zabi-components 8.0.0 → 9.0.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 (456) hide show
  1. package/CHANGELOG.md +2935 -0
  2. package/README.md +243 -10
  3. package/THEME.md +162 -332
  4. package/THEMING.md +1419 -259
  5. package/dist/atoms/ActionPanel.svelte +15 -5
  6. package/dist/atoms/Avatar.svelte +120 -0
  7. package/dist/atoms/Avatar.svelte.d.ts +46 -0
  8. package/dist/atoms/Badge.svelte +71 -13
  9. package/dist/atoms/Badge.svelte.d.ts +8 -2
  10. package/dist/atoms/Block.svelte +74 -0
  11. package/dist/atoms/Block.svelte.d.ts +29 -0
  12. package/dist/atoms/Button.svelte +217 -30
  13. package/dist/atoms/Button.svelte.d.ts +33 -4
  14. package/dist/atoms/Card.svelte +182 -26
  15. package/dist/atoms/Card.svelte.d.ts +55 -3
  16. package/dist/atoms/CardHeader.svelte +16 -4
  17. package/dist/atoms/Checkbox.svelte +81 -21
  18. package/dist/atoms/Checkbox.svelte.d.ts +31 -2
  19. package/dist/atoms/Chip.svelte +351 -0
  20. package/dist/atoms/Chip.svelte.d.ts +57 -0
  21. package/dist/atoms/CodeBlock.svelte +20 -2
  22. package/dist/atoms/CodeBlock.svelte.d.ts +4 -0
  23. package/dist/atoms/CodeField.svelte +385 -0
  24. package/dist/atoms/CodeField.svelte.d.ts +61 -0
  25. package/dist/atoms/ColorPicker.svelte +260 -49
  26. package/dist/atoms/ColorPicker.svelte.d.ts +3 -0
  27. package/dist/atoms/Container.svelte +16 -8
  28. package/dist/atoms/DateField.svelte +145 -0
  29. package/dist/atoms/DateField.svelte.d.ts +81 -0
  30. package/dist/atoms/FieldMessages.svelte +69 -0
  31. package/dist/atoms/FieldMessages.svelte.d.ts +23 -0
  32. package/dist/atoms/FloatingActionButton.svelte +176 -0
  33. package/dist/atoms/FloatingActionButton.svelte.d.ts +51 -0
  34. package/dist/atoms/Heading.svelte +63 -5
  35. package/dist/atoms/Heading.svelte.d.ts +14 -0
  36. package/dist/atoms/IconButton.svelte +294 -26
  37. package/dist/atoms/IconButton.svelte.d.ts +62 -4
  38. package/dist/atoms/Input.svelte +259 -53
  39. package/dist/atoms/Input.svelte.d.ts +33 -2
  40. package/dist/atoms/List.svelte +5 -1
  41. package/dist/atoms/ListItem.svelte +70 -13
  42. package/dist/atoms/ListItem.svelte.d.ts +11 -0
  43. package/dist/atoms/PickerField.svelte +239 -0
  44. package/dist/atoms/PickerField.svelte.d.ts +67 -0
  45. package/dist/atoms/Progress.svelte +99 -19
  46. package/dist/atoms/Progress.svelte.d.ts +15 -1
  47. package/dist/atoms/Radio.svelte +51 -3
  48. package/dist/atoms/Radio.svelte.d.ts +30 -2
  49. package/dist/atoms/Rating.svelte +620 -0
  50. package/dist/atoms/Rating.svelte.d.ts +77 -0
  51. package/dist/atoms/Select.svelte +438 -98
  52. package/dist/atoms/Select.svelte.d.ts +61 -3
  53. package/dist/atoms/SelectionControl.svelte +193 -23
  54. package/dist/atoms/SelectionControl.svelte.d.ts +29 -3
  55. package/dist/atoms/Skeleton.svelte +114 -18
  56. package/dist/atoms/Skeleton.svelte.d.ts +30 -3
  57. package/dist/atoms/SkeletonGroup.svelte +43 -0
  58. package/dist/atoms/SkeletonGroup.svelte.d.ts +20 -0
  59. package/dist/atoms/Slider.svelte +344 -0
  60. package/dist/atoms/Slider.svelte.d.ts +40 -0
  61. package/dist/atoms/Sparkline.svelte +109 -0
  62. package/dist/atoms/Sparkline.svelte.d.ts +27 -0
  63. package/dist/atoms/SpeechBubble.svelte +187 -0
  64. package/dist/atoms/SpeechBubble.svelte.d.ts +33 -0
  65. package/dist/atoms/Spinner.svelte +57 -0
  66. package/dist/atoms/Spinner.svelte.d.ts +19 -0
  67. package/dist/atoms/Stat.svelte +72 -0
  68. package/dist/atoms/Stat.svelte.d.ts +19 -0
  69. package/dist/atoms/Table.svelte +151 -6
  70. package/dist/atoms/Table.svelte.d.ts +15 -3
  71. package/dist/atoms/TemporalField.svelte +472 -0
  72. package/dist/atoms/TemporalField.svelte.d.ts +48 -0
  73. package/dist/atoms/Text.svelte +23 -11
  74. package/dist/atoms/Text.svelte.d.ts +6 -3
  75. package/dist/atoms/Textarea.svelte +150 -44
  76. package/dist/atoms/Textarea.svelte.d.ts +35 -2
  77. package/dist/atoms/ThemeToggle.svelte +223 -44
  78. package/dist/atoms/ThemeToggle.svelte.d.ts +26 -3
  79. package/dist/atoms/TimeColumn.svelte +150 -0
  80. package/dist/atoms/TimeColumn.svelte.d.ts +25 -0
  81. package/dist/atoms/TimeField.svelte +151 -0
  82. package/dist/atoms/TimeField.svelte.d.ts +85 -0
  83. package/dist/atoms/Toast.svelte +22 -8
  84. package/dist/atoms/Toast.svelte.d.ts +2 -0
  85. package/dist/atoms/Toggle.svelte +98 -14
  86. package/dist/atoms/Toggle.svelte.d.ts +26 -2
  87. package/dist/atoms/Tooltip.svelte +528 -24
  88. package/dist/atoms/Tooltip.svelte.d.ts +18 -0
  89. package/dist/atoms/ZabiStringsProvider.svelte +45 -0
  90. package/dist/atoms/ZabiStringsProvider.svelte.d.ts +27 -0
  91. package/dist/atoms/index.d.ts +38 -0
  92. package/dist/atoms/index.js +29 -0
  93. package/dist/atoms/selection-control.styles.d.ts +47 -5
  94. package/dist/atoms/selection-control.styles.js +52 -10
  95. package/dist/components/atoms/index.d.ts +38 -0
  96. package/dist/components/atoms/index.d.ts.map +1 -1
  97. package/dist/components/atoms/selection-control.styles.d.ts +47 -5
  98. package/dist/components/atoms/selection-control.styles.d.ts.map +1 -1
  99. package/dist/components/index.d.ts +104 -2
  100. package/dist/components/index.d.ts.map +1 -1
  101. package/dist/components/map.d.ts +11 -0
  102. package/dist/components/map.d.ts.map +1 -0
  103. package/dist/components/molecules/index.d.ts +51 -0
  104. package/dist/components/molecules/index.d.ts.map +1 -1
  105. package/dist/components/molecules/toast-store.d.ts +83 -7
  106. package/dist/components/molecules/toast-store.d.ts.map +1 -1
  107. package/dist/components/organisms/index.d.ts +10 -0
  108. package/dist/components/organisms/index.d.ts.map +1 -1
  109. package/dist/components/types/variants.d.ts +24 -1
  110. package/dist/components/types/variants.d.ts.map +1 -1
  111. package/dist/components/util/app-shell.d.ts +79 -0
  112. package/dist/components/util/app-shell.d.ts.map +1 -0
  113. package/dist/components/util/avatar.d.ts +39 -0
  114. package/dist/components/util/avatar.d.ts.map +1 -0
  115. package/dist/components/util/bottom-sheet.d.ts +30 -0
  116. package/dist/components/util/bottom-sheet.d.ts.map +1 -0
  117. package/dist/components/util/bottom-tab-bar.d.ts +41 -0
  118. package/dist/components/util/bottom-tab-bar.d.ts.map +1 -0
  119. package/dist/components/util/calendar.d.ts +56 -0
  120. package/dist/components/util/calendar.d.ts.map +1 -0
  121. package/dist/components/util/chart.d.ts +140 -0
  122. package/dist/components/util/chart.d.ts.map +1 -0
  123. package/dist/components/util/chip.d.ts +66 -0
  124. package/dist/components/util/chip.d.ts.map +1 -0
  125. package/dist/components/util/cn.d.ts.map +1 -1
  126. package/dist/components/util/code-field.d.ts +63 -0
  127. package/dist/components/util/code-field.d.ts.map +1 -0
  128. package/dist/components/util/collapsible.d.ts +64 -0
  129. package/dist/components/util/collapsible.d.ts.map +1 -0
  130. package/dist/components/util/confirm-dialog.d.ts +12 -0
  131. package/dist/components/util/confirm-dialog.d.ts.map +1 -0
  132. package/dist/components/util/date.d.ts +96 -0
  133. package/dist/components/util/date.d.ts.map +1 -0
  134. package/dist/components/util/display-voice.d.ts +10 -0
  135. package/dist/components/util/display-voice.d.ts.map +1 -0
  136. package/dist/components/util/drawer.d.ts +13 -0
  137. package/dist/components/util/drawer.d.ts.map +1 -0
  138. package/dist/components/util/dropdown.d.ts +47 -0
  139. package/dist/components/util/dropdown.d.ts.map +1 -0
  140. package/dist/components/util/field-control.d.ts +30 -0
  141. package/dist/components/util/field-control.d.ts.map +1 -0
  142. package/dist/components/util/field.d.ts +45 -0
  143. package/dist/components/util/field.d.ts.map +1 -0
  144. package/dist/components/util/fit-in-viewport.d.ts +201 -0
  145. package/dist/components/util/fit-in-viewport.d.ts.map +1 -0
  146. package/dist/components/util/focus-utils.d.ts +77 -2
  147. package/dist/components/util/focus-utils.d.ts.map +1 -1
  148. package/dist/components/util/hydration.d.ts +45 -0
  149. package/dist/components/util/hydration.d.ts.map +1 -0
  150. package/dist/components/util/keyboard-inset.d.ts +18 -0
  151. package/dist/components/util/keyboard-inset.d.ts.map +1 -0
  152. package/dist/components/util/map-view.d.ts +144 -0
  153. package/dist/components/util/map-view.d.ts.map +1 -0
  154. package/dist/components/util/media-grid.d.ts +51 -0
  155. package/dist/components/util/media-grid.d.ts.map +1 -0
  156. package/dist/components/util/media.d.ts +6 -0
  157. package/dist/components/util/media.d.ts.map +1 -0
  158. package/dist/components/util/overlay-chrome.d.ts +53 -0
  159. package/dist/components/util/overlay-chrome.d.ts.map +1 -0
  160. package/dist/components/util/overlay.d.ts +72 -0
  161. package/dist/components/util/overlay.d.ts.map +1 -0
  162. package/dist/components/util/photo.d.ts +234 -0
  163. package/dist/components/util/photo.d.ts.map +1 -0
  164. package/dist/components/util/portal.d.ts +23 -0
  165. package/dist/components/util/portal.d.ts.map +1 -0
  166. package/dist/components/util/progress.d.ts +19 -0
  167. package/dist/components/util/progress.d.ts.map +1 -0
  168. package/dist/components/util/pull-to-refresh.d.ts +27 -0
  169. package/dist/components/util/pull-to-refresh.d.ts.map +1 -0
  170. package/dist/components/util/radio-keys.d.ts +25 -0
  171. package/dist/components/util/radio-keys.d.ts.map +1 -0
  172. package/dist/components/util/rating.d.ts +23 -0
  173. package/dist/components/util/rating.d.ts.map +1 -0
  174. package/dist/components/util/ready-made-strings.d.ts +77 -0
  175. package/dist/components/util/ready-made-strings.d.ts.map +1 -0
  176. package/dist/components/util/scroll-edge.d.ts +33 -0
  177. package/dist/components/util/scroll-edge.d.ts.map +1 -0
  178. package/dist/components/util/scroll-padding.d.ts +20 -0
  179. package/dist/components/util/scroll-padding.d.ts.map +1 -0
  180. package/dist/components/util/segmented-control.d.ts +16 -0
  181. package/dist/components/util/segmented-control.d.ts.map +1 -0
  182. package/dist/components/util/select.d.ts +41 -0
  183. package/dist/components/util/select.d.ts.map +1 -0
  184. package/dist/components/util/sheet-drag.d.ts +84 -0
  185. package/dist/components/util/sheet-drag.d.ts.map +1 -0
  186. package/dist/components/util/sidebar.d.ts +63 -0
  187. package/dist/components/util/sidebar.d.ts.map +1 -0
  188. package/dist/components/util/skeleton.d.ts +15 -0
  189. package/dist/components/util/skeleton.d.ts.map +1 -0
  190. package/dist/components/util/sliding-indicator.d.ts +25 -0
  191. package/dist/components/util/sliding-indicator.d.ts.map +1 -0
  192. package/dist/components/util/sortable-list.d.ts +65 -0
  193. package/dist/components/util/sortable-list.d.ts.map +1 -0
  194. package/dist/components/util/stepper.d.ts +40 -0
  195. package/dist/components/util/stepper.d.ts.map +1 -0
  196. package/dist/components/util/swipeable-list-item.d.ts +36 -0
  197. package/dist/components/util/swipeable-list-item.d.ts.map +1 -0
  198. package/dist/components/util/temporal-field.d.ts +89 -0
  199. package/dist/components/util/temporal-field.d.ts.map +1 -0
  200. package/dist/components/util/theme-mode.d.ts +80 -0
  201. package/dist/components/util/theme-mode.d.ts.map +1 -0
  202. package/dist/components/util/toaster.d.ts +133 -0
  203. package/dist/components/util/toaster.d.ts.map +1 -0
  204. package/dist/components/util/tone-surface.d.ts +34 -0
  205. package/dist/components/util/tone-surface.d.ts.map +1 -0
  206. package/dist/components/util/tooltip.d.ts +10 -0
  207. package/dist/components/util/tooltip.d.ts.map +1 -0
  208. package/dist/components/util/top-navbar.d.ts +35 -0
  209. package/dist/components/util/top-navbar.d.ts.map +1 -0
  210. package/dist/components/util/touch-target.d.ts +31 -0
  211. package/dist/components/util/touch-target.d.ts.map +1 -0
  212. package/dist/components/util/zabi-strings.d.ts +142 -0
  213. package/dist/components/util/zabi-strings.d.ts.map +1 -0
  214. package/dist/create-theme/cli.js +173 -0
  215. package/dist/create-theme/index.d.ts +190 -0
  216. package/dist/create-theme/index.js +1034 -0
  217. package/dist/create-theme/lib/ramp-math.js +128 -0
  218. package/dist/create-theme/lib/resolve.js +238 -0
  219. package/dist/create-theme/theme-data.js +2644 -0
  220. package/dist/index.d.ts +104 -2
  221. package/dist/index.js +75 -2
  222. package/dist/map.d.ts +10 -0
  223. package/dist/map.js +9 -0
  224. package/dist/molecules/Alert.svelte +63 -16
  225. package/dist/molecules/Alert.svelte.d.ts +14 -1
  226. package/dist/molecules/AppBar.svelte +674 -0
  227. package/dist/molecules/AppBar.svelte.d.ts +131 -0
  228. package/dist/molecules/AvatarGroup.svelte +116 -0
  229. package/dist/molecules/AvatarGroup.svelte.d.ts +40 -0
  230. package/dist/molecules/BarChart.svelte +381 -0
  231. package/dist/molecules/BarChart.svelte.d.ts +45 -0
  232. package/dist/molecules/BottomSheet.svelte +608 -0
  233. package/dist/molecules/BottomSheet.svelte.d.ts +109 -0
  234. package/dist/molecules/BottomTabBar.svelte +403 -0
  235. package/dist/molecules/BottomTabBar.svelte.d.ts +98 -0
  236. package/dist/molecules/Calendar.svelte +597 -0
  237. package/dist/molecules/Calendar.svelte.d.ts +72 -0
  238. package/dist/molecules/ChipGroup.svelte +325 -0
  239. package/dist/molecules/ChipGroup.svelte.d.ts +41 -0
  240. package/dist/molecules/Collapsible.svelte +347 -0
  241. package/dist/molecules/Collapsible.svelte.d.ts +61 -0
  242. package/dist/molecules/CollapsibleGroup.svelte +136 -0
  243. package/dist/molecules/CollapsibleGroup.svelte.d.ts +14 -0
  244. package/dist/molecules/ComponentDemo.svelte +16 -4
  245. package/dist/molecules/ComponentDemo.svelte.d.ts +3 -0
  246. package/dist/molecules/ConfirmDialog.svelte +257 -0
  247. package/dist/molecules/ConfirmDialog.svelte.d.ts +58 -0
  248. package/dist/molecules/ContactForm.svelte +34 -17
  249. package/dist/molecules/ContactForm.svelte.d.ts +8 -0
  250. package/dist/molecules/Drawer.svelte +415 -0
  251. package/dist/molecules/Drawer.svelte.d.ts +55 -0
  252. package/dist/molecules/Dropdown.svelte +517 -48
  253. package/dist/molecules/Dropdown.svelte.d.ts +47 -6
  254. package/dist/molecules/DropdownItem.svelte +122 -0
  255. package/dist/molecules/DropdownItem.svelte.d.ts +28 -0
  256. package/dist/molecules/EmptyState.svelte +55 -10
  257. package/dist/molecules/EmptyState.svelte.d.ts +8 -0
  258. package/dist/molecules/FormField.svelte +9 -1
  259. package/dist/molecules/FormField.svelte.d.ts +2 -0
  260. package/dist/molecules/Header.svelte +1 -1
  261. package/dist/molecules/ImageUpload.svelte +492 -69
  262. package/dist/molecules/ImageUpload.svelte.d.ts +82 -2
  263. package/dist/molecules/LineChart.svelte +459 -0
  264. package/dist/molecules/LineChart.svelte.d.ts +53 -0
  265. package/dist/molecules/MapView.svelte +565 -0
  266. package/dist/molecules/MapView.svelte.d.ts +88 -0
  267. package/dist/molecules/MediaGrid.svelte +527 -0
  268. package/dist/molecules/MediaGrid.svelte.d.ts +77 -0
  269. package/dist/molecules/Modal.svelte +293 -72
  270. package/dist/molecules/Modal.svelte.d.ts +51 -2
  271. package/dist/molecules/NavigationMenuContent.svelte +58 -1
  272. package/dist/molecules/NavigationMenuItem.svelte +0 -1
  273. package/dist/molecules/NavigationMenuLink.svelte +1 -1
  274. package/dist/molecules/NavigationMenuList.svelte +10 -3
  275. package/dist/molecules/NavigationMenuTrigger.svelte +2 -2
  276. package/dist/molecules/Page.svelte +32 -2
  277. package/dist/molecules/Page.svelte.d.ts +11 -0
  278. package/dist/molecules/PhotoGrid.svelte +523 -0
  279. package/dist/molecules/PhotoGrid.svelte.d.ts +73 -0
  280. package/dist/molecules/PhotoViewer.svelte +1213 -0
  281. package/dist/molecules/PhotoViewer.svelte.d.ts +74 -0
  282. package/dist/molecules/PieChart.svelte +421 -0
  283. package/dist/molecules/PieChart.svelte.d.ts +51 -0
  284. package/dist/molecules/PropsTable.svelte +22 -10
  285. package/dist/molecules/PropsTable.svelte.d.ts +3 -0
  286. package/dist/molecules/PullToRefresh.svelte +263 -0
  287. package/dist/molecules/PullToRefresh.svelte.d.ts +52 -0
  288. package/dist/molecules/RadioGroup.svelte +72 -18
  289. package/dist/molecules/RadioGroup.svelte.d.ts +19 -3
  290. package/dist/molecules/Section.svelte +1 -1
  291. package/dist/molecules/SegmentedControl.svelte +456 -0
  292. package/dist/molecules/SegmentedControl.svelte.d.ts +40 -0
  293. package/dist/molecules/SidebarBrandHeader.svelte +11 -1
  294. package/dist/molecules/SidebarBrandHeader.svelte.d.ts +3 -0
  295. package/dist/molecules/SidebarFooter.svelte +30 -7
  296. package/dist/molecules/SidebarFooter.svelte.d.ts +3 -0
  297. package/dist/molecules/SidebarNavSection.svelte +1 -1
  298. package/dist/molecules/SlideUp.svelte +220 -61
  299. package/dist/molecules/SlideUp.svelte.d.ts +26 -0
  300. package/dist/molecules/SortableList.svelte +633 -0
  301. package/dist/molecules/SortableList.svelte.d.ts +69 -0
  302. package/dist/molecules/Stepper.svelte +562 -0
  303. package/dist/molecules/Stepper.svelte.d.ts +39 -0
  304. package/dist/molecules/StickyActionBar.svelte +250 -0
  305. package/dist/molecules/StickyActionBar.svelte.d.ts +78 -0
  306. package/dist/molecules/SwipeableListItem.svelte +334 -0
  307. package/dist/molecules/SwipeableListItem.svelte.d.ts +54 -0
  308. package/dist/molecules/Tabs.svelte +310 -9
  309. package/dist/molecules/Tabs.svelte.d.ts +7 -0
  310. package/dist/molecules/Toaster.svelte +514 -5
  311. package/dist/molecules/Toaster.svelte.d.ts +153 -2
  312. package/dist/molecules/ToasterToast.svelte +495 -77
  313. package/dist/molecules/ToasterToast.svelte.d.ts +15 -0
  314. package/dist/molecules/UnsavedChangesBar.svelte +223 -0
  315. package/dist/molecules/UnsavedChangesBar.svelte.d.ts +43 -0
  316. package/dist/molecules/index.d.ts +51 -0
  317. package/dist/molecules/index.js +31 -0
  318. package/dist/molecules/toast-store.d.ts +83 -7
  319. package/dist/molecules/toast-store.js +25 -1
  320. package/dist/organisms/AppNavigation.svelte +440 -0
  321. package/dist/organisms/AppNavigation.svelte.d.ts +72 -0
  322. package/dist/organisms/AppShell.svelte +696 -0
  323. package/dist/organisms/AppShell.svelte.d.ts +157 -0
  324. package/dist/organisms/AppShellHeaderPart.svelte +163 -0
  325. package/dist/organisms/AppShellHeaderPart.svelte.d.ts +57 -0
  326. package/dist/organisms/SidebarAccountPanel.svelte +107 -12
  327. package/dist/organisms/SidebarAccountPanel.svelte.d.ts +19 -0
  328. package/dist/organisms/SidebarNavigation.svelte +111 -43
  329. package/dist/organisms/SidebarNavigation.svelte.d.ts +29 -1
  330. package/dist/organisms/SidebarPanel.svelte +34 -17
  331. package/dist/organisms/SidebarPanel.svelte.d.ts +1 -0
  332. package/dist/organisms/SidebarShell.svelte +164 -14
  333. package/dist/organisms/SidebarShell.svelte.d.ts +56 -2
  334. package/dist/organisms/TopNavbar.svelte +353 -39
  335. package/dist/organisms/TopNavbar.svelte.d.ts +47 -0
  336. package/dist/organisms/TopNavbarSheetContent.svelte +145 -0
  337. package/dist/organisms/TopNavbarSheetContent.svelte.d.ts +24 -0
  338. package/dist/organisms/index.d.ts +10 -0
  339. package/dist/organisms/index.js +7 -0
  340. package/dist/types/components.d.ts +21 -1
  341. package/dist/types/components.d.ts.map +1 -1
  342. package/dist/types/index.d.ts +1093 -26
  343. package/dist/types/index.d.ts.map +1 -1
  344. package/dist/types/variants.ts +28 -1
  345. package/dist/util/app-shell.d.ts +78 -0
  346. package/dist/util/app-shell.js +97 -0
  347. package/dist/util/avatar.d.ts +38 -0
  348. package/dist/util/avatar.js +52 -0
  349. package/dist/util/bottom-sheet.d.ts +29 -0
  350. package/dist/util/bottom-sheet.js +43 -0
  351. package/dist/util/bottom-tab-bar.d.ts +40 -0
  352. package/dist/util/bottom-tab-bar.js +54 -0
  353. package/dist/util/calendar.d.ts +55 -0
  354. package/dist/util/calendar.js +74 -0
  355. package/dist/util/chart.d.ts +139 -0
  356. package/dist/util/chart.js +305 -0
  357. package/dist/util/chip.d.ts +65 -0
  358. package/dist/util/chip.js +58 -0
  359. package/dist/util/cn.js +28 -2
  360. package/dist/util/code-field.d.ts +62 -0
  361. package/dist/util/code-field.js +112 -0
  362. package/dist/util/collapsible.d.ts +63 -0
  363. package/dist/util/collapsible.js +23 -0
  364. package/dist/util/confirm-dialog.d.ts +11 -0
  365. package/dist/util/confirm-dialog.js +2 -0
  366. package/dist/util/date.d.ts +95 -0
  367. package/dist/util/date.js +237 -0
  368. package/dist/util/display-voice.d.ts +9 -0
  369. package/dist/util/display-voice.js +9 -0
  370. package/dist/util/drawer.d.ts +12 -0
  371. package/dist/util/drawer.js +7 -0
  372. package/dist/util/dropdown.d.ts +46 -0
  373. package/dist/util/dropdown.js +21 -0
  374. package/dist/util/field-control.d.ts +29 -0
  375. package/dist/util/field-control.js +32 -0
  376. package/dist/util/field.d.ts +44 -0
  377. package/dist/util/field.js +38 -0
  378. package/dist/util/fit-in-viewport.d.ts +200 -0
  379. package/dist/util/fit-in-viewport.js +399 -0
  380. package/dist/util/focus-utils.d.ts +77 -2
  381. package/dist/util/focus-utils.js +186 -9
  382. package/dist/util/hydration.d.ts +44 -0
  383. package/dist/util/hydration.js +58 -0
  384. package/dist/util/keyboard-inset.d.ts +17 -0
  385. package/dist/util/keyboard-inset.js +53 -0
  386. package/dist/util/map-view.d.ts +143 -0
  387. package/dist/util/map-view.js +121 -0
  388. package/dist/util/media-grid.d.ts +50 -0
  389. package/dist/util/media-grid.js +81 -0
  390. package/dist/util/media.d.ts +5 -0
  391. package/dist/util/media.js +10 -0
  392. package/dist/util/overlay-chrome.d.ts +52 -0
  393. package/dist/util/overlay-chrome.js +56 -0
  394. package/dist/util/overlay.d.ts +71 -0
  395. package/dist/util/overlay.js +240 -0
  396. package/dist/util/photo.d.ts +233 -0
  397. package/dist/util/photo.js +209 -0
  398. package/dist/util/portal.d.ts +22 -0
  399. package/dist/util/portal.js +50 -0
  400. package/dist/util/progress.d.ts +18 -0
  401. package/dist/util/progress.js +17 -0
  402. package/dist/util/pull-to-refresh.d.ts +26 -0
  403. package/dist/util/pull-to-refresh.js +30 -0
  404. package/dist/util/radio-keys.d.ts +24 -0
  405. package/dist/util/radio-keys.js +49 -0
  406. package/dist/util/rating.d.ts +22 -0
  407. package/dist/util/rating.js +26 -0
  408. package/dist/util/ready-made-strings.d.ts +76 -0
  409. package/dist/util/ready-made-strings.js +67 -0
  410. package/dist/util/scroll-edge.d.ts +32 -0
  411. package/dist/util/scroll-edge.js +87 -0
  412. package/dist/util/scroll-padding.d.ts +19 -0
  413. package/dist/util/scroll-padding.js +44 -0
  414. package/dist/util/segmented-control.d.ts +15 -0
  415. package/dist/util/segmented-control.js +1 -0
  416. package/dist/util/select.d.ts +40 -0
  417. package/dist/util/select.js +63 -0
  418. package/dist/util/sheet-drag.d.ts +83 -0
  419. package/dist/util/sheet-drag.js +311 -0
  420. package/dist/util/sidebar.d.ts +62 -0
  421. package/dist/util/sidebar.js +38 -0
  422. package/dist/util/skeleton.d.ts +14 -0
  423. package/dist/util/skeleton.js +22 -0
  424. package/dist/util/sliding-indicator.d.ts +24 -0
  425. package/dist/util/sliding-indicator.js +44 -0
  426. package/dist/util/sortable-list.d.ts +64 -0
  427. package/dist/util/sortable-list.js +53 -0
  428. package/dist/util/stepper.d.ts +39 -0
  429. package/dist/util/stepper.js +38 -0
  430. package/dist/util/swipeable-list-item.d.ts +35 -0
  431. package/dist/util/swipeable-list-item.js +32 -0
  432. package/dist/util/temporal-field.d.ts +88 -0
  433. package/dist/util/temporal-field.js +136 -0
  434. package/dist/util/theme-mode.d.ts +79 -0
  435. package/dist/util/theme-mode.js +121 -0
  436. package/dist/util/toaster.d.ts +132 -0
  437. package/dist/util/toaster.js +130 -0
  438. package/dist/util/tone-surface.d.ts +33 -0
  439. package/dist/util/tone-surface.js +35 -0
  440. package/dist/util/tooltip.d.ts +9 -0
  441. package/dist/util/tooltip.js +18 -0
  442. package/dist/util/top-navbar.d.ts +34 -0
  443. package/dist/util/top-navbar.js +28 -0
  444. package/dist/util/touch-target.d.ts +30 -0
  445. package/dist/util/touch-target.js +30 -0
  446. package/dist/util/zabi-strings.d.ts +141 -0
  447. package/dist/util/zabi-strings.js +105 -0
  448. package/dist/zabi-components-colors.css +11 -2
  449. package/dist/zabi-components-theme-dark-only.css +870 -258
  450. package/dist/zabi-components-theme-dark.css +870 -258
  451. package/dist/zabi-components-theme-only.css +2419 -368
  452. package/dist/zabi-components-theme.css +2419 -368
  453. package/dist/zabi-components.css +6032 -711
  454. package/docs/lucide-icons.md +40 -17
  455. package/docs/theme-imports.md +81 -11
  456. package/package.json +45 -8
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Calendar dates as strings: `YYYY-MM-DD` for a day, `YYYY-MM` for a month,
3
+ * `HH:mm` (or `HH:mm:ss`) for a time of day. The formats a native date or
4
+ * time input reads and writes.
5
+ *
6
+ * A date here is a day on the calendar, not a moment. Nothing in this file
7
+ * goes through a local `Date`: the arithmetic is on the numbers, or on UTC,
8
+ * where every day has 24 hours. So a date never moves to the day before or
9
+ * after because of a time zone, and a day on which the clocks change is a day
10
+ * like any other.
11
+ *
12
+ * Years 0001 to 9999, four digits: within that, two dates compare as strings.
13
+ */
14
+ export interface DateParts {
15
+ year: number;
16
+ /** 1 to 12. */
17
+ month: number;
18
+ day: number;
19
+ }
20
+ export declare function isLeapYear(year: number): boolean;
21
+ /** Days in a month; `month` is 1 to 12. */
22
+ export declare function daysInMonth(year: number, month: number): number;
23
+ /** The parts of a `YYYY-MM-DD` string, or null when it is not a real date. */
24
+ export declare function parseIsoDate(value: string | null | undefined): DateParts | null;
25
+ export declare function isIsoDate(value: string | null | undefined): value is string;
26
+ /** The parts of a `YYYY-MM` string, or null when it is not a real month. */
27
+ export declare function parseIsoMonth(value: string | null | undefined): {
28
+ year: number;
29
+ month: number;
30
+ } | null;
31
+ export declare function toIsoDate(year: number, month: number, day: number): string;
32
+ export declare function toIsoMonth(year: number, month: number): string;
33
+ /** The month a date is in: `2026-10-06` gives `2026-10`. Null for a string that is not a date. */
34
+ export declare function monthOf(date: string | null | undefined): string | null;
35
+ /** The date `count` days later (earlier when negative), or null outside years 1 to 9999. */
36
+ export declare function addDays(date: string, count: number): string | null;
37
+ /** The month `count` months later (earlier when negative), or null outside years 1 to 9999. */
38
+ export declare function addMonthsToMonth(month: string, count: number): string | null;
39
+ /**
40
+ * The same day of the month `count` months later. A day the target month does
41
+ * not have becomes its last one: 31 January plus a month is 28 or 29 February.
42
+ */
43
+ export declare function addMonths(date: string, count: number): string | null;
44
+ /** Day of the week, 0 for Sunday to 6 for Saturday. -1 for a string that is not a date. */
45
+ export declare function weekdayOf(date: string): number;
46
+ /** A whole number from 0 to 6 for the first day of the week; anything else is Monday. */
47
+ export declare function normaliseWeekStart(weekStartsOn: number | undefined): number;
48
+ /** The first day of the week a date is in. */
49
+ export declare function startOfWeek(date: string, weekStartsOn?: number): string | null;
50
+ /** The last day of the week a date is in. */
51
+ export declare function endOfWeek(date: string, weekStartsOn?: number): string | null;
52
+ /**
53
+ * The weeks of a month, each seven entries from the first day of the week. A
54
+ * day of the month is its ISO date; a place before the 1st or after the last
55
+ * day is null. There are as many weeks as the month touches: four (a
56
+ * 28-day February that starts on the first day of the week), five or six.
57
+ */
58
+ export declare function monthGrid(month: string, weekStartsOn?: number): (string | null)[][];
59
+ /** The seven days of the week as numbers (0 for Sunday), from the first day of the week. */
60
+ export declare function weekdayOrder(weekStartsOn?: number): number[];
61
+ /**
62
+ * Today where the user is, as `YYYY-MM-DD`. This is the one place that reads
63
+ * the local clock: "today" is a local idea. Call it in the browser; on a
64
+ * server it is the server's day.
65
+ */
66
+ export declare function todayIso(now?: Date): string;
67
+ /** Today in UTC: the same on a server and in a browser at the same moment. */
68
+ export declare function todayIsoUtc(now?: Date): string;
69
+ /** A date held between `min` and `max`, either of which may be missing or invalid. */
70
+ export declare function clampDate(date: string, min?: string | null, max?: string | null): string;
71
+ /**
72
+ * A date for reading: `formatDate("2026-10-06", "sv")` is "6 okt. 2026",
73
+ * `formatDate("2026-10-06", "en-GB")` is "6 Oct 2026".
74
+ *
75
+ * `value` is `YYYY-MM-DD`, what a DateField holds. The day shown is always
76
+ * the day in the string: it does not depend on the time zone of the browser
77
+ * or the server. An empty or invalid value gives an empty string.
78
+ *
79
+ * Pass the `locale` of the page. Without it the runtime's own is used, which
80
+ * on a server is the server's and may differ from the reader's, so text
81
+ * rendered on the server and again in the browser may not match.
82
+ *
83
+ * `options` are those of `Intl.DateTimeFormat`; `timeZone` is not one you can
84
+ * set here.
85
+ */
86
+ export declare function formatDate(value: string | null | undefined, locale?: string | string[], options?: Intl.DateTimeFormatOptions): string;
87
+ /**
88
+ * A time of day for reading: `formatTime("19:00", "sv")` is "19:00",
89
+ * `formatTime("19:00", "en-US")` is "7:00 PM".
90
+ *
91
+ * `value` is `HH:mm` or `HH:mm:ss`, what a TimeField holds. It is a time on
92
+ * the clock, with no zone: nothing shifts it. An empty or invalid value gives
93
+ * an empty string. `locale` and `options` as for `formatDate`.
94
+ */
95
+ export declare function formatTime(value: string | null | undefined, locale?: string | string[], options?: Intl.DateTimeFormatOptions): string;
96
+ //# sourceMappingURL=date.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/components/util/date.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACf;AAID,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,2CAA2C;AAC3C,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,CAQ/E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,M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,YAAY,SAAI,GAAG,MAAM,GAAG,IAAI,CAGvE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,SAAI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,EAAE,CAY9E;AAED,4FAA4F;AAC5F,wBAAgB,YAAY,CAAC,YAAY,SAAI,GAAG,MAAM,EAAE,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,GAAE,IAAiB,GAAG,MAAM,CAEvD;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,GAAG,GAAE,IAAiB,GAAG,MAAM,CAE1D;AAED,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAIxF;AAmBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,GAAE,IAAI,CAAC,qBAA2E,GAC1F,MAAM,CAIR;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAE1B,OAAO,GAAE,IAAI,CAAC,qBAA8C,GAC7D,MAAM,CASR"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The display voice: the weight and tracking of a figure or a display line.
3
+ * Both are read from custom properties that are declared nowhere, so any
4
+ * ancestor can set them (`--zabi-display-weight: 400` for a light serif) and
5
+ * the defaults are what the display face looked like before. The `number:`
6
+ * hint is what makes Tailwind read the weight as a weight and not a family.
7
+ * Heading `variant="display"` and Stat share this string.
8
+ */
9
+ export declare const displayVoice = "font-[number:var(--zabi-display-weight,700)] tracking-[var(--zabi-display-tracking,-0.02em)]";
10
+ //# sourceMappingURL=display-voice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display-voice.d.ts","sourceRoot":"","sources":["../../../src/components/util/display-voice.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,iGACyE,CAAC"}
@@ -0,0 +1,13 @@
1
+ /** Public types and pure helpers for `Drawer`. */
2
+ /**
3
+ * The edge the drawer is anchored to. `left` and `right` are physical and stay
4
+ * put in a right-to-left page; `start` and `end` follow the writing direction.
5
+ */
6
+ export type DrawerSide = "left" | "right" | "start" | "end";
7
+ /** Panel width on wide screens. On a phone the panel is never wider than the screen. */
8
+ export type DrawerSize = "sm" | "md" | "lg";
9
+ /** What the user did to close the drawer. The same values Modal reports. */
10
+ export type DrawerCloseReason = "escape" | "backdrop" | "close-button";
11
+ /** The physical edge a side resolves to, given the writing direction. */
12
+ export declare function resolveDrawerEdge(side: DrawerSide, rtl: boolean): "left" | "right";
13
+ //# sourceMappingURL=drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/util/drawer.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAElD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AAE5D,wFAAwF;AACxF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,UAAU,GAAG,cAAc,CAAC;AAEvE,yEAAyE;AACzE,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,OAAO,GACb,MAAM,GAAG,OAAO,CAGlB"}
@@ -0,0 +1,47 @@
1
+ import type { Component } from "svelte";
2
+ /** An icon component, as `@lucide/svelte` icons are. */
3
+ export type DropdownItemIcon = Component<{
4
+ size?: number;
5
+ class?: string;
6
+ }>;
7
+ export type DropdownItemTone = "default" | "danger";
8
+ /** One entry of Dropdown's `options`. */
9
+ export interface DropdownOption {
10
+ value: string | number;
11
+ label: string;
12
+ /**
13
+ * A disabled item stays focusable, so the arrow keys still reach it and a
14
+ * screen reader can read why it is unavailable; it cannot be chosen.
15
+ */
16
+ disabled?: boolean;
17
+ /** Rendered before the label, at 16px. Decorative: the label names the item. */
18
+ icon?: DropdownItemIcon;
19
+ /** `danger` for a destructive action such as Delete. */
20
+ tone?: DropdownItemTone;
21
+ /** Second line under the label, e.g. why the item is disabled. */
22
+ description?: string;
23
+ }
24
+ /**
25
+ * How a Dropdown's menu is shown: `popover` under its trigger, `sheet` in a
26
+ * BottomSheet, or `auto`: a sheet on a phone, the pop-over everywhere else.
27
+ */
28
+ export type DropdownPresentation = "auto" | "popover" | "sheet";
29
+ /**
30
+ * A phone, for `auto`: a touch screen (`pointer: coarse`) narrower than the
31
+ * `sm` breakpoint. A tablet has the room for a pop-over under its trigger,
32
+ * and a narrow window with a mouse has the precision for one.
33
+ */
34
+ export declare const SHEET_MEDIA_QUERY = "(pointer: coarse) and (max-width: 639.98px)";
35
+ /**
36
+ * Whether a menu asked for as `presentation` opens in a sheet right now.
37
+ * Read when the menu opens, in the browser: on the server it is never a sheet,
38
+ * so what is rendered before anyone touches the control is the same everywhere.
39
+ */
40
+ export declare function opensAsSheet(presentation: DropdownPresentation): boolean;
41
+ /** What a Dropdown tells the items inside it. */
42
+ export interface DropdownContext {
43
+ /** `option` inside a listbox, `menuitem` inside a menu. */
44
+ readonly itemRole: "menuitem" | "option";
45
+ }
46
+ export declare const DROPDOWN_CONTEXT_KEY: unique symbol;
47
+ //# sourceMappingURL=dropdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/util/dropdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,wDAAwD;AACxD,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE5E,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpD,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gFAAgF;IAChF,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,wDAAwD;IACxD,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,gDAAgD,CAAC;AAE/E;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,oBAAoB,GAAG,OAAO,CAQxE;AAED,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,UAAU,GAAG,QAAQ,CAAC;CAC5C;AAED,eAAO,MAAM,oBAAoB,eAAqB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The look of a field-shaped control's box: Select's trigger and native select
3
+ * and PickerField draw it from here, so a picker beside a Select is the same
4
+ * box. Kept in one place so they cannot drift.
5
+ */
6
+ export type FieldControlSize = "sm" | "md" | "lg";
7
+ export interface FieldControlSizeClasses {
8
+ /** The trigger's box: a minimum height, so a label that wraps makes it taller. */
9
+ box: string;
10
+ /** The text size: 16px below `sm`, as Input. */
11
+ text: string;
12
+ /** The same box for a native `<select>`, which is always one line. */
13
+ native: string;
14
+ /** Where the trailing chevron sits. */
15
+ chevron: string;
16
+ }
17
+ /**
18
+ * Same fixed height scale as Button, IconButton and Input (32 / 40 / 48), and
19
+ * the same 16px text below `sm`. One line is exactly 32, 40 or 48px: the
20
+ * padding leaves room for the line and the border inside it, and is a step
21
+ * smaller below `sm`, where the text is 16px on a 24px line.
22
+ */
23
+ export declare function fieldControlSize(size: FieldControlSize): FieldControlSizeClasses;
24
+ /** The edge colour for a status: the field's own, or the status colour. */
25
+ export declare function fieldControlEdge(variant: string): string;
26
+ /** The field's surface, edge and states. */
27
+ export declare const FIELD_CONTROL_SURFACE = "focus-ring w-full min-w-0 cursor-pointer rounded-control border bg-input text-body transition-colors duration-(--duration-base) hover:bg-input-hover active:bg-input-active focus-visible:bg-input-focus focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:bg-input-disabled disabled:text-action-disabled-text";
28
+ /** What the trigger adds to the surface: one row, text and chevron apart. */
29
+ export declare const FIELD_CONTROL_TRIGGER = "focus-ring w-full min-w-0 cursor-pointer rounded-control border bg-input text-body transition-colors duration-(--duration-base) hover:bg-input-hover active:bg-input-active focus-visible:bg-input-focus focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:bg-input-disabled disabled:text-action-disabled-text flex items-center justify-between gap-2";
30
+ //# sourceMappingURL=field-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-control.d.ts","sourceRoot":"","sources":["../../../src/components/util/field-control.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,MAAM,WAAW,uBAAuB;IACpC,kFAAkF;IAClF,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,uBAAuB,CAIhF;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQxD;AAED,4CAA4C;AAC5C,eAAO,MAAM,qBAAqB,qVACoT,CAAC;AAEvV,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,6XAAqE,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * What Input, Textarea and Select share about the text under a field, and
3
+ * DateField and TimeField through Input. Kept in one place so the four cannot
4
+ * drift: which message shows, in which variant, and what the control is
5
+ * described by.
6
+ */
7
+ import type { SemanticVariant } from "../types/variants.js";
8
+ export interface FieldMessageInput {
9
+ variant?: SemanticVariant;
10
+ message?: string;
11
+ hint?: string;
12
+ error?: string;
13
+ }
14
+ export interface FieldMessageState {
15
+ /** The variant the control is drawn in: `error` whenever there is an error. */
16
+ variant: SemanticVariant;
17
+ /** The text of the status message: the error, or else `message`. */
18
+ message: string;
19
+ /** Whether the status message is rendered. A `message` without a variant is not. */
20
+ showMessage: boolean;
21
+ /** Whether the hint is rendered. */
22
+ showHint: boolean;
23
+ }
24
+ /**
25
+ * `error` wins over `variant` and `message`: it sets the error variant and is
26
+ * the message. Without it, `message` shows in a `success`, `warning` or
27
+ * `error` variant, as it always has, and not in `default`: text for a field
28
+ * that is neither is a `hint`.
29
+ */
30
+ export declare function fieldMessageState({ variant, message, hint, error, }: FieldMessageInput): FieldMessageState;
31
+ export declare const fieldHintId: (fieldId: string) => string;
32
+ export declare const fieldMessageId: (fieldId: string) => string;
33
+ /**
34
+ * The ids a control is described by: the caller's own (a FormField around the
35
+ * field, say), then the hint, then the status message. Only ids of elements
36
+ * that are rendered; `undefined` when there are none, so no empty attribute.
37
+ */
38
+ export declare function fieldDescribedBy(fieldId: string, state: Pick<FieldMessageState, "showMessage" | "showHint">, own?: string | null): string | undefined;
39
+ /** What Textarea's `countText` is given: the characters typed, the limit, and how many are left. */
40
+ export interface TextareaCount {
41
+ length: number;
42
+ max: number;
43
+ remaining: number;
44
+ }
45
+ //# sourceMappingURL=field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/components/util/field.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,iBAAiB;IAC9B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAC9B,+EAA+E;IAC/E,OAAO,EAAE,eAAe,CAAC;IACzB,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,WAAW,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAC9B,OAAmB,EACnB,OAAY,EACZ,IAAS,EACT,KAAU,GACb,EAAE,iBAAiB,GAAG,iBAAiB,CASvC;AAED,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,WAAsB,CAAC;AAClE,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,WAAyB,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,UAAU,CAAC,EAC1D,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,MAAM,GAAG,SAAS,CAUpB;AAED,oGAAoG;AACpG,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Keeps a floating box (a menu, a panel, a tooltip) where it can be seen.
3
+ *
4
+ * One module for everything that opens next to a trigger. Two layers:
5
+ *
6
+ * - `pickSide` and `shiftIntoViewport` are the two decisions every such box
7
+ * needs: which side of its trigger it opens on, and how far it has to move
8
+ * along that side to stay on screen. Tooltip uses them as they are.
9
+ * - `fitPanel` builds on them for a panel that hangs from one edge of its
10
+ * anchor (Dropdown, Select's list, NavigationMenuContent): it also narrows
11
+ * and shortens a panel too large for the screen. `measurePlacement` reads
12
+ * the layout for it, and `watchViewport` re-runs it while the panel is open.
13
+ *
14
+ * The arithmetic is pure, so it can be tested without a layout.
15
+ *
16
+ * The screen is not the only thing that cuts a panel off. Inside a box that
17
+ * scrolls (a Modal's body, a list with its own scrollbar) the box clips it
18
+ * first. `measurePlacement` takes the nearest such box into account: it
19
+ * decides which side the panel opens on, and when the panel fits on neither
20
+ * side it says where to put the panel with `position: fixed`, which a
21
+ * scrolling ancestor does not clip.
22
+ */
23
+ export type PanelBlock = "bottom" | "top";
24
+ export type PanelInline = "start" | "end";
25
+ export interface PanelBox {
26
+ left: number;
27
+ right: number;
28
+ top: number;
29
+ bottom: number;
30
+ }
31
+ export interface FitPanelInput {
32
+ /** The box the panel is positioned against, in viewport coordinates. */
33
+ anchor: PanelBox;
34
+ /** The panel's natural size, measured with no limit on it. */
35
+ panel: {
36
+ width: number;
37
+ height: number;
38
+ };
39
+ viewport: {
40
+ width: number;
41
+ height: number;
42
+ };
43
+ /** The side asked for. It is kept whenever the panel fits there. */
44
+ block: PanelBlock;
45
+ inline: PanelInline;
46
+ /** Right-to-left layout: `start` is then the right edge. */
47
+ rtl?: boolean;
48
+ /** Room kept between the panel and every edge of the viewport. */
49
+ margin?: number;
50
+ /** Distance between the anchor and the panel. */
51
+ gap?: number;
52
+ /** False keeps the panel on the `block` side asked for, whatever fits. */
53
+ flipBlock?: boolean;
54
+ /** False keeps it on the `inline` edge asked for and slides it back inside instead. */
55
+ flipInline?: boolean;
56
+ /**
57
+ * The inside of the nearest ancestor that clips, in viewport coordinates.
58
+ * It decides which side the panel opens on and how far it slides; it
59
+ * never limits the panel's size, which only the viewport does.
60
+ */
61
+ clip?: PanelBox | null;
62
+ }
63
+ export interface PanelFit {
64
+ block: PanelBlock;
65
+ inline: PanelInline;
66
+ /**
67
+ * Distance to put between the anchor's `inline` edge and the panel's, for
68
+ * `inset-inline-start` or `inset-inline-end`. 0 when the panel fits as it
69
+ * is; otherwise what slides it back inside.
70
+ */
71
+ inlineOffset: number;
72
+ /** A limit to set, or null when the panel fits without one. */
73
+ maxWidth: number | null;
74
+ maxHeight: number | null;
75
+ /** Where the panel's box ends up, in viewport coordinates, and how wide it is there. */
76
+ left: number;
77
+ top: number;
78
+ width: number;
79
+ /** False when part of the panel is outside `clip` (or the viewport) even so. */
80
+ visible: boolean;
81
+ }
82
+ export type FloatingSide = "top" | "bottom" | "left" | "right";
83
+ /**
84
+ * The side a floating box of `size` opens on: the preferred one when it fits
85
+ * there, the opposite one when only that fits, and otherwise whichever of the
86
+ * two has more room.
87
+ *
88
+ * `gap` is the distance between trigger and box; `margin` is how close to the
89
+ * viewport edge the box may come. `clip` is the inside of an ancestor that
90
+ * cuts the box off, when there is one: the box then has to fit in what both
91
+ * leave.
92
+ */
93
+ export declare function pickSide(preferred: FloatingSide, trigger: PanelBox, size: {
94
+ width: number;
95
+ height: number;
96
+ }, viewport: {
97
+ width: number;
98
+ height: number;
99
+ }, { gap, margin, clip, }?: {
100
+ gap?: number;
101
+ margin?: number;
102
+ clip?: PanelBox | null;
103
+ }): FloatingSide;
104
+ /**
105
+ * How far `box` has to move, in px, to lie inside the viewport with `margin`
106
+ * to spare. Zero on an axis where it already does. A box larger than the
107
+ * viewport is aligned to the start edge (top, left), where its text begins.
108
+ */
109
+ export declare function shiftIntoViewport(box: PanelBox, viewport: {
110
+ width: number;
111
+ height: number;
112
+ }, margin?: number): {
113
+ x: number;
114
+ y: number;
115
+ };
116
+ export interface ViewportPoint {
117
+ x: number;
118
+ y: number;
119
+ }
120
+ /**
121
+ * True when `point` lies in the triangle `a`, `b`, `c`, edges included. For
122
+ * the path a pointer takes from a trigger to its floating box: as long as it
123
+ * stays in the triangle between where it left and the near edge of the box,
124
+ * it is on its way there.
125
+ */
126
+ export declare function insideTriangle(point: ViewportPoint, a: ViewportPoint, b: ViewportPoint, c: ViewportPoint): boolean;
127
+ /** Where the panel fits, starting from the side asked for. */
128
+ export declare function fitPanel(input: FitPanelInput): PanelFit;
129
+ /** A fit that changes nothing: the panel where the CSS puts it, with no limits. */
130
+ export declare function unfitted(block: PanelBlock, inline: PanelInline): PanelFit;
131
+ export interface MeasureOptions {
132
+ margin?: number;
133
+ gap?: number;
134
+ flipBlock?: boolean;
135
+ flipInline?: boolean;
136
+ /** Overrides the anchor's own direction; `false` for a panel placed with `left`, not `inset-inline-start`. */
137
+ rtl?: boolean;
138
+ clip?: PanelBox | null;
139
+ }
140
+ /**
141
+ * Measures `panel` against `anchor` and returns its fit. Any limit already on
142
+ * the panel is lifted for the measurement, so the answer does not depend on
143
+ * the previous one. Call it before paint (from an effect) and apply the result.
144
+ */
145
+ export declare function measureFit(anchor: Element, panel: HTMLElement, preferred: {
146
+ block: PanelBlock;
147
+ inline: PanelInline;
148
+ }, options?: MeasureOptions): PanelFit;
149
+ /**
150
+ * The nearest ancestor of `element` that clips what reaches outside it (any
151
+ * `overflow` but `visible`), with the box it clips to: its inside, without
152
+ * borders or scrollbars, in viewport coordinates. Null when only the viewport
153
+ * clips.
154
+ */
155
+ export declare function clippingAncestor(element: Element): {
156
+ element: HTMLElement;
157
+ box: PanelBox;
158
+ } | null;
159
+ export interface PanelPlacement extends PanelFit {
160
+ /**
161
+ * Set when the panel has to leave a clipping ancestor to be seen: the
162
+ * `top`, `left` and `width` to give it with `position: fixed`. Null when
163
+ * it stays where the CSS puts it.
164
+ *
165
+ * The width is the one the panel has where the CSS puts it. A fixed box
166
+ * is sized against the viewport instead of the anchor, so without it the
167
+ * panel would change width as it leaves the box.
168
+ */
169
+ fixed: {
170
+ left: number;
171
+ top: number;
172
+ width: number;
173
+ } | null;
174
+ }
175
+ /**
176
+ * The fit of `panel`, with the nearest clipping ancestor of `anchor` taken
177
+ * into account.
178
+ *
179
+ * - The panel fits inside that ancestor on the side asked for: nothing changes.
180
+ * - It fits on the other side: it opens there.
181
+ * - It fits on neither: it is placed against the viewport with `fixed`, on the
182
+ * side the viewport has room for, and reaches out of the ancestor. Only
183
+ * while some of the anchor can be seen in the ancestor: scrolled out of it,
184
+ * the anchor takes the panel with it.
185
+ * - It cannot be: something between the panel and that ancestor is the
186
+ * containing block of fixed descendants (a `transform`, a `filter`). It then
187
+ * opens on the side of the ancestor with more room, and is cut where that
188
+ * ends. That is the limit of what a panel can do without leaving its place
189
+ * in the DOM, and it stays there so that the keyboard, focus and a dialog's
190
+ * focus trap treat it as part of what opened it.
191
+ */
192
+ export declare function measurePlacement(anchor: Element, panel: HTMLElement, preferred: {
193
+ block: PanelBlock;
194
+ inline: PanelInline;
195
+ }, options?: MeasureOptions): PanelPlacement;
196
+ /**
197
+ * Calls `update` when the viewport changes size or anything outside `panel`
198
+ * scrolls, at most once a frame. Returns the function that stops it.
199
+ */
200
+ export declare function watchViewport(update: () => void, panel?: Element | null): () => void;
201
+ //# sourceMappingURL=fit-in-viewport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fit-in-viewport.d.ts","sourceRoot":"","sources":["../../../src/components/util/fit-in-viewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC;AAC1C,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1C,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,E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OAAO,CAAC;IACrB,8GAA8G;IAC9G,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC1B;AAmBD;;;;GAIG;AACH,wBAAgB,UAAU,CACtB,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,EACrD,OAAO,GAAE,cAAmB,GAC7B,QAAQ,CAyCV;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,OAAO,GACjB;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,GAAG,IAAI,CAsBhD;AA8CD,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC5C;;;;;;;;OAQG;IACH,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC9D;AAkBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,EACrD,OAAO,GAAE,cAAmB,GAC7B,cAAc,CA4BhB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,IAAI,CAsBpF"}
@@ -2,11 +2,86 @@
2
2
  /** From `app.css` `@layer components` — import the library/app stylesheet. */
3
3
  export declare const FOCUS_BRAND_CLASS = "focus-brand";
4
4
  export declare const FOCUS_NAV_CLASS = "focus-nav";
5
+ /** Every dialog panel: `dialog` and `alertdialog` are both dialogs to a focus trap. */
6
+ export declare const DIALOG_SELECTOR = "[role=\"dialog\"], [role=\"alertdialog\"]";
5
7
  export declare function getFocusableElements(container: HTMLElement): HTMLElement[];
8
+ /** The region a `Toaster` renders its toasts in. */
9
+ export declare const TOAST_REGION_SELECTOR = "[data-zabi-toaster]";
10
+ /**
11
+ * Whether an event's target is in a toast. A toast is drawn over whatever is
12
+ * open, and a press on it is for the toast (to hold it, read it, dismiss it):
13
+ * a menu or a panel that closes on a press outside itself asks this first,
14
+ * and leaves a press on a toast alone.
15
+ */
16
+ export declare function isInsideToastRegion(target: unknown): boolean;
17
+ /**
18
+ * The controls of the toasts on screen. A toast is drawn over a modal
19
+ * overlay and can cover its buttons, so a focus trap that kept the keyboard
20
+ * out of it would leave no way to dismiss it: the trap takes these in, after
21
+ * the overlay's own controls.
22
+ */
23
+ export declare function getToastFocusables(): HTMLElement[];
24
+ /**
25
+ * One step of the Tab cycle of a modal overlay: through the controls of
26
+ * `container`, then through the toasts on screen, and round again. Focusables
27
+ * are looked up on every Tab, so what is added while the overlay is open is
28
+ * in the cycle. Focus that is nowhere in it goes to the first control.
29
+ */
30
+ export declare function cycleTrappedFocus(container: HTMLElement, event: KeyboardEvent): void;
6
31
  /** Tab wraps first↔last inside `container`. Caller should pair with `saveFocus` / `returnFocus`. */
7
32
  export declare function trapFocus(container: HTMLElement): () => void;
8
33
  export declare function saveFocus(): void;
9
- /** Restores focus from the last `saveFocus`. Skips disconnected or unfocusable nodes. */
34
+ /**
35
+ * Restores focus from the last `saveFocus`. If that element has left the
36
+ * document, the element that now has its id takes the focus instead (a
37
+ * dropzone swapped for its Change button, say); with neither, nothing happens.
38
+ */
10
39
  export declare function returnFocus(): void;
11
- export declare function focusFirstElement(container: HTMLElement): void;
40
+ /**
41
+ * Moves focus into an overlay: to its first focusable element, or to the
42
+ * container itself when it has none (give the container `tabindex="-1"`), so
43
+ * focus never stays on the opener behind the backdrop.
44
+ *
45
+ * `preferred` is a CSS selector, looked up inside the container: the matching
46
+ * control takes focus instead of the first one, if it can take focus.
47
+ */
48
+ export declare function focusFirstElement(container: HTMLElement, preferred?: string): void;
49
+ /**
50
+ * Joins the stack of open modal overlays (Modal, SlideUp, a drawer).
51
+ *
52
+ * Every overlay shares one z-index, so without this the paint order is the
53
+ * DOM order, and an overlay opened later but placed earlier in the document
54
+ * opens behind the first. `depth` is 0 for the first overlay and one more than
55
+ * the highest open one after that: put it on the overlay root as
56
+ * `z-index: calc(var(--z-modal) + depth)`.
57
+ *
58
+ * `panel` is the element with the dialog role. Call this when the overlay
59
+ * opens, in the browser, and `leave()` when it closes.
60
+ */
61
+ export declare function joinOverlayStack(panel: HTMLElement): {
62
+ depth: number;
63
+ leave: () => void;
64
+ };
65
+ /** Whether `panel` is the overlay on top of the stack: the one opened last. */
66
+ export declare function isTopOverlay(panel: HTMLElement): boolean;
67
+ /**
68
+ * Keeps a modal overlay in charge of the keyboard when focus has left it
69
+ * without a Tab: the focused control was disabled or removed and the browser
70
+ * dropped focus on `<body>`, where the overlay's own key handlers never hear
71
+ * the key, and Tab would walk the page behind it.
72
+ *
73
+ * While installed, a Tab pressed with focus outside every dialog moves focus
74
+ * to the first focusable element of `container` (or to `container` itself),
75
+ * and Escape calls `onEscape`. Only the overlay on top of the stack acts (the
76
+ * one opened last), so every open overlay can install its own. An overlay that
77
+ * has not called `joinOverlayStack` is added to the stack for as long as the
78
+ * recovery is installed.
79
+ *
80
+ * `container` is the panel with `role="dialog"` or `"alertdialog"` and
81
+ * `aria-modal="true"`. Call it when the overlay opens, in the browser, and call
82
+ * the returned function when it closes.
83
+ */
84
+ export declare function recoverStrayFocus(container: HTMLElement, options?: {
85
+ onEscape?: (event: KeyboardEvent) => void;
86
+ }): () => void;
12
87
  //# sourceMappingURL=focus-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"focus-utils.d.ts","sourceRoot":"","sources":["../../../src/components/util/focus-utils.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAE1F,8EAA8E;AAC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AAiB,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAMlF;AAKD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,IAAI,CAAC;CACrB,CAWA;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAExD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAC7B,SAAS,EAAE,WAAW,EACtB,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;CAAO,GAC5D,MAAM,IAAI,CAgCZ"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Controls that keep what a visitor chose before the page hydrated.
3
+ *
4
+ * A server-rendered page can be used before its scripts arrive: a checkbox
5
+ * can be ticked, a radio chosen. A component that writes `checked={…}` from
6
+ * its own state and listens for `change` loses that on hydration: Svelte sets
7
+ * `checked` from the state, which still says nothing was chosen.
8
+ *
9
+ * Svelte's own bindings do not. `bind:checked` and `bind:group` know when
10
+ * they run during hydration, compare the input with the markup the server
11
+ * sent (`defaultChecked`), and where they differ hand the input's state to
12
+ * the binding instead of overwriting it. They also put the binding back on a
13
+ * form reset. So the controls bind, and what they bind to is an accessor of
14
+ * their own: the place where a choice is taken in, by whatever road it came.
15
+ *
16
+ * `bind:group` takes only an identifier or a member expression, which is why
17
+ * this is an object with a `value` and not a pair of functions.
18
+ */
19
+ /** What Svelte hands a group binding when no radio is checked: after a reset, or when hydration finds none. */
20
+ export type NoChoice = null | undefined;
21
+ /**
22
+ * The target of a radio's `bind:group={binding.value}`.
23
+ *
24
+ * `read` gives the chosen value; a radio is checked while its own value is
25
+ * that. `choose` is called when a radio was picked: by the user, or before
26
+ * hydration. `restore` is called with nothing chosen: a form is being reset
27
+ * (see `resetValueOf` for what to go back to).
28
+ */
29
+ export declare function groupBinding<T>(read: () => T | NoChoice, choose: (value: T) => void, restore: () => void): {
30
+ value: T | NoChoice;
31
+ };
32
+ /**
33
+ * The value a group of radios goes back to on a form reset: that of the one
34
+ * whose `checked` attribute is set, in the type the component's options have
35
+ * (Svelte keeps it on the input as `__value`), or `undefined` when none is.
36
+ *
37
+ * It reads the attribute (`defaultChecked`), not `checked`: Svelte calls a
38
+ * binding's reset handler in a microtask after the `reset` event, and when a
39
+ * user pressed the reset button that is before the browser has reset
40
+ * anything. Svelte takes the `checked` attribute off a bound input once it
41
+ * has hydrated, so in practice a reset empties the group, as it does a bound
42
+ * native input.
43
+ */
44
+ export declare function resetValueOf<T>(inputs: Iterable<HTMLInputElement | undefined>): T | undefined;
45
+ //# sourceMappingURL=hydration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydration.d.ts","sourceRoot":"","sources":["../../../src/components/util/hydration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,+GAA+G;AAC/G,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC;AAExC;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC1B,IAAI,EAAE,MAAM,CAAC,GAAG,QAAQ,EACxB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAC1B,OAAO,EAAE,MAAM,IAAI;WAGF,CAAC,GAAG,QAAQ;EAQhC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,gBAAgB,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,SAAS,CAK7F"}