From ab59d1cdabef3498bf9307f473f53f92a139f066 Mon Sep 17 00:00:00 2001 From: Ly Tempel Date: Mon, 30 Nov 2026 15:43:10 +0200 Subject: [PATCH 1/3] feat(file-dropzone,file-upload): align stories with Figma and close parity gaps with React #957 --- skills/tedi-angular/references/components.md | 32 +- .../file-dropzone.component.html | 2 +- .../file-dropzone.component.spec.ts | 406 +++++++++++++++++- .../file-dropzone/file-dropzone.component.ts | 229 +++++++--- .../file-dropzone/file-dropzone.stories.ts | 232 ++++++---- .../form/file-dropzone/file-dropzone.types.ts | 5 +- .../file-upload/file-upload.component.html | 3 +- .../file-upload/file-upload.component.spec.ts | 166 ++++++- .../form/file-upload/file-upload.component.ts | 108 +++-- .../form/file-upload/file-upload.stories.ts | 149 ++++--- .../form/file-upload/file-upload.types.ts | 3 +- .../form/file-upload/upload-results.spec.ts | 104 +++++ .../form/file-upload/upload-results.ts | 87 ++++ src/tedi/services/translation/translations.ts | 33 +- src/tedi/utils/file.util.spec.ts | 17 +- src/tedi/utils/file.util.ts | 17 +- 16 files changed, 1326 insertions(+), 267 deletions(-) create mode 100644 src/tedi/components/form/file-upload/upload-results.spec.ts create mode 100644 src/tedi/components/form/file-upload/upload-results.ts diff --git a/skills/tedi-angular/references/components.md b/skills/tedi-angular/references/components.md index 31cd1a398..58fdfdfe6 100644 --- a/skills/tedi-angular/references/components.md +++ b/skills/tedi-angular/references/components.md @@ -232,21 +232,26 @@ Both entry points declare `[tedi-floating-button]`. The Community component is the component owns the rule. No `registerOnValidatorChange` is needed — `validate()` is a pure function of the control value, which Angular already revalidates on every change. - **`tedi-file-dropzone` emits `fileRemove` alongside `filesChange`.** `filesChange` gives the new list; - `fileRemove` gives the single entry the user deleted, so an in-flight upload can be aborted or a blob - URL revoked without diffing the two arrays. + `fileRemove` gives each entry that left it — one the user deleted, the file a single-file zone + replaced, or one `duplicates="replace"` swapped out — so an in-flight upload can be aborted or a blob + URL revoked without diffing the two arrays. It fires after the list change. - **`tedi-file-dropzone` selects files, it does not upload them.** It validates against `accept` and `maxSize` and hands you the list; the upload, and setting each file's `isLoading` / `isValid` as it - progresses, is yours. A `validator` input adds a rule of your own on top, run on every selected file; + progresses, is yours. It does announce the result you report back: a listed file whose `isLoading` + ends is announced as uploaded, and one that turns invalid (`isValid: false`, or an `error`) as + failed, with its `error` as the reason. A `validator` input adds a rule of your own on top, run on every selected file; the reason it returns lands on that file's `error` after the built-in ones and joins the summary, with the files it rejected named after it. Describe the rule in `hint`, which follows the allowed types and size in the one hint. `keepRejectedFiles` decides what happens to a file that fails `accept`, `maxSize` or `validator`: off (the default) discards it and summarises every rejection in one message under the dropzone, which paints the border red. On keeps it in the list with its - reason in that file's `error` and writes no summary of its own — so the form value holds it with + reason in that file's `error` and summarises only the files it did not list — a single-file zone + keeps a valid file over a rejected one — so the form value holds a listed one with `isValid: false`, and you must drop the files marked `isValid: false` before uploading. Filter on that, not on a truthy `isValid`: a preloaded file leaves it unset, and such a file is eligible. The - dropzone's own border stays neutral, but a bound control fails on that file, so the border turns - red once the control is touched or dirty. `error` is writable, so a failure the upload came back + dropzone's own border stays neutral for a listed rejected file, but a bound control fails on it, so + the border turns red once the control is touched or dirty; a rejected file it could not list turns + it red at once. `error` is writable, so a failure the upload came back with lands on the file it belongs to. - **`tedi-file-dropzone` shows at most one hint and one validation message, error first.** Pass your own text through `hint`, `error` and `success`, not projected `tedi-feedback-text`. `error` joins @@ -256,7 +261,8 @@ Both entry points declare `[tedi-floating-button]`. The Community component is — so two different files sharing a name still both land. `duplicates` changes that: `rename` keeps both with the newcomer as `scan (1).pdf`, `replace` swaps the listed file for it. Those two match on the name alone, since that is the collision the user sees, and only a file that passes displaces its - namesake. Project an `*tediFileDropzoneFile` template to replace the built-in `tedi-attachment` row + namesake. A single-file zone always skips: the same file picked again is left alone, and any other + file replaces the one held under its own name. Project an `*tediFileDropzoneFile` template to replace the built-in `tedi-attachment` row when a file needs a progress bar, an icon or its own feedback. - **`accept`, `maxSize` and `validator` apply to what is picked next.** Files already listed keep the verdict they were given, so clear them yourself if you tighten a restriction while they are listed. @@ -275,7 +281,9 @@ Both entry points declare `[tedi-floating-button]`. The Community component is required dropzone is marked in two places: `[required]` on the label draws the asterisk, which is `aria-hidden`, and `[required]` on the dropzone adds the word to the zone's accessible name. The zone is a button, which ARIA gives no `aria-required`, and the file input behind it is hidden from - assistive technology, so the name is the only carrier left. Don't wrap it in `tedi-form-field` — + assistive technology, so the name is the only carrier left. A required dropzone therefore always + needs a visible label marked `[required]`; without one no asterisk is shown and a warning is logged + in dev mode. Only an optional dropzone can go without a label. Don't wrap it in `tedi-form-field` — that would place projected feedback after the file list rather than under the dropzone. - **The drop zone is a `div[role="button"]`, not a `