@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,26 @@
1
+ <!-- @component
2
+ A daisyUI `input` over a native `<input>`, with a bindable `value` and `FieldControl` wiring.
3
+ -->
4
+ <!--
5
+ TextInput — daisyUI `input` over a native `<input>`, with a bindable `value`
6
+ and the `FieldControl` wiring (`describedBy` → `aria-describedby`, `invalid`
7
+ → `aria-invalid` + `input-error`).
8
+
9
+ ARIA contract: a native input, so the role, the keyboard and the validation
10
+ semantics are the platform's. The component adds only the two attributes
11
+ that tie it back to its `FormField`; everything else — `name`, `autocomplete`,
12
+ `maxlength`, `pattern`, `data-*` — passes straight through, because a
13
+ control that swallows those cannot be submitted, tested or hooked into.
14
+ -->
15
+ <script lang="ts">import { inputSize } from "./field-types.js";
16
+ let { value = $bindable(""), type = "text", size = "md", invalid = false, describedBy = "", labelId: _labelId, class: className, ...rest } = $props();
17
+ </script>
18
+
19
+ <input
20
+ {...rest}
21
+ {type}
22
+ bind:value
23
+ aria-invalid={invalid ? 'true' : undefined}
24
+ aria-describedby={describedBy === '' ? undefined : describedBy}
25
+ class={['input w-full', inputSize[size], invalid && 'input-error', className]}
26
+ />
@@ -0,0 +1,36 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ import { type FieldSize } from './field-types.ts';
3
+ interface Props extends Omit<HTMLInputAttributes, 'type' | 'value' | 'size'> {
4
+ /**
5
+ * The text. Bindable.
6
+ * @defaultValue `''`
7
+ */
8
+ value?: string | undefined;
9
+ /**
10
+ * The text-ish `type`s. Dates have `DateInput`, files have `FileInput`.
11
+ * @defaultValue `'text'`
12
+ */
13
+ type?: 'text' | 'email' | 'url' | 'password' | 'tel' | 'number' | 'search' | undefined;
14
+ /**
15
+ * daisyUI size step.
16
+ * @defaultValue `'md'`
17
+ */
18
+ size?: FieldSize | undefined;
19
+ /** `FieldControl`: the field is in error — sets `aria-invalid` and the error style. */
20
+ invalid?: boolean | undefined;
21
+ /**
22
+ * Ids for `aria-describedby`; empty means none.
23
+ * @defaultValue `''`
24
+ */
25
+ describedBy?: string | undefined;
26
+ /**
27
+ * `FieldControl`: the visible label's id. Not used — this control is
28
+ * labelable, so the `FormField`'s `<label for>` already names it; taken
29
+ * here so a spread `FieldControl` does not leak it as an attribute.
30
+ */
31
+ labelId?: string | undefined;
32
+ }
33
+ /** A daisyUI `input` over a native `<input>`, with a bindable `value` and `FieldControl` wiring. */
34
+ declare const TextInput: import("svelte").Component<Props, {}, "value">;
35
+ type TextInput = ReturnType<typeof TextInput>;
36
+ export default TextInput;
@@ -0,0 +1,22 @@
1
+ <!-- @component
2
+ A daisyUI `textarea` with a bindable `value` and `FieldControl` wiring. `rows` defaults to `4`.
3
+ -->
4
+ <!--
5
+ Textarea — daisyUI `textarea` with a bindable `value` and the same
6
+ `FieldControl` wiring as `TextInput`.
7
+
8
+ ARIA contract: a native `<textarea>`; the component adds `aria-describedby`
9
+ and `aria-invalid` and nothing else.
10
+ -->
11
+ <script lang="ts">import { textareaSize } from "./field-types.js";
12
+ let { value = $bindable(""), size = "md", invalid = false, describedBy = "", labelId: _labelId, rows = 4, class: className, ...rest } = $props();
13
+ </script>
14
+
15
+ <textarea
16
+ {...rest}
17
+ {rows}
18
+ bind:value
19
+ aria-invalid={invalid ? 'true' : undefined}
20
+ aria-describedby={describedBy === '' ? undefined : describedBy}
21
+ class={['textarea w-full', textareaSize[size], invalid && 'textarea-error', className]}
22
+ ></textarea>
@@ -0,0 +1,31 @@
1
+ import type { HTMLTextareaAttributes } from 'svelte/elements';
2
+ import { type FieldSize } from './field-types.ts';
3
+ interface Props extends Omit<HTMLTextareaAttributes, 'value'> {
4
+ /**
5
+ * The text. Bindable.
6
+ * @defaultValue `''`
7
+ */
8
+ value?: string | undefined;
9
+ /**
10
+ * daisyUI size step.
11
+ * @defaultValue `'md'`
12
+ */
13
+ size?: FieldSize | undefined;
14
+ /** `FieldControl`: the field is in error — sets `aria-invalid` and the error style. */
15
+ invalid?: boolean | undefined;
16
+ /**
17
+ * `FieldControl`: space-separated ids for `aria-describedby`.
18
+ * @defaultValue `''`
19
+ */
20
+ describedBy?: string | undefined;
21
+ /**
22
+ * `FieldControl`: the visible label's id. Not used — this control is
23
+ * labelable, so the `FormField`'s `<label for>` already names it; taken
24
+ * here so a spread `FieldControl` does not leak it as an attribute.
25
+ */
26
+ labelId?: string | undefined;
27
+ }
28
+ /** A daisyUI `textarea` with a bindable `value` and `FieldControl` wiring. `rows` defaults to `4`. */
29
+ declare const Textarea: import("svelte").Component<Props, {}, "value">;
30
+ type Textarea = ReturnType<typeof Textarea>;
31
+ export default Textarea;
@@ -0,0 +1,30 @@
1
+ <!-- @component
2
+ Segmented hour / minute entry on bits-ui `TimeField`, with the locale's or a forced 12/24-hour clock.
3
+ -->
4
+ <!--
5
+ TimeField — a time of day typed into segments (hour, minute, optionally
6
+ second, and AM/PM on a 12-hour clock), each a `role="spinbutton"`. The
7
+ clock follows the locale unless `hourCycle` forces 12 or 24, so the
8
+ control no longer depends on what the browser's native time input does.
9
+
10
+ ARIA contract: see `SegmentGroup`. With `name`, bits-ui posts the ISO
11
+ time (`14:30:00`) through a hidden input.
12
+ -->
13
+ <script lang="ts">import { TimeField } from "bits-ui";
14
+ import { getComponentsContext } from "../context.svelte.js";
15
+ import { definedProps } from "./calendar-props.js";
16
+ import SegmentGroup from "./SegmentGroup.svelte";
17
+ import { segmentedField } from "./segmented-field.js";
18
+ let { value = $bindable(), minValue, maxValue, granularity = "minute", ...shared } = $props();
19
+ const context = getComponentsContext();
20
+ const field = $derived(segmentedField(shared, context.locale()));
21
+ </script>
22
+
23
+ <TimeField.Root
24
+ bind:value={() => value as Time, (next) => (value = next)}
25
+ {...field.root}
26
+ {...definedProps({ minValue, maxValue })}
27
+ {granularity}
28
+ >
29
+ <SegmentGroup parts={TimeField} group={field.group} />
30
+ </TimeField.Root>
@@ -0,0 +1,19 @@
1
+ import { TimeField } from 'bits-ui';
2
+ import { type SegmentedFieldProps, type TimeValue } from './segmented-field.ts';
3
+ interface Props extends SegmentedFieldProps {
4
+ /** The time; `undefined` while empty or incomplete. Bindable. */
5
+ value?: TimeValue | undefined;
6
+ /** Earliest valid time. */
7
+ minValue?: TimeValue | undefined;
8
+ /** Latest valid time. */
9
+ maxValue?: TimeValue | undefined;
10
+ /**
11
+ * The smallest segment shown.
12
+ * @defaultValue `'minute'`
13
+ */
14
+ granularity?: 'hour' | 'minute' | 'second' | undefined;
15
+ }
16
+ /** Segmented hour / minute entry on bits-ui `TimeField`, with the locale's or a forced 12/24-hour clock. */
17
+ declare const TimeField: import("svelte").Component<Props, {}, "value">;
18
+ type TimeField = ReturnType<typeof TimeField>;
19
+ export default TimeField;
@@ -0,0 +1,72 @@
1
+ <!-- @component
2
+ A switch for an on/off setting that takes effect immediately, rather than a checkbox submitted with a form.
3
+ -->
4
+ <!--
5
+ Toggle — a switch: an on/off setting that takes effect immediately, rather
6
+ than a checkbox whose value is submitted with a form.
7
+
8
+ ARIA contract: a native `<input type="checkbox">` carrying `role="switch"`,
9
+ so the platform supplies the keyboard (Space) and the checked state while
10
+ the role tells assistive technology to announce "on"/"off" rather than
11
+ "ticked". The visible `label` is inside the `<label>` and so IS the
12
+ accessible name; `description` is deliberately outside it and reached
13
+ through `aria-describedby`, because a paragraph of explanation inside the
14
+ label would be read as part of the name every time focus lands.
15
+
16
+ Why the control is NOT `bind:checked`: the browser flips a checkbox the
17
+ instant it is clicked, but `onChange` may refuse the change — the
18
+ registration failed, the reader denied a permission, the server said no.
19
+ So the switch reports an INTENTION, and whatever `onChange` resolves to is
20
+ written back onto the control. Without that write-back a refused change
21
+ leaves the switch showing a state that is not true until the next reload.
22
+ A thrown `onChange` is treated as a refusal for the same reason, and left
23
+ for the caller to report — a switch is not the place to render an error.
24
+ -->
25
+ <script lang="ts">import { toggleSize } from "./field-types.js";
26
+ let { checked = $bindable(false), label, description, onChange, size = "md", invalid = false, describedBy = "", labelId: _labelId, disabled = false, class: className, ...rest } = $props();
27
+ const uid = $props.id();
28
+ const descriptionId = `${uid}-description`;
29
+ let pending = $state(false);
30
+ const described = $derived([description === undefined ? "" : descriptionId, describedBy].filter((part) => part !== "").join(" "));
31
+ const settle = async (control) => {
32
+ const next = control.checked;
33
+ if (onChange === undefined) {
34
+ checked = next;
35
+ return;
36
+ }
37
+ if (pending) {
38
+ control.checked = checked;
39
+ return;
40
+ }
41
+ pending = true;
42
+ try {
43
+ checked = await onChange(next);
44
+ } catch {} finally {
45
+ pending = false;
46
+ control.checked = checked;
47
+ }
48
+ };
49
+ </script>
50
+
51
+ <div class={['flex flex-col gap-1', className]}>
52
+ <label class="label cursor-pointer justify-start gap-3">
53
+ <input
54
+ {...rest}
55
+ type="checkbox"
56
+ role="switch"
57
+ {checked}
58
+ disabled={disabled || pending}
59
+ aria-busy={pending ? 'true' : undefined}
60
+ aria-invalid={invalid ? 'true' : undefined}
61
+ aria-describedby={described === '' ? undefined : described}
62
+ onchange={(event) => {
63
+ void settle(event.currentTarget);
64
+ }}
65
+ class={['toggle', toggleSize[size], invalid && 'toggle-error']}
66
+ />
67
+ <span>{label}</span>
68
+ </label>
69
+ {#if description !== undefined}
70
+ <p id={descriptionId} class="fieldset-label">{description}</p>
71
+ {/if}
72
+ </div>
@@ -0,0 +1,38 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ import { type FieldSize } from './field-types.ts';
3
+ interface Props extends Omit<HTMLInputAttributes, 'type' | 'checked' | 'size' | 'onchange'> {
4
+ /** Whether the switch is on. Bindable. */
5
+ checked?: boolean | undefined;
6
+ /** Text beside the switch; becomes its accessible name. */
7
+ label: string;
8
+ /** Explanation under the switch, reached through `aria-describedby`. */
9
+ description?: string | undefined;
10
+ /**
11
+ * Apply the change. Whatever it resolves to is what the switch ends up
12
+ * showing, so returning `false` from a request for `true` rejects it.
13
+ * Omitted, the switch is uncontrolled and simply follows the click.
14
+ */
15
+ onChange?: ((next: boolean) => Promise<boolean> | boolean) | undefined;
16
+ /**
17
+ * daisyUI size step.
18
+ * @defaultValue `'md'`
19
+ */
20
+ size?: FieldSize | undefined;
21
+ /** `FieldControl`: the field is in error — sets `aria-invalid` and the error style. */
22
+ invalid?: boolean | undefined;
23
+ /**
24
+ * `FieldControl`: space-separated ids for `aria-describedby`.
25
+ * @defaultValue `''`
26
+ */
27
+ describedBy?: string | undefined;
28
+ /**
29
+ * `FieldControl`: the visible label's id. Not used — this control is
30
+ * labelable, so the `FormField`'s `<label for>` already names it; taken
31
+ * here so a spread `FieldControl` does not leak it as an attribute.
32
+ */
33
+ labelId?: string | undefined;
34
+ }
35
+ /** A switch for an on/off setting that takes effect immediately, rather than a checkbox submitted with a form. */
36
+ declare const Toggle: import("svelte").Component<Props, {}, "checked">;
37
+ type Toggle = ReturnType<typeof Toggle>;
38
+ export default Toggle;
@@ -0,0 +1,35 @@
1
+ <!-- @component
2
+ A `FileInput` plus the progress readout for an upload the caller performs.
3
+ -->
4
+ <!--
5
+ VideoInput — a `FileInput` plus the progress readout for an upload the
6
+ CALLER performs.
7
+
8
+ The division is deliberate and is the same one `FileInput` states: this owns
9
+ the SELECTION and the PROGRESS UI, the caller owns the transfer. It receives
10
+ the chosen file through `onSelect`, drives the upload however it likes —
11
+ resumable, direct-to-storage, whatever the provider needs — and reports back
12
+ by writing `progress`. A tus or S3 client is a real dependency and belongs
13
+ in the app, not in a package every page imports.
14
+
15
+ ARIA contract: `FileInput`'s, plus a native `<progress>` named by
16
+ `progressLabel`. The bar appears only while a transfer is actually in
17
+ flight (0 < progress < 100), so a reader is not handed a permanently
18
+ stalled-looking control.
19
+ -->
20
+ <script lang="ts">import FileInput from "./FileInput.svelte";
21
+ let { file = $bindable(), progress = $bindable(0), progressLabel = "Upload progress", accept = "video/*", onSelect, class: className, ...rest } = $props();
22
+ const uploading = $derived(file !== undefined && progress > 0 && progress < 100);
23
+ const select = (chosen) => {
24
+ progress = 0;
25
+ onSelect?.(chosen);
26
+ };
27
+ </script>
28
+
29
+ <div class={['flex flex-col gap-2', className]}>
30
+ <FileInput {...rest} {accept} bind:file onSelect={select} />
31
+ {#if uploading}
32
+ <progress class="progress progress-primary w-full" value={progress} max="100" aria-label={progressLabel}
33
+ ></progress>
34
+ {/if}
35
+ </div>
@@ -0,0 +1,46 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ import type { FieldSize } from './field-types.ts';
3
+ interface Props extends Omit<HTMLInputAttributes, 'type' | 'value' | 'files' | 'size'> {
4
+ /** The chosen file. */
5
+ file?: File | undefined;
6
+ /**
7
+ * Transfer progress, 0–100. The caller writes this as its upload advances.
8
+ * @defaultValue `0`
9
+ */
10
+ progress?: number | undefined;
11
+ /**
12
+ * Accessible name of the progress bar.
13
+ * @defaultValue `'Upload progress'`
14
+ */
15
+ progressLabel?: string | undefined;
16
+ /**
17
+ * The `accept` filter passed to the file input.
18
+ * @defaultValue `'video/*'`
19
+ */
20
+ accept?: string | undefined;
21
+ /** Largest accepted file, in bytes; a larger file is rejected with `tooLargeMessage`. */
22
+ maxBytes?: number | undefined;
23
+ /**
24
+ * Shown when the chosen file exceeds `maxBytes`.
25
+ * @defaultValue `'That file is too large.'` (from `FileInput`)
26
+ */
27
+ tooLargeMessage?: string | undefined;
28
+ /** Called with the accepted file — the caller starts the transfer here. */
29
+ onSelect?: ((file: File | undefined) => void) | undefined;
30
+ /** daisyUI size step. */
31
+ size?: FieldSize | undefined;
32
+ /** `FieldControl`: the field is in error — sets `aria-invalid` and the error style. */
33
+ invalid?: boolean | undefined;
34
+ /** `FieldControl`: space-separated ids for `aria-describedby`. */
35
+ describedBy?: string | undefined;
36
+ /**
37
+ * `FieldControl`: the visible label's id. Not used — the file input is
38
+ * labelable, so `<label for>` names it; passed through to `FileInput`,
39
+ * which drops it.
40
+ */
41
+ labelId?: string | undefined;
42
+ }
43
+ /** A `FileInput` plus the progress readout for an upload the caller performs. */
44
+ declare const VideoInput: import("svelte").Component<Props, {}, "progress" | "file">;
45
+ type VideoInput = ReturnType<typeof VideoInput>;
46
+ export default VideoInput;
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Small helpers `Calendar` and `RangeCalendar` share when handing their props
3
+ * to bits-ui.
4
+ *
5
+ * @module
6
+ */
7
+ import type { DateValue } from '@internationalized/date';
8
+ import type { Snippet } from 'svelte';
9
+ import type { HTMLAttributes } from 'svelte/elements';
10
+ /** bits-ui's calendars take ONE locale string; ours takes `Intl`'s list. The first entry wins. */
11
+ export declare function firstLocale(locales: string | readonly string[] | undefined): string | undefined;
12
+ /**
13
+ * Drop the `undefined` entries of an options object. The workspace compiles
14
+ * with `exactOptionalPropertyTypes`, and bits-ui declares its optional props
15
+ * as bare `?: T`, so an option this library leaves unset must be absent, not
16
+ * `undefined`, when it is spread onto a bits-ui root.
17
+ */
18
+ export declare function definedProps<T extends Record<string, unknown>>(options: T): {
19
+ [K in keyof T]?: Exclude<T[K], undefined>;
20
+ };
21
+ /**
22
+ * The props `Calendar` and `RangeCalendar` share — everything but the value.
23
+ * Each maps onto the bits-ui root prop of the same name, except `locales`
24
+ * (bits-ui takes one locale; the first entry is used) and the `FieldControl`
25
+ * members.
26
+ */
27
+ export interface CalendarBaseProps extends Omit<HTMLAttributes<HTMLDivElement>, 'placeholder' | 'children' | 'id'> {
28
+ /**
29
+ * A date in the month to show (bits-ui's `placeholder`); omitted, the
30
+ * selected date's month, else today's. Bindable: it follows paging.
31
+ */
32
+ month?: DateValue | undefined;
33
+ /** Earliest selectable date. */
34
+ minValue?: DateValue | undefined;
35
+ /** Latest selectable date. */
36
+ maxValue?: DateValue | undefined;
37
+ /** Days that cannot be chosen at all; rendered disabled. */
38
+ isDateDisabled?: ((date: DateValue) => boolean) | undefined;
39
+ /** Days shown but marked unavailable — booked, frost, closed. */
40
+ isDateUnavailable?: ((date: DateValue) => boolean) | undefined;
41
+ /**
42
+ * Months shown side by side.
43
+ * @defaultValue `1`
44
+ */
45
+ numberOfMonths?: number | undefined;
46
+ /** 0 = Sunday … 6 = Saturday; omitted, the locale's own week start. */
47
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
48
+ /**
49
+ * Always render six weeks, so the grid never changes height.
50
+ * @defaultValue `false`
51
+ */
52
+ fixedWeeks?: boolean | undefined;
53
+ /** BCP 47 locale(s); the first is used. Falls back to the context's `locale()`. */
54
+ locales?: string | readonly string[] | undefined;
55
+ /**
56
+ * Accessible name of the calendar, before the visible month.
57
+ * @defaultValue `'Calendar'`
58
+ */
59
+ calendarLabel?: string | undefined;
60
+ /**
61
+ * Accessible name of the previous-month button.
62
+ * @defaultValue `'Previous month'`
63
+ */
64
+ previousLabel?: string | undefined;
65
+ /**
66
+ * Accessible name of the next-month button.
67
+ * @defaultValue `'Next month'`
68
+ */
69
+ nextLabel?: string | undefined;
70
+ /**
71
+ * No interaction at all.
72
+ * @defaultValue `false`
73
+ */
74
+ disabled?: boolean | undefined;
75
+ /**
76
+ * Navigable, but the value cannot change.
77
+ * @defaultValue `false`
78
+ */
79
+ readonly?: boolean | undefined;
80
+ /** Extra decoration in a day cell (a dot for "something planted"). */
81
+ day?: Snippet<[{
82
+ date: DateValue;
83
+ selected: boolean;
84
+ unavailable: boolean;
85
+ }]> | undefined;
86
+ /** `FieldControl`: the root's `id`. */
87
+ id?: string | undefined;
88
+ /** `FieldControl`: the visible label's id; the calendar is `aria-labelledby` it. */
89
+ labelId?: string | undefined;
90
+ /**
91
+ * `FieldControl`: space-separated ids for `aria-describedby`.
92
+ * @defaultValue `''`
93
+ */
94
+ describedBy?: string | undefined;
95
+ /**
96
+ * `FieldControl`: the field is in error — draws the error border.
97
+ * @defaultValue `false`
98
+ */
99
+ invalid?: boolean | undefined;
100
+ /** `FieldControl`: accepted for the spread; a calendar has no empty-value validation of its own. */
101
+ required?: boolean | undefined;
102
+ }
103
+ /** What `calendarRoot` hands `CalendarMonths`. */
104
+ export interface CalendarMonthsOptions {
105
+ readonly locale: string;
106
+ readonly previousLabel: string;
107
+ readonly nextLabel: string;
108
+ readonly day: CalendarBaseProps['day'];
109
+ }
110
+ /**
111
+ * Turn the shared props into what both bits-ui roots and `CalendarMonths`
112
+ * take: the defaults applied, the unset options dropped, the `FieldControl`
113
+ * members mapped onto ARIA, and every other attribute passed through. One
114
+ * function, so `Calendar` and `RangeCalendar` cannot disagree about a default.
115
+ */
116
+ export declare function calendarRoot(props: Omit<CalendarBaseProps, 'month'>, contextLocale: string | readonly string[] | undefined): {
117
+ readonly root: Record<string, unknown>;
118
+ readonly months: CalendarMonthsOptions;
119
+ };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Small helpers `Calendar` and `RangeCalendar` share when handing their props
3
+ * to bits-ui.
4
+ *
5
+ * @module
6
+ */
7
+ /** bits-ui's calendars take ONE locale string; ours takes `Intl`'s list. The first entry wins. */
8
+ export function firstLocale(locales) {
9
+ return typeof locales === 'string' ? locales : locales?.[0];
10
+ }
11
+ /**
12
+ * Drop the `undefined` entries of an options object. The workspace compiles
13
+ * with `exactOptionalPropertyTypes`, and bits-ui declares its optional props
14
+ * as bare `?: T`, so an option this library leaves unset must be absent, not
15
+ * `undefined`, when it is spread onto a bits-ui root.
16
+ */
17
+ export function definedProps(options) {
18
+ return Object.fromEntries(Object.entries(options).filter(([, value]) => value !== undefined));
19
+ }
20
+ /**
21
+ * Turn the shared props into what both bits-ui roots and `CalendarMonths`
22
+ * take: the defaults applied, the unset options dropped, the `FieldControl`
23
+ * members mapped onto ARIA, and every other attribute passed through. One
24
+ * function, so `Calendar` and `RangeCalendar` cannot disagree about a default.
25
+ */
26
+ export function calendarRoot(props, contextLocale) {
27
+ const { minValue, maxValue, isDateDisabled, isDateUnavailable, numberOfMonths = 1, weekStartsOn, fixedWeeks = false, locales = contextLocale, calendarLabel = 'Calendar', previousLabel = 'Previous month', nextLabel = 'Next month', disabled = false, readonly = false, day, id, labelId, describedBy = '', invalid = false, required: _required, class: className, ...rest } = props;
28
+ const locale = firstLocale(locales) ?? 'en';
29
+ return {
30
+ root: {
31
+ ...rest,
32
+ ...definedProps({ id, minValue, maxValue, isDateDisabled, isDateUnavailable, weekStartsOn }),
33
+ numberOfMonths,
34
+ weekdayFormat: 'short',
35
+ fixedWeeks,
36
+ locale,
37
+ calendarLabel,
38
+ disabled,
39
+ readonly,
40
+ 'aria-labelledby': labelId,
41
+ 'aria-describedby': describedBy === '' ? undefined : describedBy,
42
+ class: [
43
+ 'card card-border bg-base-100 inline-block p-3',
44
+ invalid && 'border-error',
45
+ disabled && 'opacity-50',
46
+ className,
47
+ ],
48
+ },
49
+ months: { locale, previousLabel, nextLabel, day },
50
+ };
51
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * `@thomasfosterau/components/dates` — the bits-ui date controls, behind
3
+ * their own entry.
4
+ *
5
+ * They bring bits-ui's calendar state machines and `@internationalized/date`'s
6
+ * calendar maths, so they are not re-exported from the root barrel or from
7
+ * `fields`: the separate entry makes that cost visible at the import site,
8
+ * lets an app `import()` them lazily on the one page that needs them, and
9
+ * keeps any always-loaded component from pulling them in by accident (the
10
+ * #129 failure mode). `DateInput`, the native control, stays in the barrel
11
+ * and remains the default for a single date on a form.
12
+ *
13
+ * `parseDate`, `parseTime`, `Time` and the `DateValue` type are re-exported
14
+ * so a caller converts at the edge without a direct dependency:
15
+ * `parseDate('2026-10-23')` / `parseTime('14:30')` in, `value.toString()`
16
+ * (ISO) out.
17
+ *
18
+ * @module
19
+ */
20
+ export { default as Calendar } from './Calendar.svelte';
21
+ export { default as DateField } from './DateField.svelte';
22
+ export { default as DatePicker } from './DatePicker.svelte';
23
+ export { default as DateRangePicker } from './DateRangePicker.svelte';
24
+ export { default as RangeCalendar } from './RangeCalendar.svelte';
25
+ export { default as TimeField } from './TimeField.svelte';
26
+ export type { CalendarBaseProps } from './calendar-props.ts';
27
+ export type { PickerProps, SegmentedFieldProps, TimeValue } from './segmented-field.ts';
28
+ export { parseDate, parseTime, Time, type DateValue } from '@internationalized/date';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `@thomasfosterau/components/dates` — the bits-ui date controls, behind
3
+ * their own entry.
4
+ *
5
+ * They bring bits-ui's calendar state machines and `@internationalized/date`'s
6
+ * calendar maths, so they are not re-exported from the root barrel or from
7
+ * `fields`: the separate entry makes that cost visible at the import site,
8
+ * lets an app `import()` them lazily on the one page that needs them, and
9
+ * keeps any always-loaded component from pulling them in by accident (the
10
+ * #129 failure mode). `DateInput`, the native control, stays in the barrel
11
+ * and remains the default for a single date on a form.
12
+ *
13
+ * `parseDate`, `parseTime`, `Time` and the `DateValue` type are re-exported
14
+ * so a caller converts at the edge without a direct dependency:
15
+ * `parseDate('2026-10-23')` / `parseTime('14:30')` in, `value.toString()`
16
+ * (ISO) out.
17
+ *
18
+ * @module
19
+ */
20
+ export { default as Calendar } from './Calendar.svelte';
21
+ export { default as DateField } from './DateField.svelte';
22
+ export { default as DatePicker } from './DatePicker.svelte';
23
+ export { default as DateRangePicker } from './DateRangePicker.svelte';
24
+ export { default as RangeCalendar } from './RangeCalendar.svelte';
25
+ export { default as TimeField } from './TimeField.svelte';
26
+ export { parseDate, parseTime, Time } from '@internationalized/date';