@funstack/ui 0.0.0-stage → 0.1.0-alpha.1

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 (299) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -2
  3. package/dist/accordion/accordion-context.d.mts +5 -0
  4. package/dist/accordion/accordion-context.d.mts.map +1 -0
  5. package/dist/accordion/accordion-context.mjs +9 -0
  6. package/dist/accordion/accordion-context.mjs.map +1 -0
  7. package/dist/accordion/accordion-item.d.mts +53 -0
  8. package/dist/accordion/accordion-item.d.mts.map +1 -0
  9. package/dist/accordion/accordion-item.mjs +85 -0
  10. package/dist/accordion/accordion-item.mjs.map +1 -0
  11. package/dist/accordion/accordion-panel.d.mts +40 -0
  12. package/dist/accordion/accordion-panel.d.mts.map +1 -0
  13. package/dist/accordion/accordion-panel.mjs +40 -0
  14. package/dist/accordion/accordion-panel.mjs.map +1 -0
  15. package/dist/accordion/accordion-root.d.mts +90 -0
  16. package/dist/accordion/accordion-root.d.mts.map +1 -0
  17. package/dist/accordion/accordion-root.mjs +229 -0
  18. package/dist/accordion/accordion-root.mjs.map +1 -0
  19. package/dist/accordion/accordion-trigger.d.mts +37 -0
  20. package/dist/accordion/accordion-trigger.d.mts.map +1 -0
  21. package/dist/accordion/accordion-trigger.mjs +81 -0
  22. package/dist/accordion/accordion-trigger.mjs.map +1 -0
  23. package/dist/accordion/index.d.mts +20 -0
  24. package/dist/accordion/index.d.mts.map +1 -0
  25. package/dist/accordion/index.mjs +20 -0
  26. package/dist/accordion/index.mjs.map +1 -0
  27. package/dist/checkbox/checkbox.d.mts +92 -0
  28. package/dist/checkbox/checkbox.d.mts.map +1 -0
  29. package/dist/checkbox/checkbox.mjs +82 -0
  30. package/dist/checkbox/checkbox.mjs.map +1 -0
  31. package/dist/checkbox/index.d.mts +3 -0
  32. package/dist/checkbox/index.mjs +1 -0
  33. package/dist/checkbox-group/checkbox-group-context.mjs +24 -0
  34. package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -0
  35. package/dist/checkbox-group/checkbox-group-item.d.mts +55 -0
  36. package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -0
  37. package/dist/checkbox-group/checkbox-group-item.mjs +90 -0
  38. package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -0
  39. package/dist/checkbox-group/checkbox-group-label.d.mts +21 -0
  40. package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -0
  41. package/dist/checkbox-group/checkbox-group-label.mjs +30 -0
  42. package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -0
  43. package/dist/checkbox-group/checkbox-group-parent.d.mts +68 -0
  44. package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -0
  45. package/dist/checkbox-group/checkbox-group-parent.mjs +145 -0
  46. package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -0
  47. package/dist/checkbox-group/checkbox-group-root.d.mts +100 -0
  48. package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -0
  49. package/dist/checkbox-group/checkbox-group-root.mjs +291 -0
  50. package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -0
  51. package/dist/checkbox-group/index.d.mts +23 -0
  52. package/dist/checkbox-group/index.d.mts.map +1 -0
  53. package/dist/checkbox-group/index.mjs +23 -0
  54. package/dist/checkbox-group/index.mjs.map +1 -0
  55. package/dist/dialog/dialog-close.d.mts +44 -0
  56. package/dist/dialog/dialog-close.d.mts.map +1 -0
  57. package/dist/dialog/dialog-close.mjs +76 -0
  58. package/dist/dialog/dialog-close.mjs.map +1 -0
  59. package/dist/dialog/dialog-context.mjs +13 -0
  60. package/dist/dialog/dialog-context.mjs.map +1 -0
  61. package/dist/dialog/dialog-description.d.mts +22 -0
  62. package/dist/dialog/dialog-description.d.mts.map +1 -0
  63. package/dist/dialog/dialog-description.mjs +31 -0
  64. package/dist/dialog/dialog-description.mjs.map +1 -0
  65. package/dist/dialog/dialog-form.d.mts +58 -0
  66. package/dist/dialog/dialog-form.d.mts.map +1 -0
  67. package/dist/dialog/dialog-form.mjs +108 -0
  68. package/dist/dialog/dialog-form.mjs.map +1 -0
  69. package/dist/dialog/dialog-popup.d.mts +81 -0
  70. package/dist/dialog/dialog-popup.d.mts.map +1 -0
  71. package/dist/dialog/dialog-popup.mjs +367 -0
  72. package/dist/dialog/dialog-popup.mjs.map +1 -0
  73. package/dist/dialog/dialog-root.d.mts +70 -0
  74. package/dist/dialog/dialog-root.d.mts.map +1 -0
  75. package/dist/dialog/dialog-root.mjs +113 -0
  76. package/dist/dialog/dialog-root.mjs.map +1 -0
  77. package/dist/dialog/dialog-title.d.mts +23 -0
  78. package/dist/dialog/dialog-title.d.mts.map +1 -0
  79. package/dist/dialog/dialog-title.mjs +31 -0
  80. package/dist/dialog/dialog-title.mjs.map +1 -0
  81. package/dist/dialog/dialog-trigger.d.mts +39 -0
  82. package/dist/dialog/dialog-trigger.d.mts.map +1 -0
  83. package/dist/dialog/dialog-trigger.mjs +80 -0
  84. package/dist/dialog/dialog-trigger.mjs.map +1 -0
  85. package/dist/dialog/index.d.mts +28 -0
  86. package/dist/dialog/index.d.mts.map +1 -0
  87. package/dist/dialog/index.mjs +28 -0
  88. package/dist/dialog/index.mjs.map +1 -0
  89. package/dist/index.d.mts +60 -0
  90. package/dist/index.mjs +12 -0
  91. package/dist/internal/action-details.mjs +47 -0
  92. package/dist/internal/action-details.mjs.map +1 -0
  93. package/dist/internal/anchor-position.d.mts +7 -0
  94. package/dist/internal/anchor-position.d.mts.map +1 -0
  95. package/dist/internal/anchor-position.mjs +16 -0
  96. package/dist/internal/anchor-position.mjs.map +1 -0
  97. package/dist/internal/data-attr.mjs +13 -0
  98. package/dist/internal/data-attr.mjs.map +1 -0
  99. package/dist/internal/merge-props.mjs +119 -0
  100. package/dist/internal/merge-props.mjs.map +1 -0
  101. package/dist/internal/platform-attributes.d.mts +55 -0
  102. package/dist/internal/platform-attributes.d.mts.map +1 -0
  103. package/dist/internal/sync-presence.mjs +19 -0
  104. package/dist/internal/sync-presence.mjs.map +1 -0
  105. package/dist/internal/transition-boundary.mjs +52 -0
  106. package/dist/internal/transition-boundary.mjs.map +1 -0
  107. package/dist/internal/transition-types.mjs +15 -0
  108. package/dist/internal/transition-types.mjs.map +1 -0
  109. package/dist/internal/types.d.mts +38 -0
  110. package/dist/internal/types.d.mts.map +1 -0
  111. package/dist/internal/use-action-trigger.mjs +58 -0
  112. package/dist/internal/use-action-trigger.mjs.map +1 -0
  113. package/dist/internal/use-controllable-action.mjs +115 -0
  114. package/dist/internal/use-controllable-action.mjs.map +1 -0
  115. package/dist/internal/use-delayed-pair.mjs +40 -0
  116. package/dist/internal/use-delayed-pair.mjs.map +1 -0
  117. package/dist/internal/use-dev-warning.mjs +21 -0
  118. package/dist/internal/use-dev-warning.mjs.map +1 -0
  119. package/dist/internal/use-exit-animation.mjs +55 -0
  120. package/dist/internal/use-exit-animation.mjs.map +1 -0
  121. package/dist/internal/use-form-reset.mjs +50 -0
  122. package/dist/internal/use-form-reset.mjs.map +1 -0
  123. package/dist/internal/use-native-checked.mjs +113 -0
  124. package/dist/internal/use-native-checked.mjs.map +1 -0
  125. package/dist/internal/use-native-group-reconciliation.mjs +64 -0
  126. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -0
  127. package/dist/internal/use-popover-popup.mjs +274 -0
  128. package/dist/internal/use-popover-popup.mjs.map +1 -0
  129. package/dist/internal/use-popover-root.d.mts +2 -0
  130. package/dist/internal/use-popover-root.mjs +112 -0
  131. package/dist/internal/use-popover-root.mjs.map +1 -0
  132. package/dist/internal/use-popover-trigger.mjs +86 -0
  133. package/dist/internal/use-popover-trigger.mjs.map +1 -0
  134. package/dist/internal/use-render.mjs +51 -0
  135. package/dist/internal/use-render.mjs.map +1 -0
  136. package/dist/internal/use-until-found.mjs +40 -0
  137. package/dist/internal/use-until-found.mjs.map +1 -0
  138. package/dist/menu/index.d.mts +34 -0
  139. package/dist/menu/index.d.mts.map +1 -0
  140. package/dist/menu/index.mjs +34 -0
  141. package/dist/menu/index.mjs.map +1 -0
  142. package/dist/menu/menu-checkbox-item.d.mts +42 -0
  143. package/dist/menu/menu-checkbox-item.d.mts.map +1 -0
  144. package/dist/menu/menu-checkbox-item.mjs +71 -0
  145. package/dist/menu/menu-checkbox-item.mjs.map +1 -0
  146. package/dist/menu/menu-context.d.mts +1 -0
  147. package/dist/menu/menu-context.mjs +28 -0
  148. package/dist/menu/menu-context.mjs.map +1 -0
  149. package/dist/menu/menu-dom.mjs +37 -0
  150. package/dist/menu/menu-dom.mjs.map +1 -0
  151. package/dist/menu/menu-group.d.mts +48 -0
  152. package/dist/menu/menu-group.d.mts.map +1 -0
  153. package/dist/menu/menu-group.mjs +69 -0
  154. package/dist/menu/menu-group.mjs.map +1 -0
  155. package/dist/menu/menu-hover.mjs +29 -0
  156. package/dist/menu/menu-hover.mjs.map +1 -0
  157. package/dist/menu/menu-item.d.mts +45 -0
  158. package/dist/menu/menu-item.d.mts.map +1 -0
  159. package/dist/menu/menu-item.mjs +54 -0
  160. package/dist/menu/menu-item.mjs.map +1 -0
  161. package/dist/menu/menu-popup.d.mts +69 -0
  162. package/dist/menu/menu-popup.d.mts.map +1 -0
  163. package/dist/menu/menu-popup.mjs +207 -0
  164. package/dist/menu/menu-popup.mjs.map +1 -0
  165. package/dist/menu/menu-radio-group.d.mts +37 -0
  166. package/dist/menu/menu-radio-group.d.mts.map +1 -0
  167. package/dist/menu/menu-radio-group.mjs +72 -0
  168. package/dist/menu/menu-radio-group.mjs.map +1 -0
  169. package/dist/menu/menu-radio-item.d.mts +33 -0
  170. package/dist/menu/menu-radio-item.d.mts.map +1 -0
  171. package/dist/menu/menu-radio-item.mjs +62 -0
  172. package/dist/menu/menu-radio-item.mjs.map +1 -0
  173. package/dist/menu/menu-root.d.mts +54 -0
  174. package/dist/menu/menu-root.d.mts.map +1 -0
  175. package/dist/menu/menu-root.mjs +102 -0
  176. package/dist/menu/menu-root.mjs.map +1 -0
  177. package/dist/menu/menu-submenu-trigger.d.mts +31 -0
  178. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -0
  179. package/dist/menu/menu-submenu-trigger.mjs +92 -0
  180. package/dist/menu/menu-submenu-trigger.mjs.map +1 -0
  181. package/dist/menu/menu-trigger.d.mts +36 -0
  182. package/dist/menu/menu-trigger.d.mts.map +1 -0
  183. package/dist/menu/menu-trigger.mjs +81 -0
  184. package/dist/menu/menu-trigger.mjs.map +1 -0
  185. package/dist/menu/use-menu-item.mjs +54 -0
  186. package/dist/menu/use-menu-item.mjs.map +1 -0
  187. package/dist/popover/index.d.mts +28 -0
  188. package/dist/popover/index.d.mts.map +1 -0
  189. package/dist/popover/index.mjs +28 -0
  190. package/dist/popover/index.mjs.map +1 -0
  191. package/dist/popover/popover-close.d.mts +41 -0
  192. package/dist/popover/popover-close.d.mts.map +1 -0
  193. package/dist/popover/popover-close.mjs +90 -0
  194. package/dist/popover/popover-close.mjs.map +1 -0
  195. package/dist/popover/popover-context.mjs +26 -0
  196. package/dist/popover/popover-context.mjs.map +1 -0
  197. package/dist/popover/popover-description.d.mts +22 -0
  198. package/dist/popover/popover-description.d.mts.map +1 -0
  199. package/dist/popover/popover-description.mjs +28 -0
  200. package/dist/popover/popover-description.mjs.map +1 -0
  201. package/dist/popover/popover-popup.d.mts +82 -0
  202. package/dist/popover/popover-popup.d.mts.map +1 -0
  203. package/dist/popover/popover-popup.mjs +93 -0
  204. package/dist/popover/popover-popup.mjs.map +1 -0
  205. package/dist/popover/popover-root.d.mts +64 -0
  206. package/dist/popover/popover-root.d.mts.map +1 -0
  207. package/dist/popover/popover-root.mjs +39 -0
  208. package/dist/popover/popover-root.mjs.map +1 -0
  209. package/dist/popover/popover-title.d.mts +23 -0
  210. package/dist/popover/popover-title.d.mts.map +1 -0
  211. package/dist/popover/popover-title.mjs +28 -0
  212. package/dist/popover/popover-title.mjs.map +1 -0
  213. package/dist/popover/popover-trigger.d.mts +37 -0
  214. package/dist/popover/popover-trigger.d.mts.map +1 -0
  215. package/dist/popover/popover-trigger.mjs +40 -0
  216. package/dist/popover/popover-trigger.mjs.map +1 -0
  217. package/dist/radio-group/index.d.mts +20 -0
  218. package/dist/radio-group/index.d.mts.map +1 -0
  219. package/dist/radio-group/index.mjs +20 -0
  220. package/dist/radio-group/index.mjs.map +1 -0
  221. package/dist/radio-group/radio-group-context.mjs +13 -0
  222. package/dist/radio-group/radio-group-context.mjs.map +1 -0
  223. package/dist/radio-group/radio-group-item.d.mts +54 -0
  224. package/dist/radio-group/radio-group-item.d.mts.map +1 -0
  225. package/dist/radio-group/radio-group-item.mjs +83 -0
  226. package/dist/radio-group/radio-group-item.mjs.map +1 -0
  227. package/dist/radio-group/radio-group-label.d.mts +21 -0
  228. package/dist/radio-group/radio-group-label.d.mts.map +1 -0
  229. package/dist/radio-group/radio-group-label.mjs +30 -0
  230. package/dist/radio-group/radio-group-label.mjs.map +1 -0
  231. package/dist/radio-group/radio-group-root.d.mts +92 -0
  232. package/dist/radio-group/radio-group-root.d.mts.map +1 -0
  233. package/dist/radio-group/radio-group-root.mjs +137 -0
  234. package/dist/radio-group/radio-group-root.mjs.map +1 -0
  235. package/dist/switch/index.d.mts +3 -0
  236. package/dist/switch/index.mjs +1 -0
  237. package/dist/switch/switch.d.mts +78 -0
  238. package/dist/switch/switch.d.mts.map +1 -0
  239. package/dist/switch/switch.mjs +77 -0
  240. package/dist/switch/switch.mjs.map +1 -0
  241. package/dist/tabs/index.d.mts +24 -0
  242. package/dist/tabs/index.d.mts.map +1 -0
  243. package/dist/tabs/index.mjs +23 -0
  244. package/dist/tabs/index.mjs.map +1 -0
  245. package/dist/tabs/tabs-context.d.mts +7 -0
  246. package/dist/tabs/tabs-context.d.mts.map +1 -0
  247. package/dist/tabs/tabs-context.mjs +14 -0
  248. package/dist/tabs/tabs-context.mjs.map +1 -0
  249. package/dist/tabs/tabs-ids.mjs +39 -0
  250. package/dist/tabs/tabs-ids.mjs.map +1 -0
  251. package/dist/tabs/tabs-indicator.d.mts +32 -0
  252. package/dist/tabs/tabs-indicator.d.mts.map +1 -0
  253. package/dist/tabs/tabs-indicator.mjs +49 -0
  254. package/dist/tabs/tabs-indicator.mjs.map +1 -0
  255. package/dist/tabs/tabs-list.d.mts +34 -0
  256. package/dist/tabs/tabs-list.d.mts.map +1 -0
  257. package/dist/tabs/tabs-list.mjs +130 -0
  258. package/dist/tabs/tabs-list.mjs.map +1 -0
  259. package/dist/tabs/tabs-panel.d.mts +50 -0
  260. package/dist/tabs/tabs-panel.d.mts.map +1 -0
  261. package/dist/tabs/tabs-panel.mjs +81 -0
  262. package/dist/tabs/tabs-panel.mjs.map +1 -0
  263. package/dist/tabs/tabs-root.d.mts +64 -0
  264. package/dist/tabs/tabs-root.d.mts.map +1 -0
  265. package/dist/tabs/tabs-root.mjs +90 -0
  266. package/dist/tabs/tabs-root.mjs.map +1 -0
  267. package/dist/tabs/tabs-tab.d.mts +49 -0
  268. package/dist/tabs/tabs-tab.d.mts.map +1 -0
  269. package/dist/tabs/tabs-tab.mjs +89 -0
  270. package/dist/tabs/tabs-tab.mjs.map +1 -0
  271. package/dist/toggle/index.d.mts +3 -0
  272. package/dist/toggle/index.mjs +1 -0
  273. package/dist/toggle/toggle.d.mts +57 -0
  274. package/dist/toggle/toggle.d.mts.map +1 -0
  275. package/dist/toggle/toggle.mjs +59 -0
  276. package/dist/toggle/toggle.mjs.map +1 -0
  277. package/dist/tooltip/index.d.mts +20 -0
  278. package/dist/tooltip/index.d.mts.map +1 -0
  279. package/dist/tooltip/index.mjs +19 -0
  280. package/dist/tooltip/index.mjs.map +1 -0
  281. package/dist/tooltip/tooltip-context.d.mts +5 -0
  282. package/dist/tooltip/tooltip-context.d.mts.map +1 -0
  283. package/dist/tooltip/tooltip-context.mjs +13 -0
  284. package/dist/tooltip/tooltip-context.mjs.map +1 -0
  285. package/dist/tooltip/tooltip-popup.d.mts +49 -0
  286. package/dist/tooltip/tooltip-popup.d.mts.map +1 -0
  287. package/dist/tooltip/tooltip-popup.mjs +52 -0
  288. package/dist/tooltip/tooltip-popup.mjs.map +1 -0
  289. package/dist/tooltip/tooltip-root.d.mts +41 -0
  290. package/dist/tooltip/tooltip-root.d.mts.map +1 -0
  291. package/dist/tooltip/tooltip-root.mjs +86 -0
  292. package/dist/tooltip/tooltip-root.mjs.map +1 -0
  293. package/dist/tooltip/tooltip-trigger.d.mts +38 -0
  294. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -0
  295. package/dist/tooltip/tooltip-trigger.mjs +55 -0
  296. package/dist/tooltip/tooltip-trigger.mjs.map +1 -0
  297. package/dist/tooltip/use-tooltip-interaction.mjs +119 -0
  298. package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -0
  299. package/package.json +73 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-group-parent.mjs","names":[],"sources":["../../src/checkbox-group/checkbox-group-parent.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useLayoutEffect, useMemo, useRef, useSyncExternalStore } from \"react\";\nimport type { ChangeEvent, ComponentPropsWithRef, CSSProperties, ViewTransitionClass } from \"react\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { guardCheckableChange, useNativeChecked } from \"../internal/use-native-checked.js\";\nimport { useFormReset } from \"../internal/use-form-reset.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { enabledValues, useCheckboxGroupContext } from \"./checkbox-group-context.js\";\nimport type { CheckboxGroupPatch } from \"./checkbox-group-context.js\";\nimport { syncPresence } from \"../internal/sync-presence.js\";\n\nexport interface CheckboxGroupParentState {\n readonly values: readonly string[];\n /** Every value in `values` is optimistically checked (`false` when `values` is empty). */\n readonly checked: boolean;\n /**\n * Some but not all of `values` are optimistically checked. Never true together with\n * `checked`. Not suspended while pending (it is derived from optimistic state).\n */\n readonly indeterminate: boolean;\n /** The Root is pending and at least one of `values` differs between optimistic and committed. */\n readonly pending: boolean;\n /** Disabled by its own prop or by `Root disabled`. */\n readonly disabled: boolean;\n}\n\nexport interface CheckboxGroupParentProps extends Omit<\n ComponentPropsWithRef<\"input\">,\n | \"type\"\n | \"name\"\n | \"value\"\n | \"checked\"\n | \"defaultChecked\"\n | \"defaultValue\"\n | \"form\"\n | \"required\"\n | \"autoComplete\"\n | \"aria-checked\"\n | \"onChange\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * The Item values this Parent controls (usually every Item of the group). Its checked and\n * mixed states are derived from them; its click checks or unchecks all of them. Values with\n * no Item are still added to / removed from the group's value.\n *\n * Values whose Items are disabled (their own `disabled` prop) are left alone: the click does\n * not change them and the derivation ignores them, so the Parent shows checked when every\n * enabled Item is. When every value has only disabled Items, the Parent acts on all of them\n * (disable the Parent to make it inert). Before hydration the server-rendered state counts\n * disabled Items too; it settles when the Items hydrate.\n */\n values: string[];\n /** Native `disabled`: unfocusable, never dispatches. */\n disabled?: boolean;\n /**\n * Forwarded to the Parent's `<ViewTransition default>`. Default: no boundary. Fires only on the\n * commit that settles the action (or rolls it back), never on the optimistic flip; animate the\n * flip itself with CSS on `:checked` / `:indeterminate`.\n *\n * Static: without `transition` the part renders no `<ViewTransition>`; changing it between\n * `undefined` and a value remounts the element. Any value, `\"none\"` included, makes a mount or\n * `<Activity>` reveal of this part inside a transition start a document view transition: the\n * page cross-fades for about 250 ms and the next transition commit waits for it (issue #35).\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, CheckboxGroupParentState>;\n style?: StateValue<CSSProperties | undefined, CheckboxGroupParentState>;\n /** Replace the rendered element. Must keep an `<input>`; the library sets `type=\"checkbox\"`. */\n render?: RenderProp<ComponentPropsWithRef<\"input\">, CheckboxGroupParentState>;\n}\n\nconst subscribeNothing = () => () => {};\n\n/** `checked` / `indeterminate` of a Parent over `values` against `set` (design 6.1). */\nfunction derive(values: readonly string[], set: ReadonlySet<string>) {\n let inSet = 0;\n for (const v of values) if (set.has(v)) inSet += 1;\n const checked = values.length > 0 && inSet === values.length;\n return { checked, indeterminate: inSet > 0 && !checked };\n}\n\n/**\n * The mixed-state \"select all\" checkbox of a group (WAI-ARIA APG \"Checkbox (Mixed-State)\"):\n * `<input type=\"checkbox\">` checked when every value in `values` is in the group's optimistic\n * set, mixed (`el.indeterminate`, `data-indeterminate`) when some are. A click checks every value\n * when mixed, unchecks every value when checked, and from unchecked restores the last partial\n * combination of its values the group committed (seeded at mount), else checks every value. Each\n * click is one dispatch through the Root's `valueChangeAction`. Never submitted (no `name`).\n * \"Its values\" are those whose Items are enabled: disabled Items are left alone (see `values`).\n *\n * Owned keys (conventions 1.2): `type`, `name` (removed), `value` (removed), `checked`,\n * `defaultChecked`, `indeterminate` (stripped; the property is set), `required` (removed), `form`\n * (removed), `autoComplete` (`\"off\"`), `disabled`, `aria-checked` (removed), `data-checked`, `data-indeterminate`,\n * `data-pending`, `data-disabled`. `onChange` is merged.\n */\nexport function CheckboxGroupParent({\n values,\n disabled: disabledProp = false,\n transition,\n className,\n style,\n render,\n ...rest\n}: CheckboxGroupParentProps) {\n const ctx = useCheckboxGroupContext(\"CheckboxGroup.Parent\");\n // The values the Parent acts on: `values` minus disabled Items (design 6.2). A hydration\n // render uses every value, as the server did (it cannot know which Items are disabled), so\n // that the DOM `checked` it hydrates can be compared with the derivation for the\n // pre-hydration report below, also when this Parent hydrates after the Items registered.\n const hydrating = useSyncExternalStore(\n subscribeNothing,\n () => false,\n () => true,\n );\n const { disabledItems } = ctx;\n const effective = useMemo(\n () => (hydrating ? values : enabledValues(values, disabledItems)),\n [hydrating, values, disabledItems],\n );\n const { checked, indeterminate } = derive(effective, ctx.optimistic);\n const pending = ctx.pending && values.some((v) => ctx.optimistic.has(v) !== ctx.committed.has(v));\n const disabled = ctx.disabled || disabledProp;\n\n // The APG restore memory: the last partial combination of `values` the group committed\n // (design 6.2). Committed, not optimistic, so a partial state that only ever rolled back is\n // never restored. The first run seeds it from the mount-time value.\n const memory = useRef<readonly string[] | null>(null);\n const { committed } = ctx;\n useLayoutEffect(() => {\n const inCommitted = effective.filter((v) => committed.has(v));\n if (inCommitted.length > 0 && inCommitted.length < effective.length) {\n memory.current = inCommitted;\n }\n }, [committed, effective]);\n\n const inputRef = useNativeChecked({\n type: \"checkbox\",\n component: \"CheckboxGroup.Parent\",\n checked,\n indeterminate,\n group: true,\n onItemMounted: (el) => {\n if (el !== null) {\n // A click before hydration flipped the box (design 8.1): report it as the Parent's\n // semantic before the Root reads the group (which leaves disabled Items alone). Firefox's\n // form-state restoration cannot cause this: the Parent renders `autocomplete=\"off\"`.\n if (el.checked !== checked) ctx.reportParent(values, el.checked);\n syncPresence(el, \"data-checked\", checked);\n syncPresence(el, \"data-indeterminate\", indeterminate);\n syncPresence(el, \"data-pending\", pending);\n syncPresence(el, \"data-disabled\", disabled);\n }\n ctx.onItemMounted(el);\n },\n defaultChecked:\n ctx.defaultValue === undefined ? undefined : derive(effective, ctx.defaultValue).checked,\n });\n\n // A form reset sets the Parent's DOM `checked` to its `defaultChecked`, which in controlled\n // mode is React's mount-time value and can be stale (its `values` changed, it mounted after the\n // Items with another value). The Parent re-renders only if the Root dispatches; otherwise put\n // the derivation back (the Root's own microtask, queued after this one, may still dispatch,\n // and the re-render re-applies `checked`).\n const node = useRef<HTMLInputElement | null>(null);\n const ref = useCallback(\n (el: HTMLInputElement) => {\n node.current = el;\n const cleanup = inputRef(el);\n return () => {\n node.current = null;\n if (typeof cleanup === \"function\") cleanup();\n };\n },\n [inputRef],\n );\n useFormReset(node, () => {\n const el = node.current;\n if (el !== null && el.checked !== checked) el.checked = checked;\n });\n\n /** The click cycle of design 6.2. */\n const cyclePatch = (): CheckboxGroupPatch => {\n if (checked) return { added: [], removed: [...effective] };\n if (indeterminate) {\n return { added: effective.filter((v) => !ctx.optimistic.has(v)), removed: [] };\n }\n const restore = memory.current?.filter((v) => effective.includes(v)) ?? [];\n return { added: restore.length > 0 ? restore : [...effective], removed: [] };\n };\n\n const state: CheckboxGroupParentState = { values, checked, indeterminate, pending, disabled };\n\n const element = useRender<ComponentPropsWithRef<\"input\">, CheckboxGroupParentState>({\n defaultElement: \"input\",\n render,\n state,\n className,\n style,\n children: undefined,\n ref,\n props: rest,\n libraryProps: {\n type: \"checkbox\",\n // A Parent is not a value: it never posts and is never required.\n name: undefined,\n value: undefined,\n required: undefined,\n form: undefined,\n // Nothing to restore (it is not a value): without this, Firefox restores its `checked` on\n // reload and the mount read would take it for a click before hydration (design 8.1).\n autoComplete: \"off\",\n checked,\n defaultChecked: undefined,\n // Not a DOM attribute; the hook sets the property. Owned so that a `render` element's own\n // `indeterminate` prop (which react-dom would warn about) is stripped.\n ...({ indeterminate: undefined } as object),\n \"aria-checked\": undefined,\n disabled: disabledProp,\n \"data-checked\": dataAttr(checked),\n \"data-indeterminate\": dataAttr(indeterminate),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n onChange: (event: ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n const nativeEvent = event.nativeEvent;\n guardCheckableChange(\n nativeEvent,\n () => ctx.apply(cyclePatch(), nativeEvent),\n \"CheckboxGroup.Parent\",\n );\n },\n },\n });\n\n return useTransitionBoundary(\"CheckboxGroup.Parent\", transition, element);\n}\n\nCheckboxGroupParent.displayName = \"CheckboxGroupParent\";\n"],"mappings":";;;;;;;;;;AA4EA,MAAM,+BAA+B,CAAC;;AAGtC,SAAS,OAAO,QAA2B,KAA0B;CACnE,IAAI,QAAQ;CACZ,KAAK,MAAM,KAAK,QAAQ,IAAI,IAAI,IAAI,CAAC,GAAG,SAAS;CACjD,MAAM,UAAU,OAAO,SAAS,KAAK,UAAU,OAAO;CACtD,OAAO;EAAE;EAAS,eAAe,QAAQ,KAAK,CAAC;CAAQ;AACzD;;;;;;;;;;;;;;;AAgBA,SAAgB,oBAAoB,EAClC,QACA,UAAU,eAAe,OACzB,YACA,WACA,OACA,QACA,GAAG,QACwB;CAC3B,MAAM,MAAM,wBAAwB,sBAAsB;CAK1D,MAAM,YAAY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Aa,YAAY;EACvB,MAAM,KAAK,KAAK;EAChB,IAAI,OAAO,QAAQ,GAAG,YAAY,SAAS,GAAG,UAAU;CAC1D,CAAC;;CAGD,MAAM,mBAAuC;EAC3C,IAAI,SAAS,OAAO;GAAE,OAAO,CAAC;GAAG,SAAS,CAAC,GAAG,SAAS;EAAE;EACzD,IAAI,eACF,OAAO;GAAE,OAAO,UAAU,QAAQ,MAAM,CAAC,IAAI,WAAW,IAAI,CAAC,CAAC;GAAG,SAAS,CAAC;EAAE;EAE/E,MAAM,UAAU,OAAO,SAAS,QAAQ,MAAM,UAAU,SAAS,CAAC,CAAC,KAAK,CAAC;EACzE,OAAO;GAAE,OAAO,QAAQ,SAAS,IAAI,UAAU,CAAC,GAAG,SAAS;GAAG,SAAS,CAAC;EAAE;CAC7E;CAIA,MAAM,UAAU,UAAoE;EAClF,gBAAgB;EAChB;EACA,OAAA;GALwC;GAAQ;GAAS;GAAe;GAAS;EAK7E;EACJ;EACA;EACA,UAAU,KAAA;EACV;EACA,OAAO;EACP,cAAc;GACZ,MAAM;GAEN,MAAM,KAAA;GACN,OAAO,KAAA;GACP,UAAU,KAAA;GACV,MAAM,KAAA;GAGN,cAAc;GACd;GACA,gBAAgB,KAAA;GAGV,eAAe,KAAA;GACrB,gBAAgB,KAAA;GAChB,UAAU;GACV,gBAAgB,SAAS,OAAO;GAChC,sBAAsB,SAAS,aAAa;GAC5C,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;GAClC,WAAW,UAAyC;IAClD,IAAI,UAAU;IACd,MAAM,cAAc,MAAM;IAC1B,qBACE,mBACM,IAAI,MAAM,WAAW,GAAG,WAAW,GACzC,sBACF;GACF;EACF;CACF,CAAC;CAED,OAAO,sBAAsB,wBAAwB,YAAY,OAAO;AAC1E;AAEA,oBAAoB,cAAc"}
