[SUR-930] [Upload] No File Found placeholder should be replaced with file name#472
Open
jaieds wants to merge 2 commits into
Open
[SUR-930] [Upload] No File Found placeholder should be replaced with file name#472jaieds wants to merge 2 commits into
jaieds wants to merge 2 commits into
Conversation
Button-styled file input mirroring Input type="file" styling, with controlled value support (File, File[], or saved filename string), keyboard-accessible hidden native input, and opt-in clearable action.
Input's file branch now renders FilePicker, so existing consumers get controlled value support and the filename preview without code changes. Removes the file-only class constants that became unused.
imnavanath
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes brainstormforce/surerank#2200
Adds a new
FilePickercomponent: a button-styled file input that visually matchesInput type="file"but is built as a proper React control.<input type="file">.valuesupport:File | File[] | string | null— a previously saved filename string renders exactly like a fresh selection; picking a new file replaces it.onChange( files: FileList | null )— same callback convention asInput.clearableprop: shows a remove "X" (keyboard accessible) when a file is present; clears selection and firesonChange(null). Default suffix stays the static Upload icon, matchingInput's current file rendering.sm | md | lg,label,disabled,error,required, and native pass-through props (multiple,accept,name,id, aria attributes). Styling tokens copied verbatim fromInput's file branch.Input type="file"now delegates its rendering toFilePicker, so existing consumers automatically get the filename preview and controlledvaluesupport with no code changes (visuals verified identical; a native file input's value cannot be set programmatically, so the previous architecture could not show a saved filename). The file-only class constants ininput.tsxthat became unused were removed. No new dependencies.Note for reviewers: the file input's DOM changes from a styled native input to a button + visually-hidden native input. Form submission still works (the hidden input stays form-associated with
name/required/accept); a controlled string value is display-only, same as any custom picker. Consumer CSS targeting::file-selector-buttonwould no longer apply.Screenshots | Video with voice-over
Empty state renders
Choose File No file chosenidentically toInput type="file"(verified side-by-side in Storybook; computed styles at md are identical: 40px height,10px 40px 10px 14pxpadding, 14px font, 6px radius).Link to Figma (If applicable)
N/A — UI source of truth is the existing
Input type="file"styling.How has this been tested?
tsc -b,npm run build, andeslintall clean;vitest --project=storybookrenders all 10 stories (10/10 pass).input.click());changeevents withDataTransferfiles fireonChangewith the FileList and update the preview (single + multiple); controlled string value is replaced by a new selection; clearable X works via mouse, Enter, and Space; disabled blocks focus and clicks; error setsaria-invalid+ error outline.buttonnamed by the associatedLabel); hidden input istabIndex=-1+aria-hidden, so no double tab stop.Input type="file"at md: identical height, padding, font size, radius, background, and outline.Checklist: