@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,91 @@
|
|
|
1
|
+
export default OptionList;
|
|
2
|
+
type OptionList = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props & Omit<HTMLAttributes<HTMLDivElement>, keyof Props>>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const OptionList: import("svelte").Component<{
|
|
7
|
+
/**
|
|
8
|
+
* bindable: an array, or one value when not `multiple`
|
|
9
|
+
*/
|
|
10
|
+
value?: any;
|
|
11
|
+
options: {
|
|
12
|
+
value: any;
|
|
13
|
+
label: string;
|
|
14
|
+
icon?: string;
|
|
15
|
+
tone?: string;
|
|
16
|
+
hint?: string;
|
|
17
|
+
}[];
|
|
18
|
+
label: string;
|
|
19
|
+
multiple?: boolean | undefined;
|
|
20
|
+
search?: boolean | "auto" | undefined;
|
|
21
|
+
placeholder?: string | undefined;
|
|
22
|
+
empty?: string | undefined;
|
|
23
|
+
onchange?: ((value: any) => void) | undefined;
|
|
24
|
+
onpick?: ((value: any) => void) | undefined;
|
|
25
|
+
onback?: (() => void) | undefined;
|
|
26
|
+
lead?: import("svelte").Snippet<[{
|
|
27
|
+
value: any;
|
|
28
|
+
label: string;
|
|
29
|
+
icon?: string;
|
|
30
|
+
tone?: string;
|
|
31
|
+
hint?: string;
|
|
32
|
+
}]> | undefined;
|
|
33
|
+
autofocus?: boolean | undefined;
|
|
34
|
+
} & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof {
|
|
35
|
+
/**
|
|
36
|
+
* bindable: an array, or one value when not `multiple`
|
|
37
|
+
*/
|
|
38
|
+
value?: any;
|
|
39
|
+
options: {
|
|
40
|
+
value: any;
|
|
41
|
+
label: string;
|
|
42
|
+
icon?: string;
|
|
43
|
+
tone?: string;
|
|
44
|
+
hint?: string;
|
|
45
|
+
}[];
|
|
46
|
+
label: string;
|
|
47
|
+
multiple?: boolean | undefined;
|
|
48
|
+
search?: boolean | "auto" | undefined;
|
|
49
|
+
placeholder?: string | undefined;
|
|
50
|
+
empty?: string | undefined;
|
|
51
|
+
onchange?: ((value: any) => void) | undefined;
|
|
52
|
+
onpick?: ((value: any) => void) | undefined;
|
|
53
|
+
onback?: (() => void) | undefined;
|
|
54
|
+
lead?: import("svelte").Snippet<[{
|
|
55
|
+
value: any;
|
|
56
|
+
label: string;
|
|
57
|
+
icon?: string;
|
|
58
|
+
tone?: string;
|
|
59
|
+
hint?: string;
|
|
60
|
+
}]> | undefined;
|
|
61
|
+
autofocus?: boolean | undefined;
|
|
62
|
+
}>, {}, "value">;
|
|
63
|
+
type Props = {
|
|
64
|
+
/**
|
|
65
|
+
* bindable: an array, or one value when not `multiple`
|
|
66
|
+
*/
|
|
67
|
+
value?: any;
|
|
68
|
+
options: {
|
|
69
|
+
value: any;
|
|
70
|
+
label: string;
|
|
71
|
+
icon?: string;
|
|
72
|
+
tone?: string;
|
|
73
|
+
hint?: string;
|
|
74
|
+
}[];
|
|
75
|
+
label: string;
|
|
76
|
+
multiple?: boolean | undefined;
|
|
77
|
+
search?: boolean | "auto" | undefined;
|
|
78
|
+
placeholder?: string | undefined;
|
|
79
|
+
empty?: string | undefined;
|
|
80
|
+
onchange?: ((value: any) => void) | undefined;
|
|
81
|
+
onpick?: ((value: any) => void) | undefined;
|
|
82
|
+
onback?: (() => void) | undefined;
|
|
83
|
+
lead?: import("svelte").Snippet<[{
|
|
84
|
+
value: any;
|
|
85
|
+
label: string;
|
|
86
|
+
icon?: string;
|
|
87
|
+
tone?: string;
|
|
88
|
+
hint?: string;
|
|
89
|
+
}]> | undefined;
|
|
90
|
+
autofocus?: boolean | undefined;
|
|
91
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* Internal to filters/: the floating panel a filter's value editor and the add button's field list open in. It sits
|
|
4
|
+
* in the top layer (above modal dialogs), anchored under its button with CSS anchor positioning (flipping above, or
|
|
5
|
+
* to end at the button's right edge, where there is no room), grows out of the button and fades as it closes.
|
|
6
|
+
* The owner gives its button `style:anchor-name={name}` and renders this while open.
|
|
7
|
+
*
|
|
8
|
+
* <Panel anchor={button} name="--filter-x" label="Health" onclose={(refocus) => …}>…</Panel>
|
|
9
|
+
*
|
|
10
|
+
* anchor: the button it belongs to. name: that button's anchor-name. label: the panel's accessible name.
|
|
11
|
+
* onclose(refocus): asked to close: Esc (refocus true), a press outside it and its button (false), Tab or Shift+Tab
|
|
12
|
+
* past its last or first control (true, so the Tab carries on from the button).
|
|
13
|
+
* As it opens, the focus goes to its first control unless the content takes it (OptionList does).
|
|
14
|
+
*/
|
|
15
|
+
import { tick } from 'svelte'
|
|
16
|
+
import { topLayer } from '../../lib/dom.js'
|
|
17
|
+
import { pop } from '../../lib/motion.js'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {object} Props
|
|
21
|
+
* @property {HTMLElement} anchor
|
|
22
|
+
* @property {string} name
|
|
23
|
+
* @property {string} label
|
|
24
|
+
* @property {(refocus: boolean) => void} onclose
|
|
25
|
+
* @property {import('svelte').Snippet} children
|
|
26
|
+
*/
|
|
27
|
+
/** @type {Props & Omit<import('svelte/elements').HTMLAttributes<HTMLDivElement>, keyof Props>} */
|
|
28
|
+
let { anchor, name, label, onclose, children, class: className, ...rest } = $props()
|
|
29
|
+
/** @type {HTMLDivElement | undefined} */
|
|
30
|
+
let panel = $state()
|
|
31
|
+
|
|
32
|
+
const focusable = 'input, textarea, button:not(:disabled), [href], [tabindex]:not([tabindex="-1"])'
|
|
33
|
+
|
|
34
|
+
/** Attachment: once the content is in, puts the focus on its first control unless it took the focus itself. */
|
|
35
|
+
const settle = (/** @type {HTMLElement} */ node) => {
|
|
36
|
+
tick().then(() => {
|
|
37
|
+
if (!node.contains(document.activeElement)) /** @type {HTMLElement | null} */ (node.querySelector(focusable) ?? node).focus({ preventScroll: true })
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** @param {PointerEvent} e */
|
|
42
|
+
function outside(e) {
|
|
43
|
+
const target = /** @type {Element} */ (e.target)
|
|
44
|
+
if (panel?.contains(target) || anchor?.contains(target) || target.closest?.('.ctx-menu, .tooltip')) return
|
|
45
|
+
onclose(false)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** @param {KeyboardEvent} e */
|
|
49
|
+
function onkeydown(e) {
|
|
50
|
+
if (e.key === 'Escape') {
|
|
51
|
+
e.preventDefault()
|
|
52
|
+
e.stopPropagation()
|
|
53
|
+
onclose(true)
|
|
54
|
+
} else if (e.key === 'Tab' && panel) {
|
|
55
|
+
const stops = /** @type {HTMLElement[]} */ ([...panel.querySelectorAll(focusable)]).filter(
|
|
56
|
+
(el) => el.tabIndex >= 0 && el.checkVisibility(),
|
|
57
|
+
)
|
|
58
|
+
const at = stops.indexOf(/** @type {HTMLElement} */ (document.activeElement))
|
|
59
|
+
// Past either end: back on the button first, so the browser's Tab moves on from there (the panel sits at the end of
|
|
60
|
+
// <body>, where a Tab would otherwise go next).
|
|
61
|
+
if (at < 0 || (e.shiftKey ? at === 0 : at === stops.length - 1)) onclose(true)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<svelte:document onpointerdowncapture={outside} />
|
|
67
|
+
|
|
68
|
+
<div
|
|
69
|
+
bind:this={panel}
|
|
70
|
+
class={['filter-panel', className]}
|
|
71
|
+
style:position-anchor={name}
|
|
72
|
+
role="dialog"
|
|
73
|
+
aria-label={label}
|
|
74
|
+
tabindex="-1"
|
|
75
|
+
data-floating
|
|
76
|
+
{...rest}
|
|
77
|
+
{@attach topLayer(anchor)}
|
|
78
|
+
{@attach settle}
|
|
79
|
+
transition:pop={{ from: anchor }}
|
|
80
|
+
{onkeydown}
|
|
81
|
+
>
|
|
82
|
+
{@render children()}
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<style>
|
|
86
|
+
.filter-panel {
|
|
87
|
+
position: fixed;
|
|
88
|
+
z-index: calc(var(--z-overlay) + 1);
|
|
89
|
+
position-area: block-end span-inline-end;
|
|
90
|
+
position-try-fallbacks:
|
|
91
|
+
flip-block,
|
|
92
|
+
flip-inline,
|
|
93
|
+
flip-block flip-inline;
|
|
94
|
+
position-visibility: anchors-visible;
|
|
95
|
+
/* A touch to the left of the field, so the list's text lines up under the field's own (mirrored when it flips to
|
|
96
|
+
end at the field's right edge: a flip swaps the inline margins too). */
|
|
97
|
+
margin-inline-start: calc(var(--space-1) * -1);
|
|
98
|
+
margin-block: 4px;
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
width: max-content;
|
|
102
|
+
min-width: 240px;
|
|
103
|
+
max-width: min(480px, calc(100dvw - 16px));
|
|
104
|
+
max-height: min(480px, calc(100dvh - 16px));
|
|
105
|
+
overflow: auto;
|
|
106
|
+
overscroll-behavior: contain;
|
|
107
|
+
border: 1px solid transparent;
|
|
108
|
+
background:
|
|
109
|
+
linear-gradient(var(--elevated), var(--elevated)) padding-box,
|
|
110
|
+
var(--edge-grad-float);
|
|
111
|
+
border-radius: var(--r-lg);
|
|
112
|
+
box-shadow: var(--shadow);
|
|
113
|
+
color: var(--fg-2);
|
|
114
|
+
}
|
|
115
|
+
.filter-panel:focus {
|
|
116
|
+
outline: none;
|
|
117
|
+
}
|
|
118
|
+
@media (forced-colors: active) {
|
|
119
|
+
.filter-panel {
|
|
120
|
+
border-color: CanvasText;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default Panel;
|
|
2
|
+
type Panel = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props & Omit<HTMLAttributes<HTMLDivElement>, keyof Props>>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Panel: import("svelte").Component<{
|
|
7
|
+
anchor: HTMLElement;
|
|
8
|
+
name: string;
|
|
9
|
+
label: string;
|
|
10
|
+
onclose: (refocus: boolean) => void;
|
|
11
|
+
children: import("svelte").Snippet;
|
|
12
|
+
} & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof {
|
|
13
|
+
anchor: HTMLElement;
|
|
14
|
+
name: string;
|
|
15
|
+
label: string;
|
|
16
|
+
onclose: (refocus: boolean) => void;
|
|
17
|
+
children: import("svelte").Snippet;
|
|
18
|
+
}>, {}, "">;
|
|
19
|
+
type Props = {
|
|
20
|
+
anchor: HTMLElement;
|
|
21
|
+
name: string;
|
|
22
|
+
label: string;
|
|
23
|
+
onclose: (refocus: boolean) => void;
|
|
24
|
+
children: import("svelte").Snippet;
|
|
25
|
+
};
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
declare const _default: import("svelte").Component<{
|
|
2
|
+
fields: {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
7
|
+
options?: {
|
|
8
|
+
value: any;
|
|
9
|
+
label: string;
|
|
10
|
+
icon?: string;
|
|
11
|
+
tone?: string;
|
|
12
|
+
hint?: string;
|
|
13
|
+
}[];
|
|
14
|
+
operators?: string[];
|
|
15
|
+
plural?: string;
|
|
16
|
+
presets?: {
|
|
17
|
+
value: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}[];
|
|
20
|
+
search?: "auto" | boolean;
|
|
21
|
+
}[];
|
|
22
|
+
/**
|
|
23
|
+
* bindable
|
|
24
|
+
*/
|
|
25
|
+
filters?: {
|
|
26
|
+
field: string;
|
|
27
|
+
op: string;
|
|
28
|
+
value: any;
|
|
29
|
+
}[] | undefined;
|
|
30
|
+
onchange?: ((filters: {
|
|
31
|
+
field: string;
|
|
32
|
+
op: string;
|
|
33
|
+
value: any;
|
|
34
|
+
}[]) => void) | undefined;
|
|
35
|
+
label?: string | undefined;
|
|
36
|
+
addLabel?: string | undefined;
|
|
37
|
+
panel?: import("svelte").Snippet<[{
|
|
38
|
+
filter: {
|
|
39
|
+
field: string;
|
|
40
|
+
op: string;
|
|
41
|
+
value: any;
|
|
42
|
+
};
|
|
43
|
+
field: {
|
|
44
|
+
key: string;
|
|
45
|
+
label: string;
|
|
46
|
+
icon?: string;
|
|
47
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
48
|
+
options?: {
|
|
49
|
+
value: any;
|
|
50
|
+
label: string;
|
|
51
|
+
icon?: string;
|
|
52
|
+
tone?: string;
|
|
53
|
+
hint?: string;
|
|
54
|
+
}[];
|
|
55
|
+
operators?: string[];
|
|
56
|
+
plural?: string;
|
|
57
|
+
presets?: {
|
|
58
|
+
value: string;
|
|
59
|
+
label: string;
|
|
60
|
+
}[];
|
|
61
|
+
search?: "auto" | boolean;
|
|
62
|
+
};
|
|
63
|
+
set: (value: any) => void;
|
|
64
|
+
close: () => void;
|
|
65
|
+
}]> | undefined;
|
|
66
|
+
summary?: import("svelte").Snippet<[{
|
|
67
|
+
filter: {
|
|
68
|
+
field: string;
|
|
69
|
+
op: string;
|
|
70
|
+
value: any;
|
|
71
|
+
};
|
|
72
|
+
field: {
|
|
73
|
+
key: string;
|
|
74
|
+
label: string;
|
|
75
|
+
icon?: string;
|
|
76
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
77
|
+
options?: {
|
|
78
|
+
value: any;
|
|
79
|
+
label: string;
|
|
80
|
+
icon?: string;
|
|
81
|
+
tone?: string;
|
|
82
|
+
hint?: string;
|
|
83
|
+
}[];
|
|
84
|
+
operators?: string[];
|
|
85
|
+
plural?: string;
|
|
86
|
+
presets?: {
|
|
87
|
+
value: string;
|
|
88
|
+
label: string;
|
|
89
|
+
}[];
|
|
90
|
+
search?: "auto" | boolean;
|
|
91
|
+
};
|
|
92
|
+
}]> | undefined;
|
|
93
|
+
} & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof {
|
|
94
|
+
fields: {
|
|
95
|
+
key: string;
|
|
96
|
+
label: string;
|
|
97
|
+
icon?: string;
|
|
98
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
99
|
+
options?: {
|
|
100
|
+
value: any;
|
|
101
|
+
label: string;
|
|
102
|
+
icon?: string;
|
|
103
|
+
tone?: string;
|
|
104
|
+
hint?: string;
|
|
105
|
+
}[];
|
|
106
|
+
operators?: string[];
|
|
107
|
+
plural?: string;
|
|
108
|
+
presets?: {
|
|
109
|
+
value: string;
|
|
110
|
+
label: string;
|
|
111
|
+
}[];
|
|
112
|
+
search?: "auto" | boolean;
|
|
113
|
+
}[];
|
|
114
|
+
/**
|
|
115
|
+
* bindable
|
|
116
|
+
*/
|
|
117
|
+
filters?: {
|
|
118
|
+
field: string;
|
|
119
|
+
op: string;
|
|
120
|
+
value: any;
|
|
121
|
+
}[] | undefined;
|
|
122
|
+
onchange?: ((filters: {
|
|
123
|
+
field: string;
|
|
124
|
+
op: string;
|
|
125
|
+
value: any;
|
|
126
|
+
}[]) => void) | undefined;
|
|
127
|
+
label?: string | undefined;
|
|
128
|
+
addLabel?: string | undefined;
|
|
129
|
+
panel?: import("svelte").Snippet<[{
|
|
130
|
+
filter: {
|
|
131
|
+
field: string;
|
|
132
|
+
op: string;
|
|
133
|
+
value: any;
|
|
134
|
+
};
|
|
135
|
+
field: {
|
|
136
|
+
key: string;
|
|
137
|
+
label: string;
|
|
138
|
+
icon?: string;
|
|
139
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
140
|
+
options?: {
|
|
141
|
+
value: any;
|
|
142
|
+
label: string;
|
|
143
|
+
icon?: string;
|
|
144
|
+
tone?: string;
|
|
145
|
+
hint?: string;
|
|
146
|
+
}[];
|
|
147
|
+
operators?: string[];
|
|
148
|
+
plural?: string;
|
|
149
|
+
presets?: {
|
|
150
|
+
value: string;
|
|
151
|
+
label: string;
|
|
152
|
+
}[];
|
|
153
|
+
search?: "auto" | boolean;
|
|
154
|
+
};
|
|
155
|
+
set: (value: any) => void;
|
|
156
|
+
close: () => void;
|
|
157
|
+
}]> | undefined;
|
|
158
|
+
summary?: import("svelte").Snippet<[{
|
|
159
|
+
filter: {
|
|
160
|
+
field: string;
|
|
161
|
+
op: string;
|
|
162
|
+
value: any;
|
|
163
|
+
};
|
|
164
|
+
field: {
|
|
165
|
+
key: string;
|
|
166
|
+
label: string;
|
|
167
|
+
icon?: string;
|
|
168
|
+
kind?: "options" | "date" | "text" | "custom";
|
|
169
|
+
options?: {
|
|
170
|
+
value: any;
|
|
171
|
+
label: string;
|
|
172
|
+
icon?: string;
|
|
173
|
+
tone?: string;
|
|
174
|
+
hint?: string;
|
|
175
|
+
}[];
|
|
176
|
+
operators?: string[];
|
|
177
|
+
plural?: string;
|
|
178
|
+
presets?: {
|
|
179
|
+
value: string;
|
|
180
|
+
label: string;
|
|
181
|
+
}[];
|
|
182
|
+
search?: "auto" | boolean;
|
|
183
|
+
};
|
|
184
|
+
}]> | undefined;
|
|
185
|
+
}>, {}, "filters"> & {
|
|
186
|
+
Chip: import("svelte").Component<{
|
|
187
|
+
field: {
|
|
188
|
+
label: string;
|
|
189
|
+
icon?: string;
|
|
190
|
+
};
|
|
191
|
+
operator: string;
|
|
192
|
+
operators?: string[] | undefined;
|
|
193
|
+
onoperator?: ((op: string) => void) | undefined;
|
|
194
|
+
onremove: () => void;
|
|
195
|
+
removeLabel?: string | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* bindable
|
|
198
|
+
*/
|
|
199
|
+
open?: boolean | undefined;
|
|
200
|
+
onclose?: (() => void) | undefined;
|
|
201
|
+
value: import("svelte").Snippet;
|
|
202
|
+
panel?: import("svelte").Snippet<[{
|
|
203
|
+
close: () => void;
|
|
204
|
+
}]> | undefined;
|
|
205
|
+
} & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof {
|
|
206
|
+
field: {
|
|
207
|
+
label: string;
|
|
208
|
+
icon?: string;
|
|
209
|
+
};
|
|
210
|
+
operator: string;
|
|
211
|
+
operators?: string[] | undefined;
|
|
212
|
+
onoperator?: ((op: string) => void) | undefined;
|
|
213
|
+
onremove: () => void;
|
|
214
|
+
removeLabel?: string | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* bindable
|
|
217
|
+
*/
|
|
218
|
+
open?: boolean | undefined;
|
|
219
|
+
onclose?: (() => void) | undefined;
|
|
220
|
+
value: import("svelte").Snippet;
|
|
221
|
+
panel?: import("svelte").Snippet<[{
|
|
222
|
+
close: () => void;
|
|
223
|
+
}]> | undefined;
|
|
224
|
+
}>, {
|
|
225
|
+
focus: () => void;
|
|
226
|
+
}, "open">;
|
|
227
|
+
Options: import("svelte").Component<{
|
|
228
|
+
/**
|
|
229
|
+
* bindable: an array, or one value when not `multiple`
|
|
230
|
+
*/
|
|
231
|
+
value?: any;
|
|
232
|
+
options: {
|
|
233
|
+
value: any;
|
|
234
|
+
label: string;
|
|
235
|
+
icon?: string;
|
|
236
|
+
tone?: string;
|
|
237
|
+
hint?: string;
|
|
238
|
+
}[];
|
|
239
|
+
label: string;
|
|
240
|
+
multiple?: boolean | undefined;
|
|
241
|
+
search?: boolean | "auto" | undefined;
|
|
242
|
+
placeholder?: string | undefined;
|
|
243
|
+
empty?: string | undefined;
|
|
244
|
+
onchange?: ((value: any) => void) | undefined;
|
|
245
|
+
onpick?: ((value: any) => void) | undefined;
|
|
246
|
+
onback?: (() => void) | undefined;
|
|
247
|
+
lead?: import("svelte").Snippet<[{
|
|
248
|
+
value: any;
|
|
249
|
+
label: string;
|
|
250
|
+
icon?: string;
|
|
251
|
+
tone?: string;
|
|
252
|
+
hint?: string;
|
|
253
|
+
}]> | undefined;
|
|
254
|
+
autofocus?: boolean | undefined;
|
|
255
|
+
} & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof {
|
|
256
|
+
/**
|
|
257
|
+
* bindable: an array, or one value when not `multiple`
|
|
258
|
+
*/
|
|
259
|
+
value?: any;
|
|
260
|
+
options: {
|
|
261
|
+
value: any;
|
|
262
|
+
label: string;
|
|
263
|
+
icon?: string;
|
|
264
|
+
tone?: string;
|
|
265
|
+
hint?: string;
|
|
266
|
+
}[];
|
|
267
|
+
label: string;
|
|
268
|
+
multiple?: boolean | undefined;
|
|
269
|
+
search?: boolean | "auto" | undefined;
|
|
270
|
+
placeholder?: string | undefined;
|
|
271
|
+
empty?: string | undefined;
|
|
272
|
+
onchange?: ((value: any) => void) | undefined;
|
|
273
|
+
onpick?: ((value: any) => void) | undefined;
|
|
274
|
+
onback?: (() => void) | undefined;
|
|
275
|
+
lead?: import("svelte").Snippet<[{
|
|
276
|
+
value: any;
|
|
277
|
+
label: string;
|
|
278
|
+
icon?: string;
|
|
279
|
+
tone?: string;
|
|
280
|
+
hint?: string;
|
|
281
|
+
}]> | undefined;
|
|
282
|
+
autofocus?: boolean | undefined;
|
|
283
|
+
}>, {}, "value">;
|
|
284
|
+
};
|
|
285
|
+
export default _default;
|
|
286
|
+
import FilterChip from './FilterChip.svelte';
|
|
287
|
+
import OptionList from './OptionList.svelte';
|
|
288
|
+
export { FilterChip, OptionList };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Filters as one import: <FilterBar> draws a row of filters from data and adds, edits and removes them; <FilterBar.Chip>
|
|
2
|
+
// is one filter (field, condition, value, ✕) for a row of your own; <FilterBar.Options> the list of values to tick that
|
|
3
|
+
// their panels hold.
|
|
4
|
+
//
|
|
5
|
+
// import FilterBar from '@xerios/design-system/components/filters/index.js'
|
|
6
|
+
// <FilterBar bind:filters fields={FIELDS} />
|
|
7
|
+
import FilterBar from './FilterBar.svelte'
|
|
8
|
+
import FilterChip from './FilterChip.svelte'
|
|
9
|
+
import OptionList from './OptionList.svelte'
|
|
10
|
+
|
|
11
|
+
export default Object.assign(FilterBar, { Chip: FilterChip, Options: OptionList })
|
|
12
|
+
export { FilterChip, OptionList }
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
x: string;
|
|
3
|
+
calendar: string;
|
|
4
|
+
caretLeft: string;
|
|
5
|
+
search: string;
|
|
6
|
+
caretDown: string;
|
|
7
|
+
caretRight: string;
|
|
8
|
+
check: string;
|
|
9
|
+
external: string;
|
|
10
|
+
link: string;
|
|
11
|
+
star: string;
|
|
12
|
+
starFill: string;
|
|
13
|
+
more: string;
|
|
14
|
+
upload: string;
|
|
15
|
+
fileBlank: string;
|
|
16
|
+
folderSimple: string;
|
|
17
|
+
image: string;
|
|
18
|
+
arrowLeft: string;
|
|
19
|
+
arrowRight: string;
|
|
20
|
+
arrowDown: string;
|
|
21
|
+
undo: string;
|
|
22
|
+
plus: string;
|
|
23
|
+
minus: string;
|
|
24
|
+
funnel: string;
|
|
25
|
+
history: string;
|
|
26
|
+
undoArc: string;
|
|
27
|
+
redoArc: string;
|
|
28
|
+
sidebar: string;
|
|
29
|
+
eye: string;
|
|
30
|
+
eyeSlash: string;
|
|
31
|
+
caretUp: string;
|
|
32
|
+
expandAll: string;
|
|
33
|
+
collapseAll: string;
|
|
34
|
+
gear: string;
|
|
35
|
+
sun: string;
|
|
36
|
+
moon: string;
|
|
37
|
+
monitor: string;
|
|
38
|
+
keyboard: string;
|
|
39
|
+
infoCircle: string;
|
|
40
|
+
prohibit: string;
|
|
41
|
+
checkBold: string;
|
|
42
|
+
xBold: string;
|
|
43
|
+
refresh: string;
|
|
44
|
+
spinner: string;
|
|
45
|
+
checkCircle: string;
|
|
46
|
+
warning: string;
|
|
47
|
+
circleDashed: string;
|
|
48
|
+
minusCircle: string;
|
|
49
|
+
stop: string;
|
|
50
|
+
stopCircle: string;
|
|
51
|
+
};
|
|
52
|
+
export default _default;
|
|
53
|
+
/** Drawn in place of an unregistered name. */
|
|
54
|
+
export const MISSING: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" fill=\"currentColor\"><path d=\"M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z\"/></svg>";
|