bits-ui 1.8.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/dist/bits/accordion/accordion.svelte.d.ts +56 -53
  2. package/dist/bits/accordion/accordion.svelte.js +78 -89
  3. package/dist/bits/accordion/components/accordion-content.svelte +5 -3
  4. package/dist/bits/accordion/components/accordion-header.svelte +4 -2
  5. package/dist/bits/accordion/components/accordion-item.svelte +6 -3
  6. package/dist/bits/accordion/components/accordion-trigger.svelte +4 -2
  7. package/dist/bits/accordion/components/accordion.svelte +4 -2
  8. package/dist/bits/alert-dialog/components/alert-dialog-action.svelte +4 -2
  9. package/dist/bits/alert-dialog/components/alert-dialog-cancel.svelte +4 -2
  10. package/dist/bits/alert-dialog/components/alert-dialog-content.svelte +8 -3
  11. package/dist/bits/aspect-ratio/aspect-ratio.svelte.js +2 -2
  12. package/dist/bits/aspect-ratio/components/aspect-ratio.svelte +4 -2
  13. package/dist/bits/avatar/avatar.svelte.js +4 -4
  14. package/dist/bits/avatar/components/avatar-fallback.svelte +4 -2
  15. package/dist/bits/avatar/components/avatar-image.svelte +4 -2
  16. package/dist/bits/avatar/components/avatar.svelte +4 -2
  17. package/dist/bits/button/components/button.svelte +1 -1
  18. package/dist/bits/calendar/calendar.svelte.d.ts +1 -9
  19. package/dist/bits/calendar/calendar.svelte.js +47 -38
  20. package/dist/bits/calendar/components/calendar-cell.svelte +4 -2
  21. package/dist/bits/calendar/components/calendar-day.svelte +4 -2
  22. package/dist/bits/calendar/components/calendar-grid-body.svelte +4 -2
  23. package/dist/bits/calendar/components/calendar-grid-head.svelte +4 -2
  24. package/dist/bits/calendar/components/calendar-grid-row.svelte +4 -2
  25. package/dist/bits/calendar/components/calendar-grid.svelte +4 -2
  26. package/dist/bits/calendar/components/calendar-head-cell.svelte +4 -2
  27. package/dist/bits/calendar/components/calendar-header.svelte +4 -2
  28. package/dist/bits/calendar/components/calendar-heading.svelte +4 -2
  29. package/dist/bits/calendar/components/calendar-next-button.svelte +4 -2
  30. package/dist/bits/calendar/components/calendar-prev-button.svelte +4 -2
  31. package/dist/bits/checkbox/checkbox.svelte.js +4 -14
  32. package/dist/bits/checkbox/components/checkbox-group-label.svelte +4 -2
  33. package/dist/bits/checkbox/components/checkbox-group.svelte +4 -2
  34. package/dist/bits/checkbox/components/checkbox.svelte +4 -2
  35. package/dist/bits/collapsible/collapsible.svelte.js +4 -10
  36. package/dist/bits/collapsible/components/collapsible-content.svelte +5 -3
  37. package/dist/bits/collapsible/components/collapsible-trigger.svelte +4 -2
  38. package/dist/bits/collapsible/components/collapsible.svelte +4 -2
  39. package/dist/bits/combobox/components/combobox-input.svelte +1 -1
  40. package/dist/bits/combobox/components/combobox.svelte +1 -1
  41. package/dist/bits/command/command.svelte.js +13 -45
  42. package/dist/bits/command/components/_command-label.svelte +6 -7
  43. package/dist/bits/command/components/_command-label.svelte.d.ts +1 -1
  44. package/dist/bits/command/components/command-empty.svelte +4 -2
  45. package/dist/bits/command/components/command-group-heading.svelte +4 -2
  46. package/dist/bits/command/components/command-group-items.svelte +4 -2
  47. package/dist/bits/command/components/command-group.svelte +4 -2
  48. package/dist/bits/command/components/command-input.svelte +4 -2
  49. package/dist/bits/command/components/command-item.svelte +4 -2
  50. package/dist/bits/command/components/command-link-item.svelte +4 -2
  51. package/dist/bits/command/components/command-list.svelte +4 -2
  52. package/dist/bits/command/components/command-loading.svelte +4 -2
  53. package/dist/bits/command/components/command-separator.svelte +4 -2
  54. package/dist/bits/command/components/command-viewport.svelte +4 -2
  55. package/dist/bits/command/components/command.svelte +4 -2
  56. package/dist/bits/context-menu/components/context-menu-content-static.svelte +2 -3
  57. package/dist/bits/context-menu/components/context-menu-content.svelte +2 -3
  58. package/dist/bits/context-menu/components/context-menu-trigger.svelte +1 -1
  59. package/dist/bits/date-field/components/date-field-input.svelte +4 -2
  60. package/dist/bits/date-field/components/date-field-label.svelte +4 -2
  61. package/dist/bits/date-field/components/date-field-segment.svelte +4 -2
  62. package/dist/bits/date-field/date-field.svelte.d.ts +4 -4
  63. package/dist/bits/date-field/date-field.svelte.js +15 -33
  64. package/dist/bits/date-picker/components/date-picker-calendar.svelte +4 -2
  65. package/dist/bits/date-range-field/components/date-range-field-input.svelte +4 -2
  66. package/dist/bits/date-range-field/components/date-range-field-label.svelte +4 -2
  67. package/dist/bits/date-range-field/components/date-range-field.svelte +4 -2
  68. package/dist/bits/date-range-field/date-range-field.svelte.js +3 -13
  69. package/dist/bits/date-range-picker/components/date-range-picker-calendar.svelte +4 -2
  70. package/dist/bits/dialog/components/dialog-close.svelte +4 -2
  71. package/dist/bits/dialog/components/dialog-content.svelte +8 -2
  72. package/dist/bits/dialog/components/dialog-description.svelte +4 -2
  73. package/dist/bits/dialog/components/dialog-overlay.svelte +8 -3
  74. package/dist/bits/dialog/components/dialog-title.svelte +4 -2
  75. package/dist/bits/dialog/components/dialog-trigger.svelte +4 -2
  76. package/dist/bits/dialog/dialog.svelte.d.ts +1 -1
  77. package/dist/bits/dialog/dialog.svelte.js +19 -47
  78. package/dist/bits/dropdown-menu/components/dropdown-menu-content-static.svelte +6 -5
  79. package/dist/bits/dropdown-menu/components/dropdown-menu-content.svelte +6 -5
  80. package/dist/bits/index.d.ts +2 -0
  81. package/dist/bits/index.js +2 -0
  82. package/dist/bits/label/components/label.svelte +4 -2
  83. package/dist/bits/label/label.svelte.js +2 -2
  84. package/dist/bits/link-preview/components/link-preview-content-static.svelte +6 -2
  85. package/dist/bits/link-preview/components/link-preview-content.svelte +6 -2
  86. package/dist/bits/link-preview/components/link-preview-trigger.svelte +5 -3
  87. package/dist/bits/link-preview/link-preview.svelte.js +3 -14
  88. package/dist/bits/menu/components/menu-checkbox-group.svelte +4 -2
  89. package/dist/bits/menu/components/menu-checkbox-item.svelte +6 -4
  90. package/dist/bits/menu/components/menu-content-static.svelte +6 -5
  91. package/dist/bits/menu/components/menu-content.svelte +6 -5
  92. package/dist/bits/menu/components/menu-group-heading.svelte +4 -2
  93. package/dist/bits/menu/components/menu-group.svelte +4 -2
  94. package/dist/bits/menu/components/menu-item.svelte +4 -2
  95. package/dist/bits/menu/components/menu-radio-group.svelte +4 -2
  96. package/dist/bits/menu/components/menu-radio-item.svelte +4 -2
  97. package/dist/bits/menu/components/menu-separator.svelte +4 -2
  98. package/dist/bits/menu/components/menu-sub-content-static.svelte +6 -5
  99. package/dist/bits/menu/components/menu-sub-content.svelte +6 -5
  100. package/dist/bits/menu/components/menu-sub-trigger.svelte +6 -3
  101. package/dist/bits/menu/components/menu-trigger.svelte +5 -3
  102. package/dist/bits/menu/menu.svelte.d.ts +7 -20
  103. package/dist/bits/menu/menu.svelte.js +26 -54
  104. package/dist/bits/menubar/components/menubar-content-static.svelte +4 -2
  105. package/dist/bits/menubar/components/menubar-content.svelte +4 -2
  106. package/dist/bits/menubar/components/menubar-menu.svelte +4 -2
  107. package/dist/bits/menubar/components/menubar-trigger.svelte +14 -6
  108. package/dist/bits/menubar/components/menubar.svelte +4 -2
  109. package/dist/bits/menubar/menubar.svelte.d.ts +24 -20
  110. package/dist/bits/menubar/menubar.svelte.js +40 -56
  111. package/dist/bits/meter/components/meter.svelte +4 -2
  112. package/dist/bits/meter/meter.svelte.js +2 -2
  113. package/dist/bits/navigation-menu/components/navigation-menu-content-impl.svelte +5 -2
  114. package/dist/bits/navigation-menu/components/navigation-menu-content.svelte +8 -3
  115. package/dist/bits/navigation-menu/components/navigation-menu-indicator-impl.svelte +4 -2
  116. package/dist/bits/navigation-menu/components/navigation-menu-indicator.svelte +6 -4
  117. package/dist/bits/navigation-menu/components/navigation-menu-item.svelte +6 -3
  118. package/dist/bits/navigation-menu/components/navigation-menu-link.svelte +4 -2
  119. package/dist/bits/navigation-menu/components/navigation-menu-list.svelte +4 -2
  120. package/dist/bits/navigation-menu/components/navigation-menu-sub.svelte +4 -2
  121. package/dist/bits/navigation-menu/components/navigation-menu-trigger.svelte +4 -2
  122. package/dist/bits/navigation-menu/components/navigation-menu-viewport.svelte +5 -3
  123. package/dist/bits/navigation-menu/components/navigation-menu.svelte +4 -2
  124. package/dist/bits/navigation-menu/navigation-menu.svelte.js +13 -50
  125. package/dist/bits/pagination/components/pagination-next-button.svelte +4 -2
  126. package/dist/bits/pagination/components/pagination-page.svelte +4 -2
  127. package/dist/bits/pagination/components/pagination-prev-button.svelte +4 -2
  128. package/dist/bits/pagination/components/pagination.svelte +4 -2
  129. package/dist/bits/pagination/pagination.svelte.js +4 -4
  130. package/dist/bits/pin-input/components/pin-input-cell.svelte +4 -2
  131. package/dist/bits/pin-input/components/pin-input.svelte +5 -3
  132. package/dist/bits/pin-input/pin-input.svelte.js +4 -10
  133. package/dist/bits/popover/components/popover-close.svelte +4 -2
  134. package/dist/bits/popover/components/popover-content-static.svelte +6 -2
  135. package/dist/bits/popover/components/popover-content.svelte +6 -2
  136. package/dist/bits/popover/components/popover-trigger.svelte +5 -3
  137. package/dist/bits/popover/popover.svelte.js +4 -18
  138. package/dist/bits/progress/components/progress.svelte +4 -2
  139. package/dist/bits/progress/progress.svelte.js +2 -2
  140. package/dist/bits/radio-group/components/radio-group-item.svelte +4 -2
  141. package/dist/bits/radio-group/components/radio-group.svelte +4 -2
  142. package/dist/bits/radio-group/radio-group.svelte.js +4 -7
  143. package/dist/bits/range-calendar/components/range-calendar-cell.svelte +4 -2
  144. package/dist/bits/range-calendar/components/range-calendar-day.svelte +4 -2
  145. package/dist/bits/range-calendar/components/range-calendar.svelte +4 -2
  146. package/dist/bits/range-calendar/range-calendar.svelte.js +4 -4
  147. package/dist/bits/scroll-area/components/scroll-area-corner.svelte +8 -2
  148. package/dist/bits/scroll-area/components/scroll-area-scrollbar-auto.svelte +4 -1
  149. package/dist/bits/scroll-area/components/scroll-area-scrollbar-hover.svelte +1 -1
  150. package/dist/bits/scroll-area/components/scroll-area-scrollbar-scroll.svelte +5 -1
  151. package/dist/bits/scroll-area/components/scroll-area-scrollbar.svelte +4 -2
  152. package/dist/bits/scroll-area/components/scroll-area-thumb.svelte +8 -3
  153. package/dist/bits/scroll-area/components/scroll-area-viewport.svelte +4 -2
  154. package/dist/bits/scroll-area/components/scroll-area.svelte +4 -2
  155. package/dist/bits/scroll-area/scroll-area.svelte.js +13 -47
  156. package/dist/bits/select/components/select-content-static.svelte +6 -2
  157. package/dist/bits/select/components/select-content.svelte +6 -2
  158. package/dist/bits/select/components/select-group-heading.svelte +3 -2
  159. package/dist/bits/select/components/select-group.svelte +4 -2
  160. package/dist/bits/select/components/select-item.svelte +4 -2
  161. package/dist/bits/select/components/select-scroll-down-button.svelte +4 -2
  162. package/dist/bits/select/components/select-scroll-up-button.svelte +4 -2
  163. package/dist/bits/select/components/select-trigger.svelte +5 -3
  164. package/dist/bits/select/components/select-viewport.svelte +4 -2
  165. package/dist/bits/select/components/select.svelte +1 -1
  166. package/dist/bits/select/select.svelte.d.ts +0 -18
  167. package/dist/bits/select/select.svelte.js +10 -43
  168. package/dist/bits/separator/components/separator.svelte +4 -2
  169. package/dist/bits/separator/separator.svelte.js +2 -2
  170. package/dist/bits/slider/components/slider-range.svelte +4 -2
  171. package/dist/bits/slider/components/slider-thumb-label.svelte +50 -0
  172. package/dist/bits/slider/components/slider-thumb-label.svelte.d.ts +4 -0
  173. package/dist/bits/slider/components/slider-thumb.svelte +4 -2
  174. package/dist/bits/slider/components/slider-tick-label.svelte +50 -0
  175. package/dist/bits/slider/components/slider-tick-label.svelte.d.ts +4 -0
  176. package/dist/bits/slider/components/slider-tick.svelte +4 -2
  177. package/dist/bits/slider/components/slider.svelte +24 -5
  178. package/dist/bits/slider/exports.d.ts +3 -1
  179. package/dist/bits/slider/exports.js +2 -0
  180. package/dist/bits/slider/helpers.d.ts +14 -0
  181. package/dist/bits/slider/helpers.js +122 -0
  182. package/dist/bits/slider/slider.svelte.d.ts +91 -5
  183. package/dist/bits/slider/slider.svelte.js +194 -101
  184. package/dist/bits/slider/types.d.ts +105 -11
  185. package/dist/bits/switch/components/switch-thumb.svelte +4 -2
  186. package/dist/bits/switch/components/switch.svelte +4 -2
  187. package/dist/bits/switch/switch.svelte.js +3 -3
  188. package/dist/bits/tabs/components/tabs-content.svelte +4 -2
  189. package/dist/bits/tabs/components/tabs-list.svelte +4 -2
  190. package/dist/bits/tabs/components/tabs-trigger.svelte +4 -2
  191. package/dist/bits/tabs/components/tabs.svelte +4 -2
  192. package/dist/bits/tabs/tabs.svelte.js +6 -6
  193. package/dist/bits/time-field/components/time-field-hidden-input.svelte +10 -0
  194. package/dist/bits/{date-field/components/date-field-error.svelte.d.ts → time-field/components/time-field-hidden-input.svelte.d.ts} +6 -14
  195. package/dist/bits/time-field/components/time-field-input.svelte +39 -0
  196. package/dist/bits/time-field/components/time-field-input.svelte.d.ts +4 -0
  197. package/dist/bits/time-field/components/time-field-label.svelte +34 -0
  198. package/dist/bits/time-field/components/time-field-label.svelte.d.ts +4 -0
  199. package/dist/bits/time-field/components/time-field-segment.svelte +37 -0
  200. package/dist/bits/time-field/components/time-field-segment.svelte.d.ts +4 -0
  201. package/dist/bits/time-field/components/time-field.svelte +94 -0
  202. package/dist/bits/time-field/components/time-field.svelte.d.ts +20 -0
  203. package/dist/bits/time-field/exports.d.ts +5 -0
  204. package/dist/bits/time-field/exports.js +4 -0
  205. package/dist/bits/time-field/index.d.ts +1 -0
  206. package/dist/bits/time-field/index.js +1 -0
  207. package/dist/bits/time-field/time-field.svelte.d.ts +415 -0
  208. package/dist/bits/time-field/time-field.svelte.js +971 -0
  209. package/dist/bits/time-field/types.d.ts +137 -0
  210. package/dist/bits/time-field/types.js +1 -0
  211. package/dist/bits/time-range-field/components/time-range-field-input.svelte +43 -0
  212. package/dist/bits/time-range-field/components/time-range-field-input.svelte.d.ts +4 -0
  213. package/dist/bits/time-range-field/components/time-range-field-label.svelte +34 -0
  214. package/dist/bits/time-range-field/components/time-range-field-label.svelte.d.ts +4 -0
  215. package/dist/bits/time-range-field/components/time-range-field.svelte +144 -0
  216. package/dist/bits/time-range-field/components/time-range-field.svelte.d.ts +20 -0
  217. package/dist/bits/time-range-field/exports.d.ts +5 -0
  218. package/dist/bits/time-range-field/exports.js +4 -0
  219. package/dist/bits/time-range-field/index.d.ts +1 -0
  220. package/dist/bits/time-range-field/index.js +1 -0
  221. package/dist/bits/time-range-field/time-range-field.svelte.d.ts +90 -0
  222. package/dist/bits/time-range-field/time-range-field.svelte.js +210 -0
  223. package/dist/bits/time-range-field/types.d.ts +150 -0
  224. package/dist/bits/time-range-field/types.js +1 -0
  225. package/dist/bits/toggle/components/toggle.svelte +4 -2
  226. package/dist/bits/toggle/toggle.svelte.js +2 -2
  227. package/dist/bits/toggle-group/components/toggle-group-item.svelte +4 -2
  228. package/dist/bits/toggle-group/components/toggle-group.svelte +4 -2
  229. package/dist/bits/toggle-group/toggle-group.svelte.js +4 -4
  230. package/dist/bits/toolbar/components/toolbar-button.svelte +4 -2
  231. package/dist/bits/toolbar/components/toolbar-group-item.svelte +4 -2
  232. package/dist/bits/toolbar/components/toolbar-group.svelte +4 -2
  233. package/dist/bits/toolbar/components/toolbar-link.svelte +4 -2
  234. package/dist/bits/toolbar/components/toolbar.svelte +4 -2
  235. package/dist/bits/toolbar/toolbar.svelte.js +7 -7
  236. package/dist/bits/tooltip/components/tooltip-content-static.svelte +6 -2
  237. package/dist/bits/tooltip/components/tooltip-content.svelte +6 -2
  238. package/dist/bits/tooltip/components/tooltip-trigger.svelte +5 -3
  239. package/dist/bits/tooltip/tooltip.svelte.js +3 -14
  240. package/dist/bits/utilities/dismissible-layer/dismissible-layer.svelte +2 -0
  241. package/dist/bits/utilities/dismissible-layer/types.d.ts +2 -0
  242. package/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.d.ts +3 -3
  243. package/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js +16 -25
  244. package/dist/bits/utilities/floating-layer/components/floating-layer-anchor.svelte +2 -1
  245. package/dist/bits/utilities/floating-layer/types.d.ts +1 -0
  246. package/dist/bits/utilities/floating-layer/use-floating-layer.svelte.d.ts +3 -2
  247. package/dist/bits/utilities/floating-layer/use-floating-layer.svelte.js +5 -26
  248. package/dist/bits/utilities/focus-scope/focus-scope.svelte +2 -0
  249. package/dist/bits/utilities/focus-scope/types.d.ts +2 -0
  250. package/dist/bits/utilities/focus-scope/use-focus-scope.svelte.d.ts +2 -1
  251. package/dist/bits/utilities/focus-scope/use-focus-scope.svelte.js +2 -8
  252. package/dist/bits/utilities/popper-layer/popper-layer-inner.svelte +4 -0
  253. package/dist/bits/utilities/popper-layer/popper-layer.svelte +3 -1
  254. package/dist/bits/utilities/presence-layer/presence-layer.svelte +2 -2
  255. package/dist/bits/utilities/presence-layer/types.d.ts +2 -1
  256. package/dist/bits/utilities/presence-layer/use-presence.svelte.d.ts +1 -1
  257. package/dist/bits/utilities/presence-layer/use-presence.svelte.js +19 -36
  258. package/dist/bits/utilities/text-selection-layer/text-selection-layer.svelte +2 -0
  259. package/dist/bits/utilities/text-selection-layer/types.d.ts +2 -0
  260. package/dist/bits/utilities/text-selection-layer/use-text-selection-layer.svelte.d.ts +3 -1
  261. package/dist/bits/utilities/text-selection-layer/use-text-selection-layer.svelte.js +2 -8
  262. package/dist/index.d.ts +1 -1
  263. package/dist/index.js +1 -1
  264. package/dist/internal/create-id.d.ts +8 -0
  265. package/dist/internal/create-id.js +5 -0
  266. package/dist/internal/date-time/field/helpers.d.ts +1 -0
  267. package/dist/internal/date-time/field/helpers.js +8 -2
  268. package/dist/internal/date-time/field/parts.d.ts +3 -1
  269. package/dist/internal/date-time/field/parts.js +10 -2
  270. package/dist/internal/date-time/field/segments.d.ts +9 -0
  271. package/dist/internal/date-time/field/segments.js +65 -0
  272. package/dist/internal/date-time/field/time-helpers.d.ts +77 -0
  273. package/dist/internal/date-time/field/time-helpers.js +301 -0
  274. package/dist/internal/date-time/field/types.d.ts +2 -2
  275. package/dist/internal/date-time/formatter.d.ts +11 -1
  276. package/dist/internal/date-time/formatter.js +56 -0
  277. package/dist/internal/date-time/utils.d.ts +7 -2
  278. package/dist/internal/date-time/utils.js +15 -1
  279. package/dist/internal/dom-context.svelte.d.ts +9 -0
  280. package/dist/internal/dom-context.svelte.js +26 -0
  281. package/dist/internal/use-roving-focus.svelte.d.ts +3 -3
  282. package/dist/internal/use-roving-focus.svelte.js +10 -11
  283. package/dist/shared/date/types.d.ts +27 -4
  284. package/dist/shared/index.d.ts +2 -2
  285. package/dist/types.d.ts +2 -0
  286. package/package.json +18 -16
  287. package/dist/bits/date-field/components/date-field-error.svelte +0 -0
