Skip to content

Update FileChooser examples for the redesigned component#860

Merged
lbwexler merged 21 commits into
developfrom
upgradeDropzone
Jun 4, 2026
Merged

Update FileChooser examples for the redesigned component#860
lbwexler merged 21 commits into
developfrom
upgradeDropzone

Conversation

@amcclain

@amcclain amcclain commented Jun 3, 2026

Copy link
Copy Markdown
Member

Companion to the FileChooser redesign in xh/hoist-react#4385 - updates the Toolbox examples to the new FileChooserModel config API and demonstrates the new display options.

  • Updated the FileChooser example (Other › FileChooser) and the File Manager example to the redesigned API (model-config accept / maxFiles / maxFileSize, onDropAsync, and the emptyDisplay / fileDisplay content props).
  • Added live controls to the FileChooser example for accepted types (picker), max files, max file size, and the multi-file drop-target placement (dropTargetPlacement) - re-creating the chooser on config change.
  • Added a second single-image example using a custom fileDisplay that previews the selected PNG in place, with a replace / clear footer.

Should be merged in coordination with xh/hoist-react#4385, as the examples consume the new API.

PeteDarinzo and others added 18 commits November 26, 2024 13:08
Adopts the new `Accept` object form for the `FileChooser.accept` prop,
keyed by MIME type with extension arrays as values.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Resolved FileChooser-caller conflicts in favor of the redesign usage:
- FileChooserPanel: kept the no-prop fileChooser() form (develop's side was the
  prior enableMulti/showFileGrid/targetText design).
- FileManagerModel: kept both develop's telemetryPrefix and the branch's
  acceptedFileTypes; dropped stale post-runner load code (now handled inside the
  CallContext runner block) and the orphaned isEmpty import.
Add toolbar controls for accepted types (picker), max files, and max file
size that re-create the chooser on change - letting the empty-state hint be
exercised across different configurations.
amcclain and others added 3 commits June 3, 2026 15:07
- Added a `Target` segmented control (left / top / hidden) exercising the new
  `dropTargetPlacement` prop; split the demo into config / image sub-panels.
- Added a second single-image chooser demonstrating a custom `fileDisplay` that
  previews the selected PNG in place, with a replace / clear footer.
- Example panels defend their size (wrapper scrolls) and show a 1px border.
Convert the section-banner / line comments above the demo factories
(configChooserPanel, imageChooserPanel, imagePreview) to JSDoc doc comments.
@jskupsik jskupsik self-requested a review June 4, 2026 13:53
lbwexler added a commit to xh/hoist-react that referenced this pull request Jun 4, 2026
Comprehensive redesign of `FileChooser`, building on the react-dropzone
`15.x` upgrade already on `develop` (via #4381).

**Companion Toolbox PR:** xh/toolbox#860

### Highlights
- **Configuration moved to `FileChooserModel`** — `accept`, file-size
limits, and other options are now set on the model constructor rather
than as component props.
- **Empty & single-file states** — the empty target is
click-anywhere-to-browse, with a prompt and an auto-derived hint
summarizing accepted types / size limits. In single-file mode
(`maxFiles: 1`) a selected file renders as a compact card (type-specific
icon, name, size) that doubles as a replace target plus a remove action,
rather than a one-row grid.
- **Multi-file state** — once files are selected, a persistent drop
target sits alongside the grid so users can keep adding files; placement
is set via the `dropTargetPlacement` prop (`left` / `top` / `hidden`),
and it disables clearly at the `maxFiles` limit.
- **Customizable display API** — new `emptyDisplay` / `fileDisplay`
content props replace the former `targetText` / `showFileGrid`. Default
`fileDisplay` is a file grid, or the single-file card when `maxFiles` is
1.
- **New capabilities** — `maxFiles` limit (#3570), `onFileAccepted` /
`onFileRejected` callbacks, configurable rejection toasts, `maskOnDrag`
/ `maskOnDisabled`, and a programmatic `openFileBrowser()`.
- **API changes** — renamed `maxSize`/`minSize` →
`maxFileSize`/`minFileSize`; removed `enableMulti`/`enableAddMulti` (use
`maxFiles`);

Also caught the branch up with `develop` and fixed a `filesize` v11
named-import bug. See CHANGELOG for breaking-change details.

---------

Co-authored-by: petedarinzo <peter.darinzo@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Anselm McClain <atm@xh.io>
@lbwexler lbwexler merged commit 9fab876 into develop Jun 4, 2026
8 checks passed
@lbwexler lbwexler deleted the upgradeDropzone branch June 4, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants