File dropzone - Add custom error messages for validation#1080
File dropzone - Add custom error messages for validation#1080prashanthr6383 wants to merge 2 commits into
Conversation
|
There was a problem hiding this comment.
Pull request overview
Adds support for custom, per-validation error messaging in modus-wc-file-dropzone, allowing consumers to override default validation messages for invalid type, name, size, and count.
Changes:
- Introduces a new
errorMessagesprop (typed asIFileDropzoneErrorMessages) and wires it into the internalgetErrorMessage()fallback logic. - Updates Storybook examples to demonstrate setting
errorMessages(including a docs snippet showing property assignment). - Adds Jest tests to verify custom message selection and fallback behavior (including legacy
invalidFileTypeMessagefallback).
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/modus-wc-file-dropzone/modus-wc-file-dropzone.tsx | Adds IFileDropzoneErrorMessages + errorMessages prop and uses it in validation messaging fallbacks. |
| src/components/modus-wc-file-dropzone/modus-wc-file-dropzone.stories.ts | Documents and demonstrates errorMessages usage in Storybook (controls + example). |
| src/components/modus-wc-file-dropzone/modus-wc-file-dropzone.spec.ts | Adds tests covering custom error message selection and fallback behavior. |
| src/components/modus-wc-file-dropzone/readme.md | Updates auto-generated docs to include the new errorMessages prop. |
| src/custom-elements.json | Updates custom elements manifest to include error-messages. |
| src/components.d.ts | Updates generated typings to export and surface IFileDropzoneErrorMessages on the component. |
There was a problem hiding this comment.
The current implementation provides the ability to customize existing error state messages, but it does not support customizing the error state behavior itself.
Because of this limitation, it does not address the issue mentioned. They are trying to display an error state when uploads across multiple instances collectively exceed the maximum allowed count. However, with the current implementation, the count resets on each upload action, so this error state is not triggered.
@Sunder005 is this the expectation?
📄 Summary of Changes
invalid type, invalid size. invalid name, invalid count
💭 Type of Change
📋 Test Plan
✅ Self Code Review Checklist
PR authors and reviewers, please verify that all of these items have been completed.
🔗 Work Item
Issue #1064