@@ -1,36 +1,88 @@
1
1
  import type { OnChangeFn, WithChild, Without } from "../../internal/types.js";
2
2
  import type { BitsPrimitiveSpanAttributes } from "../../shared/attributes.js";
3
3
  import type { Direction, Orientation, SliderThumbPositioning } from "../../shared/index.js";
4
+ export type TickItem = {
5
+ /**
6
+ * The value this tick represents
7
+ */
8
+ value: number;
9
+ /**
10
+ * The index of this tick in the array of ticks provided by the `children`
11
+ * or `child` snippet prop of the `Slider.Root` component.
12
+ */
13
+ index: number;
14
+ };
15
+ export type ThumbItem = {
16
+ /**
17
+ * The value this thumb represents
18
+ */
19
+ value: number;
20
+ /**
21
+ * The index of this thumb in the array of thumbs provided by the `children`
22
+ * or `child` snippet prop of the `Slider.Root` component.
23
+ */
24
+ index: number;
25
+ };
26
+ export type SliderLabelPosition = "top" | "bottom" | "left" | "right";
4
27
  export type SliderRootSnippetProps = {
28
+ /**
29
+ * Use `tickItems` instead. Will be removed in Bits UI v3.
30
+ *
31
+ * The indices of the ticks.
32
+ *
33
+ * @deprecated Use `tickItems` instead.
34
+ */
5
35
  ticks: number[];
36
+ /**
37
+ * Use `thumbItems` instead. Will be removed in Bits UI v3.
38
+ *
39
+ * The indices of the thumbs.
40
+ *
41
+ * @deprecated Use `thumbItems` instead
42
+ */
6
43
  thumbs: number[];
44
+ /**
45
+ * An array of objects containing the value and index of each tick, useful for
46
+ * rendering ticks along with labels for each tick.
47
+ */
48
+ tickItems: TickItem[];
49
+ /**
50
+ * An array of objects containing the value and index of each thumb, useful for
51
+ * rendering thumbs along with labels for each thumb.
52
+ */
53
+ thumbItems: ThumbItem[];
7
54
  };
8
55
  export type BaseSliderRootPropsWithoutHTML = {
9
56
  /**
10
57
  * Whether to automatically sort the values in the array when moving thumbs past
11
58
  * one another.
12
59
  *
13
- * @defaultValue true
60
+ * @default true
14
61
  */
15
62
  autoSort?: boolean;
16
63
  /**
17
64
  * The minimum value of the slider.
18
65
  *
19
- * @defaultValue 0
66
+ * @default 0 (for number step) or the min value of the step array (for array step)
20
67
  */
21
68
  min?: number;
22
69
  /**
23
70
  * The maximum value of the slider.
24
71
  *
25
- * @defaultValue 100
72
+ * @default 100 (for number step) or the max value of the step array (for array step)
26
73
  */
27
74
  max?: number;
28
75
  /**
29
- * The amount to increment the value by when the user presses the arrow keys.
76
+ * The amount to increment the value by when the user presses the arrow keys,
77
+ * or an array of specific values that the slider can snap to.
78
+ *
79
+ * When an array is provided, the slider will only allow values that exist in the array,
80
+ * creating discrete tick points. The array values should be within the min/max range
81
+ * and will be automatically sorted.
30
82
  *
31
- * @defaultValue 1
83
+ * @default 1
32
84
  */
33
- step?: number;
85
+ step?: number | number[];
34
86
  /**
35
87
  * The direction of the slider.
36
88
  *
@@ -38,27 +90,35 @@ export type BaseSliderRootPropsWithoutHTML = {
38
90
  * from the top and move downwards. For horizontal sliders, setting `dir` to `'rtl'`
39
91
  * will cause the slider to start from the left and move rightwards.
40
92
  *
41
- * @defaultValue 'ltr'
93
+ * @default 'ltr'
42
94
  */
43
95
  dir?: Direction;
44
96
  /**
45
97
  * The orientation of the slider.
46
98
  *
47
- * @defaultValue "horizontal"
99
+ * @default "horizontal"
48
100
  */
49
101
  orientation?: Orientation;
50
102
  /**
51
103
  * Whether the slider is disabled or not.
52
104
  *
53
- * @defaultValue false
105
+ * @default false
54
106
  */
55
107
  disabled?: boolean;
56
108
  /**
57
109
  * The positioning of the slider thumb.
58
110
  *
59
- * @defaultValue "contain"
111
+ * @default "contain"
60
112
  */
61
113
  thumbPositioning?: SliderThumbPositioning;
114
+ /**
115
+ * Padding percentage for the track. Creates space before the first
116
+ * and after the last tick positions.
117
+ *
118
+ * This can also be used as an SSR-friendly alternative to `thumbPositioning="contain"`,
119
+ * which requires client-side measurement.
120
+ */
121
+ trackPadding?: number;
62
122
  };
