@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,105 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* Working border: two comets of colour (an indigo tail running through violet and pink to an amber head) travel round
|
|
4
|
+
* the edge of their parent at an even speed, with a blurred copy glowing around it. Drop it inside a positioned element
|
|
5
|
+
* with a 1px border; set --radius to its border-radius (default --r-xl). It fills that element and paints over the
|
|
6
|
+
* border. Purely decorative. Reduced motion holds the comets still (the global rule).
|
|
7
|
+
*
|
|
8
|
+
* Each comet is a run of short dashes on an SVG outline of the box (a rounded rect, its length normalised to 100 with
|
|
9
|
+
* pathLength, so the comet is a share of the perimeter and a lap takes --dur on any size). A dash bends with the outline,
|
|
10
|
+
* so a comet flows round the corners as it does along the sides; a rigid bar following a path would pivot there instead.
|
|
11
|
+
* Each dash has one colour, sampled along the comet's gradient, so the run of them reads as the gradient.
|
|
12
|
+
*
|
|
13
|
+
* Nothing here reaches past the parent's border box in layout, so it never makes a scroll container show a scrollbar:
|
|
14
|
+
* the outline sits on the border, and the glow spills outside only through a filter, which doesn't count as overflow.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** How much of the perimeter a comet covers, and how many dashes it is drawn with. */
|
|
18
|
+
const LENGTH = 22
|
|
19
|
+
const DASHES = 14
|
|
20
|
+
/** The comet's colours, tail (0) to head (1). */
|
|
21
|
+
const STOPS = [
|
|
22
|
+
[0, 'transparent'],
|
|
23
|
+
[0.35, 'rgb(94 106 210 / 0.5)'],
|
|
24
|
+
[0.6, '#7170ff'],
|
|
25
|
+
[0.75, '#a855f7'],
|
|
26
|
+
[0.88, '#ec4899'],
|
|
27
|
+
[0.97, '#f59e0b'],
|
|
28
|
+
[1, 'transparent'],
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
/** The comet's colour at t (0 tail … 1 head), mixed between the stops either side. @param {number} t */
|
|
32
|
+
function colourAt(t) {
|
|
33
|
+
const i = Math.max(
|
|
34
|
+
1,
|
|
35
|
+
STOPS.findIndex(([at]) => at >= t),
|
|
36
|
+
)
|
|
37
|
+
const [a, from] = STOPS[i - 1]
|
|
38
|
+
const [b, to] = STOPS[i]
|
|
39
|
+
const share = Math.round(((t - a) / (b - a)) * 100)
|
|
40
|
+
return `color-mix(in lch, ${to} ${share}%, ${from})`
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const seg = LENGTH / DASHES
|
|
44
|
+
const dashes = Array.from({ length: DASHES }, (_, k) => ({ k, colour: colourAt((k + 0.5) / DASHES) }))
|
|
45
|
+
/** Two comets, half a lap apart. */
|
|
46
|
+
const COMETS = [0, 50]
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<span class="working" aria-hidden="true" style:--seg="{seg}px">
|
|
50
|
+
{#each ['glow', 'line'] as layer (layer)}
|
|
51
|
+
<svg class={layer}>
|
|
52
|
+
{#each COMETS as lead (lead)}
|
|
53
|
+
{#each dashes as dash (dash.k)}
|
|
54
|
+
<!-- rx is the fallback for browsers without the rx CSS property; the CSS one follows --radius. -->
|
|
55
|
+
<rect width="100%" height="100%" rx="11.5" pathLength="100" style:stroke={dash.colour} style:--start="{-(lead + dash.k * seg)}px" />
|
|
56
|
+
{/each}
|
|
57
|
+
{/each}
|
|
58
|
+
</svg>
|
|
59
|
+
{/each}
|
|
60
|
+
</span>
|
|
61
|
+
|
|
62
|
+
<style>
|
|
63
|
+
.working {
|
|
64
|
+
position: absolute;
|
|
65
|
+
inset: -1px;
|
|
66
|
+
border-radius: var(--radius);
|
|
67
|
+
pointer-events: none;
|
|
68
|
+
z-index: 1;
|
|
69
|
+
--dur: 3.2s;
|
|
70
|
+
--radius: var(--r-xl);
|
|
71
|
+
}
|
|
72
|
+
/* The outline runs down the middle of the parent's 1px border: the svg is inset half a pixel and its strokes overflow it. */
|
|
73
|
+
svg {
|
|
74
|
+
position: absolute;
|
|
75
|
+
inset: 0.5px;
|
|
76
|
+
width: calc(100% - 1px);
|
|
77
|
+
height: calc(100% - 1px);
|
|
78
|
+
overflow: visible;
|
|
79
|
+
}
|
|
80
|
+
rect {
|
|
81
|
+
rx: calc(var(--radius) - 0.5px);
|
|
82
|
+
fill: none;
|
|
83
|
+
stroke-width: 1;
|
|
84
|
+
stroke-linecap: butt;
|
|
85
|
+
/* Lengths, not bare numbers, on every side: a number and a length don't interpolate, so the dashes would jump a lap
|
|
86
|
+
at a time instead of travelling. In SVG a px is a user unit, so pathLength still scales them. */
|
|
87
|
+
stroke-dasharray: var(--seg) calc(100px - var(--seg));
|
|
88
|
+
stroke-dashoffset: var(--start);
|
|
89
|
+
animation: travel var(--dur) linear infinite;
|
|
90
|
+
}
|
|
91
|
+
/* The glow: the same comets, wider and blurred out past the edge. */
|
|
92
|
+
.glow {
|
|
93
|
+
filter: blur(6px);
|
|
94
|
+
opacity: 0.8;
|
|
95
|
+
}
|
|
96
|
+
.glow rect {
|
|
97
|
+
stroke-width: 3;
|
|
98
|
+
}
|
|
99
|
+
/* One lap: every dash moves on by the whole outline, keeping its place in its comet. */
|
|
100
|
+
@keyframes travel {
|
|
101
|
+
to {
|
|
102
|
+
stroke-dashoffset: calc(var(--start) - 100px);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default WorkingBorder;
|
|
2
|
+
type WorkingBorder = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const WorkingBorder: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Icon from '../Icon.svelte'
|
|
3
|
+
/**
|
|
4
|
+
* Empty state: a title, an optional line saying why or what to do, and optional actions (children) below it.
|
|
5
|
+
* Import it from empty/index.js, which also gives Empty.Error (a view that failed to load, with a retry).
|
|
6
|
+
*
|
|
7
|
+
* <Empty title="No calls match these filters" body="Try a shorter term.">
|
|
8
|
+
* <div><Button onclick={clear}>Clear filters</Button></div>
|
|
9
|
+
* </Empty>
|
|
10
|
+
* <Empty.Error title="Couldn't load the list" message={error} onretry={reload} />
|
|
11
|
+
*
|
|
12
|
+
* icon: an Icon name above the title, in the element's tone (set data-tone on it).
|
|
13
|
+
* level: the title's heading level, one below the heading it sits under (2 directly under a page's h1; 3, the
|
|
14
|
+
* default, inside a section or dialog), so the outline has no gaps.
|
|
15
|
+
* Other attributes (class, id…) and attachments go to the wrapper.
|
|
16
|
+
*
|
|
17
|
+
* @typedef {object} Props
|
|
18
|
+
* @property {string} title
|
|
19
|
+
* @property {string} [body]
|
|
20
|
+
* @property {2 | 3 | 4 | 5 | 6} [level]
|
|
21
|
+
* @property {string} [icon]
|
|
22
|
+
* @property {import('svelte').Snippet} [children]
|
|
23
|
+
*/
|
|
24
|
+
/** @type {Props & Omit<import('svelte/elements').HTMLAttributes<HTMLDivElement>, keyof Props>} */
|
|
25
|
+
let { title, body = '', level = 3, icon, class: className, children, ...rest } = $props()
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<div class={['empty', className]} {...rest}>
|
|
29
|
+
{#if icon}<span class="icon-slot"><Icon name={icon} size="lg" /></span>{/if}
|
|
30
|
+
<svelte:element this={`h${level}`} class="title">{title}</svelte:element>
|
|
31
|
+
{#if body}<p>{body}</p>{/if}
|
|
32
|
+
{@render children?.()}
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.empty {
|
|
37
|
+
max-width: 420px;
|
|
38
|
+
margin: 48px auto;
|
|
39
|
+
text-align: center;
|
|
40
|
+
display: grid;
|
|
41
|
+
gap: 6px;
|
|
42
|
+
}
|
|
43
|
+
.title {
|
|
44
|
+
font: var(--w-semibold) 15px var(--font-display);
|
|
45
|
+
color: var(--fg);
|
|
46
|
+
}
|
|
47
|
+
p {
|
|
48
|
+
color: var(--muted);
|
|
49
|
+
}
|
|
50
|
+
.icon-slot {
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
justify-self: center;
|
|
53
|
+
color: var(--tone, var(--muted));
|
|
54
|
+
}
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default Empty;
|
|
2
|
+
type Empty = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props & Omit<HTMLAttributes<HTMLDivElement>, keyof Props>>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const Empty: import("svelte").Component<{
|
|
7
|
+
title: string;
|
|
8
|
+
body?: string | undefined;
|
|
9
|
+
level?: 2 | 3 | 4 | 5 | 6 | undefined;
|
|
10
|
+
icon?: string | undefined;
|
|
11
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
12
|
+
} & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof {
|
|
13
|
+
title: string;
|
|
14
|
+
body?: string | undefined;
|
|
15
|
+
level?: 2 | 3 | 4 | 5 | 6 | undefined;
|
|
16
|
+
icon?: string | undefined;
|
|
17
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
18
|
+
}>, {}, "">;
|
|
19
|
+
/**
|
|
20
|
+
* Empty state: a title, an optional line saying why or what to do, and optional actions (children) below it.
|
|
21
|
+
* Import it from empty/index.js, which also gives Empty.Error (a view that failed to load, with a retry).
|
|
22
|
+
*
|
|
23
|
+
* <Empty title="No calls match these filters" body="Try a shorter term.">
|
|
24
|
+
* <div><Button onclick={clear}>Clear filters</Button></div>
|
|
25
|
+
* </Empty>
|
|
26
|
+
* <Empty.Error title="Couldn't load the list" message={error} onretry={reload} />
|
|
27
|
+
*
|
|
28
|
+
* icon: an Icon name above the title, in the element's tone (set data-tone on it).
|
|
29
|
+
* level: the title's heading level, one below the heading it sits under (2 directly under a page's h1; 3, the
|
|
30
|
+
* default, inside a section or dialog), so the outline has no gaps.
|
|
31
|
+
* Other attributes (class, id…) and attachments go to the wrapper.
|
|
32
|
+
*/
|
|
33
|
+
type Props = {
|
|
34
|
+
title: string;
|
|
35
|
+
body?: string | undefined;
|
|
36
|
+
level?: 2 | 3 | 4 | 5 | 6 | undefined;
|
|
37
|
+
icon?: string | undefined;
|
|
38
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
39
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* Empty.Error: in place of a view that failed to load, what failed, why, and a way to try again.
|
|
4
|
+
*
|
|
5
|
+
* <Empty.Error title="Couldn't load Dokploy" message={data.error} onretry={() => refreshAll()} />
|
|
6
|
+
* <Empty.Error title="Couldn't load the settings" message={failure} onretry={load}>
|
|
7
|
+
* <div><Button href="/settings/help">Get help</Button></div>
|
|
8
|
+
* </Empty.Error>
|
|
9
|
+
*
|
|
10
|
+
* title: what failed, as an outcome ("Couldn't load …"). message: why, in words someone can act on (often the
|
|
11
|
+
* server's message). onretry: the retry; it may be async, and the button shows it working (Button). retryLabel:
|
|
12
|
+
* the button's label ("Try again"). level: as Empty's. children: more actions, after the retry.
|
|
13
|
+
* It is an alert: read out when it appears, so someone who started the load hears that it failed.
|
|
14
|
+
* Other attributes (class, id…) and attachments go to the wrapper.
|
|
15
|
+
*
|
|
16
|
+
* @typedef {object} Props
|
|
17
|
+
* @property {string} [title]
|
|
18
|
+
* @property {string} [message]
|
|
19
|
+
* @property {() => unknown} [onretry]
|
|
20
|
+
* @property {string} [retryLabel]
|
|
21
|
+
* @property {2 | 3 | 4 | 5 | 6} [level]
|
|
22
|
+
* @property {import('svelte').Snippet} [children]
|
|
23
|
+
*/
|
|
24
|
+
import Empty from './Empty.svelte'
|
|
25
|
+
import Button from '../Button.svelte'
|
|
26
|
+
|
|
27
|
+
/** @type {Props & Omit<import('svelte/elements').HTMLAttributes<HTMLDivElement>, keyof Props>} */
|
|
28
|
+
let { title = 'Something went wrong', message = '', onretry, retryLabel = 'Try again', level = 3, children, ...rest } = $props()
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<Empty {title} body={message} {level} icon="warning" data-tone="danger" role="alert" {...rest}>
|
|
32
|
+
{#if onretry || children}
|
|
33
|
+
<div class="actions">
|
|
34
|
+
{#if onretry}<Button icon="refresh" onclick={onretry}>{retryLabel}</Button>{/if}
|
|
35
|
+
{@render children?.()}
|
|
36
|
+
</div>
|
|
37
|
+
{/if}
|
|
38
|
+
</Empty>
|
|
39
|
+
|
|
40
|
+
<style>
|
|
41
|
+
.actions {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-wrap: wrap;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
gap: var(--space-2);
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default EmptyError;
|
|
2
|
+
/**
|
|
3
|
+
* Empty.Error: in place of a view that failed to load, what failed, why, and a way to try again.
|
|
4
|
+
*
|
|
5
|
+
* <Empty.Error title="Couldn't load Dokploy" message={data.error} onretry={() => refreshAll()} />
|
|
6
|
+
* <Empty.Error title="Couldn't load the settings" message={failure} onretry={load}>
|
|
7
|
+
* <div><Button href="/settings/help">Get help</Button></div>
|
|
8
|
+
* </Empty.Error>
|
|
9
|
+
*
|
|
10
|
+
* title: what failed, as an outcome ("Couldn't load …"). message: why, in words someone can act on (often the
|
|
11
|
+
* server's message). onretry: the retry; it may be async, and the button shows it working (Button). retryLabel:
|
|
12
|
+
* the button's label ("Try again"). level: as Empty's. children: more actions, after the retry.
|
|
13
|
+
* It is an alert: read out when it appears, so someone who started the load hears that it failed.
|
|
14
|
+
* Other attributes (class, id…) and attachments go to the wrapper.
|
|
15
|
+
*/
|
|
16
|
+
export type Props = {
|
|
17
|
+
title?: string | undefined;
|
|
18
|
+
message?: string | undefined;
|
|
19
|
+
onretry?: (() => unknown) | undefined;
|
|
20
|
+
retryLabel?: string | undefined;
|
|
21
|
+
level?: 2 | 3 | 4 | 5 | 6 | undefined;
|
|
22
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
23
|
+
};
|
|
24
|
+
type EmptyError = {
|
|
25
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
26
|
+
$set?(props: Partial<Props & Omit<HTMLAttributes<HTMLDivElement>, keyof Props>>): void;
|
|
27
|
+
};
|
|
28
|
+
declare const EmptyError: import("svelte").Component<Props & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof Props>, {}, "">;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: import("svelte").Component<{
|
|
2
|
+
title: string;
|
|
3
|
+
body?: string | undefined;
|
|
4
|
+
level?: 2 | 3 | 4 | 5 | 6 | undefined;
|
|
5
|
+
icon?: string | undefined;
|
|
6
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
7
|
+
} & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof {
|
|
8
|
+
title: string;
|
|
9
|
+
body?: string | undefined;
|
|
10
|
+
level?: 2 | 3 | 4 | 5 | 6 | undefined;
|
|
11
|
+
icon?: string | undefined;
|
|
12
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
13
|
+
}>, {}, ""> & {
|
|
14
|
+
Error: import("svelte").Component<import("./EmptyError.svelte").Props & Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, keyof import("./EmptyError.svelte").Props>, {}, "">;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
17
|
+
export { EmptyError };
|
|
18
|
+
import EmptyError from './EmptyError.svelte';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Empty states as one import: <Empty> for a view with nothing in it, <Empty.Error> for one that failed to load.
|
|
2
|
+
//
|
|
3
|
+
// import Empty from '@xerios/design-system/components/empty/index.js'
|
|
4
|
+
// <Empty title="No calls yet" body="…" />
|
|
5
|
+
// <Empty.Error title="Couldn't load the list" message={error} onretry={reload} />
|
|
6
|
+
import Empty from './Empty.svelte'
|
|
7
|
+
import EmptyError from './EmptyError.svelte'
|
|
8
|
+
|
|
9
|
+
export default Object.assign(Empty, { Error: EmptyError })
|
|
10
|
+
export { EmptyError }
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* Internal to filters/: the value editor of a date filter in FilterBar. Ready-made relative days ("3 days ago") in a
|
|
4
|
+
* column beside a month calendar; a press on either picks. The value is a relative id ('-3d', see relativeDay in
|
|
5
|
+
* lib/dates.js), which keeps its meaning as the days pass, or an ISO day picked on the calendar.
|
|
6
|
+
*
|
|
7
|
+
* <DateFilter value="-3d" presets={datePresets()} label="Updated" onpick={(v) => …} />
|
|
8
|
+
*
|
|
9
|
+
* Keyboard: the list first (arrows, Enter or Space picks), Tab to the calendar (its own keys, see Calendar).
|
|
10
|
+
*/
|
|
11
|
+
import { untrack } from 'svelte'
|
|
12
|
+
import Calendar from '../inputs/Calendar.svelte'
|
|
13
|
+
import OptionList from './OptionList.svelte'
|
|
14
|
+
import { relativeDay, today } from '../../lib/dates.js'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {object} Props
|
|
18
|
+
* @property {string | null | undefined} value
|
|
19
|
+
* @property {{ value: string, label: string }[]} presets
|
|
20
|
+
* @property {string} label
|
|
21
|
+
* @property {(value: string) => void} onpick
|
|
22
|
+
*/
|
|
23
|
+
/** @type {Props} */
|
|
24
|
+
let { value, presets, label, onpick } = $props()
|
|
25
|
+
|
|
26
|
+
const day = $derived(value ? relativeDay(value) : null)
|
|
27
|
+
const preset = $derived(presets.some((p) => p.value === value) ? value : undefined)
|
|
28
|
+
let month = $state(untrack(() => day ?? today()))
|
|
29
|
+
let focus = $state(untrack(() => day ?? today()))
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<div class="date-filter">
|
|
33
|
+
<OptionList class="presets" value={preset} options={presets} multiple={false} search={false} label="{label}: ready-made days" {onpick} />
|
|
34
|
+
<div class="calendar">
|
|
35
|
+
<Calendar bind:month bind:focus selected={day ? [day] : []} {onpick} {label} />
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
/* The presets and the calendar side by side, split by a rule running the panel's full height; stacked when narrow. */
|
|
41
|
+
.date-filter {
|
|
42
|
+
user-select: none;
|
|
43
|
+
display: grid;
|
|
44
|
+
grid-template-columns: auto auto;
|
|
45
|
+
}
|
|
46
|
+
.calendar {
|
|
47
|
+
padding: var(--space-2) var(--space-3) var(--space-3);
|
|
48
|
+
border-inline-start: 1px solid var(--line);
|
|
49
|
+
}
|
|
50
|
+
@media (max-width: 480px) {
|
|
51
|
+
.date-filter {
|
|
52
|
+
grid-template-columns: auto;
|
|
53
|
+
}
|
|
54
|
+
.calendar {
|
|
55
|
+
border-inline-start: 0;
|
|
56
|
+
border-top: 1px solid var(--line);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default DateFilter;
|
|
2
|
+
type DateFilter = {
|
|
3
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
+
$set?(props: Partial<Props>): void;
|
|
5
|
+
};
|
|
6
|
+
declare const DateFilter: import("svelte").Component<{
|
|
7
|
+
value: string | null | undefined;
|
|
8
|
+
presets: {
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}[];
|
|
12
|
+
label: string;
|
|
13
|
+
onpick: (value: string) => void;
|
|
14
|
+
}, {}, "">;
|
|
15
|
+
type Props = {
|
|
16
|
+
value: string | null | undefined;
|
|
17
|
+
presets: {
|
|
18
|
+
value: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}[];
|
|
21
|
+
label: string;
|
|
22
|
+
onpick: (value: string) => void;
|
|
23
|
+
};
|