@funstack/ui 0.1.0-alpha.11 → 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 (401) 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.map +1 -1
  61. package/dist/combobox/combobox-root.mjs +30 -102
  62. package/dist/combobox/combobox-root.mjs.map +1 -1
  63. package/dist/combobox/combobox-trigger.d.mts.map +1 -1
  64. package/dist/combobox/combobox-trigger.mjs +6 -25
  65. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  66. package/dist/combobox/index.mjs +1 -1
  67. package/dist/combobox/use-combobox-form.mjs +56 -0
  68. package/dist/combobox/use-combobox-form.mjs.map +1 -0
  69. package/dist/combobox/use-option-registry.mjs +62 -0
  70. package/dist/combobox/use-option-registry.mjs.map +1 -0
  71. package/dist/dialog/dialog-close.d.mts.map +1 -1
  72. package/dist/dialog/dialog-close.mjs +29 -62
  73. package/dist/dialog/dialog-close.mjs.map +1 -1
  74. package/dist/dialog/dialog-context.mjs.map +1 -1
  75. package/dist/dialog/dialog-form.d.mts.map +1 -1
  76. package/dist/dialog/dialog-form.mjs +5 -4
  77. package/dist/dialog/dialog-form.mjs.map +1 -1
  78. package/dist/dialog/dialog-popup.d.mts +3 -4
  79. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  80. package/dist/dialog/dialog-popup.mjs +37 -98
  81. package/dist/dialog/dialog-popup.mjs.map +1 -1
  82. package/dist/dialog/dialog-root.d.mts.map +1 -1
  83. package/dist/dialog/dialog-root.mjs +30 -118
  84. package/dist/dialog/dialog-root.mjs.map +1 -1
  85. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  86. package/dist/dialog/dialog-trigger.mjs +13 -16
  87. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  88. package/dist/field/field-control.mjs +6 -13
  89. package/dist/field/field-control.mjs.map +1 -1
  90. package/dist/field/field-description.d.mts.map +1 -1
  91. package/dist/field/field-description.mjs +1 -2
  92. package/dist/field/field-description.mjs.map +1 -1
  93. package/dist/field/field-error.d.mts.map +1 -1
  94. package/dist/field/field-error.mjs +1 -2
  95. package/dist/field/field-error.mjs.map +1 -1
  96. package/dist/field/field-label.d.mts.map +1 -1
  97. package/dist/field/field-label.mjs +3 -11
  98. package/dist/field/field-label.mjs.map +1 -1
  99. package/dist/field/field-root.mjs +21 -41
  100. package/dist/field/field-root.mjs.map +1 -1
  101. package/dist/field/index.mjs +1 -1
  102. package/dist/field/use-server-error-visibility.mjs +44 -0
  103. package/dist/field/use-server-error-visibility.mjs.map +1 -0
  104. package/dist/form/form-root.d.mts.map +1 -1
  105. package/dist/form/form-root.mjs +6 -7
  106. package/dist/form/form-root.mjs.map +1 -1
  107. package/dist/form/form-submit.d.mts +1 -1
  108. package/dist/form/form-submit.mjs +4 -10
  109. package/dist/form/form-submit.mjs.map +1 -1
  110. package/dist/index.d.mts +2 -2
  111. package/dist/internal/anchor-position.mjs +1 -59
  112. package/dist/internal/anchor-position.mjs.map +1 -1
  113. package/dist/internal/announce.mjs.map +1 -1
  114. package/dist/internal/arrow-keys.mjs +21 -0
  115. package/dist/internal/arrow-keys.mjs.map +1 -0
  116. package/dist/internal/decimal.mjs +7 -1
  117. package/dist/internal/decimal.mjs.map +1 -1
  118. package/dist/internal/dom-order.mjs +17 -0
  119. package/dist/internal/dom-order.mjs.map +1 -0
  120. package/dist/internal/field-context.d.mts.map +1 -1
  121. package/dist/internal/field-context.mjs +11 -1
  122. package/dist/internal/field-context.mjs.map +1 -1
  123. package/dist/internal/focus-first-invalid.mjs +1 -1
  124. package/dist/internal/focus-first-invalid.mjs.map +1 -1
  125. package/dist/internal/group-member.mjs +37 -0
  126. package/dist/internal/group-member.mjs.map +1 -0
  127. package/dist/internal/overlay-popup.mjs +103 -0
  128. package/dist/internal/overlay-popup.mjs.map +1 -0
  129. package/dist/internal/popover-open.mjs +18 -0
  130. package/dist/internal/popover-open.mjs.map +1 -0
  131. package/dist/internal/render-element.d.mts +2 -0
  132. package/dist/internal/render-element.mjs +20 -2
  133. package/dist/internal/render-element.mjs.map +1 -1
  134. package/dist/internal/shipped-styles.mjs +14 -0
  135. package/dist/internal/shipped-styles.mjs.map +1 -0
  136. package/dist/internal/sync-presence.mjs +5 -1
  137. package/dist/internal/sync-presence.mjs.map +1 -1
  138. package/dist/internal/toolbar-context.mjs.map +1 -1
  139. package/dist/internal/tooltip-warm.mjs +1 -1
  140. package/dist/internal/tooltip-warm.mjs.map +1 -1
  141. package/dist/internal/transition-boundary.mjs +1 -1
  142. package/dist/internal/transition-boundary.mjs.map +1 -1
  143. package/dist/internal/types.d.mts +2 -0
  144. package/dist/internal/types.d.mts.map +1 -1
  145. package/dist/internal/use-action-trigger.mjs +5 -23
  146. package/dist/internal/use-action-trigger.mjs.map +1 -1
  147. package/dist/internal/use-checkable-input.mjs +79 -0
  148. package/dist/internal/use-checkable-input.mjs.map +1 -0
  149. package/dist/internal/use-controllable-action.mjs +16 -24
  150. package/dist/internal/use-controllable-action.mjs.map +1 -1
  151. package/dist/internal/use-dev-warning.mjs +8 -4
  152. package/dist/internal/use-dev-warning.mjs.map +1 -1
  153. package/dist/internal/use-element-check.mjs +39 -0
  154. package/dist/internal/use-element-check.mjs.map +1 -0
  155. package/dist/internal/use-exit-animation.mjs +1 -1
  156. package/dist/internal/use-exit-animation.mjs.map +1 -1
  157. package/dist/internal/use-field-control.mjs +28 -12
  158. package/dist/internal/use-field-control.mjs.map +1 -1
  159. package/dist/internal/use-fieldset-group.mjs +46 -0
  160. package/dist/internal/use-fieldset-group.mjs.map +1 -0
  161. package/dist/internal/use-form-reset.mjs +1 -5
  162. package/dist/internal/use-form-reset.mjs.map +1 -1
  163. package/dist/internal/use-item-order.mjs +42 -0
  164. package/dist/internal/use-item-order.mjs.map +1 -0
  165. package/dist/internal/use-latest.mjs +4 -8
  166. package/dist/internal/use-latest.mjs.map +1 -1
  167. package/dist/internal/use-merged-refs.mjs +19 -0
  168. package/dist/internal/use-merged-refs.mjs.map +1 -0
  169. package/dist/internal/use-name-warning.mjs +84 -0
  170. package/dist/internal/use-name-warning.mjs.map +1 -0
  171. package/dist/internal/use-native-checked.mjs +4 -6
  172. package/dist/internal/use-native-checked.mjs.map +1 -1
  173. package/dist/internal/use-native-focusgroup.mjs +19 -0
  174. package/dist/internal/use-native-focusgroup.mjs.map +1 -0
  175. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
  176. package/dist/internal/use-overlay-close.mjs +63 -0
  177. package/dist/internal/use-overlay-close.mjs.map +1 -0
  178. package/dist/internal/{use-popover-root.mjs → use-overlay-root.mjs} +28 -39
  179. package/dist/internal/use-overlay-root.mjs.map +1 -0
  180. package/dist/internal/use-popover-popup.mjs +32 -78
  181. package/dist/internal/use-popover-popup.mjs.map +1 -1
  182. package/dist/internal/use-popover-trigger.d.mts +15 -0
  183. package/dist/internal/use-popover-trigger.d.mts.map +1 -0
  184. package/dist/internal/use-popover-trigger.mjs +13 -17
  185. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  186. package/dist/internal/use-register-count.mjs +24 -0
  187. package/dist/internal/use-register-count.mjs.map +1 -0
  188. package/dist/internal/use-render.d.mts +2 -0
  189. package/dist/internal/use-render.mjs +2 -2
  190. package/dist/internal/use-render.mjs.map +1 -1
  191. package/dist/internal/use-resolved-placement.mjs +38 -22
  192. package/dist/internal/use-resolved-placement.mjs.map +1 -1
  193. package/dist/internal/use-roving-focus.mjs +5 -18
  194. package/dist/internal/use-roving-focus.mjs.map +1 -1
  195. package/dist/internal/use-superseded-rejection.mjs +47 -0
  196. package/dist/internal/use-superseded-rejection.mjs.map +1 -0
  197. package/dist/internal/validity.mjs +1 -13
  198. package/dist/internal/validity.mjs.map +1 -1
  199. package/dist/internal/value-set.mjs +41 -0
  200. package/dist/internal/value-set.mjs.map +1 -0
  201. package/dist/menu/index.d.mts +1 -1
  202. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  203. package/dist/menu/menu-context-trigger.d.mts +2 -7
  204. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  205. package/dist/menu/menu-context-trigger.mjs +10 -187
  206. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  207. package/dist/menu/menu-context.d.mts +1 -1
  208. package/dist/menu/menu-context.mjs +1 -1
  209. package/dist/menu/menu-context.mjs.map +1 -1
  210. package/dist/menu/menu-dom.mjs +1 -2
  211. package/dist/menu/menu-dom.mjs.map +1 -1
  212. package/dist/menu/menu-gestures.mjs +167 -0
  213. package/dist/menu/menu-gestures.mjs.map +1 -0
  214. package/dist/menu/menu-group.d.mts.map +1 -1
  215. package/dist/menu/menu-group.mjs +2 -1
  216. package/dist/menu/menu-group.mjs.map +1 -1
  217. package/dist/menu/menu-hover.mjs +0 -1
  218. package/dist/menu/menu-hover.mjs.map +1 -1
  219. package/dist/menu/menu-item.mjs.map +1 -1
  220. package/dist/menu/menu-outside.mjs +101 -0
  221. package/dist/menu/menu-outside.mjs.map +1 -0
  222. package/dist/menu/menu-point.mjs +85 -0
  223. package/dist/menu/menu-point.mjs.map +1 -0
  224. package/dist/menu/menu-popup.d.mts +6 -7
  225. package/dist/menu/menu-popup.d.mts.map +1 -1
  226. package/dist/menu/menu-popup.mjs +37 -248
  227. package/dist/menu/menu-popup.mjs.map +1 -1
  228. package/dist/menu/menu-radio-group.mjs.map +1 -1
  229. package/dist/menu/menu-root.d.mts +10 -0
  230. package/dist/menu/menu-root.d.mts.map +1 -1
  231. package/dist/menu/menu-root.mjs +10 -8
  232. package/dist/menu/menu-root.mjs.map +1 -1
  233. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  234. package/dist/menu/menu-submenu-trigger.mjs +6 -6
  235. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  236. package/dist/menu/menu-trigger.d.mts +4 -9
  237. package/dist/menu/menu-trigger.d.mts.map +1 -1
  238. package/dist/menu/menu-trigger.mjs +8 -6
  239. package/dist/menu/menu-trigger.mjs.map +1 -1
  240. package/dist/menu/use-menu-item.mjs +14 -16
  241. package/dist/menu/use-menu-item.mjs.map +1 -1
  242. package/dist/menu/use-menu-keyboard.mjs +88 -0
  243. package/dist/menu/use-menu-keyboard.mjs.map +1 -0
  244. package/dist/meter/meter-root.mjs +1 -1
  245. package/dist/number-field/index.d.mts +2 -1
  246. package/dist/number-field/index.d.mts.map +1 -1
  247. package/dist/number-field/index.mjs +2 -2
  248. package/dist/number-field/index.mjs.map +1 -1
  249. package/dist/number-field/number-field-arithmetic.mjs +30 -11
  250. package/dist/number-field/number-field-arithmetic.mjs.map +1 -1
  251. package/dist/number-field/number-field-context.d.mts +6 -1
  252. package/dist/number-field/number-field-context.d.mts.map +1 -0
  253. package/dist/number-field/number-field-context.mjs.map +1 -1
  254. package/dist/number-field/number-field-decrement.d.mts +1 -1
  255. package/dist/number-field/number-field-decrement.mjs +1 -1
  256. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  257. package/dist/number-field/number-field-increment.d.mts +2 -22
  258. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  259. package/dist/number-field/number-field-increment.mjs +2 -53
  260. package/dist/number-field/number-field-increment.mjs.map +1 -1
  261. package/dist/number-field/number-field-input.d.mts.map +1 -1
  262. package/dist/number-field/number-field-input.mjs +18 -22
  263. package/dist/number-field/number-field-input.mjs.map +1 -1
  264. package/dist/number-field/number-field-label.d.mts.map +1 -1
  265. package/dist/number-field/number-field-label.mjs +3 -9
  266. package/dist/number-field/number-field-label.mjs.map +1 -1
  267. package/dist/number-field/number-field-root.d.mts +2 -1
  268. package/dist/number-field/number-field-root.d.mts.map +1 -1
  269. package/dist/number-field/number-field-root.mjs +81 -91
  270. package/dist/number-field/number-field-root.mjs.map +1 -1
  271. package/dist/number-field/use-number-field-dev-warnings.mjs +28 -0
  272. package/dist/number-field/use-number-field-dev-warnings.mjs.map +1 -0
  273. package/dist/number-field/use-step-button.d.mts +24 -0
  274. package/dist/number-field/use-step-button.d.mts.map +1 -0
  275. package/dist/number-field/use-step-button.mjs +57 -3
  276. package/dist/number-field/use-step-button.mjs.map +1 -1
  277. package/dist/popover/popover-close.d.mts.map +1 -1
  278. package/dist/popover/popover-close.mjs +28 -67
  279. package/dist/popover/popover-close.mjs.map +1 -1
  280. package/dist/popover/popover-context.mjs.map +1 -1
  281. package/dist/popover/popover-popup.d.mts +9 -6
  282. package/dist/popover/popover-popup.d.mts.map +1 -1
  283. package/dist/popover/popover-popup.mjs +13 -36
  284. package/dist/popover/popover-popup.mjs.map +1 -1
  285. package/dist/popover/popover-root.mjs +4 -3
  286. package/dist/popover/popover-root.mjs.map +1 -1
  287. package/dist/popover/popover-trigger.d.mts +4 -8
  288. package/dist/popover/popover-trigger.d.mts.map +1 -1
  289. package/dist/popover/popover-trigger.mjs +2 -1
  290. package/dist/popover/popover-trigger.mjs.map +1 -1
  291. package/dist/progress/progress-root.mjs +1 -1
  292. package/dist/radio-group/radio-group-context.mjs.map +1 -1
  293. package/dist/radio-group/radio-group-item.d.mts +3 -4
  294. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  295. package/dist/radio-group/radio-group-item.mjs +20 -25
  296. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  297. package/dist/radio-group/radio-group-label.mjs +1 -6
  298. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  299. package/dist/radio-group/radio-group-root.d.mts +1 -1
  300. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  301. package/dist/radio-group/radio-group-root.mjs +21 -40
  302. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  303. package/dist/select/select-dom.mjs +9 -18
  304. package/dist/select/select-dom.mjs.map +1 -1
  305. package/dist/select/select-option.mjs +1 -1
  306. package/dist/select/select-root.mjs +3 -2
  307. package/dist/select/select-root.mjs.map +1 -1
  308. package/dist/slider/slider-arithmetic.mjs +74 -13
  309. package/dist/slider/slider-arithmetic.mjs.map +1 -1
  310. package/dist/slider/slider-context.mjs.map +1 -1
  311. package/dist/slider/slider-label.d.mts.map +1 -1
  312. package/dist/slider/slider-label.mjs +3 -9
  313. package/dist/slider/slider-label.mjs.map +1 -1
  314. package/dist/slider/slider-root.d.mts +2 -2
  315. package/dist/slider/slider-root.d.mts.map +1 -1
  316. package/dist/slider/slider-root.mjs +36 -116
  317. package/dist/slider/slider-root.mjs.map +1 -1
  318. package/dist/slider/slider-thumb.d.mts.map +1 -1
  319. package/dist/slider/slider-thumb.mjs +8 -6
  320. package/dist/slider/slider-thumb.mjs.map +1 -1
  321. package/dist/slider/slider-value.d.mts.map +1 -1
  322. package/dist/slider/slider-value.mjs +2 -1
  323. package/dist/slider/slider-value.mjs.map +1 -1
  324. package/dist/slider/use-slider-dev-warnings.mjs +29 -0
  325. package/dist/slider/use-slider-dev-warnings.mjs.map +1 -0
  326. package/dist/slider/use-thumb-registry.mjs +51 -0
  327. package/dist/slider/use-thumb-registry.mjs.map +1 -0
  328. package/dist/switch/switch.d.mts +4 -5
  329. package/dist/switch/switch.d.mts.map +1 -1
  330. package/dist/switch/switch.mjs +15 -55
  331. package/dist/switch/switch.mjs.map +1 -1
  332. package/dist/tabs/tabs-context.d.mts +2 -3
  333. package/dist/tabs/tabs-context.d.mts.map +1 -1
  334. package/dist/tabs/tabs-context.mjs.map +1 -1
  335. package/dist/tabs/tabs-list.d.mts.map +1 -1
  336. package/dist/tabs/tabs-list.mjs +9 -22
  337. package/dist/tabs/tabs-list.mjs.map +1 -1
  338. package/dist/tabs/tabs-panel.d.mts +3 -4
  339. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  340. package/dist/tabs/tabs-panel.mjs.map +1 -1
  341. package/dist/tabs/tabs-root.d.mts +4 -3
  342. package/dist/tabs/tabs-root.d.mts.map +1 -1
  343. package/dist/tabs/tabs-root.mjs +2 -1
  344. package/dist/tabs/tabs-root.mjs.map +1 -1
  345. package/dist/tabs/tabs-tab.d.mts +3 -4
  346. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  347. package/dist/tabs/tabs-tab.mjs.map +1 -1
  348. package/dist/toast/toast-action.mjs.map +1 -1
  349. package/dist/toast/toast-close.d.mts.map +1 -1
  350. package/dist/toast/toast-close.mjs +2 -8
  351. package/dist/toast/toast-close.mjs.map +1 -1
  352. package/dist/toast/toast-context.mjs.map +1 -1
  353. package/dist/toast/toast-hotkey.mjs +27 -0
  354. package/dist/toast/toast-hotkey.mjs.map +1 -0
  355. package/dist/toast/toast-queue.mjs +137 -0
  356. package/dist/toast/toast-queue.mjs.map +1 -0
  357. package/dist/toast/toast-timers.mjs +65 -0
  358. package/dist/toast/toast-timers.mjs.map +1 -0
  359. package/dist/toast/toast-viewport.d.mts.map +1 -1
  360. package/dist/toast/toast-viewport.mjs +30 -235
  361. package/dist/toast/toast-viewport.mjs.map +1 -1
  362. package/dist/toast/toast.mjs +1 -1
  363. package/dist/toast/toast.mjs.map +1 -1
  364. package/dist/toast/use-modal-portal-host.mjs +52 -0
  365. package/dist/toast/use-modal-portal-host.mjs.map +1 -0
  366. package/dist/toggle/toggle.d.mts +3 -4
  367. package/dist/toggle/toggle.d.mts.map +1 -1
  368. package/dist/toggle/toggle.mjs +7 -10
  369. package/dist/toggle/toggle.mjs.map +1 -1
  370. package/dist/toggle-group/toggle-group-context.d.mts +2 -1
  371. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  372. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  373. package/dist/toggle-group/toggle-group-item.d.mts +5 -3
  374. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  375. package/dist/toggle-group/toggle-group-item.mjs +5 -7
  376. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  377. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  378. package/dist/toggle-group/toggle-group-root.mjs +29 -64
  379. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  380. package/dist/toolbar/toolbar-root.d.mts +2 -2
  381. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  382. package/dist/toolbar/toolbar-root.mjs +3 -4
  383. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  384. package/dist/tooltip/tooltip-context.d.mts +1 -1
  385. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  386. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  387. package/dist/tooltip/tooltip-popup.mjs +6 -15
  388. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  389. package/dist/tooltip/tooltip-root.mjs +2 -2
  390. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  391. package/dist/tooltip/tooltip-trigger.d.mts +2 -1
  392. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  393. package/dist/tooltip/tooltip-trigger.mjs +3 -2
  394. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  395. package/dist/tooltip/use-tooltip-interaction.mjs +4 -3
  396. package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
  397. package/package.json +3 -2
  398. package/dist/accordion/accordion-context.d.mts +0 -5
  399. package/dist/accordion/accordion-context.d.mts.map +0 -1
  400. package/dist/internal/use-popover-root.mjs.map +0 -1
  401. /package/dist/internal/{use-popover-root.d.mts → use-overlay-root.d.mts} +0 -0
@@ -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,
@@ -1 +1 @@
1
- {"version":3,"file":"slider-root.mjs","names":[],"sources":["../../src/slider/slider-root.tsx"],"sourcesContent":["\"use client\";\nimport {\n addTransitionType,\n use,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode, RefObject } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { FieldContext } from \"../internal/field-context.js\";\nimport { mergeTokenLists } from \"../internal/merge-props.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type {\n ActionDetails,\n ChangeAction,\n ChangeReason,\n RenderProp,\n StateValue,\n} from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport {\n useFieldControl,\n useFieldValueChange,\n useMergedRef,\n} from \"../internal/use-field-control.js\";\nimport type { FormAssociatedElement } from \"../internal/use-form-reset.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useNativeGroupReconciliation } from \"../internal/use-native-group-reconciliation.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport {\n clampToNeighbours,\n equalValues,\n isMaxReachable,\n isOnGrid,\n nearestThumb,\n percent,\n platformDefault,\n sanitize,\n} from \"./slider-arithmetic.js\";\nimport { SliderContext } from \"./slider-context.js\";\nimport type { SliderContextValue, SliderFieldWiring } from \"./slider-context.js\";\n\n/** One number (one thumb) or one number per thumb, in ascending order. */\nexport type SliderValue = number | readonly number[];\n\nexport type SliderOrientation = \"horizontal\" | \"vertical\";\n\n/** Details passed as the second argument of `Slider.Root`'s `valueChangeAction` (each step). */\nexport interface SliderValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user moved a thumb (`details.event` is the native `input` event for a key\n * press, the `pointerdown` / `pointermove` / `pointerup` for a drag, the `keydown` for a\n * JS-normalised key).\n * `\"platform\"`: a form reset (the `reset` event) or a value found in the inputs at mount\n * (`undefined`).\n * `\"dismiss\"`: the commit action rejected and the slider reverted to the committed value\n * (uncontrolled mode; `undefined`).\n */\n readonly reason: ChangeReason;\n /** Index of the thumb that moved; `null` on a platform path or a revert, where several may change. */\n readonly thumb: number | null;\n}\n\n/** Details passed as the second argument of `Slider.Root`'s `valueCommitAction` (each gesture). */\nexport interface SliderValueCommitDetails extends ActionDetails {\n /**\n * `\"activate\"`: a gesture ended (`details.event` is the native `change` event for a key press,\n * the `pointerup` / `pointercancel` / `lostpointercapture` for a drag, the `keydown` for a\n * JS-normalised key). `\"platform\"`: a form reset (the `reset` event) or mount reconciliation\n * (`undefined`). Never `\"dismiss\"`.\n */\n readonly reason: ChangeReason;\n /** Index of the thumb the gesture moved; `null` on a platform path. */\n readonly thumb: number | null;\n}\n\nexport interface SliderRootState<T extends SliderValue = number> {\n /**\n * The value the thumbs show: the value a gesture has reached while a pointer is captured or a\n * step or commit is in flight, else the optimistic value. Content rendered from it must not\n * suspend.\n */\n readonly value: T;\n /** `value` as an array, one entry per thumb, in thumb order. */\n readonly values: readonly number[];\n /** A step or commit dispatched through this Slider is in flight. */\n readonly pending: boolean;\n /** A pointer is captured on a thumb. */\n readonly dragging: boolean;\n readonly orientation: SliderOrientation;\n readonly disabled: boolean;\n readonly min: number;\n readonly max: number;\n readonly step: number;\n}\n\nexport interface SliderRootProps<T extends SliderValue = number> extends Omit<\n ComponentPropsWithRef<\"div\">,\n | \"defaultValue\"\n | \"role\"\n | \"className\"\n | \"style\"\n | \"children\"\n // The value attributes are the native inputs' (design 8): never authored.\n | \"aria-valuemin\"\n | \"aria-valuemax\"\n | \"aria-valuenow\"\n | \"aria-valuetext\"\n | \"aria-orientation\"\n> {\n /** Controlled value: one number, or one per thumb in ascending order. `undefined`: uncontrolled. */\n value?: T;\n /**\n * Initial value in uncontrolled mode; also the form-reset target (latest value). Default: the\n * platform's midpoint, `min + (max - min) / 2`, snapped to `step`.\n */\n defaultValue?: T;\n /**\n * Runs inside the Root's step transition on every step: each pointer move, each key press,\n * each platform change, and the revert after a rejected commit (`reason: \"dismiss\"`,\n * uncontrolled). Awaited; `data-pending` meanwhile (without this action a step starts no\n * transition and is never pending). Adopt the value here in a controlled\n * parent (`setValue(next)` in the sync prefix is a transition update). Not the place for a\n * save: a pending async action entangles every transition in the app, and a drag is many\n * steps. A `setState` after your own `await` needs `startTransition`.\n */\n valueChangeAction?: ChangeAction<T, SliderValueChangeDetails>;\n /**\n * Runs inside the Root's commit transition once per gesture: pointer release, each key press,\n * a form reset, a value found at mount. Awaited; the thumb keeps the gesture's value and shows\n * `data-pending` until it settles; in uncontrolled mode the value is committed when it\n * resolves and reverts to the previous value if it rejects. May be a Server Function.\n */\n valueCommitAction?: ChangeAction<T, SliderValueCommitDetails>;\n /** Default `0`. */\n min?: number;\n /**\n * Default `100`. A `max` that is not on the step grid from `min` is unreachable, as on a\n * native range (dev warning).\n */\n max?: number;\n /** Default `1`. Must be positive. Values snap to `min + n × step`. */\n step?: number;\n /** Minimum number of steps between two adjacent thumbs. Default `0` (thumbs may share a value). */\n minStepsBetweenThumbs?: number;\n /** Default `\"horizontal\"`. Vertical sliders have `min` at the bottom. */\n orientation?: SliderOrientation;\n /**\n * `aria-valuetext` for a thumb, from the value it shows. Set it when the number alone is not\n * meaningful (\"3 of 5 stars\", \"Tuesday\"). Default: none (the number is announced).\n */\n getAriaValueText?: (value: number, index: number) => string;\n /**\n * Form field name for every thumb's input (a Thumb's own `name` wins). With several thumbs,\n * read with `FormData.getAll()`.\n */\n name?: string;\n /** The `form` attribute for every thumb's input (a Thumb's own `form` wins). */\n form?: string;\n /** Disables every input (native `disabled`; not submitted) and the pointer. Never set while pending. */\n disabled?: boolean;\n className?: StateValue<string | undefined, SliderRootState<T>>;\n style?: StateValue<CSSProperties | undefined, SliderRootState<T>>;\n children?: StateValue<ReactNode, SliderRootState<T>>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, SliderRootState<T>>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nconst STEP_TYPES = transitionTypes(\"slider\", \"change\");\nconst COMMIT_TYPES = transitionTypes(\"slider\", \"commit\");\n\nfunction toArray(value: SliderValue): readonly number[] {\n return typeof value === \"number\" ? [value] : value;\n}\n\nfunction shapeOf(value: SliderValue | undefined): \"number\" | \"array\" | undefined {\n if (value === undefined) return undefined;\n return typeof value === \"number\" ? \"number\" : \"array\";\n}\n\nfunction replaceAt(values: readonly number[], index: number, value: number): readonly number[] {\n return values.map((v, i) => (i === index ? value : v));\n}\n\n/** Writes each registered input's `defaultValue` (the attribute a form reset restores). */\nfunction writeDefaults(\n registry: ReadonlyMap<number, HTMLInputElement>,\n target: readonly number[],\n): void {\n for (const [index, input] of registry) {\n const entry = target[index];\n if (entry !== undefined) input.defaultValue = String(entry);\n }\n}\n\n/** A pointer captured on a Thumb or the Track (design 4.1). */\ninterface ActiveGesture {\n readonly pointerId: number;\n /** Detaches the gesture's listeners. */\n readonly detach: () => void;\n}\n\n/**\n * Owns the slider's state (design/components/slider.md 2): the committed value through\n * `useControllableAction` with `valueCommitAction` (once per gesture), each step through its own\n * transition (`valueChangeAction`), and the value a gesture has reached in the urgent lane\n * (`live`), which the thumbs show while a pointer is captured or anything is in flight. Also the\n * pointer gesture, the Thumb registry, mount reconciliation and form reset, and the geometry\n * custom properties `--slider-start`, `--slider-end` and `--slider-value-<i>`.\n *\n * Owned keys (conventions 1.2): `role` (`\"group\"` with several thumbs), `aria-labelledby` (the\n * Label's id while a Label is mounted and there are several thumbs; token-merged with the\n * consumer's), `data-pending`, `data-dragging`, `data-orientation`, `data-disabled`. The custom\n * properties are merged into `style`, where the consumer's entries win.\n *\n * Inside a `Field.Root` (design 9.4) the Root calls `useFieldControl`: with one thumb, Thumb 0's\n * input is the Field's labelable control; with several, the Root registers itself as the group\n * and also owns the Field label in `aria-labelledby`, the Field's `aria-describedby` and\n * `data-invalid`. `name` / `disabled` default from the Field.\n */\nfunction SliderRootImpl<T extends SliderValue = number>(props: SliderRootProps<T>) {\n const {\n value,\n defaultValue,\n valueChangeAction,\n valueCommitAction,\n min = 0,\n max = 100,\n step: stepProp = 1,\n minStepsBetweenThumbs = 0,\n orientation = \"horizontal\",\n getAriaValueText,\n name: nameProp,\n form,\n disabled: disabledProp = false,\n className,\n style,\n children,\n render,\n ...rest\n } = props;\n\n const stepValid = Number.isFinite(stepProp) && stepProp > 0;\n const step = stepValid ? stepProp : 1;\n const gap = Math.max(0, minStepsBetweenThumbs) * step;\n\n const id = useId();\n const labelId = `${id}-label`;\n\n // The shape (one number or an array) is fixed at mount (design 3.1).\n const [shape] = useState<\"number\" | \"array\">(() => shapeOf(value ?? defaultValue) ?? \"number\");\n const fromArray = useCallback(\n (values: readonly number[]): T => (shape === \"number\" ? values[0] : values) as T,\n [shape],\n );\n\n // --- State (design 2) ----------------------------------------------------------------------\n\n const [live, setLive] = useState<readonly number[] | null>(null);\n const [gestureThumb, setGestureThumb] = useState<number | null>(null);\n /**\n * A step was taken and its gesture's commit has not been dispatched yet. Holds `live` on\n * screen between a key's native `input` and `change` when no step transition runs (no\n * `valueChangeAction`): otherwise react-dom restores the controlled input to the old value\n * after `input`, and Firefox then fires no `change`.\n */\n const [stepHeld, setStepHeld] = useState(false);\n const [pendingThumb, setPendingThumb] = useState<number | null>(null);\n\n /** The value of the latest step, read by the commit in the same or a later event. */\n const liveRef = useRef<readonly number[] | null>(null);\n /** The shown value when the open gesture began; `null` when no gesture is open. */\n const gestureStart = useRef<readonly number[] | null>(null);\n const activeGesture = useRef<ActiveGesture | null>(null);\n const commitSeq = useRef(0);\n const trackRef = useRef<HTMLElement | null>(null);\n\n const runCommit = async (next: T, details: SliderValueCommitDetails): Promise<void> => {\n const seq = ++commitSeq.current;\n try {\n await valueCommitAction?.(next, details);\n } catch (error) {\n // Design 2.4: in uncontrolled mode, tell the preview channel about the rollback, for the\n // latest commit only. Yield once to leave the commit's transition (conventions 2.6).\n if (value === undefined && seq === commitSeq.current) {\n await undefined;\n // `stepTo` and `committedRef` are declared below; this runs long after the render.\n stepTo(toArray(committedRef.current), null, \"dismiss\", undefined);\n }\n throw error;\n }\n };\n\n const commitState = useControllableAction<T, SliderValueCommitDetails>({\n controlled: value,\n defaultValue,\n initialValue: platformDefault(min, max, step) as T,\n action: runCommit,\n transitionTypes: () => COMMIT_TYPES,\n warn: { component: \"Slider.Root\", prop: \"value\" },\n });\n const { optimistic, committed, dispatch } = commitState;\n const committedRef = useLatest(committed);\n\n // A step is not a re-entry: a continuous control dispatches one step per key press or pointer\n // move and every step must run (design/components/button.md 16.1), so no in-flight guard.\n const { pending: stepPending, run: runStep } = useActionTrigger({ ignoreWhilePending: false });\n\n const optimisticValues = useMemo(() => toArray(optimistic), [optimistic]);\n const held = gestureThumb !== null || stepHeld || stepPending || commitState.pending;\n const shown = held && live !== null ? live : optimisticValues;\n const pending = stepPending || commitState.pending;\n\n // --- Inside a Field.Root (design 9.4) ------------------------------------------------------\n\n // One thumb: its input is the Field's labelable control. Several: the Root (`role=\"group\"`)\n // registers, `Field.Label` drops `for` and names the group through `aria-labelledby`.\n const thumbCount = shown.length;\n const field = useFieldControl({\n labelable: thumbCount === 1,\n name: nameProp,\n disabled: disabledProp,\n component: \"Slider.Root\",\n });\n const fieldName = use(FieldContext)?.name;\n const name = field.name;\n const disabled = field.disabled;\n const fieldId = field.id;\n const thumbId = useCallback(\n (index: number) => (index === 0 && fieldId !== undefined ? fieldId : `${id}-thumb-${index}`),\n [id, fieldId],\n );\n const rootRef = useMergedRef<HTMLElement>(undefined, thumbCount > 1 ? field.ref : undefined);\n useDevWarning(\n field.inField && field.required,\n \"Slider.Root: a range is never empty, so `required` on the enclosing Field.Root has no \" +\n \"effect on the slider.\",\n );\n /**\n * The reason of the latest change the user or the platform made, consumed by the Field\n * notification below: `\"activate\"` dismisses a shown server error, a rollback does not.\n */\n const lastReason = useRef<ChangeReason | null>(null);\n // A pointer gesture and the JS-normalised keys fire no `input` / `change` the Field hears:\n // tell it at the commit, when the optimistic value changes (design 9.4.4).\n useFieldValueChange(optimisticValues.join(\"\\u0000\"), () => {\n const edit = lastReason.current === \"activate\";\n lastReason.current = null;\n return edit;\n });\n const {\n \"aria-labelledby\": fieldLabelledBy,\n \"aria-describedby\": fieldDescribedBy,\n \"aria-invalid\": fieldInvalid,\n \"data-invalid\": fieldDataInvalid,\n } = field.attributes;\n const inField = field.inField;\n const fieldRef = field.ref;\n const fieldWiring = useMemo<SliderFieldWiring | null>(() => {\n if (!inField) return null;\n const single = thumbCount === 1;\n return {\n inputRef: single ? fieldRef : undefined,\n describedBy: single ? fieldDescribedBy : undefined,\n invalid: fieldInvalid,\n dataInvalid: fieldDataInvalid,\n name: fieldName,\n };\n }, [inField, fieldRef, thumbCount, fieldDescribedBy, fieldInvalid, fieldDataInvalid, fieldName]);\n\n /** What the thumbs show, for handlers; also written by `stepTo` ahead of the render. */\n const shownRef = useLatest(shown);\n\n const latest = useLatest({\n valueChangeAction,\n fromArray,\n runStep,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n });\n\n // --- Step and commit (design 2.4) ---------------------------------------------------------\n\n const stepTo = useCallback(\n (\n next: readonly number[],\n thumb: number | null,\n reason: ChangeReason,\n event: Event | undefined,\n ): boolean => {\n // No-op against what the user sees (conventions 2.3 item 8).\n if (equalValues(next, shownRef.current)) return false;\n liveRef.current = next;\n shownRef.current = next;\n // A controlled parent that adopts steps changes the optimistic value per step.\n lastReason.current = reason;\n setLive(next);\n setPendingThumb(thumb);\n // A revert has no commit after it: the optimistic value already shows the committed one.\n if (reason !== \"dismiss\") setStepHeld(true);\n const { valueChangeAction: action, fromArray: toValue, runStep: run } = latest.current;\n // Without a step action there is nothing to run and no consumer update to keep\n // interruptible: no transition, so `data-pending` does not blink on every pointer move.\n if (action === undefined) return true;\n run(() => {\n for (const type of STEP_TYPES) addTransitionType(type);\n return action?.(toValue(next), createActionDetails(event, { reason, thumb }));\n });\n return true;\n },\n [latest, shownRef],\n );\n\n const commitGesture = useCallback(\n (thumb: number | null, reason: ChangeReason, event: Event | undefined): void => {\n const start = gestureStart.current;\n gestureStart.current = null;\n // The commit's own pending state holds `live` from here (set in this same batch).\n setStepHeld(false);\n const next = liveRef.current;\n // Nothing changed since the gesture began (a drag out and back, a trailing `change`).\n if (start === null || next === null || equalValues(next, start)) return;\n lastReason.current = reason;\n setPendingThumb(thumb);\n dispatch(latest.current.fromArray(next), createActionDetails(event, { reason, thumb }));\n },\n [dispatch, latest],\n );\n\n // --- Thumb registry ------------------------------------------------------------------------\n\n const [registry] = useState(() => new Map<number, HTMLInputElement>());\n const warnedDuplicate = useRef(false);\n const warnedForm = useRef(false);\n const registerThumb = useCallback(\n (index: number, input: HTMLInputElement) => {\n const existing = registry.get(index);\n if (isDev && existing !== undefined && existing !== input && !warnedDuplicate.current) {\n warnedDuplicate.current = true;\n console.error(\n `Slider.Thumb: two Thumbs have \\`index={${index}}\\`. Each value needs exactly one ` +\n `Thumb; give every Thumb a distinct index.`,\n );\n }\n if (isDev && !warnedForm.current) {\n for (const other of registry.values()) {\n if (other !== input && other.form !== input.form) {\n warnedForm.current = true;\n console.error(\n \"Slider.Thumb: the thumbs of one Slider belong to different forms (a Thumb's \" +\n \"`form` prop). A form reset is followed through the first thumb's form only; \" +\n \"keep every thumb in one form.\",\n );\n break;\n }\n }\n }\n registry.set(index, input);\n return () => {\n if (registry.get(index) === input) registry.delete(index);\n };\n },\n [registry],\n );\n\n /** The first registered input: the form-associated element the reset subscription follows. */\n const formElement = useMemo<RefObject<FormAssociatedElement | null>>(\n () => ({\n get current() {\n let first: HTMLInputElement | null = null;\n let firstIndex = Number.POSITIVE_INFINITY;\n for (const [index, input] of registry) {\n if (index < firstIndex) {\n firstIndex = index;\n first = input;\n }\n }\n return first;\n },\n set current(_ignored) {},\n }),\n [registry],\n );\n\n // --- Labels --------------------------------------------------------------------------------\n\n const [labelCount, setLabelCount] = useState(0);\n // The same count for the dev warning, which can run before the re-render the registration\n // scheduled.\n const labelCountRef = useRef(0);\n const registerLabel = useCallback(() => {\n labelCountRef.current += 1;\n setLabelCount((count) => count + 1);\n return () => {\n labelCountRef.current -= 1;\n setLabelCount((count) => count - 1);\n };\n }, []);\n\n // --- Residual browser paths: mount reconciliation and form reset (design 9.2, 9.3) --------\n\n const [mountValue] = useState(value);\n const resetTarget = (): readonly number[] =>\n value !== undefined\n ? toArray(mountValue ?? value)\n : toArray(defaultValue ?? platformDefault(min, max, step));\n\n const readCurrent = (): readonly number[] =>\n shownRef.current.map((v, index) => {\n const input = registry.get(index);\n if (input === undefined) return v;\n const read = Number(input.value);\n return Number.isFinite(read) ? read : v;\n });\n\n const { onItemMounted } = useNativeGroupReconciliation<readonly number[]>({\n element: formElement,\n readCurrent,\n readDefault: resetTarget,\n base: () => shownRef.current,\n // Compare as the DOM would hold the values: a consumer's off-grid value is sanitised by the\n // browser (not by jsdom), and that is not a platform change.\n equals: (a, b) => {\n const reference = shownRef.current;\n return equalValues(\n sanitize(a, reference, min, max, step, gap),\n sanitize(b, reference, min, max, step, gap),\n );\n },\n onPlatformChange: (next, event) => {\n if (next.length !== shownRef.current.length) return;\n const before = shownRef.current;\n gestureStart.current = before;\n liveRef.current = before;\n stepTo(next, null, \"platform\", event);\n commitGesture(null, \"platform\", event);\n },\n onResetEvent: () => {\n // react-dom writes `defaultValue = value` after every update of a controlled input, so the\n // reset target is written here, right before the browser's reset algorithm reads it.\n writeDefaults(registry, resetTarget());\n },\n });\n\n // --- Keyboard (design 4.2) -----------------------------------------------------------------\n\n const inputStep = useCallback(\n (index: number, raw: number, event: Event) => {\n if (!Number.isFinite(raw)) return;\n const before = shownRef.current;\n if (index >= before.length) return;\n // A key press is a one-step gesture: it starts at the value shown before it.\n if (stepTo(replaceAt(before, index, raw), index, \"activate\", event)) {\n if (gestureStart.current === null) gestureStart.current = before;\n }\n },\n [shownRef, stepTo],\n );\n\n const inputCommit = useCallback(\n (index: number, event: Event) => {\n // A pointer gesture commits at its release.\n if (activeGesture.current !== null) return;\n commitGesture(index, \"activate\", event);\n },\n [commitGesture],\n );\n\n const inputKeyDown = useCallback(\n (index: number, event: KeyboardEvent) => {\n const {\n orientation: axis,\n disabled: off,\n min: lo,\n max: hi,\n step: inc,\n gap: g,\n } = latest.current;\n if (off) return;\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n // Vertical: Firefox decreases a vertical range on ArrowRight; the APG says increase.\n // Horizontal RTL: the track is mirrored (min on the right), so ArrowLeft increases;\n // Chromium and Firefox mirror a native range, WebKit does not (design 7). LTR stays native.\n let increaseKey: \"ArrowLeft\" | \"ArrowRight\";\n if (axis === \"vertical\") {\n increaseKey = \"ArrowRight\";\n } else {\n // Read at the keydown: the direction may come from any ancestor and change at any time.\n const input = event.currentTarget as Element | null;\n if (input === null || getComputedStyle(input).direction !== \"rtl\") return;\n increaseKey = \"ArrowLeft\";\n }\n event.preventDefault();\n const before = shownRef.current;\n const current = before[index];\n if (current === undefined) return;\n const delta = event.key === increaseKey ? inc : -inc;\n const next = replaceAt(\n before,\n index,\n clampToNeighbours(before, index, current + delta, lo, hi, inc, g),\n );\n if (activeGesture.current !== null) {\n stepTo(next, index, \"activate\", event);\n return;\n }\n gestureStart.current = before;\n liveRef.current = before;\n stepTo(next, index, \"activate\", event);\n commitGesture(index, \"activate\", event);\n },\n [commitGesture, latest, shownRef, stepTo],\n );\n\n // --- Pointer (design 4.1) ------------------------------------------------------------------\n\n const warnedNoTrack = useRef(false);\n const beginGesture = useCallback(\n (index: number | null, event: PointerEvent, element: HTMLElement) => {\n const { disabled: off } = latest.current;\n if (off || event.button !== 0 || activeGesture.current !== null) return;\n const track = trackRef.current;\n if (track === null) {\n if (isDev && !warnedNoTrack.current) {\n warnedNoTrack.current = true;\n console.error(\n \"Slider.Thumb: a pointer press needs a Slider.Track to map the pointer to a value. \" +\n \"Without a Track the slider is keyboard-only.\",\n );\n }\n return;\n }\n // No text selection, no focus change through the compatibility `mousedown`.\n event.preventDefault();\n const rtl = getComputedStyle(track).direction === \"rtl\";\n\n const valueAt = (clientX: number, clientY: number): number => {\n const { min: lo, max: hi, orientation: axis } = latest.current;\n const rect = (trackRef.current ?? track).getBoundingClientRect();\n let fraction: number;\n if (axis === \"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 lo + fraction * (hi - lo);\n };\n const moveTo = (thumb: number, raw: number, cause: Event): void => {\n const { min: lo, max: hi, step: inc, gap: g } = latest.current;\n const before = shownRef.current;\n if (thumb >= before.length) return;\n stepTo(\n replaceAt(before, thumb, clampToNeighbours(before, thumb, raw, lo, hi, inc, g)),\n thumb,\n \"activate\",\n cause,\n );\n };\n\n const start = valueAt(event.clientX, event.clientY);\n const startValues = shownRef.current;\n // A press on a Thumb that shares its value with a neighbour (stacked thumbs) moves the one\n // that can go toward the pointer, the Track's tie rule; when the press is exactly on the\n // value, the first move decides. Otherwise a Thumb press moves that Thumb.\n let tied: { readonly first: number; readonly last: number; readonly at: number } | null =\n null;\n if (index !== null) {\n const at = startValues[index];\n if (at !== undefined) {\n let first = index;\n let last = index;\n while (first > 0 && equalValues([startValues[first - 1] as number], [at])) first -= 1;\n while (\n last < startValues.length - 1 &&\n equalValues([startValues[last + 1] as number], [at])\n ) {\n last += 1;\n }\n if (first !== last) tied = { first, last, at };\n }\n }\n const resolveTie = (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 /** The thumb the gesture moves; `null` while a press on stacked thumbs is undecided. */\n let decided: number | null =\n index === null ? nearestThumb(startValues, start) : tied ? resolveTie(start) : index;\n /** The thumb shown as dragging and focused meanwhile. */\n let thumb = decided ?? index ?? 0;\n const pointerId = event.pointerId;\n try {\n element.setPointerCapture(pointerId);\n } catch {\n // An inactive pointer id (a synthetic event): the gesture still follows the element.\n }\n\n const decide = (raw: number): boolean => {\n if (decided !== null) return true;\n decided = resolveTie(raw);\n if (decided === null) return false;\n if (decided !== thumb) {\n thumb = decided;\n setGestureThumb(thumb);\n registry.get(thumb)?.focus({ focusVisible: false } as FocusOptions);\n }\n return true;\n };\n const follow = (pointerEvent: PointerEvent): void => {\n const raw = valueAt(pointerEvent.clientX, pointerEvent.clientY);\n if (decide(raw)) moveTo(thumb, raw, pointerEvent);\n };\n\n const onMove = (moveEvent: PointerEvent): void => {\n if (moveEvent.pointerId !== pointerId) return;\n follow(moveEvent);\n };\n const onEnd = (endEvent: PointerEvent): void => {\n if (endEvent.pointerId !== pointerId) return;\n detach();\n // The release position is the gesture's last (an engine may coalesce the final move\n // into the `pointerup`); a cancel or a lost capture keeps the last move's value.\n if (endEvent.type === \"pointerup\") follow(endEvent);\n activeGesture.current = null;\n setGestureThumb(null);\n commitGesture(thumb, \"activate\", endEvent);\n };\n const detach = (): void => {\n element.removeEventListener(\"pointermove\", onMove);\n element.removeEventListener(\"pointerup\", onEnd);\n element.removeEventListener(\"pointercancel\", onEnd);\n element.removeEventListener(\"lostpointercapture\", onEnd);\n };\n element.addEventListener(\"pointermove\", onMove);\n element.addEventListener(\"pointerup\", onEnd);\n element.addEventListener(\"pointercancel\", onEnd);\n element.addEventListener(\"lostpointercapture\", onEnd);\n\n activeGesture.current = { pointerId, detach };\n setGestureThumb(thumb);\n gestureStart.current = shownRef.current;\n liveRef.current = shownRef.current;\n // A capture alone holds `live` on screen: start it from what is shown, not from the value\n // an earlier gesture left behind (a press exactly on the current value steps nothing).\n setLive(shownRef.current);\n // `:focus-visible` does not match after a pointer press, as on a native range.\n registry.get(thumb)?.focus({ focusVisible: false } as FocusOptions);\n if (decided !== null) moveTo(thumb, start, event);\n },\n [commitGesture, latest, registry, shownRef, stepTo],\n );\n\n // An unmount mid-gesture leaves no listener behind.\n useEffect(\n () => () => {\n activeGesture.current?.detach();\n activeGesture.current = null;\n },\n [],\n );\n\n // --- Development warnings ------------------------------------------------------------------\n\n useDevWarning(\n !stepValid,\n `Slider.Root: \\`step\\` must be a positive number (got ${String(stepProp)}); using 1.`,\n );\n useDevWarning(\n stepValid && !isMaxReachable(min, max, step),\n `Slider.Root: \\`max\\` (${max}) is not on the step grid from \\`min\\` (${min}) with \\`step\\` ` +\n `${step}: it is unreachable, as on a native range. The last reachable value is the last ` +\n `step below \\`max\\`.`,\n );\n const given = value ?? defaultValue;\n const givenValues = given === undefined ? [] : toArray(given);\n useDevWarning(\n givenValues.some((v) => !isOnGrid(v, min, max, step)),\n `Slider.Root: the ${value !== undefined ? \"`value`\" : \"`defaultValue`\"} ` +\n `(${givenValues.join(\", \")}) is off the step grid or outside \\`min\\` / \\`max\\`. It is ` +\n `rendered as given and the browser sanitises it; the first user step snaps it.`,\n );\n useDevWarning(\n givenValues.some((v, i) => i > 0 && v < (givenValues[i - 1] as number)),\n `Slider.Root: the values (${givenValues.join(\", \")}) must be in ascending order; the thumbs ` +\n `would be rendered crossed.`,\n );\n const currentShape = shapeOf(given);\n useDevWarning(\n currentShape !== undefined && currentShape !== shape,\n `Slider.Root: the value changed shape between a number and an array after mount. The shape ` +\n `is fixed at mount; remount the Slider (a \\`key\\`) to change the number of thumbs.`,\n );\n // Inside a Field, `Field.Label` names the group (design 9.4.2).\n const unnamedGroup =\n shown.length > 1 &&\n !inField &&\n rest[\"aria-label\"] === undefined &&\n rest[\"aria-labelledby\"] === undefined;\n const warnedGroupName = useRef(false);\n useEffect(() => {\n if (!isDev || warnedGroupName.current || !unnamedGroup || labelCountRef.current > 0) return;\n warnedGroupName.current = true;\n console.error(\n \"Slider.Root: a slider with several thumbs is a `group` and needs a name: render a \" +\n \"Slider.Label, or pass `aria-label` / `aria-labelledby` to the Root.\",\n );\n }, [unnamedGroup]);\n\n // --- Render --------------------------------------------------------------------------------\n\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\n const shownValue = fromArray(shown);\n const dragging = gestureThumb !== null;\n const state = useMemo<SliderRootState<T>>(\n () => ({\n value: shownValue,\n values: shown,\n pending,\n dragging,\n orientation,\n disabled,\n min,\n max,\n step,\n }),\n [shownValue, shown, pending, dragging, orientation, disabled, min, max, step],\n );\n\n // Memoised (#48): the functions are stable, so this changes only with the state below.\n const context = useMemo<SliderContextValue>(\n () => ({\n state: state as SliderRootState<SliderValue>,\n shown,\n shownValue: shownValue as SliderValue,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n pending,\n draggingThumb: gestureThumb,\n pendingThumb,\n name,\n form,\n getAriaValueText,\n labelId,\n thumbId,\n trackRef,\n inputStep,\n inputCommit,\n inputKeyDown,\n beginGesture,\n registerThumb,\n registerLabel,\n onItemMounted,\n field: fieldWiring,\n }),\n [\n state,\n shown,\n shownValue,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n pending,\n gestureThumb,\n pendingThumb,\n name,\n form,\n getAriaValueText,\n labelId,\n thumbId,\n inputStep,\n inputCommit,\n inputKeyDown,\n beginGesture,\n registerThumb,\n registerLabel,\n onItemMounted,\n fieldWiring,\n ],\n );\n\n // Several thumbs: the Field's label, then `Slider.Label` while one is mounted (the consumer's\n // tokens come first through the merge). Only when there is one: an owned `undefined` would\n // remove the consumer's own tokens.\n const labelledBy =\n count > 1 ? mergeTokenLists(fieldLabelledBy, labelCount > 0 ? labelId : undefined) : \"\";\n const libraryProps: Partial<ComponentPropsWithRef<\"div\">> & DataAttributes = {\n role: count > 1 ? \"group\" : undefined,\n ...(labelledBy !== \"\" ? { \"aria-labelledby\": labelledBy } : {}),\n // The group element is described (read when focus enters it); one thumb: its input is.\n ...(count > 1 && fieldDescribedBy !== undefined\n ? { \"aria-describedby\": fieldDescribedBy }\n : {}),\n // Inside a Field only (`aria-invalid` goes on the inputs, never on the group).\n ...(inField ? { \"data-invalid\": fieldDataInvalid } : {}),\n \"data-pending\": dataAttr(pending),\n \"data-dragging\": dataAttr(dragging),\n \"data-orientation\": orientation,\n \"data-disabled\": dataAttr(disabled),\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, SliderRootState<T>>({\n defaultElement: \"div\",\n render,\n state,\n className,\n // The geometry properties lose to the consumer's own entries (design 3.1).\n style: (s) => ({ ...(geometry as CSSProperties), ...resolveStateValue(style, s) }),\n children,\n props: rest,\n libraryProps,\n ref: rootRef,\n });\n\n return <SliderContext value={context}>{element}</SliderContext>;\n}\n\nSliderRootImpl.displayName = \"SliderRoot\";\n\n/**\n * `Slider.Root`. Overloaded so that the value's shape is inferred from `value` / `defaultValue`\n * as `number` or `readonly number[]` (an array literal would otherwise infer a mutable\n * `number[]`), and every action and state function receives that shape (design 3.1).\n */\nexport const SliderRoot = SliderRootImpl as {\n (props: SliderRootProps<number>): ReactNode;\n (props: SliderRootProps<readonly number[]>): ReactNode;\n (props: SliderRootProps<SliderValue>): ReactNode;\n displayName?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+KA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,MAAM,aAAa,gBAAgB,UAAU,QAAQ;AACrD,MAAM,eAAe,gBAAgB,UAAU,QAAQ;AAEvD,SAAS,QAAQ,OAAuC;CACtD,OAAO,OAAO,UAAU,WAAW,CAAC,KAAK,IAAI;AAC/C;AAEA,SAAS,QAAQ,OAAgE;CAC/E,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,OAAO,OAAO,UAAU,WAAW,WAAW;AAChD;AAEA,SAAS,UAAU,QAA2B,OAAe,OAAkC;CAC7F,OAAO,OAAO,KAAK,GAAG,MAAO,MAAM,QAAQ,QAAQ,CAAE;AACvD;;AAGA,SAAS,cACP,UACA,QACM;CACN,KAAK,MAAM,CAAC,OAAO,UAAU,UAAU;EACrC,MAAM,QAAQ,OAA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EAAE,gBAAgB,iBAAiB,IAAI,CAAC;EACtD,gBAAgB,SAAS,OAAO;EAChC,iBAAiB,SAAS,QAAQ;EAClC,oBAAoB;EACpB,iBAAiB,SAAS,QAAQ;CACpC;CAEA,MAAM,UAAU,UAA4D;EAC1E,gBAAgB;EAChB;EACA;EACA;EAEA,QAAQ,OAAO;GAAE,GAAI;GAA4B,GAAG,kBAAkB,OAAO,CAAC;EAAE;EAChF;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,eAAD;EAAe,OAAO;EAAU,UAAA;CAAuB,CAAA;AAChE;AAEA,eAAe,cAAc;;;;;;AAO7B,MAAa,aAAa"}
1
+ {"version":3,"file":"slider-root.mjs","names":[],"sources":["../../src/slider/slider-root.tsx"],"sourcesContent":["\"use client\";\nimport { addTransitionType, useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { mergeTokenLists } from \"../internal/merge-props.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type {\n ActionDetails,\n ChangeAction,\n ChangeReason,\n Orientation,\n RenderProp,\n StateValue,\n} from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useFieldControl, useFieldValueChange } from \"../internal/use-field-control.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useNativeGroupReconciliation } from \"../internal/use-native-group-reconciliation.js\";\nimport { useRegisterCount } from \"../internal/use-register-count.js\";\nimport { useSupersededRejection } from \"../internal/use-superseded-rejection.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport {\n clampToNeighbours,\n equalValues,\n nearestThumb,\n platformDefault,\n pointerValue,\n resolveTie,\n sanitize,\n shapeOf,\n sliderGeometry,\n tiedRange,\n toArray,\n} from \"./slider-arithmetic.js\";\nimport { SliderContext } from \"./slider-context.js\";\nimport type { SliderContextValue, SliderFieldWiring } from \"./slider-context.js\";\nimport { useSliderDevWarnings } from \"./use-slider-dev-warnings.js\";\nimport { useThumbRegistry } from \"./use-thumb-registry.js\";\n\n/** One number (one thumb) or one number per thumb, in ascending order. */\nexport type SliderValue = number | readonly number[];\n\nexport type SliderOrientation = Orientation;\n\n/** Details passed as the second argument of `Slider.Root`'s `valueChangeAction` (each step). */\nexport interface SliderValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user moved a thumb (`details.event` is the native `input` event for a key\n * press, the `pointerdown` / `pointermove` / `pointerup` for a drag, the `keydown` for a\n * JS-normalised key).\n * `\"platform\"`: a form reset (the `reset` event) or a value found in the inputs at mount\n * (`undefined`).\n * `\"dismiss\"`: the commit action rejected and the slider reverted to the committed value\n * (uncontrolled mode; `undefined`).\n */\n readonly reason: ChangeReason;\n /** Index of the thumb that moved; `null` on a platform path or a revert, where several may change. */\n readonly thumb: number | null;\n}\n\n/** Details passed as the second argument of `Slider.Root`'s `valueCommitAction` (each gesture). */\nexport interface SliderValueCommitDetails extends ActionDetails {\n /**\n * `\"activate\"`: a gesture ended (`details.event` is the native `change` event for a key press,\n * the `pointerup` / `pointercancel` / `lostpointercapture` for a drag, the `keydown` for a\n * JS-normalised key). `\"platform\"`: a form reset (the `reset` event) or mount reconciliation\n * (`undefined`). Never `\"dismiss\"`.\n */\n readonly reason: ChangeReason;\n /** Index of the thumb the gesture moved; `null` on a platform path. */\n readonly thumb: number | null;\n}\n\nexport interface SliderRootState<T extends SliderValue = number> {\n /**\n * The value the thumbs show: the value a gesture has reached while a pointer is captured or a\n * step or commit is in flight, else the optimistic value. Content rendered from it must not\n * suspend.\n */\n readonly value: T;\n /** `value` as an array, one entry per thumb, in thumb order. */\n readonly values: readonly number[];\n /** A step or commit dispatched through this Slider is in flight. */\n readonly pending: boolean;\n /** A pointer is captured on a thumb. */\n readonly dragging: boolean;\n readonly orientation: SliderOrientation;\n readonly disabled: boolean;\n readonly min: number;\n readonly max: number;\n readonly step: number;\n}\n\nexport interface SliderRootProps<T extends SliderValue = number> extends Omit<\n ComponentPropsWithRef<\"div\">,\n | \"defaultValue\"\n | \"role\"\n | \"className\"\n | \"style\"\n | \"children\"\n // The value attributes are the native inputs' (design 8): never authored.\n | \"aria-valuemin\"\n | \"aria-valuemax\"\n | \"aria-valuenow\"\n | \"aria-valuetext\"\n | \"aria-orientation\"\n> {\n /** Controlled value: one number, or one per thumb in ascending order. `undefined`: uncontrolled. */\n value?: T;\n /**\n * Initial value in uncontrolled mode; also the form-reset target (latest value). Default: the\n * platform's midpoint, `min + (max - min) / 2`, snapped to `step`.\n */\n defaultValue?: T;\n /**\n * Runs inside the Root's step transition on every step: each pointer move, each key press,\n * each platform change, and the revert after a rejected commit (`reason: \"dismiss\"`,\n * uncontrolled). Awaited; `data-pending` meanwhile (without this action a step starts no\n * transition and is never pending). Adopt the value here in a controlled\n * parent (`setValue(next)` in the sync prefix is a transition update). Not the place for a\n * save: a pending async action entangles every transition in the app, and a drag is many\n * steps. A `setState` after your own `await` needs `startTransition`.\n */\n valueChangeAction?: ChangeAction<T, SliderValueChangeDetails>;\n /**\n * Runs inside the Root's commit transition once per gesture: pointer release, each key press,\n * a form reset, a value found at mount. Awaited; the thumb keeps the gesture's value and shows\n * `data-pending` until it settles; in uncontrolled mode the value is committed when it\n * resolves and reverts to the previous value if it rejects. May be a Server Function.\n */\n valueCommitAction?: ChangeAction<T, SliderValueCommitDetails>;\n /** Default `0`. */\n min?: number;\n /**\n * Default `100`. A `max` that is not on the step grid from `min` is unreachable, as on a\n * native range (dev warning).\n */\n max?: number;\n /** Default `1`. Must be positive. Values snap to `min + n × step`. */\n step?: number;\n /** Minimum number of steps between two adjacent thumbs. Default `0` (thumbs may share a value). */\n minStepsBetweenThumbs?: number;\n /** Default `\"horizontal\"`. Vertical sliders have `min` at the bottom. */\n orientation?: SliderOrientation;\n /**\n * `aria-valuetext` for a thumb, from the value it shows. Set it when the number alone is not\n * meaningful (\"3 of 5 stars\", \"Tuesday\"). Default: none (the number is announced).\n */\n getAriaValueText?: (value: number, index: number) => string;\n /**\n * Form field name for every thumb's input (a Thumb's own `name` wins). With several thumbs,\n * read with `FormData.getAll()`.\n */\n name?: string;\n /** The `form` attribute for every thumb's input (a Thumb's own `form` wins). */\n form?: string;\n /** Disables every input (native `disabled`; not submitted) and the pointer. Never set while pending. */\n disabled?: boolean;\n className?: StateValue<string | undefined, SliderRootState<T>>;\n style?: StateValue<CSSProperties | undefined, SliderRootState<T>>;\n children?: StateValue<ReactNode, SliderRootState<T>>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, SliderRootState<T>>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nconst STEP_TYPES = transitionTypes(\"slider\", \"change\");\nconst COMMIT_TYPES = transitionTypes(\"slider\", \"commit\");\n\nfunction replaceAt(values: readonly number[], index: number, value: number): readonly number[] {\n return values.map((v, i) => (i === index ? value : v));\n}\n\n/** Writes each registered input's `defaultValue` (the attribute a form reset restores). */\nfunction writeDefaults(\n registry: ReadonlyMap<number, HTMLInputElement>,\n target: readonly number[],\n): void {\n for (const [index, input] of registry) {\n const entry = target[index];\n if (entry !== undefined) input.defaultValue = String(entry);\n }\n}\n\n/** A pointer captured on a Thumb or the Track (design 4.1). */\ninterface ActiveGesture {\n readonly pointerId: number;\n /** Detaches the gesture's listeners. */\n readonly detach: () => void;\n}\n\n/**\n * Owns the slider's state (design/components/slider.md 2): the committed value through\n * `useControllableAction` with `valueCommitAction` (once per gesture), each step through its own\n * transition (`valueChangeAction`), and the value a gesture has reached in the urgent lane\n * (`live`), which the thumbs show while a pointer is captured or anything is in flight. Also the\n * pointer gesture, the Thumb registry, mount reconciliation and form reset, and the geometry\n * custom properties `--slider-start`, `--slider-end` and `--slider-value-<i>`.\n *\n * Owned keys (conventions 1.2): `role` (`\"group\"` with several thumbs), `aria-labelledby` (the\n * Label's id while a Label is mounted and there are several thumbs; token-merged with the\n * consumer's), `data-pending`, `data-dragging`, `data-orientation`, `data-disabled`. The custom\n * properties are merged into `style`, where the consumer's entries win.\n *\n * Inside a `Field.Root` (design 9.4) the Root calls `useFieldControl`: with one thumb, Thumb 0's\n * input is the Field's labelable control; with several, the Root registers itself as the group\n * and also owns the Field label in `aria-labelledby`, the Field's `aria-describedby` and\n * `data-invalid`. `name` / `disabled` default from the Field.\n */\nfunction SliderRootImpl<T extends SliderValue = number>(props: SliderRootProps<T>) {\n const {\n value,\n defaultValue,\n valueChangeAction,\n valueCommitAction,\n min = 0,\n max = 100,\n step: stepProp = 1,\n minStepsBetweenThumbs = 0,\n orientation = \"horizontal\",\n getAriaValueText,\n name: nameProp,\n form,\n disabled: disabledProp = false,\n className,\n style,\n children,\n render,\n ...rest\n } = props;\n\n const stepValid = Number.isFinite(stepProp) && stepProp > 0;\n const step = stepValid ? stepProp : 1;\n const gap = Math.max(0, minStepsBetweenThumbs) * step;\n\n const id = useId();\n const labelId = `${id}-label`;\n\n // The shape (one number or an array) is fixed at mount (design 3.1).\n const [shape] = useState<\"number\" | \"array\">(() => shapeOf(value ?? defaultValue) ?? \"number\");\n const fromArray = useCallback(\n (values: readonly number[]): T => (shape === \"number\" ? values[0] : values) as T,\n [shape],\n );\n\n // --- State (design 2) ----------------------------------------------------------------------\n\n const [live, setLive] = useState<readonly number[] | null>(null);\n const [gestureThumb, setGestureThumb] = useState<number | null>(null);\n /**\n * A step was taken and its gesture's commit has not been dispatched yet. Holds `live` on\n * screen between a key's native `input` and `change` when no step transition runs (no\n * `valueChangeAction`): otherwise react-dom restores the controlled input to the old value\n * after `input`, and Firefox then fires no `change`.\n */\n const [stepHeld, setStepHeld] = useState(false);\n const [pendingThumb, setPendingThumb] = useState<number | null>(null);\n\n /** The value of the latest step, read by the commit in the same or a later event. */\n const liveRef = useRef<readonly number[] | null>(null);\n /** The shown value when the open gesture began; `null` when no gesture is open. */\n const gestureStart = useRef<readonly number[] | null>(null);\n const activeGesture = useRef<ActiveGesture | null>(null);\n const commitSeq = useRef(0);\n const trackRef = useRef<HTMLElement | null>(null);\n\n // One capture for both channels, before both transitions (see `captureSuperseded`).\n const captureSuperseded = useSupersededRejection();\n\n const runCommit = async (next: T, details: SliderValueCommitDetails): Promise<void> => {\n const seq = ++commitSeq.current;\n try {\n await valueCommitAction?.(next, details);\n } catch (error) {\n // Design 2.4: in uncontrolled mode, tell the preview channel about the rollback, for the\n // latest commit only. Yield once to leave the commit's transition (conventions 2.6).\n if (value === undefined && seq === commitSeq.current) {\n await undefined;\n // `stepTo` and `committedRef` are declared below; this runs long after the render.\n stepTo(toArray(committedRef.current), null, \"dismiss\", undefined);\n }\n throw error;\n }\n };\n\n const commitState = useControllableAction<T, SliderValueCommitDetails>({\n controlled: value,\n defaultValue,\n initialValue: platformDefault(min, max, step) as T,\n action: runCommit,\n transitionTypes: () => COMMIT_TYPES,\n warn: { component: \"Slider.Root\", prop: \"value\" },\n captureSuperseded,\n });\n const { optimistic, committed, dispatch } = commitState;\n const committedRef = useLatest(committed);\n\n // A step is not a re-entry: a continuous control dispatches one step per key press or pointer\n // move and every step must run (design/components/button.md 16.1), so no in-flight guard.\n const { pending: stepPending, run: runStep } = useActionTrigger({\n ignoreWhilePending: false,\n captureSuperseded,\n });\n\n const optimisticValues = useMemo(() => toArray(optimistic), [optimistic]);\n const held = gestureThumb !== null || stepHeld || stepPending || commitState.pending;\n const shown = held && live !== null ? live : optimisticValues;\n const pending = stepPending || commitState.pending;\n\n // --- Inside a Field.Root (design 9.4) ------------------------------------------------------\n\n // One thumb: its input is the Field's labelable control. Several: the Root (`role=\"group\"`)\n // registers, `Field.Label` drops `for` and names the group through `aria-labelledby`.\n const thumbCount = shown.length;\n const field = useFieldControl({\n labelable: thumbCount === 1,\n name: nameProp,\n disabled: disabledProp,\n component: \"Slider.Root\",\n });\n const fieldName = field.fieldName;\n const name = field.name;\n const disabled = field.disabled;\n const fieldId = field.id;\n const thumbId = useCallback(\n (index: number) => (index === 0 && fieldId !== undefined ? fieldId : `${id}-thumb-${index}`),\n [id, fieldId],\n );\n const rootRef = thumbCount > 1 ? field.ref : undefined;\n useDevWarning(\n field.inField && field.required,\n isDev &&\n \"Slider.Root: a range is never empty, so `required` on the enclosing Field.Root has no \" +\n \"effect on the slider.\",\n );\n /**\n * The reason of the latest change the user or the platform made, consumed by the Field\n * notification below: `\"activate\"` dismisses a shown server error, a rollback does not.\n */\n const lastReason = useRef<ChangeReason | null>(null);\n // A pointer gesture and the JS-normalised keys fire no `input` / `change` the Field hears:\n // tell it at the commit, when the optimistic value changes (design 9.4.4).\n useFieldValueChange(optimisticValues.join(\"\\u0000\"), () => {\n const edit = lastReason.current === \"activate\";\n lastReason.current = null;\n return edit;\n });\n const {\n \"aria-labelledby\": fieldLabelledBy,\n \"aria-describedby\": fieldDescribedBy,\n \"aria-invalid\": fieldInvalid,\n \"data-invalid\": fieldDataInvalid,\n } = field.attributes;\n const inField = field.inField;\n const fieldRef = field.ref;\n const fieldWiring = useMemo<SliderFieldWiring | null>(() => {\n if (!inField) return null;\n const single = thumbCount === 1;\n return {\n inputRef: single ? fieldRef : undefined,\n describedBy: single ? fieldDescribedBy : undefined,\n invalid: fieldInvalid,\n dataInvalid: fieldDataInvalid,\n name: fieldName,\n };\n }, [inField, fieldRef, thumbCount, fieldDescribedBy, fieldInvalid, fieldDataInvalid, fieldName]);\n\n /** What the thumbs show, for handlers; also written by `stepTo` ahead of the render. */\n const shownRef = useLatest(shown);\n\n const latest = useLatest({\n valueChangeAction,\n fromArray,\n runStep,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n });\n\n // --- Step and commit (design 2.4) ---------------------------------------------------------\n\n const stepTo = useCallback(\n (\n next: readonly number[],\n thumb: number | null,\n reason: ChangeReason,\n event: Event | undefined,\n ): boolean => {\n // No-op against what the user sees (conventions 2.3 item 8).\n if (equalValues(next, shownRef.current)) return false;\n liveRef.current = next;\n shownRef.current = next;\n // A controlled parent that adopts steps changes the optimistic value per step.\n lastReason.current = reason;\n setLive(next);\n setPendingThumb(thumb);\n // A revert has no commit after it: the optimistic value already shows the committed one.\n if (reason !== \"dismiss\") setStepHeld(true);\n const { valueChangeAction: action, fromArray: toValue, runStep: run } = latest.current;\n // Without a step action there is nothing to run and no consumer update to keep\n // interruptible: no transition, so `data-pending` does not blink on every pointer move.\n if (action === undefined) return true;\n run(() => {\n for (const type of STEP_TYPES) addTransitionType(type);\n return action?.(toValue(next), createActionDetails(event, { reason, thumb }));\n });\n return true;\n },\n [latest, shownRef],\n );\n\n const commitGesture = useCallback(\n (thumb: number | null, reason: ChangeReason, event: Event | undefined): void => {\n const start = gestureStart.current;\n gestureStart.current = null;\n // The commit's own pending state holds `live` from here (set in this same batch).\n setStepHeld(false);\n const next = liveRef.current;\n // Nothing changed since the gesture began (a drag out and back, a trailing `change`).\n if (start === null || next === null || equalValues(next, start)) return;\n lastReason.current = reason;\n setPendingThumb(thumb);\n dispatch(latest.current.fromArray(next), createActionDetails(event, { reason, thumb }));\n },\n [dispatch, latest],\n );\n\n // --- Thumb registry ------------------------------------------------------------------------\n\n const { registry, registerThumb, formElement } = useThumbRegistry();\n\n // --- Labels --------------------------------------------------------------------------------\n\n // The ref is for the dev warning, which can run before the re-render the registration scheduled.\n const {\n count: labelCount,\n register: registerLabel,\n countRef: labelCountRef,\n } = useRegisterCount();\n\n // --- Residual browser paths: mount reconciliation and form reset (design 9.2, 9.3) --------\n\n const [mountValue] = useState(value);\n const resetTarget = (): readonly number[] =>\n value !== undefined\n ? toArray(mountValue ?? value)\n : toArray(defaultValue ?? platformDefault(min, max, step));\n\n const readCurrent = (): readonly number[] =>\n shownRef.current.map((v, index) => {\n const input = registry.get(index);\n if (input === undefined) return v;\n const read = Number(input.value);\n return Number.isFinite(read) ? read : v;\n });\n\n const { onItemMounted } = useNativeGroupReconciliation<readonly number[]>({\n element: formElement,\n readCurrent,\n readDefault: resetTarget,\n base: () => shownRef.current,\n // Compare as the DOM would hold the values: a consumer's off-grid value is sanitised by the\n // browser (not by jsdom), and that is not a platform change.\n equals: (a, b) => {\n const reference = shownRef.current;\n return equalValues(\n sanitize(a, reference, min, max, step, gap),\n sanitize(b, reference, min, max, step, gap),\n );\n },\n onPlatformChange: (next, event) => {\n if (next.length !== shownRef.current.length) return;\n const before = shownRef.current;\n gestureStart.current = before;\n liveRef.current = before;\n stepTo(next, null, \"platform\", event);\n commitGesture(null, \"platform\", event);\n },\n onResetEvent: () => {\n // react-dom writes `defaultValue = value` after every update of a controlled input, so the\n // reset target is written here, right before the browser's reset algorithm reads it.\n writeDefaults(registry, resetTarget());\n },\n });\n\n // --- Keyboard (design 4.2) -----------------------------------------------------------------\n\n const inputStep = useCallback(\n (index: number, raw: number, event: Event) => {\n if (!Number.isFinite(raw)) return;\n const before = shownRef.current;\n if (index >= before.length) return;\n // A key press is a one-step gesture: it starts at the value shown before it.\n if (stepTo(replaceAt(before, index, raw), index, \"activate\", event)) {\n if (gestureStart.current === null) gestureStart.current = before;\n }\n },\n [shownRef, stepTo],\n );\n\n const inputCommit = useCallback(\n (index: number, event: Event) => {\n // A pointer gesture commits at its release.\n if (activeGesture.current !== null) return;\n commitGesture(index, \"activate\", event);\n },\n [commitGesture],\n );\n\n const inputKeyDown = useCallback(\n (index: number, event: KeyboardEvent) => {\n const {\n orientation: axis,\n disabled: off,\n min: lo,\n max: hi,\n step: inc,\n gap: g,\n } = latest.current;\n if (off) return;\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n // Vertical: Firefox decreases a vertical range on ArrowRight; the APG says increase.\n // Horizontal RTL: the track is mirrored (min on the right), so ArrowLeft increases;\n // Chromium and Firefox mirror a native range, WebKit does not (design 7). LTR stays native.\n let increaseKey: \"ArrowLeft\" | \"ArrowRight\";\n if (axis === \"vertical\") {\n increaseKey = \"ArrowRight\";\n } else {\n // Read at the keydown: the direction may come from any ancestor and change at any time.\n const input = event.currentTarget as Element | null;\n if (input === null || getComputedStyle(input).direction !== \"rtl\") return;\n increaseKey = \"ArrowLeft\";\n }\n event.preventDefault();\n const before = shownRef.current;\n const current = before[index];\n if (current === undefined) return;\n const delta = event.key === increaseKey ? inc : -inc;\n const next = replaceAt(\n before,\n index,\n clampToNeighbours(before, index, current + delta, lo, hi, inc, g),\n );\n if (activeGesture.current !== null) {\n stepTo(next, index, \"activate\", event);\n return;\n }\n gestureStart.current = before;\n liveRef.current = before;\n stepTo(next, index, \"activate\", event);\n commitGesture(index, \"activate\", event);\n },\n [commitGesture, latest, shownRef, stepTo],\n );\n\n // --- Pointer (design 4.1) ------------------------------------------------------------------\n\n const warnedNoTrack = useRef(false);\n const beginGesture = useCallback(\n (index: number | null, event: PointerEvent, element: HTMLElement) => {\n const { disabled: off } = latest.current;\n if (off || event.button !== 0 || activeGesture.current !== null) return;\n const track = trackRef.current;\n if (track === null) {\n if (isDev && !warnedNoTrack.current) {\n warnedNoTrack.current = true;\n console.error(\n \"Slider.Thumb: a pointer press needs a Slider.Track to map the pointer to a value. \" +\n \"Without a Track the slider is keyboard-only.\",\n );\n }\n return;\n }\n // No text selection, no focus change through the compatibility `mousedown`.\n event.preventDefault();\n const rtl = getComputedStyle(track).direction === \"rtl\";\n\n const valueAt = (clientX: number, clientY: number): number => {\n const { min: lo, max: hi, orientation: axis } = latest.current;\n const rect = (trackRef.current ?? track).getBoundingClientRect();\n return pointerValue(rect, clientX, clientY, axis, rtl, lo, hi);\n };\n const moveTo = (thumb: number, raw: number, cause: Event): void => {\n const { min: lo, max: hi, step: inc, gap: g } = latest.current;\n const before = shownRef.current;\n if (thumb >= before.length) return;\n stepTo(\n replaceAt(before, thumb, clampToNeighbours(before, thumb, raw, lo, hi, inc, g)),\n thumb,\n \"activate\",\n cause,\n );\n };\n\n const start = valueAt(event.clientX, event.clientY);\n const startValues = shownRef.current;\n // A press on a Thumb that shares its value with a neighbour (stacked thumbs) moves the one\n // that can go toward the pointer, the Track's tie rule; when the press is exactly on the\n // value, the first move decides. Otherwise a Thumb press moves that Thumb.\n const tied = index === null ? null : tiedRange(startValues, index);\n /** The thumb the gesture moves; `null` while a press on stacked thumbs is undecided. */\n let decided: number | null =\n index === null ? nearestThumb(startValues, start) : tied ? resolveTie(tied, start) : index;\n /** The thumb shown as dragging and focused meanwhile. */\n let thumb = decided ?? index ?? 0;\n const pointerId = event.pointerId;\n try {\n element.setPointerCapture(pointerId);\n } catch {\n // An inactive pointer id (a synthetic event): the gesture still follows the element.\n }\n\n const decide = (raw: number): boolean => {\n if (decided !== null) return true;\n decided = resolveTie(tied, raw);\n if (decided === null) return false;\n if (decided !== thumb) {\n thumb = decided;\n setGestureThumb(thumb);\n registry.get(thumb)?.focus({ focusVisible: false } as FocusOptions);\n }\n return true;\n };\n const follow = (pointerEvent: PointerEvent): void => {\n const raw = valueAt(pointerEvent.clientX, pointerEvent.clientY);\n if (decide(raw)) moveTo(thumb, raw, pointerEvent);\n };\n\n const onMove = (moveEvent: PointerEvent): void => {\n if (moveEvent.pointerId !== pointerId) return;\n follow(moveEvent);\n };\n const onEnd = (endEvent: PointerEvent): void => {\n if (endEvent.pointerId !== pointerId) return;\n detach();\n // The release position is the gesture's last (an engine may coalesce the final move\n // into the `pointerup`); a cancel or a lost capture keeps the last move's value.\n if (endEvent.type === \"pointerup\") follow(endEvent);\n activeGesture.current = null;\n setGestureThumb(null);\n commitGesture(thumb, \"activate\", endEvent);\n };\n const detach = (): void => {\n element.removeEventListener(\"pointermove\", onMove);\n element.removeEventListener(\"pointerup\", onEnd);\n element.removeEventListener(\"pointercancel\", onEnd);\n element.removeEventListener(\"lostpointercapture\", onEnd);\n };\n element.addEventListener(\"pointermove\", onMove);\n element.addEventListener(\"pointerup\", onEnd);\n element.addEventListener(\"pointercancel\", onEnd);\n element.addEventListener(\"lostpointercapture\", onEnd);\n\n activeGesture.current = { pointerId, detach };\n setGestureThumb(thumb);\n gestureStart.current = shownRef.current;\n liveRef.current = shownRef.current;\n // A capture alone holds `live` on screen: start it from what is shown, not from the value\n // an earlier gesture left behind (a press exactly on the current value steps nothing).\n setLive(shownRef.current);\n // `:focus-visible` does not match after a pointer press, as on a native range.\n registry.get(thumb)?.focus({ focusVisible: false } as FocusOptions);\n if (decided !== null) moveTo(thumb, start, event);\n },\n [commitGesture, latest, registry, shownRef, stepTo],\n );\n\n // An unmount mid-gesture leaves no listener behind.\n useEffect(\n () => () => {\n activeGesture.current?.detach();\n activeGesture.current = null;\n },\n [],\n );\n\n // --- Development warnings ------------------------------------------------------------------\n\n useSliderDevWarnings({\n stepProp,\n stepValid,\n min,\n max,\n step,\n value,\n defaultValue,\n shape,\n // Inside a Field, `Field.Label` names the group (design 9.4.2).\n unnamedGroup:\n shown.length > 1 &&\n !inField &&\n rest[\"aria-label\"] === undefined &&\n rest[\"aria-labelledby\"] === undefined,\n labelCountRef,\n });\n\n // --- Render --------------------------------------------------------------------------------\n\n const count = shown.length;\n const geometry = sliderGeometry(shown, min, max);\n\n const shownValue = fromArray(shown);\n const dragging = gestureThumb !== null;\n const state = useMemo<SliderRootState<T>>(\n () => ({\n value: shownValue,\n values: shown,\n pending,\n dragging,\n orientation,\n disabled,\n min,\n max,\n step,\n }),\n [shownValue, shown, pending, dragging, orientation, disabled, min, max, step],\n );\n\n // Memoised: the functions are stable, so this changes only with the state below.\n const context = useMemo<SliderContextValue>(\n () => ({\n state: state as SliderRootState<SliderValue>,\n shown,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n pending,\n draggingThumb: gestureThumb,\n pendingThumb,\n name,\n form,\n getAriaValueText,\n labelId,\n thumbId,\n trackRef,\n inputStep,\n inputCommit,\n inputKeyDown,\n beginGesture,\n registerThumb,\n registerLabel,\n onItemMounted,\n field: fieldWiring,\n }),\n [\n state,\n shown,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n pending,\n gestureThumb,\n pendingThumb,\n name,\n form,\n getAriaValueText,\n labelId,\n thumbId,\n inputStep,\n inputCommit,\n inputKeyDown,\n beginGesture,\n registerThumb,\n registerLabel,\n onItemMounted,\n fieldWiring,\n ],\n );\n\n // Several thumbs: the Field's label, then `Slider.Label` while one is mounted (the consumer's\n // tokens come first through the merge). Only when there is one: an owned `undefined` would\n // remove the consumer's own tokens.\n const labelledBy =\n count > 1 ? mergeTokenLists(fieldLabelledBy, labelCount > 0 ? labelId : undefined) : \"\";\n const libraryProps: Partial<ComponentPropsWithRef<\"div\">> & DataAttributes = {\n role: count > 1 ? \"group\" : undefined,\n ...(labelledBy !== \"\" ? { \"aria-labelledby\": labelledBy } : {}),\n // The group element is described (read when focus enters it); one thumb: its input is.\n ...(count > 1 && fieldDescribedBy !== undefined\n ? { \"aria-describedby\": fieldDescribedBy }\n : {}),\n // Inside a Field only (`aria-invalid` goes on the inputs, never on the group).\n ...(inField ? { \"data-invalid\": fieldDataInvalid } : {}),\n \"data-pending\": dataAttr(pending),\n \"data-dragging\": dataAttr(dragging),\n \"data-orientation\": orientation,\n \"data-disabled\": dataAttr(disabled),\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, SliderRootState<T>>({\n defaultElement: \"div\",\n render,\n state,\n className,\n // The geometry properties lose to the consumer's own entries (design 3.1).\n style: (s) => ({ ...(geometry as CSSProperties), ...resolveStateValue(style, s) }),\n children,\n props: rest,\n libraryProps,\n ref: rootRef,\n });\n\n return <SliderContext value={context}>{element}</SliderContext>;\n}\n\nSliderRootImpl.displayName = \"SliderRoot\";\n\n/**\n * `Slider.Root`. Overloaded so that the value's shape is inferred from `value` / `defaultValue`\n * as `number` or `readonly number[]` (an array literal would otherwise infer a mutable\n * `number[]`), and every action and state function receives that shape (design 3.1).\n */\nexport const SliderRoot = SliderRootImpl as {\n (props: SliderRootProps<number>): ReactNode;\n (props: SliderRootProps<readonly number[]>): ReactNode;\n (props: SliderRootProps<SliderValue>): ReactNode;\n displayName?: string;\n};\n"],"mappings":";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AC;EAE7D,GAAI,QAAQ,KAAK,qBAAqB,KAAA,IAClC,EAAE,oBAAoB,iBAAiB,IACvC,CAAC;EAEL,GAAI,UAAU,EAAE,gBAAgB,iBAAiB,IAAI,CAAC;EACtD,gBAAgB,SAAS,OAAO;EAChC,iBAAiB,SAAS,QAAQ;EAClC,oBAAoB;EACpB,iBAAiB,SAAS,QAAQ;CACpC;CAEA,MAAM,UAAU,UAA4D;EAC1E,gBAAgB;EAChB;EACA;EACA;EAEA,QAAQ,OAAO;GAAE,GAAI;GAA4B,GAAG,kBAAkB,OAAO,CAAC;EAAE;EAChF;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,eAAD;EAAe,OAAO;EAAU,UAAA;CAAuB,CAAA;AAChE;AAEA,eAAe,cAAc;;;;;;AAO7B,MAAa,aAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"slider-thumb.d.mts","names":[],"sources":["../../src/slider/slider-thumb.tsx"],"mappings":";;;;iBAoBiB;WACN;;WAEA;;WAEA;;WAEA;WACA,aAAa;WACb;;iBAGM,yBAAyB,KACxC;;EAgBA;;EAEA;;EAEA;;;;;EAKA;;EAEA;;EAEA;;EAEA,WAAW,IAAI;;EAEf;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,+BAA+B;;;;;;;;;;;;;wBAgCrC,cACd,OACA,MACA,oBACc,8BACK,oCACC,iBACpB,UAAU,kBACV,WACA,WACA,OACA,UACA,WACG,QACF,mBAAgB;yBAdH"}
1
+ {"version":3,"file":"slider-thumb.d.mts","names":[],"sources":["../../src/slider/slider-thumb.tsx"],"mappings":";;;;iBAuBiB;WACN;;WAEA;;WAEA;;WAEA;WACA,aAAa;WACb;;iBAGM,yBAAyB,KACxC;;EAgBA;;EAEA;;EAEA;;;;;EAKA;;EAEA;;EAEA;;EAEA,WAAW,IAAI;;EAEf;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,+BAA+B;;;;;;;;;;;;;wBAgCrC,cACd,OACA,MACA,oBACc,8BACK,oCACC,iBACpB,UAAU,kBACV,WACA,WACA,OACA,UACA,WACG,QACF,mBAAgB;yBAdH"}
@@ -1,14 +1,16 @@
1
1
  "use client";
2
2
  import { dataAttr } from "../internal/data-attr.mjs";
3
3
  import { useDevWarning } from "../internal/use-dev-warning.mjs";
4
- import { mergeRefs, mergeTokenLists } from "../internal/merge-props.mjs";
4
+ import { mergeTokenLists } from "../internal/merge-props.mjs";
5
5
  import { resolveStateValue } from "../internal/render-element.mjs";
6
6
  import { useRender } from "../internal/use-render.mjs";
7
+ import { useMergedRefs } from "../internal/use-merged-refs.mjs";
7
8
  import { useSliderContext } from "./slider-context.mjs";
8
9
  import { percent, thumbBounds } from "./slider-arithmetic.mjs";
9
- import { useEffectEvent, useLayoutEffect, useMemo, useRef } from "react";
10
+ import { useEffectEvent, useLayoutEffect, useRef } from "react";
10
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
12
  //#region src/slider/slider-thumb.tsx
13
+ const isDev = process.env.NODE_ENV !== "production";
12
14
  /** Visually hidden, sized to the thumb so an assistive-technology focus ring lands on it. */
13
15
  const HIDDEN_INPUT_STYLE = {
14
16
  position: "absolute",
@@ -43,7 +45,7 @@ function SliderThumb({ index = 0, name, form, "aria-label": ariaLabel, "aria-lab
43
45
  const shownValue = value ?? ctx.min;
44
46
  const inputRef = useRef(null);
45
47
  const fieldInputRef = index === 0 ? ctx.field?.inputRef : void 0;
46
- const mergedInputRef = useMemo(() => mergeRefs(inputRef, consumerInputRef, fieldInputRef), [consumerInputRef, fieldInputRef]);
48
+ const mergedInputRef = useMergedRefs(inputRef, consumerInputRef, fieldInputRef);
47
49
  const { registerThumb, onItemMounted } = ctx;
48
50
  useLayoutEffect(() => {
49
51
  const input = inputRef.current;
@@ -72,10 +74,10 @@ function SliderThumb({ index = 0, name, form, "aria-label": ariaLabel, "aria-lab
72
74
  input.removeEventListener("keydown", onNativeKeyDown);
73
75
  };
74
76
  }, [inRange]);
75
- useDevWarning(!inRange, `Slider.Thumb: \`index={${index}}\` is outside the value (${ctx.shown.length} ${ctx.shown.length === 1 ? "value" : "values"}). The Thumb renders nothing.`);
76
- useDevWarning(inRange && ctx.shown.length > 1 && ariaLabel === void 0 && ariaLabelledBy === void 0, `Slider.Thumb: each thumb of a multi-thumb slider needs its own name (\`aria-label\` or \`aria-labelledby\`), e.g. "Minimum price"; the thumb at index ${index} has none.`);
77
+ useDevWarning(!inRange, isDev && `Slider.Thumb: \`index={${index}}\` is outside the value (${ctx.shown.length} ${ctx.shown.length === 1 ? "value" : "values"}). The Thumb renders nothing.`);
78
+ useDevWarning(inRange && ctx.shown.length > 1 && ariaLabel === void 0 && ariaLabelledBy === void 0, isDev && `Slider.Thumb: each thumb of a multi-thumb slider needs its own name (\`aria-label\` or \`aria-labelledby\`), e.g. "Minimum price"; the thumb at index ${index} has none.`);
77
79
  const fieldName = ctx.field?.name;
78
- useDevWarning(inRange && name !== void 0 && fieldName !== void 0 && name !== fieldName, `Slider.Thumb: its \`name\` ("${name}") differs from the Field.Root's ("${fieldName}"). The Field reads server errors and \`validate\`'s value by the Field's name.`);
80
+ useDevWarning(inRange && name !== void 0 && fieldName !== void 0 && name !== fieldName, isDev && `Slider.Thumb: its \`name\` ("${name}") differs from the Field.Root's ("${fieldName}"). The Field reads server errors and \`validate\`'s value by the Field's name.`);
79
81
  const pending = ctx.pending && ctx.pendingThumb === index;
80
82
  const dragging = ctx.draggingThumb === index;
81
83
  const state = {
@@ -1 +1 @@
1
- {"version":3,"file":"slider-thumb.mjs","names":[],"sources":["../../src/slider/slider-thumb.tsx"],"sourcesContent":["\"use client\";\nimport { useEffectEvent, useLayoutEffect, useMemo, useRef } from \"react\";\nimport type {\n ChangeEvent,\n ComponentPropsWithRef,\n CSSProperties,\n PointerEvent as ReactPointerEvent,\n ReactNode,\n Ref,\n} from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { mergeRefs, mergeTokenLists } from \"../internal/merge-props.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { percent, thumbBounds } from \"./slider-arithmetic.js\";\nimport { useSliderContext } from \"./slider-context.js\";\nimport type { SliderOrientation } from \"./slider-root.js\";\n\nexport interface SliderThumbState {\n readonly index: number;\n /** The value this thumb shows. */\n readonly value: number;\n /** The Root is pending and this thumb is the one the latest step or commit moved. */\n readonly pending: boolean;\n /** A pointer is captured on this thumb. */\n readonly dragging: boolean;\n readonly orientation: SliderOrientation;\n readonly disabled: boolean;\n}\n\nexport interface SliderThumbProps extends Omit<\n ComponentPropsWithRef<\"span\">,\n | \"onPointerDown\"\n | \"aria-label\"\n | \"aria-labelledby\"\n | \"aria-describedby\"\n // The value attributes are the native input's (design 8): never authored.\n | \"aria-valuemin\"\n | \"aria-valuemax\"\n | \"aria-valuenow\"\n | \"aria-valuetext\"\n | \"aria-orientation\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /** Which value this thumb edits. Default `0`. */\n index?: number;\n /** Form field name of this thumb's input; overrides the Root's `name`. */\n name?: string;\n /** The `form` attribute of this thumb's input; overrides the Root's. */\n form?: string;\n /**\n * Forwarded to the input (the element with role `slider`), not the styled element. Required\n * for every thumb of a multi-thumb slider unless `aria-labelledby` is given (dev warning).\n */\n \"aria-label\"?: string;\n /** Forwarded to the input. */\n \"aria-labelledby\"?: string;\n /** Forwarded to the input. */\n \"aria-describedby\"?: string;\n /** The native `<input type=\"range\">` inside the thumb. */\n inputRef?: Ref<HTMLInputElement>;\n /** Forwarded to the input. */\n autoFocus?: boolean;\n className?: StateValue<string | undefined, SliderThumbState>;\n style?: StateValue<CSSProperties | undefined, SliderThumbState>;\n /** Rendered inside the styled element, next to the input (an icon, a value bubble). */\n children?: StateValue<ReactNode, SliderThumbState>;\n render?: RenderProp<ComponentPropsWithRef<\"span\">, SliderThumbState>;\n}\n\n/** Visually hidden, sized to the thumb so an assistive-technology focus ring lands on it. */\nconst HIDDEN_INPUT_STYLE: CSSProperties = {\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n margin: 0,\n opacity: 0,\n pointerEvents: \"none\",\n};\n\n/** Chromium derives the accessibility orientation from `writing-mode`; `rtl` puts `min` at the bottom. */\nconst VERTICAL_INPUT_STYLE: CSSProperties = {\n ...HIDDEN_INPUT_STYLE,\n writingMode: \"vertical-lr\",\n direction: \"rtl\",\n};\n\n/**\n * One value handle: a styled element (`span`) **containing** a visually hidden native\n * `<input type=\"range\">`, which is the focusable, labelled, form-participating `slider` with the\n * native keyboard (conventions 1.1 exception). `ref` goes to the styled element, `inputRef` to the\n * input. The input's native `min` / `max` are the neighbours' values, so thumbs cannot cross.\n *\n * Owned keys on the styled element: `onPointerDown`, `data-index`, `data-orientation`,\n * `data-dragging`, `data-pending`, `data-disabled`, and `--slider-value` / `touch-action` in\n * `style` (the consumer's entries win). `aria-label`, `aria-labelledby`, `aria-describedby`,\n * `name`, `form` and `autoFocus` go to the input; every other input attribute is the library's.\n */\nexport function SliderThumb({\n index = 0,\n name,\n form,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n inputRef: consumerInputRef,\n autoFocus,\n className,\n style,\n children,\n render,\n ...rest\n}: SliderThumbProps) {\n const ctx = useSliderContext(\"Slider.Thumb\");\n const value = ctx.shown[index];\n const inRange = value !== undefined;\n const shownValue = value ?? ctx.min;\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n // Inside a Field with one thumb, Thumb 0's input is the Field's control (design 9.4.1).\n const fieldInputRef = index === 0 ? ctx.field?.inputRef : undefined;\n const mergedInputRef = useMemo(\n () =>\n mergeRefs<HTMLInputElement | null>(\n inputRef,\n consumerInputRef,\n fieldInputRef as Ref<HTMLInputElement | null> | undefined,\n ),\n [consumerInputRef, fieldInputRef],\n );\n\n // Registration with the Root (pointer focus, reconciliation, reset), from a layout effect so\n // the Root's mount reconciliation, which runs after its children's, sees every input.\n const { registerThumb, onItemMounted } = ctx;\n useLayoutEffect(() => {\n const input = inputRef.current;\n if (input === null) return;\n const unregister = registerThumb(index, input);\n onItemMounted();\n return unregister;\n }, [index, registerThumb, onItemMounted]);\n\n // React surfaces no `onChange` for the native `change` (design 4.2), and the vertical\n // ArrowLeft / ArrowRight normalisation needs the `keydown` before the browser acts on it.\n const onNativeChange = useEffectEvent((event: Event) => {\n ctx.inputCommit(index, event);\n });\n const onNativeKeyDown = useEffectEvent((event: KeyboardEvent) => {\n ctx.inputKeyDown(index, event);\n });\n useLayoutEffect(() => {\n const input = inputRef.current;\n if (input === null) return;\n input.addEventListener(\"change\", onNativeChange);\n input.addEventListener(\"keydown\", onNativeKeyDown);\n return () => {\n input.removeEventListener(\"change\", onNativeChange);\n input.removeEventListener(\"keydown\", onNativeKeyDown);\n };\n }, [inRange]);\n\n useDevWarning(\n !inRange,\n `Slider.Thumb: \\`index={${index}}\\` is outside the value (${ctx.shown.length} ` +\n `${ctx.shown.length === 1 ? \"value\" : \"values\"}). The Thumb renders nothing.`,\n );\n useDevWarning(\n inRange && ctx.shown.length > 1 && ariaLabel === undefined && ariaLabelledBy === undefined,\n `Slider.Thumb: each thumb of a multi-thumb slider needs its own name (\\`aria-label\\` or ` +\n `\\`aria-labelledby\\`), e.g. \"Minimum price\"; the thumb at index ${index} has none.`,\n );\n\n const fieldName = ctx.field?.name;\n useDevWarning(\n inRange && name !== undefined && fieldName !== undefined && name !== fieldName,\n `Slider.Thumb: its \\`name\\` (\"${name}\") differs from the Field.Root's (\"${fieldName}\"). ` +\n \"The Field reads server errors and `validate`'s value by the Field's name.\",\n );\n\n const pending = ctx.pending && ctx.pendingThumb === index;\n const dragging = ctx.draggingThumb === index;\n const state: SliderThumbState = {\n index,\n value: shownValue,\n pending,\n dragging,\n orientation: ctx.orientation,\n disabled: ctx.disabled,\n };\n\n const { lower, upper } = thumbBounds(ctx.shown, index, ctx.min, ctx.max, ctx.gap);\n const input = inRange ? (\n <input\n ref={mergedInputRef}\n type=\"range\"\n id={ctx.thumbId(index)}\n name={name ?? ctx.name}\n form={form ?? ctx.form}\n min={lower}\n max={upper}\n step={ctx.step}\n value={shownValue}\n disabled={ctx.disabled}\n autoFocus={autoFocus}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={\n mergeTokenLists(ariaDescribedBy, index === 0 ? ctx.field?.describedBy : undefined) ||\n undefined\n }\n aria-invalid={ctx.field?.invalid}\n aria-valuetext={ctx.getAriaValueText?.(shownValue, index)}\n style={ctx.orientation === \"vertical\" ? VERTICAL_INPUT_STYLE : HIDDEN_INPUT_STYLE}\n onChange={(event: ChangeEvent<HTMLInputElement>) => {\n ctx.inputStep(index, Number(event.target.value), event.nativeEvent);\n }}\n />\n ) : null;\n\n const geometry = {\n \"--slider-value\": `${percent(shownValue, ctx.min, ctx.max)}%`,\n touchAction: ctx.orientation === \"vertical\" ? \"pan-x\" : \"pan-y\",\n } as CSSProperties;\n\n const element = useRender<ComponentPropsWithRef<\"span\">, SliderThumbState>({\n defaultElement: \"span\",\n render,\n state,\n className,\n // The library's entries lose to the consumer's own (design 3.2).\n style: (s) => ({ ...geometry, ...resolveStateValue(style, s) }),\n children: undefined,\n props: rest,\n libraryProps: {\n \"data-index\": String(index),\n \"data-orientation\": ctx.orientation,\n \"data-dragging\": dataAttr(dragging),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(ctx.disabled),\n ...(ctx.field !== null ? { \"data-invalid\": ctx.field.dataInvalid } : {}),\n onPointerDown: (event: ReactPointerEvent<HTMLSpanElement>) => {\n ctx.beginGesture(index, event.nativeEvent, event.currentTarget);\n },\n // Owned, so a `render` element's own children can never drop the input.\n children: (\n <>\n {input}\n {resolveStateValue(children, state)}\n </>\n ),\n // `children` is not in the library layer's type (useRender resolves it), but an owned\n // key wins over a `render` element's own children, which is what keeps the input.\n } as Partial<ComponentPropsWithRef<\"span\">> & DataAttributes,\n });\n\n return inRange ? element : null;\n}\n\nSliderThumb.displayName = \"SliderThumb\";\n"],"mappings":";;;;;;;;;;;;AA2EA,MAAM,qBAAoC;CACxC,UAAU;CACV,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,eAAe;AACjB;;AAGA,MAAM,uBAAsC;CAC1C,GAAG;CACH,aAAa;CACb,WAAW;AACb;;;;;;;;;;;;AAaA,SAAgB,YAAY,EAC1B,QAAQ,GACR,MACA,MACA,cAAc,WACd,mBAAmB,gBACnB,oBAAoB,iBACpB,UAAU,kBACV,WACA,WACA,OACA,UACA,QACA,GAAG,QACgB;CACnB,MAAM,MAAM,iBAAiB,cAAc;CAC3C,MAAM,QAAQ,IAAI,MAAM;CACxB,MAAM,UAAU,UAAU,KAAA;CAC1B,MAAM,aAAa,SAAS,IAAI;CAEhC,MAAM,WAAW,OAAgC,IAAI;CAErD,MAAM,gBAAgB,UAAU,IAAI,IAAI,OAAO,WAAW,KAAA;CAC1D,MAAM,iBAAiB,cAEnB,UACE,UACA,kBACA,aACF,GACF,CAAC,kBAAkB,aAAa,CAClC;CAIA,MAAM,EAAE,eAAe,kBAAkB;CACzC,sBAAsB;EACpB,MAAM,QAAQ,SAAS;EACvB,IAAI,UAAU,MAAM;EACpB,MAAM,aAAa,cAAc,OAAO,KAAK;EAC7C,cAAc;EACd,OAAO;CACT,GAAG;EAAC;EAAO;EAAe;CAAa,CAAC;CAIxC,MAAM,iBAAiB,gBAAgB,UAAiB;EACtD,IAAI,YAAY,OAAO,KAAK;CAC9B,CAAC;CACD,MAAM,kBAAkB,gBAAgB,UAAyB;EAC/D,IAAI,aAAa,OAAO,KAAK;CAC/B,CAAC;CACD,sBAAsB;EACpB,MAAM,QAAQ,S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B;EAC/D,WAAW,UAAyC;GAClD,IAAI,UAAU,OAAO,OAAO,MAAM,OAAO,KAAK,GAAG,MAAM,WAAW;EACpE;CACD,CAAA,IACC;CAEJ,MAAM,WAAW;EACf,kBAAkB,GAAG,QAAQ,YAAY,IAAI,KAAK,IAAI,GAAG,EAAE;EAC3D,aAAa,IAAI,gBAAgB,aAAa,UAAU;CAC1D;CAEA,MAAM,UAAU,UAA2D;EACzE,gBAAgB;EAChB;EACA;EACA;EAEA,QAAQ,OAAO;GAAE,GAAG;GAAU,GAAG,kBAAkB,OAAO,CAAC;EAAE;EAC7D,UAAU,KAAA;EACV,OAAO;EACP,cAAc;GACZ,cAAc,OAAO,KAAK;GAC1B,oBAAoB,IAAI;GACxB,iBAAiB,SAAS,QAAQ;GAClC,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,IAAI,QAAQ;GACtC,GAAI,IAAI,UAAU,OAAO,EAAE,gBAAgB,IAAI,MAAM,YAAY,IAAI,CAAC;GACtE,gBAAgB,UAA8C;IAC5D,IAAI,aAAa,OAAO,MAAM,aAAa,MAAM,aAAa;GAChE;GAEA,UACE,qBAAA,UAAA,EAAA,UAAA,CACG,OACA,kBAAkB,UAAU,KAAK,CAClC,EAAA,CAAA;EAIN;CACF,CAAC;CAED,OAAO,UAAU,UAAU;AAC7B;AAEA,YAAY,cAAc"}
1
+ {"version":3,"file":"slider-thumb.mjs","names":[],"sources":["../../src/slider/slider-thumb.tsx"],"sourcesContent":["\"use client\";\nimport { useEffectEvent, useLayoutEffect, useRef } from \"react\";\nimport type {\n ChangeEvent,\n ComponentPropsWithRef,\n CSSProperties,\n PointerEvent as ReactPointerEvent,\n ReactNode,\n Ref,\n} from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { mergeTokenLists } from \"../internal/merge-props.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useMergedRefs } from \"../internal/use-merged-refs.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { percent, thumbBounds } from \"./slider-arithmetic.js\";\nimport { useSliderContext } from \"./slider-context.js\";\nimport type { SliderOrientation } from \"./slider-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface SliderThumbState {\n readonly index: number;\n /** The value this thumb shows. */\n readonly value: number;\n /** The Root is pending and this thumb is the one the latest step or commit moved. */\n readonly pending: boolean;\n /** A pointer is captured on this thumb. */\n readonly dragging: boolean;\n readonly orientation: SliderOrientation;\n readonly disabled: boolean;\n}\n\nexport interface SliderThumbProps extends Omit<\n ComponentPropsWithRef<\"span\">,\n | \"onPointerDown\"\n | \"aria-label\"\n | \"aria-labelledby\"\n | \"aria-describedby\"\n // The value attributes are the native input's (design 8): never authored.\n | \"aria-valuemin\"\n | \"aria-valuemax\"\n | \"aria-valuenow\"\n | \"aria-valuetext\"\n | \"aria-orientation\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /** Which value this thumb edits. Default `0`. */\n index?: number;\n /** Form field name of this thumb's input; overrides the Root's `name`. */\n name?: string;\n /** The `form` attribute of this thumb's input; overrides the Root's. */\n form?: string;\n /**\n * Forwarded to the input (the element with role `slider`), not the styled element. Required\n * for every thumb of a multi-thumb slider unless `aria-labelledby` is given (dev warning).\n */\n \"aria-label\"?: string;\n /** Forwarded to the input. */\n \"aria-labelledby\"?: string;\n /** Forwarded to the input. */\n \"aria-describedby\"?: string;\n /** The native `<input type=\"range\">` inside the thumb. */\n inputRef?: Ref<HTMLInputElement>;\n /** Forwarded to the input. */\n autoFocus?: boolean;\n className?: StateValue<string | undefined, SliderThumbState>;\n style?: StateValue<CSSProperties | undefined, SliderThumbState>;\n /** Rendered inside the styled element, next to the input (an icon, a value bubble). */\n children?: StateValue<ReactNode, SliderThumbState>;\n render?: RenderProp<ComponentPropsWithRef<\"span\">, SliderThumbState>;\n}\n\n/** Visually hidden, sized to the thumb so an assistive-technology focus ring lands on it. */\nconst HIDDEN_INPUT_STYLE: CSSProperties = {\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n margin: 0,\n opacity: 0,\n pointerEvents: \"none\",\n};\n\n/** Chromium derives the accessibility orientation from `writing-mode`; `rtl` puts `min` at the bottom. */\nconst VERTICAL_INPUT_STYLE: CSSProperties = {\n ...HIDDEN_INPUT_STYLE,\n writingMode: \"vertical-lr\",\n direction: \"rtl\",\n};\n\n/**\n * One value handle: a styled element (`span`) **containing** a visually hidden native\n * `<input type=\"range\">`, which is the focusable, labelled, form-participating `slider` with the\n * native keyboard (conventions 1.1 exception). `ref` goes to the styled element, `inputRef` to the\n * input. The input's native `min` / `max` are the neighbours' values, so thumbs cannot cross.\n *\n * Owned keys on the styled element: `onPointerDown`, `data-index`, `data-orientation`,\n * `data-dragging`, `data-pending`, `data-disabled`, and `--slider-value` / `touch-action` in\n * `style` (the consumer's entries win). `aria-label`, `aria-labelledby`, `aria-describedby`,\n * `name`, `form` and `autoFocus` go to the input; every other input attribute is the library's.\n */\nexport function SliderThumb({\n index = 0,\n name,\n form,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n inputRef: consumerInputRef,\n autoFocus,\n className,\n style,\n children,\n render,\n ...rest\n}: SliderThumbProps) {\n const ctx = useSliderContext(\"Slider.Thumb\");\n const value = ctx.shown[index];\n const inRange = value !== undefined;\n const shownValue = value ?? ctx.min;\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n // Inside a Field with one thumb, Thumb 0's input is the Field's control (design 9.4.1).\n const fieldInputRef = index === 0 ? ctx.field?.inputRef : undefined;\n const mergedInputRef = useMergedRefs<HTMLInputElement | null>(\n inputRef,\n consumerInputRef,\n fieldInputRef,\n );\n\n // Registration with the Root (pointer focus, reconciliation, reset), from a layout effect so\n // the Root's mount reconciliation, which runs after its children's, sees every input.\n const { registerThumb, onItemMounted } = ctx;\n useLayoutEffect(() => {\n const input = inputRef.current;\n if (input === null) return;\n const unregister = registerThumb(index, input);\n onItemMounted();\n return unregister;\n }, [index, registerThumb, onItemMounted]);\n\n // React surfaces no `onChange` for the native `change` (design 4.2), and the vertical\n // ArrowLeft / ArrowRight normalisation needs the `keydown` before the browser acts on it.\n const onNativeChange = useEffectEvent((event: Event) => {\n ctx.inputCommit(index, event);\n });\n const onNativeKeyDown = useEffectEvent((event: KeyboardEvent) => {\n ctx.inputKeyDown(index, event);\n });\n useLayoutEffect(() => {\n const input = inputRef.current;\n if (input === null) return;\n input.addEventListener(\"change\", onNativeChange);\n input.addEventListener(\"keydown\", onNativeKeyDown);\n return () => {\n input.removeEventListener(\"change\", onNativeChange);\n input.removeEventListener(\"keydown\", onNativeKeyDown);\n };\n }, [inRange]);\n\n useDevWarning(\n !inRange,\n isDev &&\n `Slider.Thumb: \\`index={${index}}\\` is outside the value (${ctx.shown.length} ` +\n `${ctx.shown.length === 1 ? \"value\" : \"values\"}). The Thumb renders nothing.`,\n );\n useDevWarning(\n inRange && ctx.shown.length > 1 && ariaLabel === undefined && ariaLabelledBy === undefined,\n isDev &&\n `Slider.Thumb: each thumb of a multi-thumb slider needs its own name (\\`aria-label\\` or ` +\n `\\`aria-labelledby\\`), e.g. \"Minimum price\"; the thumb at index ${index} has none.`,\n );\n\n const fieldName = ctx.field?.name;\n useDevWarning(\n inRange && name !== undefined && fieldName !== undefined && name !== fieldName,\n isDev &&\n `Slider.Thumb: its \\`name\\` (\"${name}\") differs from the Field.Root's (\"${fieldName}\"). ` +\n \"The Field reads server errors and `validate`'s value by the Field's name.\",\n );\n\n const pending = ctx.pending && ctx.pendingThumb === index;\n const dragging = ctx.draggingThumb === index;\n const state: SliderThumbState = {\n index,\n value: shownValue,\n pending,\n dragging,\n orientation: ctx.orientation,\n disabled: ctx.disabled,\n };\n\n const { lower, upper } = thumbBounds(ctx.shown, index, ctx.min, ctx.max, ctx.gap);\n const input = inRange ? (\n <input\n ref={mergedInputRef}\n type=\"range\"\n id={ctx.thumbId(index)}\n name={name ?? ctx.name}\n form={form ?? ctx.form}\n min={lower}\n max={upper}\n step={ctx.step}\n value={shownValue}\n disabled={ctx.disabled}\n autoFocus={autoFocus}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={\n mergeTokenLists(ariaDescribedBy, index === 0 ? ctx.field?.describedBy : undefined) ||\n undefined\n }\n aria-invalid={ctx.field?.invalid}\n aria-valuetext={ctx.getAriaValueText?.(shownValue, index)}\n style={ctx.orientation === \"vertical\" ? VERTICAL_INPUT_STYLE : HIDDEN_INPUT_STYLE}\n onChange={(event: ChangeEvent<HTMLInputElement>) => {\n ctx.inputStep(index, Number(event.target.value), event.nativeEvent);\n }}\n />\n ) : null;\n\n const geometry = {\n \"--slider-value\": `${percent(shownValue, ctx.min, ctx.max)}%`,\n touchAction: ctx.orientation === \"vertical\" ? \"pan-x\" : \"pan-y\",\n } as CSSProperties;\n\n const element = useRender<ComponentPropsWithRef<\"span\">, SliderThumbState>({\n defaultElement: \"span\",\n render,\n state,\n className,\n // The library's entries lose to the consumer's own (design 3.2).\n style: (s) => ({ ...geometry, ...resolveStateValue(style, s) }),\n children: undefined,\n props: rest,\n libraryProps: {\n \"data-index\": String(index),\n \"data-orientation\": ctx.orientation,\n \"data-dragging\": dataAttr(dragging),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(ctx.disabled),\n ...(ctx.field !== null ? { \"data-invalid\": ctx.field.dataInvalid } : {}),\n onPointerDown: (event: ReactPointerEvent<HTMLSpanElement>) => {\n ctx.beginGesture(index, event.nativeEvent, event.currentTarget);\n },\n // Owned, so a `render` element's own children can never drop the input.\n children: (\n <>\n {input}\n {resolveStateValue(children, state)}\n </>\n ),\n // `children` is not in the library layer's type (useRender resolves it), but an owned\n // key wins over a `render` element's own children, which is what keeps the input.\n } as Partial<ComponentPropsWithRef<\"span\">> & DataAttributes,\n });\n\n return inRange ? element : null;\n}\n\nSliderTh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,IAAI,KAAK,IAAI,GAAG,EAAE;EAC3D,aAAa,IAAI,gBAAgB,aAAa,UAAU;CAC1D;CAEA,MAAM,UAAU,UAA2D;EACzE,gBAAgB;EAChB;EACA;EACA;EAEA,QAAQ,OAAO;GAAE,GAAG;GAAU,GAAG,kBAAkB,OAAO,CAAC;EAAE;EAC7D,UAAU,KAAA;EACV,OAAO;EACP,cAAc;GACZ,cAAc,OAAO,KAAK;GAC1B,oBAAoB,IAAI;GACxB,iBAAiB,SAAS,QAAQ;GAClC,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,IAAI,QAAQ;GACtC,GAAI,IAAI,UAAU,OAAO,EAAE,gBAAgB,IAAI,MAAM,YAAY,IAAI,CAAC;GACtE,gBAAgB,UAA8C;IAC5D,IAAI,aAAa,OAAO,MAAM,aAAa,MAAM,aAAa;GAChE;GAEA,UACE,qBAAA,UAAA,EAAA,UAAA,CACG,OACA,kBAAkB,UAAU,KAAK,CAClC,EAAA,CAAA;EAIN;CACF,CAAC;CAED,OAAO,UAAU,UAAU;AAC7B;AAEA,YAAY,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"slider-value.d.mts","names":[],"sources":["../../src/slider/slider-value.tsx"],"mappings":";;;;;;;;iBAYiB,iBAAiB,UAAU,cAAc,qBAAqB,gBAAgB;;WAEpF;;iBAGM,iBAAiB,UAAU,cAAc,qBAAqB,KAC7E;;;;;EAOA;EACA,YAAY,+BAA+B,iBAAiB;EAC5D,QAAQ,WAAW,2BAA2B,iBAAiB;EAC/D,WAAW,WAAW,WAAW,iBAAiB;EAClD,SAAS,WAAW,+BAA+B,iBAAiB;;;;;;;wBAQtD,gBAAgB,UAAU,cAAc,eACtD,OACA,WACA,OACA,UACA,WACG,QACF,iBAAiB,KAAE;yBAPN"}
1
+ {"version":3,"file":"slider-value.d.mts","names":[],"sources":["../../src/slider/slider-value.tsx"],"mappings":";;;;;;;;iBAciB,iBAAiB,UAAU,cAAc,qBAAqB,gBAAgB;;WAEpF;;iBAGM,iBAAiB,UAAU,cAAc,qBAAqB,KAC7E;;;;;EAOA;EACA,YAAY,+BAA+B,iBAAiB;EAC5D,QAAQ,WAAW,2BAA2B,iBAAiB;EAC/D,WAAW,WAAW,WAAW,iBAAiB;EAClD,SAAS,WAAW,+BAA+B,iBAAiB;;;;;;;wBAQtD,gBAAgB,UAAU,cAAc,eACtD,OACA,WACA,OACA,UACA,WACG,QACF,iBAAiB,KAAE;yBAPN"}
@@ -3,6 +3,7 @@ import { useDevWarning } from "../internal/use-dev-warning.mjs";
3
3
  import { useRender } from "../internal/use-render.mjs";
4
4
  import { useSliderContext } from "./slider-context.mjs";
5
5
  //#region src/slider/slider-value.tsx
6
+ const isDev = process.env.NODE_ENV !== "production";
6
7
  /**
7
8
  * Displays the shown value: `children(state)`, or the thumb at `index`, or the single value as
8
9
  * text. A plain `span`, not `<output>`: a `status` live region updating on every step would
@@ -15,7 +16,7 @@ function SliderValuePart({ index, className, style, children, render, ...rest })
15
16
  index: index ?? null
16
17
  };
17
18
  const missing = children === void 0 && index === void 0 && ctx.shown.length > 1;
18
- useDevWarning(missing, "Slider.Value: a multi-thumb slider has no single value to show. Pass `index` to show one thumb's value, or `children` (a function of the state) to format them all.");
19
+ useDevWarning(missing, isDev && "Slider.Value: a multi-thumb slider has no single value to show. Pass `index` to show one thumb's value, or `children` (a function of the state) to format them all.");
19
20
  let fallback = null;
20
21
  if (index !== void 0) {
21
22
  const value = ctx.shown[index];