63
123
  export type SliderSingleRootPropsWithoutHTML = BaseSliderRootPropsWithoutHTML & {
64
124
  /**
@@ -71,6 +131,8 @@ export type SliderSingleRootPropsWithoutHTML = BaseSliderRootPropsWithoutHTML &
71
131
  /**
72
132
  * The value of the slider.
73
133
  * @bindable
134
+ *
135
+ * @default min
74
136
  */
75
137
  value?: number;
76
138
  /**
@@ -119,7 +181,7 @@ export type SliderThumbPropsWithoutHTML = WithChild<{
119
181
  /**
120
182
  * Whether the thumb is disabled or not.
121
183
  *
122
- * @defaultValue false
184
+ * @default false
123
185
  */
124
186
  disabled?: boolean;
125
187
  /**
@@ -137,3 +199,35 @@ export type SliderTickPropsWithoutHTML = WithChild<{
137
199
  index: number;
138
200
  }>;
139
201
  export type SliderTickProps = SliderTickPropsWithoutHTML & Without<BitsPrimitiveSpanAttributes, SliderTickPropsWithoutHTML>;
202
+ export type SliderTickLabelPropsWithoutHTML = WithChild<{
203
+ /**
204
+ * The index of the tick the label represents in the array of ticks
205
+ * provided by the `children` snippet prop of the `Slider.Root` component.
206
+ */
207
+ index: number;
208
+ /**
209
+ * The position of the label relative to the tick.
210
+ * For horizontal sliders: "top" | "bottom"
211
+ * For vertical sliders: "left" | "right"
212
+ *
213
+ * @default for horizontal sliders = "top" and for vertical sliders = "left"
214
+ */
215
+ position?: SliderLabelPosition;
216
+ }>;
217
+ export type SliderTickLabelProps = SliderTickLabelPropsWithoutHTML & Without<BitsPrimitiveSpanAttributes, SliderTickLabelPropsWithoutHTML>;
218
+ export type SliderThumbLabelPropsWithoutHTML = WithChild<{
219
+ /**
220
+ * The index of the thumb the label represents in the array of thumbs
221
+ * provided by the `children` snippet prop of the `Slider.Root` component.
222
+ */
223
+ index: number;
224
+ /**
225
+ * The position of the label relative to the thumb.
226
+ * For horizontal sliders: "top" | "bottom"
227
+ * For vertical sliders: "left" | "right"
228
+ *
229
+ * @default for horizontal sliders = "top" and for vertical sliders = "left"
230
+ */
231
+ position?: SliderLabelPosition;
232
+ }>;
233
+ export type SliderThumbLabelProps = SliderThumbLabelPropsWithoutHTML & Without<BitsPrimitiveSpanAttributes, SliderThumbLabelPropsWithoutHTML>;
@@ -2,13 +2,15 @@
2
2
  import { box, mergeProps } from "svelte-toolbelt";