@@ -0,0 +1,100 @@
1
+ import { ActionDetails, ChangeAction, ChangeReason, RenderProp, StateValue } from "../internal/types.mjs";
2
+ import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
+ //#region src/checkbox-group/checkbox-group-root.d.ts
4
+ /** Details passed as the second argument of `valueChangeAction`. */
5
+ export interface CheckboxGroupValueChangeDetails extends ActionDetails {
6
+ /**
7
+ * `"activate"`: the user toggled an Item or a Parent (click, Space, label click; `event` is the
8
+ * native `click`). `"platform"`: the browser changed the checked boxes itself: a form reset
9
+ * (`event` is the `reset` event), or clicks before hydration / Firefox form-state restoration
10
+ * found at mount (`event` is `undefined`).
11
+ */
12
+ readonly reason: ChangeReason;
13
+ /** Values this dispatch checked, in document order of their Items (values with no Item last). */
14
+ readonly added: readonly string[];
15
+ /** Values this dispatch unchecked, same order. */
16
+ readonly removed: readonly string[];
17
+ }
18
+ export interface CheckboxGroupRootState {
19
+ /**
20
+ * Optimistic checked values, in document order of the Items as of the Root's last render
21
+ * (values with no Item last). Items reordered by a component that re-renders without the Root
22
+ * keep the previous order here until the Root renders again; `next` and `details` of
23
+ * `valueChangeAction` always read the current DOM order. The server render and the first client
24
+ * render use the value's own order. Content rendered from it must not suspend.
25
+ */
26
+ readonly value: readonly string[];
27
+ /** An action dispatched through this group is in flight. */
28
+ readonly pending: boolean;
29
+ /** The `disabled` prop. */
30
+ readonly disabled: boolean;
31
+ }
32
+ export interface CheckboxGroupRootProps extends Omit<ComponentPropsWithRef<"fieldset">, "className" | "style" | "children" | "defaultValue" | "defaultChecked" | "name" | "disabled" | "form"> {
33
+ /**
34
+ * Controlled checked values. `[]` checks nothing; `undefined` means uncontrolled. Order is not
35
+ * significant and duplicates are ignored: the value is a set.
36
+ *
37
+ * A form reset returns each box to the `checked` it had when *that box* mounted (React sets
38
+ * `defaultChecked` once, from the initial `checked`). The reset is offered to
39
+ * `valueChangeAction` as a `"platform"` change; for a stable target use `defaultValue`.
40
+ */
41
+ value?: string[];
42
+ /**
43
+ * Initial values in uncontrolled mode. Defaults to `[]`. Also the values a form reset returns
44
+ * to: the latest prop value is mirrored into the boxes' `defaultChecked`.
45
+ */
46
+ defaultValue?: string[];
47
+ /**
48
+ * Runs inside the Root's transition whenever the set of checked values changes. May be sync
49
+ * or async (also a Server Function); rejections reach the nearest Error Boundary and roll the
50
+ * change back.
51
+ *
52
+ * `next` is the whole set as a fresh array in document order of the Items; treat it as a set.
53
+ * `details.added` / `details.removed` say what changed. When controlled and updating after
54
+ * your own `await`, prefer a functional update keyed by `added` / `removed` over
55
+ * `setValue(next)`: two overlapping actions completing out of order would otherwise land the
56
+ * older whole set last. A `setState` placed after your own `await` is not a Transition update;
57
+ * wrap it in `startTransition` (React limitation). `details.event.preventDefault()` is not a
58
+ * veto; use controlled mode to veto a change.
59
+ */
60
+ valueChangeAction?: ChangeAction<string[], CheckboxGroupValueChangeDetails>;
61
+ /**
62
+ * The `name` shared by every Item (form data key: `formData.getAll(name)`). Defaults to a
63
+ * `useId()` value; pass a real name when the group is inside a `<form>` you submit.
64
+ */
65
+ name?: string;
66
+ /** The `form` attribute, applied to the fieldset and to every Item. */
67
+ form?: string;
68
+ /**
69
+ * "At least one Item must be checked." Rendered as native `required` on every Item while no
70
+ * enabled Item is checked, and on none once one is: values with no Item and checked disabled
71
+ * Items (neither is submitted) do not satisfy it. Until the Items have mounted (server HTML,
72
+ * before hydration) any checked value satisfies it. Not exposed on the fieldset (ARIA does not
73
+ * allow `aria-required` on role `group`): say it in the `Label` or through `aria-describedby`.
74
+ */
75
+ required?: boolean;
76
+ /** Renders `<fieldset disabled>`: every Item and Parent is disabled and unfocusable. */
77
+ disabled?: boolean;
78
+ className?: StateValue<string | undefined, CheckboxGroupRootState>;
79
+ style?: StateValue<CSSProperties | undefined, CheckboxGroupRootState>;
80
+ children?: StateValue<ReactNode, CheckboxGroupRootState>;
81
+ /** Replace the rendered element. Must keep a `<fieldset>`. */
82
+ render?: RenderProp<ComponentPropsWithRef<"fieldset">, CheckboxGroupRootState>;
83
+ }
84
+ /**
85
+ * `<fieldset>` that owns the group's state (a set of values), the transition, the shared `name`,
86
+ * the form-reset listener, the mount reconciliation and the group-level `required`
87
+ * (design/components/checkbox-group.md 14.3). Carries `data-pending` while `valueChangeAction`
88
+ * is in flight. Its implicit role is `group`; no `role` is written.
89
+ *
90
+ * Owned keys (conventions 1.2): `disabled`, `form`, `data-pending`, `data-disabled`.
91
+ *
92
+ * Unlike RadioGroup, Items may hydrate after their Root (a Suspense boundary between them): a
93
+ * click before an Item hydrated is reconciled when it does.
94
+ */
95
+ export declare function CheckboxGroupRoot({ value, defaultValue, valueChangeAction, name: nameProp, form, required, disabled, className, style, children, render, ...rest }: CheckboxGroupRootProps): import("react").JSX.Element;
96
+ export declare namespace CheckboxGroupRoot {
97
+ var displayName: string;
98
+ }
99
+ //#endregion
100
+ //# sourceMappingURL=checkbox-group-root.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-group-root.d.mts","names":[],"sources":["../../src/checkbox-group/checkbox-group-root.tsx"],"mappings":";;;;iBA8BiB,wCAAwC;;;;;;;WAO9C,QAAQ;;WAER;;WAEA;;iBAGM;;;;;;;;WAQN;;WAEA;;WAEA;;iBAGM,+BAA+B,KAC9C;;;;;;;;;EAkBA;;;;;EAKA;;;;;;;;;;;;;;EAcA,oBAAoB,uBAAuB;;;;;EAK3C;;EAEA;;;;;;;;EAQA;;EAEA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,mCAAmC;;;;;;;;;;;;;wBAoFzC,oBACd,OACA,cACA,mBACA,MAAM,UACN,MACA,UACA,UACA,WACA,OACA,UACA,WACG,QACF,yCAAsB,IAAA;yBAbT"}
@@ -0,0 +1,291 @@
1
+ "use client";
2
+ import { createActionDetails } from "../internal/action-details.mjs";
3
+ import { dataAttr } from "../internal/data-attr.mjs";
4
+ import { transitionTypes } from "../internal/transition-types.mjs";
5
+ import { useControllableAction } from "../internal/use-controllable-action.mjs";
6
+ import { useRender } from "../internal/use-render.mjs";
7
+ import { useNativeGroupReconciliation } from "../internal/use-native-group-reconciliation.mjs";
8
+ import { CheckboxGroupContext, enabledValues } from "./checkbox-group-context.mjs";
9
+ import { useCallback, useEffectEvent, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
10
+ import { jsx } from "react/jsx-runtime";
11
+ //#region src/checkbox-group/checkbox-group-root.tsx
12
+ const isDev = process.env.NODE_ENV !== "production";
13
+ const EMPTY = /* @__PURE__ */ new Set();
14
+ function toSet(value) {
15
+ return new Set(value);
16
+ }
17
+ function setsEqual(a, b) {
18
+ if (a.size !== b.size) return false;
19
+ for (const v of a) if (!b.has(v)) return false;
20
+ return true;
21
+ }
22
+ /** The optimistic reducer (design 5.2): apply a patch, so stacked dispatches re-base. */
23
+ function reduce(set, patch) {
24
+ const next = new Set(set);
25
+ for (const v of patch.removed) next.delete(v);
26
+ for (const v of patch.added) next.add(v);
27
+ return next;
28
+ }
29
+ /**
30
+ * `values` sorted by `order` (the Items' values in document order); values not in `order` keep
31
+ * their iteration order, after the others.
32
+ */
33
+ function sortByOrder(values, order) {
34
+ const wanted = new Set(values);
35
+ const sorted = [];
36
+ for (const v of order) if (wanted.delete(v)) sorted.push(v);
37
+ for (const v of wanted) sorted.push(v);
38
+ return sorted;
39
+ }
40
+ function summarize(registry) {
41
+ const items = /* @__PURE__ */ new Map();
42
+ for (const { value, disabled } of registry.values()) items.set(value, (items.get(value) ?? false) || !disabled);
43
+ return items;
44
+ }
45
+ function disabledOf(items) {
46
+ if (items === null) return EMPTY;
47
+ const disabled = /* @__PURE__ */ new Set();
48
+ for (const [value, enabled] of items) if (!enabled) disabled.add(value);
49
+ return disabled.size === 0 ? EMPTY : disabled;
50
+ }
51
+ function mapsEqual(a, b) {
52
+ if (a.size !== b.size) return false;
53
+ for (const [k, v] of a) if (b.get(k) !== v) return false;
54
+ return true;
55
+ }
56
+ function arraysEqual(a, b) {
57
+ return a.length === b.length && a.every((v, i) => v === b[i]);
58
+ }
59
+ /** The group's Items: checkboxes of this `name` in the fieldset (Parents have none). */
60
+ function readItems(fieldset, name) {
61
+ if (fieldset === null) return [];
62
+ return [...fieldset.querySelectorAll("input[type=\"checkbox\"]")].filter((box) => box.name === name);
63
+ }
64
+ /**
65
+ * `<fieldset>` that owns the group's state (a set of values), the transition, the shared `name`,
66
+ * the form-reset listener, the mount reconciliation and the group-level `required`
67
+ * (design/components/checkbox-group.md 14.3). Carries `data-pending` while `valueChangeAction`
68
+ * is in flight. Its implicit role is `group`; no `role` is written.
69
+ *
70
+ * Owned keys (conventions 1.2): `disabled`, `form`, `data-pending`, `data-disabled`.
71
+ *
72
+ * Unlike RadioGroup, Items may hydrate after their Root (a Suspense boundary between them): a
73
+ * click before an Item hydrated is reconciled when it does.
74
+ */
75
+ function CheckboxGroupRoot({ value, defaultValue, valueChangeAction, name: nameProp, form, required = false, disabled = false, className, style, children, render, ...rest }) {
76
+ const fallbackName = useId();
77
+ const name = nameProp ?? fallbackName;
78
+ const fieldsetRef = useRef(null);
79
+ const warnedElement = useRef(false);
80
+ const warnedDuplicate = useRef(false);
81
+ /** Parent reports waiting for the next mount read (design 8.1). */
82
+ const parentReports = useRef([]);
83
+ const itemRegistry = useRef(/* @__PURE__ */ new Map());
84
+ const [items, setItems] = useState(null);
85
+ const registerItem = useCallback((value, disabled) => {
86
+ const publish = () => {
87
+ const next = summarize(itemRegistry.current);
88
+ setItems((prev) => prev !== null && mapsEqual(prev, next) ? prev : next);
89
+ };
90
+ const token = {};
91
+ itemRegistry.current.set(token, {
92
+ value,
93
+ disabled
94
+ });
95
+ publish();
96
+ return () => {
97
+ itemRegistry.current.delete(token);
98
+ publish();
99
+ };
100
+ }, []);
101
+ const disabledItems = useMemo(() => disabledOf(items), [items]);
102
+ const controlledSet = useMemo(() => value === void 0 ? void 0 : toSet(value), [value]);
103
+ const defaultSet = useMemo(() => defaultValue === void 0 ? void 0 : toSet(defaultValue), [defaultValue]);
104
+ /** Sorts by the Items' current document order. Reads the DOM: handlers and effects only. */
105
+ const sortByDocument = (values) => sortByOrder(values, readItems(fieldsetRef.current, name).map((item) => item.value));
106
+ const { optimistic, committed, pending, dispatch, latestInFlight } = useControllableAction({
107
+ controlled: controlledSet,
108
+ defaultValue: defaultSet,
109
+ initialValue: EMPTY,
110
+ action: valueChangeAction && ((next, details) => valueChangeAction(sortByDocument(next), details)),
111
+ transitionTypes: (_next, _prev, details) => [
112
+ ...transitionTypes("checkbox-group"),
113
+ ...details.added.length > 0 ? ["fsui-checkbox-group-check"] : [],
114
+ ...details.removed.length > 0 ? ["fsui-checkbox-group-uncheck"] : []
115
+ ],
116
+ reducer: (prev, _next, details) => reduce(prev, details),
117
+ warn: {
118
+ component: "CheckboxGroup.Root",
119
+ prop: "value"
120
+ }
121
+ });
122
+ /** What the user intends: the latest in-flight dispatch, else optimistic (conventions 3.8 rule 1). */
123
+ const base = () => {
124
+ const inFlight = latestInFlight();
125
+ return inFlight === null ? optimistic : inFlight.next;
126
+ };
127
+ /** Dispatches `patch` on top of `from`, with the details of design 3.1. */
128
+ const dispatchPatch = (from, patch, reason, event) => {
129
+ const details = createActionDetails(event, {
130
+ reason,
131
+ added: sortByDocument(patch.added),
132
+ removed: sortByDocument(patch.removed)
133
+ });
134
+ dispatch(reduce(from, details), details);
135
+ };
136
+ /**
137
+ * The group as the DOM shows it (`checked`) or as a form reset leaves it (`defaultChecked`),
138
+ * laid over `base()` so that values with no Item are kept (they have no DOM to read).
139
+ */
140
+ const readDom = (prop) => new Map(readItems(fieldsetRef.current, name).map((item) => [item.value, item[prop]]));
141
+ const readGroup = (prop, from, dom = readDom(prop)) => {
142
+ const next = new Set(from);
143
+ for (const [v, isChecked] of dom) if (isChecked) next.add(v);
144
+ else next.delete(v);
145
+ return next;
146
+ };
147
+ /**
148
+ * The Root's own mount reconciliation ran: later member mounts are "late" (8.3). Set after the
149
+ * adapter's mount effect; reset by the cleanup (StrictMode included).
150
+ */
151
+ const rootMounted = useRef(false);
152
+ /**
153
+ * Late mounts: the members' `checked` read in the first late member's mount layout effect. The
154
+ * adapter reads the group in a microtask, but the Items' registration re-renders the group
155
+ * right after the layout effects, and that re-render re-applies each Item's `checked`, erasing a
156
+ * click made before the Item hydrated. Every member of the commit is in the DOM by then.
157
+ */
158
+ const lateSnapshot = useRef(null);
159
+ const { onItemMounted: onMemberMounted } = useNativeGroupReconciliation({
160
+ element: fieldsetRef,
161
+ readCurrent: () => {
162
+ const next = readGroup("checked", base(), lateSnapshot.current ?? void 0);
163
+ lateSnapshot.current = null;
164
+ const disabledNow = disabledOf(summarize(itemRegistry.current));
165
+ for (const report of parentReports.current) for (const v of enabledValues(report.values, disabledNow)) if (report.checked) next.add(v);
166
+ else next.delete(v);
167
+ parentReports.current = [];
168
+ return next;
169
+ },
170
+ readDefault: () => readGroup("defaultChecked", value === void 0 ? defaultSet ?? EMPTY : base()),
171
+ base,
172
+ equals: setsEqual,
173
+ onPlatformChange: (next, event) => {
174
+ const from = base();
175
+ const added = [...next].filter((v) => !from.has(v));
176
+ const removed = [...from].filter((v) => !next.has(v));
177
+ dispatchPatch(from, {
178
+ added,
179
+ removed
180
+ }, "platform", event);
181
+ }
182
+ });
183
+ useLayoutEffect(() => {
184
+ rootMounted.current = true;
185
+ return () => {
186
+ rootMounted.current = false;
187
+ };
188
+ }, []);
189
+ const onItemMounted = (el) => {
190
+ const late = rootMounted.current;
191
+ if (late && lateSnapshot.current === null) lateSnapshot.current = readDom("checked");
192
+ onMemberMounted(el);
193
+ if (late) queueMicrotask(() => {
194
+ lateSnapshot.current = null;
195
+ });
196
+ };
197
+ const [itemOrder, setItemOrder] = useState([]);
198
+ const renderedValue = sortByOrder(optimistic, itemOrder);
199
+ const syncItemOrder = useEffectEvent(() => {
200
+ const order = readItems(fieldsetRef.current, name).map((item) => item.value);
201
+ if (!arraysEqual(sortByOrder(optimistic, order), renderedValue)) setItemOrder(order);
202
+ if (!isDev || warnedDuplicate.current) return;
203
+ const duplicate = order.find((v, i) => order.indexOf(v) !== i);
204
+ if (duplicate !== void 0) {
205
+ warnedDuplicate.current = true;
206
+ console.error(`CheckboxGroup.Item: two Items share the value "${duplicate}" in one CheckboxGroup.Root. Item values must be unique; both boxes follow the same value.`);
207
+ }
208
+ });
209
+ useLayoutEffect(() => {
210
+ syncItemOrder();
211
+ });
212
+ const libraryRef = useCallback((el) => {
213
+ fieldsetRef.current = el;
214
+ if (isDev && !warnedElement.current && el.tagName !== "FIELDSET") {
215
+ warnedElement.current = true;
216
+ console.error(`CheckboxGroup.Root: expected to render a <fieldset> element but got <${el.tagName.toLowerCase()}>. The platform semantics (legend naming, disabled inheritance, form reset) need a real <fieldset>.`);
217
+ }
218
+ return () => {
219
+ fieldsetRef.current = null;
220
+ };
221
+ }, []);
222
+ const context = {
223
+ name,
224
+ form,
225
+ required: required && (items === null ? optimistic.size === 0 : ![...optimistic].some((v) => items.get(v) === true)),
226
+ disabledItems,
227
+ registerItem,
228
+ optimistic,
229
+ committed,
230
+ pending,
231
+ disabled,
232
+ defaultValue: value === void 0 ? defaultSet ?? EMPTY : void 0,
233
+ onItemMounted,
234
+ reportParent: (values, checked) => {
235
+ parentReports.current.push({
236
+ values,
237
+ checked
238
+ });
239
+ },
240
+ value: renderedValue,
241
+ sortByDocument,
242
+ toggle: (item, checked, event) => {
243
+ if (optimistic.has(item) === checked) return;
244
+ dispatchPatch(optimistic, checked ? {
245
+ added: [item],
246
+ removed: []
247
+ } : {
248
+ added: [],
249
+ removed: [item]
250
+ }, "activate", event);
251
+ },
252
+ apply: (patch, event) => {
253
+ const added = patch.added.filter((v) => !optimistic.has(v));
254
+ const removed = patch.removed.filter((v) => optimistic.has(v));
255
+ if (added.length === 0 && removed.length === 0) return;
256
+ dispatchPatch(optimistic, {
257
+ added,
258
+ removed
259
+ }, "activate", event);
260
+ }
261
+ };
262
+ const element = useRender({
263
+ defaultElement: "fieldset",
264
+ render,
265
+ state: {
266
+ value: renderedValue,
267
+ pending,
268
+ disabled
269
+ },
270
+ className,
271
+ style,
272
+ children,
273
+ props: rest,
274
+ libraryProps: {
275
+ disabled,
276
+ form,
277
+ "data-pending": dataAttr(pending),
278
+ "data-disabled": dataAttr(disabled)
279
+ },
280
+ ref: libraryRef
281
+ });
282
+ return /* @__PURE__ */ jsx(CheckboxGroupContext, {
283
+ value: context,
284
+ children: element
285
+ });
286
+ }
287
+ CheckboxGroupRoot.displayName = "CheckboxGroupRoot";
288
+ //#endregion
289
+ export { CheckboxGroupRoot };
290
+
291
+ //# sourceMappingURL=checkbox-group-root.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-group-root.mjs","names":[],"sources":["../../src/checkbox-group/checkbox-group-root.tsx"],"sourcesContent":["\"use client\";\nimport {\n useCallback,\n useEffectEvent,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} 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 { CheckboxGroupContext, enabledValues } from \"./checkbox-group-context.js\";\nimport type { CheckboxGroupContextValue, CheckboxGroupPatch } from \"./checkbox-group-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** Details passed as the second argument of `valueChangeAction`. */\nexport interface CheckboxGroupValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user toggled an Item or a Parent (click, Space, label click; `event` is the\n * native `click`). `\"platform\"`: the browser changed the checked boxes itself: a form reset\n * (`event` is the `reset` event), or clicks before hydration / Firefox form-state restoration\n * found at mount (`event` is `undefined`).\n */\n readonly reason: ChangeReason;\n /** Values this dispatch checked, in document order of their Items (values with no Item last). */\n readonly added: readonly string[];\n /** Values this dispatch unchecked, same order. */\n readonly removed: readonly string[];\n}\n\nexport interface CheckboxGroupRootState {\n /**\n * Optimistic checked values, in document order of the Items as of the Root's last render\n * (values with no Item last). Items reordered by a component that re-renders without the Root\n * keep the previous order here until the Root renders again; `next` and `details` of\n * `valueChangeAction` always read the current DOM order. The server render and the first client\n * render use the value's own order. Content rendered from it must not suspend.\n */\n readonly value: readonly string[];\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 CheckboxGroupRootProps 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 values. `[]` checks nothing; `undefined` means uncontrolled. Order is not\n * significant and duplicates are ignored: the value is a set.\n *\n * A form reset returns each box to the `checked` it had when *that box* mounted (React sets\n * `defaultChecked` once, from the initial `checked`). The reset is offered to\n * `valueChangeAction` as a `\"platform\"` change; for a stable target use `defaultValue`.\n */\n value?: string[];\n /**\n * Initial values in uncontrolled mode. Defaults to `[]`. Also the values a form reset returns\n * to: the latest prop value is mirrored into the boxes' `defaultChecked`.\n */\n defaultValue?: string[];\n /**\n * Runs inside the Root's transition whenever the set of checked values changes. May be sync\n * or async (also a Server Function); rejections reach the nearest Error Boundary and roll the\n * change back.\n *\n * `next` is the whole set as a fresh array in document order of the Items; treat it as a set.\n * `details.added` / `details.removed` say what changed. When controlled and updating after\n * your own `await`, prefer a functional update keyed by `added` / `removed` over\n * `setValue(next)`: two overlapping actions completing out of order would otherwise land the\n * older whole set last. A `setState` placed after your own `await` is not a Transition update;\n * wrap it in `startTransition` (React limitation). `details.event.preventDefault()` is not a\n * veto; use controlled mode to veto a change.\n */\n valueChangeAction?: ChangeAction<string[], CheckboxGroupValueChangeDetails>;\n /**\n * The `name` shared by every Item (form data key: `formData.getAll(name)`). Defaults to a\n * `useId()` value; pass a real name when the group is inside a `<form>` you submit.\n */\n name?: string;\n /** The `form` attribute, applied to the fieldset and to every Item. */\n form?: string;\n /**\n * \"At least one Item must be checked.\" Rendered as native `required` on every Item while no\n * enabled Item is checked, and on none once one is: values with no Item and checked disabled\n * Items (neither is submitted) do not satisfy it. Until the Items have mounted (server HTML,\n * before hydration) any checked value satisfies it. Not exposed on the fieldset (ARIA does not\n * allow `aria-required` on role `group`): say it in the `Label` or through `aria-describedby`.\n */\n required?: boolean;\n /** Renders `<fieldset disabled>`: every Item and Parent is disabled and unfocusable. */\n disabled?: boolean;\n className?: StateValue<string | undefined, CheckboxGroupRootState>;\n style?: StateValue<CSSProperties | undefined, CheckboxGroupRootState>;\n children?: StateValue<ReactNode, CheckboxGroupRootState>;\n /** Replace the rendered element. Must keep a `<fieldset>`. */\n render?: RenderProp<ComponentPropsWithRef<\"fieldset\">, CheckboxGroupRootState>;\n}\n\ntype ValueSet = ReadonlySet<string>;\n\nconst EMPTY: ValueSet = new Set();\n\nfunction toSet(value: readonly string[]): ValueSet {\n return new Set(value);\n}\n\nfunction setsEqual(a: ValueSet, b: ValueSet): boolean {\n if (a.size !== b.size) return false;\n for (const v of a) if (!b.has(v)) return false;\n return true;\n}\n\n/** The optimistic reducer (design 5.2): apply a patch, so stacked dispatches re-base. */\nfunction reduce(set: ValueSet, patch: CheckboxGroupPatch): ValueSet {\n const next = new Set(set);\n for (const v of patch.removed) next.delete(v);\n for (const v of patch.added) next.add(v);\n return next;\n}\n\n/**\n * `values` sorted by `order` (the Items' values in document order); values not in `order` keep\n * their iteration order, after the others.\n */\nfunction sortByOrder(values: Iterable<string>, order: readonly string[]): string[] {\n const wanted = new Set(values);\n const sorted: string[] = [];\n for (const v of order) if (wanted.delete(v)) sorted.push(v);\n for (const v of wanted) sorted.push(v);\n return sorted;\n}\n\n/** Value → \"has an Item without its own `disabled`\", over the registered Items. */\ntype ItemRegistry = Map<object, { readonly value: string; readonly disabled: boolean }>;\n\nfunction summarize(registry: ItemRegistry): Map<string, boolean> {\n const items = new Map<string, boolean>();\n for (const { value, disabled } of registry.values()) {\n items.set(value, (items.get(value) ?? false) || !disabled);\n }\n return items;\n}\n\nfunction disabledOf(items: ReadonlyMap<string, boolean> | null): ValueSet {\n if (items === null) return EMPTY;\n const disabled = new Set<string>();\n for (const [value, enabled] of items) if (!enabled) disabled.add(value);\n return disabled.size === 0 ? EMPTY : disabled;\n}\n\nfunction mapsEqual(a: ReadonlyMap<string, boolean>, b: ReadonlyMap<string, boolean>): boolean {\n if (a.size !== b.size) return false;\n for (const [k, v] of a) if (b.get(k) !== v) return false;\n return true;\n}\n\nfunction arraysEqual(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((v, i) => v === b[i]);\n}\n\n/** The group's Items: checkboxes of this `name` in the fieldset (Parents have none). */\nfunction readItems(fieldset: HTMLFieldSetElement | null, name: string): HTMLInputElement[] {\n if (fieldset === null) return [];\n return [...fieldset.querySelectorAll<HTMLInputElement>('input[type=\"checkbox\"]')].filter(\n (box) => box.name === name,\n );\n}\n\n/**\n * `<fieldset>` that owns the group's state (a set of values), the transition, the shared `name`,\n * the form-reset listener, the mount reconciliation and the group-level `required`\n * (design/components/checkbox-group.md 14.3). Carries `data-pending` while `valueChangeAction`\n * is in flight. Its implicit role is `group`; no `role` is written.\n *\n * Owned keys (conventions 1.2): `disabled`, `form`, `data-pending`, `data-disabled`.\n *\n * Unlike RadioGroup, Items may hydrate after their Root (a Suspense boundary between them): a\n * click before an Item hydrated is reconciled when it does.\n */\nexport function CheckboxGroupRoot({\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}: CheckboxGroupRootProps) {\n const fallbackName = useId();\n const name = nameProp ?? fallbackName;\n const fieldsetRef = useRef<HTMLFieldSetElement | null>(null);\n const warnedElement = useRef(false);\n const warnedDuplicate = useRef(false);\n /** Parent reports waiting for the next mount read (design 8.1). */\n const parentReports = useRef<{ values: readonly string[]; checked: boolean }[]>([]);\n\n // Item registration (design 6.2, 7): each Item reports its value and own `disabled` from a\n // layout effect. The ref is current for the residual-path reads; the state, set only when the\n // summary changes, is what render uses. `null` until an Item registered, so the server render\n // and the hydration render (which cannot know) agree.\n const itemRegistry = useRef<ItemRegistry>(new Map());\n const [items, setItems] = useState<ReadonlyMap<string, boolean> | null>(null);\n const registerItem = useCallback((value: string, disabled: boolean) => {\n const publish = () => {\n const next = summarize(itemRegistry.current);\n setItems((prev) => (prev !== null && mapsEqual(prev, next) ? prev : next));\n };\n const token = {};\n itemRegistry.current.set(token, { value, disabled });\n publish();\n return () => {\n itemRegistry.current.delete(token);\n publish();\n };\n }, []);\n const disabledItems = useMemo(() => disabledOf(items), [items]);\n\n const controlledSet = useMemo(() => (value === undefined ? undefined : toSet(value)), [value]);\n const defaultSet = useMemo(\n () => (defaultValue === undefined ? undefined : toSet(defaultValue)),\n [defaultValue],\n );\n\n /** Sorts by the Items' current document order. Reads the DOM: handlers and effects only. */\n const sortByDocument = (values: Iterable<string>): string[] =>\n sortByOrder(\n values,\n readItems(fieldsetRef.current, name).map((item) => item.value),\n );\n\n const { optimistic, committed, pending, dispatch, latestInFlight } = useControllableAction<\n ValueSet,\n CheckboxGroupValueChangeDetails\n >({\n controlled: controlledSet,\n defaultValue: defaultSet,\n initialValue: EMPTY,\n action:\n valueChangeAction && ((next, details) => valueChangeAction(sortByDocument(next), details)),\n transitionTypes: (_next, _prev, details) => [\n ...transitionTypes(\"checkbox-group\"),\n ...(details.added.length > 0 ? [\"fsui-checkbox-group-check\"] : []),\n ...(details.removed.length > 0 ? [\"fsui-checkbox-group-uncheck\"] : []),\n ],\n reducer: (prev, _next, details) => reduce(prev, details),\n warn: { component: \"CheckboxGroup.Root\", prop: \"value\" },\n });\n // Deliberately no warning when neither `value` nor `defaultValue` is given: an empty group is\n // the HTML default (design 3.1).\n\n /** What the user intends: the latest in-flight dispatch, else optimistic (conventions 3.8 rule 1). */\n const base = (): ValueSet => {\n const inFlight = latestInFlight();\n return inFlight === null ? optimistic : inFlight.next;\n };\n\n /** Dispatches `patch` on top of `from`, with the details of design 3.1. */\n const dispatchPatch = (\n from: ValueSet,\n patch: CheckboxGroupPatch,\n reason: ChangeReason,\n event: Event | undefined,\n ): void => {\n const details = createActionDetails(event, {\n reason,\n added: sortByDocument(patch.added),\n removed: sortByDocument(patch.removed),\n });\n dispatch(reduce(from, details), details);\n };\n\n /**\n * The group as the DOM shows it (`checked`) or as a form reset leaves it (`defaultChecked`),\n * laid over `base()` so that values with no Item are kept (they have no DOM to read).\n */\n const readDom = (prop: \"checked\" | \"defaultChecked\"): Map<string, boolean> =>\n new Map(readItems(fieldsetRef.current, name).map((item) => [item.value, item[prop]]));\n const readGroup = (\n prop: \"checked\" | \"defaultChecked\",\n from: ValueSet,\n dom: ReadonlyMap<string, boolean> = readDom(prop),\n ): Set<string> => {\n const next = new Set(from);\n for (const [v, isChecked] of dom) {\n if (isChecked) next.add(v);\n else next.delete(v);\n }\n return next;\n };\n\n /**\n * The Root's own mount reconciliation ran: later member mounts are \"late\" (8.3). Set after the\n * adapter's mount effect; reset by the cleanup (StrictMode included).\n */\n const rootMounted = useRef(false);\n /**\n * Late mounts: the members' `checked` read in the first late member's mount layout effect. The\n * adapter reads the group in a microtask, but the Items' registration re-renders the group\n * right after the layout effects, and that re-render re-applies each Item's `checked`, erasing a\n * click made before the Item hydrated. Every member of the commit is in the DOM by then.\n */\n const lateSnapshot = useRef<Map<string, boolean> | null>(null);\n\n // The residual browser paths (design section 8): one dispatch per group, from here. Items and\n // Parents that mount after the Root report through `onItemMounted`.\n const { onItemMounted: onMemberMounted } = useNativeGroupReconciliation<ValueSet>({\n element: fieldsetRef,\n readCurrent: () => {\n const next = readGroup(\"checked\", base(), lateSnapshot.current ?? undefined);\n lateSnapshot.current = null;\n // A Parent clicked before hydration means what its click means: check / uncheck all of its\n // values whose Items are enabled (8.1, 6.2). Read from the registry ref: the Items of this\n // commit registered before this runs, and render has not caught up yet.\n const disabledNow = disabledOf(summarize(itemRegistry.current));\n for (const report of parentReports.current) {\n for (const v of enabledValues(report.values, disabledNow)) {\n if (report.checked) next.add(v);\n else next.delete(v);\n }\n }\n parentReports.current = [];\n return next;\n },\n // Uncontrolled: start from `defaultValue`, so values with no Item return to it too (they have\n // no `defaultChecked` to read). Controlled: from `base()`, as for the mount read; the parent\n // decides.\n readDefault: () =>\n readGroup(\"defaultChecked\", value === undefined ? (defaultSet ?? EMPTY) : base()),\n base,\n equals: setsEqual,\n onPlatformChange: (next, event) => {\n const from = base();\n const added = [...next].filter((v) => !from.has(v));\n const removed = [...from].filter((v) => !next.has(v));\n dispatchPatch(from, { added, removed }, \"platform\", event);\n },\n });\n\n useLayoutEffect(() => {\n rootMounted.current = true;\n return () => {\n rootMounted.current = false;\n };\n }, []);\n const onItemMounted = (el: HTMLInputElement | null) => {\n const late = rootMounted.current;\n if (late && lateSnapshot.current === null) lateSnapshot.current = readDom(\"checked\");\n onMemberMounted(el);\n // A snapshot the adapter did not consume (it queues one read per commit, before this).\n if (late) {\n queueMicrotask(() => {\n lateSnapshot.current = null;\n });\n }\n };\n\n // The state's `value` is in document order. Render cannot read the DOM, so the Items' order is\n // kept in state, refreshed after a commit only when the rendered `value` would change (a value\n // given out of document order, Items reordered or added). The first render, and the server,\n // use the value's own order.\n const [itemOrder, setItemOrder] = useState<readonly string[]>([]);\n const renderedValue = sortByOrder(optimistic, itemOrder);\n // After every commit of the Root (a deps-less layout effect runs only when the Root itself\n // committed: Items moved by a child that re-renders alone are picked up at the Root's next\n // render). The comparison ends the chain: the re-render it causes renders exactly the value\n // just compared against.\n const syncItemOrder = useEffectEvent(() => {\n const order = readItems(fieldsetRef.current, name).map((item) => item.value);\n if (!arraysEqual(sortByOrder(optimistic, order), renderedValue)) setItemOrder(order);\n\n // Dev only: Item values must be unique within the Root (design 14.6).\n if (!isDev || warnedDuplicate.current) return;\n const duplicate = order.find((v, i) => order.indexOf(v) !== i);\n if (duplicate !== undefined) {\n warnedDuplicate.current = true;\n console.error(\n `CheckboxGroup.Item: two Items share the value \"${duplicate}\" in one ` +\n `CheckboxGroup.Root. Item values must be unique; both boxes follow the same value.`,\n );\n }\n });\n useLayoutEffect(() => {\n syncItemOrder();\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 `CheckboxGroup.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: CheckboxGroupContextValue = {\n name,\n form,\n required:\n required &&\n (items === null\n ? optimistic.size === 0\n : ![...optimistic].some((v) => items.get(v) === true)),\n disabledItems,\n registerItem,\n optimistic,\n committed,\n pending,\n disabled,\n defaultValue: value === undefined ? (defaultSet ?? EMPTY) : undefined,\n onItemMounted,\n reportParent: (values, checked) => {\n parentReports.current.push({ values, checked });\n },\n value: renderedValue,\n sortByDocument,\n toggle: (item, checked, event) => {\n // No-op rule against the optimistic set (conventions 2.3 item 8).\n if (optimistic.has(item) === checked) return;\n const patch = checked ? { added: [item], removed: [] } : { added: [], removed: [item] };\n dispatchPatch(optimistic, patch, \"activate\", event);\n },\n apply: (patch, event) => {\n const added = patch.added.filter((v) => !optimistic.has(v));\n const removed = patch.removed.filter((v) => optimistic.has(v));\n if (added.length === 0 && removed.length === 0) return;\n dispatchPatch(optimistic, { added, removed }, \"activate\", event);\n },\n };\n\n const state: CheckboxGroupRootState = {\n value: renderedValue,\n pending,\n disabled,\n };\n\n const element = useRender<ComponentPropsWithRef<\"fieldset\">, CheckboxGroupRootState>({\n defaultElement: \"fieldset\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n disabled,\n form,\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n },\n ref: libraryRef,\n });\n\n return <CheckboxGroupContext value={context}>{element}</CheckboxGroupContext>;\n}\n\nCheckboxGroupRoot.displayName = \"CheckboxGroupRoot\";\n"],"mappings":";;;;;;;;;;;AA2BA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAiGvC,MAAM,wBAAkB,IAAI,IAAI;AAEhC,SAAS,MAAM,OAAoC;CACjD,OAAO,IAAI,IAAI,KAAK;AACtB;AAEA,SAAS,UAAU,GAAa,GAAsB;CACpD,IAAI,EAAE,SAAS,EAAE,MAAM,OAAO;CAC9B,KAAK,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,OAAO;CACzC,OAAO;AACT;;AAGA,SAAS,OAAO,KAAe,OAAqC;CAClE,MAAM,OAAO,IAAI,IAAI,GAAG;CACxB,KAAK,MAAM,KAAK,MAAM,SAAS,KAAK,OAAO,CAAC;CAC5C,KAAK,MAAM,KAAK,MAAM,OAAO,KAAK,IAAI,CAAC;CACvC,OAAO;AACT;;;;;AAMA,SAAS,YAAY,QAA0B,OAAoC;CACjF,MAAM,SAAS,IAAI,IAAI,MAAM;CAC7B,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,KAAK,OAAO,IAAI,OAAO,OAAO,CAAC,GAAG,OAAO,KAAK,CAAC;CAC1D,KAAK,MAAM,KAAK,QAAQ,OAAO,KAAK,CAAC;CACrC,OAAO;AACT;AAKA,SAAS,UAAU,UAA8C;CAC/D,MAAM,wBAAQ,IAAI,IAAqB;CACvC,KAAK,MAAM,EAAE,OAAO,cAAc,SAAS,OAAO,GAChD,MAAM,IAAI,QAAQ,MAAM,IAAI,KAAK,KAAK,UAAU,CAAC,QAAQ;CAE3D,OAAO;AACT;AAEA,SAAS,WAAW,OAAsD;CACxE,IAAI,UAAU,MAAM,OAAO;CAC3B,MAAM,2BAAW,IAAI,IAAY;CACjC,KAAK,MAAM,CAAC,OAAO,YAAY,OAAO,IAAI,CAAC,SAAS,SAAS,IAA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D;EACA,OAAO;EACP;EACA,SAAS,MAAM,SAAS,UAAU;GAEhC,IAAI,WAAW,IAAI,IAAI,MAAM,SAAS;GAEtC,cAAc,YADA,UAAU;IAAE,OAAO,CAAC,IAAI;IAAG,SAAS,CAAC;GAAE,IAAI;IAAE,OAAO,CAAC;IAAG,SAAS,CAAC,IAAI;GAAE,GACrD,YAAY,KAAK;EACpD;EACA,QAAQ,OAAO,UAAU;GACvB,MAAM,QAAQ,MAAM,MAAM,QAAQ,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;GAC1D,MAAM,UAAU,MAAM,QAAQ,QAAQ,MAAM,WAAW,IAAI,CAAC,CAAC;GAC7D,IAAI,MAAM,WAAW,KAAK,QAAQ,WAAW,GAAG;GAChD,cAAc,YAAY;IAAE;IAAO;GAAQ,GAAG,YAAY,KAAK;EACjE;CACF;CAQA,MAAM,UAAU,UAAqE;EACnF,gBAAgB;EAChB;EACA,OAAA;GARA,OAAO;GACP;GACA;EAMI;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ;GACA;GACA,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;EACpC;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,sBAAD;EAAsB,OAAO;EAAU,UAAA;CAA8B,CAAA;AAC9E;AAEA,kBAAkB,cAAc"}
@@ -0,0 +1,23 @@
1
+ import "../internal/platform-attributes.mjs";
2
+ import { CheckboxGroupItem, CheckboxGroupItemProps, CheckboxGroupItemState } from "./checkbox-group-item.mjs";
3
+ import { CheckboxGroupRoot, CheckboxGroupRootProps, CheckboxGroupRootState, CheckboxGroupValueChangeDetails } from "./checkbox-group-root.mjs";
4
+ import { CheckboxGroupLabel, CheckboxGroupLabelProps } from "./checkbox-group-label.mjs";
5
+ import { CheckboxGroupParent, CheckboxGroupParentProps, CheckboxGroupParentState } from "./checkbox-group-parent.mjs";
6
+ //#region src/checkbox-group/index.d.ts
7
+ /**
8
+ * CheckboxGroup (WAI-ARIA APG Checkbox pattern, native HTML variant): `Root` (`fieldset`, role
9
+ * `group`), an optional `Label` (`legend`, first child), one `Item` (`input[type=checkbox]`) per
10
+ * value, and optional `Parent` boxes (the mixed-state "select all" over a subset of values). The
11
+ * value is a set of strings; the keyboard is entirely native. Each box's DOM `checked` is
12
+ * optimistic; the Root and the boxes whose state is changing carry `data-pending` while
13
+ * `valueChangeAction` is in flight.
14
+ */
15
+ export declare const CheckboxGroup: {
16
+ readonly Root: typeof CheckboxGroupRoot;
17
+ readonly Label: typeof CheckboxGroupLabel;
18
+ readonly Item: typeof CheckboxGroupItem;
19
+ readonly Parent: typeof CheckboxGroupParent;
20
+ };
21
+ //#endregion
22
+ export type { CheckboxGroupItemProps, CheckboxGroupItemState, CheckboxGroupLabelProps, CheckboxGroupParentProps, CheckboxGroupParentState, CheckboxGroupRootProps, CheckboxGroupRootState, CheckboxGroupValueChangeDetails };
23
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/checkbox-group/index.ts"],"mappings":";;;;;;;;;;;;;;qBAgBa;WACX,aAAI;WACJ,cAAK;WACL,aAAI;WACJ,eAAM"}
@@ -0,0 +1,23 @@
1
+ import { CheckboxGroupItem } from "./checkbox-group-item.mjs";
2
+ import { CheckboxGroupLabel } from "./checkbox-group-label.mjs";
3
+ import { CheckboxGroupParent } from "./checkbox-group-parent.mjs";
4
+ import { CheckboxGroupRoot } from "./checkbox-group-root.mjs";
5
+ //#region src/checkbox-group/index.ts
6
+ /**
7
+ * CheckboxGroup (WAI-ARIA APG Checkbox pattern, native HTML variant): `Root` (`fieldset`, role
8
+ * `group`), an optional `Label` (`legend`, first child), one `Item` (`input[type=checkbox]`) per
9
+ * value, and optional `Parent` boxes (the mixed-state "select all" over a subset of values). The
10
+ * value is a set of strings; the keyboard is entirely native. Each box's DOM `checked` is
11
+ * optimistic; the Root and the boxes whose state is changing carry `data-pending` while
12
+ * `valueChangeAction` is in flight.
13
+ */
14
+ const CheckboxGroup = {
15
+ Root: CheckboxGroupRoot,
16
+ Label: CheckboxGroupLabel,
17
+ Item: CheckboxGroupItem,
18
+ Parent: CheckboxGroupParent
19
+ };
20
+ //#endregion
21
+ export { CheckboxGroup };
22
+
23
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/checkbox-group/index.ts"],"sourcesContent":["// Ships the platform attribute typings with this subpath (conventions 7.4). Type-only: the\n// built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { CheckboxGroupItem } from \"./checkbox-group-item.js\";\nimport { CheckboxGroupLabel } from \"./checkbox-group-label.js\";\nimport { CheckboxGroupParent } from \"./checkbox-group-parent.js\";\nimport { CheckboxGroupRoot } from \"./checkbox-group-root.js\";\n\n/**\n * CheckboxGroup (WAI-ARIA APG Checkbox pattern, native HTML variant): `Root` (`fieldset`, role\n * `group`), an optional `Label` (`legend`, first child), one `Item` (`input[type=checkbox]`) per\n * value, and optional `Parent` boxes (the mixed-state \"select all\" over a subset of values). The\n * value is a set of strings; the keyboard is entirely native. Each box's DOM `checked` is\n * optimistic; the Root and the boxes whose state is changing carry `data-pending` while\n * `valueChangeAction` is in flight.\n */\nexport const CheckboxGroup = {\n Root: CheckboxGroupRoot,\n Label: CheckboxGroupLabel,\n Item: CheckboxGroupItem,\n Parent: CheckboxGroupParent,\n} as const;\n\nexport type {\n CheckboxGroupRootProps,\n CheckboxGroupRootState,\n CheckboxGroupValueChangeDetails,\n} from \"./checkbox-group-root.js\";\nexport type { CheckboxGroupLabelProps } from \"./checkbox-group-label.js\";\nexport type { CheckboxGroupItemProps, CheckboxGroupItemState } from \"./checkbox-group-item.js\";\nexport type {\n CheckboxGroupParentProps,\n CheckboxGroupParentState,\n} from \"./checkbox-group-parent.js\";\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAa,gBAAgB;CAC3B,MAAM;CACN,OAAO;CACP,MAAM;CACN,QAAQ;AACV"}
@@ -0,0 +1,44 @@
1
+ import { Action, ActionDetails, RenderProp, StateValue } from "../internal/types.mjs";
2
+ import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
+ //#region src/dialog/dialog-close.d.ts
4
+ export interface DialogCloseState {
5
+ /** The `action` is in flight. */
6
+ readonly pending: boolean;
7
+ readonly disabled: boolean;
8
+ }
9
+ /** Details passed to `Dialog.Close`'s `action`. */
10
+ export interface DialogCloseDetails extends ActionDetails {
11
+ /** The `value` the dialog closes with (`dialog.returnValue`); `""` without `value`. */
12
+ readonly returnValue: string;
13
+ }
14
+ export interface DialogCloseProps extends Omit<ComponentPropsWithRef<"button">, "onClick" | "value" | "className" | "style" | "children"> {
15
+ /**
16
+ * Runs inside this part's own transition, then closes the dialog with `close(value)`. A
17
+ * rejection reaches the nearest Error Boundary above the Close part and leaves the dialog open.
18
+ * Without `action` the button is a native `command="request-close"` invoker (JS-free).
19
+ */
20
+ action?: Action<[details: DialogCloseDetails]>;
21
+ /** Becomes `dialog.returnValue` (and `details.returnValue` of the close notification). */
22
+ value?: string;
23
+ disabled?: boolean;
24
+ className?: StateValue<string | undefined, DialogCloseState>;
25
+ style?: StateValue<CSSProperties | undefined, DialogCloseState>;
26
+ children?: StateValue<ReactNode, DialogCloseState>;
27
+ render?: RenderProp<ComponentPropsWithRef<"button">, DialogCloseState>;
28
+ }
29
+ /**
30
+ * A close button: `<button type="button" commandfor command="request-close">`. Without `action`
31
+ * the browser closes the dialog (a close request: `cancel`, then `close`), with `value` as the
32
+ * `returnValue`. With `action` the click is cancelled, the action runs in this part's own
33
+ * transition (`data-pending` on the button) and the dialog closes with `close(value)` once it
34
+ * resolves; a rejection leaves the dialog open.
35
+ *
36
+ * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,
37
+ * `command`, `value`, `onClick` (with `action`), `data-pending`, `data-disabled`.
38
+ */
39
+ export declare function DialogClose({ action, value, disabled, className, style, children, render, ...rest }: DialogCloseProps): ReactNode;
40
+ export declare namespace DialogClose {
41
+ var displayName: string;
42
+ }
43
+ //#endregion
44
+ //# sourceMappingURL=dialog-close.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog-close.d.mts","names":[],"sources":["../../src/dialog/dialog-close.tsx"],"mappings":";;;iBAWiB;;WAEN;WACA;;;iBAIM,2BAA2B;;WAEjC;;iBAGM,yBAAyB,KACxC;;;;;;EAQA,SAAS,QAAQ,SAAS;;EAE1B;EACA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;wBAevC,cACd,QACA,OACA,UACA,WACA,OACA,UACA,WACG,QACF,mBAAgB;yBATH"}