@xerios/design-system 0.0.0-stage → 0.1.1
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 +185 -0
- package/dist/components/Button.svelte.d.ts +70 -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 +401 -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 +110 -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 +151 -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 +79 -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 +899 -0
- package/dist/css/base.css +334 -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,401 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* A row of filters drawn from data (Linear's view filters): one FilterChip per filter, then a funnel button that adds
|
|
4
|
+
* one. The button lists the fields (with a search field when there are many); picking one shows its value editor in
|
|
5
|
+
* the same panel, and the filter joins the row as soon as it has a value. A field already filtered opens its chip
|
|
6
|
+
* instead, so each field has one filter. A filter left with no value (every value unticked, every word removed) leaves
|
|
7
|
+
* `filters` at once, so nothing filters by it; its chip stays on the row until its panel closes, and picking a value
|
|
8
|
+
* again puts it back in its place.
|
|
9
|
+
*
|
|
10
|
+
* <FilterBar bind:filters fields={[
|
|
11
|
+
* { key: 'status', label: 'Status', icon: 'circleDashed', options: [{ value: 'open', label: 'Open', icon: 'checkCircle', tone: 'success', hint: '12 items' }, …], plural: 'statuses' },
|
|
12
|
+
* { key: 'created', label: 'Created', icon: 'calendar', kind: 'date' },
|
|
13
|
+
* { key: 'words', label: 'Keywords', icon: 'search', kind: 'text' },
|
|
14
|
+
* ]} />
|
|
15
|
+
*
|
|
16
|
+
* fields: [{ key, label, icon?, kind?, options?, operators?, plural?, presets?, search? }]. kind:
|
|
17
|
+
* 'options' (the default): ticks values of `options` (OptionList's shape: { value, label, icon?, tone?, hint? });
|
|
18
|
+
* the filter's value is an array. The chip shows one value with its icon, or several as their icons and
|
|
19
|
+
* "3 {plural}" (default "values"). Conditions default to ['is', 'is not']. `search` as OptionList's.
|
|
20
|
+
* 'date': a day from `presets` ([{ value, label }], default datePresets() in lib/dates.js: 1 day ago … 3 months ago)
|
|
21
|
+
* or a calendar; the value is a relative id ('-3d') or an ISO day, relativeDay(value) turns either into a day.
|
|
22
|
+
* Conditions default to ['after', 'before'].
|
|
23
|
+
* 'text': words typed into a TagInput (Enter or a comma adds one); the value is an array of strings, applied as each
|
|
24
|
+
* word is added. The chip shows them as small label chips (three, then "+2"). Conditions default to
|
|
25
|
+
* ['contains', 'does not contain'].
|
|
26
|
+
* 'custom': the `panel` snippet edits the value and `summary` draws it on the chip. Conditions default to ['is'].
|
|
27
|
+
* Without a `panel` snippet a custom field can't be edited, so the add button leaves it out.
|
|
28
|
+
* operators: the conditions to choose from, the first being where a new filter starts.
|
|
29
|
+
* filters (bindable): [{ field, op, value }], field a key of `fields`. The app applies them; this only edits them.
|
|
30
|
+
* onchange(filters): after every edit. label: the row's accessible name ("Filters"). addLabel: the button's ("Add filter").
|
|
31
|
+
* panel: snippet ({ filter, field, set, close }) for a custom field's editor: set(value) stores a value, close() closes.
|
|
32
|
+
* summary: snippet ({ filter, field }) drawing a custom field's value on its chip (default: the value as text).
|
|
33
|
+
* Keyboard: the chips' parts and the add button are in the tab order. In the add panel, Backspace on a field's values
|
|
34
|
+
* goes back to the field list, unless it deletes something there (typed text, a word). Removing a filter moves the focus
|
|
35
|
+
* to the next one, else the button.
|
|
36
|
+
* Other attributes (class…) and attachments go to the row.
|
|
37
|
+
*/
|
|
38
|
+
import { tick } from 'svelte'
|
|
39
|
+
import Icon from '../Icon.svelte'
|
|
40
|
+
import FilterChip from './FilterChip.svelte'
|
|
41
|
+
import OptionList from './OptionList.svelte'
|
|
42
|
+
import DateFilter from './DateFilter.svelte'
|
|
43
|
+
import TagInput from '../inputs/TagInput.svelte'
|
|
44
|
+
import Panel from './Panel.svelte'
|
|
45
|
+
import { tooltip } from '../../lib/tooltip.js'
|
|
46
|
+
import { composing } from '../../lib/dom.js'
|
|
47
|
+
import { datePresets, formatDay, relativeDay } from '../../lib/dates.js'
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @typedef {{ value: any, label: string, icon?: string, tone?: string, hint?: string }} Option
|
|
51
|
+
* @typedef {{ key: string, label: string, icon?: string, kind?: 'options' | 'date' | 'text' | 'custom', options?: Option[], operators?: string[], plural?: string, presets?: { value: string, label: string }[], search?: 'auto' | boolean }} Field
|
|
52
|
+
* @typedef {{ field: string, op: string, value: any }} Filter
|
|
53
|
+
* @typedef {object} Props
|
|
54
|
+
* @property {Field[]} fields
|
|
55
|
+
* @property {Filter[]} [filters] bindable
|
|
56
|
+
* @property {(filters: Filter[]) => void} [onchange]
|
|
57
|
+
* @property {string} [label]
|
|
58
|
+
* @property {string} [addLabel]
|
|
59
|
+
* @property {import('svelte').Snippet<[{ filter: Filter, field: Field, set: (value: any) => void, close: () => void }]>} [panel]
|
|
60
|
+
* @property {import('svelte').Snippet<[{ filter: Filter, field: Field }]>} [summary]
|
|
61
|
+
*/
|
|
62
|
+
/** @type {Props & Omit<import('svelte/elements').HTMLAttributes<HTMLDivElement>, keyof Props>} */
|
|
63
|
+
let {
|
|
64
|
+
fields,
|
|
65
|
+
filters = $bindable([]),
|
|
66
|
+
onchange,
|
|
67
|
+
label = 'Filters',
|
|
68
|
+
addLabel = 'Add filter',
|
|
69
|
+
panel,
|
|
70
|
+
summary,
|
|
71
|
+
class: className,
|
|
72
|
+
...rest
|
|
73
|
+
} = $props()
|
|
74
|
+
|
|
75
|
+
const uid = $props.id()
|
|
76
|
+
const anchor = `--filter-add-${uid}`
|
|
77
|
+
/** @type {HTMLButtonElement | undefined} */
|
|
78
|
+
let addButton = $state()
|
|
79
|
+
/** @type {Record<string, { focus: () => void }>} */
|
|
80
|
+
const chips = $state({})
|
|
81
|
+
/** The field whose chip has its panel open. */
|
|
82
|
+
let openKey = $state(/** @type {string | null} */ (null))
|
|
83
|
+
/** The add panel: closed, listing the fields, or showing one field's values. */
|
|
84
|
+
let adding = $state(/** @type {null | { key: string | null }} */ (null))
|
|
85
|
+
/** A filter emptied while its panel is open: out of `filters`, but its chip stays on the row (at `at`) until it closes. */
|
|
86
|
+
let held = $state(/** @type {null | { at: number, filter: Filter }} */ (null))
|
|
87
|
+
/** The chips on the row: the filters, with the held one back in its place. */
|
|
88
|
+
const rows = $derived.by(() => {
|
|
89
|
+
if (!held || filters.some((x) => x.field === held?.filter.field)) return filters
|
|
90
|
+
const at = Math.min(held.at, filters.length)
|
|
91
|
+
return [...filters.slice(0, at), held.filter, ...filters.slice(at)]
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const byKey = $derived(new Map(fields.map((f) => [f.key, f])))
|
|
95
|
+
/** @param {Field} f */
|
|
96
|
+
const kindOf = (f) => f.kind ?? 'options'
|
|
97
|
+
/** Whether a field has something to edit it with: a custom one needs the `panel` snippet. @param {Field} f */
|
|
98
|
+
const editable = (f) => kindOf(f) !== 'custom' || !!panel
|
|
99
|
+
const fieldOptions = $derived(fields.filter(editable).map((f) => ({ value: f.key, label: f.label, icon: f.icon })))
|
|
100
|
+
/** @param {Field} f */
|
|
101
|
+
const operatorsOf = (f) =>
|
|
102
|
+
f.operators ?? { options: ['is', 'is not'], date: ['after', 'before'], text: ['contains', 'does not contain'], custom: ['is'] }[kindOf(f)]
|
|
103
|
+
/** @param {any} v */
|
|
104
|
+
const isEmpty = (v) => v == null || v === '' || (Array.isArray(v) && !v.length)
|
|
105
|
+
/** @param {string} key */
|
|
106
|
+
const find = (key) => rows.find((x) => x.field === key)
|
|
107
|
+
/** @param {string} key */
|
|
108
|
+
const isHeld = (key) => held?.filter.field === key
|
|
109
|
+
|
|
110
|
+
/** @param {Filter[]} next */
|
|
111
|
+
function commitAll(next) {
|
|
112
|
+
filters = next
|
|
113
|
+
onchange?.(next)
|
|
114
|
+
}
|
|
115
|
+
/** @param {string} key @param {Partial<Filter>} patch */
|
|
116
|
+
function update(key, patch) {
|
|
117
|
+
if (held && isHeld(key)) {
|
|
118
|
+
const filter = { ...held.filter, ...patch }
|
|
119
|
+
if (isEmpty(filter.value)) held = { ...held, filter }
|
|
120
|
+
else {
|
|
121
|
+
const at = Math.min(held.at, filters.length)
|
|
122
|
+
held = null
|
|
123
|
+
commitAll([...filters.slice(0, at), filter, ...filters.slice(at)])
|
|
124
|
+
}
|
|
125
|
+
return
|
|
126
|
+
}
|
|
127
|
+
const at = filters.findIndex((x) => x.field === key)
|
|
128
|
+
if (at < 0) return
|
|
129
|
+
const filter = { ...filters[at], ...patch }
|
|
130
|
+
if (isEmpty(filter.value)) {
|
|
131
|
+
// Nothing to filter by: out of `filters` now, its chip held on the row until its panel closes.
|
|
132
|
+
held = { at, filter }
|
|
133
|
+
commitAll(filters.filter((_, i) => i !== at))
|
|
134
|
+
} else commitAll(filters.map((x, i) => (i === at ? filter : x)))
|
|
135
|
+
}
|
|
136
|
+
/** Stores a value for a field: on its filter, or as a new one once there is something to filter by. @param {string} key @param {any} value */
|
|
137
|
+
function put(key, value) {
|
|
138
|
+
const field = byKey.get(key)
|
|
139
|
+
if (!field) return
|
|
140
|
+
if (find(key)) update(key, { value })
|
|
141
|
+
else if (!isEmpty(value)) commitAll([...filters, { field: key, op: operatorsOf(field)[0], value }])
|
|
142
|
+
}
|
|
143
|
+
/** Drops a field's chip if it has nothing left to filter by. @param {string} key */
|
|
144
|
+
function prune(key) {
|
|
145
|
+
if (isHeld(key)) held = null
|
|
146
|
+
const f = filters.find((x) => x.field === key)
|
|
147
|
+
if (f && isEmpty(f.value)) commitAll(filters.filter((x) => x !== f))
|
|
148
|
+
}
|
|
149
|
+
/** @param {string} key */
|
|
150
|
+
async function remove(key) {
|
|
151
|
+
const at = rows.findIndex((x) => x.field === key)
|
|
152
|
+
if (at < 0) return
|
|
153
|
+
if (openKey === key) openKey = null
|
|
154
|
+
if (isHeld(key)) held = null
|
|
155
|
+
commitAll(filters.filter((x) => x.field !== key))
|
|
156
|
+
await tick()
|
|
157
|
+
const next = rows[at] ?? rows[at - 1]
|
|
158
|
+
if (next) chips[next.field]?.focus()
|
|
159
|
+
else addButton?.focus()
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** @param {string} key */
|
|
163
|
+
function pickField(key) {
|
|
164
|
+
if (find(key)) {
|
|
165
|
+
adding = null
|
|
166
|
+
openKey = key
|
|
167
|
+
} else adding = { key }
|
|
168
|
+
}
|
|
169
|
+
/** @param {boolean} refocus */
|
|
170
|
+
function closeAdding(refocus) {
|
|
171
|
+
const key = adding?.key
|
|
172
|
+
adding = null
|
|
173
|
+
if (key) prune(key)
|
|
174
|
+
if (refocus) addButton?.focus()
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Attachment on the add panel's value step: it replaces the field list, which held the focus, so the focus moves into
|
|
178
|
+
* it (OptionList takes it itself; a text or custom editor doesn't). */
|
|
179
|
+
const focusIn = (/** @type {HTMLElement} */ node) => {
|
|
180
|
+
tick().then(() => {
|
|
181
|
+
if (node.contains(document.activeElement)) return
|
|
182
|
+
;/** @type {HTMLElement | null} */ (node.querySelector('input, textarea, button:not(:disabled), [tabindex]:not([tabindex="-1"])'))?.focus()
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Attachment on the add panel's value step: Backspace goes back to the field list, whichever editor has the focus,
|
|
187
|
+
* unless the editor used it (a TagInput removing a word) or it deletes text where it was pressed.
|
|
188
|
+
* @param {() => void} back */
|
|
189
|
+
const NOT_TYPED = new Set(['checkbox', 'radio', 'button', 'submit', 'reset', 'range', 'color', 'file', 'image'])
|
|
190
|
+
const backOnBackspace = (back) => (/** @type {HTMLElement} */ node) => {
|
|
191
|
+
/** @param {KeyboardEvent} e */
|
|
192
|
+
const onkeydown = (e) => {
|
|
193
|
+
if (e.key !== 'Backspace' || e.defaultPrevented || composing(e) || e.ctrlKey || e.metaKey || e.altKey) return
|
|
194
|
+
const t = /** @type {HTMLElement} */ (e.target)
|
|
195
|
+
if (t.isContentEditable && t.textContent) return
|
|
196
|
+
// Text a Backspace would delete (a checkbox's or a button-like input's value isn't).
|
|
197
|
+
if (t instanceof HTMLTextAreaElement && t.value && !t.readOnly) return
|
|
198
|
+
if (t instanceof HTMLInputElement && t.value && !t.readOnly && !NOT_TYPED.has(t.type)) return
|
|
199
|
+
e.preventDefault()
|
|
200
|
+
back()
|
|
201
|
+
}
|
|
202
|
+
node.addEventListener('keydown', onkeydown)
|
|
203
|
+
return () => node.removeEventListener('keydown', onkeydown)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** @param {Filter} filter @param {Field} field */
|
|
207
|
+
const presetOf = (filter, field) => (field.presets ?? datePresets()).find((p) => p.value === filter.value)
|
|
208
|
+
/** @param {Filter} filter @param {Field} field */
|
|
209
|
+
const isPreset = (filter, field) => !!presetOf(filter, field)
|
|
210
|
+
/** @param {Filter} filter @param {Field} field */
|
|
211
|
+
function describe(filter, field) {
|
|
212
|
+
if (kindOf(field) === 'date') {
|
|
213
|
+
const day = relativeDay(filter.value)
|
|
214
|
+
return presetOf(filter, field)?.label ?? (day ? formatDay(day) : String(filter.value ?? ''))
|
|
215
|
+
}
|
|
216
|
+
return String(filter.value ?? '')
|
|
217
|
+
}
|
|
218
|
+
</script>
|
|
219
|
+
|
|
220
|
+
{#snippet editor(/** @type {Field} */ field, /** @type {Filter} */ current, /** @type {() => void} */ close)}
|
|
221
|
+
{#if kindOf(field) === 'options'}
|
|
222
|
+
<OptionList
|
|
223
|
+
value={current.value ?? []}
|
|
224
|
+
options={field.options ?? []}
|
|
225
|
+
label={field.label}
|
|
226
|
+
search={field.search ?? 'auto'}
|
|
227
|
+
onchange={(v) => put(field.key, v)}
|
|
228
|
+
/>
|
|
229
|
+
{:else if kindOf(field) === 'date'}
|
|
230
|
+
<DateFilter
|
|
231
|
+
value={current.value}
|
|
232
|
+
presets={field.presets ?? datePresets()}
|
|
233
|
+
label={field.label}
|
|
234
|
+
onpick={(v) => {
|
|
235
|
+
put(field.key, v)
|
|
236
|
+
close()
|
|
237
|
+
}}
|
|
238
|
+
/>
|
|
239
|
+
{:else if kindOf(field) === 'text'}
|
|
240
|
+
<div class="words">
|
|
241
|
+
<TagInput
|
|
242
|
+
bind:value={() => (Array.isArray(current.value) ? current.value : []), (words) => put(field.key, words)}
|
|
243
|
+
id="{uid}-{field.key}-words"
|
|
244
|
+
label={field.label}
|
|
245
|
+
hideLabel
|
|
246
|
+
placeholder="Type a word, then Enter"
|
|
247
|
+
/>
|
|
248
|
+
</div>
|
|
249
|
+
{:else if panel}
|
|
250
|
+
{@render panel({ filter: current, field, set: (v) => put(field.key, v), close })}
|
|
251
|
+
{/if}
|
|
252
|
+
{/snippet}
|
|
253
|
+
|
|
254
|
+
{#snippet shown(/** @type {Filter} */ filter, /** @type {Field} */ field)}
|
|
255
|
+
{#if kindOf(field) === 'options'}
|
|
256
|
+
{@const on = (field.options ?? []).filter((o) => Array.isArray(filter.value) && filter.value.includes(o.value))}
|
|
257
|
+
{#if on.length === 1}
|
|
258
|
+
{#if on[0].icon}<span class="tone" data-tone={on[0].tone}><Icon name={on[0].icon} size="sm" /></span>{/if}
|
|
259
|
+
<span class="text">{on[0].label}</span>
|
|
260
|
+
{:else}
|
|
261
|
+
<span class="icons">
|
|
262
|
+
{#each on.slice(0, 3) as o (o.value)}
|
|
263
|
+
{#if o.icon}<span class="tone" data-tone={o.tone}><Icon name={o.icon} size="sm" /></span>{/if}
|
|
264
|
+
{/each}
|
|
265
|
+
</span>
|
|
266
|
+
<span class="text"><span class="num">{on.length}</span> {field.plural ?? 'values'}</span>
|
|
267
|
+
{/if}
|
|
268
|
+
{:else if kindOf(field) === 'text'}
|
|
269
|
+
{@const words = Array.isArray(filter.value) ? filter.value : [filter.value]}
|
|
270
|
+
<span class="words-shown">
|
|
271
|
+
{#each words.slice(0, 3) as word (word)}<span class="label-chip word">{word}</span>{/each}
|
|
272
|
+
{#if words.length > 3}<span class="more">+{words.length - 3}</span>{/if}
|
|
273
|
+
</span>
|
|
274
|
+
{:else if kindOf(field) === 'custom' && summary}
|
|
275
|
+
{@render summary({ filter, field })}
|
|
276
|
+
{:else}
|
|
277
|
+
<span class="text" class:num={kindOf(field) === 'date' && !isPreset(filter, field)}>{describe(filter, field)}</span>
|
|
278
|
+
{/if}
|
|
279
|
+
{/snippet}
|
|
280
|
+
|
|
281
|
+
<div class={['filter-bar', className]} role="group" aria-label={label} {...rest}>
|
|
282
|
+
{#each rows as filter (filter.field)}
|
|
283
|
+
{@const field = byKey.get(filter.field)}
|
|
284
|
+
{#if field}
|
|
285
|
+
{#snippet editPanel(/** @type {{ close: () => void }} */ { close })}{@render editor(field, filter, close)}{/snippet}
|
|
286
|
+
<FilterChip
|
|
287
|
+
bind:this={chips[filter.field]}
|
|
288
|
+
field={{ label: field.label, icon: field.icon }}
|
|
289
|
+
operator={filter.op}
|
|
290
|
+
operators={operatorsOf(field)}
|
|
291
|
+
onoperator={(op) => update(field.key, { op })}
|
|
292
|
+
onremove={() => remove(field.key)}
|
|
293
|
+
bind:open={() => openKey === field.key, (v) => (openKey = v ? field.key : openKey === field.key ? null : openKey)}
|
|
294
|
+
onclose={() => prune(field.key)}
|
|
295
|
+
panel={editable(field) ? editPanel : undefined}
|
|
296
|
+
>
|
|
297
|
+
{#snippet value()}<span class="summary">{@render shown(filter, field)}</span>{/snippet}
|
|
298
|
+
</FilterChip>
|
|
299
|
+
{/if}
|
|
300
|
+
{/each}
|
|
301
|
+
<button
|
|
302
|
+
bind:this={addButton}
|
|
303
|
+
type="button"
|
|
304
|
+
class="icon-btn add"
|
|
305
|
+
style:anchor-name={anchor}
|
|
306
|
+
aria-label={addLabel}
|
|
307
|
+
aria-haspopup="dialog"
|
|
308
|
+
aria-expanded={!!adding}
|
|
309
|
+
{@attach tooltip(addLabel)}
|
|
310
|
+
onclick={() => (adding ? closeAdding(true) : (adding = { key: null }))}
|
|
311
|
+
>
|
|
312
|
+
<Icon name="funnel" />
|
|
313
|
+
</button>
|
|
314
|
+
</div>
|
|
315
|
+
|
|
316
|
+
{#if adding && addButton}
|
|
317
|
+
{@const field = adding.key ? byKey.get(adding.key) : null}
|
|
318
|
+
<Panel anchor={addButton} name={anchor} label={field ? field.label : addLabel} onclose={closeAdding}>
|
|
319
|
+
{#if field}
|
|
320
|
+
{#key field.key}
|
|
321
|
+
<div
|
|
322
|
+
class="step"
|
|
323
|
+
{@attach focusIn}
|
|
324
|
+
{@attach backOnBackspace(() => {
|
|
325
|
+
prune(field.key)
|
|
326
|
+
adding = { key: null }
|
|
327
|
+
})}
|
|
328
|
+
>
|
|
329
|
+
{@render editor(field, find(field.key) ?? { field: field.key, op: operatorsOf(field)[0], value: null }, () => closeAdding(true))}
|
|
330
|
+
</div>
|
|
331
|
+
{/key}
|
|
332
|
+
{:else}
|
|
333
|
+
<OptionList options={fieldOptions} multiple={false} label={addLabel} placeholder="Filter by…" onpick={pickField} />
|
|
334
|
+
{/if}
|
|
335
|
+
</Panel>
|
|
336
|
+
{/if}
|
|
337
|
+
|
|
338
|
+
<style>
|
|
339
|
+
/* Chrome, not content: a press or drag across the row doesn't select its words. */
|
|
340
|
+
.filter-bar {
|
|
341
|
+
user-select: none;
|
|
342
|
+
display: flex;
|
|
343
|
+
flex-wrap: wrap;
|
|
344
|
+
align-items: center;
|
|
345
|
+
gap: var(--space-2);
|
|
346
|
+
min-width: 0;
|
|
347
|
+
}
|
|
348
|
+
.step {
|
|
349
|
+
display: flex;
|
|
350
|
+
flex-direction: column;
|
|
351
|
+
min-height: 0;
|
|
352
|
+
}
|
|
353
|
+
.words {
|
|
354
|
+
width: 280px;
|
|
355
|
+
max-width: 100%;
|
|
356
|
+
padding: var(--space-2);
|
|
357
|
+
}
|
|
358
|
+
.summary {
|
|
359
|
+
display: inline-flex;
|
|
360
|
+
align-items: center;
|
|
361
|
+
gap: 6px;
|
|
362
|
+
min-width: 0;
|
|
363
|
+
}
|
|
364
|
+
.text {
|
|
365
|
+
min-width: 0;
|
|
366
|
+
overflow: clip;
|
|
367
|
+
text-overflow: ellipsis;
|
|
368
|
+
}
|
|
369
|
+
.num {
|
|
370
|
+
font-family: var(--font-data);
|
|
371
|
+
font-variant-numeric: tabular-nums;
|
|
372
|
+
}
|
|
373
|
+
.words-shown {
|
|
374
|
+
display: inline-flex;
|
|
375
|
+
align-items: center;
|
|
376
|
+
gap: var(--space-1);
|
|
377
|
+
min-width: 0;
|
|
378
|
+
}
|
|
379
|
+
/* The .label-chip atom, a size down to sit inside the chip's 26px row. */
|
|
380
|
+
.word {
|
|
381
|
+
min-height: 18px;
|
|
382
|
+
padding: 0 6px;
|
|
383
|
+
color: var(--fg-2);
|
|
384
|
+
}
|
|
385
|
+
.more {
|
|
386
|
+
color: var(--muted);
|
|
387
|
+
font-family: var(--font-data);
|
|
388
|
+
font-variant-numeric: tabular-nums;
|
|
389
|
+
}
|
|
390
|
+
.icons {
|
|
391
|
+
display: inline-flex;
|
|
392
|
+
gap: 2px;
|
|
393
|
+
}
|
|
394
|
+
.tone {
|
|
395
|
+
display: inline-flex;
|
|
396
|
+
color: var(--muted);
|
|
397
|
+
}
|
|
398
|
+
.tone[data-tone] {
|
|
399
|
+
color: var(--tone);
|
|
400
|
+
}
|
|
401
|
+
</style>
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
export default FilterBar;
|
|
2
|
+
type FilterBar = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props & Omit<HTMLAttributes<HTMLDivElement>, keyof Props>>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const FilterBar: import("svelte").Component<{
|
|
7
|
+
fields: {
|
|
8
|
+
key: string;
|
|
9
|
+
label: string;
|
|
10
|
+
icon?: string;
|
|
11
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
12
|
+
options?: {
|
|
13
|
+
value: any;
|
|
14
|
+
label: string;
|
|
15
|
+
icon?: string;
|
|
16
|
+
tone?: string;
|
|
17
|
+
hint?: string;
|
|
18
|
+
}[];
|
|
19
|
+
operators?: string[];
|
|
20
|
+
plural?: string;
|
|
21
|
+
presets?: {
|
|
22
|
+
value: string;
|
|
23
|
+
label: string;
|
|
24
|
+
}[];
|
|
25
|
+
search?: "auto" | boolean;
|
|
26
|
+
}[];
|
|
27
|
+
/**
|
|
28
|
+
* bindable
|
|
29
|
+
*/
|
|
30
|
+
filters?: {
|
|
31
|
+
field: string;
|
|
32
|
+
op: string;
|
|
33
|
+
value: any;
|
|
34
|
+
}[] | undefined;
|
|
35
|
+
onchange?: ((filters: {
|
|
36
|
+
field: string;
|
|
37
|
+
op: string;
|
|
38
|
+
value: any;
|
|
39
|
+
}[]) => void) | undefined;
|
|
40
|
+
label?: string | undefined;
|
|
41
|
+
addLabel?: string | undefined;
|
|
42
|
+
panel?: import("svelte").Snippet<[{
|
|
43
|
+
filter: {
|
|
44
|
+
field: string;
|
|
45
|
+
op: string;
|
|
46
|
+
value: any;
|
|
47
|
+
};
|
|
48
|
+
field: {
|
|
49
|
+
key: string;
|
|
50
|
+
label: string;
|
|
51
|
+
icon?: string;
|
|
52
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
53
|
+
options?: {
|
|
54
|
+
value: any;
|
|
55
|
+
label: string;
|
|
56
|
+
icon?: string;
|
|
57
|
+
tone?: string;
|
|
58
|
+
hint?: string;
|
|
59
|
+
}[];
|
|
60
|
+
operators?: string[];
|
|
61
|
+
plural?: string;
|
|
62
|
+
presets?: {
|
|
63
|
+
value: string;
|
|
64
|
+
label: string;
|
|
65
|
+
}[];
|
|
66
|
+
search?: "auto" | boolean;
|
|
67
|
+
};
|
|
68
|
+
set: (value: any) => void;
|
|
69
|
+
close: () => void;
|
|
70
|
+
}]> | undefined;
|
|
71
|
+
summary?: import("svelte").Snippet<[{
|
|
72
|
+
filter: {
|
|
73
|
+
field: string;
|
|
74
|
+
op: string;
|
|
75
|
+
value: any;
|
|
76
|
+
};
|
|
77
|
+
field: {
|
|
78
|
+
key: string;
|
|
79
|
+
label: string;
|
|
80
|
+
icon?: string;
|
|
81
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
82
|
+
options?: {
|
|
83
|
+
value: any;
|
|
84
|
+
label: string;
|
|
85
|
+
icon?: string;
|
|
86
|
+
tone?: string;
|
|
87
|
+
hint?: string;
|
|
88
|
+
}[];
|
|
89
|
+
operators?: string[];
|
|
90
|
+
plural?: string;
|
|
91
|
+
presets?: {
|
|
92
|
+
value: string;
|
|
93
|
+
label: string;
|
|
94
|
+
}[];
|
|
95
|
+
search?: "auto" | boolean;
|
|
96
|
+
};
|
|
97
|
+
}]> | undefined;
|
|
98
|
+
} & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof {
|
|
99
|
+
fields: {
|
|
100
|
+
key: string;
|
|
101
|
+
label: string;
|
|
102
|
+
icon?: string;
|
|
103
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
104
|
+
options?: {
|
|
105
|
+
value: any;
|
|
106
|
+
label: string;
|
|
107
|
+
icon?: string;
|
|
108
|
+
tone?: string;
|
|
109
|
+
hint?: string;
|
|
110
|
+
}[];
|
|
111
|
+
operators?: string[];
|
|
112
|
+
plural?: string;
|
|
113
|
+
presets?: {
|
|
114
|
+
value: string;
|
|
115
|
+
label: string;
|
|
116
|
+
}[];
|
|
117
|
+
search?: "auto" | boolean;
|
|
118
|
+
}[];
|
|
119
|
+
/**
|
|
120
|
+
* bindable
|
|
121
|
+
*/
|
|
122
|
+
filters?: {
|
|
123
|
+
field: string;
|
|
124
|
+
op: string;
|
|
125
|
+
value: any;
|
|
126
|
+
}[] | undefined;
|
|
127
|
+
onchange?: ((filters: {
|
|
128
|
+
field: string;
|
|
129
|
+
op: string;
|
|
130
|
+
value: any;
|
|
131
|
+
}[]) => void) | undefined;
|
|
132
|
+
label?: string | undefined;
|
|
133
|
+
addLabel?: string | undefined;
|
|
134
|
+
panel?: import("svelte").Snippet<[{
|
|
135
|
+
filter: {
|
|
136
|
+
field: string;
|
|
137
|
+
op: string;
|
|
138
|
+
value: any;
|
|
139
|
+
};
|
|
140
|
+
field: {
|
|
141
|
+
key: string;
|
|
142
|
+
label: string;
|
|
143
|
+
icon?: string;
|
|
144
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
145
|
+
options?: {
|
|
146
|
+
value: any;
|
|
147
|
+
label: string;
|
|
148
|
+
icon?: string;
|
|
149
|
+
tone?: string;
|
|
150
|
+
hint?: string;
|
|
151
|
+
}[];
|
|
152
|
+
operators?: string[];
|
|
153
|
+
plural?: string;
|
|
154
|
+
presets?: {
|
|
155
|
+
value: string;
|
|
156
|
+
label: string;
|
|
157
|
+
}[];
|
|
158
|
+
search?: "auto" | boolean;
|
|
159
|
+
};
|
|
160
|
+
set: (value: any) => void;
|
|
161
|
+
close: () => void;
|
|
162
|
+
}]> | undefined;
|
|
163
|
+
summary?: import("svelte").Snippet<[{
|
|
164
|
+
filter: {
|
|
165
|
+
field: string;
|
|
166
|
+
op: string;
|
|
167
|
+
value: any;
|
|
168
|
+
};
|
|
169
|
+
field: {
|
|
170
|
+
key: string;
|
|
171
|
+
label: string;
|
|
172
|
+
icon?: string;
|
|
173
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
174
|
+
options?: {
|
|
175
|
+
value: any;
|
|
176
|
+
label: string;
|
|
177
|
+
icon?: string;
|
|
178
|
+
tone?: string;
|
|
179
|
+
hint?: string;
|
|
180
|
+
}[];
|
|
181
|
+
operators?: string[];
|
|
182
|
+
plural?: string;
|
|
183
|
+
presets?: {
|
|
184
|
+
value: string;
|
|
185
|
+
label: string;
|
|
186
|
+
}[];
|
|
187
|
+
search?: "auto" | boolean;
|
|
188
|
+
};
|
|
189
|
+
}]> | undefined;
|
|
190
|
+
}>, {}, "filters">;
|
|
191
|
+
type Props = {
|
|
192
|
+
fields: {
|
|
193
|
+
key: string;
|
|
194
|
+
label: string;
|
|
195
|
+
icon?: string;
|
|
196
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
197
|
+
options?: {
|
|
198
|
+
value: any;
|
|
199
|
+
label: string;
|
|
200
|
+
icon?: string;
|
|
201
|
+
tone?: string;
|
|
202
|
+
hint?: string;
|
|
203
|
+
}[];
|
|
204
|
+
operators?: string[];
|
|
205
|
+
plural?: string;
|
|
206
|
+
presets?: {
|
|
207
|
+
value: string;
|
|
208
|
+
label: string;
|
|
209
|
+
}[];
|
|
210
|
+
search?: "auto" | boolean;
|
|
211
|
+
}[];
|
|
212
|
+
/**
|
|
213
|
+
* bindable
|
|
214
|
+
*/
|
|
215
|
+
filters?: {
|
|
216
|
+
field: string;
|
|
217
|
+
op: string;
|
|
218
|
+
value: any;
|
|
219
|
+
}[] | undefined;
|
|
220
|
+
onchange?: ((filters: {
|
|
221
|
+
field: string;
|
|
222
|
+
op: string;
|
|
223
|
+
value: any;
|
|
224
|
+
}[]) => void) | undefined;
|
|
225
|
+
label?: string | undefined;
|
|
226
|
+
addLabel?: string | undefined;
|
|
227
|
+
panel?: import("svelte").Snippet<[{
|
|
228
|
+
filter: {
|
|
229
|
+
field: string;
|
|
230
|
+
op: string;
|
|
231
|
+
value: any;
|
|
232
|
+
};
|
|
233
|
+
field: {
|
|
234
|
+
key: string;
|
|
235
|
+
label: string;
|
|
236
|
+
icon?: string;
|
|
237
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
238
|
+
options?: {
|
|
239
|
+
value: any;
|
|
240
|
+
label: string;
|
|
241
|
+
icon?: string;
|
|
242
|
+
tone?: string;
|
|
243
|
+
hint?: string;
|
|
244
|
+
}[];
|
|
245
|
+
operators?: string[];
|
|
246
|
+
plural?: string;
|
|
247
|
+
presets?: {
|
|
248
|
+
value: string;
|
|
249
|
+
label: string;
|
|
250
|
+
}[];
|
|
251
|
+
search?: "auto" | boolean;
|
|
252
|
+
};
|
|
253
|
+
set: (value: any) => void;
|
|
254
|
+
close: () => void;
|
|
255
|
+
}]> | undefined;
|
|
256
|
+
summary?: import("svelte").Snippet<[{
|
|
257
|
+
filter: {
|
|
258
|
+
field: string;
|
|
259
|
+
op: string;
|
|
260
|
+
value: any;
|
|
261
|
+
};
|
|
262
|
+
field: {
|
|
263
|
+
key: string;
|
|
264
|
+
label: string;
|
|
265
|
+
icon?: string;
|
|
266
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
267
|
+
options?: {
|
|
268
|
+
value: any;
|
|
269
|
+
label: string;
|
|
270
|
+
icon?: string;
|
|
271
|
+
tone?: string;
|
|
272
|
+
hint?: string;
|
|
273
|
+
}[];
|
|
274
|
+
operators?: string[];
|
|
275
|
+
plural?: string;
|
|
276
|
+
presets?: {
|
|
277
|
+
value: string;
|
|
278
|
+
label: string;
|
|
279
|
+
}[];
|
|
280
|
+
search?: "auto" | boolean;
|
|
281
|
+
};
|
|
282
|
+
}]> | undefined;
|
|
283
|
+
};
|