@thomasfosterau/components 0.0.0 → 0.2.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 (484) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +241 -56
  3. package/dist/canvas/VectorCanvas.svelte +320 -0
  4. package/dist/canvas/VectorCanvas.svelte.d.ts +105 -0
  5. package/dist/canvas/history.d.ts +105 -0
  6. package/dist/canvas/history.js +147 -0
  7. package/dist/canvas/index.d.ts +15 -0
  8. package/dist/canvas/index.js +14 -0
  9. package/dist/canvas/types.d.ts +91 -0
  10. package/dist/canvas/types.js +13 -0
  11. package/dist/canvas/utils.d.ts +66 -0
  12. package/dist/canvas/utils.js +114 -0
  13. package/dist/charts/Chart.svelte +300 -0
  14. package/dist/charts/Chart.svelte.d.ts +50 -0
  15. package/dist/charts/index.d.ts +11 -0
  16. package/dist/charts/index.js +10 -0
  17. package/dist/charts/types.d.ts +28 -0
  18. package/dist/charts/types.js +6 -0
  19. package/dist/citations/BookCitation.svelte +53 -0
  20. package/dist/citations/BookCitation.svelte.d.ts +41 -0
  21. package/dist/citations/ChapterCitation.svelte +38 -0
  22. package/dist/citations/ChapterCitation.svelte.d.ts +50 -0
  23. package/dist/citations/Citation.svelte +47 -0
  24. package/dist/citations/Citation.svelte.d.ts +24 -0
  25. package/dist/citations/CreditList.svelte +69 -0
  26. package/dist/citations/CreditList.svelte.d.ts +47 -0
  27. package/dist/citations/DOILink.svelte +28 -0
  28. package/dist/citations/DOILink.svelte.d.ts +19 -0
  29. package/dist/citations/Footnote.svelte +39 -0
  30. package/dist/citations/Footnote.svelte.d.ts +17 -0
  31. package/dist/citations/FootnoteList.svelte +36 -0
  32. package/dist/citations/FootnoteList.svelte.d.ts +21 -0
  33. package/dist/citations/ISBNLink.svelte +29 -0
  34. package/dist/citations/ISBNLink.svelte.d.ts +19 -0
  35. package/dist/citations/ISSNLink.svelte +29 -0
  36. package/dist/citations/ISSNLink.svelte.d.ts +19 -0
  37. package/dist/citations/Publisher.svelte +34 -0
  38. package/dist/citations/Publisher.svelte.d.ts +14 -0
  39. package/dist/citations/ReferenceList.svelte +53 -0
  40. package/dist/citations/ReferenceList.svelte.d.ts +21 -0
  41. package/dist/citations/ReportCitation.svelte +41 -0
  42. package/dist/citations/ReportCitation.svelte.d.ts +36 -0
  43. package/dist/citations/ScholarlyArticleCitation.svelte +64 -0
  44. package/dist/citations/ScholarlyArticleCitation.svelte.d.ts +41 -0
  45. package/dist/citations/ThesisCitation.svelte +35 -0
  46. package/dist/citations/ThesisCitation.svelte.d.ts +29 -0
  47. package/dist/citations/bibliography.svelte.d.ts +55 -0
  48. package/dist/citations/bibliography.svelte.js +78 -0
  49. package/dist/citations/citation.d.ts +71 -0
  50. package/dist/citations/citation.js +121 -0
  51. package/dist/citations/csl.d.ts +102 -0
  52. package/dist/citations/csl.js +20 -0
  53. package/dist/citations/index.d.ts +31 -0
  54. package/dist/citations/index.js +36 -0
  55. package/dist/citations/list-format.d.ts +34 -0
  56. package/dist/citations/list-format.js +40 -0
  57. package/dist/context.svelte.d.ts +46 -0
  58. package/dist/context.svelte.js +51 -0
  59. package/dist/data/ChatBubble.svelte +48 -0
  60. package/dist/data/ChatBubble.svelte.d.ts +33 -0
  61. package/dist/data/DataGrid.svelte +150 -0
  62. package/dist/data/DataGrid.svelte.d.ts +118 -0
  63. package/dist/data/DescriptionList.svelte +53 -0
  64. package/dist/data/DescriptionList.svelte.d.ts +26 -0
  65. package/dist/data/DescriptionRow.svelte +56 -0
  66. package/dist/data/DescriptionRow.svelte.d.ts +21 -0
  67. package/dist/data/DiffText.svelte +29 -0
  68. package/dist/data/DiffText.svelte.d.ts +19 -0
  69. package/dist/data/ItemList.svelte +80 -0
  70. package/dist/data/ItemList.svelte.d.ts +52 -0
  71. package/dist/data/LinkListItem.svelte +46 -0
  72. package/dist/data/LinkListItem.svelte.d.ts +21 -0
  73. package/dist/data/MessageThread.svelte +29 -0
  74. package/dist/data/MessageThread.svelte.d.ts +17 -0
  75. package/dist/data/Pagination.svelte +136 -0
  76. package/dist/data/Pagination.svelte.d.ts +79 -0
  77. package/dist/data/PaginationFooter.svelte +42 -0
  78. package/dist/data/PaginationFooter.svelte.d.ts +61 -0
  79. package/dist/data/ResultCount.svelte +27 -0
  80. package/dist/data/ResultCount.svelte.d.ts +18 -0
  81. package/dist/data/Table.svelte +151 -0
  82. package/dist/data/Table.svelte.d.ts +75 -0
  83. package/dist/data/TreeList.svelte +41 -0
  84. package/dist/data/TreeList.svelte.d.ts +17 -0
  85. package/dist/data/TreeListItem.svelte +29 -0
  86. package/dist/data/TreeListItem.svelte.d.ts +10 -0
  87. package/dist/data/description-context.d.ts +39 -0
  88. package/dist/data/description-context.js +36 -0
  89. package/dist/data/diff.d.ts +14 -0
  90. package/dist/data/diff.js +10 -0
  91. package/dist/data/index.d.ts +37 -0
  92. package/dist/data/index.js +37 -0
  93. package/dist/data/list-item.d.ts +30 -0
  94. package/dist/data/list-item.js +19 -0
  95. package/dist/data/pagination.d.ts +81 -0
  96. package/dist/data/pagination.js +79 -0
  97. package/dist/data/table-types.d.ts +71 -0
  98. package/dist/data/table-types.js +35 -0
  99. package/dist/feedback/ConfirmDialog.svelte +79 -0
  100. package/dist/feedback/ConfirmDialog.svelte.d.ts +82 -0
  101. package/dist/feedback/Dialog.svelte +47 -0
  102. package/dist/feedback/Dialog.svelte.d.ts +36 -0
  103. package/dist/feedback/DialogFrame.svelte +64 -0
  104. package/dist/feedback/DialogFrame.svelte.d.ts +23 -0
  105. package/dist/feedback/Drawer.svelte +43 -0
  106. package/dist/feedback/Drawer.svelte.d.ts +43 -0
  107. package/dist/feedback/LoadingBoundary.svelte +61 -0
  108. package/dist/feedback/LoadingBoundary.svelte.d.ts +34 -0
  109. package/dist/feedback/ProgressBar.svelte +46 -0
  110. package/dist/feedback/ProgressBar.svelte.d.ts +28 -0
  111. package/dist/feedback/SegmentBar.svelte +83 -0
  112. package/dist/feedback/SegmentBar.svelte.d.ts +37 -0
  113. package/dist/feedback/StatTile.svelte +77 -0
  114. package/dist/feedback/StatTile.svelte.d.ts +50 -0
  115. package/dist/feedback/Stats.svelte +18 -0
  116. package/dist/feedback/Stats.svelte.d.ts +16 -0
  117. package/dist/feedback/Steps.svelte +72 -0
  118. package/dist/feedback/Steps.svelte.d.ts +61 -0
  119. package/dist/feedback/Timeline.svelte +86 -0
  120. package/dist/feedback/Timeline.svelte.d.ts +55 -0
  121. package/dist/feedback/Toaster.svelte +78 -0
  122. package/dist/feedback/Toaster.svelte.d.ts +32 -0
  123. package/dist/feedback/index.d.ts +34 -0
  124. package/dist/feedback/index.js +29 -0
  125. package/dist/feedback/sizes.d.ts +41 -0
  126. package/dist/feedback/sizes.js +69 -0
  127. package/dist/feedback/toaster.d.ts +48 -0
  128. package/dist/feedback/toaster.js +29 -0
  129. package/dist/fields/Calendar.svelte +60 -0
  130. package/dist/fields/Calendar.svelte.d.ts +11 -0
  131. package/dist/fields/CalendarMonths.svelte +86 -0
  132. package/dist/fields/CalendarMonths.svelte.d.ts +30 -0
  133. package/dist/fields/Checkbox.svelte +33 -0
  134. package/dist/fields/Checkbox.svelte.d.ts +30 -0
  135. package/dist/fields/CheckboxGroup.svelte +41 -0
  136. package/dist/fields/CheckboxGroup.svelte.d.ts +40 -0
  137. package/dist/fields/Combobox.svelte +229 -0
  138. package/dist/fields/Combobox.svelte.d.ts +133 -0
  139. package/dist/fields/DateField.svelte +37 -0
  140. package/dist/fields/DateField.svelte.d.ts +20 -0
  141. package/dist/fields/DateInput.svelte +31 -0
  142. package/dist/fields/DateInput.svelte.d.ts +35 -0
  143. package/dist/fields/DatePicker.svelte +47 -0
  144. package/dist/fields/DatePicker.svelte.d.ts +25 -0
  145. package/dist/fields/DateRangePicker.svelte +70 -0
  146. package/dist/fields/DateRangePicker.svelte.d.ts +43 -0
  147. package/dist/fields/Dropzone.svelte +232 -0
  148. package/dist/fields/Dropzone.svelte.d.ts +103 -0
  149. package/dist/fields/FieldErrors.svelte +30 -0
  150. package/dist/fields/FieldErrors.svelte.d.ts +11 -0
  151. package/dist/fields/Fieldset.svelte +53 -0
  152. package/dist/fields/Fieldset.svelte.d.ts +27 -0
  153. package/dist/fields/FileInput.svelte +68 -0
  154. package/dist/fields/FileInput.svelte.d.ts +39 -0
  155. package/dist/fields/FormField.svelte +78 -0
  156. package/dist/fields/FormField.svelte.d.ts +29 -0
  157. package/dist/fields/ImageInput.svelte +87 -0
  158. package/dist/fields/ImageInput.svelte.d.ts +45 -0
  159. package/dist/fields/MultiSelect.svelte +112 -0
  160. package/dist/fields/MultiSelect.svelte.d.ts +75 -0
  161. package/dist/fields/NumberField.svelte +190 -0
  162. package/dist/fields/NumberField.svelte.d.ts +76 -0
  163. package/dist/fields/PasswordInput.svelte +95 -0
  164. package/dist/fields/PasswordInput.svelte.d.ts +58 -0
  165. package/dist/fields/PickerPopover.svelte +47 -0
  166. package/dist/fields/PickerPopover.svelte.d.ts +16 -0
  167. package/dist/fields/PinInput.svelte +83 -0
  168. package/dist/fields/PinInput.svelte.d.ts +66 -0
  169. package/dist/fields/PushToggle.svelte +93 -0
  170. package/dist/fields/PushToggle.svelte.d.ts +55 -0
  171. package/dist/fields/RadioGroup.svelte +88 -0
  172. package/dist/fields/RadioGroup.svelte.d.ts +41 -0
  173. package/dist/fields/RangeCalendar.svelte +51 -0
  174. package/dist/fields/RangeCalendar.svelte.d.ts +23 -0
  175. package/dist/fields/Rating.svelte +127 -0
  176. package/dist/fields/Rating.svelte.d.ts +86 -0
  177. package/dist/fields/SearchInput.svelte +58 -0
  178. package/dist/fields/SearchInput.svelte.d.ts +33 -0
  179. package/dist/fields/SegmentGroup.svelte +91 -0
  180. package/dist/fields/SegmentGroup.svelte.d.ts +20 -0
  181. package/dist/fields/Select.svelte +36 -0
  182. package/dist/fields/Select.svelte.d.ts +35 -0
  183. package/dist/fields/Slider.svelte +194 -0
  184. package/dist/fields/Slider.svelte.d.ts +100 -0
  185. package/dist/fields/TagsInput.svelte +256 -0
  186. package/dist/fields/TagsInput.svelte.d.ts +102 -0
  187. package/dist/fields/TextInput.svelte +26 -0
  188. package/dist/fields/TextInput.svelte.d.ts +36 -0
  189. package/dist/fields/Textarea.svelte +22 -0
  190. package/dist/fields/Textarea.svelte.d.ts +31 -0
  191. package/dist/fields/TimeField.svelte +30 -0
  192. package/dist/fields/TimeField.svelte.d.ts +19 -0
  193. package/dist/fields/Toggle.svelte +72 -0
  194. package/dist/fields/Toggle.svelte.d.ts +38 -0
  195. package/dist/fields/VideoInput.svelte +35 -0
  196. package/dist/fields/VideoInput.svelte.d.ts +46 -0
  197. package/dist/fields/calendar-props.d.ts +119 -0
  198. package/dist/fields/calendar-props.js +51 -0
  199. package/dist/fields/dates.d.ts +28 -0
  200. package/dist/fields/dates.js +26 -0
  201. package/dist/fields/field-types.d.ts +80 -0
  202. package/dist/fields/field-types.js +92 -0
  203. package/dist/fields/file-validation.d.ts +30 -0
  204. package/dist/fields/file-validation.js +51 -0
  205. package/dist/fields/index.d.ts +43 -0
  206. package/dist/fields/index.js +42 -0
  207. package/dist/fields/latest-search.svelte.d.ts +38 -0
  208. package/dist/fields/latest-search.svelte.js +85 -0
  209. package/dist/fields/number-format.d.ts +52 -0
  210. package/dist/fields/number-format.js +89 -0
  211. package/dist/fields/segmented-field.d.ts +128 -0
  212. package/dist/fields/segmented-field.js +52 -0
  213. package/dist/fields/slider-keys.d.ts +21 -0
  214. package/dist/fields/slider-keys.js +37 -0
  215. package/dist/formatting/Countdown.svelte +110 -0
  216. package/dist/formatting/Countdown.svelte.d.ts +35 -0
  217. package/dist/formatting/DateTime.svelte +35 -0
  218. package/dist/formatting/DateTime.svelte.d.ts +26 -0
  219. package/dist/formatting/Duration.svelte +18 -0
  220. package/dist/formatting/Duration.svelte.d.ts +20 -0
  221. package/dist/formatting/FormatList.svelte +31 -0
  222. package/dist/formatting/FormatList.svelte.d.ts +46 -0
  223. package/dist/formatting/Highlight.svelte +51 -0
  224. package/dist/formatting/Highlight.svelte.d.ts +19 -0
  225. package/dist/formatting/Number.svelte +35 -0
  226. package/dist/formatting/Number.svelte.d.ts +43 -0
  227. package/dist/formatting/RelativeTime.svelte +69 -0
  228. package/dist/formatting/RelativeTime.svelte.d.ts +26 -0
  229. package/dist/formatting/Year.svelte +39 -0
  230. package/dist/formatting/Year.svelte.d.ts +21 -0
  231. package/dist/formatting/duration.d.ts +44 -0
  232. package/dist/formatting/duration.js +125 -0
  233. package/dist/formatting/index.d.ts +15 -0
  234. package/dist/formatting/index.js +17 -0
  235. package/dist/forms/EntityForm.svelte +185 -0
  236. package/dist/forms/EntityForm.svelte.d.ts +66 -0
  237. package/dist/forms/FormActions.svelte +29 -0
  238. package/dist/forms/FormActions.svelte.d.ts +37 -0
  239. package/dist/forms/FormErrors.svelte +21 -0
  240. package/dist/forms/FormErrors.svelte.d.ts +16 -0
  241. package/dist/forms/HiddenField.svelte +22 -0
  242. package/dist/forms/HiddenField.svelte.d.ts +11 -0
  243. package/dist/forms/SearchForm.svelte +43 -0
  244. package/dist/forms/SearchForm.svelte.d.ts +36 -0
  245. package/dist/forms/entity-form.d.ts +12 -0
  246. package/dist/forms/entity-form.js +12 -0
  247. package/dist/forms/index.d.ts +14 -0
  248. package/dist/forms/index.js +14 -0
  249. package/dist/hotkeys/HotkeyBadge.svelte +39 -0
  250. package/dist/hotkeys/HotkeyBadge.svelte.d.ts +25 -0
  251. package/dist/hotkeys/HotkeyHelpDialog.svelte +68 -0
  252. package/dist/hotkeys/HotkeyHelpDialog.svelte.d.ts +35 -0
  253. package/dist/hotkeys/HotkeyProvider.svelte +92 -0
  254. package/dist/hotkeys/HotkeyProvider.svelte.d.ts +4 -0
  255. package/dist/hotkeys/context.svelte.d.ts +47 -0
  256. package/dist/hotkeys/context.svelte.js +72 -0
  257. package/dist/hotkeys/index.d.ts +28 -0
  258. package/dist/hotkeys/index.js +27 -0
  259. package/dist/hotkeys/match.d.ts +65 -0
  260. package/dist/hotkeys/match.js +135 -0
  261. package/dist/hotkeys/registry.svelte.d.ts +55 -0
  262. package/dist/hotkeys/registry.svelte.js +110 -0
  263. package/dist/hotkeys/types.d.ts +74 -0
  264. package/dist/hotkeys/types.js +18 -0
  265. package/dist/index.d.ts +37 -0
  266. package/dist/index.js +37 -0
  267. package/dist/infobox/Infobox.svelte +79 -0
  268. package/dist/infobox/Infobox.svelte.d.ts +33 -0
  269. package/dist/infobox/InfoboxHeader.svelte +35 -0
  270. package/dist/infobox/InfoboxHeader.svelte.d.ts +18 -0
  271. package/dist/infobox/InfoboxImage.svelte +38 -0
  272. package/dist/infobox/InfoboxImage.svelte.d.ts +21 -0
  273. package/dist/infobox/InfoboxRow.svelte +50 -0
  274. package/dist/infobox/InfoboxRow.svelte.d.ts +25 -0
  275. package/dist/infobox/InfoboxSection.svelte +24 -0
  276. package/dist/infobox/InfoboxSection.svelte.d.ts +12 -0
  277. package/dist/infobox/index.d.ts +21 -0
  278. package/dist/infobox/index.js +20 -0
  279. package/dist/infobox/types.d.ts +86 -0
  280. package/dist/infobox/types.js +27 -0
  281. package/dist/layout/AppShell.svelte +50 -0
  282. package/dist/layout/AppShell.svelte.d.ts +28 -0
  283. package/dist/layout/Breadcrumbs.svelte +52 -0
  284. package/dist/layout/Breadcrumbs.svelte.d.ts +18 -0
  285. package/dist/layout/Cluster.svelte +28 -0
  286. package/dist/layout/Cluster.svelte.d.ts +27 -0
  287. package/dist/layout/DetailLayout.svelte +50 -0
  288. package/dist/layout/DetailLayout.svelte.d.ts +19 -0
  289. package/dist/layout/FilterBar.svelte +40 -0
  290. package/dist/layout/FilterBar.svelte.d.ts +12 -0
  291. package/dist/layout/Fits.svelte +27 -0
  292. package/dist/layout/Fits.svelte.d.ts +13 -0
  293. package/dist/layout/Flow.svelte +46 -0
  294. package/dist/layout/Flow.svelte.d.ts +16 -0
  295. package/dist/layout/Footer.svelte +32 -0
  296. package/dist/layout/Footer.svelte.d.ts +12 -0
  297. package/dist/layout/Grid.svelte +23 -0
  298. package/dist/layout/Grid.svelte.d.ts +26 -0
  299. package/dist/layout/HStack.svelte +12 -0
  300. package/dist/layout/HStack.svelte.d.ts +34 -0
  301. package/dist/layout/Hero.svelte +76 -0
  302. package/dist/layout/Hero.svelte.d.ts +36 -0
  303. package/dist/layout/Main.svelte +30 -0
  304. package/dist/layout/Main.svelte.d.ts +15 -0
  305. package/dist/layout/Navbar.svelte +68 -0
  306. package/dist/layout/Navbar.svelte.d.ts +31 -0
  307. package/dist/layout/PageHeader.svelte +77 -0
  308. package/dist/layout/PageHeader.svelte.d.ts +33 -0
  309. package/dist/layout/Section.svelte +72 -0
  310. package/dist/layout/Section.svelte.d.ts +40 -0
  311. package/dist/layout/Sidebar.svelte +54 -0
  312. package/dist/layout/Sidebar.svelte.d.ts +27 -0
  313. package/dist/layout/Spacer.svelte +12 -0
  314. package/dist/layout/Spacer.svelte.d.ts +6 -0
  315. package/dist/layout/Tabs.svelte +85 -0
  316. package/dist/layout/Tabs.svelte.d.ts +42 -0
  317. package/dist/layout/VStack.svelte +12 -0
  318. package/dist/layout/VStack.svelte.d.ts +29 -0
  319. package/dist/layout/index.d.ts +38 -0
  320. package/dist/layout/index.js +38 -0
  321. package/dist/layout/space.d.ts +44 -0
  322. package/dist/layout/space.js +76 -0
  323. package/dist/layout/types.d.ts +52 -0
  324. package/dist/layout/types.js +27 -0
  325. package/dist/links/ContextLinks.svelte +28 -0
  326. package/dist/links/ContextLinks.svelte.d.ts +20 -0
  327. package/dist/links/EmailLink.svelte +26 -0
  328. package/dist/links/EmailLink.svelte.d.ts +20 -0
  329. package/dist/links/index.d.ts +7 -0
  330. package/dist/links/index.js +7 -0
  331. package/dist/media/Figure.svelte +26 -0
  332. package/dist/media/Figure.svelte.d.ts +12 -0
  333. package/dist/media/Image.svelte +76 -0
  334. package/dist/media/Image.svelte.d.ts +41 -0
  335. package/dist/media/Video.svelte +65 -0
  336. package/dist/media/Video.svelte.d.ts +29 -0
  337. package/dist/media/image-dimensions.d.ts +28 -0
  338. package/dist/media/image-dimensions.js +34 -0
  339. package/dist/media/index.d.ts +10 -0
  340. package/dist/media/index.js +10 -0
  341. package/dist/search/CommandPalette.svelte +257 -0
  342. package/dist/search/CommandPalette.svelte.d.ts +59 -0
  343. package/dist/search/index.d.ts +13 -0
  344. package/dist/search/index.js +13 -0
  345. package/dist/search/types.d.ts +40 -0
  346. package/dist/search/types.js +20 -0
  347. package/dist/seo/Head.svelte +190 -0
  348. package/dist/seo/Head.svelte.d.ts +86 -0
  349. package/dist/seo/JsonLd.svelte +30 -0
  350. package/dist/seo/JsonLd.svelte.d.ts +20 -0
  351. package/dist/seo/index.d.ts +18 -0
  352. package/dist/seo/index.js +17 -0
  353. package/dist/seo/json-ld.d.ts +33 -0
  354. package/dist/seo/json-ld.js +29 -0
  355. package/dist/seo/og-image.d.ts +72 -0
  356. package/dist/seo/og-image.js +82 -0
  357. package/dist/seo/types.d.ts +43 -0
  358. package/dist/seo/types.js +6 -0
  359. package/dist/theme.css +161 -0
  360. package/dist/tips/PopoverTip.svelte +80 -0
  361. package/dist/tips/PopoverTip.svelte.d.ts +33 -0
  362. package/dist/tips/Tip.svelte +91 -0
  363. package/dist/tips/Tip.svelte.d.ts +25 -0
  364. package/dist/tips/index.d.ts +15 -0
  365. package/dist/tips/index.js +14 -0
  366. package/dist/tips/tip-stack.d.ts +26 -0
  367. package/dist/tips/tip-stack.js +37 -0
  368. package/dist/tips/tip-store.svelte.d.ts +75 -0
  369. package/dist/tips/tip-store.svelte.js +158 -0
  370. package/dist/tips/types.d.ts +46 -0
  371. package/dist/tips/types.js +6 -0
  372. package/dist/ui/Accordion.svelte +75 -0
  373. package/dist/ui/Accordion.svelte.d.ts +50 -0
  374. package/dist/ui/AccordionItem.svelte +73 -0
  375. package/dist/ui/AccordionItem.svelte.d.ts +18 -0
  376. package/dist/ui/Alert.svelte +61 -0
  377. package/dist/ui/Alert.svelte.d.ts +37 -0
  378. package/dist/ui/Badge.svelte +39 -0
  379. package/dist/ui/Badge.svelte.d.ts +32 -0
  380. package/dist/ui/Button.svelte +44 -0
  381. package/dist/ui/Button.svelte.d.ts +29 -0
  382. package/dist/ui/ButtonGroup.svelte +24 -0
  383. package/dist/ui/ButtonGroup.svelte.d.ts +17 -0
  384. package/dist/ui/Card.svelte +49 -0
  385. package/dist/ui/Card.svelte.d.ts +44 -0
  386. package/dist/ui/Chip.svelte +58 -0
  387. package/dist/ui/Chip.svelte.d.ts +21 -0
  388. package/dist/ui/ConfirmButton.svelte +75 -0
  389. package/dist/ui/ConfirmButton.svelte.d.ts +48 -0
  390. package/dist/ui/ContextMenu.svelte +75 -0
  391. package/dist/ui/ContextMenu.svelte.d.ts +25 -0
  392. package/dist/ui/Disclosure.svelte +46 -0
  393. package/dist/ui/Disclosure.svelte.d.ts +22 -0
  394. package/dist/ui/Divider.svelte +47 -0
  395. package/dist/ui/Divider.svelte.d.ts +28 -0
  396. package/dist/ui/DropdownMenu.svelte +44 -0
  397. package/dist/ui/DropdownMenu.svelte.d.ts +30 -0
  398. package/dist/ui/EmptyState.svelte +37 -0
  399. package/dist/ui/EmptyState.svelte.d.ts +22 -0
  400. package/dist/ui/ExternalLink.svelte +38 -0
  401. package/dist/ui/ExternalLink.svelte.d.ts +34 -0
  402. package/dist/ui/Heading.svelte +58 -0
  403. package/dist/ui/Heading.svelte.d.ts +22 -0
  404. package/dist/ui/Link.svelte +34 -0
  405. package/dist/ui/Link.svelte.d.ts +20 -0
  406. package/dist/ui/LinkButton.svelte +51 -0
  407. package/dist/ui/LinkButton.svelte.d.ts +33 -0
  408. package/dist/ui/Menu.svelte +24 -0
  409. package/dist/ui/Menu.svelte.d.ts +13 -0
  410. package/dist/ui/MenuCheckboxItem.svelte +33 -0
  411. package/dist/ui/MenuCheckboxItem.svelte.d.ts +20 -0
  412. package/dist/ui/MenuItem.svelte +73 -0
  413. package/dist/ui/MenuItem.svelte.d.ts +21 -0
  414. package/dist/ui/MenuRadioGroup.svelte +25 -0
  415. package/dist/ui/MenuRadioGroup.svelte.d.ts +20 -0
  416. package/dist/ui/MenuRadioItem.svelte +20 -0
  417. package/dist/ui/MenuRadioItem.svelte.d.ts +15 -0
  418. package/dist/ui/MenuSeparator.svelte +27 -0
  419. package/dist/ui/MenuSeparator.svelte.d.ts +8 -0
  420. package/dist/ui/MenuSub.svelte +24 -0
  421. package/dist/ui/MenuSub.svelte.d.ts +15 -0
  422. package/dist/ui/Popover.svelte +63 -0
  423. package/dist/ui/Popover.svelte.d.ts +40 -0
  424. package/dist/ui/ShareButton.svelte +64 -0
  425. package/dist/ui/ShareButton.svelte.d.ts +39 -0
  426. package/dist/ui/Skeleton.svelte +43 -0
  427. package/dist/ui/Skeleton.svelte.d.ts +22 -0
  428. package/dist/ui/Spinner.svelte +41 -0
  429. package/dist/ui/Spinner.svelte.d.ts +35 -0
  430. package/dist/ui/Stack.svelte +36 -0
  431. package/dist/ui/Stack.svelte.d.ts +48 -0
  432. package/dist/ui/ThemeToggle.svelte +65 -0
  433. package/dist/ui/ThemeToggle.svelte.d.ts +24 -0
  434. package/dist/ui/ToggleButton.svelte +58 -0
  435. package/dist/ui/ToggleButton.svelte.d.ts +45 -0
  436. package/dist/ui/ToggleGroup.svelte +142 -0
  437. package/dist/ui/ToggleGroup.svelte.d.ts +86 -0
  438. package/dist/ui/Toolbar.svelte +40 -0
  439. package/dist/ui/Toolbar.svelte.d.ts +20 -0
  440. package/dist/ui/ToolbarButton.svelte +29 -0
  441. package/dist/ui/ToolbarButton.svelte.d.ts +21 -0
  442. package/dist/ui/ToolbarLink.svelte +21 -0
  443. package/dist/ui/ToolbarLink.svelte.d.ts +12 -0
  444. package/dist/ui/ToolbarSeparator.svelte +22 -0
  445. package/dist/ui/ToolbarSeparator.svelte.d.ts +12 -0
  446. package/dist/ui/ToolbarToggleGroup.svelte +66 -0
  447. package/dist/ui/ToolbarToggleGroup.svelte.d.ts +52 -0
  448. package/dist/ui/Tooltip.svelte +54 -0
  449. package/dist/ui/Tooltip.svelte.d.ts +35 -0
  450. package/dist/ui/VisuallyHidden.svelte +23 -0
  451. package/dist/ui/VisuallyHidden.svelte.d.ts +10 -0
  452. package/dist/ui/accordion-context.d.ts +26 -0
  453. package/dist/ui/accordion-context.js +23 -0
  454. package/dist/ui/colour-token.d.ts +41 -0
  455. package/dist/ui/colour-token.js +49 -0
  456. package/dist/ui/context-menu.d.ts +13 -0
  457. package/dist/ui/context-menu.js +13 -0
  458. package/dist/ui/index.d.ts +63 -0
  459. package/dist/ui/index.js +62 -0
  460. package/dist/ui/menu-context.d.ts +20 -0
  461. package/dist/ui/menu-context.js +22 -0
  462. package/dist/ui/menu-parts/CheckboxItemPart.svelte +26 -0
  463. package/dist/ui/menu-parts/CheckboxItemPart.svelte.d.ts +5 -0
  464. package/dist/ui/menu-parts/ItemPart.svelte +29 -0
  465. package/dist/ui/menu-parts/ItemPart.svelte.d.ts +5 -0
  466. package/dist/ui/menu-parts/RadioGroupPart.svelte +24 -0
  467. package/dist/ui/menu-parts/RadioGroupPart.svelte.d.ts +5 -0
  468. package/dist/ui/menu-parts/RadioItemPart.svelte +22 -0
  469. package/dist/ui/menu-parts/RadioItemPart.svelte.d.ts +5 -0
  470. package/dist/ui/menu-parts/SeparatorPart.svelte +16 -0
  471. package/dist/ui/menu-parts/SeparatorPart.svelte.d.ts +5 -0
  472. package/dist/ui/menu-parts/SubPart.svelte +28 -0
  473. package/dist/ui/menu-parts/SubPart.svelte.d.ts +5 -0
  474. package/dist/ui/menu-parts/menu-parts.d.ts +104 -0
  475. package/dist/ui/menu-parts/menu-parts.js +31 -0
  476. package/dist/ui/menu-parts/parts.d.ts +12 -0
  477. package/dist/ui/menu-parts/parts.js +27 -0
  478. package/dist/ui/slug.d.ts +19 -0
  479. package/dist/ui/slug.js +25 -0
  480. package/dist/ui/toggle-classes.d.ts +39 -0
  481. package/dist/ui/toggle-classes.js +36 -0
  482. package/dist/ui/tones.d.ts +103 -0
  483. package/dist/ui/tones.js +240 -0
  484. package/package.json +41 -25
