Skip to content

feat(FwbInput): Add direct error message support #362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

radudiaconu0
Copy link

@radudiaconu0 radudiaconu0 commented Mar 26, 2025

  • Add errorMessage and successMessage props for direct message support
  • Fix slot validation in computed properties ($slots not available in props)
  • Add fallback for validation message slots without status
  • Implement hideDetails prop to control message visibility
  • Maintain backward compatibility with existing slot-based approach

This implementation makes error handling more versatile and similar to other libraries like Vuetify, improving developer experience while preserving existing functionality.

Summary by CodeRabbit

  • New Features
    • Enhanced input fields now display clear error and success messages during interactions.
    • Customizable options allow for tailored feedback based on input validations.
    • Introduced a new component showcasing examples of error and success messages for input fields.
    • Added documentation detailing new props for managing validation messages and visibility.

- Add errorMessage and successMessage props for direct message support
- Fix slot validation in computed properties ($slots not available in props)
- Add fallback for validation message slots without status
- Implement hideDetails prop to control message visibility
- Maintain backward compatibility with existing slot-based approach

This implementation makes error handling more versatile and
similar to other libraries like Vuetify, improving developer
experience while preserving existing functionality.
Copy link
Contributor

coderabbitai bot commented Mar 26, 2025

Walkthrough

This change enhances the FwbInput component by introducing conditional rendering for error and success messages. It adds computed properties to determine when to display these messages based on new props. Additionally, the InputProps interface has been extended with three new optional properties: errorMessage, successMessage, and hideDetails, with defaults provided via the withDefaults function. A new example component is also introduced to demonstrate these functionalities.

Changes

File(s) Change Summary
src/components/FwbInput/FwbInput.vue Added conditional sections for displaying error and success messages based on computed properties (showErrorMessage and showSuccessMessage); extended InputProps with errorMessage, successMessage, and hideDetails with default values.
docs/components/input/examples/FwbInputExampleErrorMessage.vue Introduced a new component to showcase examples of error and success messages, including dynamic validation and a toggle for hiding error details.
docs/components/input.md Added a new section titled "Error Messages" detailing the new props for validation statuses, error messages, success messages, and visibility control, along with usage examples.

Possibly related PRs

Suggested labels

🔧 enhancement

Suggested reviewers

  • Sqrcz

Poem

Oh, I’m a bunny with a skip so light,
Hopping through code with joy so bright,
Error and success now dance in view,
Props and computed, all shiny and new!
Hop along, dear devs, and let changes ensue.
🐇💻✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Mar 26, 2025

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit 4efc442
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/67e435c384d2d50008c1b12b
😎 Deploy Preview https://deploy-preview-362--sensational-seahorse-8635f8.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/components/FwbInput/FwbInput.vue (2)

120-130: Fix linting issues in computed properties

There are several linting errors in these computed properties related to trailing spaces, operator placement, and missing trailing commas.

-const showErrorMessage = computed(() => 
-  !props.hideDetails && 
-  (props.validationStatus === validationStatusMap.Error || props.errorMessage)
-)
+const showErrorMessage = computed(() => 
+  !props.hideDetails 
+  && (props.validationStatus === validationStatusMap.Error || props.errorMessage),
+)

-const showSuccessMessage = computed(() => 
-  !props.hideDetails && 
-  props.validationStatus === validationStatusMap.Success && 
-  props.successMessage
-)
+const showSuccessMessage = computed(() => 
+  !props.hideDetails 
+  && props.validationStatus === validationStatusMap.Success 
+  && props.successMessage,
+)
🧰 Tools
🪛 ESLint

[error] 121-121: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 122-122: '&&' should be placed at the beginning of the line.

(@stylistic/operator-linebreak)


[error] 122-122: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 123-124: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 126-126: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 127-127: '&&' should be placed at the beginning of the line.

(@stylistic/operator-linebreak)


[error] 127-127: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 128-128: '&&' should be placed at the beginning of the line.

(@stylistic/operator-linebreak)


[error] 128-128: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 129-130: Missing trailing comma.

(@stylistic/comma-dangle)


137-137: Add missing newline at end of file

Add a newline at the end of the file to fix the linting error.

