@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.
Files changed (261) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -3
  3. package/dist/components/Accordion.svelte +48 -0
  4. package/dist/components/Accordion.svelte.d.ts +24 -0
  5. package/dist/components/Alert.svelte +107 -0
  6. package/dist/components/Alert.svelte.d.ts +40 -0
  7. package/dist/components/Avatar.svelte +75 -0
  8. package/dist/components/Avatar.svelte.d.ts +37 -0
  9. package/dist/components/Badge.svelte +46 -0
  10. package/dist/components/Badge.svelte.d.ts +22 -0
  11. package/dist/components/Breadcrumbs.svelte +36 -0
  12. package/dist/components/Breadcrumbs.svelte.d.ts +18 -0
  13. package/dist/components/Bubble.svelte +43 -0
  14. package/dist/components/Bubble.svelte.d.ts +23 -0
  15. package/dist/components/Button.svelte +132 -0
  16. package/dist/components/Button.svelte.d.ts +40 -0
  17. package/dist/components/Calendar.svelte +193 -0
  18. package/dist/components/Calendar.svelte.d.ts +60 -0
  19. package/dist/components/Card.svelte +69 -0
  20. package/dist/components/Card.svelte.d.ts +37 -0
  21. package/dist/components/Carousel.svelte +550 -0
  22. package/dist/components/Carousel.svelte.d.ts +124 -0
  23. package/dist/components/Checkbox.svelte +48 -0
  24. package/dist/components/Checkbox.svelte.d.ts +26 -0
  25. package/dist/components/Chip.svelte +60 -0
  26. package/dist/components/Chip.svelte.d.ts +26 -0
  27. package/dist/components/ChipsInput.svelte +158 -0
  28. package/dist/components/ChipsInput.svelte.d.ts +64 -0
  29. package/dist/components/Collapse.svelte +101 -0
  30. package/dist/components/Collapse.svelte.d.ts +46 -0
  31. package/dist/components/ColorPicker.svelte +135 -0
  32. package/dist/components/ColorPicker.svelte.d.ts +44 -0
  33. package/dist/components/Combobox.svelte +496 -0
  34. package/dist/components/Combobox.svelte.d.ts +96 -0
  35. package/dist/components/DataControl.svelte +754 -0
  36. package/dist/components/DataControl.svelte.d.ts +143 -0
  37. package/dist/components/DataHandler.svelte +67 -0
  38. package/dist/components/DataHandler.svelte.d.ts +44 -0
  39. package/dist/components/DatePicker.svelte +185 -0
  40. package/dist/components/DatePicker.svelte.d.ts +56 -0
  41. package/dist/components/Dialog.svelte +194 -0
  42. package/dist/components/Dialog.svelte.d.ts +51 -0
  43. package/dist/components/Divider.svelte +54 -0
  44. package/dist/components/Divider.svelte.d.ts +27 -0
  45. package/dist/components/Dock.svelte +34 -0
  46. package/dist/components/Dock.svelte.d.ts +18 -0
  47. package/dist/components/Drawer.svelte +174 -0
  48. package/dist/components/Drawer.svelte.d.ts +51 -0
  49. package/dist/components/Dropdown.svelte +183 -0
  50. package/dist/components/Dropdown.svelte.d.ts +52 -0
  51. package/dist/components/Editable.svelte +292 -0
  52. package/dist/components/Editable.svelte.d.ts +113 -0
  53. package/dist/components/EmptyState.svelte +64 -0
  54. package/dist/components/EmptyState.svelte.d.ts +29 -0
  55. package/dist/components/Fieldset.svelte +42 -0
  56. package/dist/components/Fieldset.svelte.d.ts +20 -0
  57. package/dist/components/FileDropzone.svelte +154 -0
  58. package/dist/components/FileDropzone.svelte.d.ts +45 -0
  59. package/dist/components/FileExplorer.svelte +643 -0
  60. package/dist/components/FileExplorer.svelte.d.ts +114 -0
  61. package/dist/components/FileInput.svelte +125 -0
  62. package/dist/components/FileInput.svelte.d.ts +51 -0
  63. package/dist/components/FloatingLabel.svelte +38 -0
  64. package/dist/components/FloatingLabel.svelte.d.ts +24 -0
  65. package/dist/components/Footer.svelte +68 -0
  66. package/dist/components/Footer.svelte.d.ts +37 -0
  67. package/dist/components/Grid.svelte +122 -0
  68. package/dist/components/Grid.svelte.d.ts +72 -0
  69. package/dist/components/Hero.svelte +62 -0
  70. package/dist/components/Hero.svelte.d.ts +33 -0
  71. package/dist/components/Input.svelte +184 -0
  72. package/dist/components/Input.svelte.d.ts +65 -0
  73. package/dist/components/Join.svelte +38 -0
  74. package/dist/components/Join.svelte.d.ts +21 -0
  75. package/dist/components/Kanban.svelte +284 -0
  76. package/dist/components/Kanban.svelte.d.ts +93 -0
  77. package/dist/components/Label.svelte +32 -0
  78. package/dist/components/Label.svelte.d.ts +21 -0
  79. package/dist/components/LaptopFrame.svelte +44 -0
  80. package/dist/components/LaptopFrame.svelte.d.ts +21 -0
  81. package/dist/components/List.svelte +95 -0
  82. package/dist/components/List.svelte.d.ts +69 -0
  83. package/dist/components/Loading.svelte +37 -0
  84. package/dist/components/Loading.svelte.d.ts +17 -0
  85. package/dist/components/Menu.svelte +144 -0
  86. package/dist/components/Menu.svelte.d.ts +53 -0
  87. package/dist/components/MobileFrame.svelte +41 -0
  88. package/dist/components/MobileFrame.svelte.d.ts +21 -0
  89. package/dist/components/Navbar.svelte +49 -0
  90. package/dist/components/Navbar.svelte.d.ts +25 -0
  91. package/dist/components/NumberInput.svelte +255 -0
  92. package/dist/components/NumberInput.svelte.d.ts +68 -0
  93. package/dist/components/Pagination.svelte +169 -0
  94. package/dist/components/Pagination.svelte.d.ts +50 -0
  95. package/dist/components/Progress.svelte +65 -0
  96. package/dist/components/Progress.svelte.d.ts +28 -0
  97. package/dist/components/RadialProgress.svelte +48 -0
  98. package/dist/components/RadialProgress.svelte.d.ts +20 -0
  99. package/dist/components/Radio.svelte +50 -0
  100. package/dist/components/Radio.svelte.d.ts +28 -0
  101. package/dist/components/Range.svelte +53 -0
  102. package/dist/components/Range.svelte.d.ts +26 -0
  103. package/dist/components/Rating.svelte +90 -0
  104. package/dist/components/Rating.svelte.d.ts +41 -0
  105. package/dist/components/Select.svelte +338 -0
  106. package/dist/components/Select.svelte.d.ts +74 -0
  107. package/dist/components/Sidebar.svelte +100 -0
  108. package/dist/components/Sidebar.svelte.d.ts +54 -0
  109. package/dist/components/Skeleton.svelte +40 -0
  110. package/dist/components/Skeleton.svelte.d.ts +18 -0
  111. package/dist/components/Stat.svelte +71 -0
  112. package/dist/components/Stat.svelte.d.ts +35 -0
  113. package/dist/components/Stats.svelte +38 -0
  114. package/dist/components/Stats.svelte.d.ts +22 -0
  115. package/dist/components/Steps.svelte +204 -0
  116. package/dist/components/Steps.svelte.d.ts +66 -0
  117. package/dist/components/Subtitle.svelte +44 -0
  118. package/dist/components/Subtitle.svelte.d.ts +26 -0
  119. package/dist/components/Swatch.svelte +61 -0
  120. package/dist/components/Swatch.svelte.d.ts +27 -0
  121. package/dist/components/Switch.svelte +105 -0
  122. package/dist/components/Switch.svelte.d.ts +44 -0
  123. package/dist/components/Table.svelte +243 -0
  124. package/dist/components/Table.svelte.d.ts +121 -0
  125. package/dist/components/Tabs.svelte +142 -0
  126. package/dist/components/Tabs.svelte.d.ts +80 -0
  127. package/dist/components/Text.svelte +43 -0
  128. package/dist/components/Text.svelte.d.ts +25 -0
  129. package/dist/components/Textarea.svelte +76 -0
  130. package/dist/components/Textarea.svelte.d.ts +39 -0
  131. package/dist/components/Title.svelte +46 -0
  132. package/dist/components/Title.svelte.d.ts +29 -0
  133. package/dist/components/Toast.svelte +154 -0
  134. package/dist/components/Toast.svelte.d.ts +49 -0
  135. package/dist/components/Toggle.svelte +48 -0
  136. package/dist/components/Toggle.svelte.d.ts +25 -0
  137. package/dist/components/Tooltip.svelte +70 -0
  138. package/dist/components/Tooltip.svelte.d.ts +34 -0
  139. package/dist/components/WindowFrame.svelte +53 -0
  140. package/dist/components/WindowFrame.svelte.d.ts +24 -0
  141. package/dist/components/accordion-context.d.ts +8 -0
  142. package/dist/components/accordion-context.js +25 -0
  143. package/dist/components/color.d.ts +39 -0
  144. package/dist/components/color.js +92 -0
  145. package/dist/components/data-handler.svelte.d.ts +362 -0
  146. package/dist/components/data-handler.svelte.js +690 -0
  147. package/dist/components/file-icons.d.ts +25 -0
  148. package/dist/components/file-icons.js +46 -0
  149. package/dist/family-types.d.ts +45 -0
  150. package/dist/family-types.js +73 -0
  151. package/dist/generated/classes.d.ts +17 -0
  152. package/dist/generated/classes.js +2511 -0
  153. package/dist/generated/components.d.ts +39 -0
  154. package/dist/generated/components.js +28666 -0
  155. package/dist/generated/registry.d.ts +35 -0
  156. package/dist/generated/registry.js +2658 -0
  157. package/dist/index.d.ts +73 -0
  158. package/dist/index.js +99 -0
  159. package/dist/sepale-types.d.ts +8 -0
  160. package/dist/sepale-types.js +200 -0
  161. package/dist/theme.d.ts +123 -0
  162. package/dist/theme.js +226 -0
  163. package/dist/variants.d.ts +124 -0
  164. package/dist/variants.js +70 -0
  165. package/dist/vendor/air-datepicker/LICENSE.md +21 -0
  166. package/dist/vendor/air-datepicker/README.md +19 -0
  167. package/dist/vendor/air-datepicker/buttonPresets.d.ts +13 -0
  168. package/dist/vendor/air-datepicker/buttonPresets.js +12 -0
  169. package/dist/vendor/air-datepicker/consts.d.ts +18 -0
  170. package/dist/vendor/air-datepicker/consts.js +35 -0
  171. package/dist/vendor/air-datepicker/datepicker.d.ts +289 -0
  172. package/dist/vendor/air-datepicker/datepicker.js +1435 -0
  173. package/dist/vendor/air-datepicker/datepickerBody.d.ts +46 -0
  174. package/dist/vendor/air-datepicker/datepickerBody.js +386 -0
  175. package/dist/vendor/air-datepicker/datepickerButtons.d.ts +25 -0
  176. package/dist/vendor/air-datepicker/datepickerButtons.js +85 -0
  177. package/dist/vendor/air-datepicker/datepickerCell.d.ts +35 -0
  178. package/dist/vendor/air-datepicker/datepickerCell.js +297 -0
  179. package/dist/vendor/air-datepicker/datepickerKeyboard.d.ts +26 -0
  180. package/dist/vendor/air-datepicker/datepickerKeyboard.js +207 -0
  181. package/dist/vendor/air-datepicker/datepickerNav.d.ts +31 -0
  182. package/dist/vendor/air-datepicker/datepickerNav.js +200 -0
  183. package/dist/vendor/air-datepicker/datepickerTime.d.ts +60 -0
  184. package/dist/vendor/air-datepicker/datepickerTime.js +276 -0
  185. package/dist/vendor/air-datepicker/defaults.d.ts +65 -0
  186. package/dist/vendor/air-datepicker/defaults.js +79 -0
  187. package/dist/vendor/air-datepicker/index.d.ts +168 -0
  188. package/dist/vendor/air-datepicker/index.js +3 -0
  189. package/dist/vendor/air-datepicker/locale/ar.d.ts +4 -0
  190. package/dist/vendor/air-datepicker/locale/ar.js +14 -0
  191. package/dist/vendor/air-datepicker/locale/bg.d.ts +4 -0
  192. package/dist/vendor/air-datepicker/locale/bg.js +14 -0
  193. package/dist/vendor/air-datepicker/locale/ca.d.ts +4 -0
  194. package/dist/vendor/air-datepicker/locale/ca.js +14 -0
  195. package/dist/vendor/air-datepicker/locale/cs.d.ts +4 -0
  196. package/dist/vendor/air-datepicker/locale/cs.js +14 -0
  197. package/dist/vendor/air-datepicker/locale/da.d.ts +4 -0
  198. package/dist/vendor/air-datepicker/locale/da.js +14 -0
  199. package/dist/vendor/air-datepicker/locale/de.d.ts +4 -0
  200. package/dist/vendor/air-datepicker/locale/de.js +14 -0
  201. package/dist/vendor/air-datepicker/locale/el.d.ts +4 -0
  202. package/dist/vendor/air-datepicker/locale/el.js +14 -0
  203. package/dist/vendor/air-datepicker/locale/en.d.ts +4 -0
  204. package/dist/vendor/air-datepicker/locale/en.js +14 -0
  205. package/dist/vendor/air-datepicker/locale/es.d.ts +4 -0
  206. package/dist/vendor/air-datepicker/locale/es.js +14 -0
  207. package/dist/vendor/air-datepicker/locale/eu.d.ts +4 -0
  208. package/dist/vendor/air-datepicker/locale/eu.js +14 -0
  209. package/dist/vendor/air-datepicker/locale/fi.d.ts +4 -0
  210. package/dist/vendor/air-datepicker/locale/fi.js +14 -0
  211. package/dist/vendor/air-datepicker/locale/fr.d.ts +4 -0
  212. package/dist/vendor/air-datepicker/locale/fr.js +14 -0
  213. package/dist/vendor/air-datepicker/locale/hr.d.ts +4 -0
  214. package/dist/vendor/air-datepicker/locale/hr.js +14 -0
  215. package/dist/vendor/air-datepicker/locale/hu.d.ts +4 -0
  216. package/dist/vendor/air-datepicker/locale/hu.js +14 -0
  217. package/dist/vendor/air-datepicker/locale/id.d.ts +4 -0
  218. package/dist/vendor/air-datepicker/locale/id.js +14 -0
  219. package/dist/vendor/air-datepicker/locale/it.d.ts +4 -0
  220. package/dist/vendor/air-datepicker/locale/it.js +14 -0
  221. package/dist/vendor/air-datepicker/locale/ja.d.ts +4 -0
  222. package/dist/vendor/air-datepicker/locale/ja.js +14 -0
  223. package/dist/vendor/air-datepicker/locale/ko.d.ts +4 -0
  224. package/dist/vendor/air-datepicker/locale/ko.js +14 -0
  225. package/dist/vendor/air-datepicker/locale/nb.d.ts +4 -0
  226. package/dist/vendor/air-datepicker/locale/nb.js +14 -0
  227. package/dist/vendor/air-datepicker/locale/nl.d.ts +4 -0
  228. package/dist/vendor/air-datepicker/locale/nl.js +14 -0
  229. package/dist/vendor/air-datepicker/locale/pl.d.ts +4 -0
  230. package/dist/vendor/air-datepicker/locale/pl.js +14 -0
  231. package/dist/vendor/air-datepicker/locale/pt-BR.d.ts +4 -0
  232. package/dist/vendor/air-datepicker/locale/pt-BR.js +14 -0
  233. package/dist/vendor/air-datepicker/locale/pt.d.ts +4 -0
  234. package/dist/vendor/air-datepicker/locale/pt.js +14 -0
  235. package/dist/vendor/air-datepicker/locale/ro.d.ts +4 -0
  236. package/dist/vendor/air-datepicker/locale/ro.js +14 -0
  237. package/dist/vendor/air-datepicker/locale/ru.d.ts +4 -0
  238. package/dist/vendor/air-datepicker/locale/ru.js +14 -0
  239. package/dist/vendor/air-datepicker/locale/si.d.ts +4 -0
  240. package/dist/vendor/air-datepicker/locale/si.js +14 -0
  241. package/dist/vendor/air-datepicker/locale/sk.d.ts +4 -0
  242. package/dist/vendor/air-datepicker/locale/sk.js +14 -0
  243. package/dist/vendor/air-datepicker/locale/sl.d.ts +4 -0
  244. package/dist/vendor/air-datepicker/locale/sl.js +14 -0
  245. package/dist/vendor/air-datepicker/locale/sv.d.ts +4 -0
  246. package/dist/vendor/air-datepicker/locale/sv.js +14 -0
  247. package/dist/vendor/air-datepicker/locale/th.d.ts +4 -0
  248. package/dist/vendor/air-datepicker/locale/th.js +14 -0
  249. package/dist/vendor/air-datepicker/locale/tr.d.ts +4 -0
  250. package/dist/vendor/air-datepicker/locale/tr.js +16 -0
  251. package/dist/vendor/air-datepicker/locale/uk.d.ts +4 -0
  252. package/dist/vendor/air-datepicker/locale/uk.js +14 -0
  253. package/dist/vendor/air-datepicker/locale/zh.d.ts +4 -0
  254. package/dist/vendor/air-datepicker/locale/zh.js +14 -0
  255. package/dist/vendor/air-datepicker/typedefs.d.ts +3 -0
  256. package/dist/vendor/air-datepicker/typedefs.js +15 -0
  257. package/dist/vendor/air-datepicker/utils.d.ts +155 -0
  258. package/dist/vendor/air-datepicker/utils.js +395 -0
  259. package/dist/vendor/air-datepicker/withEvents.d.ts +1 -0
  260. package/dist/vendor/air-datepicker/withEvents.js +39 -0
  261. 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;