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

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 (537) hide show
  1. package/dist/accordion/accordion-context.mjs.map +1 -1
  2. package/dist/accordion/accordion-item.mjs +20 -6
  3. package/dist/accordion/accordion-item.mjs.map +1 -1
  4. package/dist/accordion/accordion-panel.mjs +4 -5
  5. package/dist/accordion/accordion-panel.mjs.map +1 -1
  6. package/dist/accordion/accordion-root.d.mts.map +1 -1
  7. package/dist/accordion/accordion-root.mjs +35 -16
  8. package/dist/accordion/accordion-root.mjs.map +1 -1
  9. package/dist/accordion/accordion-trigger.mjs +6 -7
  10. package/dist/accordion/accordion-trigger.mjs.map +1 -1
  11. package/dist/button/button.d.mts +78 -0
  12. package/dist/button/button.d.mts.map +1 -0
  13. package/dist/button/button.mjs +77 -0
  14. package/dist/button/button.mjs.map +1 -0
  15. package/dist/button/index.d.mts +3 -0
  16. package/dist/button/index.mjs +1 -0
  17. package/dist/checkbox/checkbox.d.mts +5 -3
  18. package/dist/checkbox/checkbox.d.mts.map +1 -1
  19. package/dist/checkbox/checkbox.mjs +27 -11
  20. package/dist/checkbox/checkbox.mjs.map +1 -1
  21. package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -1
  22. package/dist/checkbox-group/checkbox-group-item.d.mts +2 -1
  23. package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
  24. package/dist/checkbox-group/checkbox-group-item.mjs +5 -3
  25. package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
  26. package/dist/checkbox-group/checkbox-group-parent.mjs +2 -2
  27. package/dist/checkbox-group/checkbox-group-root.d.mts +5 -2
  28. package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
  29. package/dist/checkbox-group/checkbox-group-root.mjs +25 -6
  30. package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
  31. package/dist/combobox/combobox-clear.d.mts +37 -0
  32. package/dist/combobox/combobox-clear.d.mts.map +1 -0
  33. package/dist/combobox/combobox-clear.mjs +64 -0
  34. package/dist/combobox/combobox-clear.mjs.map +1 -0
  35. package/dist/combobox/combobox-context.mjs +23 -0
  36. package/dist/combobox/combobox-context.mjs.map +1 -0
  37. package/dist/combobox/combobox-group.d.mts +72 -0
  38. package/dist/combobox/combobox-group.d.mts.map +1 -0
  39. package/dist/combobox/combobox-group.mjs +104 -0
  40. package/dist/combobox/combobox-group.mjs.map +1 -0
  41. package/dist/combobox/combobox-input.d.mts +42 -0
  42. package/dist/combobox/combobox-input.d.mts.map +1 -0
  43. package/dist/combobox/combobox-input.mjs +102 -0
  44. package/dist/combobox/combobox-input.mjs.map +1 -0
  45. package/dist/combobox/combobox-label.d.mts +22 -0
  46. package/dist/combobox/combobox-label.d.mts.map +1 -0
  47. package/dist/combobox/combobox-label.mjs +32 -0
  48. package/dist/combobox/combobox-label.mjs.map +1 -0
  49. package/dist/combobox/combobox-list.d.mts +37 -0
  50. package/dist/combobox/combobox-list.d.mts.map +1 -0
  51. package/dist/combobox/combobox-list.mjs +71 -0
  52. package/dist/combobox/combobox-list.mjs.map +1 -0
  53. package/dist/combobox/combobox-option.d.mts +45 -0
  54. package/dist/combobox/combobox-option.d.mts.map +1 -0
  55. package/dist/combobox/combobox-option.mjs +88 -0
  56. package/dist/combobox/combobox-option.mjs.map +1 -0
  57. package/dist/combobox/combobox-popup.d.mts +49 -0
  58. package/dist/combobox/combobox-popup.d.mts.map +1 -0
  59. package/dist/combobox/combobox-popup.mjs +91 -0
  60. package/dist/combobox/combobox-popup.mjs.map +1 -0
  61. package/dist/combobox/combobox-root.d.mts +135 -0
  62. package/dist/combobox/combobox-root.d.mts.map +1 -0
  63. package/dist/combobox/combobox-root.mjs +523 -0
  64. package/dist/combobox/combobox-root.mjs.map +1 -0
  65. package/dist/combobox/combobox-trigger.d.mts +40 -0
  66. package/dist/combobox/combobox-trigger.d.mts.map +1 -0
  67. package/dist/combobox/combobox-trigger.mjs +99 -0
  68. package/dist/combobox/combobox-trigger.mjs.map +1 -0
  69. package/dist/combobox/index.d.mts +36 -0
  70. package/dist/combobox/index.d.mts.map +1 -0
  71. package/dist/combobox/index.mjs +36 -0
  72. package/dist/combobox/index.mjs.map +1 -0
  73. package/dist/csp/csp-provider.d.mts +25 -0
  74. package/dist/csp/csp-provider.d.mts.map +1 -0
  75. package/dist/csp/csp-provider.mjs +24 -0
  76. package/dist/csp/csp-provider.mjs.map +1 -0
  77. package/dist/csp/index.d.mts +3 -0
  78. package/dist/csp/index.mjs +3 -0
  79. package/dist/csp/style-hashes.d.mts +19 -0
  80. package/dist/csp/style-hashes.d.mts.map +1 -0
  81. package/dist/csp/style-hashes.mjs +21 -0
  82. package/dist/csp/style-hashes.mjs.map +1 -0
  83. package/dist/dialog/dialog-close.d.mts +22 -10
  84. package/dist/dialog/dialog-close.d.mts.map +1 -1
  85. package/dist/dialog/dialog-close.mjs +41 -25
  86. package/dist/dialog/dialog-close.mjs.map +1 -1
  87. package/dist/dialog/dialog-context.mjs.map +1 -1
  88. package/dist/dialog/dialog-form.d.mts +23 -10
  89. package/dist/dialog/dialog-form.d.mts.map +1 -1
  90. package/dist/dialog/dialog-form.mjs +51 -32
  91. package/dist/dialog/dialog-form.mjs.map +1 -1
  92. package/dist/dialog/dialog-popup.d.mts +10 -4
  93. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  94. package/dist/dialog/dialog-popup.mjs +118 -45
  95. package/dist/dialog/dialog-popup.mjs.map +1 -1
  96. package/dist/dialog/dialog-root.d.mts +14 -8
  97. package/dist/dialog/dialog-root.d.mts.map +1 -1
  98. package/dist/dialog/dialog-root.mjs +68 -13
  99. package/dist/dialog/dialog-root.mjs.map +1 -1
  100. package/dist/dialog/dialog-trigger.d.mts +11 -5
  101. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  102. package/dist/dialog/dialog-trigger.mjs +16 -8
  103. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  104. package/dist/dialog/index.d.mts +4 -2
  105. package/dist/dialog/index.d.mts.map +1 -1
  106. package/dist/dialog/index.mjs +4 -2
  107. package/dist/dialog/index.mjs.map +1 -1
  108. package/dist/field/field-control.d.mts +33 -0
  109. package/dist/field/field-control.d.mts.map +1 -0
  110. package/dist/field/field-control.mjs +68 -0
  111. package/dist/field/field-control.mjs.map +1 -0
  112. package/dist/field/field-description.d.mts +24 -0
  113. package/dist/field/field-description.d.mts.map +1 -0
  114. package/dist/field/field-description.mjs +34 -0
  115. package/dist/field/field-description.mjs.map +1 -0
  116. package/dist/field/field-error.d.mts +30 -0
  117. package/dist/field/field-error.d.mts.map +1 -0
  118. package/dist/field/field-error.mjs +42 -0
  119. package/dist/field/field-error.mjs.map +1 -0
  120. package/dist/field/field-label.d.mts +25 -0
  121. package/dist/field/field-label.d.mts.map +1 -0
  122. package/dist/field/field-label.mjs +46 -0
  123. package/dist/field/field-label.mjs.map +1 -0
  124. package/dist/field/field-root.d.mts +53 -0
  125. package/dist/field/field-root.d.mts.map +1 -0
  126. package/dist/field/field-root.mjs +319 -0
  127. package/dist/field/field-root.mjs.map +1 -0
  128. package/dist/field/index.d.mts +18 -0
  129. package/dist/field/index.d.mts.map +1 -0
  130. package/dist/field/index.mjs +17 -0
  131. package/dist/field/index.mjs.map +1 -0
  132. package/dist/form/form-root.d.mts +58 -0
  133. package/dist/form/form-root.d.mts.map +1 -0
  134. package/dist/form/form-root.mjs +147 -0
  135. package/dist/form/form-root.mjs.map +1 -0
  136. package/dist/form/form-submit.d.mts +34 -0
  137. package/dist/form/form-submit.d.mts.map +1 -0
  138. package/dist/form/form-submit.mjs +53 -0
  139. package/dist/form/form-submit.mjs.map +1 -0
  140. package/dist/form/index.d.mts +11 -0
  141. package/dist/form/index.d.mts.map +1 -0
  142. package/dist/form/index.mjs +11 -0
  143. package/dist/form/index.mjs.map +1 -0
  144. package/dist/index.d.mts +79 -4
  145. package/dist/index.mjs +16 -1
  146. package/dist/internal/anchor-position.d.mts +11 -3
  147. package/dist/internal/anchor-position.d.mts.map +1 -1
  148. package/dist/internal/anchor-position.mjs +180 -6
  149. package/dist/internal/anchor-position.mjs.map +1 -1
  150. package/dist/internal/announce.mjs +53 -0
  151. package/dist/internal/announce.mjs.map +1 -0
  152. package/dist/internal/content-focus-probe.mjs +42 -0
  153. package/dist/internal/content-focus-probe.mjs.map +1 -0
  154. package/dist/internal/csp-context.mjs +8 -0
  155. package/dist/internal/csp-context.mjs.map +1 -0
  156. package/dist/internal/decimal.mjs +27 -0
  157. package/dist/internal/decimal.mjs.map +1 -0
  158. package/dist/internal/dev-warn.mjs +17 -0
  159. package/dist/internal/dev-warn.mjs.map +1 -0
  160. package/dist/internal/field-context.d.mts +19 -0
  161. package/dist/internal/field-context.d.mts.map +1 -0
  162. package/dist/internal/field-context.mjs +14 -0
  163. package/dist/internal/field-context.mjs.map +1 -0
  164. package/dist/internal/focus-first-invalid.mjs +67 -0
  165. package/dist/internal/focus-first-invalid.mjs.map +1 -0
  166. package/dist/internal/form-status-watcher.mjs +31 -0
  167. package/dist/internal/form-status-watcher.mjs.map +1 -0
  168. package/dist/internal/modal-registry.mjs +39 -0
  169. package/dist/internal/modal-registry.mjs.map +1 -0
  170. package/dist/internal/platform-attributes.d.mts +12 -1
  171. package/dist/internal/platform-attributes.d.mts.map +1 -1
  172. package/dist/internal/range-value.mjs +51 -0
  173. package/dist/internal/range-value.mjs.map +1 -0
  174. package/dist/internal/render-element.mjs +67 -0
  175. package/dist/internal/render-element.mjs.map +1 -0
  176. package/dist/internal/toolbar-context.mjs +17 -0
  177. package/dist/internal/toolbar-context.mjs.map +1 -0
  178. package/dist/internal/tooltip-warm.mjs +29 -0
  179. package/dist/internal/tooltip-warm.mjs.map +1 -0
  180. package/dist/internal/types.d.mts +11 -1
  181. package/dist/internal/types.d.mts.map +1 -1
  182. package/dist/internal/use-action-trigger.mjs +17 -6
  183. package/dist/internal/use-action-trigger.mjs.map +1 -1
  184. package/dist/internal/use-controllable-action.mjs +35 -13
  185. package/dist/internal/use-controllable-action.mjs.map +1 -1
  186. package/dist/internal/use-exit-animation.mjs +26 -6
  187. package/dist/internal/use-exit-animation.mjs.map +1 -1
  188. package/dist/internal/use-field-control.mjs +109 -0
  189. package/dist/internal/use-field-control.mjs.map +1 -0
  190. package/dist/internal/use-form-owner-event.mjs +44 -0
  191. package/dist/internal/use-form-owner-event.mjs.map +1 -0
  192. package/dist/internal/use-form-reset.mjs +12 -31
  193. package/dist/internal/use-form-reset.mjs.map +1 -1
  194. package/dist/internal/use-hydrated-mount.mjs +21 -0
  195. package/dist/internal/use-hydrated-mount.mjs.map +1 -0
  196. package/dist/internal/use-latest.mjs +32 -0
  197. package/dist/internal/use-latest.mjs.map +1 -0
  198. package/dist/internal/use-modal-registration.mjs +47 -0
  199. package/dist/internal/use-modal-registration.mjs.map +1 -0
  200. package/dist/internal/use-native-group-reconciliation.mjs +6 -5
  201. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
  202. package/dist/internal/use-native-select-value.mjs +184 -0
  203. package/dist/internal/use-native-select-value.mjs.map +1 -0
  204. package/dist/internal/use-popover-popup.mjs +33 -28
  205. package/dist/internal/use-popover-popup.mjs.map +1 -1
  206. package/dist/internal/use-popover-root.mjs +59 -24
  207. package/dist/internal/use-popover-root.mjs.map +1 -1
  208. package/dist/internal/use-popover-trigger.mjs +6 -5
  209. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  210. package/dist/internal/use-render.mjs +12 -35
  211. package/dist/internal/use-render.mjs.map +1 -1
  212. package/dist/internal/use-resolved-placement.mjs +146 -0
  213. package/dist/internal/use-resolved-placement.mjs.map +1 -0
  214. package/dist/internal/use-roving-focus.mjs +301 -0
  215. package/dist/internal/use-roving-focus.mjs.map +1 -0
  216. package/dist/internal/validity.d.mts +24 -0
  217. package/dist/internal/validity.d.mts.map +1 -0
  218. package/dist/internal/validity.mjs +108 -0
  219. package/dist/internal/validity.mjs.map +1 -0
  220. package/dist/menu/index.d.mts +5 -1
  221. package/dist/menu/index.d.mts.map +1 -1
  222. package/dist/menu/index.mjs +5 -1
  223. package/dist/menu/index.mjs.map +1 -1
  224. package/dist/menu/menu-checkbox-item.mjs +2 -1
  225. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  226. package/dist/menu/menu-context-trigger.d.mts +46 -0
  227. package/dist/menu/menu-context-trigger.d.mts.map +1 -0
  228. package/dist/menu/menu-context-trigger.mjs +405 -0
  229. package/dist/menu/menu-context-trigger.mjs.map +1 -0
  230. package/dist/menu/menu-context.mjs +44 -1
  231. package/dist/menu/menu-context.mjs.map +1 -1
  232. package/dist/menu/menu-dom.mjs +49 -3
  233. package/dist/menu/menu-dom.mjs.map +1 -1
  234. package/dist/menu/menu-group.d.mts.map +1 -1
  235. package/dist/menu/menu-group.mjs +4 -3
  236. package/dist/menu/menu-group.mjs.map +1 -1
  237. package/dist/menu/menu-item.d.mts +6 -2
  238. package/dist/menu/menu-item.d.mts.map +1 -1
  239. package/dist/menu/menu-item.mjs +7 -4
  240. package/dist/menu/menu-item.mjs.map +1 -1
  241. package/dist/menu/menu-popup.d.mts +36 -8
  242. package/dist/menu/menu-popup.d.mts.map +1 -1
  243. package/dist/menu/menu-popup.mjs +219 -22
  244. package/dist/menu/menu-popup.mjs.map +1 -1
  245. package/dist/menu/menu-radio-group.mjs +10 -5
  246. package/dist/menu/menu-radio-group.mjs.map +1 -1
  247. package/dist/menu/menu-radio-item.mjs +2 -1
  248. package/dist/menu/menu-radio-item.mjs.map +1 -1
  249. package/dist/menu/menu-root.d.mts +5 -0
  250. package/dist/menu/menu-root.d.mts.map +1 -1
  251. package/dist/menu/menu-root.mjs +57 -7
  252. package/dist/menu/menu-root.mjs.map +1 -1
  253. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  254. package/dist/menu/menu-submenu-trigger.mjs +28 -12
  255. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  256. package/dist/menu/menu-trigger.d.mts +8 -4
  257. package/dist/menu/menu-trigger.d.mts.map +1 -1
  258. package/dist/menu/menu-trigger.mjs +18 -7
  259. package/dist/menu/menu-trigger.mjs.map +1 -1
  260. package/dist/meter/index.d.mts +24 -0
  261. package/dist/meter/index.d.mts.map +1 -0
  262. package/dist/meter/index.mjs +23 -0
  263. package/dist/meter/index.mjs.map +1 -0
  264. package/dist/meter/meter-context.mjs +13 -0
  265. package/dist/meter/meter-context.mjs.map +1 -0
  266. package/dist/meter/meter-indicator.d.mts +19 -0
  267. package/dist/meter/meter-indicator.d.mts.map +1 -0
  268. package/dist/meter/meter-indicator.mjs +25 -0
  269. package/dist/meter/meter-indicator.mjs.map +1 -0
  270. package/dist/meter/meter-label.d.mts +19 -0
  271. package/dist/meter/meter-label.d.mts.map +1 -0
  272. package/dist/meter/meter-label.mjs +28 -0
  273. package/dist/meter/meter-label.mjs.map +1 -0
  274. package/dist/meter/meter-region.d.mts +4 -0
  275. package/dist/meter/meter-region.d.mts.map +1 -0
  276. package/dist/meter/meter-region.mjs +39 -0
  277. package/dist/meter/meter-region.mjs.map +1 -0
  278. package/dist/meter/meter-root.d.mts +71 -0
  279. package/dist/meter/meter-root.d.mts.map +1 -0
  280. package/dist/meter/meter-root.mjs +83 -0
  281. package/dist/meter/meter-root.mjs.map +1 -0
  282. package/dist/meter/meter-track.d.mts +19 -0
  283. package/dist/meter/meter-track.d.mts.map +1 -0
  284. package/dist/meter/meter-track.mjs +25 -0
  285. package/dist/meter/meter-track.mjs.map +1 -0
  286. package/dist/meter/meter-value.d.mts +20 -0
  287. package/dist/meter/meter-value.d.mts.map +1 -0
  288. package/dist/meter/meter-value.mjs +29 -0
  289. package/dist/meter/meter-value.mjs.map +1 -0
  290. package/dist/number-field/index.d.mts +26 -0
  291. package/dist/number-field/index.d.mts.map +1 -0
  292. package/dist/number-field/index.mjs +26 -0
  293. package/dist/number-field/index.mjs.map +1 -0
  294. package/dist/number-field/number-field-arithmetic.mjs +78 -0
  295. package/dist/number-field/number-field-arithmetic.mjs.map +1 -0
  296. package/dist/number-field/number-field-context.d.mts +2 -0
  297. package/dist/number-field/number-field-context.mjs +13 -0
  298. package/dist/number-field/number-field-context.mjs.map +1 -0
  299. package/dist/number-field/number-field-decrement.d.mts +17 -0
  300. package/dist/number-field/number-field-decrement.d.mts.map +1 -0
  301. package/dist/number-field/number-field-decrement.mjs +20 -0
  302. package/dist/number-field/number-field-decrement.mjs.map +1 -0
  303. package/dist/number-field/number-field-format.mjs +279 -0
  304. package/dist/number-field/number-field-format.mjs.map +1 -0
  305. package/dist/number-field/number-field-increment.d.mts +37 -0
  306. package/dist/number-field/number-field-increment.d.mts.map +1 -0
  307. package/dist/number-field/number-field-increment.mjs +71 -0
  308. package/dist/number-field/number-field-increment.mjs.map +1 -0
  309. package/dist/number-field/number-field-input.d.mts +29 -0
  310. package/dist/number-field/number-field-input.d.mts.map +1 -0
  311. package/dist/number-field/number-field-input.mjs +163 -0
  312. package/dist/number-field/number-field-input.mjs.map +1 -0
  313. package/dist/number-field/number-field-label.d.mts +23 -0
  314. package/dist/number-field/number-field-label.d.mts.map +1 -0
  315. package/dist/number-field/number-field-label.mjs +47 -0
  316. package/dist/number-field/number-field-label.mjs.map +1 -0
  317. package/dist/number-field/number-field-root.d.mts +108 -0
  318. package/dist/number-field/number-field-root.d.mts.map +1 -0
  319. package/dist/number-field/number-field-root.mjs +523 -0
  320. package/dist/number-field/number-field-root.mjs.map +1 -0
  321. package/dist/number-field/use-step-button.mjs +112 -0
  322. package/dist/number-field/use-step-button.mjs.map +1 -0
  323. package/dist/popover/popover-close.d.mts +9 -3
  324. package/dist/popover/popover-close.d.mts.map +1 -1
  325. package/dist/popover/popover-close.mjs +13 -7
  326. package/dist/popover/popover-close.mjs.map +1 -1
  327. package/dist/popover/popover-popup.d.mts +21 -7
  328. package/dist/popover/popover-popup.d.mts.map +1 -1
  329. package/dist/popover/popover-popup.mjs +23 -8
  330. package/dist/popover/popover-popup.mjs.map +1 -1
  331. package/dist/popover/popover-root.mjs +1 -1
  332. package/dist/popover/popover-trigger.d.mts +8 -4
  333. package/dist/popover/popover-trigger.d.mts.map +1 -1
  334. package/dist/popover/popover-trigger.mjs +3 -3
  335. package/dist/popover/popover-trigger.mjs.map +1 -1
  336. package/dist/progress/index.d.mts +24 -0
  337. package/dist/progress/index.d.mts.map +1 -0
  338. package/dist/progress/index.mjs +24 -0
  339. package/dist/progress/index.mjs.map +1 -0
  340. package/dist/progress/progress-context.mjs +13 -0
  341. package/dist/progress/progress-context.mjs.map +1 -0
  342. package/dist/progress/progress-indicator.d.mts +19 -0
  343. package/dist/progress/progress-indicator.d.mts.map +1 -0
  344. package/dist/progress/progress-indicator.mjs +29 -0
  345. package/dist/progress/progress-indicator.mjs.map +1 -0
  346. package/dist/progress/progress-label.d.mts +19 -0
  347. package/dist/progress/progress-label.d.mts.map +1 -0
  348. package/dist/progress/progress-label.mjs +30 -0
  349. package/dist/progress/progress-label.mjs.map +1 -0
  350. package/dist/progress/progress-root.d.mts +68 -0
  351. package/dist/progress/progress-root.d.mts.map +1 -0
  352. package/dist/progress/progress-root.mjs +80 -0
  353. package/dist/progress/progress-root.mjs.map +1 -0
  354. package/dist/progress/progress-track.d.mts +19 -0
  355. package/dist/progress/progress-track.d.mts.map +1 -0
  356. package/dist/progress/progress-track.mjs +29 -0
  357. package/dist/progress/progress-track.mjs.map +1 -0
  358. package/dist/progress/progress-value.d.mts +20 -0
  359. package/dist/progress/progress-value.d.mts.map +1 -0
  360. package/dist/progress/progress-value.mjs +33 -0
  361. package/dist/progress/progress-value.mjs.map +1 -0
  362. package/dist/radio-group/radio-group-item.mjs +2 -2
  363. package/dist/radio-group/radio-group-root.d.mts +4 -2
  364. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  365. package/dist/radio-group/radio-group-root.mjs +35 -9
  366. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  367. package/dist/select/index.d.mts +30 -0
  368. package/dist/select/index.d.mts.map +1 -0
  369. package/dist/select/index.mjs +30 -0
  370. package/dist/select/index.mjs.map +1 -0
  371. package/dist/select/select-context.mjs +13 -0
  372. package/dist/select/select-context.mjs.map +1 -0
  373. package/dist/select/select-dom.mjs +44 -0
  374. package/dist/select/select-dom.mjs.map +1 -0
  375. package/dist/select/select-group-label.d.mts +22 -0
  376. package/dist/select/select-group-label.d.mts.map +1 -0
  377. package/dist/select/select-group-label.mjs +39 -0
  378. package/dist/select/select-group-label.mjs.map +1 -0
  379. package/dist/select/select-group.d.mts +28 -0
  380. package/dist/select/select-group.d.mts.map +1 -0
  381. package/dist/select/select-group.mjs +47 -0
  382. package/dist/select/select-group.mjs.map +1 -0
  383. package/dist/select/select-option.d.mts +42 -0
  384. package/dist/select/select-option.d.mts.map +1 -0
  385. package/dist/select/select-option.mjs +65 -0
  386. package/dist/select/select-option.mjs.map +1 -0
  387. package/dist/select/select-root.d.mts +68 -0
  388. package/dist/select/select-root.d.mts.map +1 -0
  389. package/dist/select/select-root.mjs +114 -0
  390. package/dist/select/select-root.mjs.map +1 -0
  391. package/dist/select/select-separator.d.mts +20 -0
  392. package/dist/select/select-separator.d.mts.map +1 -0
  393. package/dist/select/select-separator.mjs +30 -0
  394. package/dist/select/select-separator.mjs.map +1 -0
  395. package/dist/select/select-trigger.d.mts +29 -0
  396. package/dist/select/select-trigger.d.mts.map +1 -0
  397. package/dist/select/select-trigger.mjs +48 -0
  398. package/dist/select/select-trigger.mjs.map +1 -0
  399. package/dist/select/select-value.d.mts +31 -0
  400. package/dist/select/select-value.d.mts.map +1 -0
  401. package/dist/select/select-value.mjs +101 -0
  402. package/dist/select/select-value.mjs.map +1 -0
  403. package/dist/slider/index.d.mts +32 -0
  404. package/dist/slider/index.d.mts.map +1 -0
  405. package/dist/slider/index.mjs +27 -0
  406. package/dist/slider/index.mjs.map +1 -0
  407. package/dist/slider/slider-arithmetic.mjs +104 -0
  408. package/dist/slider/slider-arithmetic.mjs.map +1 -0
  409. package/dist/slider/slider-context.mjs +13 -0
  410. package/dist/slider/slider-context.mjs.map +1 -0
  411. package/dist/slider/slider-indicator.d.mts +22 -0
  412. package/dist/slider/slider-indicator.d.mts.map +1 -0
  413. package/dist/slider/slider-indicator.mjs +36 -0
  414. package/dist/slider/slider-indicator.mjs.map +1 -0
  415. package/dist/slider/slider-label.d.mts +23 -0
  416. package/dist/slider/slider-label.d.mts.map +1 -0
  417. package/dist/slider/slider-label.mjs +44 -0
  418. package/dist/slider/slider-label.mjs.map +1 -0
  419. package/dist/slider/slider-root.d.mts +111 -0
  420. package/dist/slider/slider-root.d.mts.map +1 -0
  421. package/dist/slider/slider-root.mjs +583 -0
  422. package/dist/slider/slider-root.mjs.map +1 -0
  423. package/dist/slider/slider-thumb.d.mts +58 -0
  424. package/dist/slider/slider-thumb.d.mts.map +1 -0
  425. package/dist/slider/slider-thumb.mjs +146 -0
  426. package/dist/slider/slider-thumb.mjs.map +1 -0
  427. package/dist/slider/slider-track.d.mts +29 -0
  428. package/dist/slider/slider-track.d.mts.map +1 -0
  429. package/dist/slider/slider-track.mjs +55 -0
  430. package/dist/slider/slider-track.mjs.map +1 -0
  431. package/dist/slider/slider-value.d.mts +34 -0
  432. package/dist/slider/slider-value.d.mts.map +1 -0
  433. package/dist/slider/slider-value.mjs +38 -0
  434. package/dist/slider/slider-value.mjs.map +1 -0
  435. package/dist/switch/switch.d.mts +5 -3
  436. package/dist/switch/switch.d.mts.map +1 -1
  437. package/dist/switch/switch.mjs +26 -10
  438. package/dist/switch/switch.mjs.map +1 -1
  439. package/dist/tabs/tabs-indicator.mjs +2 -1
  440. package/dist/tabs/tabs-indicator.mjs.map +1 -1
  441. package/dist/tabs/tabs-list.mjs +1 -1
  442. package/dist/tabs/tabs-panel.mjs +1 -1
  443. package/dist/tabs/tabs-root.mjs +15 -5
  444. package/dist/tabs/tabs-root.mjs.map +1 -1
  445. package/dist/tabs/tabs-tab.mjs +3 -2
  446. package/dist/tabs/tabs-tab.mjs.map +1 -1
  447. package/dist/toast/index.d.mts +25 -0
  448. package/dist/toast/index.d.mts.map +1 -0
  449. package/dist/toast/index.mjs +26 -0
  450. package/dist/toast/index.mjs.map +1 -0
  451. package/dist/toast/toast-action.d.mts +40 -0
  452. package/dist/toast/toast-action.d.mts.map +1 -0
  453. package/dist/toast/toast-action.mjs +67 -0
  454. package/dist/toast/toast-action.mjs.map +1 -0
  455. package/dist/toast/toast-close.d.mts +25 -0
  456. package/dist/toast/toast-close.d.mts.map +1 -0
  457. package/dist/toast/toast-close.mjs +47 -0
  458. package/dist/toast/toast-close.mjs.map +1 -0
  459. package/dist/toast/toast-context.mjs +19 -0
  460. package/dist/toast/toast-context.mjs.map +1 -0
  461. package/dist/toast/toast-description.d.mts +24 -0
  462. package/dist/toast/toast-description.d.mts.map +1 -0
  463. package/dist/toast/toast-description.mjs +35 -0
  464. package/dist/toast/toast-description.mjs.map +1 -0
  465. package/dist/toast/toast-root.d.mts +43 -0
  466. package/dist/toast/toast-root.d.mts.map +1 -0
  467. package/dist/toast/toast-root.mjs +205 -0
  468. package/dist/toast/toast-root.mjs.map +1 -0
  469. package/dist/toast/toast-title.d.mts +24 -0
  470. package/dist/toast/toast-title.d.mts.map +1 -0
  471. package/dist/toast/toast-title.mjs +33 -0
  472. package/dist/toast/toast-title.mjs.map +1 -0
  473. package/dist/toast/toast-viewport.d.mts +52 -0
  474. package/dist/toast/toast-viewport.d.mts.map +1 -0
  475. package/dist/toast/toast-viewport.mjs +644 -0
  476. package/dist/toast/toast-viewport.mjs.map +1 -0
  477. package/dist/toast/toast.d.mts +119 -0
  478. package/dist/toast/toast.d.mts.map +1 -0
  479. package/dist/toast/toast.mjs +157 -0
  480. package/dist/toast/toast.mjs.map +1 -0
  481. package/dist/toggle/toggle.d.mts +4 -1
  482. package/dist/toggle/toggle.d.mts.map +1 -1
  483. package/dist/toggle/toggle.mjs +16 -9
  484. package/dist/toggle/toggle.mjs.map +1 -1
  485. package/dist/toggle-group/index.d.mts +16 -0
  486. package/dist/toggle-group/index.d.mts.map +1 -0
  487. package/dist/toggle-group/index.mjs +15 -0
  488. package/dist/toggle-group/index.mjs.map +1 -0
  489. package/dist/toggle-group/toggle-group-context.d.mts +4 -0
  490. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -0
  491. package/dist/toggle-group/toggle-group-context.mjs +13 -0
  492. package/dist/toggle-group/toggle-group-context.mjs.map +1 -0
  493. package/dist/toggle-group/toggle-group-item.d.mts +51 -0
  494. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -0
  495. package/dist/toggle-group/toggle-group-item.mjs +68 -0
  496. package/dist/toggle-group/toggle-group-item.mjs.map +1 -0
  497. package/dist/toggle-group/toggle-group-root.d.mts +95 -0
  498. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -0
  499. package/dist/toggle-group/toggle-group-root.mjs +211 -0
  500. package/dist/toggle-group/toggle-group-root.mjs.map +1 -0
  501. package/dist/toolbar/index.d.mts +17 -0
  502. package/dist/toolbar/index.d.mts.map +1 -0
  503. package/dist/toolbar/index.mjs +17 -0
  504. package/dist/toolbar/index.mjs.map +1 -0
  505. package/dist/toolbar/toolbar-root.d.mts +38 -0
  506. package/dist/toolbar/toolbar-root.d.mts.map +1 -0
  507. package/dist/toolbar/toolbar-root.mjs +66 -0
  508. package/dist/toolbar/toolbar-root.mjs.map +1 -0
  509. package/dist/toolbar/toolbar-separator.d.mts +25 -0
  510. package/dist/toolbar/toolbar-separator.d.mts.map +1 -0
  511. package/dist/toolbar/toolbar-separator.mjs +31 -0
  512. package/dist/toolbar/toolbar-separator.mjs.map +1 -0
  513. package/dist/tooltip/index.d.mts +8 -5
  514. package/dist/tooltip/index.d.mts.map +1 -1
  515. package/dist/tooltip/index.mjs +6 -3
  516. package/dist/tooltip/index.mjs.map +1 -1
  517. package/dist/tooltip/tooltip-arrow.d.mts +30 -0
  518. package/dist/tooltip/tooltip-arrow.d.mts.map +1 -0
  519. package/dist/tooltip/tooltip-arrow.mjs +45 -0
  520. package/dist/tooltip/tooltip-arrow.mjs.map +1 -0
  521. package/dist/tooltip/tooltip-context.d.mts +7 -0
  522. package/dist/tooltip/tooltip-context.d.mts.map +1 -1
  523. package/dist/tooltip/tooltip-context.mjs +2 -1
  524. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  525. package/dist/tooltip/tooltip-popup.d.mts +27 -6
  526. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  527. package/dist/tooltip/tooltip-popup.mjs +36 -7
  528. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  529. package/dist/tooltip/tooltip-root.mjs +18 -2
  530. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  531. package/dist/tooltip/tooltip-trigger.d.mts +9 -2
  532. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  533. package/dist/tooltip/tooltip-trigger.mjs +23 -6
  534. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  535. package/dist/tooltip/use-tooltip-interaction.mjs +126 -76
  536. package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
  537. package/package.json +14 -1
@@ -1 +1 @@
1
- {"version":3,"file":"radio-group-root.mjs","names":[],"sources":["../../src/radio-group/radio-group-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useId, useLayoutEffect, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.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 { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useNativeGroupReconciliation } from \"../internal/use-native-group-reconciliation.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { RadioGroupContext } from \"./radio-group-context.js\";\nimport type { RadioGroupContextValue } from \"./radio-group-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** Details passed as the second argument of `valueChangeAction`. */\nexport interface RadioGroupValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user checked a radio (click, Space, label click, or an arrow key, all of\n * which arrive as a native `click`). `\"platform\"`: the browser changed the checked radio\n * itself: a form reset (`details.event` is the `reset` event), or a click before hydration /\n * Firefox form-state restoration found at mount (`details.event` is `undefined`).\n */\n readonly reason: ChangeReason;\n}\n\nexport interface RadioGroupRootState {\n /** Optimistic checked value, or `null`. Content rendered from it must not suspend. */\n readonly value: string | null;\n /** An action dispatched through this group is in flight. */\n readonly pending: boolean;\n /** The `disabled` prop. */\n readonly disabled: boolean;\n}\n\nexport interface RadioGroupRootProps extends Omit<\n ComponentPropsWithRef<\"fieldset\">,\n | \"className\"\n | \"style\"\n | \"children\"\n | \"defaultValue\"\n | \"defaultChecked\"\n | \"name\"\n | \"disabled\"\n | \"form\"\n> {\n /**\n * Controlled checked value. `null` checks nothing; `undefined` means uncontrolled.\n *\n * A form reset returns each radio to the `checked` it had when *that radio* mounted (React sets\n * `defaultChecked` once, from the initial `checked`). An Item added on the client while `value`\n * equals its value therefore also gets `defaultChecked`, so two radios may carry it and the\n * reset target is not necessarily the group's mount-time value. The reset is offered to\n * `valueChangeAction` as usual; for a stable target remount the group with a `key` or use\n * `defaultValue`, whose latest value every Item mirrors.\n */\n value?: string | null;\n /**\n * Initial value in uncontrolled mode. Defaults to `null` (nothing checked). Also the value a\n * form reset returns to: the latest prop value is mirrored into the radios' `defaultChecked`.\n */\n defaultValue?: string | null;\n /**\n * Runs inside the Root's transition whenever the checked radio changes. May be sync or async\n * (also a Server Function); rejections reach the nearest Error Boundary and roll the selection\n * back.\n *\n * `next` is a string for every user interaction. It is `null` only with\n * `details.reason === \"platform\"`, when a form reset returned the group to \"nothing checked\".\n * Every arrow key press dispatches; the latest dispatch wins. A `setState` placed after your\n * own `await` is not a Transition update; wrap it in `startTransition` (React limitation).\n * `details.event.preventDefault()` is not a veto; use controlled mode to veto a change.\n */\n valueChangeAction?: ChangeAction<string | null, RadioGroupValueChangeDetails>;\n /**\n * The `name` shared by every radio in the group (form data key). Defaults to a `useId()` value;\n * pass a real name when the group is inside a `<form>` you submit. Must be unique within the\n * form: react-dom throws if a non-React radio shares it.\n */\n name?: string;\n /** The `form` attribute, applied to the fieldset and to every radio. */\n form?: string;\n /**\n * Marks every radio `required`, which makes the group required (one checked radio satisfies it),\n * and renders `aria-required=\"true\"` on the fieldset so the radiogroup itself is exposed as\n * required.\n */\n required?: boolean;\n /** Renders `<fieldset disabled>`: every radio is disabled, unfocusable and skipped by arrows. */\n disabled?: boolean;\n className?: StateValue<string | undefined, RadioGroupRootState>;\n style?: StateValue<CSSProperties | undefined, RadioGroupRootState>;\n children?: StateValue<ReactNode, RadioGroupRootState>;\n /** Replace the rendered element. Must keep a `<fieldset>`. */\n render?: RenderProp<ComponentPropsWithRef<\"fieldset\">, RadioGroupRootState>;\n}\n\n/**\n * Value of the group's checked radio as the DOM shows it (`prop: \"checked\"`) or as a form reset\n * leaves it (`prop: \"defaultChecked\"`), or `null`. Only radios of this group's `name` count, so a\n * nested group is ignored.\n */\nfunction readGroup(\n fieldset: HTMLFieldSetElement | null,\n name: string,\n prop: \"checked\" | \"defaultChecked\",\n): string | null {\n if (fieldset === null) return null;\n for (const radio of fieldset.querySelectorAll<HTMLInputElement>('input[type=\"radio\"]')) {\n if (radio.name === name && radio[prop]) return radio.value;\n }\n return null;\n}\n\n/**\n * `<fieldset role=\"radiogroup\">` that owns the group's state, the transition, the shared `name`,\n * the form-reset listener and the mount reconciliation (design/components/radio-group.md 13.3).\n * Carries `data-pending` while `valueChangeAction` is in flight.\n *\n * Owned keys (conventions 1.2): `role`, `aria-required`, `disabled`, `form`, `data-pending`,\n * `data-disabled`.\n *\n * Keep every Item in the same Suspense boundary as its Root when server rendering. Partial\n * hydration of a group (a boundary between Root and Items that stays dehydrated while the user\n * interacts) is not supported by React: clicking a hydrated radio while same-`name` siblings are\n * still dehydrated makes react-dom throw \"Mixing React and non-React radio inputs with the same\n * `name` is not supported\". Development warns when Items hydrate after their Root.\n */\nexport function RadioGroupRoot({\n value,\n defaultValue,\n valueChangeAction,\n name: nameProp,\n form,\n required = false,\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: RadioGroupRootProps) {\n const fallbackName = useId();\n const name = nameProp ?? fallbackName;\n const fieldsetRef = useRef<HTMLFieldSetElement | null>(null);\n const warnedElement = useRef(false);\n\n const { optimistic, pending, dispatch, latestInFlight } = useControllableAction<\n string | null,\n RadioGroupValueChangeDetails\n >({\n controlled: value,\n defaultValue,\n initialValue: null,\n action: valueChangeAction,\n transitionTypes: () => transitionTypes(\"radio-group\"),\n warn: { component: \"RadioGroup.Root\", prop: \"value\" },\n });\n // Deliberately no warning when neither `value` nor `defaultValue` is given: an unchecked group\n // is the HTML default (design decision 2).\n\n /** What the user intends: the latest in-flight dispatch, else optimistic (conventions 3.8 rule 1). */\n const base = (): string | null => {\n const inFlight = latestInFlight();\n // Not `?.next ?? optimistic`: an in-flight reset to `null` is a real intent.\n return inFlight === null ? optimistic : inFlight.next;\n };\n\n // The residual browser paths (design section 5): one dispatch per group, from here. Items that\n // mount after the Root report through `onItemMounted` so the group is reconciled again.\n const { onItemMounted } = useNativeGroupReconciliation<string | null>({\n element: fieldsetRef,\n readCurrent: () => readGroup(fieldsetRef.current, name, \"checked\"),\n readDefault: () => readGroup(fieldsetRef.current, name, \"defaultChecked\"),\n base,\n onPlatformChange: (next, event) =>\n dispatch(next, createActionDetails(event, { reason: \"platform\" })),\n });\n\n // Dev-only partial-hydration detection. The radios present in the fieldset when the Root\n // mounts are either mounted in the Root's commit or still dehydrated server HTML. An Item that\n // mounts later on one of those elements hydrated after the Root (an Item created on the client\n // gets a new element). Items of the Root's own commit run their mount effect before this one,\n // while the snapshot is still `null`; StrictMode's re-run finds it reset by the cleanup.\n const serverRadios = useRef<ReadonlySet<Element> | null>(null);\n const warnedPartialHydration = useRef(false);\n useLayoutEffect(() => {\n if (!isDev) return;\n const el = fieldsetRef.current;\n serverRadios.current = new Set(el === null ? [] : el.querySelectorAll('input[type=\"radio\"]'));\n return () => {\n serverRadios.current = null;\n };\n }, []);\n const onItemMountedWithCheck = useCallback(\n (element?: Element | null) => {\n if (\n isDev &&\n !warnedPartialHydration.current &&\n element != null &&\n serverRadios.current?.has(element) === true\n ) {\n warnedPartialHydration.current = true;\n console.error(\n `RadioGroup.Item: an Item hydrated after its RadioGroup.Root (a Suspense boundary ` +\n `between them). Partial hydration of a radio group is not supported by React: ` +\n `clicking a hydrated radio while same-name radios are still dehydrated makes ` +\n `react-dom throw \"Mixing React and non-React radio inputs with the same name is not ` +\n `supported\". Keep every Item in the same Suspense boundary as its Root.`,\n );\n }\n onItemMounted(element);\n },\n [onItemMounted],\n );\n\n const libraryRef = useCallback((el: HTMLFieldSetElement) => {\n fieldsetRef.current = el;\n if (isDev && !warnedElement.current && el.tagName !== \"FIELDSET\") {\n warnedElement.current = true;\n console.error(\n `RadioGroup.Root: expected to render a <fieldset> element but got ` +\n `<${el.tagName.toLowerCase()}>. The platform semantics (legend naming, disabled ` +\n `inheritance, form reset) need a real <fieldset>.`,\n );\n }\n return () => {\n fieldsetRef.current = null;\n };\n }, []);\n\n const context: RadioGroupContextValue = {\n name,\n form,\n required,\n optimistic,\n pending,\n disabled,\n defaultValue: value === undefined ? (defaultValue ?? null) : undefined,\n onItemMounted: onItemMountedWithCheck,\n select: (next, event) => {\n // No-op rule against the optimistic value (conventions 2.3 item 7, design 4.2).\n if (next === optimistic) return;\n dispatch(next, createActionDetails(event, { reason: \"activate\" }));\n },\n };\n\n const state: RadioGroupRootState = { value: optimistic, pending, disabled };\n\n const element = useRender<ComponentPropsWithRef<\"fieldset\">, RadioGroupRootState>({\n defaultElement: \"fieldset\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n role: \"radiogroup\",\n \"aria-required\": required ? \"true\" : undefined,\n disabled,\n form,\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n },\n ref: libraryRef,\n });\n\n return <RadioGroupContext value={context}>{element}</RadioGroupContext>;\n}\n\nRadioGroupRoot.displayName = \"RadioGroupRoot\";\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;AAyFvC,SAAS,UACP,UACA,MACA,MACe;CACf,IAAI,aAAa,MAAM,OAAO;CAC9B,KAAK,MAAM,SAAS,SAAS,iBAAmC,uBAAqB,GACnF,IAAI,MAAM,SAAS,QAAQ,MAAM,OAAO,OAAO,MAAM;CAEvD,OAAO;AACT;;;;;;;;;;;;;;;AAgBA,SAAgB,eAAe,EAC7B,OACA,cACA,mBACA,MAAM,UACN,MACA,WAAW,OACX,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACmB;CACtB,MAAM,eAAe,MAAM;CAC3B,MAAM,OAAO,YAAY;CACzB,MAAM,cAAc,OAAmC,IAAI;CAC3D,MAAM,gBAAgB,OAAO,KAAK;CAElC,MAAM,EAAE,YAAY,SAAS,UAAU,mBAAmB,sBAGxD;EACA,YAAY;EACZ;EACA,cAAc;EACd,QAAQ;EACR,uBAAuB,gBAAgB,aAAa;EACpD,MAAM;GAAE,WAAW;GAAmB,MAAM;EAAQ;CACtD,CAAC;;CAKD,MAAM,aAA4B;EAChC,MAAM,WAAW,eAAe;EAEhC,OAAO,aAAa,OAAO,aAAa,SAAS;CACnD;CAIA,MAAM,EAAE,kBAAkB,6BAA4C;EACpE,SAAS;EACT,mBAAmB,UAAU,YAAY,SAAS,MAAM,SAAS;EACjE,mBAAmB,UAAU,YAAY,SAAS,MAAM,gBAAgB;EACxE;EACA,mBAAmB,MAAM,UACvB,SAAS,MAAM,oBAAoB,OAAO,EAAE,QAAQ,WAAW,CAAC,CAAC;CACrE,CAAC;CAOD,MAAM,eAAe,OAAoC,IAAI;CAC7D,MAAM,yBAAyB,OAAO,KAAK;CAC3C,sBAAsB;EACpB,IAAI,CAAC,OAAO;EACZ,MAAM,KAAK,YAAY;EACvB,aAAa,UAAU,IAAI,IAAI,OAAO,OAAO,CAAC,IAAI,GAAG,iBAAiB,uBAAqB,CAAC;EAC5F,aAAa;GACX,aAAa,UAAU;EACzB;CACF,GAAG,CAAC,CAAC;CACL,MAAM,yBAAyB,aAC5B,YAA6B;EAC5B,IACE,SACA,CAAC,uBAAuB,WACxB,WAAW,QACX,aAAa,SAAS,IAAI,OAAO,MAAM,MACvC;GACA,uBAAuB,UAAU;GACjC,QAAQ,MACN,uYAKF;EACF;EACA,cAAc,OAAO;CACvB,GACA,CAAC,aAAa,CAChB;CAEA,MAAM,aAAa,aAAa,OAA4B;EAC1D,YAAY,UAAU;EACtB,IAAI,SAAS,CAAC,cAAc,WAAW,GAAG,YAAY,YAAY;GAChE,cAAc,UAAU;GACxB,QAAQ,MACN,qEACM,GAAG,QAAQ,YAAY,EAAE,oGAEjC;EACF;EACA,aAAa;GACX,YAAY,UAAU;EACxB;CACF,GAAG,CAAC,CAAC;CAEL,MAAM,UAAkC;EACtC;EACA;EACA;EACA;EACA;EACA;EACA,cAAc,UAAU,KAAA,IAAa,gBAAgB,OAAQ,KAAA;EAC7D,eAAe;EACf,SAAS,MAAM,UAAU;GAEvB,IAAI,SAAS,YAAY;GACzB,SAAS,MAAM,oBAAoB,OAAO,EAAE,QAAQ,WAAW,CAAC,CAAC;EACnE;CACF;CAIA,MAAM,UAAU,UAAkE;EAChF,gBAAgB;EAChB;EACA,OAAA;GALmC,OAAO;GAAY;GAAS;EAK3D;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,MAAM;GACN,iBAAiB,WAAW,SAAS,KAAA;GACrC;GACA;GACA,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;EACpC;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,mBAAD;EAAmB,OAAO;EAAU,UAAA;CAA2B,CAAA;AACxE;AAEA,eAAe,cAAc"}
1
+ {"version":3,"file":"radio-group-root.mjs","names":[],"sources":["../../src/radio-group/radio-group-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useId, useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.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 { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useNativeGroupReconciliation } from \"../internal/use-native-group-reconciliation.js\";\nimport {\n useFieldControl,\n useFieldValueChange,\n useMergedRef,\n} from \"../internal/use-field-control.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { RadioGroupContext } from \"./radio-group-context.js\";\nimport type { RadioGroupContextValue } from \"./radio-group-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** Details passed as the second argument of `valueChangeAction`. */\nexport interface RadioGroupValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user checked a radio (click, Space, label click, or an arrow key, all of\n * which arrive as a native `click`). `\"platform\"`: the browser changed the checked radio\n * itself: a form reset (`details.event` is the `reset` event), or a click before hydration /\n * Firefox form-state restoration found at mount (`details.event` is `undefined`).\n */\n readonly reason: ChangeReason;\n}\n\nexport interface RadioGroupRootState {\n /** Optimistic checked value, or `null`. Content rendered from it must not suspend. */\n readonly value: string | null;\n /** An action dispatched through this group is in flight. */\n readonly pending: boolean;\n /** The `disabled` prop. */\n readonly disabled: boolean;\n}\n\nexport interface RadioGroupRootProps extends Omit<\n ComponentPropsWithRef<\"fieldset\">,\n | \"className\"\n | \"style\"\n | \"children\"\n | \"defaultValue\"\n | \"defaultChecked\"\n | \"name\"\n | \"disabled\"\n | \"form\"\n> {\n /**\n * Controlled checked value. `null` checks nothing; `undefined` means uncontrolled.\n *\n * A form reset returns each radio to the `checked` it had when *that radio* mounted (React sets\n * `defaultChecked` once, from the initial `checked`). An Item added on the client while `value`\n * equals its value therefore also gets `defaultChecked`, so two radios may carry it and the\n * reset target is not necessarily the group's mount-time value. The reset is offered to\n * `valueChangeAction` as usual; for a stable target remount the group with a `key` or use\n * `defaultValue`, whose latest value every Item mirrors.\n */\n value?: string | null;\n /**\n * Initial value in uncontrolled mode. Defaults to `null` (nothing checked). Also the value a\n * form reset returns to: the latest prop value is mirrored into the radios' `defaultChecked`.\n */\n defaultValue?: string | null;\n /**\n * Runs inside the Root's transition whenever the checked radio changes. May be sync or async\n * (also a Server Function); rejections reach the nearest Error Boundary and roll the selection\n * back.\n *\n * `next` is a string for every user interaction. It is `null` only with\n * `details.reason === \"platform\"`, when a form reset returned the group to \"nothing checked\".\n * Every arrow key press dispatches; the latest dispatch wins. A `setState` placed after your\n * own `await` is not a Transition update; wrap it in `startTransition` (React limitation).\n * `details.event.preventDefault()` is not a veto; use controlled mode to veto a change.\n */\n valueChangeAction?: ChangeAction<string | null, RadioGroupValueChangeDetails>;\n /**\n * The `name` shared by every radio in the group (form data key). Defaults to a `useId()` value;\n * pass a real name when the group is inside a `<form>` you submit. Must be unique within the\n * form: react-dom throws if a non-React radio shares it.\n */\n name?: string;\n /** The `form` attribute, applied to the fieldset and to every radio. */\n form?: string;\n /**\n * Marks every radio `required`, which makes the group required (one checked radio satisfies it),\n * and renders `aria-required=\"true\"` on the fieldset so the radiogroup itself is exposed as\n * required.\n */\n required?: boolean;\n /** Renders `<fieldset disabled>`: every radio is disabled, unfocusable and skipped by arrows. */\n disabled?: boolean;\n className?: StateValue<string | undefined, RadioGroupRootState>;\n style?: StateValue<CSSProperties | undefined, RadioGroupRootState>;\n children?: StateValue<ReactNode, RadioGroupRootState>;\n /** Replace the rendered element. Must keep a `<fieldset>`. */\n render?: RenderProp<ComponentPropsWithRef<\"fieldset\">, RadioGroupRootState>;\n}\n\n/**\n * Value of the group's checked radio as the DOM shows it (`prop: \"checked\"`) or as a form reset\n * leaves it (`prop: \"defaultChecked\"`), or `null`. Only radios of this group's `name` count, so a\n * nested group is ignored.\n */\nfunction readGroup(\n fieldset: HTMLFieldSetElement | null,\n name: string,\n prop: \"checked\" | \"defaultChecked\",\n): string | null {\n if (fieldset === null) return null;\n for (const radio of fieldset.querySelectorAll<HTMLInputElement>('input[type=\"radio\"]')) {\n if (radio.name === name && radio[prop]) return radio.value;\n }\n return null;\n}\n\n/**\n * `<fieldset role=\"radiogroup\">` that owns the group's state, the transition, the shared `name`,\n * the form-reset listener and the mount reconciliation (design/components/radio-group.md 13.3).\n * Carries `data-pending` while `valueChangeAction` is in flight.\n *\n * Owned keys (conventions 1.2): `role`, `aria-required`, `disabled`, `form`, `data-pending`,\n * `data-disabled`; inside a `Field.Root` also `aria-labelledby` (→ `Field.Label`, token-merged),\n * `aria-describedby` (token-merged), `aria-invalid` and `data-invalid`, and `name` / `required` /\n * `disabled` default from the Field.\n *\n * Keep every Item in the same Suspense boundary as its Root when server rendering. Partial\n * hydration of a group (a boundary between Root and Items that stays dehydrated while the user\n * interacts) is not supported by React: clicking a hydrated radio while same-`name` siblings are\n * still dehydrated makes react-dom throw \"Mixing React and non-React radio inputs with the same\n * `name` is not supported\". Development warns when Items hydrate after their Root.\n */\nexport function RadioGroupRoot({\n value,\n defaultValue,\n valueChangeAction,\n name: nameProp,\n form,\n required: requiredProp,\n disabled: disabledProp,\n className,\n style,\n children,\n render,\n ...rest\n}: RadioGroupRootProps) {\n // Inside a Field.Root (design/components/field-form.md 7.2) the fieldset is the Field's group\n // control: `aria-labelledby` → `Field.Label`, the ARIA wiring, and `name` / `required` /\n // `disabled` defaulting from the Field.\n const field = useFieldControl({\n labelable: false,\n name: nameProp,\n disabled: disabledProp,\n required: requiredProp,\n component: \"RadioGroup.Root\",\n });\n const required = field.required;\n const disabled = field.disabled;\n const fallbackName = useId();\n const name = field.name ?? fallbackName;\n const fieldsetRef = useRef<HTMLFieldSetElement | null>(null);\n const warnedElement = useRef(false);\n\n const { optimistic, pending, dispatch, latestInFlight } = useControllableAction<\n string | null,\n RadioGroupValueChangeDetails\n >({\n controlled: value,\n defaultValue,\n initialValue: null,\n action: valueChangeAction,\n transitionTypes: () => transitionTypes(\"radio-group\"),\n warn: { component: \"RadioGroup.Root\", prop: \"value\" },\n });\n // Inside a Field: a value React writes with no event (a rejected action rolling back, a\n // controlled change) re-reads validity and `validate` after the commit.\n useFieldValueChange(optimistic);\n // Deliberately no warning when neither `value` nor `defaultValue` is given: an unchecked group\n // is the HTML default (design decision 2).\n\n /** What the user intends: the latest in-flight dispatch, else optimistic (conventions 3.8 rule 1). */\n const base = (): string | null => {\n const inFlight = latestInFlight();\n // Not `?.next ?? optimistic`: an in-flight reset to `null` is a real intent.\n return inFlight === null ? optimistic : inFlight.next;\n };\n\n // The residual browser paths (design section 5): one dispatch per group, from here. Items that\n // mount after the Root report through `onItemMounted` so the group is reconciled again.\n const { onItemMounted } = useNativeGroupReconciliation<string | null>({\n element: fieldsetRef,\n readCurrent: () => readGroup(fieldsetRef.current, name, \"checked\"),\n readDefault: () => readGroup(fieldsetRef.current, name, \"defaultChecked\"),\n base,\n onPlatformChange: (next, event) =>\n dispatch(next, createActionDetails(event, { reason: \"platform\" })),\n });\n\n // Dev-only partial-hydration detection. The radios present in the fieldset when the Root\n // mounts are either mounted in the Root's commit or still dehydrated server HTML. An Item that\n // mounts later on one of those elements hydrated after the Root (an Item created on the client\n // gets a new element). Items of the Root's own commit run their mount effect before this one,\n // while the snapshot is still `null`; StrictMode's re-run finds it reset by the cleanup.\n const serverRadios = useRef<ReadonlySet<Element> | null>(null);\n const warnedPartialHydration = useRef(false);\n useLayoutEffect(() => {\n if (!isDev) return;\n const el = fieldsetRef.current;\n serverRadios.current = new Set(el === null ? [] : el.querySelectorAll('input[type=\"radio\"]'));\n return () => {\n serverRadios.current = null;\n };\n }, []);\n const onItemMountedWithCheck = useCallback(\n (element?: Element | null) => {\n if (\n isDev &&\n !warnedPartialHydration.current &&\n element != null &&\n serverRadios.current?.has(element) === true\n ) {\n warnedPartialHydration.current = true;\n console.error(\n `RadioGroup.Item: an Item hydrated after its RadioGroup.Root (a Suspense boundary ` +\n `between them). Partial hydration of a radio group is not supported by React: ` +\n `clicking a hydrated radio while same-name radios are still dehydrated makes ` +\n `react-dom throw \"Mixing React and non-React radio inputs with the same name is not ` +\n `supported\". Keep every Item in the same Suspense boundary as its Root.`,\n );\n }\n onItemMounted(element);\n },\n [onItemMounted],\n );\n\n const libraryRef = useCallback((el: HTMLFieldSetElement) => {\n fieldsetRef.current = el;\n if (isDev && !warnedElement.current && el.tagName !== \"FIELDSET\") {\n warnedElement.current = true;\n console.error(\n `RadioGroup.Root: expected to render a <fieldset> element but got ` +\n `<${el.tagName.toLowerCase()}>. The platform semantics (legend naming, disabled ` +\n `inheritance, form reset) need a real <fieldset>.`,\n );\n }\n return () => {\n fieldsetRef.current = null;\n };\n }, []);\n const rootRef = useMergedRef<HTMLFieldSetElement>(libraryRef, field.ref);\n\n // Memoised (#48): `dispatch` and `onItemMountedWithCheck` are stable, so this changes only with\n // the state and the props below.\n const contextDefault = value === undefined ? (defaultValue ?? null) : undefined;\n const context = useMemo<RadioGroupContextValue>(\n () => ({\n name,\n form,\n required,\n optimistic,\n pending,\n disabled,\n defaultValue: contextDefault,\n onItemMounted: onItemMountedWithCheck,\n select: (next, event) => {\n // No-op rule against the optimistic value (conventions 2.3 item 7, design 4.2).\n if (next === optimistic) return;\n dispatch(next, createActionDetails(event, { reason: \"activate\" }));\n },\n }),\n [\n name,\n form,\n required,\n optimistic,\n pending,\n disabled,\n contextDefault,\n onItemMountedWithCheck,\n dispatch,\n ],\n );\n\n const state: RadioGroupRootState = { value: optimistic, pending, disabled };\n\n const element = useRender<ComponentPropsWithRef<\"fieldset\">, RadioGroupRootState>({\n defaultElement: \"fieldset\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n ...field.attributes,\n role: \"radiogroup\",\n \"aria-required\": required ? \"true\" : undefined,\n disabled,\n form,\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n },\n ref: rootRef,\n });\n\n return <RadioGroupContext value={context}>{element}</RadioGroupContext>;\n}\n\nRadioGroupRoot.displayName = \"RadioGroupRoot\";\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;AAyFvC,SAAS,UACP,UACA,MACA,MACe;CACf,IAAI,aAAa,MAAM,OAAO;CAC9B,KAAK,MAAM,SAAS,SAAS,iBAAmC,uBAAqB,GACnF,IAAI,MAAM,SAAS,QAAQ,MAAM,OAAO,OAAO,MAAM;CAEvD,OAAO;AACT;;;;;;;;;;;;;;;;;AAkBA,SAAgB,eAAe,EAC7B,OACA,cACA,mBACA,MAAM,UACN,MACA,UAAU,cACV,UAAU,cACV,WACA,OACA,UACA,QACA,GAAG,QACmB;CAItB,MAAM,QAAQ,gBAAgB;EAC5B,WAAW;EACX,MAAM;EACN,UAAU;EACV,UAAU;EACV,WAAW;CACb,CAAC;CACD,MAAM,WAAW,MAAM;CACvB,MAAM,WAAW,MAAM;CACvB,MAAM,eAAe,MAAM;CAC3B,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,cAAc,OAAmC,IAAI;CAC3D,MAAM,gBAAgB,OAAO,KAAK;CAElC,MAAM,EAAE,YAAY,SAAS,UAAU,mBAAmB,sBAGxD;EACA,YAAY;EACZ;EACA,cAAc;EACd,QAAQ;EACR,uBAAuB,gBAAgB,aAAa;EACpD,MAAM;GAAE,WAAW;GAAmB,MAAM;EAAQ;CACtD,CAAC;CAGD,oBAAoB,UAAU;;CAK9B,MAAM,aAA4B;EAChC,MAAM,WAAW,eAAe;EAEhC,OAAO,aAAa,OAAO,aAAa,SAAS;CACnD;CAIA,MAAM,EAAE,kBAAkB,6BAA4C;EACpE,SAAS;EACT,mBAAmB,UAAU,YAAY,SAAS,MAAM,SAAS;EACjE,mBAAmB,UAAU,YAAY,SAAS,MAAM,gBAAgB;EACxE;EACA,mBAAmB,MAAM,UACvB,SAAS,MAAM,oBAAoB,OAAO,EAAE,QAAQ,WAAW,CAAC,CAAC;CACrE,CAAC;CAOD,MAAM,eAAe,OAAoC,IAAI;CAC7D,MAAM,yBAAyB,OAAO,KAAK;CAC3C,sBAAsB;EACpB,IAAI,CAAC,OAAO;EACZ,MAAM,KAAK,YAAY;EACvB,aAAa,UAAU,IAAI,IAAI,OAAO,OAAO,CAAC,IAAI,GAAG,iBAAiB,uBAAqB,CAAC;EAC5F,aAAa;GACX,aAAa,UAAU;EACzB;CACF,GAAG,CAAC,CAAC;CACL,MAAM,yBAAyB,aAC5B,YAA6B;EAC5B,IACE,SACA,CAAC,uBAAuB,WACxB,WAAW,QACX,aAAa,SAAS,IAAI,OAAO,MAAM,MACvC;GACA,uBAAuB,UAAU;GACjC,QAAQ,MACN,uYAKF;EACF;EACA,cAAc,OAAO;CACvB,GACA,CAAC,aAAa,CAChB;CAEA,MAAM,aAAa,aAAa,OAA4B;EAC1D,YAAY,UAAU;EACtB,IAAI,SAAS,CAAC,cAAc,WAAW,GAAG,YAAY,YAAY;GAChE,cAAc,UAAU;GACxB,QAAQ,MACN,qEACM,GAAG,QAAQ,YAAY,EAAE,oGAEjC;EACF;EACA,aAAa;GACX,YAAY,UAAU;EACxB;CACF,GAAG,CAAC,CAAC;CACL,MAAM,UAAU,aAAkC,YAAY,MAAM,GAAG;CAIvE,MAAM,iBAAiB,UAAU,KAAA,IAAa,gBAAgB,OAAQ,KAAA;CACtE,MAAM,UAAU,eACP;EACL;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd,eAAe;EACf,SAAS,MAAM,UAAU;GAEvB,IAAI,SAAS,YAAY;GACzB,SAAS,MAAM,oBAAoB,OAAO,EAAE,QAAQ,WAAW,CAAC,CAAC;EACnE;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAIA,MAAM,UAAU,UAAkE;EAChF,gBAAgB;EAChB;EACA,OAAA;GALmC,OAAO;GAAY;GAAS;EAK3D;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,GAAG,MAAM;GACT,MAAM;GACN,iBAAiB,WAAW,SAAS,KAAA;GACrC;GACA;GACA,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;EACpC;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,mBAAD;EAAmB,OAAO;EAAU,UAAA;CAA2B,CAAA;AACxE;AAEA,eAAe,cAAc"}
@@ -0,0 +1,30 @@
1
+ import "../internal/platform-attributes.mjs";
2
+ import { SelectRoot, SelectRootProps, SelectRootState, SelectValueChangeDetails } from "./select-root.mjs";
3
+ import { SelectGroup, SelectGroupProps } from "./select-group.mjs";
4
+ import { SelectGroupLabel, SelectGroupLabelProps } from "./select-group-label.mjs";
5
+ import { SelectOption, SelectOptionProps, SelectOptionState } from "./select-option.mjs";
6
+ import { SelectSeparator, SelectSeparatorProps } from "./select-separator.mjs";
7
+ import { SelectTrigger, SelectTriggerProps } from "./select-trigger.mjs";
8
+ import { SelectValue, SelectValueProps } from "./select-value.mjs";
9
+ //#region src/select/index.d.ts
10
+ /**
11
+ * Select: a real `<select>` (`Root`), progressively enhanced with customizable select. Optional
12
+ * `Trigger` (`<button>`, first child) and `Value` (`<selectedcontent>`) for rich button content,
13
+ * `Option` (`<option>`), `Group` (`<optgroup>`) with an optional `GroupLabel` (`<legend>`), and
14
+ * `Separator` (`<hr>`). The picker, its keyboard and its placement are the browser's; opt into
15
+ * the styled picker with `appearance: base-select` in your CSS. The selected option is the
16
+ * optimistic value; the Root, the Trigger and the picked Option carry `data-pending` while
17
+ * `valueChangeAction` is in flight.
18
+ */
19
+ export declare const Select: {
20
+ readonly Root: typeof SelectRoot;
21
+ readonly Trigger: typeof SelectTrigger;
22
+ readonly Value: typeof SelectValue;
23
+ readonly Option: typeof SelectOption;
24
+ readonly Group: typeof SelectGroup;
25
+ readonly GroupLabel: typeof SelectGroupLabel;
26
+ readonly Separator: typeof SelectSeparator;
27
+ };
28
+ //#endregion
29
+ export type { SelectGroupLabelProps, SelectGroupProps, SelectOptionProps, SelectOptionState, SelectRootProps, SelectRootState, SelectSeparatorProps, SelectTriggerProps, SelectValueChangeDetails, SelectValueProps };
30
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/select/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;qBAoBa;WACX,aAAI;WACJ,gBAAO;WACP,cAAK;WACL,eAAM;WACN,cAAK;WACL,mBAAU;WACV,kBAAS"}
@@ -0,0 +1,30 @@
1
+ import { SelectGroup } from "./select-group.mjs";
2
+ import { SelectGroupLabel } from "./select-group-label.mjs";
3
+ import { SelectOption } from "./select-option.mjs";
4
+ import { SelectRoot } from "./select-root.mjs";
5
+ import { SelectSeparator } from "./select-separator.mjs";
6
+ import { SelectTrigger } from "./select-trigger.mjs";
7
+ import { SelectValue } from "./select-value.mjs";
8
+ //#region src/select/index.ts
9
+ /**
10
+ * Select: a real `<select>` (`Root`), progressively enhanced with customizable select. Optional
11
+ * `Trigger` (`<button>`, first child) and `Value` (`<selectedcontent>`) for rich button content,
12
+ * `Option` (`<option>`), `Group` (`<optgroup>`) with an optional `GroupLabel` (`<legend>`), and
13
+ * `Separator` (`<hr>`). The picker, its keyboard and its placement are the browser's; opt into
14
+ * the styled picker with `appearance: base-select` in your CSS. The selected option is the
15
+ * optimistic value; the Root, the Trigger and the picked Option carry `data-pending` while
16
+ * `valueChangeAction` is in flight.
17
+ */
18
+ const Select = {
19
+ Root: SelectRoot,
20
+ Trigger: SelectTrigger,
21
+ Value: SelectValue,
22
+ Option: SelectOption,
23
+ Group: SelectGroup,
24
+ GroupLabel: SelectGroupLabel,
25
+ Separator: SelectSeparator
26
+ };
27
+ //#endregion
28
+ export { Select };
29
+
30
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/select/index.ts"],"sourcesContent":["// Ships the platform typings (the `selectedcontent` element) with this subpath (conventions 7.4).\n// Type-only: the built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { SelectGroup } from \"./select-group.js\";\nimport { SelectGroupLabel } from \"./select-group-label.js\";\nimport { SelectOption } from \"./select-option.js\";\nimport { SelectRoot } from \"./select-root.js\";\nimport { SelectSeparator } from \"./select-separator.js\";\nimport { SelectTrigger } from \"./select-trigger.js\";\nimport { SelectValue } from \"./select-value.js\";\n\n/**\n * Select: a real `<select>` (`Root`), progressively enhanced with customizable select. Optional\n * `Trigger` (`<button>`, first child) and `Value` (`<selectedcontent>`) for rich button content,\n * `Option` (`<option>`), `Group` (`<optgroup>`) with an optional `GroupLabel` (`<legend>`), and\n * `Separator` (`<hr>`). The picker, its keyboard and its placement are the browser's; opt into\n * the styled picker with `appearance: base-select` in your CSS. The selected option is the\n * optimistic value; the Root, the Trigger and the picked Option carry `data-pending` while\n * `valueChangeAction` is in flight.\n */\nexport const Select = {\n Root: SelectRoot,\n Trigger: SelectTrigger,\n Value: SelectValue,\n Option: SelectOption,\n Group: SelectGroup,\n GroupLabel: SelectGroupLabel,\n Separator: SelectSeparator,\n} as const;\n\nexport type { SelectRootProps, SelectRootState, SelectValueChangeDetails } from \"./select-root.js\";\nexport type { SelectTriggerProps } from \"./select-trigger.js\";\nexport type { SelectValueProps } from \"./select-value.js\";\nexport type { SelectOptionProps, SelectOptionState } from \"./select-option.js\";\nexport type { SelectGroupProps } from \"./select-group.js\";\nexport type { SelectGroupLabelProps } from \"./select-group-label.js\";\nexport type { SelectSeparatorProps } from \"./select-separator.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,MAAa,SAAS;CACpB,MAAM;CACN,SAAS;CACT,OAAO;CACP,QAAQ;CACR,OAAO;CACP,YAAY;CACZ,WAAW;AACb"}
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { createContext, use } from "react";
3
+ //#region src/select/select-context.ts
4
+ const SelectContext = createContext(null);
5
+ function useSelectContext(part) {
6
+ const context = use(SelectContext);
7
+ if (context === null) throw new Error(`${part} must be rendered inside a Select.Root.`);
8
+ return context;
9
+ }
10
+ //#endregion
11
+ export { SelectContext, useSelectContext };
12
+
13
+ //# sourceMappingURL=select-context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-context.mjs","names":[],"sources":["../../src/select/select-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\n\nexport interface SelectContextValue {\n /** Optimistic value: Options render `data-selected` from it. */\n readonly optimistic: string;\n readonly pending: boolean;\n /** `Root disabled` (natively disables the whole `<select>`). */\n readonly disabled: boolean;\n /** Inside a `Select.Group disabled` (`false` outside groups): Options match `:disabled`. */\n readonly groupDisabled: boolean;\n /**\n * Called by each Option from its mount layout effect with its element and whether that render\n * hydrated server HTML. Late options are re-applied, and hydrated late options reconciled\n * (design/components/select.md 6.2).\n */\n readonly optionMounted: (el: HTMLOptionElement | null, hydrated: boolean) => void;\n}\n\nexport const SelectContext = createContext<SelectContextValue | null>(null);\n\nexport function useSelectContext(part: string): SelectContextValue {\n const context = use(SelectContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Select.Root.`);\n }\n return context;\n}\n"],"mappings":";;;AAmBA,MAAa,gBAAgB,cAAyC,IAAI;AAE1E,SAAgB,iBAAiB,MAAkC;CACjE,MAAM,UAAU,IAAI,aAAa;CACjC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,wCAAwC;CAElE,OAAO;AACT"}
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import { useCallback, useRef } from "react";
3
+ //#region src/select/select-dom.ts
4
+ const isDev = process.env.NODE_ENV !== "production";
5
+ /**
6
+ * The library ref of a Select part: stores the node in `node` and, in development,
7
+ * warns once per instance when the mounted element is not `<tag>` (conventions 1.2: Select's parts
8
+ * keep their native elements) or when `position` reports a misplaced element (a message, or
9
+ * `null` when the element is where HTML wants it). Ref callbacks run in the layout phase, when
10
+ * the element's siblings are in place.
11
+ */
12
+ function useSelectPartRef(component, tag, position) {
13
+ const node = useRef(null);
14
+ const warnedTag = useRef(false);
15
+ const warnedPosition = useRef(false);
16
+ return {
17
+ ref: useCallback((el) => {
18
+ node.current = el;
19
+ if (isDev && !warnedTag.current && el.tagName !== tag.toUpperCase()) {
20
+ warnedTag.current = true;
21
+ console.error(`${component}: expected to render a <${tag}> element but got <${el.tagName.toLowerCase()}>. The parser, the picker and <selectedcontent> cloning key on the native element; a \`render\` element must keep it.`);
22
+ }
23
+ if (isDev && position && !warnedPosition.current) {
24
+ const message = position(el);
25
+ if (message !== null) {
26
+ warnedPosition.current = true;
27
+ console.error(`${component}: ${message}`);
28
+ }
29
+ }
30
+ return () => {
31
+ node.current = null;
32
+ };
33
+ }, [
34
+ component,
35
+ tag,
36
+ position
37
+ ]),
38
+ node
39
+ };
40
+ }
41
+ //#endregion
42
+ export { useSelectPartRef };
43
+
44
+ //# sourceMappingURL=select-dom.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-dom.mjs","names":[],"sources":["../../src/select/select-dom.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef } from \"react\";\nimport type { RefCallback, RefObject } from \"react\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface SelectPartRef<E extends Element> {\n /** The library ref to pass to `useRender`. */\n readonly ref: RefCallback<E>;\n /** The mounted element. Read it from effects and handlers only. */\n readonly node: RefObject<E | null>;\n}\n\n/**\n * The library ref of a Select part: stores the node in `node` and, in development,\n * warns once per instance when the mounted element is not `<tag>` (conventions 1.2: Select's parts\n * keep their native elements) or when `position` reports a misplaced element (a message, or\n * `null` when the element is where HTML wants it). Ref callbacks run in the layout phase, when\n * the element's siblings are in place.\n */\nexport function useSelectPartRef<E extends Element>(\n component: string,\n tag: string,\n position?: (el: E) => string | null,\n): SelectPartRef<E> {\n const node = useRef<E | null>(null);\n const warnedTag = useRef(false);\n const warnedPosition = useRef(false);\n const ref = useCallback(\n (el: E) => {\n node.current = el;\n if (isDev && !warnedTag.current && el.tagName !== tag.toUpperCase()) {\n warnedTag.current = true;\n console.error(\n `${component}: expected to render a <${tag}> element but got ` +\n `<${el.tagName.toLowerCase()}>. The parser, the picker and <selectedcontent> cloning ` +\n `key on the native element; a \\`render\\` element must keep it.`,\n );\n }\n if (isDev && position && !warnedPosition.current) {\n const message = position(el);\n if (message !== null) {\n warnedPosition.current = true;\n console.error(`${component}: ${message}`);\n }\n }\n return () => {\n node.current = null;\n };\n },\n // `position` is a module-level function at every call site, so the callback is stable.\n [component, tag, position],\n );\n return { ref, node };\n}\n"],"mappings":";;;AAIA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;AAgBvC,SAAgB,iBACd,WACA,KACA,UACkB;CAClB,MAAM,OAAO,OAAiB,IAAI;CAClC,MAAM,YAAY,OAAO,KAAK;CAC9B,MAAM,iBAAiB,OAAO,KAAK;CA0BnC,OAAO;EAAE,KAzBG,aACT,OAAU;GACT,KAAK,UAAU;GACf,IAAI,SAAS,CAAC,UAAU,WAAW,GAAG,YAAY,IAAI,YAAY,GAAG;IACnE,UAAU,UAAU;IACpB,QAAQ,MACN,GAAG,UAAU,0BAA0B,IAAI,qBACrC,GAAG,QAAQ,YAAY,EAAE,sHAEjC;GACF;GACA,IAAI,SAAS,YAAY,CAAC,eAAe,SAAS;IAChD,MAAM,UAAU,SAAS,EAAE;IAC3B,IAAI,YAAY,MAAM;KACpB,eAAe,UAAU;KACzB,QAAQ,MAAM,GAAG,UAAU,IAAI,SAAS;IAC1C;GACF;GACA,aAAa;IACX,KAAK,UAAU;GACjB;EACF,GAEA;GAAC;GAAW;GAAK;EAAQ,CAEhB;EAAG;CAAK;AACrB"}
@@ -0,0 +1,22 @@
1
+ import { RenderProp, StateValue } from "../internal/types.mjs";
2
+ import { SelectRootState } from "./select-root.mjs";
3
+ import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
4
+ //#region src/select/select-group-label.d.ts
5
+ export interface SelectGroupLabelProps extends Omit<ComponentPropsWithRef<"legend">, "className" | "style" | "children"> {
6
+ className?: StateValue<string | undefined, SelectRootState>;
7
+ style?: StateValue<CSSProperties | undefined, SelectRootState>;
8
+ children?: StateValue<ReactNode, SelectRootState>;
9
+ /** Replace the rendered element. Must keep a `<legend>`. */
10
+ render?: RenderProp<ComponentPropsWithRef<"legend">, SelectRootState>;
11
+ }
12
+ /**
13
+ * The rich label of a `Select.Group`: a `<legend>`, rendered by engines with customizable select.
14
+ * Optional; must be the **first child** of its Group. Keep its text equal to the Group's `label`,
15
+ * which native pickers and assistive technology use. Owns no keys.
16
+ */
17
+ export declare function SelectGroupLabel({ className, style, children, render, ...rest }: SelectGroupLabelProps): ReactNode;
18
+ export declare namespace SelectGroupLabel {
19
+ var displayName: string;
20
+ }
21
+ //#endregion
22
+ //# sourceMappingURL=select-group-label.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-group-label.d.mts","names":[],"sources":["../../src/select/select-group-label.tsx"],"mappings":";;;;iBAQiB,8BAA8B,KAC7C;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;wBAcvC,mBACd,WACA,OACA,UACA,WACG,QACF,wBAAqB;yBANR"}
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import { useRender } from "../internal/use-render.mjs";
3
+ import { useSelectContext } from "./select-context.mjs";
4
+ import { useSelectPartRef } from "./select-dom.mjs";
5
+ //#region src/select/select-group-label.tsx
6
+ function firstChildOfGroup(el) {
7
+ const parent = el.parentElement;
8
+ if (parent?.tagName === "OPTGROUP" && parent.firstElementChild === el) return null;
9
+ return "must be the first child of a Select.Group's <optgroup> (HTML content model).";
10
+ }
11
+ /**
12
+ * The rich label of a `Select.Group`: a `<legend>`, rendered by engines with customizable select.
13
+ * Optional; must be the **first child** of its Group. Keep its text equal to the Group's `label`,
14
+ * which native pickers and assistive technology use. Owns no keys.
15
+ */
16
+ function SelectGroupLabel({ className, style, children, render, ...rest }) {
17
+ const ctx = useSelectContext("Select.GroupLabel");
18
+ const state = {
19
+ value: ctx.optimistic,
20
+ pending: ctx.pending,
21
+ disabled: ctx.disabled
22
+ };
23
+ const { ref } = useSelectPartRef("Select.GroupLabel", "legend", firstChildOfGroup);
24
+ return useRender({
25
+ defaultElement: "legend",
26
+ render,
27
+ state,
28
+ className,
29
+ style,
30
+ children,
31
+ props: rest,
32
+ ref
33
+ });
34
+ }
35
+ SelectGroupLabel.displayName = "SelectGroupLabel";
36
+ //#endregion
37
+ export { SelectGroupLabel };
38
+
39
+ //# sourceMappingURL=select-group-label.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-group-label.mjs","names":[],"sources":["../../src/select/select-group-label.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useSelectContext } from \"./select-context.js\";\nimport { useSelectPartRef } from \"./select-dom.js\";\nimport type { SelectRootState } from \"./select-root.js\";\n\nexport interface SelectGroupLabelProps extends Omit<\n ComponentPropsWithRef<\"legend\">,\n \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, SelectRootState>;\n style?: StateValue<CSSProperties | undefined, SelectRootState>;\n children?: StateValue<ReactNode, SelectRootState>;\n /** Replace the rendered element. Must keep a `<legend>`. */\n render?: RenderProp<ComponentPropsWithRef<\"legend\">, SelectRootState>;\n}\n\nfunction firstChildOfGroup(el: HTMLLegendElement): string | null {\n const parent = el.parentElement;\n if (parent?.tagName === \"OPTGROUP\" && parent.firstElementChild === el) return null;\n return \"must be the first child of a Select.Group's <optgroup> (HTML content model).\";\n}\n\n/**\n * The rich label of a `Select.Group`: a `<legend>`, rendered by engines with customizable select.\n * Optional; must be the **first child** of its Group. Keep its text equal to the Group's `label`,\n * which native pickers and assistive technology use. Owns no keys.\n */\nexport function SelectGroupLabel({\n className,\n style,\n children,\n render,\n ...rest\n}: SelectGroupLabelProps) {\n const ctx = useSelectContext(\"Select.GroupLabel\");\n const state: SelectRootState = {\n value: ctx.optimistic,\n pending: ctx.pending,\n disabled: ctx.disabled,\n };\n const { ref } = useSelectPartRef<HTMLLegendElement>(\n \"Select.GroupLabel\",\n \"legend\",\n firstChildOfGroup,\n );\n return useRender<ComponentPropsWithRef<\"legend\">, SelectRootState>({\n defaultElement: \"legend\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n ref,\n });\n}\n\nSelectGroupLabel.displayName = \"SelectGroupLabel\";\n"],"mappings":";;;;;AAmBA,SAAS,kBAAkB,IAAsC;CAC/D,MAAM,SAAS,GAAG;CAClB,IAAI,QAAQ,YAAY,cAAc,OAAO,sBAAsB,IAAI,OAAO;CAC9E,OAAO;AACT;;;;;;AAOA,SAAgB,iBAAiB,EAC/B,WACA,OACA,UACA,QACA,GAAG,QACqB;CACxB,MAAM,MAAM,iBAAiB,mBAAmB;CAChD,MAAM,QAAyB;EAC7B,OAAO,IAAI;EACX,SAAS,IAAI;EACb,UAAU,IAAI;CAChB;CACA,MAAM,EAAE,QAAQ,iBACd,qBACA,UACA,iBACF;CACA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;CACF,CAAC;AACH;AAEA,iBAAiB,cAAc"}
@@ -0,0 +1,28 @@
1
+ import { RenderProp, StateValue } from "../internal/types.mjs";
2
+ import { SelectRootState } from "./select-root.mjs";
3
+ import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
4
+ //#region src/select/select-group.d.ts
5
+ export interface SelectGroupProps extends Omit<ComponentPropsWithRef<"optgroup">, "label" | "className" | "style" | "children"> {
6
+ /**
7
+ * The `<optgroup label>`: shown by native pickers (Firefox today) and read by assistive
8
+ * technology. Required. Keep it equal to the text of a `Select.GroupLabel`, if any.
9
+ */
10
+ label: string;
11
+ /** Native `disabled`: every option in the group is disabled. */
12
+ disabled?: boolean;
13
+ className?: StateValue<string | undefined, SelectRootState>;
14
+ style?: StateValue<CSSProperties | undefined, SelectRootState>;
15
+ children?: StateValue<ReactNode, SelectRootState>;
16
+ /** Replace the rendered element. Must keep an `<optgroup>`. */
17
+ render?: RenderProp<ComponentPropsWithRef<"optgroup">, SelectRootState>;
18
+ }
19
+ /**
20
+ * An `<optgroup>` of options. Its state is the Root's state. Owned key: `label`. Its `disabled`
21
+ * reaches the Options' `state.disabled` / `data-disabled` through context, as `:disabled` does.
22
+ */
23
+ export declare function SelectGroup({ label, disabled, className, style, children, render, ...rest }: SelectGroupProps): import("react").JSX.Element;
24
+ export declare namespace SelectGroup {
25
+ var displayName: string;
26
+ }
27
+ //#endregion
28
+ //# sourceMappingURL=select-group.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-group.d.mts","names":[],"sources":["../../src/select/select-group.tsx"],"mappings":";;;;iBASiB,yBAAyB,KACxC;;;;;EAOA;;EAEA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,mCAAmC;;;;;;wBAOzC,cACd,OACA,UACA,WACA,OACA,UACA,WACG,QACF,mCAAgB,IAAA;yBARH"}
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import { useRender } from "../internal/use-render.mjs";
3
+ import { SelectContext, useSelectContext } from "./select-context.mjs";
4
+ import { useSelectPartRef } from "./select-dom.mjs";
5
+ import { useMemo } from "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ //#region src/select/select-group.tsx
8
+ /**
9
+ * An `<optgroup>` of options. Its state is the Root's state. Owned key: `label`. Its `disabled`
10
+ * reaches the Options' `state.disabled` / `data-disabled` through context, as `:disabled` does.
11
+ */
12
+ function SelectGroup({ label, disabled = false, className, style, children, render, ...rest }) {
13
+ const ctx = useSelectContext("Select.Group");
14
+ const state = {
15
+ value: ctx.optimistic,
16
+ pending: ctx.pending,
17
+ disabled: ctx.disabled
18
+ };
19
+ const { ref } = useSelectPartRef("Select.Group", "optgroup");
20
+ const element = useRender({
21
+ defaultElement: "optgroup",
22
+ render,
23
+ state,
24
+ className,
25
+ style,
26
+ children,
27
+ props: {
28
+ ...rest,
29
+ disabled
30
+ },
31
+ libraryProps: { label },
32
+ ref
33
+ });
34
+ const context = useMemo(() => ({
35
+ ...ctx,
36
+ groupDisabled: disabled
37
+ }), [ctx, disabled]);
38
+ return /* @__PURE__ */ jsx(SelectContext, {
39
+ value: context,
40
+ children: element
41
+ });
42
+ }
43
+ SelectGroup.displayName = "SelectGroup";
44
+ //#endregion
45
+ export { SelectGroup };
46
+
47
+ //# sourceMappingURL=select-group.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-group.mjs","names":[],"sources":["../../src/select/select-group.tsx"],"sourcesContent":["\"use client\";\nimport { useMemo } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { SelectContext, useSelectContext } from \"./select-context.js\";\nimport { useSelectPartRef } from \"./select-dom.js\";\nimport type { SelectRootState } from \"./select-root.js\";\n\nexport interface SelectGroupProps extends Omit<\n ComponentPropsWithRef<\"optgroup\">,\n \"label\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * The `<optgroup label>`: shown by native pickers (Firefox today) and read by assistive\n * technology. Required. Keep it equal to the text of a `Select.GroupLabel`, if any.\n */\n label: string;\n /** Native `disabled`: every option in the group is disabled. */\n disabled?: boolean;\n className?: StateValue<string | undefined, SelectRootState>;\n style?: StateValue<CSSProperties | undefined, SelectRootState>;\n children?: StateValue<ReactNode, SelectRootState>;\n /** Replace the rendered element. Must keep an `<optgroup>`. */\n render?: RenderProp<ComponentPropsWithRef<\"optgroup\">, SelectRootState>;\n}\n\n/**\n * An `<optgroup>` of options. Its state is the Root's state. Owned key: `label`. Its `disabled`\n * reaches the Options' `state.disabled` / `data-disabled` through context, as `:disabled` does.\n */\nexport function SelectGroup({\n label,\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: SelectGroupProps) {\n const ctx = useSelectContext(\"Select.Group\");\n const state: SelectRootState = {\n value: ctx.optimistic,\n pending: ctx.pending,\n disabled: ctx.disabled,\n };\n const { ref } = useSelectPartRef<HTMLOptGroupElement>(\"Select.Group\", \"optgroup\");\n const element = useRender<ComponentPropsWithRef<\"optgroup\">, SelectRootState>({\n defaultElement: \"optgroup\",\n render,\n state,\n className,\n style,\n children,\n props: { ...rest, disabled },\n libraryProps: { label },\n ref,\n });\n // Nested groups are not valid HTML, so this only ever turns `false` into the group's value.\n const context = useMemo(() => ({ ...ctx, groupDisabled: disabled }), [ctx, disabled]);\n return <SelectContext value={context}>{element}</SelectContext>;\n}\n\nSelectGroup.displayName = \"SelectGroup\";\n"],"mappings":";;;;;;;;;;;AA+BA,SAAgB,YAAY,EAC1B,OACA,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACgB;CACnB,MAAM,MAAM,iBAAiB,cAAc;CAC3C,MAAM,QAAyB;EAC7B,OAAO,IAAI;EACX,SAAS,IAAI;EACb,UAAU,IAAI;CAChB;CACA,MAAM,EAAE,QAAQ,iBAAsC,gBAAgB,UAAU;CAChF,MAAM,UAAU,UAA8D;EAC5E,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;GAAE,GAAG;GAAM;EAAS;EAC3B,cAAc,EAAE,MAAM;EACtB;CACF,CAAC;CAED,MAAM,UAAU,eAAe;EAAE,GAAG;EAAK,eAAe;CAAS,IAAI,CAAC,KAAK,QAAQ,CAAC;CACpF,OAAO,oBAAC,eAAD;EAAe,OAAO;EAAU,UAAA;CAAuB,CAAA;AAChE;AAEA,YAAY,cAAc"}
@@ -0,0 +1,42 @@
1
+ import { RenderProp, StateValue } from "../internal/types.mjs";
2
+ import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
+ //#region src/select/select-option.d.ts
4
+ export interface SelectOptionState {
5
+ readonly value: string;
6
+ /** Optimistic: true as soon as the user picks this option, before the action settles. */
7
+ readonly selected: boolean;
8
+ /** The Root is pending and this option is the optimistic target. */
9
+ readonly pending: boolean;
10
+ /** Disabled by its own prop, a disabled `Select.Group`, or `Root disabled` (as `:disabled`). */
11
+ readonly disabled: boolean;
12
+ }
13
+ export interface SelectOptionProps extends Omit<ComponentPropsWithRef<"option">, "value" | "selected" | "className" | "style" | "children"> {
14
+ /** The option's value. Required: React cannot infer a value from rich children. */
15
+ value: string;
16
+ /** Native `disabled`: not pickable, skipped by keyboard navigation. */
17
+ disabled?: boolean;
18
+ className?: StateValue<string | undefined, SelectOptionState>;
19
+ style?: StateValue<CSSProperties | undefined, SelectOptionState>;
20
+ /**
21
+ * The option's content. Keep it readable as plain text: engines without customizable select
22
+ * (Firefox today) show only the text. Give icons `aria-hidden` and no text. Avoid the `label`
23
+ * attribute (Chromium names the option from it but shows the content).
24
+ */
25
+ children?: StateValue<ReactNode, SelectOptionState>;
26
+ /** Replace the rendered element. Must keep an `<option>`. */
27
+ render?: RenderProp<ComponentPropsWithRef<"option">, SelectOptionState>;
28
+ }
29
+ /**
30
+ * One `<option>`. It never renders `selected`: the selection is the Root's `value={optimistic}`
31
+ * plus the Root's re-apply for options that mount after the select's own commit (a Suspense
32
+ * boundary or `use()` inside the select), which the Option reports from its mount layout effect.
33
+ *
34
+ * Owned keys: `value`, `selected` (never rendered), `disabled`, `data-selected`, `data-pending`,
35
+ * `data-disabled`.
36
+ */
37
+ export declare function SelectOption({ value, disabled: disabledProp, className, style, children, render, ...rest }: SelectOptionProps): ReactNode;
38
+ export declare namespace SelectOption {
39
+ var displayName: string;
40
+ }
41
+ //#endregion
42
+ //# sourceMappingURL=select-option.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-option.d.mts","names":[],"sources":["../../src/select/select-option.tsx"],"mappings":";;;iBAWiB;WACN;;WAEA;;WAEA;;WAEA;;iBAGM,0BAA0B,KACzC;;EAIA;;EAEA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;;;;;EAM9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;wBAWvC,eACd,OACA,UAAU,cACV,WACA,OACA,UACA,WACG,QACF,oBAAiB;yBARJ"}
@@ -0,0 +1,65 @@
1
+ "use client";
2
+ import { dataAttr } from "../internal/data-attr.mjs";
3
+ import { useRender } from "../internal/use-render.mjs";
4
+ import { syncPresence } from "../internal/sync-presence.mjs";
5
+ import { useSelectContext } from "./select-context.mjs";
6
+ import { useSelectPartRef } from "./select-dom.mjs";
7
+ import { useHydratedMount } from "../internal/use-hydrated-mount.mjs";
8
+ import { useEffectEvent, useLayoutEffect } from "react";
9
+ //#region src/select/select-option.tsx
10
+ /**
11
+ * One `<option>`. It never renders `selected`: the selection is the Root's `value={optimistic}`
12
+ * plus the Root's re-apply for options that mount after the select's own commit (a Suspense
13
+ * boundary or `use()` inside the select), which the Option reports from its mount layout effect.
14
+ *
15
+ * Owned keys: `value`, `selected` (never rendered), `disabled`, `data-selected`, `data-pending`,
16
+ * `data-disabled`.
17
+ */
18
+ function SelectOption({ value, disabled: disabledProp = false, className, style, children, render, ...rest }) {
19
+ const ctx = useSelectContext("Select.Option");
20
+ const selected = ctx.optimistic === value;
21
+ const pending = ctx.pending && selected;
22
+ const disabled = ctx.disabled || ctx.groupDisabled || disabledProp;
23
+ const hydrated = useHydratedMount();
24
+ const { ref, node } = useSelectPartRef("Select.Option", "option");
25
+ const reportMount = useEffectEvent(() => {
26
+ const el = node.current;
27
+ if (el !== null) {
28
+ syncPresence(el, "data-selected", selected);
29
+ syncPresence(el, "data-pending", pending);
30
+ syncPresence(el, "data-disabled", disabled);
31
+ }
32
+ ctx.optionMounted(el, hydrated);
33
+ });
34
+ useLayoutEffect(() => {
35
+ reportMount();
36
+ }, []);
37
+ return useRender({
38
+ defaultElement: "option",
39
+ render,
40
+ state: {
41
+ value,
42
+ selected,
43
+ pending,
44
+ disabled
45
+ },
46
+ className,
47
+ style,
48
+ children,
49
+ props: rest,
50
+ libraryProps: {
51
+ value,
52
+ selected: void 0,
53
+ disabled: disabledProp,
54
+ "data-selected": dataAttr(selected),
55
+ "data-pending": dataAttr(pending),
56
+ "data-disabled": dataAttr(disabled)
57
+ },
58
+ ref
59
+ });
60
+ }
61
+ SelectOption.displayName = "SelectOption";
62
+ //#endregion
63
+ export { SelectOption };
64
+
65
+ //# sourceMappingURL=select-option.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-option.mjs","names":[],"sources":["../../src/select/select-option.tsx"],"sourcesContent":["\"use client\";\nimport { useEffectEvent, useLayoutEffect } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { syncPresence } from \"../internal/sync-presence.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useHydratedMount } from \"../internal/use-hydrated-mount.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useSelectContext } from \"./select-context.js\";\nimport { useSelectPartRef } from \"./select-dom.js\";\n\nexport interface SelectOptionState {\n readonly value: string;\n /** Optimistic: true as soon as the user picks this option, before the action settles. */\n readonly selected: boolean;\n /** The Root is pending and this option is the optimistic target. */\n readonly pending: boolean;\n /** Disabled by its own prop, a disabled `Select.Group`, or `Root disabled` (as `:disabled`). */\n readonly disabled: boolean;\n}\n\nexport interface SelectOptionProps extends Omit<\n ComponentPropsWithRef<\"option\">,\n \"value\" | \"selected\" | \"className\" | \"style\" | \"children\"\n> {\n /** The option's value. Required: React cannot infer a value from rich children. */\n value: string;\n /** Native `disabled`: not pickable, skipped by keyboard navigation. */\n disabled?: boolean;\n className?: StateValue<string | undefined, SelectOptionState>;\n style?: StateValue<CSSProperties | undefined, SelectOptionState>;\n /**\n * The option's content. Keep it readable as plain text: engines without customizable select\n * (Firefox today) show only the text. Give icons `aria-hidden` and no text. Avoid the `label`\n * attribute (Chromium names the option from it but shows the content).\n */\n children?: StateValue<ReactNode, SelectOptionState>;\n /** Replace the rendered element. Must keep an `<option>`. */\n render?: RenderProp<ComponentPropsWithRef<\"option\">, SelectOptionState>;\n}\n\n/**\n * One `<option>`. It never renders `selected`: the selection is the Root's `value={optimistic}`\n * plus the Root's re-apply for options that mount after the select's own commit (a Suspense\n * boundary or `use()` inside the select), which the Option reports from its mount layout effect.\n *\n * Owned keys: `value`, `selected` (never rendered), `disabled`, `data-selected`, `data-pending`,\n * `data-disabled`.\n */\nexport function SelectOption({\n value,\n disabled: disabledProp = false,\n className,\n style,\n children,\n render,\n ...rest\n}: SelectOptionProps) {\n const ctx = useSelectContext(\"Select.Option\");\n const selected = ctx.optimistic === value;\n const pending = ctx.pending && selected;\n const disabled = ctx.disabled || ctx.groupDisabled || disabledProp;\n const hydrated = useHydratedMount();\n const { ref, node } = useSelectPartRef<HTMLOptionElement>(\"Select.Option\", \"option\");\n\n // Reads the mount render's values: for a hydrated option that is the hydration render, which\n // used the server snapshot (`hydrated === true`).\n const reportMount = useEffectEvent(() => {\n const el = node.current;\n if (el !== null) {\n // Hydration keeps server attributes that differ from the client render (React only warns);\n // an option hydrating after its Root can render a different state than the server did.\n syncPresence(el, \"data-selected\", selected);\n syncPresence(el, \"data-pending\", pending);\n syncPresence(el, \"data-disabled\", disabled);\n }\n ctx.optionMounted(el, hydrated);\n });\n useLayoutEffect(() => {\n reportMount();\n }, []);\n\n const state: SelectOptionState = { value, selected, pending, disabled };\n\n return useRender<ComponentPropsWithRef<\"option\">, SelectOptionState>({\n defaultElement: \"option\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n value,\n selected: undefined,\n // Only the Option's own prop: `Root disabled` and the Group disable natively themselves.\n disabled: disabledProp,\n \"data-selected\": dataAttr(selected),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n },\n ref,\n });\n}\n\nSelectOption.displayName = \"SelectOption\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAiDA,SAAgB,aAAa,EAC3B,OACA,UAAU,eAAe,OACzB,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,iBAAiB,eAAe;CAC5C,MAAM,WAAW,IAAI,eAAe;CACpC,MAAM,UAAU,IAAI,WAAW;CAC/B,MAAM,WAAW,IAAI,YAAY,IAAI,iBAAiB;CACtD,MAAM,WAAW,iBAAiB;CAClC,MAAM,EAAE,KAAK,SAAS,iBAAoC,iBAAiB,QAAQ;CAInF,MAAM,cAAc,qBAAqB;EACvC,MAAM,KAAK,KAAK;EAChB,IAAI,OAAO,MAAM;GAGf,aAAa,IAAI,iBAAiB,QAAQ;GAC1C,aAAa,IAAI,gBAAgB,OAAO;GACxC,aAAa,IAAI,iBAAiB,QAAQ;EAC5C;EACA,IAAI,cAAc,IAAI,QAAQ;CAChC,CAAC;CACD,sBAAsB;EACpB,YAAY;CACd,GAAG,CAAC,CAAC;CAIL,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA,OAAA;GALiC;GAAO;GAAU;GAAS;EAKvD;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ;GACA,UAAU,KAAA;GAEV,UAAU;GACV,iBAAiB,SAAS,QAAQ;GAClC,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;EACpC;EACA;CACF,CAAC;AACH;AAEA,aAAa,cAAc"}
@@ -0,0 +1,68 @@
1
+ import { ActionDetails, ChangeAction, ChangeReason, RenderProp, StateValue } from "../internal/types.mjs";
2
+ import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
+ //#region src/select/select-root.d.ts
4
+ /** Details passed as the second argument of `valueChangeAction`. */
5
+ export interface SelectValueChangeDetails extends ActionDetails {
6
+ /**
7
+ * `"activate"`: the user picked an option (pointer, keyboard, typeahead, or browser autofill,
8
+ * which the library cannot tell from a pick); `details.event` is the native `change` event.
9
+ * `"platform"`: the browser changed the value without a pick the library saw: a form reset
10
+ * (`details.event` is the `reset` event), or a pick before hydration / Firefox form-state
11
+ * restoration reconciled at mount (`details.event` is `undefined`).
12
+ */
13
+ readonly reason: ChangeReason;
14
+ }
15
+ export interface SelectRootState {
16
+ /** Optimistic value. Content rendered from it must not suspend. */
17
+ readonly value: string;
18
+ /** An action dispatched through this Select is in flight. */
19
+ readonly pending: boolean;
20
+ /** The `disabled` prop. */
21
+ readonly disabled: boolean;
22
+ }
23
+ export interface SelectRootProps extends Omit<ComponentPropsWithRef<"select">, "value" | "defaultValue" | "onChange" | "multiple" | "size" | "disabled" | "className" | "style" | "children"> {
24
+ /** Controlled value. `undefined` means uncontrolled. Use `""` for the placeholder option. */
25
+ value?: string;
26
+ /**
27
+ * Initial value in uncontrolled mode, and the value a form reset returns to (the latest prop is
28
+ * mirrored into the options' `defaultSelected`). When omitted, the browser's choice (an option
29
+ * whose value is `""`, else the first enabled option) is adopted at mount, without a dispatch,
30
+ * and is what a form reset returns to. Until a pick (or a platform change) sets the value,
31
+ * options that mount later without the adopted one (a Suspense fallback) adopt again.
32
+ */
33
+ defaultValue?: string;
34
+ /**
35
+ * Runs inside the Root's transition whenever the selected option changes. May be sync or async
36
+ * (also a Server Function); rejections reach the nearest Error Boundary and roll the selection
37
+ * back.
38
+ *
39
+ * In engines whose closed select changes the value on every arrow press (Firefox, Safari with
40
+ * native appearance), every press dispatches; the latest dispatch wins. A `setState` placed
41
+ * after your own `await` is not a Transition update; wrap it in `startTransition` (React
42
+ * limitation). Controlled mode is the way to veto a change.
43
+ */
44
+ valueChangeAction?: ChangeAction<string, SelectValueChangeDetails>;
45
+ /** Native `disabled`. Never set by the library while pending. */
46
+ disabled?: boolean;
47
+ className?: StateValue<string | undefined, SelectRootState>;
48
+ style?: StateValue<CSSProperties | undefined, SelectRootState>;
49
+ children?: StateValue<ReactNode, SelectRootState>;
50
+ /** Replace the rendered element. Must keep a `<select>`. */
51
+ render?: RenderProp<ComponentPropsWithRef<"select">, SelectRootState>;
52
+ }
53
+ /**
54
+ * The `<select>` itself: owns the value, the transition, the form-reset listener, the mount
55
+ * reconciliation and the re-apply of late options (design/components/select.md 15.2). Renders
56
+ * `value={optimistic}`: react-dom restores a controlled select to its props after every event,
57
+ * and only the sync-lane optimistic value survives that restore.
58
+ *
59
+ * Owned keys (conventions 1.2): `value`, `disabled`, `data-pending`, `data-disabled`, `onChange`;
60
+ * inside a `Field.Root` also `id`, `name`, `required`, `aria-invalid`, `aria-describedby`
61
+ * (token-merged) and `data-invalid`, and `disabled` / `name` / `required` default from the Field.
62
+ */
63
+ export declare function SelectRoot({ value, defaultValue, valueChangeAction, disabled: disabledProp, className, style, children, render, ...rest }: SelectRootProps): import("react").JSX.Element;
64
+ export declare namespace SelectRoot {
65
+ var displayName: string;
66
+ }
67
+ //#endregion
68
+ //# sourceMappingURL=select-root.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-root.d.mts","names":[],"sources":["../../src/select/select-root.tsx"],"mappings":";;;;iBA2BiB,iCAAiC;;;;;;;;WAQvC,QAAQ;;iBAGF;;WAEN;;WAEA;;WAEA;;iBAGM,wBAAwB,KACvC;;EAYA;;;;;;;;EAQA;;;;;;;;;;;EAWA,oBAAoB,qBAAqB;;EAEzC;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;wBAavC,aACd,OACA,cACA,mBACA,UAAU,cACV,WACA,OACA,UACA,WACG,QACF,kCAAe,IAAA;yBAVF"}