-</script>
\ No newline at end of file
+</script>
🧰 Tools
🪛 ESLint

[error] 137-137: Newline required at end of file but not found.

(@stylistic/eol-last)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8cf7c5c and c431d1b.

📒 Files selected for processing (1)
  • src/components/FwbInput/FwbInput.vue (3 hunks)
🧰 Additional context used
🪛 ESLint
src/components/FwbInput/FwbInput.vue

[error] 121-121: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 122-122: '&&' should be placed at the beginning of the line.

(@stylistic/operator-linebreak)


[error] 122-122: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 123-124: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 126-126: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 127-127: '&&' should be placed at the beginning of the line.

(@stylistic/operator-linebreak)


[error] 127-127: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 128-128: '&&' should be placed at the beginning of the line.

(@stylistic/operator-linebreak)


[error] 128-128: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 129-130: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 137-137: Newline required at end of file but not found.

(@stylistic/eol-last)

🔇 Additional comments (5)
src/components/FwbInput/FwbInput.vue (5)

33-41: Nice improvement adding direct error message support!

The new error message section enhances usability by providing a way to display error messages with both slot and prop support. This matches the PR objective of adding direct error message support.


42-50: Good addition of success message support

The success message implementation complements the error message feature nicely, providing a consistent approach to feedback.


51-57: Great job maintaining backward compatibility

The fallback mechanism for validation message slots without status ensures backward compatibility, as mentioned in the PR objectives.


92-94: Well-documented interface extensions

The new props are clearly defined with explanatory comments that align with their purpose.


111-113: Sensible default values for new props

The default values make sense - empty strings for messages and false for hideDetails.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
docs/components/input/examples/FwbInputExampleErrorMessage.vue (2)

1-131: Fix code style issues throughout the file

This file contains multiple style issues that should be fixed to maintain consistency with the codebase:

  • Trailing whitespace on lines 4, 15, 26, 38, 46, 58, 71, 93, 96, 99, 106, 109, 118, 125
  • Inconsistent indentation in the script section (lines 94-131)
  • Missing trailing commas in objects (lines 115, 122, 128)
  • Missing newline at end of file

I recommend running ESLint to fix these issues automatically:

- <template>
-     <div class="vp-raw">
-       <h3 class="mb-3 text-lg font-medium text-gray-900 dark:text-white">Error Messages Examples</h3>
-       
+<template>
+  <div class="vp-raw">
+    <h3 class="mb-3 text-lg font-medium text-gray-900 dark:text-white">Error Messages Examples</h3>
+    
...
-  <script lang="ts" setup>
-  import { computed, ref } from 'vue'
-  
-  import { FwbCheckbox, FwbInput } from '../../../../src/index'
-  import { validationStatusMap } from '../../../../src/components/FwbInput/types'
+<script lang="ts" setup>
+import { computed, ref } from 'vue'
+
+import { validationStatusMap } from '../../../../src/components/FwbInput/types'
+import { FwbCheckbox, FwbInput } from '../../../../src/index'
...
-      return {
-        status: validationStatusMap.Error,
-        message: 'Password is required'
-      }
+      return {
+        status: validationStatusMap.Error,
+        message: 'Password is required',
+      }
...
-  </script>
+</script>
🧰 Tools
🪛 ESLint

[error] 4-4: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 15-15: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 26-26: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 38-38: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 46-46: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 58-58: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 71-71: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 93-93: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 94-94: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 95-95: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 96-96: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 97-97: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 98-98: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 98-98: ../../../../src/components/FwbInput/types import should occur before import of ../../../../src/index

(import/order)


[error] 99-99: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 100-100: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 101-101: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 102-102: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 103-103: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 104-104: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 105-105: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 106-106: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 107-107: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 108-108: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 109-109: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 110-110: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 111-111: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 112-112: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 113-113: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 114-114: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 115-115: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 115-116: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 116-116: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 117-117: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 118-118: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 119-119: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 120-120: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 121-121: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 122-122: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 122-123: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 123-123: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 124-124: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 125-125: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 126-126: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 127-127: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 128-128: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 128-129: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 129-129: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 130-130: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 131-131: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 131-131: Newline required at end of file but not found.

(@stylistic/eol-last)


97-98: Fix import order

The imports should be organized with types imported before components:

-import { FwbCheckbox, FwbInput } from '../../../../src/index'
-import { validationStatusMap } from '../../../../src/components/FwbInput/types'
+import { validationStatusMap } from '../../../../src/components/FwbInput/types'
+import { FwbCheckbox, FwbInput } from '../../../../src/index'
🧰 Tools
🪛 ESLint

[error] 97-97: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 98-98: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 98-98: ../../../../src/components/FwbInput/types import should occur before import of ../../../../src/index

(import/order)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c431d1b and 0fe66c9.

📒 Files selected for processing (1)
  • docs/components/input/examples/FwbInputExampleErrorMessage.vue (1 hunks)
🧰 Additional context used
🪛 ESLint
docs/components/input/examples/FwbInputExampleErrorMessage.vue

[error] 4-4: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 15-15: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 26-26: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 38-38: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 46-46: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 58-58: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 71-71: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 93-93: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 94-94: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 95-95: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 96-96: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 97-97: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 98-98: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 98-98: ../../../../src/components/FwbInput/types import should occur before import of ../../../../src/index

(import/order)


[error] 99-99: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 100-100: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 101-101: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 102-102: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 103-103: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 104-104: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 105-105: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 106-106: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 107-107: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 108-108: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 109-109: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 110-110: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 111-111: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 112-112: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 113-113: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 114-114: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 115-115: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 115-116: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 116-116: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 117-117: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 118-118: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 119-119: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 120-120: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 121-121: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 122-122: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 122-123: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 123-123: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 124-124: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 125-125: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 126-126: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 127-127: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 128-128: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 128-129: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 129-129: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 130-130: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 131-131: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 131-131: Newline required at end of file but not found.

(@stylistic/eol-last)

🔇 Additional comments (4)
docs/components/input/examples/FwbInputExampleErrorMessage.vue (4)

1-92: Well-structured examples demonstrating the new error message features

The template is well-organized with clear examples showcasing:

  • Direct error and success message props
  • Dynamic validation logic
  • The hide-details functionality
  • Side-by-side comparison of prop-based vs slot-based approaches

This provides excellent documentation for users learning how to implement the new features.

🧰 Tools
🪛 ESLint

[error] 4-4: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 15-15: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 26-26: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 38-38: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 46-46: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 58-58: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 71-71: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


111-130: Well-implemented form validation logic

The computed property for password validation is implemented correctly:

  • Properly checks for empty password
  • Validates password length requirements
  • Returns appropriate validation status and message

This serves as a good example of how to create dynamic validation with the new error message props.

🧰 Tools
🪛 ESLint

[error] 111-111: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


[error] 112-112: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 113-113: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 114-114: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 115-115: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 115-116: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 116-116: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 117-117: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 118-118: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 119-119: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 120-120: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 121-121: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 122-122: Expected indentation of 6 spaces but found 8.

(@stylistic/indent)


[error] 122-123: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 123-123: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 124-124: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 125-125: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 126-126: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 127-127: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 128-128: Expected indentation of 4 spaces but found 6.

(@stylistic/indent)


[error] 128-129: Missing trailing comma.

(@stylistic/comma-dangle)


[error] 129-129: Expected indentation of 2 spaces but found 4.

(@stylistic/indent)


[error] 130-130: Expected indentation of 0 spaces but found 2.

(@stylistic/indent)


40-57: Excellent example of the hideDetails prop functionality

The inclusion of a toggle to demonstrate the hideDetails prop is especially helpful. This allows users to understand how to dynamically control error message visibility, which is an important aspect of the new feature.

🧰 Tools
🪛 ESLint

[error] 46-46: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


60-90: Great comparison between old and new approaches

The side-by-side comparison of the prop-based approach vs. the slot-based approach clearly demonstrates:

  1. How the new, simpler approach works with the error-message prop
  2. How the existing slot-based approach continues to function

This effectively communicates the backward compatibility of the enhancement while highlighting the improved developer experience.

🧰 Tools
🪛 ESLint

[error] 71-71: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
docs/components/input.md (2)

