@sepale/components 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 +65 -3
- package/dist/components/Accordion.svelte +48 -0
- package/dist/components/Accordion.svelte.d.ts +24 -0
- package/dist/components/Alert.svelte +107 -0
- package/dist/components/Alert.svelte.d.ts +40 -0
- package/dist/components/Avatar.svelte +75 -0
- package/dist/components/Avatar.svelte.d.ts +37 -0
- package/dist/components/Badge.svelte +46 -0
- package/dist/components/Badge.svelte.d.ts +22 -0
- package/dist/components/Breadcrumbs.svelte +36 -0
- package/dist/components/Breadcrumbs.svelte.d.ts +18 -0
- package/dist/components/Bubble.svelte +43 -0
- package/dist/components/Bubble.svelte.d.ts +23 -0
- package/dist/components/Button.svelte +132 -0
- package/dist/components/Button.svelte.d.ts +40 -0
- package/dist/components/Calendar.svelte +193 -0
- package/dist/components/Calendar.svelte.d.ts +60 -0
- package/dist/components/Card.svelte +69 -0
- package/dist/components/Card.svelte.d.ts +37 -0
- package/dist/components/Carousel.svelte +550 -0
- package/dist/components/Carousel.svelte.d.ts +124 -0
- package/dist/components/Checkbox.svelte +48 -0
- package/dist/components/Checkbox.svelte.d.ts +26 -0
- package/dist/components/Chip.svelte +60 -0
- package/dist/components/Chip.svelte.d.ts +26 -0
- package/dist/components/ChipsInput.svelte +158 -0
- package/dist/components/ChipsInput.svelte.d.ts +64 -0
- package/dist/components/Collapse.svelte +101 -0
- package/dist/components/Collapse.svelte.d.ts +46 -0
- package/dist/components/ColorPicker.svelte +135 -0
- package/dist/components/ColorPicker.svelte.d.ts +44 -0
- package/dist/components/Combobox.svelte +496 -0
- package/dist/components/Combobox.svelte.d.ts +96 -0
- package/dist/components/DataControl.svelte +754 -0
- package/dist/components/DataControl.svelte.d.ts +143 -0
- package/dist/components/DataHandler.svelte +67 -0
- package/dist/components/DataHandler.svelte.d.ts +44 -0
- package/dist/components/DatePicker.svelte +185 -0
- package/dist/components/DatePicker.svelte.d.ts +56 -0
- package/dist/components/Dialog.svelte +194 -0
- package/dist/components/Dialog.svelte.d.ts +51 -0
- package/dist/components/Divider.svelte +54 -0
- package/dist/components/Divider.svelte.d.ts +27 -0
- package/dist/components/Dock.svelte +34 -0
- package/dist/components/Dock.svelte.d.ts +18 -0
- package/dist/components/Drawer.svelte +174 -0
- package/dist/components/Drawer.svelte.d.ts +51 -0
- package/dist/components/Dropdown.svelte +183 -0
- package/dist/components/Dropdown.svelte.d.ts +52 -0
- package/dist/components/Editable.svelte +292 -0
- package/dist/components/Editable.svelte.d.ts +113 -0
- package/dist/components/EmptyState.svelte +64 -0
- package/dist/components/EmptyState.svelte.d.ts +29 -0
- package/dist/components/Fieldset.svelte +42 -0
- package/dist/components/Fieldset.svelte.d.ts +20 -0
- package/dist/components/FileDropzone.svelte +154 -0
- package/dist/components/FileDropzone.svelte.d.ts +45 -0
- package/dist/components/FileExplorer.svelte +643 -0
- package/dist/components/FileExplorer.svelte.d.ts +114 -0
- package/dist/components/FileInput.svelte +125 -0
- package/dist/components/FileInput.svelte.d.ts +51 -0
- package/dist/components/FloatingLabel.svelte +38 -0
- package/dist/components/FloatingLabel.svelte.d.ts +24 -0
- package/dist/components/Footer.svelte +68 -0
- package/dist/components/Footer.svelte.d.ts +37 -0
- package/dist/components/Grid.svelte +122 -0
- package/dist/components/Grid.svelte.d.ts +72 -0
- package/dist/components/Hero.svelte +62 -0
- package/dist/components/Hero.svelte.d.ts +33 -0
- package/dist/components/Input.svelte +184 -0
- package/dist/components/Input.svelte.d.ts +65 -0
- package/dist/components/Join.svelte +38 -0
- package/dist/components/Join.svelte.d.ts +21 -0
- package/dist/components/Kanban.svelte +284 -0
- package/dist/components/Kanban.svelte.d.ts +93 -0
- package/dist/components/Label.svelte +32 -0
- package/dist/components/Label.svelte.d.ts +21 -0
- package/dist/components/LaptopFrame.svelte +44 -0
- package/dist/components/LaptopFrame.svelte.d.ts +21 -0
- package/dist/components/List.svelte +95 -0
- package/dist/components/List.svelte.d.ts +69 -0
- package/dist/components/Loading.svelte +37 -0
- package/dist/components/Loading.svelte.d.ts +17 -0
- package/dist/components/Menu.svelte +144 -0
- package/dist/components/Menu.svelte.d.ts +53 -0
- package/dist/components/MobileFrame.svelte +41 -0
- package/dist/components/MobileFrame.svelte.d.ts +21 -0
- package/dist/components/Navbar.svelte +49 -0
- package/dist/components/Navbar.svelte.d.ts +25 -0
- package/dist/components/NumberInput.svelte +255 -0
- package/dist/components/NumberInput.svelte.d.ts +68 -0
- package/dist/components/Pagination.svelte +169 -0
- package/dist/components/Pagination.svelte.d.ts +50 -0
- package/dist/components/Progress.svelte +65 -0
- package/dist/components/Progress.svelte.d.ts +28 -0
- package/dist/components/RadialProgress.svelte +48 -0
- package/dist/components/RadialProgress.svelte.d.ts +20 -0
- package/dist/components/Radio.svelte +50 -0
- package/dist/components/Radio.svelte.d.ts +28 -0
- package/dist/components/Range.svelte +53 -0
- package/dist/components/Range.svelte.d.ts +26 -0
- package/dist/components/Rating.svelte +90 -0
- package/dist/components/Rating.svelte.d.ts +41 -0
- package/dist/components/Select.svelte +338 -0
- package/dist/components/Select.svelte.d.ts +74 -0
- package/dist/components/Sidebar.svelte +100 -0
- package/dist/components/Sidebar.svelte.d.ts +54 -0
- package/dist/components/Skeleton.svelte +40 -0
- package/dist/components/Skeleton.svelte.d.ts +18 -0
- package/dist/components/Stat.svelte +71 -0
- package/dist/components/Stat.svelte.d.ts +35 -0
- package/dist/components/Stats.svelte +38 -0
- package/dist/components/Stats.svelte.d.ts +22 -0
- package/dist/components/Steps.svelte +204 -0
- package/dist/components/Steps.svelte.d.ts +66 -0
- package/dist/components/Subtitle.svelte +44 -0
- package/dist/components/Subtitle.svelte.d.ts +26 -0
- package/dist/components/Swatch.svelte +61 -0
- package/dist/components/Swatch.svelte.d.ts +27 -0
- package/dist/components/Switch.svelte +105 -0
- package/dist/components/Switch.svelte.d.ts +44 -0
- package/dist/components/Table.svelte +243 -0
- package/dist/components/Table.svelte.d.ts +121 -0
- package/dist/components/Tabs.svelte +142 -0
- package/dist/components/Tabs.svelte.d.ts +80 -0
- package/dist/components/Text.svelte +43 -0
- package/dist/components/Text.svelte.d.ts +25 -0
- package/dist/components/Textarea.svelte +76 -0
- package/dist/components/Textarea.svelte.d.ts +39 -0
- package/dist/components/Title.svelte +46 -0
- package/dist/components/Title.svelte.d.ts +29 -0
- package/dist/components/Toast.svelte +154 -0
- package/dist/components/Toast.svelte.d.ts +49 -0
- package/dist/components/Toggle.svelte +48 -0
- package/dist/components/Toggle.svelte.d.ts +25 -0
- package/dist/components/Tooltip.svelte +70 -0
- package/dist/components/Tooltip.svelte.d.ts +34 -0
- package/dist/components/WindowFrame.svelte +53 -0
- package/dist/components/WindowFrame.svelte.d.ts +24 -0
- package/dist/components/accordion-context.d.ts +8 -0
- package/dist/components/accordion-context.js +25 -0
- package/dist/components/color.d.ts +39 -0
- package/dist/components/color.js +92 -0
- package/dist/components/data-handler.svelte.d.ts +362 -0
- package/dist/components/data-handler.svelte.js +690 -0
- package/dist/components/file-icons.d.ts +25 -0
- package/dist/components/file-icons.js +46 -0
- package/dist/family-types.d.ts +45 -0
- package/dist/family-types.js +73 -0
- package/dist/generated/classes.d.ts +17 -0
- package/dist/generated/classes.js +2511 -0
- package/dist/generated/components.d.ts +39 -0
- package/dist/generated/components.js +28666 -0
- package/dist/generated/registry.d.ts +35 -0
- package/dist/generated/registry.js +2658 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +99 -0
- package/dist/sepale-types.d.ts +8 -0
- package/dist/sepale-types.js +200 -0
- package/dist/theme.d.ts +123 -0
- package/dist/theme.js +226 -0
- package/dist/variants.d.ts +124 -0
- package/dist/variants.js +70 -0
- package/dist/vendor/air-datepicker/LICENSE.md +21 -0
- package/dist/vendor/air-datepicker/README.md +19 -0
- package/dist/vendor/air-datepicker/buttonPresets.d.ts +13 -0
- package/dist/vendor/air-datepicker/buttonPresets.js +12 -0
- package/dist/vendor/air-datepicker/consts.d.ts +18 -0
- package/dist/vendor/air-datepicker/consts.js +35 -0
- package/dist/vendor/air-datepicker/datepicker.d.ts +289 -0
- package/dist/vendor/air-datepicker/datepicker.js +1435 -0
- package/dist/vendor/air-datepicker/datepickerBody.d.ts +46 -0
- package/dist/vendor/air-datepicker/datepickerBody.js +386 -0
- package/dist/vendor/air-datepicker/datepickerButtons.d.ts +25 -0
- package/dist/vendor/air-datepicker/datepickerButtons.js +85 -0
- package/dist/vendor/air-datepicker/datepickerCell.d.ts +35 -0
- package/dist/vendor/air-datepicker/datepickerCell.js +297 -0
- package/dist/vendor/air-datepicker/datepickerKeyboard.d.ts +26 -0
- package/dist/vendor/air-datepicker/datepickerKeyboard.js +207 -0
- package/dist/vendor/air-datepicker/datepickerNav.d.ts +31 -0
- package/dist/vendor/air-datepicker/datepickerNav.js +200 -0
- package/dist/vendor/air-datepicker/datepickerTime.d.ts +60 -0
- package/dist/vendor/air-datepicker/datepickerTime.js +276 -0
- package/dist/vendor/air-datepicker/defaults.d.ts +65 -0
- package/dist/vendor/air-datepicker/defaults.js +79 -0
- package/dist/vendor/air-datepicker/index.d.ts +168 -0
- package/dist/vendor/air-datepicker/index.js +3 -0
- package/dist/vendor/air-datepicker/locale/ar.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ar.js +14 -0
- package/dist/vendor/air-datepicker/locale/bg.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/bg.js +14 -0
- package/dist/vendor/air-datepicker/locale/ca.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ca.js +14 -0
- package/dist/vendor/air-datepicker/locale/cs.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/cs.js +14 -0
- package/dist/vendor/air-datepicker/locale/da.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/da.js +14 -0
- package/dist/vendor/air-datepicker/locale/de.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/de.js +14 -0
- package/dist/vendor/air-datepicker/locale/el.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/el.js +14 -0
- package/dist/vendor/air-datepicker/locale/en.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/en.js +14 -0
- package/dist/vendor/air-datepicker/locale/es.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/es.js +14 -0
- package/dist/vendor/air-datepicker/locale/eu.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/eu.js +14 -0
- package/dist/vendor/air-datepicker/locale/fi.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/fi.js +14 -0
- package/dist/vendor/air-datepicker/locale/fr.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/fr.js +14 -0
- package/dist/vendor/air-datepicker/locale/hr.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/hr.js +14 -0
- package/dist/vendor/air-datepicker/locale/hu.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/hu.js +14 -0
- package/dist/vendor/air-datepicker/locale/id.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/id.js +14 -0
- package/dist/vendor/air-datepicker/locale/it.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/it.js +14 -0
- package/dist/vendor/air-datepicker/locale/ja.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ja.js +14 -0
- package/dist/vendor/air-datepicker/locale/ko.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ko.js +14 -0
- package/dist/vendor/air-datepicker/locale/nb.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/nb.js +14 -0
- package/dist/vendor/air-datepicker/locale/nl.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/nl.js +14 -0
- package/dist/vendor/air-datepicker/locale/pl.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/pl.js +14 -0
- package/dist/vendor/air-datepicker/locale/pt-BR.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/pt-BR.js +14 -0
- package/dist/vendor/air-datepicker/locale/pt.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/pt.js +14 -0
- package/dist/vendor/air-datepicker/locale/ro.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ro.js +14 -0
- package/dist/vendor/air-datepicker/locale/ru.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/ru.js +14 -0
- package/dist/vendor/air-datepicker/locale/si.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/si.js +14 -0
- package/dist/vendor/air-datepicker/locale/sk.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/sk.js +14 -0
- package/dist/vendor/air-datepicker/locale/sl.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/sl.js +14 -0
- package/dist/vendor/air-datepicker/locale/sv.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/sv.js +14 -0
- package/dist/vendor/air-datepicker/locale/th.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/th.js +14 -0
- package/dist/vendor/air-datepicker/locale/tr.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/tr.js +16 -0
- package/dist/vendor/air-datepicker/locale/uk.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/uk.js +14 -0
- package/dist/vendor/air-datepicker/locale/zh.d.ts +4 -0
- package/dist/vendor/air-datepicker/locale/zh.js +14 -0
- package/dist/vendor/air-datepicker/typedefs.d.ts +3 -0
- package/dist/vendor/air-datepicker/typedefs.js +15 -0
- package/dist/vendor/air-datepicker/utils.d.ts +155 -0
- package/dist/vendor/air-datepicker/utils.js +395 -0
- package/dist/vendor/air-datepicker/withEvents.d.ts +1 -0
- package/dist/vendor/air-datepicker/withEvents.js +39 -0
- package/package.json +44 -3
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
/** What .progress is made of, classified. The props follow the
|
|
3
|
+
families the project registers (variants.ts, ADR 0015). */
|
|
4
|
+
export const PREFIX = 'progress';
|
|
5
|
+
|
|
6
|
+
export const AXES = {
|
|
7
|
+
/* No size axis: a progress bar answers to the width it is given. */
|
|
8
|
+
color: ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error']
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
export const FLAGS = {} as const;
|
|
12
|
+
export const PARTS = ['segments', 'segment'] as const;
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import type { Snippet } from 'svelte';
|
|
17
|
+
import type { HTMLAttributes, HTMLProgressAttributes } from 'svelte/elements';
|
|
18
|
+
import { applyAxes, cx, type AxisProps } from '../variants.js';
|
|
19
|
+
|
|
20
|
+
interface Segment {
|
|
21
|
+
/** Its share of the bar, against the others'. */
|
|
22
|
+
value: number;
|
|
23
|
+
/** A theme colour (`primary`, `warning`…) or any CSS colour (`color-mix(…)`). */
|
|
24
|
+
color?: string;
|
|
25
|
+
/** Read on hover, and by a screen reader. */
|
|
26
|
+
label?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLElement>, 'color'>,
|
|
30
|
+
Pick<HTMLProgressAttributes, 'value' | 'max'> {
|
|
31
|
+
/** Cut the bar into parts, each as wide as its `value` among the others.
|
|
32
|
+
The bar then stands for a split rather than a progress: `value` and
|
|
33
|
+
`max` are ignored. */
|
|
34
|
+
segments?: Segment[];
|
|
35
|
+
class?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// The axes are deliberately NOT destructured: they travel in `axes` and are
|
|
39
|
+
// resolved by name, so an axis a family drops changes nothing down here.
|
|
40
|
+
let {
|
|
41
|
+
class: klass = '',
|
|
42
|
+
value,
|
|
43
|
+
max = 100,
|
|
44
|
+
segments,
|
|
45
|
+
...axes
|
|
46
|
+
}: Props = $props();
|
|
47
|
+
|
|
48
|
+
let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
|
|
49
|
+
let classes = $derived(cx(PREFIX, applied.classes, klass));
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
{#if segments}
|
|
53
|
+
<div {...applied.rest} class={[classes, 'progress-segments']} role="img">
|
|
54
|
+
{#each segments as s, i (i)}
|
|
55
|
+
<span
|
|
56
|
+
class="progress-segment"
|
|
57
|
+
title={s.label}
|
|
58
|
+
style:--segment={s.value}
|
|
59
|
+
style:--segment-color={s.color && (/^[a-z]+$/.test(s.color) ? `var(--color-${s.color})` : s.color)}
|
|
60
|
+
></span>
|
|
61
|
+
{/each}
|
|
62
|
+
</div>
|
|
63
|
+
{:else}
|
|
64
|
+
<progress {...applied.rest} class={classes} {value} {max}></progress>
|
|
65
|
+
{/if}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** What .progress is made of, classified. The props follow the
|
|
2
|
+
families the project registers (variants.ts, ADR 0015). */
|
|
3
|
+
export declare const PREFIX = "progress";
|
|
4
|
+
export declare const AXES: {
|
|
5
|
+
readonly color: readonly ["primary", "secondary", "accent", "neutral", "info", "success", "warning", "error"];
|
|
6
|
+
};
|
|
7
|
+
export declare const FLAGS: {};
|
|
8
|
+
export declare const PARTS: readonly ["segments", "segment"];
|
|
9
|
+
import type { HTMLAttributes, HTMLProgressAttributes } from 'svelte/elements';
|
|
10
|
+
import { type AxisProps } from '../variants.js';
|
|
11
|
+
interface Segment {
|
|
12
|
+
/** Its share of the bar, against the others'. */
|
|
13
|
+
value: number;
|
|
14
|
+
/** A theme colour (`primary`, `warning`…) or any CSS colour (`color-mix(…)`). */
|
|
15
|
+
color?: string;
|
|
16
|
+
/** Read on hover, and by a screen reader. */
|
|
17
|
+
label?: string;
|
|
18
|
+
}
|
|
19
|
+
interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLElement>, 'color'>, Pick<HTMLProgressAttributes, 'value' | 'max'> {
|
|
20
|
+
/** Cut the bar into parts, each as wide as its `value` among the others.
|
|
21
|
+
The bar then stands for a split rather than a progress: `value` and
|
|
22
|
+
`max` are ignored. */
|
|
23
|
+
segments?: Segment[];
|
|
24
|
+
class?: string;
|
|
25
|
+
}
|
|
26
|
+
declare const Progress: import("svelte").Component<Props, {}, "">;
|
|
27
|
+
type Progress = ReturnType<typeof Progress>;
|
|
28
|
+
export default Progress;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
/** What .radial-progress is made of, classified. The props follow the
|
|
3
|
+
families the project registers (variants.ts, ADR 0015). */
|
|
4
|
+
export const PREFIX = 'radial-progress';
|
|
5
|
+
|
|
6
|
+
export const AXES = {
|
|
7
|
+
/* The ring takes its colour from the family, not from a variant. */
|
|
8
|
+
size: ['xs', 'sm', 'md', 'lg', 'xl']
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
export const FLAGS = {} as const;
|
|
12
|
+
export const PARTS = [] as const;
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import type { Snippet } from 'svelte';
|
|
17
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
18
|
+
import { applyAxes, cx, type AxisProps } from '../variants.js';
|
|
19
|
+
|
|
20
|
+
interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, HTMLAttributes<HTMLDivElement> {
|
|
21
|
+
/** 0–100. */
|
|
22
|
+
value?: number;
|
|
23
|
+
class?: string;
|
|
24
|
+
children?: Snippet;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// The axes are deliberately NOT destructured: they travel in `axes` and are
|
|
28
|
+
// resolved by name, so an axis a family drops changes nothing down here.
|
|
29
|
+
let {
|
|
30
|
+
value = 0,
|
|
31
|
+
class: klass = '',
|
|
32
|
+
children,
|
|
33
|
+
...axes
|
|
34
|
+
}: Props = $props();
|
|
35
|
+
|
|
36
|
+
let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
|
|
37
|
+
let classes = $derived(cx(PREFIX, applied.classes, klass));
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<div
|
|
41
|
+
{...applied.rest}
|
|
42
|
+
class={classes}
|
|
43
|
+
style:--value={value}
|
|
44
|
+
role="progressbar"
|
|
45
|
+
aria-valuenow={value}
|
|
46
|
+
>
|
|
47
|
+
{#if children}{@render children()}{:else}{value}%{/if}
|
|
48
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** What .radial-progress is made of, classified. The props follow the
|
|
2
|
+
families the project registers (variants.ts, ADR 0015). */
|
|
3
|
+
export declare const PREFIX = "radial-progress";
|
|
4
|
+
export declare const AXES: {
|
|
5
|
+
readonly size: readonly ["xs", "sm", "md", "lg", "xl"];
|
|
6
|
+
};
|
|
7
|
+
export declare const FLAGS: {};
|
|
8
|
+
export declare const PARTS: readonly [];
|
|
9
|
+
import type { Snippet } from 'svelte';
|
|
10
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
11
|
+
import { type AxisProps } from '../variants.js';
|
|
12
|
+
interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, HTMLAttributes<HTMLDivElement> {
|
|
13
|
+
/** 0–100. */
|
|
14
|
+
value?: number;
|
|
15
|
+
class?: string;
|
|
16
|
+
children?: Snippet;
|
|
17
|
+
}
|
|
18
|
+
declare const RadialProgress: import("svelte").Component<Props, {}, "">;
|
|
19
|
+
type RadialProgress = ReturnType<typeof RadialProgress>;
|
|
20
|
+
export default RadialProgress;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
/** What .radio is made of, classified. The props follow the
|
|
3
|
+
families the project registers (variants.ts, ADR 0015). */
|
|
4
|
+
export const PREFIX = 'radio';
|
|
5
|
+
|
|
6
|
+
export const AXES = {
|
|
7
|
+
color: ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error'],
|
|
8
|
+
size: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
9
|
+
shape: ['square']
|
|
10
|
+
} as const;
|
|
11
|
+
|
|
12
|
+
export const FLAGS = {} as const;
|
|
13
|
+
export const PARTS = [] as const;
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import type { Snippet } from 'svelte';
|
|
18
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
19
|
+
import { applyAxes, cx, type AxisProps } from '../variants.js';
|
|
20
|
+
|
|
21
|
+
interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLInputAttributes, 'size' | 'color' | 'type'> {
|
|
22
|
+
/** Colour the control by its own validity and reveal `hint` when invalid. */
|
|
23
|
+
validator?: boolean;
|
|
24
|
+
/** Shown below once invalid. It must be the control's next sibling for the
|
|
25
|
+
CSS to reach it, which is why it is a prop rather than your markup. */
|
|
26
|
+
hint?: Snippet;
|
|
27
|
+
class?: string;
|
|
28
|
+
/** The value this radio contributes when it is the one selected. */
|
|
29
|
+
value?: string | number;
|
|
30
|
+
/** Bound across the whole set: it holds the selected value. */
|
|
31
|
+
group?: string | number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// The axes are deliberately NOT destructured: they travel in `axes` and are
|
|
35
|
+
// resolved by name, so an axis a family drops changes nothing down here.
|
|
36
|
+
let {
|
|
37
|
+
validator = false,
|
|
38
|
+
hint,
|
|
39
|
+
group = $bindable(),
|
|
40
|
+
value,
|
|
41
|
+
class: klass = '',
|
|
42
|
+
...axes
|
|
43
|
+
}: Props = $props();
|
|
44
|
+
|
|
45
|
+
let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
|
|
46
|
+
let classes = $derived(cx(PREFIX, applied.classes, validator && 'validator', klass));
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<input type="radio" {...applied.rest} class={classes} bind:group {value} />
|
|
50
|
+
{#if hint}<p class="validator-hint">{@render hint()}</p>{/if}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** What .radio is made of, classified. The props follow the
|
|
2
|
+
families the project registers (variants.ts, ADR 0015). */
|
|
3
|
+
export declare const PREFIX = "radio";
|
|
4
|
+
export declare const AXES: {
|
|
5
|
+
readonly color: readonly ["primary", "secondary", "accent", "neutral", "info", "success", "warning", "error"];
|
|
6
|
+
readonly size: readonly ["xs", "sm", "md", "lg", "xl"];
|
|
7
|
+
readonly shape: readonly ["square"];
|
|
8
|
+
};
|
|
9
|
+
export declare const FLAGS: {};
|
|
10
|
+
export declare const PARTS: readonly [];
|
|
11
|
+
import type { Snippet } from 'svelte';
|
|
12
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
13
|
+
import { type AxisProps } from '../variants.js';
|
|
14
|
+
interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLInputAttributes, 'size' | 'color' | 'type'> {
|
|
15
|
+
/** Colour the control by its own validity and reveal `hint` when invalid. */
|
|
16
|
+
validator?: boolean;
|
|
17
|
+
/** Shown below once invalid. It must be the control's next sibling for the
|
|
18
|
+
CSS to reach it, which is why it is a prop rather than your markup. */
|
|
19
|
+
hint?: Snippet;
|
|
20
|
+
class?: string;
|
|
21
|
+
/** The value this radio contributes when it is the one selected. */
|
|
22
|
+
value?: string | number;
|
|
23
|
+
/** Bound across the whole set: it holds the selected value. */
|
|
24
|
+
group?: string | number;
|
|
25
|
+
}
|
|
26
|
+
declare const Radio: import("svelte").Component<Props, {}, "group">;
|
|
27
|
+
type Radio = ReturnType<typeof Radio>;
|
|
28
|
+
export default Radio;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
/** What .range is made of, classified. The props follow the
|
|
3
|
+
families the project registers (variants.ts, ADR 0015). */
|
|
4
|
+
export const PREFIX = 'range';
|
|
5
|
+
|
|
6
|
+
export const AXES = {
|
|
7
|
+
color: ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error'],
|
|
8
|
+
size: ['xs', 'sm', 'md', 'lg', 'xl']
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
export const FLAGS = {} as const;
|
|
12
|
+
export const PARTS = [] as const;
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import type { Snippet } from 'svelte';
|
|
17
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
18
|
+
import { applyAxes, cx, type AxisProps } from '../variants.js';
|
|
19
|
+
|
|
20
|
+
interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLInputAttributes, 'size' | 'color' | 'type'> {
|
|
21
|
+
/** Colour the control by its own validity and reveal `hint` when invalid. */
|
|
22
|
+
validator?: boolean;
|
|
23
|
+
/** Shown below once invalid. It must be the control's next sibling for the
|
|
24
|
+
CSS to reach it, which is why it is a prop rather than your markup. */
|
|
25
|
+
hint?: Snippet;
|
|
26
|
+
class?: string;
|
|
27
|
+
value?: number;
|
|
28
|
+
min?: number;
|
|
29
|
+
max?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// The axes are deliberately NOT destructured: they travel in `axes` and are
|
|
33
|
+
// resolved by name, so an axis a family drops changes nothing down here.
|
|
34
|
+
let {
|
|
35
|
+
validator = false,
|
|
36
|
+
hint,
|
|
37
|
+
value = $bindable(0),
|
|
38
|
+
min = 0,
|
|
39
|
+
max = 100,
|
|
40
|
+
class: klass = '',
|
|
41
|
+
...axes
|
|
42
|
+
}: Props = $props();
|
|
43
|
+
|
|
44
|
+
let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
|
|
45
|
+
let classes = $derived(cx(PREFIX, applied.classes, validator && 'validator', klass));
|
|
46
|
+
|
|
47
|
+
/* How far the value is along the track, for a family that paints the
|
|
48
|
+
filled part itself (`data-fill`) rather than with the thumb's shadow. */
|
|
49
|
+
let pct = $derived(max > min ? Math.min(100, Math.max(0, ((Number(value) - min) / (max - min)) * 100)) : 0);
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<input type="range" {...applied.rest} {min} {max} class={classes} data-fill style:--range-pct="{pct}%" bind:value />
|
|
53
|
+
{#if hint}<p class="validator-hint">{@render hint()}</p>{/if}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** What .range is made of, classified. The props follow the
|
|
2
|
+
families the project registers (variants.ts, ADR 0015). */
|
|
3
|
+
export declare const PREFIX = "range";
|
|
4
|
+
export declare const AXES: {
|
|
5
|
+
readonly color: readonly ["primary", "secondary", "accent", "neutral", "info", "success", "warning", "error"];
|
|
6
|
+
readonly size: readonly ["xs", "sm", "md", "lg", "xl"];
|
|
7
|
+
};
|
|
8
|
+
export declare const FLAGS: {};
|
|
9
|
+
export declare const PARTS: readonly [];
|
|
10
|
+
import type { Snippet } from 'svelte';
|
|
11
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
12
|
+
import { type AxisProps } from '../variants.js';
|
|
13
|
+
interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLInputAttributes, 'size' | 'color' | 'type'> {
|
|
14
|
+
/** Colour the control by its own validity and reveal `hint` when invalid. */
|
|
15
|
+
validator?: boolean;
|
|
16
|
+
/** Shown below once invalid. It must be the control's next sibling for the
|
|
17
|
+
CSS to reach it, which is why it is a prop rather than your markup. */
|
|
18
|
+
hint?: Snippet;
|
|
19
|
+
class?: string;
|
|
20
|
+
value?: number;
|
|
21
|
+
min?: number;
|
|
22
|
+
max?: number;
|
|
23
|
+
}
|
|
24
|
+
declare const Range: import("svelte").Component<Props, {}, "value">;
|
|
25
|
+
type Range = ReturnType<typeof Range>;
|
|
26
|
+
export default Range;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
/** What .rating is made of, classified. The props follow the
|
|
3
|
+
families the project registers (variants.ts, ADR 0015). */
|
|
4
|
+
export const PREFIX = 'rating';
|
|
5
|
+
|
|
6
|
+
export const AXES = {
|
|
7
|
+
color: ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error'],
|
|
8
|
+
size: ['xs', 'sm', 'md', 'lg', 'xl']
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
export const FLAGS = {
|
|
12
|
+
readonly: 'Show the score; no picking.'
|
|
13
|
+
} as const;
|
|
14
|
+
export const PARTS = ['item'] as const;
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
/**
|
|
19
|
+
* A whole-number score picked from a row of icons — real radios, so it
|
|
20
|
+
* submits with a form and the arrow keys move along it.
|
|
21
|
+
*
|
|
22
|
+
* The icon is a CSS mask, a star by default; `mask` takes another
|
|
23
|
+
* (`url(heart.svg)`). `value` is bindable: it is the field's own value.
|
|
24
|
+
*/
|
|
25
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
26
|
+
import { applyAxes, cx, type AxisProps } from '../variants.js';
|
|
27
|
+
|
|
28
|
+
interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLDivElement>, 'color' | 'onchange'> {
|
|
29
|
+
/** The score, 0 for none. Bindable. */
|
|
30
|
+
value?: number;
|
|
31
|
+
/** How many icons. */
|
|
32
|
+
max?: number;
|
|
33
|
+
/** The radios' name, for a form. */
|
|
34
|
+
name?: string;
|
|
35
|
+
/** Another icon, as a CSS image: `url(…)`. */
|
|
36
|
+
mask?: string;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
/** The group's accessible name. */
|
|
39
|
+
label?: string;
|
|
40
|
+
/** One item's accessible name. */
|
|
41
|
+
itemLabel?: (n: number) => string;
|
|
42
|
+
/** After the user picked a score. */
|
|
43
|
+
onChange?: (value: number) => void;
|
|
44
|
+
class?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// The axes are deliberately NOT destructured: they travel in `axes` and are
|
|
48
|
+
// resolved by name, so an axis a family drops changes nothing down here.
|
|
49
|
+
let {
|
|
50
|
+
value = $bindable(0),
|
|
51
|
+
max = 5,
|
|
52
|
+
name = `rating-${Math.random().toString(36).slice(2, 9)}`,
|
|
53
|
+
mask,
|
|
54
|
+
disabled = false,
|
|
55
|
+
label = 'Rating',
|
|
56
|
+
itemLabel = (n: number) => `${n} / ${max}`,
|
|
57
|
+
onChange,
|
|
58
|
+
class: klass = '',
|
|
59
|
+
...axes
|
|
60
|
+
}: Props = $props();
|
|
61
|
+
|
|
62
|
+
let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
|
|
63
|
+
let classes = $derived(cx(PREFIX, applied.classes, klass));
|
|
64
|
+
/* Read back from the classes, the one place the axes are resolved. */
|
|
65
|
+
let locked = $derived(classes.includes(`${PREFIX}-readonly`));
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<div
|
|
69
|
+
{...applied.rest}
|
|
70
|
+
class={classes}
|
|
71
|
+
role="radiogroup"
|
|
72
|
+
aria-label={label}
|
|
73
|
+
style={mask ? `--rating-mask: ${mask};` : undefined}
|
|
74
|
+
>
|
|
75
|
+
{#each { length: max }, i (i)}
|
|
76
|
+
<input
|
|
77
|
+
type="radio"
|
|
78
|
+
class="rating-item"
|
|
79
|
+
{name}
|
|
80
|
+
value={i + 1}
|
|
81
|
+
aria-label={itemLabel(i + 1)}
|
|
82
|
+
checked={value === i + 1}
|
|
83
|
+
disabled={disabled || locked}
|
|
84
|
+
onchange={() => {
|
|
85
|
+
value = i + 1;
|
|
86
|
+
onChange?.(value);
|
|
87
|
+
}}
|
|
88
|
+
/>
|
|
89
|
+
{/each}
|
|
90
|
+
</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** What .rating is made of, classified. The props follow the
|
|
2
|
+
families the project registers (variants.ts, ADR 0015). */
|
|
3
|
+
export declare const PREFIX = "rating";
|
|
4
|
+
export declare const AXES: {
|
|
5
|
+
readonly color: readonly ["primary", "secondary", "accent", "neutral", "info", "success", "warning", "error"];
|
|
6
|
+
readonly size: readonly ["xs", "sm", "md", "lg", "xl"];
|
|
7
|
+
};
|
|
8
|
+
export declare const FLAGS: {
|
|
9
|
+
readonly readonly: "Show the score; no picking.";
|
|
10
|
+
};
|
|
11
|
+
export declare const PARTS: readonly ["item"];
|
|
12
|
+
/**
|
|
13
|
+
* A whole-number score picked from a row of icons — real radios, so it
|
|
14
|
+
* submits with a form and the arrow keys move along it.
|
|
15
|
+
*
|
|
16
|
+
* The icon is a CSS mask, a star by default; `mask` takes another
|
|
17
|
+
* (`url(heart.svg)`). `value` is bindable: it is the field's own value.
|
|
18
|
+
*/
|
|
19
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
20
|
+
import { type AxisProps } from '../variants.js';
|
|
21
|
+
interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLDivElement>, 'color' | 'onchange'> {
|
|
22
|
+
/** The score, 0 for none. Bindable. */
|
|
23
|
+
value?: number;
|
|
24
|
+
/** How many icons. */
|
|
25
|
+
max?: number;
|
|
26
|
+
/** The radios' name, for a form. */
|
|
27
|
+
name?: string;
|
|
28
|
+
/** Another icon, as a CSS image: `url(…)`. */
|
|
29
|
+
mask?: string;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** The group's accessible name. */
|
|
32
|
+
label?: string;
|
|
33
|
+
/** One item's accessible name. */
|
|
34
|
+
itemLabel?: (n: number) => string;
|
|
35
|
+
/** After the user picked a score. */
|
|
36
|
+
onChange?: (value: number) => void;
|
|
37
|
+
class?: string;
|
|
38
|
+
}
|
|
39
|
+
declare const Rating: import("svelte").Component<Props, {}, "value">;
|
|
40
|
+
type Rating = ReturnType<typeof Rating>;
|
|
41
|
+
export default Rating;
|