Repository navigation
FSHSP-274 feat(file-upload)!: split the drop zone from the file list - #204
Merged
Merged
Conversation
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.
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.
Jira: FSHSP-274.⚠️ Breaking — migration note in the CHANGELOG
[Unreleased].ui-file-uploadwas 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 (markUploadedbefore 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 asfiles(). An uploaded file (built-in XHR, ormarkUploaded()withcustomUpload) leaves the queue and comes out throughuploaded(now also emitted for custom uploads),completed,Filekept, preview URL revoked. The zone draws no list. Built-in upload, manual toolbar,fieldsummary, nativenamesubmission andadd()all work on the queue.fileLimit/maxTotalSizecount the app's files through the newcurrentCount/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.filesin (stored, uploading, failed),open/removeout,showTotal+totalLabel,fileActionsTemplate, row labels passed through.storedUploadFile()turns aUiStoredFileinto 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:
openableonly on acompletedfile — no more underlined name on a failed or uploading row.SingleFilestory (zone hidden while a file is present, « Remplacer » shows it, the old file is deleted onuploadedonly — a failed upload keeps it).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-*. Generatedcomponent-vars+figma/README.mdcounts, registries (READMEs EN/FR,components-index.md,Overview.mdx),AGENTS.md.Tests:
ui-file-upload.spec.tsrewritten (13 cases: queue, handover, failures outside the cap,currentCount/currentTotalSize, single-file replacement, list rows, openable oncompletedonly, total without failures).pnpm test(469), eslint,ng build ui-kit,docs:config:checkgreen. Rebased onmain(0.17.1).Checked in Storybook (static build + Playwright, system Chrome):
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;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;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 lowui-buttonin dark mode (color-contrast 3.74:1). It reproduces on theui-buttonLow story alone: a pre-existingactions.lowdark 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 Figmacomponent-varscollection needs a re-import for the renamed hooks.🤖 Generated with Claude Code