@reliability-design/web 1.4.9 → 1.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +155 -2
- package/custom-elements.json +18600 -0
- package/dist/components/rel-accordion/README.md +9 -2
- package/dist/components/rel-alert/README.md +4 -7
- package/dist/components/rel-autocomplete/README.md +209 -209
- package/dist/components/rel-avatar/README.md +228 -118
- package/dist/components/rel-breadcrumb/README.md +1 -0
- package/dist/components/rel-button/README.md +9 -9
- package/dist/components/rel-calendar/README.md +111 -109
- package/dist/components/rel-cardmedia/README.md +1 -1
- package/dist/components/rel-carousel/README.md +187 -187
- package/dist/components/rel-checkbox/README.md +159 -147
- package/dist/components/rel-chip/README.md +141 -138
- package/dist/components/rel-container/README.md +1 -1
- package/dist/components/rel-date-picker/README.md +221 -206
- package/dist/components/rel-drawer/README.md +4 -4
- package/dist/components/rel-kbd/README.md +188 -141
- package/dist/components/rel-layout/README.md +34 -34
- package/dist/components/rel-menu/README.md +17 -10
- package/dist/components/rel-menubar/README.md +218 -218
- package/dist/components/rel-otp/README.md +4 -8
- package/dist/components/rel-pagination/README.md +141 -100
- package/dist/components/rel-popover/README.md +220 -203
- package/dist/components/rel-radio/README.md +142 -131
- package/dist/components/rel-range-picker/README.md +194 -171
- package/dist/components/rel-resizable/README.md +220 -199
- package/dist/components/rel-segmented-button/README.md +158 -157
- package/dist/components/rel-select/README.md +20 -17
- package/dist/components/rel-sheet/README.md +3 -2
- package/dist/components/rel-signature-pad/README.md +161 -0
- package/dist/components/rel-slider/README.md +140 -131
- package/dist/components/rel-snackbar/README.md +170 -168
- package/dist/components/rel-split-button/README.md +129 -0
- package/dist/components/rel-stepper/README.md +171 -171
- package/dist/components/rel-switch/README.md +122 -117
- package/dist/components/rel-tab/README.md +184 -174
- package/dist/components/rel-textfield/README.md +21 -28
- package/dist/components/rel-time-picker/README.md +188 -170
- package/dist/components/rel-toast/README.md +20 -11
- package/dist/components/rel-tooltip/README.md +5 -4
- package/dist/components/rel-tree/README.md +157 -0
- package/dist/components/rel-upload/README.md +8 -5
- package/dist/index.d.mts +1602 -624
- package/dist/index.d.ts +1602 -624
- package/dist/index.js +11755 -6673
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10955 -5880
- package/dist/index.mjs.map +1 -1
- package/dist/styles/motion.css +31 -0
- package/dist/styles/motion.tokens.json +38 -0
- package/dist/styles/vars.css +88 -64
- package/dist/{vars-DXX6QOAG.css → vars-E22LYFMV.css} +88 -64
- package/package.json +60 -37
- package/dist/styles/focus-ring.ts +0 -84
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# rel-tree
|
|
2
|
+
|
|
3
|
+
<!-- @unreleased-component 1.5.0 -->
|
|
4
|
+
|
|
5
|
+
A hierarchical list whose parents expand and collapse (Figma "Nested Tree"). Each entry in `items` renders as a 24px row: hierarchy guides in the indentation, a caret on parents, a checkbox in `multiple` mode, an optional icon, and a one-line label that truncates with an ellipsis. The tree follows the WAI-ARIA Tree View pattern: it is one Tab stop, and the arrow keys move between rows and expand or collapse them. Use it for file browsers, nested navigation, or any data with more than two levels. Use `rel-accordion` for a few collapsible sections of content, and `rel-menu` for a list of actions.
|
|
6
|
+
|
|
7
|
+
The tree has no background, padding or radius of its own. Place it inside the surface that hosts it, such as a card, a side panel or a drawer.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<!-- Items are set as a property; `selected` holds the selected value -->
|
|
13
|
+
<rel-tree id="files" field-aria-label="Project files" selected="button"></rel-tree>
|
|
14
|
+
<script>
|
|
15
|
+
document.getElementById('files').items = [
|
|
16
|
+
{ value: 'src', label: 'src', icon: 'document', expanded: true, children: [
|
|
17
|
+
{ value: 'button', label: 'button.ts', icon: 'document' },
|
|
18
|
+
{ value: 'card', label: 'card.ts', icon: 'document' }
|
|
19
|
+
] },
|
|
20
|
+
{ value: 'package', label: 'package.json', icon: 'document' }
|
|
21
|
+
];
|
|
22
|
+
document.getElementById('files').addEventListener('rel-change', (e) => {
|
|
23
|
+
console.log('selected', e.detail.value);
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<!-- Multiple selection: a checkbox on every row; checking a parent checks its subtree -->
|
|
28
|
+
<rel-tree id="scope" selection="multiple" field-aria-label="Folders to sync"></rel-tree>
|
|
29
|
+
<script>
|
|
30
|
+
const scope = document.getElementById('scope');
|
|
31
|
+
scope.items = [
|
|
32
|
+
{ value: 'docs', label: 'docs', expanded: true, children: [
|
|
33
|
+
{ value: 'guides', label: 'guides' },
|
|
34
|
+
{ value: 'api', label: 'api' }
|
|
35
|
+
] },
|
|
36
|
+
{ value: 'assets', label: 'assets' }
|
|
37
|
+
];
|
|
38
|
+
scope.selectedValues = ['guides']; // docs shows the indeterminate glyph
|
|
39
|
+
scope.addEventListener('rel-change', (e) => {
|
|
40
|
+
console.log('checked', e.detail.value); // e.g. ['docs', 'guides', 'api']
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<!-- Lazy children: load a branch the first time it opens -->
|
|
45
|
+
<rel-tree id="remote" field-aria-label="Remote folders"></rel-tree>
|
|
46
|
+
<script>
|
|
47
|
+
const remote = document.getElementById('remote');
|
|
48
|
+
remote.items = [{ value: 'home', label: 'home', lazy: true }];
|
|
49
|
+
remote.addEventListener('rel-load-children', async (e) => {
|
|
50
|
+
const item = findItem(remote.items, e.detail.value); // your own lookup
|
|
51
|
+
item.children = await fetchFolder(e.detail.value); // [] when it has none
|
|
52
|
+
remote.items = [...remote.items]; // assign again to re-render
|
|
53
|
+
});
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<!-- Navigation only: no selection, Enter and clicks on a parent expand or collapse it -->
|
|
57
|
+
<rel-tree selection="none" field-aria-label="Sections"
|
|
58
|
+
items='[{"value":"a","label":"Getting started","children":[{"value":"a1","label":"Install"}]}]'>
|
|
59
|
+
</rel-tree>
|
|
60
|
+
|
|
61
|
+
<!-- Without the hierarchy guides (the indentation stays) -->
|
|
62
|
+
<rel-tree show-guides="false" field-aria-label="Outline"></rel-tree>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
In `multiple` mode the check cascades. Checking a parent checks every enabled descendant, and unchecking it clears them; disabled rows keep their state. A parent is checked when all of its children are, unchecked when none are, and indeterminate otherwise. `selected-values` lists every checked value, parents included. When you set it, a parent's value checks its whole subtree, and the array is rewritten in that full form.
|
|
66
|
+
|
|
67
|
+
A `lazy` item has a caret while its `children` is undefined. Expanding it (by the user, by `expanded: true` or through `expanded-values`) fires `rel-load-children` once and marks the row `aria-busy="true"`. Set the item's `children` and assign `items` again: the row stays open and shows them. An empty array makes the item a leaf. In `multiple` mode, children that load under a checked item arrive checked.
|
|
68
|
+
|
|
69
|
+
`expanded-values` holds the values of the open parents. It is seeded from the items' `expanded` flags and updated on every expand or collapse; set it to control expansion, or call `expandAll()` / `collapseAll()`.
|
|
70
|
+
|
|
71
|
+
<!-- readme-gen:start -->
|
|
72
|
+
|
|
73
|
+
<!-- Generated from rel-tree.ts — do not edit; run readme-generate.mjs -->
|
|
74
|
+
|
|
75
|
+
## API
|
|
76
|
+
|
|
77
|
+
### Attributes / Properties
|
|
78
|
+
|
|
79
|
+
| Property | Attribute | Type | Default | Description |
|
|
80
|
+
| --- | --- | --- | --- | --- |
|
|
81
|
+
| `items` | `items` | `TreeItem[]` | `[]` | The tree's items, each `{ value, label, icon?, children?, expanded?, disabled?, lazy? }`. Set as a property or as a JSON array attribute. |
|
|
82
|
+
| `selection` | `selection` | `"single" \| "multiple" \| "none"` | `"single"` | Selection mode: `single` (default; the selected row has the Figma Active style and `aria-selected="true"`), `multiple` (a checkbox on every row, see `selected-values`) or `none` (navigation only: Enter, Space and clicks on a parent row expand or collapse it). Reflected. |
|
|
83
|
+
| `selected` | `selected` | `string` | `""` | `value` of the selected item in `single` mode; `""` when nothing is selected. Updated on every user selection. |
|
|
84
|
+
| `selectedValues` | `selected-values` | `string[]` | `[]` | Values of the checked items in `multiple` mode. Checking a parent checks every enabled descendant and unchecking it clears them; a parent is checked when all its children are, and shows the indeterminate glyph (`aria-checked="mixed"`) when only some are. The array lists every checked value, parents included, and is rewritten in that form when you set it: a parent's value checks its whole subtree. |
|
|
85
|
+
| `expandedValues` | `expanded-values` | `string[]` | `[]` | Values of the expanded parents. Seeded from the items' `expanded` flags, updated whenever the user expands or collapses a row; set it to control expansion. |
|
|
86
|
+
| `showGuides` | `show-guides` | `boolean` | `true` | Draws the hierarchy guides (│ ├ └) in the indentation. On by default; `show-guides="false"` hides them and keeps the indentation. Reflected. |
|
|
87
|
+
| `fieldAriaLabel` | `field-aria-label` | `string` | `undefined` | Accessible name of the tree. The tree renders no visible label of its own, so set this (a console warning names trees without one). |
|
|
88
|
+
|
|
89
|
+
### Methods
|
|
90
|
+
|
|
91
|
+
| Method | Signature | Description |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| `expandAll` | `expandAll()` | Expands every parent that has children (lazy items whose children have not been loaded stay closed). |
|
|
94
|
+
| `collapseAll` | `collapseAll()` | Collapses every parent. |
|
|
95
|
+
|
|
96
|
+
## Events
|
|
97
|
+
|
|
98
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
99
|
+
| --- | --- | --- | --- |
|
|
100
|
+
| `rel-change` | `{ value: [...this.selectedValues] } / { value: item.value }` | bubbles / composed | The user changed the selection with Enter, Space or a click: picked a row in `single` mode (detail `{ value: string }`) or checked / unchecked one in `multiple` mode (detail `{ value: string[] }`, the new `selected-values`). |
|
|
101
|
+
| `rel-expanded-change` | `{ value: item.value, expanded }` | bubbles / composed | The user expanded or collapsed a parent. Detail: `{ value: string; expanded: boolean }`. |
|
|
102
|
+
| `rel-load-children` | `{ value }` | bubbles / composed | A `lazy` item without `children` was expanded (by the user, `expanded` or `expanded-values`). Load its children, set them on the item and assign `items` again. Fired once per item until its children arrive. Detail: `{ value: string }`. |
|
|
103
|
+
|
|
104
|
+
## Slots
|
|
105
|
+
|
|
106
|
+
| Slot | Description |
|
|
107
|
+
| --- | --- |
|
|
108
|
+
| — | This element has no slots. |
|
|
109
|
+
|
|
110
|
+
## CSS Parts
|
|
111
|
+
|
|
112
|
+
| Part | Description |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `item` | Each `role="treeitem"` element; it contains the item's row and, when expanded, the group of its children. |
|
|
115
|
+
| `row` | The visible row of an item (guides, caret, checkbox, icon, label). Carries the hover, pressed, selected and focus styles. |
|
|
116
|
+
| `guide` | One hierarchy-guide column, one per level of indentation. |
|
|
117
|
+
| `caret` | The expand / collapse caret of a parent row. |
|
|
118
|
+
| `checkbox` | The check glyph of a row in `multiple` mode (Figma .Check Control: unchecked, checked, indeterminate). |
|
|
119
|
+
| `icon` | The optional leading icon. |
|
|
120
|
+
| `label` | The label text. |
|
|
121
|
+
| `group` | The `role="group"` list that holds an expanded item's children. |
|
|
122
|
+
| `tree` | The `role="tree"` list. |
|
|
123
|
+
|
|
124
|
+
## Tokens / CSS Variables
|
|
125
|
+
|
|
126
|
+
### Component hooks
|
|
127
|
+
|
|
128
|
+
Set these on the host (or an ancestor) to customise the element without touching design tokens.
|
|
129
|
+
|
|
130
|
+
| Custom property | Default | Description |
|
|
131
|
+
| --- | --- | --- |
|
|
132
|
+
| `--rel-tree-guide-color` | `var(--rel-border-subtle)` | Colour of the hierarchy guides (default `var(--rel-border-subtle)`). |
|
|
133
|
+
| `--rel-tree-indent` | `24px` | Width of one level of indentation, one guide column (default 24px). |
|
|
134
|
+
| `--rel-tree-row-height` | `24px` | Row height (default 24px, Figma .Tree Item). |
|
|
135
|
+
|
|
136
|
+
<!-- readme-gen:end -->
|
|
137
|
+
|
|
138
|
+
## Accessibility
|
|
139
|
+
|
|
140
|
+
- The tree needs an accessible name: set `field-aria-label`. The component logs a console warning when it has none.
|
|
141
|
+
- Rows are `role="treeitem"` elements with `aria-level`, `aria-posinset`, `aria-setsize`, `aria-expanded` (parents only), `aria-selected` (single mode), `aria-checked` (`true`, `false` or `mixed`, multiple mode) `aria-disabled` and, while a lazy item loads, `aria-busy`. In multiple mode the tree carries `aria-multiselectable="true"`. Each row is named by its label alone; the caret, checkbox glyph, icon and guides are hidden from assistive technology.
|
|
142
|
+
- The focused row shows an inset 2px focus ring. In forced-colours mode the selected row uses `Highlight` and the guides use `CanvasText`.
|
|
143
|
+
|
|
144
|
+
### Keyboard
|
|
145
|
+
|
|
146
|
+
| Key | Action |
|
|
147
|
+
| --- | --- |
|
|
148
|
+
| Tab / Shift+Tab | Moves focus into or out of the tree (one Tab stop, on the selected row, or the first row) |
|
|
149
|
+
| Down / Up | Next / previous visible row |
|
|
150
|
+
| Right | Expands a closed parent; on an open parent, moves to its first child |
|
|
151
|
+
| Left | Collapses an open parent; otherwise moves to the parent |
|
|
152
|
+
| Home / End | First / last visible row |
|
|
153
|
+
| Enter / Space | Selects the row (`selection="single"`), checks or unchecks it (`selection="multiple"`), or expands or collapses a parent (`selection="none"`) |
|
|
154
|
+
| `*` | Expands every sibling of the focused row |
|
|
155
|
+
| Typing a letter | Moves to the next row whose label starts with the typed text |
|
|
156
|
+
|
|
157
|
+
In a right-to-left context, Right and Left swap and the guides and carets mirror. Disabled rows stay focusable, so the keyboard can reach and read them, but they cannot be selected, checked or expanded.
|
|
@@ -43,7 +43,7 @@ File upload: `<rel-upload>` renders the dropzone, the format / size hint, the st
|
|
|
43
43
|
// Any transport works; honour `signal` so Cancel aborts, call `onProgress(loaded, total)` for the bar.
|
|
44
44
|
await putWithProgress('/api/photos', file, { signal, onProgress });
|
|
45
45
|
};
|
|
46
|
-
photos.addEventListener('rel-complete', (e) => {
|
|
46
|
+
photos.addEventListener('rel-upload-complete', (e) => {
|
|
47
47
|
console.log('done', e.detail.succeeded.length, 'failed', e.detail.failed.length);
|
|
48
48
|
});
|
|
49
49
|
</script>
|
|
@@ -91,11 +91,12 @@ File upload: `<rel-upload>` renders the dropzone, the format / size hint, the st
|
|
|
91
91
|
| `accept` | `accept` | `string` | `""` | Comma-separated accept list, e.g. ".pdf,.png,.jpg" or "image/*". |
|
|
92
92
|
| `maxSize` | `max-size` | `string` | `""` | Max size per file as a human string ("10MB", "500kb"). Empty → no limit. |
|
|
93
93
|
| `multiple` | `multiple` | `boolean` | `false` | Allow more than one file. |
|
|
94
|
+
| `maxFiles` | `max-files` | `number` | `0` | New in 1.5.0. With `multiple`, the most files the list may hold; `0` (the default) means no limit. Files beyond it become error rows ("only 5 files allowed") and `rel-invalid` rejections with `reason: "count"`. Rows already in the list count first, then new files in selection order; rows rejected by `accept`, `max-size` or the limit hold no place. `retry()` checks the limit again, so removing rows lets a rejected one through. Ignored without `multiple` (one file at a time). |
|
|
94
95
|
| `disabled` | `disabled` | `boolean` | `false` | Disables the whole control. Reflected. |
|
|
95
96
|
| `hint` | `hint` | `string` | `""` | Overrides the derived "PDF, PNG or JPG - up to 10 MB per file" hint. |
|
|
96
97
|
| `dropzoneTitle` | `dropzone-title` | `string` | `"Drag and drop your files here"` | Dropzone headline. |
|
|
97
98
|
| `browseLabel` | `browse-label` | `string` | `"Browse files"` | Browse button label. |
|
|
98
|
-
| `files` | — | `UploadFile[]` | `[]` | The file list. Set it to drive the component in controlled mode; the component also maintains it itself as files are added and removed. Property only. |
|
|
99
|
+
| `files` | — | `UploadFile[]` | `[]` | The file list. Set it to drive the component in controlled mode; the component also maintains it itself as files are added and removed. A row whose `file` is an image (`image/*`) shows a 40px preview in place of the file icon (new in 1.5.0); its object URL is revoked when the row leaves the list and when the element disconnects. Property only. |
|
|
99
100
|
| `uploader` | — | `(file: File, ctx: UploaderContext) => Promise<void>` | `undefined` | Supply an `Uploader` `(file, { file, signal, onProgress }) => Promise<void>` to switch to self-driving mode: the component runs the batch itself with `concurrency`, progress, the delay alert, abort and retry. Unset (default) the component only emits intents. Property only. |
|
|
100
101
|
| `concurrency` | `concurrency` | `number` | `3` | Max files transferred at once in self-driving mode. |
|
|
101
102
|
| `delayThreshold` | `delay-threshold` | `number` | `15000` | ms of continuous uploading before the "taking longer than usual" alert. |
|
|
@@ -125,16 +126,18 @@ File upload: `<rel-upload>` renders the dropzone, the format / size hint, the st
|
|
|
125
126
|
| --- | --- | --- | --- |
|
|
126
127
|
| `rel-cancel` | — | bubbles / composed | Fired when Cancel is pressed (or `cancel()` is called); in-flight transfers are aborted, the list is kept. No detail. |
|
|
127
128
|
| `rel-change` | `{ files: this.files }` | bubbles / composed | Fired whenever the file list changes (files added, a row removed, `reset()`). Detail: `{ files: UploadFile[] }`. |
|
|
128
|
-
| `rel-complete` | `{ succeeded: this.files.filter((f) => f.status === "success"), failed: this.failedFiles, }` | bubbles / composed | Fired when the whole self-driving batch settles without being cancelled. Detail: `{ succeeded: UploadFile[], failed: UploadFile[] }
|
|
129
|
+
| `rel-complete` | `{ succeeded: this.files.filter((f) => f.status === "success"), failed: this.failedFiles, }` | bubbles / composed | Deprecated: use `rel-upload-complete`, which fires once per batch in both modes; removed in 3.0. It still fires as before, and listening for it logs a one-time console warning. Fired when the whole self-driving batch settles without being cancelled. Detail: `{ succeeded: UploadFile[], failed: UploadFile[] }` (every success and error row in the list). Self-driving mode only; `rel-upload-complete` covers both modes. |
|
|
129
130
|
| `rel-file-complete` | `{ id: item.id, file: item.file }` | bubbles / composed | Fired when one file finishes uploading in self-driving mode. Detail: `{ id: string, file: File }`. |
|
|
130
131
|
| `rel-file-error` | `{ id: item.id, file: item.file, error: message }` | bubbles / composed | Fired when one file's `uploader` rejects in self-driving mode. Detail: `{ id: string, file: File, error: string }`. |
|
|
132
|
+
| `rel-file-replaced` | `{ name: previous.name, previous, next }` | bubbles / composed | New in 1.5.0. Fired once per list entry that a newly picked file with the same name replaced (the replace itself is unchanged: names stay unique). The component also announces it and shows an info notice in its alert slot. Detail: `{ name: string, previous: UploadFile, next: UploadFile }`. |
|
|
131
133
|
| `rel-files-added` | `{ added, rejected }` | bubbles / composed | Fired after files are picked or dropped and validated. Detail: `{ added: UploadFile[], rejected: UploadRejection[] }`. |
|
|
132
|
-
| `rel-invalid` | `{ rejected }` | bubbles / composed | Fired just before `rel-files-added` when at least one picked file fails `accept` / `max-size`. Detail: `{ rejected: UploadRejection[] }`. |
|
|
134
|
+
| `rel-invalid` | `{ rejected }` | bubbles / composed | Fired just before `rel-files-added` when at least one picked file fails `accept` / `max-size` / `max-files`. Detail: `{ rejected: UploadRejection[] }`. |
|
|
133
135
|
| `rel-progress` | `{ id: item.id, progress, loaded, total: t }` | bubbles / composed | Fired on every progress tick in self-driving mode. Detail: `{ id: string, progress: number (0–100), loaded: number, total: number }` (bytes). |
|
|
134
136
|
| `rel-remove` | `{ id, file: target?.file }` | bubbles / composed | Fired when a row is removed via its delete button or `removeFile()`. Detail: `{ id: string, file?: File }`. |
|
|
135
137
|
| `rel-retry` | `{ files: requeued }` | bubbles / composed | Fired when Retry re-queues the retryable failed rows. Detail: `{ files: UploadFile[] }`. |
|
|
136
138
|
| `rel-state` | `s / this.state` | bubbles / composed | Fired when the derived `state` snapshot changes (and once after connecting). Detail: `UploadState`. |
|
|
137
139
|
| `rel-upload` | `{ files: targets }` | bubbles / composed | Fired when Upload is pressed (or `upload()` is called) with the rows still `ready`; in controlled mode the app performs the transfer. Detail: `{ files: UploadFile[] }`. |
|
|
140
|
+
| `rel-upload-complete` | `settled` | bubbles / composed | New in 1.5.0. Fired once per batch when nothing is uploading any more, in BOTH modes: in self-driving mode when the `uploader` calls settle, in controlled mode when the app moves the last `uploading` row it set to `success` or `error`. Not fired after `cancel()`. The component announces the result politely ("3 files uploaded", "2 uploaded, 1 failed"), and when nothing failed it shows a success alert in its alert slot ("3 files uploaded"; the delay warning and the failure alert come first). It shows no toast: listen for this event to show your own (for example a success `rel-toast`). Detail: `{ succeeded: UploadFile[], failed: UploadFile[] }`, the rows of this batch only. |
|
|
138
141
|
|
|
139
142
|
### Slots
|
|
140
143
|
|
|
@@ -208,7 +211,7 @@ Set these on the host (or an ancestor) to customise the element without touching
|
|
|
208
211
|
|
|
209
212
|
## Notes / Edge Cases
|
|
210
213
|
|
|
211
|
-
- **Modes.** Without `uploader` the component only emits intents (`rel-upload`, `rel-retry`, `rel-cancel`, `rel-remove`) and your app must write `status` / `progress` / `loaded` / `error` back onto `files` (replace the array — rows are keyed by `id`). With `uploader` the component patches `files` itself, runs up to `concurrency` transfers at once, emits `rel-progress` / `rel-file-complete` / `rel-file-error` per file and `rel-complete` when the batch settles.
|
|
214
|
+
- **Modes.** Without `uploader` the component only emits intents (`rel-upload`, `rel-retry`, `rel-cancel`, `rel-remove`) and your app must write `status` / `progress` / `loaded` / `error` back onto `files` (replace the array — rows are keyed by `id`). With `uploader` the component patches `files` itself, runs up to `concurrency` transfers at once, emits `rel-progress` / `rel-file-complete` / `rel-file-error` per file and `rel-upload-complete` when the batch settles (`rel-complete` still fires too, but is deprecated: listening for it logs a one-time console warning, and it is removed in 3.0).
|
|
212
215
|
- **Validation happens on pick.** Files failing `accept` or `max-size` are kept as `error` rows ("unsupported file type" / "file exceeds the 10MB limit") — that is how the Figma Failure state surfaces them — and are reported in `rel-invalid` and `rel-files-added.rejected`. `retry()` skips rows that would fail validation again (and rows without a `file` object); if every failed row is unretryable the Retry button stays disabled — remove the row instead.
|
|
213
216
|
- **`accept` tokens** are `.ext` (name suffix), `type/*` (MIME prefix) or an exact MIME type; the hint line is derived from them ("PDF, PNG or JPG") plus `max-size` ("- up to 10MB per file"). `max-size` accepts `b` / `kb` / `mb` / `gb` (decimal: 1MB = 1,000,000 bytes); an unparseable string means no limit.
|
|
214
217
|
- **Same-named files replace** the existing entry instead of duplicating it. Without `multiple` only the first picked file is taken and it replaces the whole list.
|