@@ -0,0 +1,21 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { HeadingLevel } from '../ui/tones.ts';
4
+ interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'children'> {
5
+ /** Where the title links to; resolved through the components context. */
6
+ href: string;
7
+ /** The linked title; rendered as a heading when `headingLevel` is set. */
8
+ title: string;
9
+ /** A line of context under the title — an owner, a parent, a date. */
10
+ subtitle?: string | undefined;
11
+ /** Short markers rendered as badges. */
12
+ badges?: readonly string[] | undefined;
13
+ /** Render the title as a real heading at this level. */
14
+ headingLevel?: HeadingLevel | undefined;
15
+ /** Extra detail under the subtitle — formatted dates, counts, a second link. */
16
+ meta?: Snippet<[]> | undefined;
17
+ }
18
+ /** The row body most lists want: a linked title, a line of context under it, and short badges. */
19
+ declare const LinkListItem: import("svelte").Component<Props, {}, "">;
20
+ type LinkListItem = ReturnType<typeof LinkListItem>;
21
+ export default LinkListItem;
@@ -0,0 +1,29 @@
1
+ <!-- @component
2
+ A conversation: a named region holding an ordered list of `ChatBubble`s.
3
+ -->
4
+ <!--
5
+ MessageThread — comments on a planting, a support thread, a note from the
6
+ garden coordinator. A `<section aria-label>` (a `region` a reader can jump
7
+ to) around an `<ol>`, because order is the content. Its children are
8
+ `ChatBubble`s, each an `<li>`.
9
+
10
+ `live` is for a thread that grows while it is read (live chat): the
11
+ section becomes `role="log"`, which announces appended messages politely.
12
+ Off by default, because a static comment history must not read itself
13
+ out as it renders.
14
+ -->
15
+ <script lang="ts">let { label, live = false, children, class: className, ...rest } = $props();
16
+ export {};
17
+ </script>
18
+
19
+ <section
20
+ {...rest}
21
+ aria-label={label}
22
+ role={live ? 'log' : undefined}
23
+ aria-live={live ? 'polite' : undefined}
24
+ class={className}
25
+ >
26
+ <ol class="flex list-none flex-col gap-1 p-0">
27
+ {@render children()}
28
+ </ol>
29
+ </section>
@@ -0,0 +1,17 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ interface Props extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
4
+ /** Accessible name, e.g. `'Comments on Bed 4'`. */
5
+ label: string;
6
+ /**
7
+ * Announce new messages as they arrive (`role="log"`).
8
+ * @defaultValue `false`
9
+ */
10
+ live?: boolean | undefined;
11
+ /** The `ChatBubble`s, oldest first. */
12
+ children: Snippet<[]>;
13
+ }
14
+ /** A conversation: a named region holding an ordered list of `ChatBubble`s. */
15
+ declare const MessageThread: import("svelte").Component<Props, {}, "">;
16
+ type MessageThread = ReturnType<typeof MessageThread>;
17
+ export default MessageThread;
@@ -0,0 +1,136 @@
1
+ <!-- @component
2
+ Offset-based page navigation: numbered links with gaps or a bare Previous/Next pair, as links (`href`) or callbacks (`onPage`).
3
+ -->
4
+ <!--
5
+ Pagination — one component for the five pagers the four apps had grown:
6
+ numbered page links with gaps, a bare Previous/Next pair, the link form and
7
+ the callback form.
8
+
9
+ Two axes, and that is the whole design. `variant` chooses how much is
10
+ drawn — `window` renders first / last / the current page's neighbours,
11
+ `prevNext` renders the two arms and nothing else, which is what a listing
12
+ that only knows "there is more" can honestly offer. `href` versus `onPage`
13
+ chooses what the controls ARE: given `href` they are real links, which keeps
14
+ Ctrl-click, middle-click and "copy link address" and works with no
15
+ JavaScript at all; given `onPage` they are buttons, for a pager over state
16
+ the URL does not carry. `href` wins when both are passed.
17
+
18
+ ARIA contract: a `<nav>` named by `label`, holding a list of controls. The
19
+ arms carry `rel="prev"` / `rel="next"`. An unavailable arm is an
20
+ `aria-disabled` `<span>` — never a link to nowhere, and never removed, since
21
+ a pager whose Previous disappears on page one slides Next under the reader's
22
+ cursor. The current page is a `<span>` with `aria-current="page"` rather
23
+ than a link to where you already are; every numbered control is named
24
+ "Page 8" through `pageLabel`, because a bare digit is not an accessible
25
+ name; and the gap marker is `aria-hidden`, because "…" is not information.
26
+
27
+ In `window` mode a single page renders nothing at all — there is nothing to
28
+ navigate — unless `showRange` asked for the range line, which is a fact
29
+ about the result and still true. In `prevNext` mode both arms stay, disabled:
30
+ that variant is drawn by a caller that wants its control bar to hold place.
31
+ -->
32
+ <script lang="ts">import { ChevronLeft, ChevronRight } from "@lucide/svelte";
33
+ import { getComponentsContext } from "../context.svelte.js";
34
+ import { buttonSize } from "../ui/tones.js";
35
+ import { pageWindow } from "./pagination.js";
36
+ let { offset, limit, total, variant = "window", href, onPage, siblings = 1, label = "Pagination", previousLabel = "Previous", nextLabel = "Next", pageLabel = (page) => `Page ${page}`, formatPage = (page) => String(page), size = "sm", showRange = false, rangeLabel, statusLabel, locales = getComponentsContext().locale(), class: className, ...rest } = $props();
37
+ const context = getComponentsContext();
38
+ const view = $derived(pageWindow({
39
+ offset,
40
+ limit
41
+ }, total, siblings));
42
+ // The formatter and the formatted string are separate `$derived`s so the
43
+ // (relatively expensive) `Intl.NumberFormat` is not rebuilt when only the
44
+ // offset moves. Counts are quantities and get grouped; the page NUMBERS
45
+ // below are identifiers and stay bare unless `formatPage` says otherwise.
46
+ const counts = $derived(new Intl.NumberFormat(locales));
47
+ const rangeText = $derived(rangeLabel === undefined ? `Showing ${counts.format(view.from)}–${counts.format(view.to)} of ${counts.format(total)}` : rangeLabel(view.from, view.to, total));
48
+ /** A target offset's href, resolved through the context. */
49
+ const linkTo = (target) => href === undefined ? undefined : context.href(href(target));
50
+ const itemClass = $derived(["btn join-item", buttonSize[size]]);
51
+ const inertClass = $derived(["btn btn-disabled join-item", buttonSize[size]]);
52
+ </script>
53
+
54
+ {#snippet armBody(text: string, leading: boolean)}
55
+ {#if leading}<ChevronLeft class="size-4" aria-hidden="true" />{/if}
56
+ <span>{text}</span>
57
+ {#if !leading}<ChevronRight class="size-4" aria-hidden="true" />{/if}
58
+ {/snippet}
59
+
60
+ {#snippet arm(target: number | undefined, text: string, rel: 'prev' | 'next', leading: boolean)}
61
+ <li>
62
+ {#if target === undefined}
63
+ <span class={inertClass} aria-disabled="true">{@render armBody(text, leading)}</span>
64
+ {:else if href !== undefined}
65
+ <a href={linkTo(target)} {rel} class={itemClass}>{@render armBody(text, leading)}</a>
66
+ {:else}
67
+ <button
68
+ type="button"
69
+ class={itemClass}
70
+ onclick={() => {
71
+ onPage?.(target);
72
+ }}
73
+ >
74
+ {@render armBody(text, leading)}
75
+ </button>
76
+ {/if}
77
+ </li>
78
+ {/snippet}
79
+
80
+ {#if variant === 'prevNext' || view.pageCount > 1}
81
+ <nav
82
+ {...rest}
83
+ aria-label={label}
84
+ class={['flex flex-col items-center gap-2 sm:flex-row sm:justify-between', className]}
85
+ >
86
+ {#if showRange}
87
+ <p class="text-base-content/70 text-sm tabular-nums">{rangeText}</p>
88
+ {/if}
89
+ <ul class="join">
90
+ {@render arm(view.previous, previousLabel, 'prev', true)}
91
+ {#if variant === 'prevNext'}
92
+ {#if statusLabel !== undefined}
93
+ <li>
94
+ <span class={['btn btn-ghost join-item pointer-events-none', buttonSize[size]]}>
95
+ {statusLabel(view.page, view.pageCount)}
96
+ </span>
97
+ </li>
98
+ {/if}
99
+ {:else}
100
+ {#each view.items as item (item.kind === 'page' ? item.page : `gap-${item.after}`)}
101
+ <li>
102
+ {#if item.kind === 'gap'}
103
+ <span class={inertClass} aria-hidden="true">…</span>
104
+ {:else if item.current}
105
+ <span class={['btn btn-active join-item', buttonSize[size]]} aria-current="page">
106
+ <span class="sr-only">{pageLabel(item.page)}</span>
107
+ <span aria-hidden="true">{formatPage(item.page)}</span>
108
+ </span>
109
+ {:else if href !== undefined}
110
+ <a href={linkTo(item.offset)} class={itemClass} aria-label={pageLabel(item.page)}>
111
+ <span aria-hidden="true">{formatPage(item.page)}</span>
112
+ </a>
113
+ {:else}
114
+ <button
115
+ type="button"
116
+ class={itemClass}
117
+ aria-label={pageLabel(item.page)}
118
+ onclick={() => {
119
+ onPage?.(item.offset);
120
+ }}
121
+ >
122
+ <span aria-hidden="true">{formatPage(item.page)}</span>
123
+ </button>
124
+ {/if}
125
+ </li>
126
+ {/each}
127
+ {/if}
128
+ {@render arm(view.next, nextLabel, 'next', false)}
129
+ </ul>
130
+ </nav>
131
+ {:else if showRange}
132
+ <!-- One page, so there is nothing to navigate — but the range line is a
133
+ fact about the result, not about the pager, and stays. A <nav> around
134
+ it alone would be a landmark with no controls in it. -->
135
+ <p {...rest} class={['text-base-content/70 text-sm tabular-nums', className]}>{rangeText}</p>
136
+ {/if}
@@ -0,0 +1,79 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type Size } from '../ui/tones.ts';
3
+ interface Props extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
4
+ /** The offset the current page was rendered with. */
5
+ offset: number;
6
+ /** The page size the current page was rendered with. */
7
+ limit: number;
8
+ /** The unpaged total across every page. */
9
+ total: number;
10
+ /**
11
+ * `window` renders numbered page links with gaps; `prevNext` a bare Previous/Next pair.
12
+ * @defaultValue `'window'`
13
+ */
14
+ variant?: 'window' | 'prevNext' | undefined;
15
+ /**
16
+ * Build the link for a target offset. Preserving the page's own query
17
+ * parameters is the caller's job — `pageHref` does it for a JSON:API
18
+ * URL — and the result is resolved through the components context.
19
+ */
20
+ href?: ((offset: number) => string) | undefined;
21
+ /** Page without navigating. Ignored when `href` is given. */
22
+ onPage?: ((offset: number) => void) | undefined;
23
+ /**
24
+ * Pages rendered either side of the current one.
25
+ * @defaultValue `1`
26
+ */
27
+ siblings?: number | undefined;
28
+ /**
29
+ * The navigation landmark's accessible name.
30
+ * @defaultValue `'Pagination'`
31
+ */
32
+ label?: string | undefined;
33
+ /**
34
+ * Text of the previous-page control.
35
+ * @defaultValue `'Previous'`
36
+ */
37
+ previousLabel?: string | undefined;
38
+ /**
39
+ * Text of the next-page control.
40
+ * @defaultValue `'Next'`
41
+ */
42
+ nextLabel?: string | undefined;
43
+ /**
44
+ * How a numbered control is named — its digit alone is not a name.
45
+ * @defaultValue `"Page <page>"`
46
+ */
47
+ pageLabel?: ((page: number) => string) | undefined;
48
+ /**
49
+ * How a page number is written on its control — the visible digits only;
50
+ * `pageLabel` is the accessible name. Page numbers are identifiers, so they
51
+ * are bare by default; pass e.g. `(page) => new Intl.NumberFormat('en-AU').format(page)`
52
+ * to group them ("1,000").
53
+ * @defaultValue `String(page)`
54
+ */
55
+ formatPage?: ((page: number) => string) | undefined;
56
+ /**
57
+ * daisyUI size step.
58
+ * @defaultValue `'sm'`
59
+ */
60
+ size?: Size | undefined;
61
+ /** Print the range line ("Showing 41–60 of 151"). */
62
+ showRange?: boolean | undefined;
63
+ /**
64
+ * The range line when `showRange`.
65
+ * @defaultValue `"Showing <start>–<end> of <total>"`
66
+ */
67
+ rangeLabel?: ((start: number, end: number, total: number) => string) | undefined;
68
+ /** Text between the two arms in `prevNext` mode ("Page 2 of 8"). */
69
+ statusLabel?: ((page: number, pages: number) => string) | undefined;
70
+ /**
71
+ * Locale(s) for `Intl` formatting.
72
+ * @defaultValue the components context's `locale()`
73
+ */
74
+ locales?: string | readonly string[] | undefined;
75
+ }
76
+ /** Offset-based page navigation: numbered links with gaps or a bare Previous/Next pair, as links (`href`) or callbacks (`onPage`). */
77
+ declare const Pagination: import("svelte").Component<Props, {}, "">;
78
+ type Pagination = ReturnType<typeof Pagination>;
79
+ export default Pagination;
@@ -0,0 +1,42 @@
1
+ <!-- @component
2
+ The count line and the pager that sit under a paginated index page.
3
+ -->
4
+ <!--
5
+ PaginationFooter — what sits under a paginated index page: the count, and
6
+ the pager.
7
+
8
+ The two always travel together, and rendering them separately at each call
9
+ site meant the same dozen lines in every listing — a dozen lines in which
10
+ the limit, the offset and the total are threaded through twice and can
11
+ disagree. Here they come from one set of props, so they cannot.
12
+
13
+ `ResultCount` and `Pagination` stay exported on their own: a page that shows
14
+ a count without paging, or pages without a count, is a real thing. This is
15
+ the pairing, not a replacement.
16
+
17
+ ARIA contract: whatever its two parts carry — a `<p>` and a labelled `<nav>`.
18
+ -->
19
+ <script lang="ts">import Pagination from "./Pagination.svelte";
20
+ import ResultCount from "./ResultCount.svelte";
21
+ let { shown, offset, limit, total, href, onPage, variant = "window", siblings = 1, size = "sm", label = "Pagination", previousLabel = "Previous", nextLabel = "Next", pageLabel, formatPage, countLabel, locales, class: className, ...rest } = $props();
22
+ </script>
23
+
24
+ <div {...rest} class={['space-y-4', className]}>
25
+ <ResultCount {shown} {total} label={countLabel} {locales} />
26
+ <Pagination
27
+ {offset}
28
+ {limit}
29
+ {total}
30
+ {variant}
31
+ {href}
32
+ {onPage}
33
+ {siblings}
34
+ {size}
35
+ {label}
36
+ {previousLabel}
37
+ {nextLabel}
38
+ {pageLabel}
39
+ {formatPage}
40
+ {locales}
41
+ />
42
+ </div>
@@ -0,0 +1,61 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { Size } from '../ui/tones.ts';
3
+ interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
4
+ /** Rows on this page — the length of what was rendered. */
5
+ shown: number;
6
+ /** The offset this page was rendered with. */
7
+ offset: number;
8
+ /** The page size this page was rendered with. */
9
+ limit: number;
10
+ /** The unpaged total. */
11
+ total: number;
12
+ /** Build the link for a target offset; the page's own query parameters included. */
13
+ href?: ((offset: number) => string) | undefined;
14
+ /** Page without navigating. Ignored when `href` is given. */
15
+ onPage?: ((offset: number) => void) | undefined;
16
+ /**
17
+ * `window` renders numbered page links with gaps; `prevNext` a bare Previous/Next pair.
18
+ * @defaultValue `'window'`
19
+ */
20
+ variant?: 'window' | 'prevNext' | undefined;
21
+ /**
22
+ * Pages rendered either side of the current one.
23
+ * @defaultValue `1`
24
+ */
25
+ siblings?: number | undefined;
26
+ /**
27
+ * daisyUI size step.
28
+ * @defaultValue `'sm'`
29
+ */
30
+ size?: Size | undefined;
31
+ /**
32
+ * The pager landmark's accessible name.
33
+ * @defaultValue `'Pagination'`
34
+ */
35
+ label?: string | undefined;
36
+ /**
37
+ * Text of the previous-page control.
38
+ * @defaultValue `'Previous'`
39
+ */
40
+ previousLabel?: string | undefined;
41
+ /**
42
+ * Text of the next-page control.
43
+ * @defaultValue `'Next'`
44
+ */
45
+ nextLabel?: string | undefined;
46
+ /** How a numbered control is named; see `Pagination`. */
47
+ pageLabel?: ((page: number) => string) | undefined;
48
+ /** Passed to `Pagination`: how a page number's visible digits are written. */
49
+ formatPage?: ((page: number) => string) | undefined;
50
+ /** The count line, when "Showing x of y" is not the sentence wanted. */
51
+ countLabel?: ((shown: number, total: number) => string) | undefined;
52
+ /**
53
+ * Locale(s) for `Intl` formatting.
54
+ * @defaultValue the components context's `locale()`
55
+ */
56
+ locales?: string | readonly string[] | undefined;
57
+ }
58
+ /** The count line and the pager that sit under a paginated index page. */
59
+ declare const PaginationFooter: import("svelte").Component<Props, {}, "">;
60
+ type PaginationFooter = ReturnType<typeof PaginationFooter>;
61
+ export default PaginationFooter;
@@ -0,0 +1,27 @@
1
+ <!-- @component
2
+ The "Showing 24 of 310" line under a list.
3
+ -->
4
+ <!--
5
+ ResultCount — "Showing 24 of 310" under a list.
6
+
7
+ Every list an API serves is a `LIMIT`ed window, so a page that showed only
8
+ the window would quietly imply it was everything; this says otherwise. It
9
+ renders nothing when `shown` is zero: an empty result is already saying
10
+ "nothing here" through its empty state, and "Showing 0 of 0" beside that is
11
+ noise, not reassurance.
12
+
13
+ ARIA contract: a plain `<p>`. Not a live region — the count is part of the
14
+ page that was just rendered, not an update to it, and announcing it on
15
+ every keystroke of a filter is the thing live regions are misused for.
16
+ -->
17
+ <script lang="ts">import { getComponentsContext } from "../context.svelte.js";
18
+ let { shown, total, label, locales = getComponentsContext().locale(), class: className, ...rest } = $props();
19
+ // Formatter and formatted string in separate `$derived`s: the constructor
20
+ // is the expensive half and only the locale should rebuild it.
21
+ const counts = $derived(new Intl.NumberFormat(locales));
22
+ const text = $derived(label === undefined ? `Showing ${counts.format(shown)} of ${counts.format(total)}` : label(shown, total));
23
+ </script>
24
+
25
+ {#if shown > 0}
26
+ <p {...rest} class={['text-base-content/60 text-sm tabular-nums', className]}>{text}</p>
27
+ {/if}
@@ -0,0 +1,18 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ interface Props extends Omit<HTMLAttributes<HTMLParagraphElement>, 'children'> {
3
+ /** Rows on this page. */
4
+ shown: number;
5
+ /** Rows the query matched in total, before the window was applied. */
6
+ total: number;
7
+ /** The whole line, when "Showing x of y" is not the sentence wanted. */
8
+ label?: ((shown: number, total: number) => string) | undefined;
9
+ /**
10
+ * Locale(s) for `Intl` formatting.
11
+ * @defaultValue the components context's `locale()`
12
+ */
13
+ locales?: string | readonly string[] | undefined;
14
+ }
15
+ /** The "Showing 24 of 310" line under a list. */
16
+ declare const ResultCount: import("svelte").Component<Props, {}, "">;
17
+ type ResultCount = ReturnType<typeof ResultCount>;
18
+ export default ResultCount;
@@ -0,0 +1,151 @@
1
+ <!-- @component
2
+ A daisyUI `table` from column definitions and rows, with optional sortable headers and activatable rows.
3
+ -->
4
+ <!--
5
+ Table — columns in, rows in, a daisyUI `table` out.
6
+
7
+ It decides nothing about WHICH rows: a caller hands it the window it wants
8
+ shown, in the order it wants it, and this draws the header, the body, the
9
+ footer and the empty state. Sorting is the same deal — the header offers
10
+ the control and announces the state, and the caller (or `DataGrid`) does
11
+ the reordering. That split is what lets one component serve both a
12
+ client-side grid over 40 rows and a server-paged listing over 40,000, where
13
+ sorting the page in hand would be a lie.
14
+
15
+ ARIA contract: a real `<table>` with `<th scope="col">` headers. `caption`
16
+ is the table's accessible name — an unnamed table is one a screen-reader
17
+ user cannot tell from the next one — and `captionHidden` keeps it for
18
+ assistive technology only when the page's own heading already shows it. A
19
+ sortable column's header is a real `<button>` inside the `<th>` (the
20
+ activation), and the `<th>` carries `aria-sort` (the state); the arrow
21
+ beside it is `aria-hidden`, because the sort must be announced by the state
22
+ and not by a glyph.
23
+
24
+ `onSelect` makes each row activatable with `role="button"`, `tabindex="0"`
25
+ and Enter/Space — a click handler on a bare `<tr>` is invisible to everyone
26
+ not using a mouse. It costs the row its `row` semantics, so prefer a link
27
+ or a button inside a cell where the row's structure matters, and keep this
28
+ for a grid whose whole row is one destination.
29
+
30
+ The empty state is not an optional nicety: a table body with no rows and no
31
+ explanation reads as broken, and only the caller knows whether "nothing"
32
+ means "none yet" or "none matched".
33
+ -->
34
+ <script lang="ts" generics="T">import { columnAriaSort, nextSortState } from "./table-types.js";
35
+ let { rows, columns, rowKey, caption, captionHidden = false, size = "md", zebra = false, pinRows = false, sort = $bindable(undefined), onSort, onSelect, emptyMessage = "Nothing to show.", emptyState, foot, sortLabel = (column) => `Sort by ${column.header}`, containerClass, class: className, ...rest } = $props();
36
+ const tableSize = {
37
+ xs: "table-xs",
38
+ sm: "table-sm",
39
+ md: "table-md",
40
+ lg: "table-lg",
41
+ xl: "table-xl"
42
+ };
43
+ /** Alignment and the column's own classes, shared by its `<th>` and `<td>`. */
44
+ const columnClass = (column) => [column.align === "end" ? "text-end" : "text-start", column.class];
45
+ const toggleSort = (column) => {
46
+ const next = nextSortState(sort, column.key);
47
+ sort = next;
48
+ onSort?.(next);
49
+ };
50
+ /** The arrow beside a sorted header. Decorative — `aria-sort` is the state. */
51
+ const sortIndicator = (key) => {
52
+ if (sort === undefined || sort.key !== key) return "";
53
+ return sort.direction === "asc" ? "▲" : "▼";
54
+ };
55
+ /**
56
+ * Everything an activatable row needs, as one spread — or nothing at all
57
+ * when it is not activatable. Assembled here rather than as four attribute
58
+ * ternaries in the markup, because those four have to agree with each other
59
+ * (a `role` without a `tabindex` is a lie) and one object is where that
60
+ * agreement is visible.
61
+ */
62
+ const rowAttributes = (row) => onSelect === undefined ? {} : {
63
+ role: "button",
64
+ tabindex: 0,
65
+ class: "cursor-pointer",
66
+ onclick: () => {
67
+ onSelect(row);
68
+ },
69
+ onkeydown: (event) => {
70
+ if (event.key !== "Enter" && event.key !== " ") return;
71
+ // Space scrolls the page and Enter can submit a wrapping form;
72
+ // an activation that also does one of those is a bug report.
73
+ event.preventDefault();
74
+ onSelect(row);
75
+ }
76
+ };
77
+ </script>
78
+
79
+ {#snippet cellBody(column: TableColumn<T>, row: T)}
80
+ {#if column.cell}{@render column.cell(row)}{:else}{column.value(row)}{/if}
81
+ {/snippet}
82
+
83
+ <div class={['overflow-x-auto', containerClass]}>
84
+ <table
85
+ {...rest}
86
+ class={[
87
+ 'table bg-base-100',
88
+ tableSize[size],
89
+ zebra && 'table-zebra',
90
+ pinRows && 'table-pin-rows',
91
+ className,
92
+ ]}
93
+ >
94
+ {#if caption !== undefined}
95
+ <caption class={captionHidden ? 'sr-only' : 'p-3 text-start text-sm font-medium'}>
96
+ {caption}
97
+ </caption>
98
+ {/if}
99
+ <thead>
100
+ <tr>
101
+ {#each columns as column (column.key)}
102
+ <th scope="col" class={columnClass(column)} aria-sort={column.sortable ? columnAriaSort(sort, column.key) : undefined}>
103
+ {#if column.sortable}
104
+ <button
105
+ type="button"
106
+ class="link link-hover inline-flex items-center gap-1"
107
+ onclick={() => {
108
+ toggleSort(column);
109
+ }}
110
+ aria-label={sortLabel(column)}
111
+ >
112
+ {column.header}
113
+ <span aria-hidden="true" class="text-xs">{sortIndicator(column.key)}</span>
114
+ </button>
115
+ {:else}
116
+ {column.header}
117
+ {/if}
118
+ </th>
119
+ {/each}
120
+ </tr>
121
+ </thead>
122
+ <tbody>
123
+ {#if rows.length === 0}
124
+ <tr>
125
+ <!-- Without the colspan the message sits under the first column and
126
+ the table looks like it lost its data rather than never had any. -->
127
+ <td colspan={columns.length} class="text-base-content/60 py-8 text-center">
128
+ {#if emptyState}{@render emptyState()}{:else}{emptyMessage}{/if}
129
+ </td>
130
+ </tr>
131
+ {:else}
132
+ {#each rows as row (rowKey(row))}
133
+ <tr class="hover:bg-base-200" {...rowAttributes(row)}>
134
+ {#each columns as column (column.key)}
135
+ {#if column.rowHeader}
136
+ <th scope="row" class={['font-normal', columnClass(column)]}>{@render cellBody(column, row)}</th>
137
+ {:else}
138
+ <td class={columnClass(column)}>{@render cellBody(column, row)}</td>
139
+ {/if}
140
+ {/each}
141
+ </tr>
142
+ {/each}
143
+ {/if}
144
+ </tbody>
145
+ {#if foot}
146
+ <tfoot>
147
+ <tr>{@render foot()}</tr>
148
+ </tfoot>
149
+ {/if}
150
+ </table>
151
+ </div>
@@ -0,0 +1,75 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLTableAttributes } from 'svelte/elements';
3
+ import type { Size } from '../ui/tones.ts';
4
+ import { type SortState, type TableColumn } from './table-types.ts';
5
+ declare function $$render<T>(): {
6
+ props: Omit<HTMLTableAttributes, "children"> & {
7
+ /** The rows to draw, in the order to draw them. */
8
+ rows: readonly T[];
9
+ /** Column definitions: header, cell renderer, sort key. */
10
+ columns: readonly TableColumn<T>[];
11
+ /** Stable identity per row — the `{#each}` key. */
12
+ rowKey: (row: T) => string;
13
+ /** The table's accessible name, rendered as its `<caption>`. */
14
+ caption?: string | undefined;
15
+ /** Keep the caption for assistive technology only. */
16
+ captionHidden?: boolean | undefined;
17
+ /**
18
+ * daisyUI size step.
19
+ * @defaultValue `'md'`
20
+ */
21
+ size?: Size | undefined;
22
+ /** Stripe alternate rows. */
23
+ zebra?: boolean | undefined;
24
+ /**
25
+ * Stick the header row while the body scrolls. Needs the scroll container
26
+ * to be the scrolling element, so give it a `max-h-*` through `class`
27
+ * when the page itself should not scroll.
28
+ */
29
+ pinRows?: boolean | undefined;
30
+ /** Which column is sorted, and which way. Bindable; `undefined` is unsorted. */
31
+ sort?: SortState | undefined;
32
+ /** Called with the next state when a sortable header is activated. */
33
+ onSort?: ((sort: SortState | undefined) => void) | undefined;
34
+ /** Makes every row activatable by pointer and keyboard. */
35
+ onSelect?: ((row: T) => void) | undefined;
36
+ /**
37
+ * The line shown instead of an empty body.
38
+ * @defaultValue `'Nothing to show.'`
39
+ */
40
+ emptyMessage?: string | undefined;
41
+ /** Richer empty state, in place of `emptyMessage`. */
42
+ emptyState?: Snippet<[]> | undefined;
43
+ /** A `<tfoot>` row — totals, or a summary. Render `<td>`/`<th>` cells. */
44
+ foot?: Snippet<[]> | undefined;
45
+ /**
46
+ * How a sortable column's button is named.
47
+ * @defaultValue `"Sort by <header>"`
48
+ */
49
+ sortLabel?: ((column: TableColumn<T>) => string) | undefined;
50
+ /** Classes on the scroll container the table sits in. */
51
+ containerClass?: string | undefined;
52
+ };
53
+ exports: {};
54
+ bindings: "sort";
55
+ slots: {};
56
+ events: {};
57
+ };
58
+ declare class __sveltets_Render<T> {
59
+ props(): ReturnType<typeof $$render<T>>['props'];
60
+ events(): ReturnType<typeof $$render<T>>['events'];
61
+ slots(): ReturnType<typeof $$render<T>>['slots'];
62
+ bindings(): "sort";
63
+ exports(): {};
64
+ }
65
+ interface $$IsomorphicComponent {
66
+ new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
67
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
68
+ } & ReturnType<__sveltets_Render<T>['exports']>;
69
+ <T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
70
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
71
+ }
72
+ /** A daisyUI `table` from column definitions and rows, with optional sortable headers and activatable rows. */
73
+ declare const Table: $$IsomorphicComponent;
74
+ type Table<T> = InstanceType<typeof Table<T>>;
75
+ export default Table;