Add FileInput component to utah-design-system#562
Conversation
|
@copilot When I click on the upload area, nothing happens and I get this warning in the console: PressResponder.tsx:45 A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with component. |
Fixed in commit 4ac30a7. The issue was that |
|
@copilot You inadvertantly added the tsc .js output files. Please remove them. |
Removed in commit 32a1c98. Deleted 102 .js files and 2 .tsbuildinfo files that were TypeScript compilation outputs. Also updated .gitignore to prevent these files from being tracked in the future by adding patterns for:
|
|
@copilot Drag and drop isn't working. Please implement this: https://react-spectrum.adobe.com/react-aria/dnd.html |
Implemented in commit 1c009dd. Added drag and drop functionality using React Aria's
|
|
Visit the preview URL for this PR (updated for commit 3a625c1): |
There was a problem hiding this comment.
Pull request overview
This PR adds a new FileInput component to the utah-design-system package, implementing file upload functionality with drag-and-drop support, file type restrictions, and validation capabilities.
Key Changes
- Implemented FileInput component using react-aria-components' FileTrigger and DropZone with full accessibility support
- Added comprehensive Storybook stories demonstrating various states and use cases including React Hook Form integration
- Updated build configuration to properly handle TypeScript compiled output
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/utah-design-system/src/components/FileInput.tsx | New FileInput component with drag-and-drop, file selection, and validation features |
| packages/utah-design-system/src/components/FileInput.stories.tsx | Comprehensive Storybook stories for all FileInput states and use cases |
| packages/utah-design-system/src/index.ts | Export FileInput component from package entry point |
| .gitignore | Added TypeScript compiled output patterns to prevent committing generated files |
| package-lock.json | Updated MSW optional dependency metadata with dev flags |
| public/mockServiceWorker.js | Auto-generated MSW service worker update (v2.10.2 → v2.12.2) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@steveoh What do you think about this? I think that it's pretty good but I'm not sure that it's great yet. |
77743aa to
a0faffa
Compare
…DropZone - Added DropZone component from react-aria-components to enable drag and drop - Implemented handleDrop function to process dropped files - Added visual feedback with isDropTarget state (border and background color change) - Files are filtered by acceptedFileTypes and allowsMultiple settings - Drop zone highlights when files are dragged over it Co-authored-by: stdavis <1326248+stdavis@users.noreply.github.com>
a0faffa to
373eee2
Compare
also moved the description to where the dts uds has it
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 5 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Scott Davis <stdavis@utah.gov>
- Implemented matchesAcceptedType function to support wildcard MIME types (e.g., image/*, video/*) - Updated handleDrop to use wildcard matching for file type filtering - Added ValidationResult support to errorMessage prop type for consistency with other form components - Error message can now be a function that receives ValidationResult parameter Co-authored-by: steveoh <325813+steveoh@users.noreply.github.com>
Head branch was pushed to by a user without write access

Creating FileInput component for utah-design-system package
Implementation Plan:
Screenshots
FileInput Documentation in Storybook
Multiple Files Example
WRI Integration Example
Implementation Details
The FileInput component has been successfully implemented with the following features:
FileTriggerandDropZonefor robust accessibility and drag-and-drop supportallowsMultiplepropacceptedFileTypesprop to restrict file types with full wildcard MIME type support (e.g.,image/*for all images,video/*for all videos, or specific types likeimage/png)onSelectcallback when files are added, removed, or clearedValidationResultfunction forms for consistency with other form components (TextField, TextArea, etc.)All 12 story examples are working correctly in Storybook, demonstrating various use cases and states.
Security Summary
No security vulnerabilities were found during CodeQL analysis.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.