248-254: Clarify the New "Error Messages" Section!
The added "Error Messages" section provides a clear summary of the new props (error-message, success-message, and hide-details). Consider adding a brief note on how these direct message props interact with traditional slot-based messages (e.g., which one has priority) to further aid developer understanding.


255-296: Comprehensive Example for Direct Message Support!
The Vue example for the FwbInput component demonstrates direct usage of error and success messages very effectively. The examples for static messages, dynamic validation via computed properties, and the hide-details usage provide a holistic overview for developers. As a minor nitpick, consider adding a short inline comment in the template to point out that the fallback mechanism for slot content will be used when the direct message props are absent, which might help some users.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0fe66c9 and e44869a.

📒 Files selected for processing (1)
  • docs/components/input.md (1 hunks)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
docs/components/input.md (2)

107-112: New "Error Messages" Section – Clear Documentation
The new section clearly outlines the usage of the validationStatus, error-message, success-message, and hide-details props. One minor suggestion: for improved grammatical clarity, consider adding a definite article in the bullet points (e.g., “Set the validation status via…”).

🧰 Tools
🪛 LanguageTool

[uncategorized] ~109-~109: You might be missing the article “the” here.
Context: ...r Messages - Set validation status via validationStatus prop, which accepts `'...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


113-156: Comprehensive Example for Error and Success Messages
The example template does an excellent job of demonstrating various use cases including direct error messages, success messages, conditional validation via computed properties, and the usage of the hide-details prop. The structured presentation makes it easier for developers to understand how to integrate these new features. Consider adding brief inline comments within the template sections to highlight the different scenarios for extra clarity to readers.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e44869a and 4efc442.

📒 Files selected for processing (1)
  • docs/components/input.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/components/input.md

[uncategorized] ~109-~109: You might be missing the article “the” here.
Context: ...r Messages - Set validation status via validationStatus prop, which accepts `'...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

🪛 markdownlint-cli2 (0.17.2)
docs/components/input.md

174-174: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

🔇 Additional comments (1)
docs/components/input.md (1)

157-174: Well-Structured Script Block for Validation Handling
The script block, which sets up reactive variables and the computed property passwordError, is concise and follows standard Vue practices. This makes the form validation example easy to understand and maintain. No changes are necessary here.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

174-174: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

@Sqrcz Sqrcz self-assigned this Mar 26, 2025
@Sqrcz Sqrcz added 📚 documentation Improvements or additions to documentation 🔧 enhancement New feature or request labels Mar 26, 2025
@Sqrcz
Copy link
Collaborator

Sqrcz commented Apr 17, 2025

Hey @radudiaconu0 👋

First of all... thank you for your input 🎉

I'm not against... ;) I may be missing some context.
Can you please explain me where previous implementation was limited?

Is it just to replace slots usage in favor od props?

Why not one validationMessage prop... there shouldn't be a case when both (error and success) are shown.

If I understand correctly usage could be improved from slots to props something like this: (but you're not removing validationMessage slot... why?)

<!-- from -->
<fwb-input
  v-model="form.password"
  label="Nazwa"
  :validation-status="form.errors.password ? 'error' : undefined"
  class="bg-gray-50 rounded-sm"
  wrapper-class="col-span-3"
>
  <template
    v-if="form.errors.password"
    #validationMessage
  >
    {{ form.errors.password }}
  </template>
</fwb-input>

<!-- to -->
<fwb-input
  v-model="form.password"
  label="Password"
  :validation-status="form.errors.password ? 'error' : 'success'"
  :validation-message="form.errors.password ? form.errors.password : 'Password meets requirements'"
/>

Why we would need separated error and success messages?
Why we would need hideDetails prop... wouldn't it be enough to check if validationMessage is empty or not?

Copy link
Collaborator

@Sqrcz Sqrcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey,

Please respond to my comment in the main PR thread... and we have few conflicts now... 🙈

- Add success messages directly via `success-message` prop.
- Control visibility of messages with the `hide-details` prop.

<fwb-input-example-error-message />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not imported and results in an error:
[Vue warn]: Failed to resolve component: fwb-input-example-error-message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Improvements or additions to documentation 🔧 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants