@funstack/ui 0.1.0-alpha.10 → 0.1.0-alpha.12

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 (404) hide show
  1. package/dist/accordion/accordion-context.mjs.map +1 -1
  2. package/dist/accordion/accordion-item.d.mts +3 -4
  3. package/dist/accordion/accordion-item.d.mts.map +1 -1
  4. package/dist/accordion/accordion-item.mjs +10 -4
  5. package/dist/accordion/accordion-item.mjs.map +1 -1
  6. package/dist/accordion/accordion-panel.d.mts +3 -4
  7. package/dist/accordion/accordion-panel.d.mts.map +1 -1
  8. package/dist/accordion/accordion-panel.mjs +2 -1
  9. package/dist/accordion/accordion-panel.mjs.map +1 -1
  10. package/dist/accordion/accordion-root.d.mts +3 -3
  11. package/dist/accordion/accordion-root.d.mts.map +1 -1
  12. package/dist/accordion/accordion-root.mjs +8 -19
  13. package/dist/accordion/accordion-root.mjs.map +1 -1
  14. package/dist/accordion/accordion-trigger.d.mts +3 -4
  15. package/dist/accordion/accordion-trigger.d.mts.map +1 -1
  16. package/dist/accordion/accordion-trigger.mjs +5 -3
  17. package/dist/accordion/accordion-trigger.mjs.map +1 -1
  18. package/dist/button/button.d.mts +4 -2
  19. package/dist/button/button.d.mts.map +1 -1
  20. package/dist/button/button.mjs +3 -2
  21. package/dist/button/button.mjs.map +1 -1
  22. package/dist/checkbox/checkbox.d.mts +4 -5
  23. package/dist/checkbox/checkbox.d.mts.map +1 -1
  24. package/dist/checkbox/checkbox.mjs +16 -59
  25. package/dist/checkbox/checkbox.mjs.map +1 -1
  26. package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -1
  27. package/dist/checkbox-group/checkbox-group-item.d.mts +3 -4
  28. package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
  29. package/dist/checkbox-group/checkbox-group-item.mjs +21 -27
  30. package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
  31. package/dist/checkbox-group/checkbox-group-label.mjs +1 -6
  32. package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
  33. package/dist/checkbox-group/checkbox-group-parent.d.mts +3 -4
  34. package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
  35. package/dist/checkbox-group/checkbox-group-parent.mjs +12 -10
  36. package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
  37. package/dist/checkbox-group/checkbox-group-root.d.mts +1 -1
  38. package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
  39. package/dist/checkbox-group/checkbox-group-root.mjs +74 -101
  40. package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
  41. package/dist/combobox/combobox-clear.d.mts.map +1 -1
  42. package/dist/combobox/combobox-clear.mjs +5 -6
  43. package/dist/combobox/combobox-clear.mjs.map +1 -1
  44. package/dist/combobox/combobox-context.mjs.map +1 -1
  45. package/dist/combobox/combobox-group.d.mts.map +1 -1
  46. package/dist/combobox/combobox-group.mjs +2 -1
  47. package/dist/combobox/combobox-group.mjs.map +1 -1
  48. package/dist/combobox/combobox-input.d.mts.map +1 -1
  49. package/dist/combobox/combobox-input.mjs +14 -7
  50. package/dist/combobox/combobox-input.mjs.map +1 -1
  51. package/dist/combobox/combobox-list.d.mts.map +1 -1
  52. package/dist/combobox/combobox-list.mjs +6 -10
  53. package/dist/combobox/combobox-list.mjs.map +1 -1
  54. package/dist/combobox/combobox-option.d.mts.map +1 -1
  55. package/dist/combobox/combobox-option.mjs +2 -1
  56. package/dist/combobox/combobox-option.mjs.map +1 -1
  57. package/dist/combobox/combobox-popup.d.mts.map +1 -1
  58. package/dist/combobox/combobox-popup.mjs +9 -25
  59. package/dist/combobox/combobox-popup.mjs.map +1 -1
  60. package/dist/combobox/combobox-root.d.mts +11 -10
  61. package/dist/combobox/combobox-root.d.mts.map +1 -1
  62. package/dist/combobox/combobox-root.mjs +37 -109
  63. package/dist/combobox/combobox-root.mjs.map +1 -1
  64. package/dist/combobox/combobox-trigger.d.mts.map +1 -1
  65. package/dist/combobox/combobox-trigger.mjs +6 -25
  66. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  67. package/dist/combobox/index.d.mts +2 -2
  68. package/dist/combobox/index.mjs +3 -3
  69. package/dist/combobox/index.mjs.map +1 -1
  70. package/dist/combobox/use-combobox-form.mjs +56 -0
  71. package/dist/combobox/use-combobox-form.mjs.map +1 -0
  72. package/dist/combobox/use-option-registry.mjs +62 -0
  73. package/dist/combobox/use-option-registry.mjs.map +1 -0
  74. package/dist/dialog/dialog-close.d.mts.map +1 -1
  75. package/dist/dialog/dialog-close.mjs +29 -62
  76. package/dist/dialog/dialog-close.mjs.map +1 -1
  77. package/dist/dialog/dialog-context.mjs.map +1 -1
  78. package/dist/dialog/dialog-form.d.mts.map +1 -1
  79. package/dist/dialog/dialog-form.mjs +5 -4
  80. package/dist/dialog/dialog-form.mjs.map +1 -1
  81. package/dist/dialog/dialog-popup.d.mts +3 -4
  82. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  83. package/dist/dialog/dialog-popup.mjs +37 -98
  84. package/dist/dialog/dialog-popup.mjs.map +1 -1
  85. package/dist/dialog/dialog-root.d.mts.map +1 -1
  86. package/dist/dialog/dialog-root.mjs +30 -118
  87. package/dist/dialog/dialog-root.mjs.map +1 -1
  88. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  89. package/dist/dialog/dialog-trigger.mjs +13 -16
  90. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  91. package/dist/field/field-control.mjs +6 -13
  92. package/dist/field/field-control.mjs.map +1 -1
  93. package/dist/field/field-description.d.mts.map +1 -1
  94. package/dist/field/field-description.mjs +1 -2
  95. package/dist/field/field-description.mjs.map +1 -1
  96. package/dist/field/field-error.d.mts.map +1 -1
  97. package/dist/field/field-error.mjs +1 -2
  98. package/dist/field/field-error.mjs.map +1 -1
  99. package/dist/field/field-label.d.mts.map +1 -1
  100. package/dist/field/field-label.mjs +3 -11
  101. package/dist/field/field-label.mjs.map +1 -1
  102. package/dist/field/field-root.mjs +21 -41
  103. package/dist/field/field-root.mjs.map +1 -1
  104. package/dist/field/index.mjs +1 -1
  105. package/dist/field/use-server-error-visibility.mjs +44 -0
  106. package/dist/field/use-server-error-visibility.mjs.map +1 -0
  107. package/dist/form/form-root.d.mts.map +1 -1
  108. package/dist/form/form-root.mjs +6 -7
  109. package/dist/form/form-root.mjs.map +1 -1
  110. package/dist/form/form-submit.d.mts +1 -1
  111. package/dist/form/form-submit.mjs +4 -10
  112. package/dist/form/form-submit.mjs.map +1 -1
  113. package/dist/index.d.mts +4 -4
  114. package/dist/internal/anchor-position.mjs +1 -59
  115. package/dist/internal/anchor-position.mjs.map +1 -1
  116. package/dist/internal/announce.mjs.map +1 -1
  117. package/dist/internal/arrow-keys.mjs +21 -0
  118. package/dist/internal/arrow-keys.mjs.map +1 -0
  119. package/dist/internal/decimal.mjs +7 -1
  120. package/dist/internal/decimal.mjs.map +1 -1
  121. package/dist/internal/dom-order.mjs +17 -0
  122. package/dist/internal/dom-order.mjs.map +1 -0
  123. package/dist/internal/field-context.d.mts.map +1 -1
  124. package/dist/internal/field-context.mjs +11 -1
  125. package/dist/internal/field-context.mjs.map +1 -1
  126. package/dist/internal/focus-first-invalid.mjs +1 -1
  127. package/dist/internal/focus-first-invalid.mjs.map +1 -1
  128. package/dist/internal/group-member.mjs +37 -0
  129. package/dist/internal/group-member.mjs.map +1 -0
  130. package/dist/internal/overlay-popup.mjs +103 -0
  131. package/dist/internal/overlay-popup.mjs.map +1 -0
  132. package/dist/internal/popover-open.mjs +18 -0
  133. package/dist/internal/popover-open.mjs.map +1 -0
  134. package/dist/internal/render-element.d.mts +2 -0
  135. package/dist/internal/render-element.mjs +20 -2
  136. package/dist/internal/render-element.mjs.map +1 -1
  137. package/dist/internal/shipped-styles.mjs +14 -0
  138. package/dist/internal/shipped-styles.mjs.map +1 -0
  139. package/dist/internal/sync-presence.mjs +5 -1
  140. package/dist/internal/sync-presence.mjs.map +1 -1
  141. package/dist/internal/toolbar-context.mjs.map +1 -1
  142. package/dist/internal/tooltip-warm.mjs +1 -1
  143. package/dist/internal/tooltip-warm.mjs.map +1 -1
  144. package/dist/internal/transition-boundary.mjs +1 -1
  145. package/dist/internal/transition-boundary.mjs.map +1 -1
  146. package/dist/internal/types.d.mts +8 -6
  147. package/dist/internal/types.d.mts.map +1 -1
  148. package/dist/internal/use-action-trigger.mjs +5 -23
  149. package/dist/internal/use-action-trigger.mjs.map +1 -1
  150. package/dist/internal/use-checkable-input.mjs +79 -0
  151. package/dist/internal/use-checkable-input.mjs.map +1 -0
  152. package/dist/internal/use-controllable-action.mjs +16 -24
  153. package/dist/internal/use-controllable-action.mjs.map +1 -1
  154. package/dist/internal/use-dev-warning.mjs +8 -4
  155. package/dist/internal/use-dev-warning.mjs.map +1 -1
  156. package/dist/internal/use-element-check.mjs +39 -0
  157. package/dist/internal/use-element-check.mjs.map +1 -0
  158. package/dist/internal/use-exit-animation.mjs +1 -1
  159. package/dist/internal/use-exit-animation.mjs.map +1 -1
  160. package/dist/internal/use-field-control.mjs +28 -12
  161. package/dist/internal/use-field-control.mjs.map +1 -1
  162. package/dist/internal/use-fieldset-group.mjs +46 -0
  163. package/dist/internal/use-fieldset-group.mjs.map +1 -0
  164. package/dist/internal/use-form-reset.mjs +1 -5
  165. package/dist/internal/use-form-reset.mjs.map +1 -1
  166. package/dist/internal/use-item-order.mjs +42 -0
  167. package/dist/internal/use-item-order.mjs.map +1 -0
  168. package/dist/internal/use-latest.mjs +4 -8
  169. package/dist/internal/use-latest.mjs.map +1 -1
  170. package/dist/internal/use-merged-refs.mjs +19 -0
  171. package/dist/internal/use-merged-refs.mjs.map +1 -0
  172. package/dist/internal/use-name-warning.mjs +84 -0
  173. package/dist/internal/use-name-warning.mjs.map +1 -0
  174. package/dist/internal/use-native-checked.mjs +4 -6
  175. package/dist/internal/use-native-checked.mjs.map +1 -1
  176. package/dist/internal/use-native-focusgroup.mjs +19 -0
  177. package/dist/internal/use-native-focusgroup.mjs.map +1 -0
  178. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
  179. package/dist/internal/use-overlay-close.mjs +63 -0
  180. package/dist/internal/use-overlay-close.mjs.map +1 -0
  181. package/dist/internal/{use-popover-root.mjs → use-overlay-root.mjs} +28 -39
  182. package/dist/internal/use-overlay-root.mjs.map +1 -0
  183. package/dist/internal/use-popover-popup.mjs +32 -78
  184. package/dist/internal/use-popover-popup.mjs.map +1 -1
  185. package/dist/internal/use-popover-trigger.d.mts +15 -0
  186. package/dist/internal/use-popover-trigger.d.mts.map +1 -0
  187. package/dist/internal/use-popover-trigger.mjs +13 -17
  188. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  189. package/dist/internal/use-register-count.mjs +24 -0
  190. package/dist/internal/use-register-count.mjs.map +1 -0
  191. package/dist/internal/use-render.d.mts +2 -0
  192. package/dist/internal/use-render.mjs +2 -2
  193. package/dist/internal/use-render.mjs.map +1 -1
  194. package/dist/internal/use-resolved-placement.mjs +38 -22
  195. package/dist/internal/use-resolved-placement.mjs.map +1 -1
  196. package/dist/internal/use-roving-focus.mjs +5 -18
  197. package/dist/internal/use-roving-focus.mjs.map +1 -1
  198. package/dist/internal/use-superseded-rejection.mjs +47 -0
  199. package/dist/internal/use-superseded-rejection.mjs.map +1 -0
  200. package/dist/internal/validity.mjs +1 -13
  201. package/dist/internal/validity.mjs.map +1 -1
  202. package/dist/internal/value-set.mjs +41 -0
  203. package/dist/internal/value-set.mjs.map +1 -0
  204. package/dist/menu/index.d.mts +1 -1
  205. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  206. package/dist/menu/menu-context-trigger.d.mts +2 -7
  207. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  208. package/dist/menu/menu-context-trigger.mjs +10 -187
  209. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  210. package/dist/menu/menu-context.d.mts +1 -1
  211. package/dist/menu/menu-context.mjs +1 -1
  212. package/dist/menu/menu-context.mjs.map +1 -1
  213. package/dist/menu/menu-dom.mjs +1 -2
  214. package/dist/menu/menu-dom.mjs.map +1 -1
  215. package/dist/menu/menu-gestures.mjs +167 -0
  216. package/dist/menu/menu-gestures.mjs.map +1 -0
  217. package/dist/menu/menu-group.d.mts.map +1 -1
  218. package/dist/menu/menu-group.mjs +2 -1
  219. package/dist/menu/menu-group.mjs.map +1 -1
  220. package/dist/menu/menu-hover.mjs +0 -1
  221. package/dist/menu/menu-hover.mjs.map +1 -1
  222. package/dist/menu/menu-item.mjs.map +1 -1
  223. package/dist/menu/menu-outside.mjs +101 -0
  224. package/dist/menu/menu-outside.mjs.map +1 -0
  225. package/dist/menu/menu-point.mjs +85 -0
  226. package/dist/menu/menu-point.mjs.map +1 -0
  227. package/dist/menu/menu-popup.d.mts +6 -7
  228. package/dist/menu/menu-popup.d.mts.map +1 -1
  229. package/dist/menu/menu-popup.mjs +37 -248
  230. package/dist/menu/menu-popup.mjs.map +1 -1
  231. package/dist/menu/menu-radio-group.mjs.map +1 -1
  232. package/dist/menu/menu-root.d.mts +10 -0
  233. package/dist/menu/menu-root.d.mts.map +1 -1
  234. package/dist/menu/menu-root.mjs +10 -8
  235. package/dist/menu/menu-root.mjs.map +1 -1
  236. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  237. package/dist/menu/menu-submenu-trigger.mjs +6 -6
  238. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  239. package/dist/menu/menu-trigger.d.mts +4 -9
  240. package/dist/menu/menu-trigger.d.mts.map +1 -1
  241. package/dist/menu/menu-trigger.mjs +8 -6
  242. package/dist/menu/menu-trigger.mjs.map +1 -1
  243. package/dist/menu/use-menu-item.mjs +14 -16
  244. package/dist/menu/use-menu-item.mjs.map +1 -1
  245. package/dist/menu/use-menu-keyboard.mjs +88 -0
  246. package/dist/menu/use-menu-keyboard.mjs.map +1 -0
  247. package/dist/meter/meter-root.mjs +1 -1
  248. package/dist/number-field/index.d.mts +2 -1
  249. package/dist/number-field/index.d.mts.map +1 -1
  250. package/dist/number-field/index.mjs +2 -2
  251. package/dist/number-field/index.mjs.map +1 -1
  252. package/dist/number-field/number-field-arithmetic.mjs +30 -11
  253. package/dist/number-field/number-field-arithmetic.mjs.map +1 -1
  254. package/dist/number-field/number-field-context.d.mts +6 -1
  255. package/dist/number-field/number-field-context.d.mts.map +1 -0
  256. package/dist/number-field/number-field-context.mjs.map +1 -1
  257. package/dist/number-field/number-field-decrement.d.mts +1 -1
  258. package/dist/number-field/number-field-decrement.mjs +1 -1
  259. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  260. package/dist/number-field/number-field-increment.d.mts +2 -22
  261. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  262. package/dist/number-field/number-field-increment.mjs +2 -53
  263. package/dist/number-field/number-field-increment.mjs.map +1 -1
  264. package/dist/number-field/number-field-input.d.mts.map +1 -1
  265. package/dist/number-field/number-field-input.mjs +18 -22
  266. package/dist/number-field/number-field-input.mjs.map +1 -1
  267. package/dist/number-field/number-field-label.d.mts.map +1 -1
  268. package/dist/number-field/number-field-label.mjs +3 -9
  269. package/dist/number-field/number-field-label.mjs.map +1 -1
  270. package/dist/number-field/number-field-root.d.mts +2 -1
  271. package/dist/number-field/number-field-root.d.mts.map +1 -1
  272. package/dist/number-field/number-field-root.mjs +81 -91
  273. package/dist/number-field/number-field-root.mjs.map +1 -1
  274. package/dist/number-field/use-number-field-dev-warnings.mjs +28 -0
  275. package/dist/number-field/use-number-field-dev-warnings.mjs.map +1 -0
  276. package/dist/number-field/use-step-button.d.mts +24 -0
  277. package/dist/number-field/use-step-button.d.mts.map +1 -0
  278. package/dist/number-field/use-step-button.mjs +57 -3
  279. package/dist/number-field/use-step-button.mjs.map +1 -1
  280. package/dist/popover/popover-close.d.mts.map +1 -1
  281. package/dist/popover/popover-close.mjs +28 -67
  282. package/dist/popover/popover-close.mjs.map +1 -1
  283. package/dist/popover/popover-context.mjs.map +1 -1
  284. package/dist/popover/popover-popup.d.mts +9 -6
  285. package/dist/popover/popover-popup.d.mts.map +1 -1
  286. package/dist/popover/popover-popup.mjs +13 -36
  287. package/dist/popover/popover-popup.mjs.map +1 -1
  288. package/dist/popover/popover-root.mjs +4 -3
  289. package/dist/popover/popover-root.mjs.map +1 -1
  290. package/dist/popover/popover-trigger.d.mts +4 -8
  291. package/dist/popover/popover-trigger.d.mts.map +1 -1
  292. package/dist/popover/popover-trigger.mjs +2 -1
  293. package/dist/popover/popover-trigger.mjs.map +1 -1
  294. package/dist/progress/progress-root.mjs +1 -1
  295. package/dist/radio-group/radio-group-context.mjs.map +1 -1
  296. package/dist/radio-group/radio-group-item.d.mts +3 -4
  297. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  298. package/dist/radio-group/radio-group-item.mjs +20 -25
  299. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  300. package/dist/radio-group/radio-group-label.mjs +1 -6
  301. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  302. package/dist/radio-group/radio-group-root.d.mts +1 -1
  303. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  304. package/dist/radio-group/radio-group-root.mjs +21 -40
  305. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  306. package/dist/select/select-dom.mjs +9 -18
  307. package/dist/select/select-dom.mjs.map +1 -1
  308. package/dist/select/select-option.mjs +1 -1
  309. package/dist/select/select-root.mjs +3 -2
  310. package/dist/select/select-root.mjs.map +1 -1
  311. package/dist/slider/slider-arithmetic.mjs +74 -13
  312. package/dist/slider/slider-arithmetic.mjs.map +1 -1
  313. package/dist/slider/slider-context.mjs.map +1 -1
  314. package/dist/slider/slider-label.d.mts.map +1 -1
  315. package/dist/slider/slider-label.mjs +3 -9
  316. package/dist/slider/slider-label.mjs.map +1 -1
  317. package/dist/slider/slider-root.d.mts +2 -2
  318. package/dist/slider/slider-root.d.mts.map +1 -1
  319. package/dist/slider/slider-root.mjs +36 -116
  320. package/dist/slider/slider-root.mjs.map +1 -1
  321. package/dist/slider/slider-thumb.d.mts.map +1 -1
  322. package/dist/slider/slider-thumb.mjs +8 -6
  323. package/dist/slider/slider-thumb.mjs.map +1 -1
  324. package/dist/slider/slider-value.d.mts.map +1 -1
  325. package/dist/slider/slider-value.mjs +2 -1
  326. package/dist/slider/slider-value.mjs.map +1 -1
  327. package/dist/slider/use-slider-dev-warnings.mjs +29 -0
  328. package/dist/slider/use-slider-dev-warnings.mjs.map +1 -0
  329. package/dist/slider/use-thumb-registry.mjs +51 -0
  330. package/dist/slider/use-thumb-registry.mjs.map +1 -0
  331. package/dist/switch/switch.d.mts +4 -5
  332. package/dist/switch/switch.d.mts.map +1 -1
  333. package/dist/switch/switch.mjs +15 -55
  334. package/dist/switch/switch.mjs.map +1 -1
  335. package/dist/tabs/tabs-context.d.mts +2 -3
  336. package/dist/tabs/tabs-context.d.mts.map +1 -1
  337. package/dist/tabs/tabs-context.mjs.map +1 -1
  338. package/dist/tabs/tabs-list.d.mts.map +1 -1
  339. package/dist/tabs/tabs-list.mjs +9 -22
  340. package/dist/tabs/tabs-list.mjs.map +1 -1
  341. package/dist/tabs/tabs-panel.d.mts +3 -4
  342. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  343. package/dist/tabs/tabs-panel.mjs.map +1 -1
  344. package/dist/tabs/tabs-root.d.mts +4 -3
  345. package/dist/tabs/tabs-root.d.mts.map +1 -1
  346. package/dist/tabs/tabs-root.mjs +2 -1
  347. package/dist/tabs/tabs-root.mjs.map +1 -1
  348. package/dist/tabs/tabs-tab.d.mts +3 -4
  349. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  350. package/dist/tabs/tabs-tab.mjs.map +1 -1
  351. package/dist/toast/toast-action.mjs.map +1 -1
  352. package/dist/toast/toast-close.d.mts.map +1 -1
  353. package/dist/toast/toast-close.mjs +2 -8
  354. package/dist/toast/toast-close.mjs.map +1 -1
  355. package/dist/toast/toast-context.mjs.map +1 -1
  356. package/dist/toast/toast-hotkey.mjs +27 -0
  357. package/dist/toast/toast-hotkey.mjs.map +1 -0
  358. package/dist/toast/toast-queue.mjs +137 -0
  359. package/dist/toast/toast-queue.mjs.map +1 -0
  360. package/dist/toast/toast-timers.mjs +65 -0
  361. package/dist/toast/toast-timers.mjs.map +1 -0
  362. package/dist/toast/toast-viewport.d.mts.map +1 -1
  363. package/dist/toast/toast-viewport.mjs +30 -235
  364. package/dist/toast/toast-viewport.mjs.map +1 -1
  365. package/dist/toast/toast.mjs +1 -1
  366. package/dist/toast/toast.mjs.map +1 -1
  367. package/dist/toast/use-modal-portal-host.mjs +52 -0
  368. package/dist/toast/use-modal-portal-host.mjs.map +1 -0
  369. package/dist/toggle/toggle.d.mts +3 -4
  370. package/dist/toggle/toggle.d.mts.map +1 -1
  371. package/dist/toggle/toggle.mjs +7 -10
  372. package/dist/toggle/toggle.mjs.map +1 -1
  373. package/dist/toggle-group/toggle-group-context.d.mts +2 -1
  374. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  375. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  376. package/dist/toggle-group/toggle-group-item.d.mts +5 -3
  377. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  378. package/dist/toggle-group/toggle-group-item.mjs +5 -7
  379. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  380. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  381. package/dist/toggle-group/toggle-group-root.mjs +29 -64
  382. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  383. package/dist/toolbar/toolbar-root.d.mts +2 -2
  384. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  385. package/dist/toolbar/toolbar-root.mjs +3 -4
  386. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  387. package/dist/tooltip/tooltip-context.d.mts +1 -1
  388. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  389. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  390. package/dist/tooltip/tooltip-popup.mjs +6 -15
  391. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  392. package/dist/tooltip/tooltip-root.mjs +2 -2
  393. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  394. package/dist/tooltip/tooltip-trigger.d.mts +2 -1
  395. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  396. package/dist/tooltip/tooltip-trigger.mjs +3 -2
  397. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  398. package/dist/tooltip/use-tooltip-interaction.mjs +4 -3
  399. package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
  400. package/package.json +3 -2
  401. package/dist/accordion/accordion-context.d.mts +0 -5
  402. package/dist/accordion/accordion-context.d.mts.map +0 -1
  403. package/dist/internal/use-popover-root.mjs.map +0 -1
  404. /package/dist/internal/{use-popover-root.d.mts → use-overlay-root.d.mts} +0 -0
@@ -1,7 +1,6 @@
1
- import { decimalsOf, roundTo } from "../internal/decimal.mjs";
1
+ import { EPSILON, gridDecimals, roundTo } from "../internal/decimal.mjs";
2
+ import { clamp, percentage } from "../internal/range-value.mjs";
2
3
  //#region src/slider/slider-arithmetic.ts
3
- /** Tolerance for grid computations on binary floating point (`0.3 / 0.1` is `2.9999999999999996`). */
4
- const EPSILON = 1e-9;
5
4
  /**
6
5
  * The value a native range with these bounds would hold for `value`: snapped to
7
6
  * `min + n × step` (ties toward +∞, the HTML step-mismatch rule), clamped to `[min, max]`, and,
@@ -10,7 +9,7 @@ const EPSILON = 1e-9;
10
9
  * platform's maximum is `min`.
11
10
  */
12
11
  function snap(value, min, max, step) {
13
- const decimals = Math.max(decimalsOf(step), decimalsOf(min));
12
+ const decimals = gridDecimals(step, min);
14
13
  if (!Number.isFinite(value)) return min;
15
14
  if (!(max > min)) return roundTo(min, decimals);
16
15
  const lastIndex = Math.floor((max - min) / step + EPSILON);
@@ -31,7 +30,7 @@ function isOnGrid(value, min, max, step) {
31
30
  }
32
31
  /** The native `min` / `max` of thumb `index`: the slider's bounds, narrowed by its neighbours. */
33
32
  function thumbBounds(values, index, min, max, gap) {
34
- const decimals = Math.max(decimalsOf(gap), decimalsOf(min));
33
+ const decimals = gridDecimals(gap, min);
35
34
  const before = values[index - 1];
36
35
  const after = values[index + 1];
37
36
  return {
@@ -47,7 +46,7 @@ function thumbBounds(values, index, min, max, gap) {
47
46
  function clampToNeighbours(values, index, next, min, max, step, gap) {
48
47
  const { lower, upper } = thumbBounds(values, index, min, max, gap);
49
48
  const current = values[index] ?? next;
50
- if (lower > upper + EPSILON) return current;
49
+ if (lower > upper + 1e-9) return current;
51
50
  return Math.min(Math.max(snap(next, min, max, step), lower), upper);
52
51
  }
53
52
  /**
@@ -64,9 +63,7 @@ function sanitize(values, reference, min, max, step, gap) {
64
63
  }
65
64
  /** Position of `value` in `[min, max]`, in percent, clamped to `0`–`100`. */
66
65
  function percent(value, min, max) {
67
- if (!(max > min)) return 0;
68
- const fraction = (value - min) / (max - min);
69
- return Math.min(100, Math.max(0, fraction * 100));
66
+ return clamp(percentage(value, min, max), 0, 100);
70
67
  }
71
68
  /**
72
69
  * The thumb a track press at `target` moves: the nearest by value. On a tie (two thumbs at one
@@ -78,10 +75,10 @@ function nearestThumb(values, target) {
78
75
  let bestDistance = Number.POSITIVE_INFINITY;
79
76
  values.forEach((value, index) => {
80
77
  const distance = Math.abs(value - target);
81
- if (distance < bestDistance - EPSILON) {
78
+ if (distance < bestDistance - 1e-9) {
82
79
  best = index;
83
80
  bestDistance = distance;
84
- } else if (Math.abs(distance - bestDistance) <= EPSILON && target > value) best = index;
81
+ } else if (Math.abs(distance - bestDistance) <= 1e-9 && target > value) best = index;
85
82
  });
86
83
  return best;
87
84
  }
@@ -95,10 +92,74 @@ function equalValues(a, b) {
95
92
  if (a.length !== b.length) return false;
96
93
  return a.every((value, index) => {
97
94
  const other = b[index];
98
- return value === other || Math.abs(value - other) < EPSILON * Math.max(1, Math.abs(value));
95
+ return value === other || Math.abs(value - other) < 1e-9 * Math.max(1, Math.abs(value));
99
96
  });
100
97
  }
98
+ /**
99
+ * The value under a pointer at `(clientX, clientY)` on a track occupying `rect` (design 4.1):
100
+ * left to right (right to left with `rtl`), or bottom to top when vertical, clamped to the track
101
+ * and mapped linearly onto `[min, max]`. Not snapped. An empty track maps to `min` (`max` in RTL).
102
+ */
103
+ function pointerValue(rect, clientX, clientY, orientation, rtl, min, max) {
104
+ let fraction;
105
+ if (orientation === "vertical") fraction = rect.height > 0 ? (rect.bottom - clientY) / rect.height : 0;
106
+ else {
107
+ fraction = rect.width > 0 ? (clientX - rect.left) / rect.width : 0;
108
+ if (rtl) fraction = 1 - fraction;
109
+ }
110
+ fraction = Math.min(1, Math.max(0, fraction));
111
+ return min + fraction * (max - min);
112
+ }
113
+ /** The run of thumbs sharing thumb `index`'s value, or `null` when it shares it with none. */
114
+ function tiedRange(values, index) {
115
+ const at = values[index];
116
+ if (at === void 0) return null;
117
+ let first = index;
118
+ let last = index;
119
+ while (first > 0 && equalValues([values[first - 1]], [at])) first -= 1;
120
+ while (last < values.length - 1 && equalValues([values[last + 1]], [at])) last += 1;
121
+ return first !== last ? {
122
+ first,
123
+ last,
124
+ at
125
+ } : null;
126
+ }
127
+ /**
128
+ * Which of the stacked thumbs a pointer at `raw` moves: the one that can go toward it (the last
129
+ * above the shared value, the first below). `null` exactly on the value (or with no tie).
130
+ */
131
+ function resolveTie(tied, raw) {
132
+ if (tied === null) return null;
133
+ if (raw > tied.at) return tied.last;
134
+ if (raw < tied.at) return tied.first;
135
+ return null;
136
+ }
137
+ /**
138
+ * The Root's geometry custom properties (design 3.1): `--slider-start` (the first thumb with
139
+ * several, else `0%`), `--slider-end` (the last thumb) and `--slider-value-<i>`, in percent.
140
+ */
141
+ function sliderGeometry(shown, min, max) {
142
+ const count = shown.length;
143
+ const percents = shown.map((v) => percent(v, min, max));
144
+ const geometry = {
145
+ "--slider-start": count > 1 ? `${percents[0] ?? 0}%` : "0%",
146
+ "--slider-end": `${percents[count - 1] ?? 0}%`
147
+ };
148
+ percents.forEach((p, index) => {
149
+ geometry[`--slider-value-${index}`] = `${p}%`;
150
+ });
151
+ return geometry;
152
+ }
153
+ /** A Slider value as an array, one entry per thumb. */
154
+ function toArray(value) {
155
+ return typeof value === "number" ? [value] : value;
156
+ }
157
+ /** The shape of a Slider value (fixed at mount, design 3.1). */
158
+ function shapeOf(value) {
159
+ if (value === void 0) return void 0;
160
+ return typeof value === "number" ? "number" : "array";
161
+ }
101
162
  //#endregion
102
- export { clampToNeighbours, decimalsOf, equalValues, isMaxReachable, isOnGrid, nearestThumb, percent, platformDefault, sanitize, snap, thumbBounds };
163
+ export { clampToNeighbours, equalValues, isMaxReachable, isOnGrid, nearestThumb, percent, platformDefault, pointerValue, resolveTie, sanitize, shapeOf, sliderGeometry, snap, thumbBounds, tiedRange, toArray };
103
164
 
104
165
  //# sourceMappingURL=slider-arithmetic.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"slider-arithmetic.mjs","names":[],"sources":["../../src/slider/slider-arithmetic.ts"],"sourcesContent":["// Pure value arithmetic of the Slider (design/components/slider.md 5). No directive: no React,\n// no client-only API. The library computes exactly what the platform's range sanitisation would,\n// so the number it renders is the number the DOM holds and `FormData` posts.\n\nimport { decimalsOf, roundTo } from \"../internal/decimal.js\";\n\nexport { decimalsOf };\n\n/** Tolerance for grid computations on binary floating point (`0.3 / 0.1` is `2.9999999999999996`). */\nconst EPSILON = 1e-9;\n\n/**\n * The value a native range with these bounds would hold for `value`: snapped to\n * `min + n × step` (ties toward +∞, the HTML step-mismatch rule), clamped to `[min, max]`, and,\n * when the snapped value exceeds `max`, the last grid point below `max` (so `min 0, max 5,\n * step 2` caps at `4`). Rounded to the decimal places of `step` and `min`. With `max < min` the\n * platform's maximum is `min`.\n */\nexport function snap(value: number, min: number, max: number, step: number): number {\n const decimals = Math.max(decimalsOf(step), decimalsOf(min));\n if (!Number.isFinite(value)) return min;\n if (!(max > min)) return roundTo(min, decimals);\n const lastIndex = Math.floor((max - min) / step + EPSILON);\n let index = Math.floor((value - min) / step + 0.5 + EPSILON);\n if (index > lastIndex) index = lastIndex;\n if (index < 0) index = 0;\n return roundTo(min + index * step, decimals);\n}\n\n/** Whether `max` is reachable: `max - min` is a whole number of steps. */\nexport function isMaxReachable(min: number, max: number, step: number): boolean {\n if (!(max > min)) return true;\n const steps = (max - min) / step;\n return Math.abs(steps - Math.round(steps)) < EPSILON * Math.max(1, steps);\n}\n\n/** Whether `value` is a value a native range with these bounds can hold unchanged. */\nexport function isOnGrid(value: number, min: number, max: number, step: number): boolean {\n return Math.abs(snap(value, min, max, step) - value) < EPSILON * Math.max(1, Math.abs(value));\n}\n\n/** The native `min` / `max` of thumb `index`: the slider's bounds, narrowed by its neighbours. */\nexport function thumbBounds(\n values: readonly number[],\n index: number,\n min: number,\n max: number,\n gap: number,\n): { readonly lower: number; readonly upper: number } {\n const decimals = Math.max(decimalsOf(gap), decimalsOf(min));\n const before = values[index - 1];\n const after = values[index + 1];\n const lower = before === undefined ? min : roundTo(before + gap, decimals);\n const upper = after === undefined ? max : roundTo(after - gap, decimals);\n return { lower, upper };\n}\n\n/**\n * `next` for thumb `index`, snapped to the slider's grid and clamped between its neighbours\n * (`values[i - 1] + gap`, `values[i + 1] - gap`; on the grid, because every thumb shares `step`\n * and `min`). With no room between the neighbours the thumb keeps its value.\n */\nexport function clampToNeighbours(\n values: readonly number[],\n index: number,\n next: number,\n min: number,\n max: number,\n step: number,\n gap: number,\n): number {\n const { lower, upper } = thumbBounds(values, index, min, max, gap);\n const current = values[index] ?? next;\n if (lower > upper + EPSILON) return current;\n return Math.min(Math.max(snap(next, min, max, step), lower), upper);\n}\n\n/**\n * The value a native input with these attributes would hold for `value` (each thumb's bounds come\n * from `reference`, the values it is rendered against). Used to compare a DOM read with the shown\n * value: jsdom does not sanitise a range's value, browsers do, and a consumer's off-grid value is\n * rendered as given and sanitised by the DOM.\n */\nexport function sanitize(\n values: readonly number[],\n reference: readonly number[],\n min: number,\n max: number,\n step: number,\n gap: number,\n): readonly number[] {\n return values.map((value, index) => {\n const { lower, upper } = thumbBounds(reference, index, min, max, gap);\n // The native step base is the input's own `min` attribute (the neighbour-adjusted bound).\n return snap(value, lower, Math.max(lower, upper), step);\n });\n}\n\n/** Position of `value` in `[min, max]`, in percent, clamped to `0`–`100`. */\nexport function percent(value: number, min: number, max: number): number {\n if (!(max > min)) return 0;\n const fraction = (value - min) / (max - min);\n return Math.min(100, Math.max(0, fraction * 100));\n}\n\n/**\n * The thumb a track press at `target` moves: the nearest by value. On a tie (two thumbs at one\n * value, or equidistant thumbs) the thumb that can move toward the pointer: the later one when\n * the pointer is above it, else the earlier one.\n */\nexport function nearestThumb(values: readonly number[], target: number): number {\n let best = 0;\n let bestDistance = Number.POSITIVE_INFINITY;\n values.forEach((value, index) => {\n const distance = Math.abs(value - target);\n if (distance < bestDistance - EPSILON) {\n best = index;\n bestDistance = distance;\n } else if (Math.abs(distance - bestDistance) <= EPSILON && target > value) {\n best = index;\n }\n });\n return best;\n}\n\n/** The platform's default value: the midpoint, snapped to the grid; `min` when `max < min`. */\nexport function platformDefault(min: number, max: number, step: number): number {\n if (!(max > min)) return min;\n return snap(min + (max - min) / 2, min, max, step);\n}\n\n/** Element-wise equality of two value arrays (within floating-point tolerance). */\nexport function equalValues(a: readonly number[], b: readonly number[]): boolean {\n if (a.length !== b.length) return false;\n return a.every((value, index) => {\n const other = b[index] as number;\n return value === other || Math.abs(value - other) < EPSILON * Math.max(1, Math.abs(value));\n });\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"slider-arithmetic.mjs","names":[],"sources":["../../src/slider/slider-arithmetic.ts"],"sourcesContent":["// Pure value arithmetic of the Slider (design/components/slider.md 5). No directive: no React,\n// no client-only API. The library computes exactly what the platform's range sanitisation would,\n// so the number it renders is the number the DOM holds and `FormData` posts.\n\nimport { EPSILON, gridDecimals, roundTo } from \"../internal/decimal.js\";\nimport { clamp, percentage } from \"../internal/range-value.js\";\nimport type { Orientation } from \"../internal/types.js\";\n\n/**\n * The value a native range with these bounds would hold for `value`: snapped to\n * `min + n × step` (ties toward +∞, the HTML step-mismatch rule), clamped to `[min, max]`, and,\n * when the snapped value exceeds `max`, the last grid point below `max` (so `min 0, max 5,\n * step 2` caps at `4`). Rounded to the decimal places of `step` and `min`. With `max < min` the\n * platform's maximum is `min`.\n */\nexport function snap(value: number, min: number, max: number, step: number): number {\n const decimals = gridDecimals(step, min);\n if (!Number.isFinite(value)) return min;\n if (!(max > min)) return roundTo(min, decimals);\n const lastIndex = Math.floor((max - min) / step + EPSILON);\n let index = Math.floor((value - min) / step + 0.5 + EPSILON);\n if (index > lastIndex) index = lastIndex;\n if (index < 0) index = 0;\n return roundTo(min + index * step, decimals);\n}\n\n/** Whether `max` is reachable: `max - min` is a whole number of steps. */\nexport function isMaxReachable(min: number, max: number, step: number): boolean {\n if (!(max > min)) return true;\n const steps = (max - min) / step;\n return Math.abs(steps - Math.round(steps)) < EPSILON * Math.max(1, steps);\n}\n\n/** Whether `value` is a value a native range with these bounds can hold unchanged. */\nexport function isOnGrid(value: number, min: number, max: number, step: number): boolean {\n return Math.abs(snap(value, min, max, step) - value) < EPSILON * Math.max(1, Math.abs(value));\n}\n\n/** The native `min` / `max` of thumb `index`: the slider's bounds, narrowed by its neighbours. */\nexport function thumbBounds(\n values: readonly number[],\n index: number,\n min: number,\n max: number,\n gap: number,\n): { readonly lower: number; readonly upper: number } {\n const decimals = gridDecimals(gap, min);\n const before = values[index - 1];\n const after = values[index + 1];\n const lower = before === undefined ? min : roundTo(before + gap, decimals);\n const upper = after === undefined ? max : roundTo(after - gap, decimals);\n return { lower, upper };\n}\n\n/**\n * `next` for thumb `index`, snapped to the slider's grid and clamped between its neighbours\n * (`values[i - 1] + gap`, `values[i + 1] - gap`; on the grid, because every thumb shares `step`\n * and `min`). With no room between the neighbours the thumb keeps its value.\n */\nexport function clampToNeighbours(\n values: readonly number[],\n index: number,\n next: number,\n min: number,\n max: number,\n step: number,\n gap: number,\n): number {\n const { lower, upper } = thumbBounds(values, index, min, max, gap);\n const current = values[index] ?? next;\n if (lower > upper + EPSILON) return current;\n return Math.min(Math.max(snap(next, min, max, step), lower), upper);\n}\n\n/**\n * The value a native input with these attributes would hold for `value` (each thumb's bounds come\n * from `reference`, the values it is rendered against). Used to compare a DOM read with the shown\n * value: jsdom does not sanitise a range's value, browsers do, and a consumer's off-grid value is\n * rendered as given and sanitised by the DOM.\n */\nexport function sanitize(\n values: readonly number[],\n reference: readonly number[],\n min: number,\n max: number,\n step: number,\n gap: number,\n): readonly number[] {\n return values.map((value, index) => {\n const { lower, upper } = thumbBounds(reference, index, min, max, gap);\n // The native step base is the input's own `min` attribute (the neighbour-adjusted bound).\n return snap(value, lower, Math.max(lower, upper), step);\n });\n}\n\n/** Position of `value` in `[min, max]`, in percent, clamped to `0`–`100`. */\nexport function percent(value: number, min: number, max: number): number {\n return clamp(percentage(value, min, max), 0, 100);\n}\n\n/**\n * The thumb a track press at `target` moves: the nearest by value. On a tie (two thumbs at one\n * value, or equidistant thumbs) the thumb that can move toward the pointer: the later one when\n * the pointer is above it, else the earlier one.\n */\nexport function nearestThumb(values: readonly number[], target: number): number {\n let best = 0;\n let bestDistance = Number.POSITIVE_INFINITY;\n values.forEach((value, index) => {\n const distance = Math.abs(value - target);\n if (distance < bestDistance - EPSILON) {\n best = index;\n bestDistance = distance;\n } else if (Math.abs(distance - bestDistance) <= EPSILON && target > value) {\n best = index;\n }\n });\n return best;\n}\n\n/** The platform's default value: the midpoint, snapped to the grid; `min` when `max < min`. */\nexport function platformDefault(min: number, max: number, step: number): number {\n if (!(max > min)) return min;\n return snap(min + (max - min) / 2, min, max, step);\n}\n\n/** Element-wise equality of two value arrays (within floating-point tolerance). */\nexport function equalValues(a: readonly number[], b: readonly number[]): boolean {\n if (a.length !== b.length) return false;\n return a.every((value, index) => {\n const other = b[index] as number;\n return value === other || Math.abs(value - other) < EPSILON * Math.max(1, Math.abs(value));\n });\n}\n\n/** The part of `DOMRect` a pointer position is mapped through. */\nexport interface TrackRect {\n readonly left: number;\n readonly bottom: number;\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * The value under a pointer at `(clientX, clientY)` on a track occupying `rect` (design 4.1):\n * left to right (right to left with `rtl`), or bottom to top when vertical, clamped to the track\n * and mapped linearly onto `[min, max]`. Not snapped. An empty track maps to `min` (`max` in RTL).\n */\nexport function pointerValue(\n rect: TrackRect,\n clientX: number,\n clientY: number,\n orientation: Orientation,\n rtl: boolean,\n min: number,\n max: number,\n): number {\n let fraction: number;\n if (orientation === \"vertical\") {\n fraction = rect.height > 0 ? (rect.bottom - clientY) / rect.height : 0;\n } else {\n fraction = rect.width > 0 ? (clientX - rect.left) / rect.width : 0;\n if (rtl) fraction = 1 - fraction;\n }\n fraction = Math.min(1, Math.max(0, fraction));\n return min + fraction * (max - min);\n}\n\n/** Stacked thumbs: the thumbs `first`..`last` all hold the value `at`. */\nexport interface TiedThumbs {\n readonly first: number;\n readonly last: number;\n readonly at: number;\n}\n\n/** The run of thumbs sharing thumb `index`'s value, or `null` when it shares it with none. */\nexport function tiedRange(values: readonly number[], index: number): TiedThumbs | null {\n const at = values[index];\n if (at === undefined) return null;\n let first = index;\n let last = index;\n while (first > 0 && equalValues([values[first - 1] as number], [at])) first -= 1;\n while (last < values.length - 1 && equalValues([values[last + 1] as number], [at])) last += 1;\n return first !== last ? { first, last, at } : null;\n}\n\n/**\n * Which of the stacked thumbs a pointer at `raw` moves: the one that can go toward it (the last\n * above the shared value, the first below). `null` exactly on the value (or with no tie).\n */\nexport function resolveTie(tied: TiedThumbs | null, raw: number): number | null {\n if (tied === null) return null;\n if (raw > tied.at) return tied.last;\n if (raw < tied.at) return tied.first;\n return null;\n}\n\n/**\n * The Root's geometry custom properties (design 3.1): `--slider-start` (the first thumb with\n * several, else `0%`), `--slider-end` (the last thumb) and `--slider-value-<i>`, in percent.\n */\nexport function sliderGeometry(\n shown: readonly number[],\n min: number,\n max: number,\n): Record<string, string> {\n const count = shown.length;\n const percents = shown.map((v) => percent(v, min, max));\n const geometry: Record<string, string> = {\n \"--slider-start\": count > 1 ? `${percents[0] ?? 0}%` : \"0%\",\n \"--slider-end\": `${percents[count - 1] ?? 0}%`,\n };\n percents.forEach((p, index) => {\n geometry[`--slider-value-${index}`] = `${p}%`;\n });\n return geometry;\n}\n\n/** A Slider value as an array, one entry per thumb. */\nexport function toArray(value: number | readonly number[]): readonly number[] {\n return typeof value === \"number\" ? [value] : value;\n}\n\n/** The shape of a Slider value (fixed at mount, design 3.1). */\nexport function shapeOf(\n value: number | readonly number[] | undefined,\n): \"number\" | \"array\" | undefined {\n if (value === undefined) return undefined;\n return typeof value === \"number\" ? \"number\" : \"array\";\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgB,KAAK,OAAe,KAAa,KAAa,MAAsB;CAClF,MAAM,WAAW,aAAa,MAAM,GAAG;CACvC,IAAI,CAAC,OAAO,SAAS,KAAK,GAAG,OAAO;CACpC,IAAI,EAAE,MAAM,MAAM,OAAO,QAAQ,KAAK,QAAQ;CAC9C,MAAM,YAAY,KAAK,OAAO,MAAM,OAAO,OAAO,OAAO;CACzD,IAAI,QAAQ,KAAK,OAAO,QAAQ,OAAO,OAAO,KAAM,OAAO;CAC3D,IAAI,QAAQ,WAAW,QAAQ;CAC/B,IAAI,QAAQ,GAAG,QAAQ;CACvB,OAAO,QAAQ,MAAM,QAAQ,MAAM,QAAQ;AAC7C;;AAGA,SAAgB,eAAe,KAAa,KAAa,MAAuB;CAC9E,IAAI,EAAE,MAAM,MAAM,OAAO;CACzB,MAAM,SAAS,MAAM,OAAO;CAC5B,OAAO,KAAK,IAAI,QAAQ,KAAK,MAAM,KAAK,CAAC,IAAI,UAAU,KAAK,IAAI,GAAG,KAAK;AAC1E;;AAGA,SAAgB,SAAS,OAAe,KAAa,KAAa,MAAuB;CACvF,OAAO,KAAK,IAAI,KAAK,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,IAAI,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,CAAC;AAC9F;;AAGA,SAAgB,YACd,QACA,OACA,KACA,KACA,KACoD;CACpD,MAAM,WAAW,aAAa,KAAK,GAAG;CACtC,MAAM,SAAS,OAAO,QAAQ;CAC9B,MAAM,QAAQ,OAAO,QAAQ;CAG7B,OAAO;EAAE,OAFK,WAAW,KAAA,IAAY,MAAM,QAAQ,SAAS,KAAK,QAAQ;EAEzD,OADF,UAAU,KAAA,IAAY,MAAM,QAAQ,QAAQ,KAAK,QAAQ;CACjD;AACxB;;;;;;AAOA,SAAgB,kBACd,QACA,OACA,MACA,KACA,KACA,MACA,KACQ;CACR,MAAM,EAAE,OAAO,UAAU,YAAY,QAAQ,OAAO,KAAK,KAAK,GAAG;CACjE,MAAM,UAAU,OAAO,UAAU;CACjC,IAAI,QAAQ,QAAA,MAAiB,OAAO;CACpC,OAAO,KAAK,IAAI,KAAK,IAAI,KAAK,MAAM,KAAK,KAAK,IAAI,GAAG,KAAK,GAAG,KAAK;AACpE;;;;;;;AAQA,SAAgB,SACd,QACA,WACA,KACA,KACA,MACA,KACmB;CACnB,OAAO,OAAO,KAAK,OAAO,UAAU;EAClC,MAAM,EAAE,OAAO,UAAU,YAAY,WAAW,OAAO,KAAK,KAAK,GAAG;EAEpE,OAAO,KAAK,OAAO,OAAO,KAAK,IAAI,OAAO,KAAK,GAAG,IAAI;CACxD,CAAC;AACH;;AAGA,SAAgB,QAAQ,OAAe,KAAa,KAAqB;CACvE,OAAO,MAAM,WAAW,OAAO,KAAK,GAAG,GAAG,GAAG,GAAG;AAClD;;;;;;AAOA,SAAgB,aAAa,QAA2B,QAAwB;CAC9E,IAAI,OAAO;CACX,IAAI,eAAe,OAAO;CAC1B,OAAO,SAAS,OAAO,UAAU;EAC/B,MAAM,WAAW,KAAK,IAAI,QAAQ,MAAM;EACxC,IAAI,WAAW,eAAA,MAAwB;GACrC,OAAO;GACP,eAAe;EACjB,OAAO,IAAI,KAAK,IAAI,WAAW,YAAY,KAAA,QAAgB,SAAS,OAClE,OAAO;CAEX,CAAC;CACD,OAAO;AACT;;AAGA,SAAgB,gBAAgB,KAAa,KAAa,MAAsB;CAC9E,IAAI,EAAE,MAAM,MAAM,OAAO;CACzB,OAAO,KAAK,OAAO,MAAM,OAAO,GAAG,KAAK,KAAK,IAAI;AACnD;;AAGA,SAAgB,YAAY,GAAsB,GAA+B;CAC/E,IAAI,EAAE,WAAW,EAAE,QAAQ,OAAO;CAClC,OAAO,EAAE,OAAO,OAAO,UAAU;EAC/B,MAAM,QAAQ,EAAE;EAChB,OAAO,UAAU,SAAS,KAAK,IAAI,QAAQ,KAAK,IAAA,OAAc,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,CAAC;CAC3F,CAAC;AACH;;;;;;AAeA,SAAgB,aACd,MACA,SACA,SACA,aACA,KACA,KACA,KACQ;CACR,IAAI;CACJ,IAAI,gBAAgB,YAClB,WAAW,KAAK,SAAS,KAAK,KAAK,SAAS,WAAW,KAAK,SAAS;MAChE;EACL,WAAW,KAAK,QAAQ,KAAK,UAAU,KAAK,QAAQ,KAAK,QAAQ;EACjE,IAAI,KAAK,WAAW,IAAI;CAC1B;CACA,WAAW,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,QAAQ,CAAC;CAC5C,OAAO,MAAM,YAAY,MAAM;AACjC;;AAUA,SAAgB,UAAU,QAA2B,OAAkC;CACrF,MAAM,KAAK,OAAO;CAClB,IAAI,OAAO,KAAA,GAAW,OAAO;CAC7B,IAAI,QAAQ;CACZ,IAAI,OAAO;CACX,OAAO,QAAQ,KAAK,YAAY,CAAC,OAAO,QAAQ,EAAY,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS;CAC/E,OAAO,OAAO,OAAO,SAAS,KAAK,YAAY,CAAC,OAAO,OAAO,EAAY,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ;CAC5F,OAAO,UAAU,OAAO;EAAE;EAAO;EAAM;CAAG,IAAI;AAChD;;;;;AAMA,SAAgB,WAAW,MAAyB,KAA4B;CAC9E,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI,MAAM,KAAK,IAAI,OAAO,KAAK;CAC/B,IAAI,MAAM,KAAK,IAAI,OAAO,KAAK;CAC/B,OAAO;AACT;;;;;AAMA,SAAgB,eACd,OACA,KACA,KACwB;CACxB,MAAM,QAAQ,MAAM;CACpB,MAAM,WAAW,MAAM,KAAK,MAAM,QAAQ,GAAG,KAAK,GAAG,CAAC;CACtD,MAAM,WAAmC;EACvC,kBAAkB,QAAQ,IAAI,GAAG,SAAS,MAAM,EAAE,KAAK;EACvD,gBAAgB,GAAG,SAAS,QAAQ,MAAM,EAAE;CAC9C;CACA,SAAS,SAAS,GAAG,UAAU;EAC7B,SAAS,kBAAkB,WAAW,GAAG,EAAE;CAC7C,CAAC;CACD,OAAO;AACT;;AAGA,SAAgB,QAAQ,OAAsD;CAC5E,OAAO,OAAO,UAAU,WAAW,CAAC,KAAK,IAAI;AAC/C;;AAGA,SAAgB,QACd,OACgC;CAChC,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,OAAO,OAAO,UAAU,WAAW,WAAW;AAChD"}
@@ -1 +1 @@
1
- {"version":3,"file":"slider-context.mjs","names":[],"sources":["../../src/slider/slider-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { RefCallback, RefObject } from \"react\";\nimport type { SliderOrientation, SliderRootState, SliderValue } from \"./slider-root.js\";\n\n/** What the Root routes from an enclosing `Field.Root` to its Thumbs (design 9.4.1). */\nexport interface SliderFieldWiring {\n /** One thumb only: Thumb `index` 0 merges it into its input ref (registers the input). */\n readonly inputRef: RefCallback<HTMLElement> | undefined;\n /** One thumb only: token-merged into Thumb 0's input `aria-describedby`. */\n readonly describedBy: string | undefined;\n /** On every Thumb's input (ARIA 1.2: never on the group element). */\n readonly invalid: \"true\" | \"false\" | undefined;\n /** On every Thumb's styled element. */\n readonly dataInvalid: \"\" | undefined;\n /** The Field's own `name`, for the Thumb's \"name differs from the Field's\" warning. */\n readonly name: string | undefined;\n}\n\nexport interface SliderContextValue {\n /** The Root's state, for `Slider.Label` and `Slider.Value`. */\n readonly state: SliderRootState<SliderValue>;\n /** The values the thumbs show (design 2.2): `live` while held, else optimistic. */\n readonly shown: readonly number[];\n /** `shown` in the prop's shape (`number` or array). */\n readonly shownValue: number | readonly number[];\n readonly min: number;\n readonly max: number;\n readonly step: number;\n /** `minStepsBetweenThumbs × step`. */\n readonly gap: number;\n readonly orientation: SliderOrientation;\n readonly disabled: boolean;\n /** A step or commit dispatched through this Slider is in flight. */\n readonly pending: boolean;\n /** The thumb a pointer is captured on, or `null`. */\n readonly draggingThumb: number | null;\n /** The thumb the latest step or commit moved, or `null` (platform dispatches). */\n readonly pendingThumb: number | null;\n readonly name: string | undefined;\n readonly form: string | undefined;\n readonly getAriaValueText: ((value: number, index: number) => string) | undefined;\n readonly labelId: string;\n readonly thumbId: (index: number) => string;\n /** The Track's element: the geometry reference for pointer math. */\n readonly trackRef: RefObject<HTMLElement | null>;\n\n /** The native `input` of thumb `index` (React `onChange`): one step. */\n readonly inputStep: (index: number, value: number, event: Event) => void;\n /** The native `change` of thumb `index`: the key press's commit. */\n readonly inputCommit: (index: number, event: Event) => void;\n /** `keydown` on thumb `index`: ArrowLeft / ArrowRight normalisation of a vertical slider. */\n readonly inputKeyDown: (index: number, event: KeyboardEvent) => void;\n /** `pointerdown` on a Thumb (`index`) or on the Track (`null`: the nearest thumb). */\n readonly beginGesture: (index: number | null, event: PointerEvent, element: HTMLElement) => void;\n /** Called by each Thumb from a layout effect; returns the unregistration. */\n readonly registerThumb: (index: number, input: HTMLInputElement) => () => void;\n /** Called by each Label from a layout effect; returns the unregistration. */\n readonly registerLabel: () => () => void;\n /** The enclosing Field's wiring (design 9.4), `null` outside a `Field.Root`. */\n readonly field: SliderFieldWiring | null;\n /** Late-mounting Thumbs report here (useNativeGroupReconciliation). */\n readonly onItemMounted: () => void;\n}\n\nexport const SliderContext = createContext<SliderContextValue | null>(null);\n\nexport function useSliderContext(part: string): SliderContextValue {\n const context = use(SliderContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Slider.Root.`);\n }\n return context;\n}\n"],"mappings":";;;AAiEA,MAAa,gBAAgB,cAAyC,IAAI;AAE1E,SAAgB,iBAAiB,MAAkC;CACjE,MAAM,UAAU,IAAI,aAAa;CACjC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,wCAAwC;CAElE,OAAO;AACT"}
1
+ {"version":3,"file":"slider-context.mjs","names":[],"sources":["../../src/slider/slider-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { RefCallback, RefObject } from \"react\";\nimport type { SliderOrientation, SliderRootState, SliderValue } from \"./slider-root.js\";\n\n/** What the Root routes from an enclosing `Field.Root` to its Thumbs (design 9.4.1). */\nexport interface SliderFieldWiring {\n /** One thumb only: Thumb `index` 0 merges it into its input ref (registers the input). */\n readonly inputRef: RefCallback<HTMLElement> | undefined;\n /** One thumb only: token-merged into Thumb 0's input `aria-describedby`. */\n readonly describedBy: string | undefined;\n /** On every Thumb's input (ARIA 1.2: never on the group element). */\n readonly invalid: \"true\" | \"false\" | undefined;\n /** On every Thumb's styled element. */\n readonly dataInvalid: \"\" | undefined;\n /** The Field's own `name`, for the Thumb's \"name differs from the Field's\" warning. */\n readonly name: string | undefined;\n}\n\nexport interface SliderContextValue {\n /** The Root's state, for `Slider.Label` and `Slider.Value`. */\n readonly state: SliderRootState<SliderValue>;\n /** The values the thumbs show (design 2.2): `live` while held, else optimistic. */\n readonly shown: readonly number[];\n readonly min: number;\n readonly max: number;\n readonly step: number;\n /** `minStepsBetweenThumbs × step`. */\n readonly gap: number;\n readonly orientation: SliderOrientation;\n readonly disabled: boolean;\n /** A step or commit dispatched through this Slider is in flight. */\n readonly pending: boolean;\n /** The thumb a pointer is captured on, or `null`. */\n readonly draggingThumb: number | null;\n /** The thumb the latest step or commit moved, or `null` (platform dispatches). */\n readonly pendingThumb: number | null;\n readonly name: string | undefined;\n readonly form: string | undefined;\n readonly getAriaValueText: ((value: number, index: number) => string) | undefined;\n readonly labelId: string;\n readonly thumbId: (index: number) => string;\n /** The Track's element: the geometry reference for pointer math. */\n readonly trackRef: RefObject<HTMLElement | null>;\n\n /** The native `input` of thumb `index` (React `onChange`): one step. */\n readonly inputStep: (index: number, value: number, event: Event) => void;\n /** The native `change` of thumb `index`: the key press's commit. */\n readonly inputCommit: (index: number, event: Event) => void;\n /** `keydown` on thumb `index`: ArrowLeft / ArrowRight normalisation of a vertical slider. */\n readonly inputKeyDown: (index: number, event: KeyboardEvent) => void;\n /** `pointerdown` on a Thumb (`index`) or on the Track (`null`: the nearest thumb). */\n readonly beginGesture: (index: number | null, event: PointerEvent, element: HTMLElement) => void;\n /** Called by each Thumb from a layout effect; returns the unregistration. */\n readonly registerThumb: (index: number, input: HTMLInputElement) => () => void;\n /** Called by each Label from a layout effect; returns the unregistration. */\n readonly registerLabel: () => () => void;\n /** The enclosing Field's wiring (design 9.4), `null` outside a `Field.Root`. */\n readonly field: SliderFieldWiring | null;\n /** Late-mounting Thumbs report here (useNativeGroupReconciliation). */\n readonly onItemMounted: () => void;\n}\n\nexport const SliderContext = createContext<SliderContextValue | null>(null);\n\nexport function useSliderContext(part: string): SliderContextValue {\n const context = use(SliderContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Slider.Root.`);\n }\n return context;\n}\n"],"mappings":";;;AA+DA,MAAa,gBAAgB,cAAyC,IAAI;AAE1E,SAAgB,iBAAiB,MAAkC;CACjE,MAAM,UAAU,IAAI,aAAa;CACjC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,wCAAwC;CAElE,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"slider-label.d.mts","names":[],"sources":["../../src/slider/slider-label.tsx"],"mappings":";;;;;iBAWiB,iBAAiB,UAAU,cAAc,qBAAqB,KAC7E;EAGA,YAAY,+BAA+B,gBAAgB;EAC3D,QAAQ,WAAW,2BAA2B,gBAAgB;EAC9D,WAAW,WAAW,WAAW,gBAAgB;;EAEjD,SAAS,WAAW,gCAAgC,gBAAgB;;;;;;;wBAQtD,YAAY,UAAU,cAAc,eAClD,WACA,OACA,UACA,WACG,QACF,iBAAiB,KAAE;yBANN"}
1
+ {"version":3,"file":"slider-label.d.mts","names":[],"sources":["../../src/slider/slider-label.tsx"],"mappings":";;;;;iBAYiB,iBAAiB,UAAU,cAAc,qBAAqB,KAC7E;EAGA,YAAY,+BAA+B,gBAAgB;EAC3D,QAAQ,WAAW,2BAA2B,gBAAgB;EAC9D,WAAW,WAAW,WAAW,gBAAgB;;EAEjD,SAAS,WAAW,gCAAgC,gBAAgB;;;;;;;wBAQtD,YAAY,UAAU,cAAc,eAClD,WACA,OACA,UACA,WACG,QACF,iBAAiB,KAAE;yBANN"}
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import { useRender } from "../internal/use-render.mjs";
3
+ import { useElementCheck } from "../internal/use-element-check.mjs";
3
4
  import { useSliderContext } from "./slider-context.mjs";
4
- import { useCallback, useLayoutEffect, useRef } from "react";
5
+ import { useLayoutEffect } from "react";
5
6
  //#region src/slider/slider-label.tsx
6
7
  const isDev = process.env.NODE_ENV !== "production";
7
8
  /**
@@ -14,14 +15,7 @@ function SliderLabel({ className, style, children, render, ...rest }) {
14
15
  const { registerLabel } = ctx;
15
16
  useLayoutEffect(registerLabel, [registerLabel]);
16
17
  const single = ctx.shown.length === 1;
17
- const warnedElement = useRef(false);
18
- const libraryRef = useCallback((element) => {
19
- if (isDev && single && !warnedElement.current && element.tagName !== "LABEL") {
20
- warnedElement.current = true;
21
- console.error(`Slider.Label: expected a <label> element but got <${element.tagName.toLowerCase()}>. With one thumb the Label names the input through \`for\`, which only a <label> has.`);
22
- }
23
- return () => {};
24
- }, [single]);
18
+ const libraryRef = useElementCheck(isDev && ((element) => single && element.tagName !== "LABEL" ? `Slider.Label: expected a <label> element but got <${element.tagName.toLowerCase()}>. With one thumb the Label names the input through \`for\`, which only a <label> has.` : null), [single]);
25
19
  return useRender({
26
20
  defaultElement: "label",
27
21
  render,
@@ -1 +1 @@
1
- {"version":3,"file":"slider-label.mjs","names":[],"sources":["../../src/slider/slider-label.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useLayoutEffect, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useSliderContext } from \"./slider-context.js\";\nimport type { SliderRootState, SliderValue } from \"./slider-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** `T` defaults to `SliderValue`; pass it to narrow the state (`<Slider.Label<number>>`). */\nexport interface SliderLabelProps<T extends SliderValue = SliderValue> extends Omit<\n ComponentPropsWithRef<\"label\">,\n \"htmlFor\" | \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, SliderRootState<T>>;\n style?: StateValue<CSSProperties | undefined, SliderRootState<T>>;\n children?: StateValue<ReactNode, SliderRootState<T>>;\n /** Must stay a `<label>` when the slider has one thumb (the `for` association). */\n render?: RenderProp<ComponentPropsWithRef<\"label\">, SliderRootState<T>>;\n}\n\n/**\n * The visible name of the slider: `<label for>` naming the only thumb's input, or, with several\n * thumbs, the element whose `id` the Root's `aria-labelledby` (`role=\"group\"`) points at, emitted\n * only while a Label is mounted. Owned keys: `id`, `htmlFor`.\n */\nexport function SliderLabel<T extends SliderValue = SliderValue>({\n className,\n style,\n children,\n render,\n ...rest\n}: SliderLabelProps<T>) {\n const ctx = useSliderContext(\"Slider.Label\");\n const { registerLabel } = ctx;\n useLayoutEffect(registerLabel, [registerLabel]);\n\n const single = ctx.shown.length === 1;\n const warnedElement = useRef(false);\n const libraryRef = useCallback(\n (element: HTMLElement) => {\n if (isDev && single && !warnedElement.current && element.tagName !== \"LABEL\") {\n warnedElement.current = true;\n console.error(\n `Slider.Label: expected a <label> element but got <${element.tagName.toLowerCase()}>. ` +\n `With one thumb the Label names the input through \\`for\\`, which only a <label> has.`,\n );\n }\n // A cleanup, so the ref is never called with `null`.\n return () => {};\n },\n [single],\n );\n\n return useRender<ComponentPropsWithRef<\"label\">, SliderRootState<T>>({\n defaultElement: \"label\",\n render,\n state: ctx.state as SliderRootState<T>,\n className,\n style,\n children,\n props: rest,\n ref: libraryRef,\n libraryProps: {\n id: ctx.labelId,\n htmlFor: single ? ctx.thumbId(0) : undefined,\n },\n });\n}\n\nSliderLabel.displayName = \"SliderLabel\";\n"],"mappings":";;;;;AAQA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;AAmBvC,SAAgB,YAAiD,EAC/D,WACA,OACA,UACA,QACA,GAAG,QACmB;CACtB,MAAM,MAAM,iBAAiB,cAAc;CAC3C,MAAM,EAAE,kBAAkB;CAC1B,gBAAgB,eAAe,CAAC,aAAa,CAAC;CAE9C,MAAM,SAAS,IAAI,MAAM,WAAW;CACpC,MAAM,gBAAgB,OAAO,KAAK;CAClC,MAAM,aAAa,aAChB,YAAyB;EACxB,IAAI,SAAS,UAAU,CAAC,cAAc,WAAW,QAAQ,YAAY,SAAS;GAC5E,cAAc,UAAU;GACxB,QAAQ,MACN,qDAAqD,QAAQ,QAAQ,YAAY,EAAE,uFAErF;EACF;EAEA,aAAa,CAAC;CAChB,GACA,CAAC,MAAM,CACT;CAEA,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,KAAK;EACL,cAAc;GACZ,IAAI,IAAI;GACR,SAAS,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAA;EACrC;CACF,CAAC;AACH;AAEA,YAAY,cAAc"}
1
+ {"version":3,"file":"slider-label.mjs","names":[],"sources":["../../src/slider/slider-label.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useSliderContext } from \"./slider-context.js\";\nimport type { SliderRootState, SliderValue } from \"./slider-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** `T` defaults to `SliderValue`; pass it to narrow the state (`<Slider.Label<number>>`). */\nexport interface SliderLabelProps<T extends SliderValue = SliderValue> extends Omit<\n ComponentPropsWithRef<\"label\">,\n \"htmlFor\" | \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, SliderRootState<T>>;\n style?: StateValue<CSSProperties | undefined, SliderRootState<T>>;\n children?: StateValue<ReactNode, SliderRootState<T>>;\n /** Must stay a `<label>` when the slider has one thumb (the `for` association). */\n render?: RenderProp<ComponentPropsWithRef<\"label\">, SliderRootState<T>>;\n}\n\n/**\n * The visible name of the slider: `<label for>` naming the only thumb's input, or, with several\n * thumbs, the element whose `id` the Root's `aria-labelledby` (`role=\"group\"`) points at, emitted\n * only while a Label is mounted. Owned keys: `id`, `htmlFor`.\n */\nexport function SliderLabel<T extends SliderValue = SliderValue>({\n className,\n style,\n children,\n render,\n ...rest\n}: SliderLabelProps<T>) {\n const ctx = useSliderContext(\"Slider.Label\");\n const { registerLabel } = ctx;\n useLayoutEffect(registerLabel, [registerLabel]);\n\n const single = ctx.shown.length === 1;\n const libraryRef = useElementCheck(\n isDev &&\n ((element) =>\n single && element.tagName !== \"LABEL\"\n ? `Slider.Label: expected a <label> element but got <${element.tagName.toLowerCase()}>. ` +\n `With one thumb the Label names the input through \\`for\\`, which only a <label> has.`\n : null),\n [single],\n );\n\n return useRender<ComponentPropsWithRef<\"label\">, SliderRootState<T>>({\n defaultElement: \"label\",\n render,\n state: ctx.state as SliderRootState<T>,\n className,\n style,\n children,\n props: rest,\n ref: libraryRef,\n libraryProps: {\n id: ctx.labelId,\n htmlFor: single ? ctx.thumbId(0) : undefined,\n },\n });\n}\n\nSliderLabel.displayName = \"SliderLabel\";\n"],"mappings":";;;;;;AASA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;AAmBvC,SAAgB,YAAiD,EAC/D,WACA,OACA,UACA,QACA,GAAG,QACmB;CACtB,MAAM,MAAM,iBAAiB,cAAc;CAC3C,MAAM,EAAE,kBAAkB;CAC1B,gBAAgB,eAAe,CAAC,aAAa,CAAC;CAE9C,MAAM,SAAS,IAAI,MAAM,WAAW;CACpC,MAAM,aAAa,gBACjB,WACI,YACA,UAAU,QAAQ,YAAY,UAC1B,qDAAqD,QAAQ,QAAQ,YAAY,EAAE,0FAEnF,OACR,CAAC,MAAM,CACT;CAEA,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,KAAK;EACL,cAAc;GACZ,IAAI,IAAI;GACR,SAAS,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAA;EACrC;CACF,CAAC;AACH;AAEA,YAAY,cAAc"}
@@ -1,9 +1,9 @@
1
- import { ActionDetails, ChangeAction, ChangeReason, RenderProp, StateValue } from "../internal/types.mjs";
1
+ import { ActionDetails, ChangeAction, ChangeReason, Orientation, RenderProp, StateValue } from "../internal/types.mjs";
2
2
  import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
3
  //#region src/slider/slider-root.d.ts
4
4
  /** One number (one thumb) or one number per thumb, in ascending order. */
5
5
  export type SliderValue = number | readonly number[];
6
- export type SliderOrientation = "horizontal" | "vertical";
6
+ export type SliderOrientation = Orientation;
7
7
  /** Details passed as the second argument of `Slider.Root`'s `valueChangeAction` (each step). */
8
8
  export interface SliderValueChangeDetails extends ActionDetails {
9
9
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"slider-root.d.mts","names":[],"sources":["../../src/slider/slider-root.tsx"],"mappings":";;;;YAmDY;YAEA;;iBAGK,iCAAiC;;;;;;;;;;WAUvC,QAAQ;;WAER;;;iBAIM,iCAAiC;;;;;;;WAOvC,QAAQ;;WAER;;iBAGM,gBAAgB,UAAU;;;;;;WAMhC,OAAO;;WAEP;;WAEA;;WAEA;WACA,aAAa;WACb;WACA;WACA;WACA;;iBAGM,gBAAgB,UAAU,8BAA8B,KACvE;;EAcA,QAAQ;;;;;EAKR,eAAe;;;;;;;;;;EAUf,oBAAoB,aAAa,GAAG;;;;;;;EAOpC,oBAAoB,aAAa,GAAG;;EAEpC;;;;;EAKA;;EAEA;;EAEA;;EAEA,cAAc;;;;;EAKd,oBAAoB,eAAe;;;;;EAKnC;;EAEA;;EAEA;EACA,YAAY,+BAA+B,gBAAgB;EAC3D,QAAQ,WAAW,2BAA2B,gBAAgB;EAC9D,WAAW,WAAW,WAAW,gBAAgB;EACjD,SAAS,WAAW,8BAA8B,gBAAgB"}
1
+ {"version":3,"file":"slider-root.d.mts","names":[],"sources":["../../src/slider/slider-root.tsx"],"mappings":";;;;YA4CY;YAEA,oBAAoB;;iBAGf,iCAAiC;;;;;;;;;;WAUvC,QAAQ;;WAER;;;iBAIM,iCAAiC;;;;;;;WAOvC,QAAQ;;WAER;;iBAGM,gBAAgB,UAAU;;;;;;WAMhC,OAAO;;WAEP;;WAEA;;WAEA;WACA,aAAa;WACb;WACA;WACA;WACA;;iBAGM,gBAAgB,UAAU,8BAA8B,KACvE;;EAcA,QAAQ;;;;;EAKR,eAAe;;;;;;;;;;EAUf,oBAAoB,aAAa,GAAG;;;;;;;EAOpC,oBAAoB,aAAa,GAAG;;EAEpC;;;;;EAKA;;EAEA;;EAEA;;EAEA,cAAc;;;;;EAKd,oBAAoB,eAAe;;;;;EAKnC;;EAEA;;EAEA;EACA,YAAY,+BAA+B,gBAAgB;EAC3D,QAAQ,WAAW,2BAA2B,gBAAgB;EAC9D,WAAW,WAAW,WAAW,gBAAgB;EACjD,SAAS,WAAW,8BAA8B,gBAAgB"}
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { createActionDetails } from "../internal/action-details.mjs";
3
3
  import { dataAttr } from "../internal/data-attr.mjs";
4
+ import { useSupersededRejection } from "../internal/use-superseded-rejection.mjs";
4
5
  import { useActionTrigger } from "../internal/use-action-trigger.mjs";
5
6
  import { useDevWarning } from "../internal/use-dev-warning.mjs";
6
7
  import { mergeTokenLists } from "../internal/merge-props.mjs";
@@ -9,24 +10,19 @@ import { useRender } from "../internal/use-render.mjs";
9
10
  import { transitionTypes } from "../internal/transition-types.mjs";
10
11
  import { useLatest } from "../internal/use-latest.mjs";
11
12
  import { useControllableAction } from "../internal/use-controllable-action.mjs";
12
- import { FieldContext } from "../internal/field-context.mjs";
13
- import { useFieldControl, useFieldValueChange, useMergedRef } from "../internal/use-field-control.mjs";
13
+ import { useFieldControl, useFieldValueChange } from "../internal/use-field-control.mjs";
14
14
  import { useNativeGroupReconciliation } from "../internal/use-native-group-reconciliation.mjs";
15
15
  import { SliderContext } from "./slider-context.mjs";
16
- import { clampToNeighbours, equalValues, isMaxReachable, isOnGrid, nearestThumb, percent, platformDefault, sanitize } from "./slider-arithmetic.mjs";
17
- import { addTransitionType, use, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
16
+ import { useRegisterCount } from "../internal/use-register-count.mjs";
17
+ import { clampToNeighbours, equalValues, nearestThumb, platformDefault, pointerValue, resolveTie, sanitize, shapeOf, sliderGeometry, tiedRange, toArray } from "./slider-arithmetic.mjs";
18
+ import { useSliderDevWarnings } from "./use-slider-dev-warnings.mjs";
19
+ import { useThumbRegistry } from "./use-thumb-registry.mjs";
20
+ import { addTransitionType, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
18
21
  import { jsx } from "react/jsx-runtime";
19
22
  //#region src/slider/slider-root.tsx
20
23
  const isDev = process.env.NODE_ENV !== "production";
21
24
  const STEP_TYPES = transitionTypes("slider", "change");
22
25
  const COMMIT_TYPES = transitionTypes("slider", "commit");
23
- function toArray(value) {
24
- return typeof value === "number" ? [value] : value;
25
- }
26
- function shapeOf(value) {
27
- if (value === void 0) return void 0;
28
- return typeof value === "number" ? "number" : "array";
29
- }
30
26
  function replaceAt(values, index, value) {
31
27
  return values.map((v, i) => i === index ? value : v);
32
28
  }
@@ -81,6 +77,7 @@ function SliderRootImpl(props) {
81
77
  const activeGesture = useRef(null);
82
78
  const commitSeq = useRef(0);
83
79
  const trackRef = useRef(null);
80
+ const captureSuperseded = useSupersededRejection();
84
81
  const runCommit = async (next, details) => {
85
82
  const seq = ++commitSeq.current;
86
83
  try {
@@ -102,11 +99,15 @@ function SliderRootImpl(props) {
102
99
  warn: {
103
100
  component: "Slider.Root",
104
101
  prop: "value"
105
- }
102
+ },
103
+ captureSuperseded
106
104
  });
107
105
  const { optimistic, committed, dispatch } = commitState;
108
106
  const committedRef = useLatest(committed);
109
- const { pending: stepPending, run: runStep } = useActionTrigger({ ignoreWhilePending: false });
107
+ const { pending: stepPending, run: runStep } = useActionTrigger({
108
+ ignoreWhilePending: false,
109
+ captureSuperseded
110
+ });
110
111
  const optimisticValues = useMemo(() => toArray(optimistic), [optimistic]);
111
112
  const shown = (gestureThumb !== null || stepHeld || stepPending || commitState.pending) && live !== null ? live : optimisticValues;
112
113
  const pending = stepPending || commitState.pending;
@@ -117,13 +118,13 @@ function SliderRootImpl(props) {
117
118
  disabled: disabledProp,
118
119
  component: "Slider.Root"
119
120
  });
120
- const fieldName = use(FieldContext)?.name;
121
+ const fieldName = field.fieldName;
121
122
  const name = field.name;
122
123
  const disabled = field.disabled;
123
124
  const fieldId = field.id;
124
125
  const thumbId = useCallback((index) => index === 0 && fieldId !== void 0 ? fieldId : `${id}-thumb-${index}`, [id, fieldId]);
125
- const rootRef = useMergedRef(void 0, thumbCount > 1 ? field.ref : void 0);
126
- useDevWarning(field.inField && field.required, "Slider.Root: a range is never empty, so `required` on the enclosing Field.Root has no effect on the slider.");
126
+ const rootRef = thumbCount > 1 ? field.ref : void 0;
127
+ useDevWarning(field.inField && field.required, isDev && "Slider.Root: a range is never empty, so `required` on the enclosing Field.Root has no effect on the slider.");
127
128
  /**
128
129
  * The reason of the latest change the user or the platform made, consumed by the Field
129
130
  * notification below: `"activate"` dismisses a shown server error, a rollback does not.
@@ -201,50 +202,8 @@ function SliderRootImpl(props) {
201
202
  thumb
202
203
  }));
203
204
  }, [dispatch, latest]);
204
- const [registry] = useState(() => /* @__PURE__ */ new Map());
205
- const warnedDuplicate = useRef(false);
206
- const warnedForm = useRef(false);
207
- const registerThumb = useCallback((index, input) => {
208
- const existing = registry.get(index);
209
- if (isDev && existing !== void 0 && existing !== input && !warnedDuplicate.current) {
210
- warnedDuplicate.current = true;
211
- console.error(`Slider.Thumb: two Thumbs have \`index={${index}}\`. Each value needs exactly one Thumb; give every Thumb a distinct index.`);
212
- }
213
- if (isDev && !warnedForm.current) {
214
- for (const other of registry.values()) if (other !== input && other.form !== input.form) {
215
- warnedForm.current = true;
216
- console.error("Slider.Thumb: the thumbs of one Slider belong to different forms (a Thumb's `form` prop). A form reset is followed through the first thumb's form only; keep every thumb in one form.");
217
- break;
218
- }
219
- }
220
- registry.set(index, input);
221
- return () => {
222
- if (registry.get(index) === input) registry.delete(index);
223
- };
224
- }, [registry]);
225
- /** The first registered input: the form-associated element the reset subscription follows. */
226
- const formElement = useMemo(() => ({
227
- get current() {
228
- let first = null;
229
- let firstIndex = Number.POSITIVE_INFINITY;
230
- for (const [index, input] of registry) if (index < firstIndex) {
231
- firstIndex = index;
232
- first = input;
233
- }
234
- return first;
235
- },
236
- set current(_ignored) {}
237
- }), [registry]);
238
- const [labelCount, setLabelCount] = useState(0);
239
- const labelCountRef = useRef(0);
240
- const registerLabel = useCallback(() => {
241
- labelCountRef.current += 1;
242
- setLabelCount((count) => count + 1);
243
- return () => {
244
- labelCountRef.current -= 1;
245
- setLabelCount((count) => count - 1);
246
- };
247
- }, []);
205
+ const { registry, registerThumb, formElement } = useThumbRegistry();
206
+ const { count: labelCount, register: registerLabel, countRef: labelCountRef } = useRegisterCount();
248
207
  const [mountValue] = useState(value);
249
208
  const resetTarget = () => value !== void 0 ? toArray(mountValue ?? value) : toArray(defaultValue ?? platformDefault(min, max, step));
250
209
  const readCurrent = () => shownRef.current.map((v, index) => {
@@ -335,14 +294,7 @@ function SliderRootImpl(props) {
335
294
  const valueAt = (clientX, clientY) => {
336
295
  const { min: lo, max: hi, orientation: axis } = latest.current;
337
296
  const rect = (trackRef.current ?? track).getBoundingClientRect();
338
- let fraction;
339
- if (axis === "vertical") fraction = rect.height > 0 ? (rect.bottom - clientY) / rect.height : 0;
340
- else {
341
- fraction = rect.width > 0 ? (clientX - rect.left) / rect.width : 0;
342
- if (rtl) fraction = 1 - fraction;
343
- }
344
- fraction = Math.min(1, Math.max(0, fraction));
345
- return lo + fraction * (hi - lo);
297
+ return pointerValue(rect, clientX, clientY, axis, rtl, lo, hi);
346
298
  };
347
299
  const moveTo = (thumb, raw, cause) => {
348
300
  const { min: lo, max: hi, step: inc, gap: g } = latest.current;
@@ -352,29 +304,9 @@ function SliderRootImpl(props) {
352
304
  };
353
305
  const start = valueAt(event.clientX, event.clientY);
354
306
  const startValues = shownRef.current;
355
- let tied = null;
356
- if (index !== null) {
357
- const at = startValues[index];
358
- if (at !== void 0) {
359
- let first = index;
360
- let last = index;
361
- while (first > 0 && equalValues([startValues[first - 1]], [at])) first -= 1;
362
- while (last < startValues.length - 1 && equalValues([startValues[last + 1]], [at])) last += 1;
363
- if (first !== last) tied = {
364
- first,
365
- last,
366
- at
367
- };
368
- }
369
- }
370
- const resolveTie = (raw) => {
371
- if (tied === null) return null;
372
- if (raw > tied.at) return tied.last;
373
- if (raw < tied.at) return tied.first;
374
- return null;
375
- };
307
+ const tied = index === null ? null : tiedRange(startValues, index);
376
308
  /** The thumb the gesture moves; `null` while a press on stacked thumbs is undecided. */
377
- let decided = index === null ? nearestThumb(startValues, start) : tied ? resolveTie(start) : index;
309
+ let decided = index === null ? nearestThumb(startValues, start) : tied ? resolveTie(tied, start) : index;
378
310
  /** The thumb shown as dragging and focused meanwhile. */
379
311
  let thumb = decided ?? index ?? 0;
380
312
  const pointerId = event.pointerId;
@@ -383,7 +315,7 @@ function SliderRootImpl(props) {
383
315
  } catch {}
384
316
  const decide = (raw) => {
385
317
  if (decided !== null) return true;
386
- decided = resolveTie(raw);
318
+ decided = resolveTie(tied, raw);
387
319
  if (decided === null) return false;
388
320
  if (decided !== thumb) {
389
321
  thumb = decided;
@@ -439,30 +371,20 @@ function SliderRootImpl(props) {
439
371
  activeGesture.current?.detach();
440
372
  activeGesture.current = null;
441
373
  }, []);
442
- useDevWarning(!stepValid, `Slider.Root: \`step\` must be a positive number (got ${String(stepProp)}); using 1.`);
443
- useDevWarning(stepValid && !isMaxReachable(min, max, step), `Slider.Root: \`max\` (${max}) is not on the step grid from \`min\` (${min}) with \`step\` ${step}: it is unreachable, as on a native range. The last reachable value is the last step below \`max\`.`);
444
- const given = value ?? defaultValue;
445
- const givenValues = given === void 0 ? [] : toArray(given);
446
- useDevWarning(givenValues.some((v) => !isOnGrid(v, min, max, step)), `Slider.Root: the ${value !== void 0 ? "`value`" : "`defaultValue`"} (${givenValues.join(", ")}) is off the step grid or outside \`min\` / \`max\`. It is rendered as given and the browser sanitises it; the first user step snaps it.`);
447
- useDevWarning(givenValues.some((v, i) => i > 0 && v < givenValues[i - 1]), `Slider.Root: the values (${givenValues.join(", ")}) must be in ascending order; the thumbs would be rendered crossed.`);
448
- const currentShape = shapeOf(given);
449
- useDevWarning(currentShape !== void 0 && currentShape !== shape, "Slider.Root: the value changed shape between a number and an array after mount. The shape is fixed at mount; remount the Slider (a `key`) to change the number of thumbs.");
450
- const unnamedGroup = shown.length > 1 && !inField && rest["aria-label"] === void 0 && rest["aria-labelledby"] === void 0;
451
- const warnedGroupName = useRef(false);
452
- useEffect(() => {
453
- if (!isDev || warnedGroupName.current || !unnamedGroup || labelCountRef.current > 0) return;
454
- warnedGroupName.current = true;
455
- console.error("Slider.Root: a slider with several thumbs is a `group` and needs a name: render a Slider.Label, or pass `aria-label` / `aria-labelledby` to the Root.");
456
- }, [unnamedGroup]);
457
- const count = shown.length;
458
- const percents = shown.map((v) => percent(v, min, max));
459
- const geometry = {
460
- "--slider-start": count > 1 ? `${percents[0] ?? 0}%` : "0%",
461
- "--slider-end": `${percents[count - 1] ?? 0}%`
462
- };
463
- percents.forEach((p, index) => {
464
- geometry[`--slider-value-${index}`] = `${p}%`;
374
+ useSliderDevWarnings({
375
+ stepProp,
376
+ stepValid,
377
+ min,
378
+ max,
379
+ step,
380
+ value,
381
+ defaultValue,
382
+ shape,
383
+ unnamedGroup: shown.length > 1 && !inField && rest["aria-label"] === void 0 && rest["aria-labelledby"] === void 0,
384
+ labelCountRef
465
385
  });
386
+ const count = shown.length;
387
+ const geometry = sliderGeometry(shown, min, max);
466
388
  const shownValue = fromArray(shown);
467
389
  const dragging = gestureThumb !== null;
468
390
  const state = useMemo(() => ({
@@ -489,7 +411,6 @@ function SliderRootImpl(props) {
489
411
  const context = useMemo(() => ({
490
412
  state,
491
413
  shown,
492
- shownValue,
493
414
  min,
494
415
  max,
495
416
  step,
@@ -516,7 +437,6 @@ function SliderRootImpl(props) {
516
437
  }), [
517
438
  state,
518
439
  shown,
519
- shownValue,
520
440
  min,
521
441
  max,
522
442
  step,