3
3
  import type { SwitchThumbProps } from "../types.js";
4
4
  import { useSwitchThumb } from "../switch.svelte.js";
5
- import { useId } from "../../../internal/use-id.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
+
7
+ const uid = $props.id();
6
8
 
7
9
  let {
8
10
  child,
9
11
  children,
10
12
  ref = $bindable(null),
11
- id = useId(),
13
+ id = createId(uid),
12
14
  ...restProps
13
15
  }: SwitchThumbProps = $props();
14
16
 
@@ -3,14 +3,16 @@
3
3
  import type { SwitchRootProps } from "../types.js";
4
4
  import { useSwitchRoot } from "../switch.svelte.js";
5
5
  import SwitchInput from "./switch-input.svelte";
6
- import { useId } from "../../../internal/use-id.js";
6
+ import { createId } from "../../../internal/create-id.js";
7
7
  import { noop } from "../../../internal/noop.js";
8
8
 
9
+ const uid = $props.id();
10
+
9
11
  let {
10
12
  child,
11
13
  children,
12
14
  ref = $bindable(null),
13
- id = useId(),
15
+ id = createId(uid),
14
16
  disabled = false,
15
17
  required = false,
16
18
  checked = $bindable(false),
@@ -1,4 +1,4 @@
1
- import { useRefById } from "svelte-toolbelt";
1
+ import { attachRef } from "svelte-toolbelt";
2
2
  import { Context } from "runed";
3
3
  import { getAriaChecked, getAriaRequired, getDataChecked, getDataDisabled, getDataRequired, getDisabled, } from "../../internal/attrs.js";
4
4
  import { kbd } from "../../internal/kbd.js";
@@ -8,7 +8,6 @@ class SwitchRootState {
8
8
  opts;
9
9
  constructor(opts) {
10
10
  this.opts = opts;
11
- useRefById(opts);
12
11
  this.onkeydown = this.onkeydown.bind(this);
13
12
  this.onclick = this.onclick.bind(this);
14
13
  }
@@ -45,6 +44,7 @@ class SwitchRootState {
45
44
  //
46
45
  onclick: this.onclick,
47
46
  onkeydown: this.onkeydown,
47
+ ...attachRef(this.opts.ref),
48
48
  }));
