@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,114 @@
1
+ /** What .file-explorer is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015). */
3
+ export declare const PREFIX = "file-explorer";
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 ["toolbar", "path", "actions", "views", "view", "main", "tree", "tree-item", "twisty", "content", "table", "grid", "item", "entry", "icon", "thumb", "name", "meta", "empty", "details", "menu"];
9
+ /** A file or a folder. Anything else on it is yours: it travels to the snippets. */
10
+ export interface FileNode {
11
+ id: string | number;
12
+ name: string;
13
+ kind: 'folder' | 'file';
14
+ /** Bytes. */
15
+ size?: number;
16
+ modified?: Date;
17
+ /** A static tree: a folder's content, known up front. */
18
+ children?: FileNode[];
19
+ [key: string]: unknown;
20
+ }
21
+ /** What a drop brings: nodes dragged inside the explorer, or files from the system. */
22
+ export type FileDrop = FileNode[] | File[];
23
+ /**
24
+ * Files and folders in a hierarchy, Drive-like: the folder tree on the
25
+ * left, the current folder as a list or a grid, the details of the
26
+ * selection on the right, under a toolbar with the path and your actions.
27
+ *
28
+ * Folders load lazily through `load(folder)` — `null` is the top — or
29
+ * come from a static `root`. Selection: click, Ctrl/⌘ to add, Shift for a
30
+ * range; the keyboard walks the content (arrows, Enter, Backspace to go
31
+ * up). Double-click or Enter opens a folder, or calls `onOpen` on a file.
32
+ * Right-click shows the `menu` snippet.
33
+ *
34
+ * Drag and drop moves nothing by itself: `onDrag` may refuse a drag,
35
+ * `onDrop(items, target)` says what was dropped where — nodes from inside,
36
+ * or `File`s from the system — and the app does the work, then calls
37
+ * `refresh()`.
38
+ */
39
+ import { type Snippet } from 'svelte';
40
+ import type { HTMLAttributes } from 'svelte/elements';
41
+ import { type FileIcon } from './file-icons.js';
42
+ declare const FileExplorer: import("svelte").Component<{
43
+ readonly size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
44
+ } & {} & {
45
+ background?: string;
46
+ } & HTMLAttributes<HTMLDivElement> & {
47
+ /** A static tree, from its top folder. */
48
+ root?: FileNode;
49
+ /** A folder's content, on demand. `null` is the top. Wins over `root`'s children. */
50
+ load?: (folder: FileNode | null) => FileNode[] | Promise<FileNode[]>;
51
+ /** The top's name in the path and the tree, when there is no `root`. */
52
+ rootLabel?: string;
53
+ /** Show the folder tree. */
54
+ tree?: boolean;
55
+ /** The view it starts in. */
56
+ view?: "list" | "grid";
57
+ /** Your actions, in the toolbar. */
58
+ toolbar?: Snippet<[{
59
+ folder: FileNode | null;
60
+ selection: FileNode[];
61
+ }]>;
62
+ /** The details pane, shown while something is selected. */
63
+ details?: Snippet<[FileNode[]]>;
64
+ /** The context menu's content. `close` closes it. */
65
+ menu?: Snippet<[{
66
+ items: FileNode[];
67
+ close: () => void;
68
+ }]>;
69
+ /** A node's icon, drawn by you. Wins over `icons` and `preview`. */
70
+ icon?: Snippet<[FileNode]>;
71
+ /**
72
+ * Icons by extension (`{ pdf: { glyph, color } }`), merged over the
73
+ * default table. `false` turns the table off: every file is a page.
74
+ */
75
+ icons?: Record<string, FileIcon> | false;
76
+ /**
77
+ * A picture for a file, or nothing. Defaults to the node's `thumbnail`,
78
+ * else its `url` when the extension is an image's. `false`: never.
79
+ */
80
+ preview?: ((node: FileNode) => string | undefined) | false;
81
+ /** Drawn in an empty folder. */
82
+ empty?: Snippet<[FileNode | null]>;
83
+ /** A file was opened (double-click, Enter). */
84
+ onOpen?: (file: FileNode) => void;
85
+ /** The selection changed. */
86
+ onSelect?: (items: FileNode[]) => void;
87
+ /** Another folder is shown. */
88
+ onNavigate?: (folder: FileNode | null) => void;
89
+ /** A drag starts. Return `false` to refuse it. */
90
+ onDrag?: (items: FileNode[], event: DragEvent) => boolean | void;
91
+ /** Something was dropped on a folder (`null`: the top). */
92
+ onDrop?: (items: FileDrop, target: FileNode | null, event: DragEvent) => void;
93
+ /** The texts it writes. */
94
+ labels?: Partial<{
95
+ name: string;
96
+ modified: string;
97
+ size: string;
98
+ list: string;
99
+ grid: string;
100
+ empty: string;
101
+ tree: string;
102
+ path: string;
103
+ loading: string;
104
+ }>;
105
+ formatSize?: (bytes: number) => string;
106
+ formatDate?: (date: Date) => string;
107
+ class?: string;
108
+ }, {
109
+ refresh: (folder?: FileNode | null) => void;
110
+ navigate: (chain: FileNode[]) => void;
111
+ getSelection: () => FileNode[];
112
+ }, "">;
113
+ type FileExplorer = ReturnType<typeof FileExplorer>;
114
+ export default FileExplorer;
@@ -0,0 +1,125 @@
1
+ <script module lang="ts">
2
+ /** What .file-input is made of, classified. The props follow the
3
+ families the project registers (variants.ts, ADR 0015). */
4
+ export const PREFIX = 'file-input';
5
+
6
+ export const AXES = {
7
+ color: ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error'],
8
+ size: ['xs', 'sm', 'md', 'lg', 'xl'],
9
+ variant: ['ghost']
10
+ } as const;
11
+
12
+ export const FLAGS = {} as const;
13
+ export const PARTS = [] as const;
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ /**
18
+ * A file picker. Validation stays the browser's (`required`, `accept`…);
19
+ * the message shown is the browser's own, in the visitor's language, and
20
+ * `error` forces one from outside.
21
+ */
22
+ import type { Snippet } from 'svelte';
23
+ import type { HTMLInputAttributes } from 'svelte/elements';
24
+ import { applyAxes, cx, type AxisProps } from '../variants.js';
25
+
26
+ // `size` is ours — the HTML attribute of the same name is a character count
27
+ // our CSS overrides anyway.
28
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLInputAttributes, 'size' | 'color'> {
29
+ /**
30
+ * Colour the field by its own validity and reveal `hint` once the
31
+ * browser marks it invalid. The CSS drives this off `:user-invalid`,
32
+ * so it only fires after the visitor has actually had a go.
33
+ */
34
+ validator?: boolean;
35
+ /**
36
+ * Shown under the field when it is invalid. It has to be the field's
37
+ * next sibling for the CSS to reach it, which is the whole reason this
38
+ * is a prop and not something you write yourself. Without it, the
39
+ * message is the browser's own.
40
+ */
41
+ hint?: Snippet;
42
+ /**
43
+ * An error from outside (the server said no): marks the field invalid and
44
+ * shows this, for as long as it is given. The parent owns it — it knows
45
+ * the value and is the one able to test it — so the field never clears it.
46
+ */
47
+ error?: string | null;
48
+ /** The message of the last check, `false` when the field passed. Bindable. */
49
+ invalid?: string | false;
50
+ /** The `<input>` itself. Bindable. */
51
+ element?: HTMLInputElement;
52
+ class?: string;
53
+ files?: FileList | null;
54
+ }
55
+
56
+ // The axes are deliberately NOT destructured: they travel in `axes` and are
57
+ // resolved by name, so an axis a family drops changes nothing down here.
58
+ let {
59
+ validator = false,
60
+ hint,
61
+ error = null,
62
+ invalid = $bindable(false),
63
+ element = $bindable(),
64
+ files = $bindable<FileList | null>(null),
65
+ class: klass = '',
66
+ disabled = false,
67
+ onchange,
68
+ onblur,
69
+ ...axes
70
+ }: Props = $props();
71
+
72
+ let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
73
+
74
+ /** What is shown under the field. A disabled field shows nothing. */
75
+ let message = $derived(disabled ? '' : error || (typeof invalid === 'string' ? invalid : ''));
76
+
77
+ let classes = $derived(cx(PREFIX, applied.classes, (validator || !!message) && 'validator', klass));
78
+
79
+ /** Check the field now and show the browser's message if it fails. */
80
+ export function isValid(): boolean {
81
+ if (!element || disabled) return !error;
82
+ invalid = element.validity.valid ? false : element.validationMessage;
83
+ return !error && !invalid;
84
+ }
85
+
86
+ /** Drop the chosen files. */
87
+ export function clear() {
88
+ if (element) element.value = '';
89
+ files = null;
90
+ if (invalid) isValid();
91
+ }
92
+
93
+ function handleChange(e: Event & { currentTarget: EventTarget & HTMLInputElement }) {
94
+ // A field shown invalid is re-checked once a file is picked.
95
+ if (invalid) isValid();
96
+ onchange?.(e);
97
+ }
98
+
99
+ function handleBlur(e: FocusEvent & { currentTarget: EventTarget & HTMLInputElement }) {
100
+ if (validator) isValid();
101
+ onblur?.(e);
102
+ }
103
+ </script>
104
+
105
+ <!-- Ours first: what the caller writes in the spread still wins. -->
106
+ <input
107
+ aria-invalid={message ? 'true' : undefined}
108
+ {...applied.rest}
109
+ bind:this={element}
110
+ type="file"
111
+ class={classes}
112
+ bind:files
113
+ {disabled}
114
+ onchange={handleChange}
115
+ onblur={handleBlur}
116
+ />
117
+ <!-- An error from outside first, then the caller's hint, then the browser's
118
+ own message. -->
119
+ {#if error && !disabled}
120
+ <p class="validator-hint">{error}</p>
121
+ {:else if hint}
122
+ <p class="validator-hint">{@render hint()}</p>
123
+ {:else if message}
124
+ <p class="validator-hint">{message}</p>
125
+ {/if}
@@ -0,0 +1,51 @@
1
+ /** What .file-input is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015). */
3
+ export declare const PREFIX = "file-input";
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 variant: readonly ["ghost"];
8
+ };
9
+ export declare const FLAGS: {};
10
+ export declare const PARTS: readonly [];
11
+ /**
12
+ * A file picker. Validation stays the browser's (`required`, `accept`…);
13
+ * the message shown is the browser's own, in the visitor's language, and
14
+ * `error` forces one from outside.
15
+ */
16
+ import type { Snippet } from 'svelte';
17
+ import type { HTMLInputAttributes } from 'svelte/elements';
18
+ import { type AxisProps } from '../variants.js';
19
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLInputAttributes, 'size' | 'color'> {
20
+ /**
21
+ * Colour the field by its own validity and reveal `hint` once the
22
+ * browser marks it invalid. The CSS drives this off `:user-invalid`,
23
+ * so it only fires after the visitor has actually had a go.
24
+ */
25
+ validator?: boolean;
26
+ /**
27
+ * Shown under the field when it is invalid. It has to be the field's
28
+ * next sibling for the CSS to reach it, which is the whole reason this
29
+ * is a prop and not something you write yourself. Without it, the
30
+ * message is the browser's own.
31
+ */
32
+ hint?: Snippet;
33
+ /**
34
+ * An error from outside (the server said no): marks the field invalid and
35
+ * shows this, for as long as it is given. The parent owns it — it knows
36
+ * the value and is the one able to test it — so the field never clears it.
37
+ */
38
+ error?: string | null;
39
+ /** The message of the last check, `false` when the field passed. Bindable. */
40
+ invalid?: string | false;
41
+ /** The `<input>` itself. Bindable. */
42
+ element?: HTMLInputElement;
43
+ class?: string;
44
+ files?: FileList | null;
45
+ }
46
+ declare const FileInput: import("svelte").Component<Props, {
47
+ isValid: () => boolean;
48
+ clear: () => void;
49
+ }, "invalid" | "element" | "files">;
50
+ type FileInput = ReturnType<typeof FileInput>;
51
+ export default FileInput;
@@ -0,0 +1,38 @@
1
+ <script module lang="ts">
2
+ /** What .floating-label is made of, classified. The props follow the
3
+ families the project registers (variants.ts, ADR 0015).
4
+
5
+ A container that WRAPS a field, unlike `.label`, which is inline and
6
+ lives inside one. Two roles, two components (ADR 0009). The <span> must
7
+ come before the field: the CSS reads the field's placeholder state with
8
+ `:has()` and paints the span accordingly. */
9
+ export const PREFIX = 'floating-label';
10
+
11
+ export const AXES = {} as const;
12
+
13
+ export const FLAGS = {} as const;
14
+ export const PARTS = [] as const;
15
+ </script>
16
+
17
+ <script lang="ts">
18
+ import type { Snippet } from 'svelte';
19
+ import type { HTMLLabelAttributes } from 'svelte/elements';
20
+ import { applyAxes, cx, type AxisProps } from '../variants.js';
21
+
22
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, HTMLLabelAttributes {
23
+ /** The text that floats into the field's frame once it has content. */
24
+ label?: string;
25
+ class?: string;
26
+ /** The field itself — an `<input>`, `<select>` or `<textarea>`. */
27
+ children?: Snippet;
28
+ }
29
+
30
+ let { label, class: klass = '', children, ...axes }: Props = $props();
31
+
32
+ let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
33
+ </script>
34
+
35
+ <label {...applied.rest} class={cx(PREFIX, applied.classes, klass)}>
36
+ <span>{label}</span>
37
+ {@render children?.()}
38
+ </label>
@@ -0,0 +1,24 @@
1
+ /** What .floating-label is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015).
3
+
4
+ A container that WRAPS a field, unlike `.label`, which is inline and
5
+ lives inside one. Two roles, two components (ADR 0009). The <span> must
6
+ come before the field: the CSS reads the field's placeholder state with
7
+ `:has()` and paints the span accordingly. */
8
+ export declare const PREFIX = "floating-label";
9
+ export declare const AXES: {};
10
+ export declare const FLAGS: {};
11
+ export declare const PARTS: readonly [];
12
+ import type { Snippet } from 'svelte';
13
+ import type { HTMLLabelAttributes } from 'svelte/elements';
14
+ import { type AxisProps } from '../variants.js';
15
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, HTMLLabelAttributes {
16
+ /** The text that floats into the field's frame once it has content. */
17
+ label?: string;
18
+ class?: string;
19
+ /** The field itself — an `<input>`, `<select>` or `<textarea>`. */
20
+ children?: Snippet;
21
+ }
22
+ declare const FloatingLabel: import("svelte").Component<Props, {}, "">;
23
+ type FloatingLabel = ReturnType<typeof FloatingLabel>;
24
+ export default FloatingLabel;
@@ -0,0 +1,68 @@
1
+ <script module lang="ts">
2
+ /** What .footer is made of, classified. The props follow the
3
+ families the project registers (variants.ts, ADR 0015). */
4
+ export const PREFIX = 'footer';
5
+
6
+ export const AXES = {
7
+ color: ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error']
8
+ } as const;
9
+
10
+ export const FLAGS = {
11
+ center: 'Centre the columns and the bottom row.'
12
+ } as const;
13
+ export const PARTS = ['sections', 'section', 'title', 'bottom'] as const;
14
+
15
+ export interface FooterSection {
16
+ title: string;
17
+ links: { label: string; href: string }[];
18
+ }
19
+ </script>
20
+
21
+ <script lang="ts">
22
+ /**
23
+ * The closing block of a page: columns of links, then a bottom row.
24
+ *
25
+ * `sections` draws the columns from data; for anything else, pass
26
+ * children and write `<nav class="footer-section">` yourself.
27
+ */
28
+ import type { Snippet } from 'svelte';
29
+ import type { HTMLAttributes } from 'svelte/elements';
30
+ import { applyAxes, cx, type AxisProps } from '../variants.js';
31
+
32
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLElement>, 'color'> {
33
+ sections?: FooterSection[];
34
+ /** The last row: copyright, legal links, social icons. */
35
+ bottom?: Snippet;
36
+ class?: string;
37
+ /** Columns of your own, after `sections`. */
38
+ children?: Snippet;
39
+ }
40
+
41
+ // The axes are deliberately NOT destructured: they travel in `axes` and are
42
+ // resolved by name, so an axis a family drops changes nothing down here.
43
+ let {
44
+ sections = [],
45
+ bottom,
46
+ class: klass = '',
47
+ children,
48
+ ...axes
49
+ }: Props = $props();
50
+
51
+ let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
52
+ let classes = $derived(cx(PREFIX, applied.classes, klass));
53
+ </script>
54
+
55
+ <footer {...applied.rest} class={classes}>
56
+ {#if sections.length || children}
57
+ <div class="footer-sections">
58
+ {#each sections as s (s.title)}
59
+ <nav class="footer-section" aria-label={s.title}>
60
+ <h2 class="footer-title">{s.title}</h2>
61
+ {#each s.links as l (l.href)}<a href={l.href}>{l.label}</a>{/each}
62
+ </nav>
63
+ {/each}
64
+ {@render children?.()}
65
+ </div>
66
+ {/if}
67
+ {#if bottom}<div class="footer-bottom">{@render bottom()}</div>{/if}
68
+ </footer>
@@ -0,0 +1,37 @@
1
+ /** What .footer is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015). */
3
+ export declare const PREFIX = "footer";
4
+ export declare const AXES: {
5
+ readonly color: readonly ["primary", "secondary", "accent", "neutral", "info", "success", "warning", "error"];
6
+ };
7
+ export declare const FLAGS: {
8
+ readonly center: "Centre the columns and the bottom row.";
9
+ };
10
+ export declare const PARTS: readonly ["sections", "section", "title", "bottom"];
11
+ export interface FooterSection {
12
+ title: string;
13
+ links: {
14
+ label: string;
15
+ href: string;
16
+ }[];
17
+ }
18
+ /**
19
+ * The closing block of a page: columns of links, then a bottom row.
20
+ *
21
+ * `sections` draws the columns from data; for anything else, pass
22
+ * children and write `<nav class="footer-section">` yourself.
23
+ */
24
+ import type { Snippet } from 'svelte';
25
+ import type { HTMLAttributes } from 'svelte/elements';
26
+ import { type AxisProps } from '../variants.js';
27
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLElement>, 'color'> {
28
+ sections?: FooterSection[];
29
+ /** The last row: copyright, legal links, social icons. */
30
+ bottom?: Snippet;
31
+ class?: string;
32
+ /** Columns of your own, after `sections`. */
33
+ children?: Snippet;
34
+ }
35
+ declare const Footer: import("svelte").Component<Props, {}, "">;
36
+ type Footer = ReturnType<typeof Footer>;
37
+ export default Footer;
@@ -0,0 +1,122 @@
1
+ <script module lang="ts">
2
+ /** What .grid is made of, classified. The props follow the
3
+ families the project registers (variants.ts, ADR 0015).
4
+
5
+ `masonry` is a PART, not a flag: its prop changes what is drawn (the
6
+ lanes), so it is written by hand below. */
7
+ export const PREFIX = 'grid';
8
+
9
+ export const AXES = {
10
+ size: ['xs', 'sm', 'md', 'lg', 'xl'],
11
+ /* Space between the items. */
12
+ gap: ['none', 'tight', 'loose']
13
+ } as const;
14
+
15
+ export const FLAGS = {
16
+ loading: 'Fade the items while new ones are on their way.'
17
+ } as const;
18
+ export const PARTS = ['item', 'item-selected', 'item-dirty', 'lane', 'masonry', 'empty'] as const;
19
+ </script>
20
+
21
+ <script lang="ts" generics="Item">
22
+ /**
23
+ * Items in as many columns as fit: a column is at least the family's
24
+ * minimum wide, so the count follows the width, never a breakpoint. What
25
+ * an item looks like is the `item` snippet's — a card, usually.
26
+ *
27
+ * `masonry` stacks each column on its own instead of lining items up in
28
+ * rows: the grid deals the items into its columns in turn, so the reading
29
+ * order stays row by row.
30
+ */
31
+ import type { Snippet } from 'svelte';
32
+ import type { HTMLAttributes } from 'svelte/elements';
33
+ import { applyAxes, cx, type AxisProps } from '../variants.js';
34
+
35
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, HTMLAttributes<HTMLDivElement> {
36
+ /** The items: your data, as is. */
37
+ items?: Item[];
38
+ /** How one item is drawn. */
39
+ item: Snippet<[Item, number]>;
40
+ /** An item's identity, for `selected`, `dirty` and keyed rendering. Defaults to its index. */
41
+ key?: (item: Item, index: number) => string;
42
+ /** Drawn in place of the items when there are none. */
43
+ empty?: Snippet;
44
+ /** Keys of the items to draw as selected. */
45
+ selected?: Iterable<string>;
46
+ /** Keys of the items to draw as changed and not yet saved. */
47
+ dirty?: Iterable<string>;
48
+ /** Stack each column on its own, items of uneven height packed tight. */
49
+ masonry?: boolean;
50
+ class?: string;
51
+ }
52
+
53
+ let {
54
+ items = [],
55
+ item,
56
+ key = (_item: Item, i: number) => String(i),
57
+ empty,
58
+ selected,
59
+ dirty,
60
+ masonry = false,
61
+ class: klass = '',
62
+ ...axes
63
+ }: Props = $props();
64
+
65
+ let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
66
+ let classes = $derived(cx(PREFIX, applied.classes, masonry && `${PREFIX}-masonry`, klass));
67
+
68
+ let selectedSet = $derived(new Set(selected ?? []));
69
+ let dirtySet = $derived(new Set(dirty ?? []));
70
+
71
+ /* Masonry: how many columns the browser made, read off the computed
72
+ track list — the CSS stays the one place that decides it. */
73
+ let root: HTMLDivElement | undefined = $state();
74
+ let count = $state(1);
75
+
76
+ $effect(() => {
77
+ if (!masonry || !root) return;
78
+ const el = root;
79
+ const measure = () => {
80
+ const tracks = getComputedStyle(el).gridTemplateColumns.split(' ').filter(Boolean).length;
81
+ count = Math.max(1, tracks);
82
+ };
83
+ measure();
84
+ const observer = new ResizeObserver(measure);
85
+ observer.observe(el);
86
+ return () => observer.disconnect();
87
+ });
88
+
89
+ /** Item i goes to lane i mod n: row by row, as a reader expects. */
90
+ let lanes = $derived.by(() => {
91
+ const out: { item: Item; index: number }[][] = Array.from({ length: count }, () => []);
92
+ items.forEach((it, index) => out[index % count]!.push({ item: it, index }));
93
+ return out;
94
+ });
95
+
96
+ function itemClass(it: Item, i: number) {
97
+ const k = key(it, i);
98
+ return cx(
99
+ `${PREFIX}-item`,
100
+ selectedSet.has(k) && `${PREFIX}-item-selected`,
101
+ dirtySet.has(k) && `${PREFIX}-item-dirty`
102
+ );
103
+ }
104
+ </script>
105
+
106
+ <div {...applied.rest} bind:this={root} class={classes}>
107
+ {#if !items.length}
108
+ {#if empty}<div class={`${PREFIX}-empty`}>{@render empty()}</div>{/if}
109
+ {:else if masonry}
110
+ {#each lanes as lane, li (li)}
111
+ <div class={`${PREFIX}-lane`}>
112
+ {#each lane as entry (key(entry.item, entry.index))}
113
+ <div class={itemClass(entry.item, entry.index)}>{@render item(entry.item, entry.index)}</div>
114
+ {/each}
115
+ </div>
116
+ {/each}
117
+ {:else}
118
+ {#each items as it, i (key(it, i))}
119
+ <div class={itemClass(it, i)}>{@render item(it, i)}</div>
120
+ {/each}
121
+ {/if}
122
+ </div>
@@ -0,0 +1,72 @@
1
+ /** What .grid is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015).
3
+
4
+ `masonry` is a PART, not a flag: its prop changes what is drawn (the
5
+ lanes), so it is written by hand below. */
6
+ export declare const PREFIX = "grid";
7
+ export declare const AXES: {
8
+ readonly size: readonly ["xs", "sm", "md", "lg", "xl"];
9
+ readonly gap: readonly ["none", "tight", "loose"];
10
+ };
11
+ export declare const FLAGS: {
12
+ readonly loading: "Fade the items while new ones are on their way.";
13
+ };
14
+ export declare const PARTS: readonly ["item", "item-selected", "item-dirty", "lane", "masonry", "empty"];
15
+ /**
16
+ * Items in as many columns as fit: a column is at least the family's
17
+ * minimum wide, so the count follows the width, never a breakpoint. What
18
+ * an item looks like is the `item` snippet's — a card, usually.
19
+ *
20
+ * `masonry` stacks each column on its own instead of lining items up in
21
+ * rows: the grid deals the items into its columns in turn, so the reading
22
+ * order stays row by row.
23
+ */
24
+ import type { Snippet } from 'svelte';
25
+ import type { HTMLAttributes } from 'svelte/elements';
26
+ declare function $$render<Item>(): {
27
+ props: {
28
+ readonly size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
29
+ readonly gap?: "none" | "tight" | "loose" | undefined;
30
+ } & {
31
+ loading?: boolean | undefined;
32
+ } & {
33
+ background?: string;
34
+ } & HTMLAttributes<HTMLDivElement> & {
35
+ /** The items: your data, as is. */
36
+ items?: Item[];
37
+ /** How one item is drawn. */
38
+ item: Snippet<[Item, number]>;
39
+ /** An item's identity, for `selected`, `dirty` and keyed rendering. Defaults to its index. */
40
+ key?: (item: Item, index: number) => string;
41
+ /** Drawn in place of the items when there are none. */
42
+ empty?: Snippet;
43
+ /** Keys of the items to draw as selected. */
44
+ selected?: Iterable<string>;
45
+ /** Keys of the items to draw as changed and not yet saved. */
46
+ dirty?: Iterable<string>;
47
+ /** Stack each column on its own, items of uneven height packed tight. */
48
+ masonry?: boolean;
49
+ class?: string;
50
+ };
51
+ exports: {};
52
+ bindings: "";
53
+ slots: {};
54
+ events: {};
55
+ };
56
+ declare class __sveltets_Render<Item> {
57
+ props(): ReturnType<typeof $$render<Item>>['props'];
58
+ events(): ReturnType<typeof $$render<Item>>['events'];
59
+ slots(): ReturnType<typeof $$render<Item>>['slots'];
60
+ bindings(): "";
61
+ exports(): {};
62
+ }
63
+ interface $$IsomorphicComponent {
64
+ new <Item>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Item>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Item>['props']>, ReturnType<__sveltets_Render<Item>['events']>, ReturnType<__sveltets_Render<Item>['slots']>> & {
65
+ $$bindings?: ReturnType<__sveltets_Render<Item>['bindings']>;
66
+ } & ReturnType<__sveltets_Render<Item>['exports']>;
67
+ <Item>(internal: unknown, props: ReturnType<__sveltets_Render<Item>['props']> & {}): ReturnType<__sveltets_Render<Item>['exports']>;
68
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
69
+ }
70
+ declare const Grid: $$IsomorphicComponent;
71
+ type Grid<Item> = InstanceType<typeof Grid<Item>>;
72
+ export default Grid;