Skip to content

FSHSP-274 feat(file-upload)!: split the drop zone from the file list - #204

Merged
LBU4SH merged 1 commit into
mainfrom
breaking/FSHSP-274-file-upload-list
Dec 1, 2026
Merged

LBU4SH merged 1 commit into
mainfrom
breaking/FSHSP-274-file-upload-list

Conversation

@LBU4SH

@LBU4SH LBU4SH commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Jira: FSHSP-274. ⚠️ Breaking — migration note in the CHANGELOG [Unreleased].

ui-file-upload was both a drop zone and a list mixing picked files with server-stored ones (initialFiles, FSHSP-264). Integrated in an app that owns its list of attachments, the list existed twice and had to be kept in sync (markUploaded before adding the file, or the row showed twice). This splits the roles.

  • ui-file-upload = drop zone + picker. It only keeps the files it has not handed over yet — its queue: pending a manual upload, uploading, failed — read-only as files(). An uploaded file (built-in XHR, or markUploaded() with customUpload) leaves the queue and comes out through uploaded (now also emitted for custom uploads), completed, File kept, preview URL revoked. The zone draws no list. Built-in upload, manual toolbar, field summary, native name submission and add() all work on the queue.
  • Limits — fileLimit / maxTotalSize count the app's files through the new currentCount / currentTotalSize, plus the queue, failures left out. In single-file mode the incoming file replaces the queued one only.
  • ui-file-upload-list = the app's list. files in (stored, uploading, failed), open / remove out, showTotal + totalLabel, fileActionsTemplate, row labels passed through. storedUploadFile() turns a UiStoredFile into a row.
  • ui-file-upload-item = the former row (ui-file-upload-list), usable alone. Its --ui-file-upload-list-* hooks become --ui-file-upload-item-*.

Fixes from the ticket:

  1. openable only on a completed file — no more underlined name on a failed or uploading row.
  2. Single file: replacement is the app's, documented with a SingleFile story (zone hidden while a file is present, « Remplacer » shows it, the old file is deleted on uploaded only — a failed upload keeps it).
  3. The list total leaves failed files out, like maxTotalSize.

Removed from the zone: initialFiles, showFileList, fileTemplate, contentTemplate, fileOpen; moved to the list: showTotal, totalLabel, openable, fileActionsTemplate (fileOpen → open). Hooks --ui-file-upload-content-gap / -total-* → --ui-file-upload-list-gap / -list-total-*. Generated component-vars + figma/README.md counts, registries (READMEs EN/FR, components-index.md, Overview.mdx), AGENTS.md.

Tests: ui-file-upload.spec.ts rewritten (13 cases: queue, handover, failures outside the cap, currentCount / currentTotalSize, single-file replacement, list rows, openable on completed only, total without failures). pnpm test (469), eslint, ng build ui-kit, docs:config:check green. Rebased on main (0.17.1).

Checked in Storybook (static build + Playwright, system Chrome):

  • zone stories (Auto, Advanced, CustomUpload, StoredFiles): no list inside the zone; a picked file shows in the app list while uploading, then stays once handed over and its name becomes clickable;
  • list Default (2 stored, 1 uploading, 1 failed): only the 2 stored names are buttons, total « 3 fichiers · 3.9 MB »; removing the failed row leaves the total unchanged;
  • SingleFile: zone hidden with a file, shown after « Remplacer », old file kept during the upload and replaced on success, trash brings the zone back;
  • ImagePreview, Template, Basic (field summary), item stories;
  • axe (same pass as storybook/test-runner.ts) on the 19 stories plus 3 interaction states (uploading row, refusal messages + toolbar, « Remplacer »), light and dark: 0 violations, except the zone toolbar's low ui-button in dark mode (color-contrast 3.74:1). It reproduces on the ui-button Low story alone: a pre-existing actions.low dark token issue, out of scope here.

Not covered: no dedicated Figma component for the list (its story points to the row, 155-2563), and the Figma component-vars collection needs a re-import for the renamed hooks.

🤖 Generated with Claude Code

ui-file-upload is now only a drop zone and picker: it keeps the files it has
not handed over yet (pending, uploading, failed), exposed as files(), and hands
an uploaded file to the app through `uploaded` (custom upload included).
ui-file-upload-list becomes the app's list (files in, open/remove out, total,
row actions); the former row is renamed ui-file-upload-item.

- openable only on completed files
- the list total leaves failed files out, like maxTotalSize
- fileLimit/maxTotalSize count the app's files via currentCount/currentTotalSize
- single-file replacement left to the app, documented with a story

BREAKING CHANGE: initialFiles, showFileList, fileTemplate and contentTemplate
are removed from ui-file-upload; showTotal, totalLabel, openable and
fileActionsTemplate move to ui-file-upload-list (fileOpen becomes open). The
row selector, class and --ui-file-upload-list-* hooks are renamed to
ui-file-upload-item. See the CHANGELOG migration note.
@LBU4SH
LBU4SH merged commit d27f27c into main Dec 1, 2026
4 checks passed
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.

1 participant