@xerios/design-system 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +403 -2
- package/dist/components/AnchorHeading.svelte +79 -0
- package/dist/components/AnchorHeading.svelte.d.ts +28 -0
- package/dist/components/Breadcrumbs.svelte +216 -0
- package/dist/components/Breadcrumbs.svelte.d.ts +37 -0
- package/dist/components/Button.svelte +178 -0
- package/dist/components/Button.svelte.d.ts +58 -0
- package/dist/components/Canvas.svelte +248 -0
- package/dist/components/Canvas.svelte.d.ts +91 -0
- package/dist/components/Collapsible.svelte +139 -0
- package/dist/components/Collapsible.svelte.d.ts +52 -0
- package/dist/components/CollapsibleAdvanced.svelte +174 -0
- package/dist/components/CollapsibleAdvanced.svelte.d.ts +43 -0
- package/dist/components/DashOutline.svelte +47 -0
- package/dist/components/DashOutline.svelte.d.ts +6 -0
- package/dist/components/Dialogs.svelte +123 -0
- package/dist/components/Dialogs.svelte.d.ts +6 -0
- package/dist/components/Drawer.svelte +231 -0
- package/dist/components/Drawer.svelte.d.ts +62 -0
- package/dist/components/ErrorMessage.svelte +140 -0
- package/dist/components/ErrorMessage.svelte.d.ts +41 -0
- package/dist/components/Icon.svelte +94 -0
- package/dist/components/Icon.svelte.d.ts +33 -0
- package/dist/components/InfoTip.svelte +183 -0
- package/dist/components/InfoTip.svelte.d.ts +28 -0
- package/dist/components/Md.svelte +28 -0
- package/dist/components/Md.svelte.d.ts +11 -0
- package/dist/components/Modal.svelte +91 -0
- package/dist/components/Modal.svelte.d.ts +41 -0
- package/dist/components/Notice.svelte +50 -0
- package/dist/components/Notice.svelte.d.ts +30 -0
- package/dist/components/Popover.svelte +212 -0
- package/dist/components/Popover.svelte.d.ts +70 -0
- package/dist/components/Shimmer.svelte +27 -0
- package/dist/components/Shimmer.svelte.d.ts +22 -0
- package/dist/components/Splitter.svelte +152 -0
- package/dist/components/Splitter.svelte.d.ts +41 -0
- package/dist/components/Table.svelte +448 -0
- package/dist/components/Table.svelte.d.ts +268 -0
- package/dist/components/Toast.svelte +273 -0
- package/dist/components/Toast.svelte.d.ts +31 -0
- package/dist/components/Tooltip.svelte +97 -0
- package/dist/components/Tooltip.svelte.d.ts +19 -0
- package/dist/components/WorkingBorder.svelte +105 -0
- package/dist/components/WorkingBorder.svelte.d.ts +26 -0
- package/dist/components/empty/Empty.svelte +55 -0
- package/dist/components/empty/Empty.svelte.d.ts +39 -0
- package/dist/components/empty/EmptyError.svelte +47 -0
- package/dist/components/empty/EmptyError.svelte.d.ts +28 -0
- package/dist/components/empty/index.d.ts +18 -0
- package/dist/components/empty/index.js +10 -0
- package/dist/components/filters/DateFilter.svelte +59 -0
- package/dist/components/filters/DateFilter.svelte.d.ts +23 -0
- package/dist/components/filters/FilterBar.svelte +342 -0
- package/dist/components/filters/FilterBar.svelte.d.ts +283 -0
- package/dist/components/filters/FilterChip.svelte +235 -0
- package/dist/components/filters/FilterChip.svelte.d.ts +68 -0
- package/dist/components/filters/OptionList.svelte +352 -0
- package/dist/components/filters/OptionList.svelte.d.ts +91 -0
- package/dist/components/filters/Panel.svelte +123 -0
- package/dist/components/filters/Panel.svelte.d.ts +25 -0
- package/dist/components/filters/index.d.ts +288 -0
- package/dist/components/filters/index.js +12 -0
- package/dist/components/icons.d.ts +54 -0
- package/dist/components/icons.js +58 -0
- package/dist/components/inputs/ButtonGroup.svelte +104 -0
- package/dist/components/inputs/ButtonGroup.svelte.d.ts +40 -0
- package/dist/components/inputs/Calendar.svelte +535 -0
- package/dist/components/inputs/Calendar.svelte.d.ts +45 -0
- package/dist/components/inputs/DateField.svelte +247 -0
- package/dist/components/inputs/DateField.svelte.d.ts +74 -0
- package/dist/components/inputs/DateInput.svelte +118 -0
- package/dist/components/inputs/DateInput.svelte.d.ts +43 -0
- package/dist/components/inputs/DatePicker.svelte +102 -0
- package/dist/components/inputs/DatePicker.svelte.d.ts +67 -0
- package/dist/components/inputs/DateRangePicker.svelte +208 -0
- package/dist/components/inputs/DateRangePicker.svelte.d.ts +76 -0
- package/dist/components/inputs/DateRangeSelect.svelte +548 -0
- package/dist/components/inputs/DateRangeSelect.svelte.d.ts +70 -0
- package/dist/components/inputs/FieldLabel.svelte +43 -0
- package/dist/components/inputs/FieldLabel.svelte.d.ts +28 -0
- package/dist/components/inputs/ListSearch.svelte +142 -0
- package/dist/components/inputs/ListSearch.svelte.d.ts +35 -0
- package/dist/components/inputs/RadioGroup.svelte +153 -0
- package/dist/components/inputs/RadioGroup.svelte.d.ts +49 -0
- package/dist/components/inputs/RangeShortcuts.svelte +90 -0
- package/dist/components/inputs/RangeShortcuts.svelte.d.ts +31 -0
- package/dist/components/inputs/RangeSlider.svelte +225 -0
- package/dist/components/inputs/RangeSlider.svelte.d.ts +37 -0
- package/dist/components/inputs/SearchField.svelte +24 -0
- package/dist/components/inputs/SearchField.svelte.d.ts +41 -0
- package/dist/components/inputs/Segmented.svelte +76 -0
- package/dist/components/inputs/Segmented.svelte.d.ts +43 -0
- package/dist/components/inputs/Select.svelte +552 -0
- package/dist/components/inputs/Select.svelte.d.ts +100 -0
- package/dist/components/inputs/Slider.svelte +177 -0
- package/dist/components/inputs/Slider.svelte.d.ts +33 -0
- package/dist/components/inputs/SliderTicks.svelte +62 -0
- package/dist/components/inputs/SliderTicks.svelte.d.ts +23 -0
- package/dist/components/inputs/Switch.svelte +120 -0
- package/dist/components/inputs/Switch.svelte.d.ts +31 -0
- package/dist/components/inputs/TagInput.svelte +296 -0
- package/dist/components/inputs/TagInput.svelte.d.ts +61 -0
- package/dist/components/inputs/TextArea.svelte +86 -0
- package/dist/components/inputs/TextArea.svelte.d.ts +56 -0
- package/dist/components/inputs/TextField.svelte +170 -0
- package/dist/components/inputs/TextField.svelte.d.ts +80 -0
- package/dist/components/menu/ContextMenu.svelte +25 -0
- package/dist/components/menu/ContextMenu.svelte.d.ts +26 -0
- package/dist/components/menu/MenuButton.svelte +46 -0
- package/dist/components/menu/MenuButton.svelte.d.ts +16 -0
- package/dist/components/menu/MenuList.svelte +319 -0
- package/dist/components/menu/MenuList.svelte.d.ts +30 -0
- package/dist/components/metadata/Metadata.svelte +38 -0
- package/dist/components/metadata/Metadata.svelte.d.ts +31 -0
- package/dist/components/metadata/MetadataRow.svelte +84 -0
- package/dist/components/metadata/MetadataRow.svelte.d.ts +26 -0
- package/dist/components/metadata/index.d.ts +8 -0
- package/dist/components/metadata/index.js +13 -0
- package/dist/components/side-menu/SideMenu.svelte +138 -0
- package/dist/components/side-menu/SideMenu.svelte.d.ts +25 -0
- package/dist/components/side-menu/SideMenuGroup.svelte +108 -0
- package/dist/components/side-menu/SideMenuGroup.svelte.d.ts +31 -0
- package/dist/components/side-menu/SideMenuItem.svelte +221 -0
- package/dist/components/side-menu/SideMenuItem.svelte.d.ts +46 -0
- package/dist/components/side-menu/context.d.ts +1 -0
- package/dist/components/side-menu/context.js +3 -0
- package/dist/components/side-menu/index.d.ts +62 -0
- package/dist/components/side-menu/index.js +15 -0
- package/dist/components/tiles/Tile.svelte +419 -0
- package/dist/components/tiles/Tile.svelte.d.ts +58 -0
- package/dist/components/tiles/TileGroup.svelte +135 -0
- package/dist/components/tiles/TileGroup.svelte.d.ts +45 -0
- package/dist/components/tiles/context.d.ts +35 -0
- package/dist/components/tiles/context.js +14 -0
- package/dist/components/tiles/index.d.ts +6 -0
- package/dist/components/tiles/index.js +13 -0
- package/dist/components/upload/FileCard.svelte +301 -0
- package/dist/components/upload/FileCard.svelte.d.ts +127 -0
- package/dist/components/upload/Thumb.svelte +274 -0
- package/dist/components/upload/Thumb.svelte.d.ts +101 -0
- package/dist/components/upload/UploadFile.svelte +123 -0
- package/dist/components/upload/UploadFile.svelte.d.ts +48 -0
- package/dist/components/upload/UploadFiles.svelte +177 -0
- package/dist/components/upload/UploadFiles.svelte.d.ts +50 -0
- package/dist/components/upload/UploadFolder.svelte +153 -0
- package/dist/components/upload/UploadFolder.svelte.d.ts +63 -0
- package/dist/components/upload/UploadImage.svelte +137 -0
- package/dist/components/upload/UploadImage.svelte.d.ts +52 -0
- package/dist/components/upload/UploadImages.svelte +172 -0
- package/dist/components/upload/UploadImages.svelte.d.ts +52 -0
- package/dist/components/upload/UploadZone.svelte +130 -0
- package/dist/components/upload/UploadZone.svelte.d.ts +41 -0
- package/dist/components/upload/common.d.ts +31 -0
- package/dist/components/upload/common.js +103 -0
- package/dist/components/upload/context.d.ts +18 -0
- package/dist/components/upload/context.js +10 -0
- package/dist/components/upload/index.d.ts +16 -0
- package/dist/components/upload/index.js +18 -0
- package/dist/css/atoms.css +892 -0
- package/dist/css/base.css +333 -0
- package/dist/css/effects.css +430 -0
- package/dist/css/index.css +10 -0
- package/dist/css/tokens.css +296 -0
- package/dist/fonts.d.ts +1 -0
- package/dist/fonts.js +7 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +77 -0
- package/dist/lib/announce.d.ts +8 -0
- package/dist/lib/announce.js +48 -0
- package/dist/lib/controls.d.ts +10 -0
- package/dist/lib/controls.js +42 -0
- package/dist/lib/dates.d.ts +104 -0
- package/dist/lib/dates.js +235 -0
- package/dist/lib/dialogs.svelte.d.ts +8 -0
- package/dist/lib/dialogs.svelte.js +45 -0
- package/dist/lib/dom.d.ts +34 -0
- package/dist/lib/dom.js +90 -0
- package/dist/lib/field-errors.svelte.d.ts +40 -0
- package/dist/lib/field-errors.svelte.js +89 -0
- package/dist/lib/files.d.ts +74 -0
- package/dist/lib/files.js +215 -0
- package/dist/lib/inline-md.d.ts +1 -0
- package/dist/lib/inline-md.js +36 -0
- package/dist/lib/invalid.d.ts +4 -0
- package/dist/lib/invalid.js +35 -0
- package/dist/lib/list-search.d.ts +9 -0
- package/dist/lib/list-search.js +27 -0
- package/dist/lib/menu.svelte.d.ts +39 -0
- package/dist/lib/menu.svelte.js +98 -0
- package/dist/lib/morph.svelte.d.ts +17 -0
- package/dist/lib/morph.svelte.js +46 -0
- package/dist/lib/motion.d.ts +115 -0
- package/dist/lib/motion.js +174 -0
- package/dist/lib/observe.d.ts +36 -0
- package/dist/lib/observe.js +142 -0
- package/dist/lib/reveal.d.ts +7 -0
- package/dist/lib/reveal.js +28 -0
- package/dist/lib/roving.d.ts +16 -0
- package/dist/lib/roving.js +35 -0
- package/dist/lib/runs.d.ts +18 -0
- package/dist/lib/runs.js +25 -0
- package/dist/lib/scroll-fade.d.ts +4 -0
- package/dist/lib/scroll-fade.js +71 -0
- package/dist/lib/spotlight.d.ts +4 -0
- package/dist/lib/spotlight.js +109 -0
- package/dist/lib/ticks.d.ts +12 -0
- package/dist/lib/ticks.js +24 -0
- package/dist/lib/tooltip.d.ts +4 -0
- package/dist/lib/tooltip.js +110 -0
- package/dist/lib/validity.d.ts +16 -0
- package/dist/lib/validity.js +36 -0
- package/package.json +69 -3
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* A choice made of tiles: every Tile inside it with a `value` is one of its options. One choice (a radio group) or,
|
|
4
|
+
* with `multiple`, any number (a group of checkboxes). For choices worth more than a word each: a plan, a template, a
|
|
5
|
+
* region with its details. Lays the tiles out in a grid of equal columns that drops to fewer as it narrows.
|
|
6
|
+
*
|
|
7
|
+
* <TileGroup label="Plan" bind:value={plan}>
|
|
8
|
+
* <Tile value="free" title="Free" icon="cloud">Up to 3 projects.</Tile>
|
|
9
|
+
* <Tile value="pro" title="Pro" icon="rocket">Unlimited projects.</Tile>
|
|
10
|
+
* </TileGroup>
|
|
11
|
+
* <TileGroup label="Notify me about" multiple bind:value={topics}>…</TileGroup>
|
|
12
|
+
*
|
|
13
|
+
* value: bindable. The chosen tile's value ('' for none yet), or with `multiple` the array of chosen values.
|
|
14
|
+
* label: the group's name, shown above it; `hideLabel` keeps it for screen readers only.
|
|
15
|
+
* info: help text behind an ⓘ next to the label.
|
|
16
|
+
* note: dimmed text after the label, such as '(optional)' (see .label-note); screen readers read it as part of the label.
|
|
17
|
+
* multiple: any number may be chosen (checkboxes) rather than one (radios).
|
|
18
|
+
* columns: at most this many tiles to a row (default: as many as fit). Each is at least --tile-min wide (220px), so a
|
|
19
|
+
* narrow container gets fewer, down to one.
|
|
20
|
+
* disabled: every option out of reach.
|
|
21
|
+
* onchange(value): after the choice changes.
|
|
22
|
+
* Children: the tiles, in order. Other attributes, the class and attachments go to the group's outer box.
|
|
23
|
+
* Keyboard: one choice: Tab reaches the chosen tile (the first when none is), the arrows move to the next or previous
|
|
24
|
+
* and choose it, Home and End the first and last. Multiple: each tile is a tab stop, Space toggles it.
|
|
25
|
+
*
|
|
26
|
+
* @typedef {object} Props
|
|
27
|
+
* @property {string | string[]} [value]
|
|
28
|
+
* @property {string} label
|
|
29
|
+
* @property {boolean} [hideLabel]
|
|
30
|
+
* @property {string} [info]
|
|
31
|
+
* @property {string} [note] dimmed text after the label, e.g. '(optional)'
|
|
32
|
+
* @property {boolean} [multiple]
|
|
33
|
+
* @property {number} [columns]
|
|
34
|
+
* @property {boolean} [disabled]
|
|
35
|
+
* @property {(value: string | string[]) => void} [onchange]
|
|
36
|
+
* @property {import('svelte').Snippet} children
|
|
37
|
+
*/
|
|
38
|
+
import { setContext, untrack } from 'svelte'
|
|
39
|
+
import FieldLabel from '../inputs/FieldLabel.svelte'
|
|
40
|
+
import { radioKeys } from '../../lib/roving.js'
|
|
41
|
+
import { TILE_GROUP } from './context.js'
|
|
42
|
+
|
|
43
|
+
/** @type {Props & Omit<import('svelte/elements').HTMLAttributes<HTMLDivElement>, keyof Props>} */
|
|
44
|
+
let {
|
|
45
|
+
value = $bindable(),
|
|
46
|
+
label,
|
|
47
|
+
hideLabel = false,
|
|
48
|
+
info,
|
|
49
|
+
note = '',
|
|
50
|
+
multiple = false,
|
|
51
|
+
columns,
|
|
52
|
+
disabled = false,
|
|
53
|
+
onchange,
|
|
54
|
+
children,
|
|
55
|
+
class: className,
|
|
56
|
+
...rest
|
|
57
|
+
} = $props()
|
|
58
|
+
const uid = $props.id()
|
|
59
|
+
|
|
60
|
+
/** The options that can be reached, in page order. */
|
|
61
|
+
let options = $state(/** @type {string[]} */ ([]))
|
|
62
|
+
const chosen = $derived(multiple ? (Array.isArray(value) ? value : []) : [value])
|
|
63
|
+
// With one choice and none of the options chosen, the first is the tab stop.
|
|
64
|
+
const first = $derived(!multiple && !options.some((o) => o === value) ? options[0] : undefined)
|
|
65
|
+
|
|
66
|
+
/** @type {import('./context.js').TileGroupContext} */
|
|
67
|
+
const group = {
|
|
68
|
+
get multiple() {
|
|
69
|
+
return multiple
|
|
70
|
+
},
|
|
71
|
+
get disabled() {
|
|
72
|
+
return disabled
|
|
73
|
+
},
|
|
74
|
+
isChosen: (v) => chosen.includes(v),
|
|
75
|
+
choose(v) {
|
|
76
|
+
if (multiple) {
|
|
77
|
+
const list = Array.isArray(value) ? value : []
|
|
78
|
+
value = list.includes(v) ? list.filter((x) => x !== v) : [...list, v]
|
|
79
|
+
} else if (value === v) return
|
|
80
|
+
else value = v
|
|
81
|
+
onchange?.(value)
|
|
82
|
+
},
|
|
83
|
+
tabStop: (v) => (multiple ? undefined : v === value || v === first ? 0 : -1),
|
|
84
|
+
// Untracked: a tile calls this from its $effect, and push and indexOf read the list, which would make every tile's
|
|
85
|
+
// effect depend on it. Each tile joining would then rerun the others' effects, which leave and join again, forever.
|
|
86
|
+
register(v) {
|
|
87
|
+
untrack(() => options.push(v))
|
|
88
|
+
return () => {
|
|
89
|
+
untrack(() => {
|
|
90
|
+
const at = options.indexOf(v)
|
|
91
|
+
if (at >= 0) options.splice(at, 1)
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
setContext(TILE_GROUP, group)
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<div class={['tile-group', className]} {...rest}>
|
|
100
|
+
<FieldLabel id="{uid}-label" {label} {note} {info} {hideLabel} />
|
|
101
|
+
<div
|
|
102
|
+
class="tiles"
|
|
103
|
+
class:capped={!!columns}
|
|
104
|
+
style:--tile-columns={columns}
|
|
105
|
+
role={multiple ? 'group' : 'radiogroup'}
|
|
106
|
+
aria-labelledby="{uid}-label"
|
|
107
|
+
aria-disabled={disabled || undefined}
|
|
108
|
+
{@attach multiple ? undefined : radioKeys}
|
|
109
|
+
>
|
|
110
|
+
{@render children()}
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<style>
|
|
115
|
+
.tile-group {
|
|
116
|
+
display: grid;
|
|
117
|
+
gap: var(--space-2);
|
|
118
|
+
min-width: 0;
|
|
119
|
+
}
|
|
120
|
+
/* Equal columns at least --tile-min wide, as many as fit; tiles in a row share its height. */
|
|
121
|
+
.tiles {
|
|
122
|
+
--tile-gap: var(--space-2);
|
|
123
|
+
display: grid;
|
|
124
|
+
grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--tile-min, 220px)), 1fr));
|
|
125
|
+
gap: var(--tile-gap);
|
|
126
|
+
align-items: stretch;
|
|
127
|
+
}
|
|
128
|
+
/* At most --tile-columns to a row: each column is at least that share of the row, so no more fit. */
|
|
129
|
+
.tiles.capped {
|
|
130
|
+
grid-template-columns: repeat(
|
|
131
|
+
auto-fill,
|
|
132
|
+
minmax(max(min(100%, var(--tile-min, 220px)), calc((100% - (var(--tile-columns) - 1) * var(--tile-gap)) / var(--tile-columns))), 1fr)
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export default TileGroup;
|
|
2
|
+
/**
|
|
3
|
+
* A choice made of tiles: every Tile inside it with a `value` is one of its options. One choice (a radio group) or,
|
|
4
|
+
* with `multiple`, any number (a group of checkboxes). For choices worth more than a word each: a plan, a template, a
|
|
5
|
+
* region with its details. Lays the tiles out in a grid of equal columns that drops to fewer as it narrows.
|
|
6
|
+
*
|
|
7
|
+
* <TileGroup label="Plan" bind:value={plan}>
|
|
8
|
+
* <Tile value="free" title="Free" icon="cloud">Up to 3 projects.</Tile>
|
|
9
|
+
* <Tile value="pro" title="Pro" icon="rocket">Unlimited projects.</Tile>
|
|
10
|
+
* </TileGroup>
|
|
11
|
+
* <TileGroup label="Notify me about" multiple bind:value={topics}>…</TileGroup>
|
|
12
|
+
*
|
|
13
|
+
* value: bindable. The chosen tile's value ('' for none yet), or with `multiple` the array of chosen values.
|
|
14
|
+
* label: the group's name, shown above it; `hideLabel` keeps it for screen readers only.
|
|
15
|
+
* info: help text behind an ⓘ next to the label.
|
|
16
|
+
* note: dimmed text after the label, such as '(optional)' (see .label-note); screen readers read it as part of the label.
|
|
17
|
+
* multiple: any number may be chosen (checkboxes) rather than one (radios).
|
|
18
|
+
* columns: at most this many tiles to a row (default: as many as fit). Each is at least --tile-min wide (220px), so a
|
|
19
|
+
* narrow container gets fewer, down to one.
|
|
20
|
+
* disabled: every option out of reach.
|
|
21
|
+
* onchange(value): after the choice changes.
|
|
22
|
+
* Children: the tiles, in order. Other attributes, the class and attachments go to the group's outer box.
|
|
23
|
+
* Keyboard: one choice: Tab reaches the chosen tile (the first when none is), the arrows move to the next or previous
|
|
24
|
+
* and choose it, Home and End the first and last. Multiple: each tile is a tab stop, Space toggles it.
|
|
25
|
+
*/
|
|
26
|
+
export type Props = {
|
|
27
|
+
value?: string | string[] | undefined;
|
|
28
|
+
label: string;
|
|
29
|
+
hideLabel?: boolean | undefined;
|
|
30
|
+
info?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* dimmed text after the label, e.g. '(optional)'
|
|
33
|
+
*/
|
|
34
|
+
note?: string | undefined;
|
|
35
|
+
multiple?: boolean | undefined;
|
|
36
|
+
columns?: number | undefined;
|
|
37
|
+
disabled?: boolean | undefined;
|
|
38
|
+
onchange?: ((value: string | string[]) => void) | undefined;
|
|
39
|
+
children: import("svelte").Snippet;
|
|
40
|
+
};
|
|
41
|
+
type TileGroup = {
|
|
42
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
43
|
+
$set?(props: Partial<Props & Omit<HTMLAttributes<HTMLDivElement>, keyof Props>>): void;
|
|
44
|
+
};
|
|
45
|
+
declare const TileGroup: import("svelte").Component<Props & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof Props>, {}, "value">;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} TileGroupContext
|
|
3
|
+
* @property {boolean} multiple any number may be chosen (checkboxes), not one (radios)
|
|
4
|
+
* @property {boolean} disabled every option is out of reach
|
|
5
|
+
* @property {(value: string) => boolean} isChosen
|
|
6
|
+
* @property {(value: string) => void} choose picks it (one choice) or toggles it (multiple)
|
|
7
|
+
* @property {(value: string) => 0 | -1 | undefined} tabStop the option's tabindex: with one choice, only the chosen one
|
|
8
|
+
* (the first when none is) is in the tab order and arrows move between them; with multiple, every one is
|
|
9
|
+
* @property {(value: string) => () => void} register adds an option that can be reached, in page order; returns its removal
|
|
10
|
+
*/
|
|
11
|
+
export const TILE_GROUP: unique symbol;
|
|
12
|
+
export type TileGroupContext = {
|
|
13
|
+
/**
|
|
14
|
+
* any number may be chosen (checkboxes), not one (radios)
|
|
15
|
+
*/
|
|
16
|
+
multiple: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* every option is out of reach
|
|
19
|
+
*/
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
isChosen: (value: string) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* picks it (one choice) or toggles it (multiple)
|
|
24
|
+
*/
|
|
25
|
+
choose: (value: string) => void;
|
|
26
|
+
/**
|
|
27
|
+
* the option's tabindex: with one choice, only the chosen one
|
|
28
|
+
* (the first when none is) is in the tab order and arrows move between them; with multiple, every one is
|
|
29
|
+
*/
|
|
30
|
+
tabStop: (value: string) => 0 | -1 | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* adds an option that can be reached, in page order; returns its removal
|
|
33
|
+
*/
|
|
34
|
+
register: (value: string) => () => void;
|
|
35
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// What a TileGroup hands the Tiles inside it, so a tile with a `value` becomes one of its options.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {object} TileGroupContext
|
|
5
|
+
* @property {boolean} multiple any number may be chosen (checkboxes), not one (radios)
|
|
6
|
+
* @property {boolean} disabled every option is out of reach
|
|
7
|
+
* @property {(value: string) => boolean} isChosen
|
|
8
|
+
* @property {(value: string) => void} choose picks it (one choice) or toggles it (multiple)
|
|
9
|
+
* @property {(value: string) => 0 | -1 | undefined} tabStop the option's tabindex: with one choice, only the chosen one
|
|
10
|
+
* (the first when none is) is in the tab order and arrows move between them; with multiple, every one is
|
|
11
|
+
* @property {(value: string) => () => void} register adds an option that can be reached, in page order; returns its removal
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const TILE_GROUP = Symbol('tile-group')
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const _default: import("svelte").Component<import("./Tile.svelte").Props & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof import("./Tile.svelte").Props>, {}, "checked"> & {
|
|
2
|
+
Group: import("svelte").Component<import("./TileGroup.svelte").Props & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof import("./TileGroup.svelte").Props>, {}, "value">;
|
|
3
|
+
};
|
|
4
|
+
export default _default;
|
|
5
|
+
export { TileGroup };
|
|
6
|
+
import TileGroup from './TileGroup.svelte';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Tiles as one import: <Tile> is one tile (a link, a button, a checkbox, or content), <Tile.Group> a choice made of the
|
|
2
|
+
// tiles inside it (one, or several with `multiple`).
|
|
3
|
+
//
|
|
4
|
+
// import Tile from '@xerios/design-system/components/tiles/index.js'
|
|
5
|
+
// <Tile title="Docs" icon="document" href="/docs">Guides and reference.</Tile>
|
|
6
|
+
// <Tile.Group label="Plan" bind:value={plan}>
|
|
7
|
+
// <Tile value="free" title="Free">Up to 3 projects.</Tile>
|
|
8
|
+
// </Tile.Group>
|
|
9
|
+
import Tile from './Tile.svelte'
|
|
10
|
+
import TileGroup from './TileGroup.svelte'
|
|
11
|
+
|
|
12
|
+
export default Object.assign(Tile, { Group: TileGroup })
|
|
13
|
+
export { TileGroup }
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Icon from '../Icon.svelte'
|
|
3
|
+
import Shimmer from '../Shimmer.svelte'
|
|
4
|
+
import { invalid } from '../../lib/invalid.js'
|
|
5
|
+
import { tooltip } from '../../lib/tooltip.js'
|
|
6
|
+
import { fade, durations } from '../../lib/motion.js'
|
|
7
|
+
import { morph } from '../../lib/morph.svelte.js'
|
|
8
|
+
/**
|
|
9
|
+
* Internal to Upload (Upload.File, Upload.Files, Upload.Folder): the box a picker draws, empty or holding its choice.
|
|
10
|
+
* Empty, it is a pill like .btn: an icon and `label`, opening the picker. Holding something, the same box reshapes
|
|
11
|
+
* (lib/morph.svelte.js) into a card: an icon, the name over a detail line (its size), and a ✕ that clears it. A file's
|
|
12
|
+
* icon is coloured by its format (`tone`), with its extension (`ext`) on a band across it. Pressing the card opens the
|
|
13
|
+
* picker again to replace it, unless `onpick` is left out (a card in a list, which only clears). The tooltips of both
|
|
14
|
+
* buttons name the file in full, since the card may cut its name short.
|
|
15
|
+
* Delete or Backspace on it clears it too. The button stays the same element throughout, so it keeps the focus, and
|
|
16
|
+
* the ✕ hands the focus back to it.
|
|
17
|
+
*
|
|
18
|
+
* @typedef {object} Item
|
|
19
|
+
* @property {string} name
|
|
20
|
+
* @property {string} detail
|
|
21
|
+
* @property {string} icon
|
|
22
|
+
* @property {string} [ext] the extension, on a band across the icon ('PDF')
|
|
23
|
+
* @property {string} [tone] the icon's colour: a data-tone name, or 'accent'
|
|
24
|
+
*
|
|
25
|
+
* @typedef {object} Props
|
|
26
|
+
* @property {Item | null} item what it holds, or null while empty
|
|
27
|
+
* @property {string} [label] the empty pill's text
|
|
28
|
+
* @property {string} [icon] the empty pill's icon
|
|
29
|
+
* @property {() => void} [onpick] opens the picker; left out, the card is not a button
|
|
30
|
+
* @property {() => void} [onclear] adds the ✕
|
|
31
|
+
* @property {boolean} [disabled]
|
|
32
|
+
* @property {boolean} [dragging] files are dragged over its drop target
|
|
33
|
+
* @property {boolean} [busy] reading what was dropped: the pill shimmers with `busyLabel` and ignores presses
|
|
34
|
+
* @property {string} [busyLabel]
|
|
35
|
+
* @property {string} [id] on the button
|
|
36
|
+
* @property {string | false} [errorId] the id of its error message, while there is one
|
|
37
|
+
* @property {HTMLButtonElement} [main] the button (bindable)
|
|
38
|
+
*/
|
|
39
|
+
/** @type {Props} */
|
|
40
|
+
let {
|
|
41
|
+
item,
|
|
42
|
+
label = '',
|
|
43
|
+
icon = 'upload',
|
|
44
|
+
onpick,
|
|
45
|
+
onclear,
|
|
46
|
+
disabled = false,
|
|
47
|
+
dragging = false,
|
|
48
|
+
busy = false,
|
|
49
|
+
busyLabel = 'Reading…',
|
|
50
|
+
id,
|
|
51
|
+
errorId = false,
|
|
52
|
+
main = $bindable(),
|
|
53
|
+
} = $props()
|
|
54
|
+
|
|
55
|
+
/** @type {HTMLDivElement | undefined} */
|
|
56
|
+
let box = $state()
|
|
57
|
+
morph(
|
|
58
|
+
() => box,
|
|
59
|
+
() => item,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
function clear() {
|
|
63
|
+
if (disabled) return
|
|
64
|
+
onclear?.()
|
|
65
|
+
main?.focus()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** @param {KeyboardEvent} event */
|
|
69
|
+
function onkeydown(event) {
|
|
70
|
+
if (!item || !onclear || (event.key !== 'Delete' && event.key !== 'Backspace')) return
|
|
71
|
+
event.preventDefault()
|
|
72
|
+
clear()
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
{#snippet content()}
|
|
77
|
+
{#if busy}
|
|
78
|
+
<Icon name={icon} size="sm" /><Shimmer>{busyLabel}</Shimmer>
|
|
79
|
+
{:else if item}
|
|
80
|
+
<span class="lead" class:toned={item.tone} data-tone={item.tone} in:fade={{ duration: durations.short4 }}
|
|
81
|
+
><Icon name={item.icon} size={item.ext ? 'lg' : 'md'} />{#if item.ext}<span class="ext">{item.ext}</span>{/if}</span
|
|
82
|
+
>
|
|
83
|
+
<span class="text" in:fade={{ duration: durations.short4 }}>
|
|
84
|
+
<span class="name">{item.name}</span>
|
|
85
|
+
<span class="detail">{item.detail}</span>
|
|
86
|
+
</span>
|
|
87
|
+
{:else}
|
|
88
|
+
<Icon name={icon} size="sm" /><span class="label" in:fade={{ duration: durations.short4 }}>{label}</span>
|
|
89
|
+
{/if}
|
|
90
|
+
{/snippet}
|
|
91
|
+
|
|
92
|
+
<div bind:this={box} class={['card', item ? 'filled' : 'empty', dragging && 'dragging', disabled && 'disabled', busy && 'shimmer']}>
|
|
93
|
+
{#if onpick}
|
|
94
|
+
<button
|
|
95
|
+
bind:this={main}
|
|
96
|
+
type="button"
|
|
97
|
+
class="main"
|
|
98
|
+
{id}
|
|
99
|
+
{disabled}
|
|
100
|
+
aria-busy={busy || undefined}
|
|
101
|
+
aria-disabled={busy || undefined}
|
|
102
|
+
{@attach invalid(errorId)}
|
|
103
|
+
{@attach tooltip(item && !busy ? 'Replace' : '', { detail: item?.name })}
|
|
104
|
+
onclick={() => {
|
|
105
|
+
if (!busy) onpick()
|
|
106
|
+
}}
|
|
107
|
+
{onkeydown}>{@render content()}</button
|
|
108
|
+
>
|
|
109
|
+
{:else}
|
|
110
|
+
<div class="main">{@render content()}</div>
|
|
111
|
+
{/if}
|
|
112
|
+
{#if item && onclear && !busy}
|
|
113
|
+
<button
|
|
114
|
+
type="button"
|
|
115
|
+
class="clear"
|
|
116
|
+
aria-label="Remove {item.name}"
|
|
117
|
+
{disabled}
|
|
118
|
+
{@attach tooltip('Remove', { detail: item.name })}
|
|
119
|
+
onclick={clear}
|
|
120
|
+
in:fade={{ duration: durations.short4 }}><Icon name="x" size="sm" /></button
|
|
121
|
+
>
|
|
122
|
+
{/if}
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<style>
|
|
126
|
+
/* One box for both states. Empty it is drawn as .btn is; holding something it is a flat card, wider and rounder.
|
|
127
|
+
lib/morph animates its size between the two and these transitions the rest. */
|
|
128
|
+
.card {
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
min-width: 0;
|
|
132
|
+
max-width: 100%;
|
|
133
|
+
border: 1px solid var(--line-strong);
|
|
134
|
+
background: var(--control-1);
|
|
135
|
+
color: var(--fg);
|
|
136
|
+
transition:
|
|
137
|
+
border-radius var(--dur) var(--ease-out),
|
|
138
|
+
border-color var(--dur) var(--ease-out),
|
|
139
|
+
background-color var(--dur) var(--ease-out),
|
|
140
|
+
box-shadow var(--dur) var(--ease-out),
|
|
141
|
+
color var(--dur) var(--ease-out);
|
|
142
|
+
}
|
|
143
|
+
.empty {
|
|
144
|
+
min-height: 28px;
|
|
145
|
+
border-radius: var(--r-sm);
|
|
146
|
+
box-shadow: var(--shadow-btn);
|
|
147
|
+
}
|
|
148
|
+
.filled {
|
|
149
|
+
width: 280px;
|
|
150
|
+
border-radius: var(--r);
|
|
151
|
+
}
|
|
152
|
+
.main {
|
|
153
|
+
display: flex;
|
|
154
|
+
flex: 1;
|
|
155
|
+
align-self: stretch;
|
|
156
|
+
align-items: center;
|
|
157
|
+
gap: 6px;
|
|
158
|
+
min-width: 0;
|
|
159
|
+
margin: 0;
|
|
160
|
+
padding: 0 11px;
|
|
161
|
+
border: 0;
|
|
162
|
+
border-radius: inherit;
|
|
163
|
+
background: none;
|
|
164
|
+
color: inherit;
|
|
165
|
+
font: inherit;
|
|
166
|
+
font-size: 12px;
|
|
167
|
+
font-weight: var(--w-medium);
|
|
168
|
+
line-height: 14px;
|
|
169
|
+
text-align: start;
|
|
170
|
+
white-space: nowrap;
|
|
171
|
+
}
|
|
172
|
+
button.main {
|
|
173
|
+
cursor: pointer;
|
|
174
|
+
}
|
|
175
|
+
button.main:disabled {
|
|
176
|
+
cursor: default;
|
|
177
|
+
}
|
|
178
|
+
button.main[aria-busy='true'] {
|
|
179
|
+
cursor: progress;
|
|
180
|
+
}
|
|
181
|
+
.main > :global(.icon) {
|
|
182
|
+
color: var(--muted);
|
|
183
|
+
transition: color var(--dur) var(--ease-out);
|
|
184
|
+
}
|
|
185
|
+
.card:has(> button.main:hover:not(:disabled, [aria-disabled='true'])) {
|
|
186
|
+
background: var(--control-3);
|
|
187
|
+
}
|
|
188
|
+
.card:has(> button.main:hover:not(:disabled, [aria-disabled='true'])) .main > :global(.icon) {
|
|
189
|
+
color: inherit;
|
|
190
|
+
}
|
|
191
|
+
.card:has(> button.main:active:not(:disabled, [aria-disabled='true'])) {
|
|
192
|
+
background: var(--control-4);
|
|
193
|
+
}
|
|
194
|
+
/* The card: the icon in a square inset by the same space all round, then the name over the detail. */
|
|
195
|
+
.filled .main {
|
|
196
|
+
gap: var(--space-2);
|
|
197
|
+
padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
|
|
198
|
+
}
|
|
199
|
+
.lead {
|
|
200
|
+
position: relative;
|
|
201
|
+
display: grid;
|
|
202
|
+
flex: none;
|
|
203
|
+
place-items: center;
|
|
204
|
+
width: 32px;
|
|
205
|
+
height: 32px;
|
|
206
|
+
border-radius: var(--r-sm);
|
|
207
|
+
background: var(--fill-3);
|
|
208
|
+
color: var(--muted);
|
|
209
|
+
}
|
|
210
|
+
/* A file's format: the icon tinted in its family's colour, on that colour's soft fill. 'accent' is not a data-tone of
|
|
211
|
+
atoms.css, so it is defined here. */
|
|
212
|
+
.lead[data-tone='accent'] {
|
|
213
|
+
--tone: var(--accent);
|
|
214
|
+
--tone-soft: var(--accent-soft);
|
|
215
|
+
}
|
|
216
|
+
.lead.toned {
|
|
217
|
+
background: var(--tone-soft);
|
|
218
|
+
color: var(--tone);
|
|
219
|
+
}
|
|
220
|
+
/* The extension on a solid band across the lower half of the page, as file-type icons have it. The band is darkened a
|
|
221
|
+
touch in the light theme so the light text on it keeps AA contrast (green is just under it as it is). */
|
|
222
|
+
.ext {
|
|
223
|
+
position: absolute;
|
|
224
|
+
bottom: 5px;
|
|
225
|
+
left: 50%;
|
|
226
|
+
padding: 0 2px;
|
|
227
|
+
border-radius: calc(var(--r-sm) / 2);
|
|
228
|
+
background: light-dark(color-mix(in lch, var(--tone, var(--muted)) 88%, var(--fg)), var(--tone, var(--muted)));
|
|
229
|
+
color: var(--surface);
|
|
230
|
+
font-family: var(--font-data);
|
|
231
|
+
font-size: 11px;
|
|
232
|
+
font-weight: var(--w-semibold);
|
|
233
|
+
line-height: 12px;
|
|
234
|
+
translate: -50% 0;
|
|
235
|
+
}
|
|
236
|
+
.text {
|
|
237
|
+
display: grid;
|
|
238
|
+
min-width: 0;
|
|
239
|
+
}
|
|
240
|
+
.name {
|
|
241
|
+
overflow: clip;
|
|
242
|
+
color: var(--fg);
|
|
243
|
+
font-size: 13px;
|
|
244
|
+
line-height: 18px;
|
|
245
|
+
text-overflow: ellipsis;
|
|
246
|
+
}
|
|
247
|
+
.detail {
|
|
248
|
+
overflow: clip;
|
|
249
|
+
color: var(--muted);
|
|
250
|
+
font-family: var(--font-data);
|
|
251
|
+
font-size: 11px;
|
|
252
|
+
font-weight: var(--w-normal);
|
|
253
|
+
font-variant-numeric: tabular-nums;
|
|
254
|
+
text-overflow: ellipsis;
|
|
255
|
+
}
|
|
256
|
+
.clear {
|
|
257
|
+
display: inline-grid;
|
|
258
|
+
flex: none;
|
|
259
|
+
place-items: center;
|
|
260
|
+
width: 24px;
|
|
261
|
+
height: 24px;
|
|
262
|
+
margin-inline-end: var(--space-2);
|
|
263
|
+
padding: 0;
|
|
264
|
+
border: 0;
|
|
265
|
+
border-radius: var(--r-pill);
|
|
266
|
+
background: none;
|
|
267
|
+
color: var(--muted);
|
|
268
|
+
cursor: pointer;
|
|
269
|
+
transition:
|
|
270
|
+
background-color var(--dur) var(--ease-out),
|
|
271
|
+
color var(--dur) var(--ease-out);
|
|
272
|
+
}
|
|
273
|
+
.clear:hover:not(:disabled) {
|
|
274
|
+
background: var(--control-4);
|
|
275
|
+
color: var(--fg);
|
|
276
|
+
}
|
|
277
|
+
.clear:disabled {
|
|
278
|
+
cursor: default;
|
|
279
|
+
}
|
|
280
|
+
.dragging {
|
|
281
|
+
border-color: var(--accent);
|
|
282
|
+
background: var(--accent-soft);
|
|
283
|
+
}
|
|
284
|
+
.card:has(> .main:global([aria-invalid='true'])) {
|
|
285
|
+
border-color: var(--danger);
|
|
286
|
+
}
|
|
287
|
+
.disabled {
|
|
288
|
+
opacity: 0.5;
|
|
289
|
+
box-shadow: none;
|
|
290
|
+
}
|
|
291
|
+
@media (pointer: coarse) {
|
|
292
|
+
.empty {
|
|
293
|
+
min-height: 44px;
|
|
294
|
+
}
|
|
295
|
+
.clear {
|
|
296
|
+
width: 44px;
|
|
297
|
+
height: 44px;
|
|
298
|
+
margin-inline-end: 0;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
</style>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export default FileCard;
|
|
2
|
+
type FileCard = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const FileCard: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* what it holds, or null while empty
|
|
9
|
+
*/
|
|
10
|
+
item: {
|
|
11
|
+
name: string;
|
|
12
|
+
detail: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
/**
|
|
15
|
+
* the extension, on a band across the icon ('PDF')
|
|
16
|
+
*/
|
|
17
|
+
ext?: string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* the icon's colour: a data-tone name, or 'accent'
|
|
20
|
+
*/
|
|
21
|
+
tone?: string | undefined;
|
|
22
|
+
} | null;
|
|
23
|
+
/**
|
|
24
|
+
* the empty pill's text
|
|
25
|
+
*/
|
|
26
|
+
label?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* the empty pill's icon
|
|
29
|
+
*/
|
|
30
|
+
icon?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* opens the picker; left out, the card is not a button
|
|
33
|
+
*/
|
|
34
|
+
onpick?: (() => void) | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* adds the ✕
|
|
37
|
+
*/
|
|
38
|
+
onclear?: (() => void) | undefined;
|
|
39
|
+
disabled?: boolean | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* files are dragged over its drop target
|
|
42
|
+
*/
|
|
43
|
+
dragging?: boolean | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* reading what was dropped: the pill shimmers with `busyLabel` and ignores presses
|
|
46
|
+
*/
|
|
47
|
+
busy?: boolean | undefined;
|
|
48
|
+
busyLabel?: string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* on the button
|
|
51
|
+
*/
|
|
52
|
+
id?: string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* the id of its error message, while there is one
|
|
55
|
+
*/
|
|
56
|
+
errorId?: string | false | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* the button (bindable)
|
|
59
|
+
*/
|
|
60
|
+
main?: HTMLButtonElement | undefined;
|
|
61
|
+
}, {}, "main">;
|
|
62
|
+
/**
|
|
63
|
+
* Internal to Upload (Upload.File, Upload.Files, Upload.Folder): the box a picker draws, empty or holding its choice.
|
|
64
|
+
* Empty, it is a pill like .btn: an icon and `label`, opening the picker. Holding something, the same box reshapes
|
|
65
|
+
* (lib/morph.svelte.js) into a card: an icon, the name over a detail line (its size), and a ✕ that clears it. A file's
|
|
66
|
+
* icon is coloured by its format (`tone`), with its extension (`ext`) on a band across it. Pressing the card opens the
|
|
67
|
+
* picker again to replace it, unless `onpick` is left out (a card in a list, which only clears). The tooltips of both
|
|
68
|
+
* buttons name the file in full, since the card may cut its name short.
|
|
69
|
+
* Delete or Backspace on it clears it too. The button stays the same element throughout, so it keeps the focus, and
|
|
70
|
+
* the ✕ hands the focus back to it.
|
|
71
|
+
*/
|
|
72
|
+
type Props = {
|
|
73
|
+
/**
|
|
74
|
+
* what it holds, or null while empty
|
|
75
|
+
*/
|
|
76
|
+
item: {
|
|
77
|
+
name: string;
|
|
78
|
+
detail: string;
|
|
79
|
+
icon: string;
|
|
80
|
+
/**
|
|
81
|
+
* the extension, on a band across the icon ('PDF')
|
|
82
|
+
*/
|
|
83
|
+
ext?: string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* the icon's colour: a data-tone name, or 'accent'
|
|
86
|
+
*/
|
|
87
|
+
tone?: string | undefined;
|
|
88
|
+
} | null;
|
|
89
|
+
/**
|
|
90
|
+
* the empty pill's text
|
|
91
|
+
*/
|
|
92
|
+
label?: string | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* the empty pill's icon
|
|
95
|
+
*/
|
|
96
|
+
icon?: string | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* opens the picker; left out, the card is not a button
|
|
99
|
+
*/
|
|
100
|
+
onpick?: (() => void) | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* adds the ✕
|
|
103
|
+
*/
|
|
104
|
+
onclear?: (() => void) | undefined;
|
|
105
|
+
disabled?: boolean | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* files are dragged over its drop target
|
|
108
|
+
*/
|
|
109
|
+
dragging?: boolean | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* reading what was dropped: the pill shimmers with `busyLabel` and ignores presses
|
|
112
|
+
*/
|
|
113
|
+
busy?: boolean | undefined;
|
|
114
|
+
busyLabel?: string | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* on the button
|
|
117
|
+
*/
|
|
118
|
+
id?: string | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* the id of its error message, while there is one
|
|
121
|
+
*/
|
|
122
|
+
errorId?: string | false | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* the button (bindable)
|
|
125
|
+
*/
|
|
126
|
+
main?: HTMLButtonElement | undefined;
|
|
127
|
+
};
|