49
49
  }
50
50
  class SwitchInputState {
@@ -68,7 +68,6 @@ class SwitchThumbState {
68
68
  constructor(opts, root) {
69
69
  this.opts = opts;
70
70
  this.root = root;
71
- useRefById(opts);
72
71
  }
73
72
  snippetProps = $derived.by(() => ({
74
73
  checked: this.root.opts.checked.current,
@@ -77,6 +76,7 @@ class SwitchThumbState {
77
76
  ...this.root.sharedProps,
78
77
  id: this.opts.id.current,
79
78
  [SWITCH_THUMB_ATTR]: "",
79
+ ...attachRef(this.opts.ref),
80
80
  }));
81
81
  }
82
82
  const SwitchRootContext = new Context("Switch.Root");
@@ -2,12 +2,14 @@
2
2
  import { box, mergeProps } from "svelte-toolbelt";
3
3
  import type { TabsContentProps } from "../types.js";
4
4
  import { useTabsContent } from "../tabs.svelte.js";
5
- import { useId } from "../../../internal/use-id.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
+
7
+ const uid = $props.id();
6
8
 
7
9
  let {
8
10
  children,
9
11
  child,
10
- id = useId(),
12
+ id = createId(uid),
11
13
  ref = $bindable(null),
12
14
  value,
13
15
  ...restProps
@@ -2,12 +2,14 @@
2
2
  import { box, mergeProps } from "svelte-toolbelt";
3
3
  import type { TabsListProps } from "../types.js";
4
4
  import { useTabsList } from "../tabs.svelte.js";
5
- import { useId } from "../../../internal/use-id.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
+
7
+ const uid = $props.id();
6
8
 
7
9
  let {
8
10
  child,
9
11
  children,
10
- id = useId(),
12
+ id = createId(uid),
11
13
  ref = $bindable(null),
12
14
  ...restProps
13
15
  }: TabsListProps = $props();
@@ -2,13 +2,15 @@
2
2
  import { box, mergeProps } from "svelte-toolbelt";
3
3
  import type { TabsTriggerProps } from "../types.js";
4
4
  import { useTabsTrigger } from "../tabs.svelte.js";
5
- import { useId } from "../../../internal/use-id.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
+
7
+ const uid = $props.id();
6
8
 
7
9
  let {
8
10
  child,
9
11
  children,
10
12
  disabled = false,
11
- id = useId(),
13
+ id = createId(uid),
12
14
  type = "button",
13
15
  value,
14
16
  ref = $bindable(null),
@@ -2,11 +2,13 @@
2
2
  import { box, mergeProps } from "svelte-toolbelt";
3
3
  import type { TabsRootProps } from "../types.js";
4
4
  import { useTabsRoot } from "../tabs.svelte.js";
5
- import { useId } from "../../../internal/use-id.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
6
  import { noop } from "../../../internal/noop.js";
7
7
 
8
+ const uid = $props.id();
9
+
8
10
  let {
9
- id = useId(),
11
+ id = createId(uid),
10
12
  ref = $bindable(null),
11
13
  value = $bindable(""),
12
14
  onValueChange = noop,
@@ -1,5 +1,5 @@
1
1
  import { SvelteMap } from "svelte/reactivity";
2
- import { useRefById } from "svelte-toolbelt";
2
+ import { attachRef } from "svelte-toolbelt";
3
3
  import { Context, watch } from "runed";
4
4
  import { getAriaOrientation, getAriaSelected, getDataDisabled, getDataOrientation, getDisabled, getHidden, } from "../../internal/attrs.js";
5
5
  import { kbd } from "../../internal/kbd.js";
@@ -18,10 +18,9 @@ class TabsRootState {
18
18
  valueToContentId = new SvelteMap();
19
19
  constructor(opts) {
20
20
  this.opts = opts;
21
- useRefById(opts);
22
21
  this.rovingFocusGroup = useRovingFocus({
23
22
  candidateAttr: TABS_TRIGGER_ATTR,
24
- rootNodeId: this.opts.id,
23
+ rootNode: this.opts.ref,
25
24
  loop: this.opts.loop,
26
25
  orientation: this.opts.orientation,
27
26
  });
@@ -49,6 +48,7 @@ class TabsRootState {
49
48
  id: this.opts.id.current,
50
49
  "data-orientation": getDataOrientation(this.opts.orientation.current),
51
50
  [TABS_ROOT_ATTR]: "",
51
+ ...attachRef(this.opts.ref),
52
52
  }));
53
53
  }
54
54
  class TabsListState {
@@ -58,7 +58,6 @@ class TabsListState {
58
58
  constructor(opts, root) {
59
59
  this.opts = opts;
60
60
  this.root = root;
61
- useRefById(opts);
62
61
  }
63
62
  props = $derived.by(() => ({
64
63
  id: this.opts.id.current,
@@ -67,6 +66,7 @@ class TabsListState {
67
66
  "data-orientation": getDataOrientation(this.root.opts.orientation.current),
68
67
  [TABS_LIST_ATTR]: "",
69
68
  "data-disabled": getDataDisabled(this.#isDisabled),
69
+ ...attachRef(this.opts.ref),
70
70
  }));
71
71
  }
72
72
  class TabsTriggerState {
@@ -79,7 +79,6 @@ class TabsTriggerState {
79
79
  constructor(opts, root) {
80
80
  this.opts = opts;
81
81
  this.root = root;
82
- useRefById(opts);
83
82
  watch([() => this.opts.id.current, () => this.opts.value.current], ([id, value]) => {
84
83
  return this.root.registerTrigger(id, value);
85
84
  });
@@ -137,6 +136,7 @@ class TabsTriggerState {
137
136
  onclick: this.onclick,
138
137
  onfocus: this.onfocus,
139
138
  onkeydown: this.onkeydown,
139
+ ...attachRef(this.opts.ref),
140
140
  }));
141
141
  }
142
142
  class TabsContentState {
@@ -147,7 +147,6 @@ class TabsContentState {
147
147
  constructor(opts, root) {
148
148
  this.opts = opts;
149
149
  this.root = root;
150
- useRefById(opts);
151
150
  watch([() => this.opts.id.current, () => this.opts.value.current], ([id, value]) => {
152
151
  return this.root.registerContent(id, value);
153
152
  });
@@ -161,6 +160,7 @@ class TabsContentState {
161
160
  "data-state": getTabDataState(this.#isActive),
162
161
  "aria-labelledby": this.#ariaLabelledBy,
163
162
  [TABS_CONTENT_ATTR]: "",
163
+ ...attachRef(this.opts.ref),
164
164
  }));
165
165
  }
166
166
  const TabsRootContext = new Context("Tabs.Root");
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import { useTimeFieldHiddenInput } from "../time-field.svelte.js";
3
+ import HiddenInput from "../../utilities/hidden-input.svelte";
4
+
5
+ const hiddenInputState = useTimeFieldHiddenInput();
6
+ </script>
7
+
8
+ {#if hiddenInputState.shouldRender}
9
+ <HiddenInput {...hiddenInputState.props} />
10
+ {/if}
@@ -1,18 +1,5 @@
1
- export default DateFieldError;
2
- type DateFieldError = SvelteComponent<{
3
- [x: string]: never;
4
- }, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: string | undefined;
8
- };
9
- declare const DateFieldError: $$__sveltets_2_IsomorphicComponent<{
10
- [x: string]: never;
11
- }, {
12
- [evt: string]: CustomEvent<any>;
13
- }, {}, {}, string>;
14
1
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
- new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
16
3
  $$bindings?: Bindings;
17
4
  } & Exports;
18
5
  (internal: unknown, props: {
@@ -24,3 +11,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
24
11
  };
25
12
  z_$$bindings?: Bindings;
26
13
  }
14
+ declare const TimeFieldHiddenInput: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type TimeFieldHiddenInput = InstanceType<typeof TimeFieldHiddenInput>;
18
+ export default TimeFieldHiddenInput;
@@ -0,0 +1,39 @@
1
+ <script lang="ts">
2
+ import { box, mergeProps } from "svelte-toolbelt";
3
+ import { useTimeFieldInput } from "../time-field.svelte.js";
4
+ import type { TimeFieldInputProps } from "../types.js";
5
+ import DateFieldHiddenInput from "./time-field-hidden-input.svelte";
6
+ import { createId } from "../../../internal/create-id.js";
7
+
8
+ const uid = $props.id();
9
+
10
+ let {
11
+ id = createId(uid),
12
+ ref = $bindable(null),
13
+ name = "",
14
+ children,
15
+ child,
16
+ ...restProps
17
+ }: TimeFieldInputProps = $props();
18
+
19
+ const inputState = useTimeFieldInput({
20
+ id: box.with(() => id),
21
+ ref: box.with(
22
+ () => ref,
23
+ (v) => (ref = v)
24
+ ),
25
+ name: box.with(() => name),
26
+ });
27
+
28
+ const mergedProps = $derived(mergeProps(restProps, inputState.props));
29
+ </script>
30
+
31
+ {#if child}
32
+ {@render child({ props: mergedProps, segments: inputState.root.segmentContents })}
33
+ {:else}
34
+ <div {...mergedProps}>
35
+ {@render children?.({ segments: inputState.root.segmentContents })}
36
+ </div>
37
+ {/if}
38
+
39
+ <DateFieldHiddenInput />
@@ -0,0 +1,4 @@
1
+ import type { TimeFieldInputProps } from "../types.js";
2
+ declare const TimeFieldInput: import("svelte").Component<TimeFieldInputProps, {}, "ref">;
3
+ type TimeFieldInput = ReturnType<typeof TimeFieldInput>;
4
+ export default TimeFieldInput;
@@ -0,0 +1,34 @@
1
+ <script lang="ts">
2
+ import { box, mergeProps } from "svelte-toolbelt";
3
+ import { useTimeFieldLabel } from "../time-field.svelte.js";
4
+ import type { TimeFieldLabelProps } from "../types.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
+
7
+ const uid = $props.id();
8
+
9
+ let {
10
+ id = createId(uid),
11
+ ref = $bindable(null),
12
+ children,
13
+ child,
14
+ ...restProps
15
+ }: TimeFieldLabelProps = $props();
16
+
17
+ const labelState = useTimeFieldLabel({
18
+ id: box.with(() => id),
19
+ ref: box.with(
20
+ () => ref,
21
+ (v) => (ref = v)
22
+ ),
23
+ });
24
+
25
+ const mergedProps = $derived(mergeProps(restProps, labelState.props));
26
+ </script>
27
+
28
+ {#if child}
29
+ {@render child({ props: mergedProps })}
30
+ {:else}
31
+ <div {...mergedProps}>
32
+ {@render children?.()}
33
+ </div>
34
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { TimeFieldLabelProps } from "../types.js";
2
+ declare const TimeFieldLabel: import("svelte").Component<TimeFieldLabelProps, {}, "ref">;
3
+ type TimeFieldLabel = ReturnType<typeof TimeFieldLabel>;
4
+ export default TimeFieldLabel;
@@ -0,0 +1,37 @@
1
+ <script lang="ts">
2
+ import { box, mergeProps } from "svelte-toolbelt";
3
+ import { useTimeFieldSegment } from "../time-field.svelte.js";
4
+ import type { TimeFieldSegmentProps } from "../types.js";
5
+ import { createId } from "../../../internal/create-id.js";
6
+
7
+ const uid = $props.id();
8
+
9
+ let {
10
+ id = createId(uid),
11
+ ref = $bindable(null),
12
+ children,
13
+ child,
14
+ part,
15
+ ...restProps
16
+ }: TimeFieldSegmentProps = $props();
17
+
18
+ const segmentState = useTimeFieldSegment(part, {
19
+ id: box.with(() => id),
20
+ ref: box.with(
21
+ () => ref,
22
+ (v) => (ref = v)
23
+ ),
24
+ });
25
+
26
+ const mergedProps = $derived(
27
+ mergeProps(restProps, segmentState.props as Record<string, unknown>)
28
+ );
29
+ </script>
30
+
31
+ {#if child}
32
+ {@render child({ props: mergedProps })}
33
+ {:else}
34
+ <span {...mergedProps}>
35
+ {@render children?.()}
36
+ </span>
37
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { TimeFieldSegmentProps } from "../types.js";
2
+ declare const TimeFieldSegment: import("svelte").Component<TimeFieldSegmentProps, {}, "ref">;
3
+ type TimeFieldSegment = ReturnType<typeof TimeFieldSegment>;
4
+ export default TimeFieldSegment;
@@ -0,0 +1,94 @@
1
+ <script lang="ts" module>
2
+ import type { TimeValue } from "../../../shared/date/types.js";
3
+ import type { Time } from "@internationalized/date";
4
+ type T = unknown;
5
+ </script>
6
+
7
+ <script lang="ts" generics="T extends TimeValue = Time">
8
+ import { box } from "svelte-toolbelt";
9
+ import { useTimeFieldRoot } from "../time-field.svelte.js";
10
+ import type { TimeFieldRootProps } from "../types.js";
11
+ import { noop } from "../../../internal/noop.js";
12
+ import { getDefaultTime } from "../../../internal/date-time/utils.js";
13
+ import { watch } from "runed";
14
+
15
+ let {
16
+ disabled = false,
17
+ granularity,
18
+ hideTimeZone = false,
19
+ hourCycle,
20
+ locale = "en",
21
+ maxValue,
22
+ minValue,
23
+ onPlaceholderChange = noop,
24
+ onValueChange = noop,
25
+ validate = noop,
26
+ onInvalid = noop,
27
+ placeholder = $bindable(),
28
+ value = $bindable(),
29
+ readonly = false,
30
+ readonlySegments = [],
31
+ required = false,
32
+ errorMessageId,
33
+ children,
34
+ }: TimeFieldRootProps<T> = $props();
35
+
36
+ function handleDefaultPlaceholder() {
37
+ if (placeholder !== undefined) return;
38
+
39
+ const defaultPlaceholder = getDefaultTime({
40
+ granularity,
41
+ defaultValue: value,
42
+ });
43
+
44
+ placeholder = defaultPlaceholder;
45
+ }
46
+
47
+ // SSR
48
+ handleDefaultPlaceholder();
49
+
50
+ /**
51
+ * Covers an edge case where when a spread props object is reassigned,
52
+ * the props are reset to their default values, which would make placeholder
53
+ * undefined which causes errors to be thrown.
54
+ */
55
+ watch.pre(
56
+ () => placeholder,
57
+ () => {
58
+ handleDefaultPlaceholder();
59
+ }
60
+ );
61
+
62
+ useTimeFieldRoot({
63
+ value: box.with(
64
+ () => value,
65
+ (v) => {
66
+ value = v;
67
+ onValueChange(v);
68
+ }
69
+ ),
70
+ placeholder: box.with(
71
+ () => placeholder as TimeValue,
72
+ (v) => {
73
+ placeholder = v;
74
+ onPlaceholderChange(v);
75
+ }
76
+ ),
77
+ disabled: box.with(() => disabled),
78
+ granularity: box.with(() => granularity),
79
+ hideTimeZone: box.with(() => hideTimeZone),
80
+ hourCycle: box.with(() => hourCycle),
81
+ locale: box.with(() => locale),
82
+ maxValue: box.with(() => maxValue),
83
+ minValue: box.with(() => minValue),
84
+ validate: box.with(() => validate),
85
+ readonly: box.with(() => readonly),
86
+ readonlySegments: box.with(() => readonlySegments),
87
+ required: box.with(() => required),
88
+ onInvalid: box.with(() => onInvalid),
89
+ errorMessageId: box.with(() => errorMessageId),
90
+ isInvalidProp: box.with(() => undefined),
91
+ });
92
+ </script>
93
+
94
+ {@render children?.()}