@funstack/ui 0.1.0-alpha.14 → 0.1.0-alpha.16

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 (584) hide show
  1. package/README.md +22 -1
  2. package/dist/accordion/accordion-item.d.mts +19 -0
  3. package/dist/accordion/accordion-item.d.mts.map +1 -1
  4. package/dist/accordion/accordion-item.mjs +2 -0
  5. package/dist/accordion/accordion-item.mjs.map +1 -1
  6. package/dist/accordion/accordion-panel.d.mts +16 -0
  7. package/dist/accordion/accordion-panel.d.mts.map +1 -1
  8. package/dist/accordion/accordion-panel.mjs +2 -0
  9. package/dist/accordion/accordion-panel.mjs.map +1 -1
  10. package/dist/accordion/accordion-root.d.mts +36 -2
  11. package/dist/accordion/accordion-root.d.mts.map +1 -1
  12. package/dist/accordion/accordion-root.mjs +7 -4
  13. package/dist/accordion/accordion-root.mjs.map +1 -1
  14. package/dist/accordion/accordion-trigger.d.mts +9 -0
  15. package/dist/accordion/accordion-trigger.d.mts.map +1 -1
  16. package/dist/accordion/accordion-trigger.mjs +2 -0
  17. package/dist/accordion/accordion-trigger.mjs.map +1 -1
  18. package/dist/accordion/index.d.mts +2 -0
  19. package/dist/accordion/index.d.mts.map +1 -1
  20. package/dist/accordion/index.mjs +2 -0
  21. package/dist/accordion/index.mjs.map +1 -1
  22. package/dist/bin/skill-installer.d.mts +1 -0
  23. package/dist/bin/skill-installer.mjs +12 -0
  24. package/dist/bin/skill-installer.mjs.map +1 -0
  25. package/dist/button/button.d.mts +25 -7
  26. package/dist/button/button.d.mts.map +1 -1
  27. package/dist/button/button.mjs +2 -0
  28. package/dist/button/button.mjs.map +1 -1
  29. package/dist/checkbox/checkbox.d.mts +25 -3
  30. package/dist/checkbox/checkbox.d.mts.map +1 -1
  31. package/dist/checkbox/checkbox.mjs +2 -0
  32. package/dist/checkbox/checkbox.mjs.map +1 -1
  33. package/dist/checkbox-group/checkbox-group-item.d.mts +15 -0
  34. package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
  35. package/dist/checkbox-group/checkbox-group-item.mjs +2 -0
  36. package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
  37. package/dist/checkbox-group/checkbox-group-label.d.mts +10 -0
  38. package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
  39. package/dist/checkbox-group/checkbox-group-label.mjs +2 -0
  40. package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
  41. package/dist/checkbox-group/checkbox-group-parent.d.mts +19 -1
  42. package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
  43. package/dist/checkbox-group/checkbox-group-parent.mjs +2 -0
  44. package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
  45. package/dist/checkbox-group/checkbox-group-root.d.mts +31 -4
  46. package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
  47. package/dist/checkbox-group/checkbox-group-root.mjs +6 -5
  48. package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
  49. package/dist/checkbox-group/index.d.mts +2 -0
  50. package/dist/checkbox-group/index.d.mts.map +1 -1
  51. package/dist/checkbox-group/index.mjs +2 -0
  52. package/dist/checkbox-group/index.mjs.map +1 -1
  53. package/dist/combobox/combobox-clear.d.mts +18 -0
  54. package/dist/combobox/combobox-clear.d.mts.map +1 -1
  55. package/dist/combobox/combobox-clear.mjs +2 -0
  56. package/dist/combobox/combobox-clear.mjs.map +1 -1
  57. package/dist/combobox/combobox-context.mjs.map +1 -1
  58. package/dist/combobox/combobox-group.d.mts +49 -1
  59. package/dist/combobox/combobox-group.d.mts.map +1 -1
  60. package/dist/combobox/combobox-group.mjs +11 -1
  61. package/dist/combobox/combobox-group.mjs.map +1 -1
  62. package/dist/combobox/combobox-input.d.mts +18 -6
  63. package/dist/combobox/combobox-input.d.mts.map +1 -1
  64. package/dist/combobox/combobox-input.mjs +8 -5
  65. package/dist/combobox/combobox-input.mjs.map +1 -1
  66. package/dist/combobox/combobox-label.d.mts +18 -1
  67. package/dist/combobox/combobox-label.d.mts.map +1 -1
  68. package/dist/combobox/combobox-label.mjs +4 -1
  69. package/dist/combobox/combobox-label.mjs.map +1 -1
  70. package/dist/combobox/combobox-list.d.mts +14 -0
  71. package/dist/combobox/combobox-list.d.mts.map +1 -1
  72. package/dist/combobox/combobox-list.mjs +2 -0
  73. package/dist/combobox/combobox-list.mjs.map +1 -1
  74. package/dist/combobox/combobox-option.d.mts +25 -3
  75. package/dist/combobox/combobox-option.d.mts.map +1 -1
  76. package/dist/combobox/combobox-option.mjs +2 -0
  77. package/dist/combobox/combobox-option.mjs.map +1 -1
  78. package/dist/combobox/combobox-popup.d.mts +17 -1
  79. package/dist/combobox/combobox-popup.d.mts.map +1 -1
  80. package/dist/combobox/combobox-popup.mjs +5 -15
  81. package/dist/combobox/combobox-popup.mjs.map +1 -1
  82. package/dist/combobox/combobox-root.d.mts +49 -12
  83. package/dist/combobox/combobox-root.d.mts.map +1 -1
  84. package/dist/combobox/combobox-root.mjs +11 -80
  85. package/dist/combobox/combobox-root.mjs.map +1 -1
  86. package/dist/combobox/combobox-trigger.d.mts +26 -8
  87. package/dist/combobox/combobox-trigger.d.mts.map +1 -1
  88. package/dist/combobox/combobox-trigger.mjs +23 -17
  89. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  90. package/dist/combobox/index.d.mts +4 -2
  91. package/dist/combobox/index.d.mts.map +1 -1
  92. package/dist/combobox/index.mjs +4 -2
  93. package/dist/combobox/index.mjs.map +1 -1
  94. package/dist/combobox/use-deferred-leave.mjs +105 -0
  95. package/dist/combobox/use-deferred-leave.mjs.map +1 -0
  96. package/dist/csp/csp-provider.d.mts +8 -0
  97. package/dist/csp/csp-provider.d.mts.map +1 -1
  98. package/dist/csp/csp-provider.mjs +2 -0
  99. package/dist/csp/csp-provider.mjs.map +1 -1
  100. package/dist/csp/style-hashes.d.mts +2 -0
  101. package/dist/csp/style-hashes.d.mts.map +1 -1
  102. package/dist/csp/style-hashes.mjs +2 -0
  103. package/dist/csp/style-hashes.mjs.map +1 -1
  104. package/dist/dialog/dialog-close.d.mts +18 -0
  105. package/dist/dialog/dialog-close.d.mts.map +1 -1
  106. package/dist/dialog/dialog-close.mjs +2 -0
  107. package/dist/dialog/dialog-close.mjs.map +1 -1
  108. package/dist/dialog/dialog-context.mjs.map +1 -1
  109. package/dist/dialog/dialog-description.d.mts +12 -0
  110. package/dist/dialog/dialog-description.d.mts.map +1 -1
  111. package/dist/dialog/dialog-description.mjs +2 -0
  112. package/dist/dialog/dialog-description.mjs.map +1 -1
  113. package/dist/dialog/dialog-form.d.mts +18 -1
  114. package/dist/dialog/dialog-form.d.mts.map +1 -1
  115. package/dist/dialog/dialog-form.mjs +2 -0
  116. package/dist/dialog/dialog-form.mjs.map +1 -1
  117. package/dist/dialog/dialog-popup.d.mts +25 -4
  118. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  119. package/dist/dialog/dialog-popup.mjs +4 -2
  120. package/dist/dialog/dialog-popup.mjs.map +1 -1
  121. package/dist/dialog/dialog-root.d.mts +15 -1
  122. package/dist/dialog/dialog-root.d.mts.map +1 -1
  123. package/dist/dialog/dialog-root.mjs +2 -0
  124. package/dist/dialog/dialog-root.mjs.map +1 -1
  125. package/dist/dialog/dialog-title.d.mts +11 -0
  126. package/dist/dialog/dialog-title.d.mts.map +1 -1
  127. package/dist/dialog/dialog-title.mjs +2 -0
  128. package/dist/dialog/dialog-title.mjs.map +1 -1
  129. package/dist/dialog/dialog-trigger.d.mts +16 -0
  130. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  131. package/dist/dialog/dialog-trigger.mjs +2 -0
  132. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  133. package/dist/dialog/index.d.mts +2 -0
  134. package/dist/dialog/index.d.mts.map +1 -1
  135. package/dist/dialog/index.mjs +2 -0
  136. package/dist/dialog/index.mjs.map +1 -1
  137. package/dist/docs/components/accordion.md +426 -0
  138. package/dist/docs/components/button.md +464 -0
  139. package/dist/docs/components/checkbox-group.md +474 -0
  140. package/dist/docs/components/checkbox.md +373 -0
  141. package/dist/docs/components/combobox.md +635 -0
  142. package/dist/docs/components/context-menu.md +524 -0
  143. package/dist/docs/components/dialog.md +686 -0
  144. package/dist/docs/components/field.md +587 -0
  145. package/dist/docs/components/menu.md +589 -0
  146. package/dist/docs/components/meter.md +313 -0
  147. package/dist/docs/components/number-field.md +528 -0
  148. package/dist/docs/components/popover.md +591 -0
  149. package/dist/docs/components/progress.md +450 -0
  150. package/dist/docs/components/radio-group.md +457 -0
  151. package/dist/docs/components/select.md +662 -0
  152. package/dist/docs/components/slider.md +558 -0
  153. package/dist/docs/components/switch.md +311 -0
  154. package/dist/docs/components/tabs.md +473 -0
  155. package/dist/docs/components/toast.md +576 -0
  156. package/dist/docs/components/toggle-group.md +341 -0
  157. package/dist/docs/components/toggle.md +245 -0
  158. package/dist/docs/components/toolbar.md +389 -0
  159. package/dist/docs/components/tooltip.md +494 -0
  160. package/dist/docs/concepts/action-props.md +251 -0
  161. package/dist/docs/concepts/ai-agents.md +56 -0
  162. package/dist/docs/concepts/browser-owned-state.md +118 -0
  163. package/dist/docs/concepts/content-security-policy.md +69 -0
  164. package/dist/docs/concepts/experimental.md +36 -0
  165. package/dist/docs/concepts/pending-and-optimistic.md +250 -0
  166. package/dist/docs/concepts/server-components.md +118 -0
  167. package/dist/docs/concepts/suspense.md +124 -0
  168. package/dist/docs/concepts/transitions.md +118 -0
  169. package/dist/docs/getting-started.md +115 -0
  170. package/dist/docs/index.md +181 -0
  171. package/dist/docs/roadmap.md +74 -0
  172. package/dist/docs/why.md +100 -0
  173. package/dist/field/field-control.d.mts +26 -3
  174. package/dist/field/field-control.d.mts.map +1 -1
  175. package/dist/field/field-control.mjs +2 -0
  176. package/dist/field/field-control.mjs.map +1 -1
  177. package/dist/field/field-description.d.mts +11 -0
  178. package/dist/field/field-description.d.mts.map +1 -1
  179. package/dist/field/field-description.mjs +2 -0
  180. package/dist/field/field-description.mjs.map +1 -1
  181. package/dist/field/field-error.d.mts +14 -2
  182. package/dist/field/field-error.d.mts.map +1 -1
  183. package/dist/field/field-error.mjs +2 -0
  184. package/dist/field/field-error.mjs.map +1 -1
  185. package/dist/field/field-label.d.mts +10 -0
  186. package/dist/field/field-label.d.mts.map +1 -1
  187. package/dist/field/field-label.mjs +2 -0
  188. package/dist/field/field-label.mjs.map +1 -1
  189. package/dist/field/field-root.d.mts +21 -2
  190. package/dist/field/field-root.d.mts.map +1 -1
  191. package/dist/field/field-root.mjs +2 -0
  192. package/dist/field/field-root.mjs.map +1 -1
  193. package/dist/field/index.d.mts +9 -0
  194. package/dist/field/index.d.mts.map +1 -1
  195. package/dist/field/index.mjs +9 -0
  196. package/dist/field/index.mjs.map +1 -1
  197. package/dist/form/form-root.d.mts +17 -1
  198. package/dist/form/form-root.d.mts.map +1 -1
  199. package/dist/form/form-root.mjs +3 -1
  200. package/dist/form/form-root.mjs.map +1 -1
  201. package/dist/form/form-submit.d.mts +18 -0
  202. package/dist/form/form-submit.d.mts.map +1 -1
  203. package/dist/form/form-submit.mjs +2 -0
  204. package/dist/form/form-submit.mjs.map +1 -1
  205. package/dist/form/index.d.mts +7 -0
  206. package/dist/form/index.d.mts.map +1 -1
  207. package/dist/form/index.mjs +7 -0
  208. package/dist/form/index.mjs.map +1 -1
  209. package/dist/index.d.mts +2 -1
  210. package/dist/internal/announce.mjs +12 -7
  211. package/dist/internal/announce.mjs.map +1 -1
  212. package/dist/internal/focus-first-invalid.mjs +2 -11
  213. package/dist/internal/focus-first-invalid.mjs.map +1 -1
  214. package/dist/internal/focus-visible.mjs +26 -0
  215. package/dist/internal/focus-visible.mjs.map +1 -0
  216. package/dist/internal/{invoker-press.mjs → invokers.mjs} +22 -5
  217. package/dist/internal/invokers.mjs.map +1 -0
  218. package/dist/internal/platform-attributes.d.mts +1 -1
  219. package/dist/internal/pointer-capture.mjs +1 -1
  220. package/dist/internal/pointer-capture.mjs.map +1 -1
  221. package/dist/internal/trigger-ref.mjs +1 -1
  222. package/dist/internal/trigger-ref.mjs.map +1 -1
  223. package/dist/internal/types.d.mts +3 -0
  224. package/dist/internal/types.d.mts.map +1 -1
  225. package/dist/internal/use-interest-dismiss.mjs +84 -0
  226. package/dist/internal/use-interest-dismiss.mjs.map +1 -0
  227. package/dist/internal/use-overlay-root.mjs.map +1 -1
  228. package/dist/internal/use-popover-popup.mjs +43 -108
  229. package/dist/internal/use-popover-popup.mjs.map +1 -1
  230. package/dist/internal/use-popover-trigger.d.mts +1 -0
  231. package/dist/internal/use-popover-trigger.d.mts.map +1 -1
  232. package/dist/internal/use-popover-trigger.mjs +29 -10
  233. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  234. package/dist/internal/use-value-set.mjs +20 -0
  235. package/dist/internal/use-value-set.mjs.map +1 -0
  236. package/dist/internal/validity.d.mts +11 -0
  237. package/dist/internal/validity.d.mts.map +1 -1
  238. package/dist/internal/validity.mjs.map +1 -1
  239. package/dist/menu/index.d.mts +2 -0
  240. package/dist/menu/index.d.mts.map +1 -1
  241. package/dist/menu/index.mjs +2 -0
  242. package/dist/menu/index.mjs.map +1 -1
  243. package/dist/menu/menu-checkbox-item.d.mts +26 -2
  244. package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
  245. package/dist/menu/menu-checkbox-item.mjs +2 -0
  246. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  247. package/dist/menu/menu-context-trigger.d.mts +24 -2
  248. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  249. package/dist/menu/menu-context-trigger.mjs +2 -0
  250. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  251. package/dist/menu/menu-group.d.mts +36 -1
  252. package/dist/menu/menu-group.d.mts.map +1 -1
  253. package/dist/menu/menu-group.mjs +9 -1
  254. package/dist/menu/menu-group.mjs.map +1 -1
  255. package/dist/menu/menu-item.d.mts +23 -1
  256. package/dist/menu/menu-item.d.mts.map +1 -1
  257. package/dist/menu/menu-item.mjs +2 -0
  258. package/dist/menu/menu-item.mjs.map +1 -1
  259. package/dist/menu/menu-popup.d.mts +34 -9
  260. package/dist/menu/menu-popup.d.mts.map +1 -1
  261. package/dist/menu/menu-popup.mjs +15 -27
  262. package/dist/menu/menu-popup.mjs.map +1 -1
  263. package/dist/menu/menu-radio-group.d.mts +20 -1
  264. package/dist/menu/menu-radio-group.d.mts.map +1 -1
  265. package/dist/menu/menu-radio-group.mjs +2 -0
  266. package/dist/menu/menu-radio-group.mjs.map +1 -1
  267. package/dist/menu/menu-radio-item.d.mts +16 -0
  268. package/dist/menu/menu-radio-item.d.mts.map +1 -1
  269. package/dist/menu/menu-radio-item.mjs +2 -0
  270. package/dist/menu/menu-radio-item.mjs.map +1 -1
  271. package/dist/menu/menu-root.d.mts +22 -3
  272. package/dist/menu/menu-root.d.mts.map +1 -1
  273. package/dist/menu/menu-root.mjs +2 -0
  274. package/dist/menu/menu-root.mjs.map +1 -1
  275. package/dist/menu/menu-submenu-trigger.d.mts +21 -8
  276. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  277. package/dist/menu/menu-submenu-trigger.mjs +11 -10
  278. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  279. package/dist/menu/menu-trigger.d.mts +23 -7
  280. package/dist/menu/menu-trigger.d.mts.map +1 -1
  281. package/dist/menu/menu-trigger.mjs +8 -12
  282. package/dist/menu/menu-trigger.mjs.map +1 -1
  283. package/dist/meter/index.d.mts +2 -0
  284. package/dist/meter/index.d.mts.map +1 -1
  285. package/dist/meter/index.mjs +2 -0
  286. package/dist/meter/index.mjs.map +1 -1
  287. package/dist/meter/meter-indicator.d.mts +11 -0
  288. package/dist/meter/meter-indicator.d.mts.map +1 -1
  289. package/dist/meter/meter-indicator.mjs +2 -0
  290. package/dist/meter/meter-indicator.mjs.map +1 -1
  291. package/dist/meter/meter-label.d.mts +11 -0
  292. package/dist/meter/meter-label.d.mts.map +1 -1
  293. package/dist/meter/meter-label.mjs +2 -0
  294. package/dist/meter/meter-label.mjs.map +1 -1
  295. package/dist/meter/meter-region.d.mts +5 -0
  296. package/dist/meter/meter-region.d.mts.map +1 -1
  297. package/dist/meter/meter-region.mjs.map +1 -1
  298. package/dist/meter/meter-root.d.mts +52 -10
  299. package/dist/meter/meter-root.d.mts.map +1 -1
  300. package/dist/meter/meter-root.mjs +2 -0
  301. package/dist/meter/meter-root.mjs.map +1 -1
  302. package/dist/meter/meter-track.d.mts +11 -0
  303. package/dist/meter/meter-track.d.mts.map +1 -1
  304. package/dist/meter/meter-track.mjs +2 -0
  305. package/dist/meter/meter-track.mjs.map +1 -1
  306. package/dist/meter/meter-value.d.mts +15 -1
  307. package/dist/meter/meter-value.d.mts.map +1 -1
  308. package/dist/meter/meter-value.mjs +2 -0
  309. package/dist/meter/meter-value.mjs.map +1 -1
  310. package/dist/number-field/index.d.mts +2 -0
  311. package/dist/number-field/index.d.mts.map +1 -1
  312. package/dist/number-field/index.mjs +2 -0
  313. package/dist/number-field/index.mjs.map +1 -1
  314. package/dist/number-field/number-field-decrement.d.mts +2 -0
  315. package/dist/number-field/number-field-decrement.d.mts.map +1 -1
  316. package/dist/number-field/number-field-decrement.mjs +2 -0
  317. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  318. package/dist/number-field/number-field-increment.d.mts +2 -0
  319. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  320. package/dist/number-field/number-field-increment.mjs +2 -0
  321. package/dist/number-field/number-field-increment.mjs.map +1 -1
  322. package/dist/number-field/number-field-input.d.mts +9 -0
  323. package/dist/number-field/number-field-input.d.mts.map +1 -1
  324. package/dist/number-field/number-field-input.mjs +2 -0
  325. package/dist/number-field/number-field-input.mjs.map +1 -1
  326. package/dist/number-field/number-field-label.d.mts +10 -0
  327. package/dist/number-field/number-field-label.d.mts.map +1 -1
  328. package/dist/number-field/number-field-label.mjs +2 -0
  329. package/dist/number-field/number-field-label.mjs.map +1 -1
  330. package/dist/number-field/number-field-root.d.mts +62 -14
  331. package/dist/number-field/number-field-root.d.mts.map +1 -1
  332. package/dist/number-field/number-field-root.mjs +3 -1
  333. package/dist/number-field/number-field-root.mjs.map +1 -1
  334. package/dist/number-field/use-step-button.d.mts +20 -0
  335. package/dist/number-field/use-step-button.d.mts.map +1 -1
  336. package/dist/number-field/use-step-button.mjs.map +1 -1
  337. package/dist/popover/index.d.mts +2 -0
  338. package/dist/popover/index.d.mts.map +1 -1
  339. package/dist/popover/index.mjs +2 -0
  340. package/dist/popover/index.mjs.map +1 -1
  341. package/dist/popover/popover-close.d.mts +21 -3
  342. package/dist/popover/popover-close.d.mts.map +1 -1
  343. package/dist/popover/popover-close.mjs +3 -1
  344. package/dist/popover/popover-close.mjs.map +1 -1
  345. package/dist/popover/popover-description.d.mts +12 -0
  346. package/dist/popover/popover-description.d.mts.map +1 -1
  347. package/dist/popover/popover-description.mjs +2 -0
  348. package/dist/popover/popover-description.mjs.map +1 -1
  349. package/dist/popover/popover-popup.d.mts +30 -4
  350. package/dist/popover/popover-popup.d.mts.map +1 -1
  351. package/dist/popover/popover-popup.mjs +2 -0
  352. package/dist/popover/popover-popup.mjs.map +1 -1
  353. package/dist/popover/popover-root.d.mts +9 -0
  354. package/dist/popover/popover-root.d.mts.map +1 -1
  355. package/dist/popover/popover-root.mjs +2 -0
  356. package/dist/popover/popover-root.mjs.map +1 -1
  357. package/dist/popover/popover-title.d.mts +11 -0
  358. package/dist/popover/popover-title.d.mts.map +1 -1
  359. package/dist/popover/popover-title.mjs +2 -0
  360. package/dist/popover/popover-title.mjs.map +1 -1
  361. package/dist/popover/popover-trigger.d.mts +24 -9
  362. package/dist/popover/popover-trigger.d.mts.map +1 -1
  363. package/dist/popover/popover-trigger.mjs +11 -9
  364. package/dist/popover/popover-trigger.mjs.map +1 -1
  365. package/dist/progress/index.d.mts +2 -0
  366. package/dist/progress/index.d.mts.map +1 -1
  367. package/dist/progress/index.mjs +2 -0
  368. package/dist/progress/index.mjs.map +1 -1
  369. package/dist/progress/progress-indicator.d.mts +11 -0
  370. package/dist/progress/progress-indicator.d.mts.map +1 -1
  371. package/dist/progress/progress-indicator.mjs +2 -0
  372. package/dist/progress/progress-indicator.mjs.map +1 -1
  373. package/dist/progress/progress-label.d.mts +11 -0
  374. package/dist/progress/progress-label.d.mts.map +1 -1
  375. package/dist/progress/progress-label.mjs +2 -0
  376. package/dist/progress/progress-label.mjs.map +1 -1
  377. package/dist/progress/progress-root.d.mts +36 -8
  378. package/dist/progress/progress-root.d.mts.map +1 -1
  379. package/dist/progress/progress-root.mjs +2 -0
  380. package/dist/progress/progress-root.mjs.map +1 -1
  381. package/dist/progress/progress-track.d.mts +11 -0
  382. package/dist/progress/progress-track.d.mts.map +1 -1
  383. package/dist/progress/progress-track.mjs +2 -0
  384. package/dist/progress/progress-track.mjs.map +1 -1
  385. package/dist/progress/progress-value.d.mts +15 -1
  386. package/dist/progress/progress-value.d.mts.map +1 -1
  387. package/dist/progress/progress-value.mjs +2 -0
  388. package/dist/progress/progress-value.mjs.map +1 -1
  389. package/dist/radio-group/index.d.mts +2 -0
  390. package/dist/radio-group/index.d.mts.map +1 -1
  391. package/dist/radio-group/index.mjs +2 -0
  392. package/dist/radio-group/index.mjs.map +1 -1
  393. package/dist/radio-group/radio-group-item.d.mts +18 -1
  394. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  395. package/dist/radio-group/radio-group-item.mjs +2 -0
  396. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  397. package/dist/radio-group/radio-group-label.d.mts +10 -0
  398. package/dist/radio-group/radio-group-label.d.mts.map +1 -1
  399. package/dist/radio-group/radio-group-label.mjs +2 -0
  400. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  401. package/dist/radio-group/radio-group-root.d.mts +29 -5
  402. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  403. package/dist/radio-group/radio-group-root.mjs +2 -0
  404. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  405. package/dist/select/index.d.mts +2 -0
  406. package/dist/select/index.d.mts.map +1 -1
  407. package/dist/select/index.mjs +2 -0
  408. package/dist/select/index.mjs.map +1 -1
  409. package/dist/select/select-group-label.d.mts +10 -0
  410. package/dist/select/select-group-label.d.mts.map +1 -1
  411. package/dist/select/select-group-label.mjs +2 -0
  412. package/dist/select/select-group-label.mjs.map +1 -1
  413. package/dist/select/select-group.d.mts +15 -1
  414. package/dist/select/select-group.d.mts.map +1 -1
  415. package/dist/select/select-group.mjs +2 -0
  416. package/dist/select/select-group.mjs.map +1 -1
  417. package/dist/select/select-option.d.mts +19 -1
  418. package/dist/select/select-option.d.mts.map +1 -1
  419. package/dist/select/select-option.mjs +2 -0
  420. package/dist/select/select-option.mjs.map +1 -1
  421. package/dist/select/select-root.d.mts +24 -1
  422. package/dist/select/select-root.d.mts.map +1 -1
  423. package/dist/select/select-root.mjs +2 -0
  424. package/dist/select/select-root.mjs.map +1 -1
  425. package/dist/select/select-separator.d.mts +9 -0
  426. package/dist/select/select-separator.d.mts.map +1 -1
  427. package/dist/select/select-separator.mjs +2 -0
  428. package/dist/select/select-separator.mjs.map +1 -1
  429. package/dist/select/select-trigger.d.mts +9 -0
  430. package/dist/select/select-trigger.d.mts.map +1 -1
  431. package/dist/select/select-trigger.mjs +2 -0
  432. package/dist/select/select-trigger.mjs.map +1 -1
  433. package/dist/select/select-value.d.mts +9 -0
  434. package/dist/select/select-value.d.mts.map +1 -1
  435. package/dist/select/select-value.mjs +2 -0
  436. package/dist/select/select-value.mjs.map +1 -1
  437. package/dist/slider/index.d.mts +2 -0
  438. package/dist/slider/index.d.mts.map +1 -1
  439. package/dist/slider/index.mjs +2 -0
  440. package/dist/slider/index.mjs.map +1 -1
  441. package/dist/slider/slider-indicator.d.mts +12 -0
  442. package/dist/slider/slider-indicator.d.mts.map +1 -1
  443. package/dist/slider/slider-indicator.mjs +2 -0
  444. package/dist/slider/slider-indicator.mjs.map +1 -1
  445. package/dist/slider/slider-label.d.mts +11 -1
  446. package/dist/slider/slider-label.d.mts.map +1 -1
  447. package/dist/slider/slider-label.mjs +2 -0
  448. package/dist/slider/slider-label.mjs.map +1 -1
  449. package/dist/slider/slider-root.d.mts +53 -9
  450. package/dist/slider/slider-root.d.mts.map +1 -1
  451. package/dist/slider/slider-root.mjs +2 -0
  452. package/dist/slider/slider-root.mjs.map +1 -1
  453. package/dist/slider/slider-thumb.d.mts +32 -3
  454. package/dist/slider/slider-thumb.d.mts.map +1 -1
  455. package/dist/slider/slider-thumb.mjs +2 -0
  456. package/dist/slider/slider-thumb.mjs.map +1 -1
  457. package/dist/slider/slider-track.d.mts +17 -0
  458. package/dist/slider/slider-track.d.mts.map +1 -1
  459. package/dist/slider/slider-track.mjs +2 -0
  460. package/dist/slider/slider-track.mjs.map +1 -1
  461. package/dist/slider/slider-value.d.mts +11 -0
  462. package/dist/slider/slider-value.d.mts.map +1 -1
  463. package/dist/slider/slider-value.mjs +2 -0
  464. package/dist/slider/slider-value.mjs.map +1 -1
  465. package/dist/switch/switch.d.mts +23 -3
  466. package/dist/switch/switch.d.mts.map +1 -1
  467. package/dist/switch/switch.mjs +2 -0
  468. package/dist/switch/switch.mjs.map +1 -1
  469. package/dist/tabs/index.d.mts +2 -0
  470. package/dist/tabs/index.d.mts.map +1 -1
  471. package/dist/tabs/index.mjs +2 -0
  472. package/dist/tabs/index.mjs.map +1 -1
  473. package/dist/tabs/tabs-context.d.mts +5 -0
  474. package/dist/tabs/tabs-context.d.mts.map +1 -1
  475. package/dist/tabs/tabs-context.mjs.map +1 -1
  476. package/dist/tabs/tabs-indicator.d.mts +17 -0
  477. package/dist/tabs/tabs-indicator.d.mts.map +1 -1
  478. package/dist/tabs/tabs-indicator.mjs +2 -0
  479. package/dist/tabs/tabs-indicator.mjs.map +1 -1
  480. package/dist/tabs/tabs-list.d.mts +19 -1
  481. package/dist/tabs/tabs-list.d.mts.map +1 -1
  482. package/dist/tabs/tabs-list.mjs +2 -0
  483. package/dist/tabs/tabs-list.mjs.map +1 -1
  484. package/dist/tabs/tabs-panel.d.mts +19 -0
  485. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  486. package/dist/tabs/tabs-panel.mjs +2 -0
  487. package/dist/tabs/tabs-panel.mjs.map +1 -1
  488. package/dist/tabs/tabs-root.d.mts +39 -5
  489. package/dist/tabs/tabs-root.d.mts.map +1 -1
  490. package/dist/tabs/tabs-root.mjs +2 -0
  491. package/dist/tabs/tabs-root.mjs.map +1 -1
  492. package/dist/tabs/tabs-tab.d.mts +22 -1
  493. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  494. package/dist/tabs/tabs-tab.mjs +2 -0
  495. package/dist/tabs/tabs-tab.mjs.map +1 -1
  496. package/dist/toast/index.d.mts +2 -0
  497. package/dist/toast/index.d.mts.map +1 -1
  498. package/dist/toast/index.mjs +2 -0
  499. package/dist/toast/index.mjs.map +1 -1
  500. package/dist/toast/toast-action.d.mts +28 -3
  501. package/dist/toast/toast-action.d.mts.map +1 -1
  502. package/dist/toast/toast-action.mjs +2 -0
  503. package/dist/toast/toast-action.mjs.map +1 -1
  504. package/dist/toast/toast-close.d.mts +16 -0
  505. package/dist/toast/toast-close.d.mts.map +1 -1
  506. package/dist/toast/toast-close.mjs +2 -0
  507. package/dist/toast/toast-close.mjs.map +1 -1
  508. package/dist/toast/toast-description.d.mts +16 -1
  509. package/dist/toast/toast-description.d.mts.map +1 -1
  510. package/dist/toast/toast-description.mjs +2 -0
  511. package/dist/toast/toast-description.mjs.map +1 -1
  512. package/dist/toast/toast-root.d.mts +20 -0
  513. package/dist/toast/toast-root.d.mts.map +1 -1
  514. package/dist/toast/toast-root.mjs +2 -0
  515. package/dist/toast/toast-root.mjs.map +1 -1
  516. package/dist/toast/toast-title.d.mts +15 -1
  517. package/dist/toast/toast-title.d.mts.map +1 -1
  518. package/dist/toast/toast-title.mjs +2 -0
  519. package/dist/toast/toast-title.mjs.map +1 -1
  520. package/dist/toast/toast-viewport.d.mts +34 -5
  521. package/dist/toast/toast-viewport.d.mts.map +1 -1
  522. package/dist/toast/toast-viewport.mjs +6 -5
  523. package/dist/toast/toast-viewport.mjs.map +1 -1
  524. package/dist/toast/toast.d.mts +46 -6
  525. package/dist/toast/toast.d.mts.map +1 -1
  526. package/dist/toast/toast.mjs +4 -0
  527. package/dist/toast/toast.mjs.map +1 -1
  528. package/dist/toggle/toggle.d.mts +20 -2
  529. package/dist/toggle/toggle.d.mts.map +1 -1
  530. package/dist/toggle/toggle.mjs +2 -0
  531. package/dist/toggle/toggle.mjs.map +1 -1
  532. package/dist/toggle-group/index.d.mts +2 -0
  533. package/dist/toggle-group/index.d.mts.map +1 -1
  534. package/dist/toggle-group/index.mjs +2 -0
  535. package/dist/toggle-group/index.mjs.map +1 -1
  536. package/dist/toggle-group/toggle-group-context.d.mts +1 -0
  537. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  538. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  539. package/dist/toggle-group/toggle-group-item.d.mts +16 -0
  540. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  541. package/dist/toggle-group/toggle-group-item.mjs +2 -0
  542. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  543. package/dist/toggle-group/toggle-group-root.d.mts +73 -12
  544. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  545. package/dist/toggle-group/toggle-group-root.mjs +6 -5
  546. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  547. package/dist/toolbar/index.d.mts +2 -0
  548. package/dist/toolbar/index.d.mts.map +1 -1
  549. package/dist/toolbar/index.mjs +2 -0
  550. package/dist/toolbar/index.mjs.map +1 -1
  551. package/dist/toolbar/toolbar-root.d.mts +30 -3
  552. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  553. package/dist/toolbar/toolbar-root.mjs +2 -0
  554. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  555. package/dist/toolbar/toolbar-separator.d.mts +13 -0
  556. package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
  557. package/dist/toolbar/toolbar-separator.mjs +2 -0
  558. package/dist/toolbar/toolbar-separator.mjs.map +1 -1
  559. package/dist/tooltip/index.d.mts +2 -0
  560. package/dist/tooltip/index.d.mts.map +1 -1
  561. package/dist/tooltip/index.mjs +2 -0
  562. package/dist/tooltip/index.mjs.map +1 -1
  563. package/dist/tooltip/tooltip-arrow.d.mts +16 -0
  564. package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
  565. package/dist/tooltip/tooltip-arrow.mjs +2 -0
  566. package/dist/tooltip/tooltip-arrow.mjs.map +1 -1
  567. package/dist/tooltip/tooltip-context.d.mts +4 -0
  568. package/dist/tooltip/tooltip-context.d.mts.map +1 -1
  569. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  570. package/dist/tooltip/tooltip-popup.d.mts +24 -3
  571. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  572. package/dist/tooltip/tooltip-popup.mjs +2 -0
  573. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  574. package/dist/tooltip/tooltip-root.d.mts +24 -2
  575. package/dist/tooltip/tooltip-root.d.mts.map +1 -1
  576. package/dist/tooltip/tooltip-root.mjs +2 -0
  577. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  578. package/dist/tooltip/tooltip-trigger.d.mts +18 -1
  579. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  580. package/dist/tooltip/tooltip-trigger.mjs +2 -0
  581. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  582. package/package.json +9 -1
  583. package/skills/funstack-ui-knowledge/SKILL.md +75 -0
  584. package/dist/internal/invoker-press.mjs.map +0 -1
@@ -1,6 +1,10 @@
1
1
  import { RenderProp, StateValue } from "../internal/types.mjs";
2
2
  import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
3
  //#region src/dialog/dialog-trigger.d.ts
4
+ /**
5
+ * State of `Dialog.Trigger`, passed to the function forms of `className`, `style`, `children` and
6
+ * `render`.
7
+ */
4
8
  export interface DialogTriggerState {
5
9
  /** Optimistic open state (library mode); `false` in JS-free mode. */
6
10
  readonly open: boolean;
@@ -10,16 +14,26 @@ export interface DialogTriggerState {
10
14
  * flight, or a re-open requested while a close notification is still settling.
11
15
  */
12
16
  readonly pending: boolean;
17
+ /** The `disabled` prop. */
13
18
  readonly disabled: boolean;
14
19
  }
20
+ /**
21
+ * Props of `Dialog.Trigger`.
22
+ *
23
+ * @see https://ui.funstack.work/components/dialog
24
+ */
15
25
  export interface DialogTriggerProps extends Omit<ComponentPropsWithRef<"button">, "onClick" | "className" | "style" | "children"> {
16
26
  /**
17
27
  * Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); with a link or
18
28
  * component `render` where the Trigger handles the click (library mode, or a non-modal
19
29
  * dialog), `aria-disabled="true"` instead: the element stays focusable.
30
+ *
31
+ * @defaultValue `false`
20
32
  */
21
33
  disabled?: boolean;
34
+ /** Class name, or a function of the part's state that returns one. */
22
35
  className?: StateValue<string | undefined, DialogTriggerState>;
36
+ /** Inline style, or a function of the part's state that returns one. */
23
37
  style?: StateValue<CSSProperties | undefined, DialogTriggerState>;
24
38
  /** Rendered from optimistic state; must not suspend. */
25
39
  children?: StateValue<ReactNode, DialogTriggerState>;
@@ -37,6 +51,8 @@ export interface DialogTriggerProps extends Omit<ComponentPropsWithRef<"button">
37
51
  * link or component `render` with the click handler installed), `commandfor`, `command`,
38
52
  * `onClick`, `onPointerDown` (non-modal JS-free mode), `data-open`, `data-pending`,
39
53
  * `data-disabled`.
54
+ *
55
+ * @see https://ui.funstack.work/components/dialog
40
56
  */
41
57
  export declare function DialogTrigger({ disabled, className, style, children, render, ...rest }: DialogTriggerProps): ReactNode;
42
58
  export declare namespace DialogTrigger {
@@ -1 +1 @@
1
- {"version":3,"file":"dialog-trigger.d.mts","names":[],"sources":["../../src/dialog/dialog-trigger.tsx"],"mappings":";;;iBAWiB;;WAEN;;;;;;WAMA;WACA;;iBAGM,2BAA2B,KAC1C;;;;;;EAQA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;wBAiBvC,gBACd,UACA,WACA,OACA,UACA,WACG,QACF,qBAAkB;yBAPL"}
1
+ {"version":3,"file":"dialog-trigger.d.mts","names":[],"sources":["../../src/dialog/dialog-trigger.tsx"],"mappings":";;;;;;;iBAeiB;;WAEN;;;;;;WAMA;;WAEA;;;;;;;iBAQM,2BAA2B,KAC1C;;;;;;;;EAUA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;;;wBAmBvC,gBACd,UACA,WACA,OACA,UACA,WACG,QACF,qBAAkB;yBAPL"}
@@ -19,6 +19,8 @@ const isDev = process.env.NODE_ENV !== "production";
19
19
  * link or component `render` with the click handler installed), `commandfor`, `command`,
20
20
  * `onClick`, `onPointerDown` (non-modal JS-free mode), `data-open`, `data-pending`,
21
21
  * `data-disabled`.
22
+ *
23
+ * @see https://ui.funstack.work/components/dialog
22
24
  */
23
25
  function DialogTrigger({ disabled = false, className, style, children, render, ...rest }) {
24
26
  const ctx = useDialogContext("Dialog.Trigger");
@@ -1 +1 @@
1
- {"version":3,"file":"dialog-trigger.mjs","names":[],"sources":["../../src/dialog/dialog-trigger.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { registerTrigger } from \"../internal/trigger-ref.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { disabledButton, rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { useDialogContext } from \"./dialog-context.js\";\n\nexport interface DialogTriggerState {\n /** Optimistic open state (library mode); `false` in JS-free mode. */\n readonly open: boolean;\n /**\n * The Root's transition is pending: an open in flight, a close a part asked for in flight\n * (`openChangeAction(false)` awaited while the dialog is still open), a close notification in\n * flight, or a re-open requested while a close notification is still settling.\n */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface DialogTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); with a link or\n * component `render` where the Trigger handles the click (library mode, or a non-modal\n * dialog), `aria-disabled=\"true\"` instead: the element stays focusable.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, DialogTriggerState>;\n style?: StateValue<CSSProperties | undefined, DialogTriggerState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, DialogTriggerState>;\n /** Should render a `<button>`; another element works only in library mode (click handler). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, DialogTriggerState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * The opener: `<button type=\"button\" commandfor command=\"show-modal\">`. In JS-free mode the\n * browser runs the command. In library mode the click is cancelled (so the command does not run)\n * and dispatched through the Root's transition; the button shows optimistic `data-open` and\n * `data-pending` until the dialog has opened. Non-modal dialogs have no command and always use a\n * click handler (`show()`).\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled` (a\n * link or component `render` with the click handler installed), `commandfor`, `command`,\n * `onClick`, `onPointerDown` (non-modal JS-free mode), `data-open`, `data-pending`,\n * `data-disabled`.\n */\nexport function DialogTrigger({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: DialogTriggerProps) {\n const ctx = useDialogContext(\"Dialog.Trigger\");\n const isLibrary = ctx.mode === \"library\";\n const { modal, ids, triggerRef, popupRef } = ctx;\n\n const state: DialogTriggerState = {\n open: ctx.optimistic,\n // Every Root dispatch is an open, a part-initiated close or a dismissal notification, and\n // all of them belong to the Trigger (design 4.2). Not `optimistic !== committed`: a re-open\n // while a close notification is still settling has both `true` (the close never committed)\n // and is pending all the same.\n pending: ctx.pending,\n disabled,\n };\n\n const checkElement = useElementCheck(\n isDev &&\n ((element) =>\n !isLibrary && modal && element.tagName !== \"BUTTON\"\n ? `Dialog.Trigger: rendered a <${element.tagName.toLowerCase()}> in JS-free mode. Only a ` +\n '<button> runs `command=\"show-modal\"`; this trigger will not open the dialog. Render ' +\n \"a <button>, or put the Dialog in library mode (`defaultOpen={false}`).\"\n : null),\n );\n const libraryRef = useCallback(\n (element: HTMLElement) => {\n checkElement?.(element);\n return registerTrigger(triggerRef, element, \"Dialog.Trigger\");\n },\n [checkElement, triggerRef],\n );\n\n // A Trigger without a Popup opens nothing (design 14, dev warnings).\n useEffect(() => {\n if (!isDev) return;\n if (document.getElementById(ids.popup) === null) {\n console.error(\n \"Dialog.Trigger: no Dialog.Popup is rendered for this Dialog.Root; the trigger opens nothing.\",\n );\n }\n }, [ids.popup]);\n\n // Library mode (both modal and non-modal) and non-modal JS-free mode need a click handler;\n // modal JS-free mode is the browser's command.\n const installClick = isLibrary || !modal;\n // The modal JS-free command needs native `disabled` to stop it.\n const disabledProps = disabledButton(render, disabled, { handlesClick: installClick });\n // Only on a button (or a component, assumed to render one): another element is no invoker.\n const invoker = modal && disabledProps.invoker && rendersButton(render);\n // Non-modal JS-free mode: whether the dialog was open when the press began. A press on the\n // Trigger of an open `lightDismiss` dialog is a dismissal (the JS listeners or native\n // `closedby=\"any\"` close it before the click), so that click must not `show()` it again\n // (#116). Pointer clicks only (`detail > 0`): a keyboard click has no press, and a press that\n // never became a click must not swallow a later one.\n const pressedOpen = useRef(false);\n const installPress = !isLibrary && !modal;\n const onPointerDown = () => {\n pressedOpen.current = popupRef.current?.open ?? false;\n };\n const onClick = (event: MouseEvent<HTMLElement>) => {\n if (isLibrary) {\n // Cancelling the click cancels the command (it runs as the button's activation\n // behaviour, only if the click was not cancelled).\n event.preventDefault();\n if (disabled) return;\n ctx.requestOpen(event.nativeEvent, \"activate\");\n return;\n }\n if (disabled) {\n // A disabled link must not navigate either.\n event.preventDefault();\n return;\n }\n const wasOpen = event.detail > 0 && pressedOpen.current;\n pressedOpen.current = false;\n const dialog = popupRef.current;\n if (dialog !== null && !dialog.open && !wasOpen && dialog.isConnected) dialog.show();\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n // `type` only applies to a <button>; on any other element the key is not owned.\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Trigger (in JS-free mode the\n // browser would run its command).\n ...disabledProps.props,\n commandfor: invoker ? ids.popup : undefined,\n command: invoker ? \"show-modal\" : undefined,\n // Only owned when installed, so a render element keeps its own `onClick` in modal JS-free\n // mode (Accordion's rule).\n ...(installClick && { onClick }),\n ...(installPress && { onPointerDown }),\n \"data-open\": dataAttr(state.open),\n \"data-pending\": dataAttr(state.pending),\n // Every mode: the styling hook agrees with the rendered `disabled` / `aria-disabled`\n // (conventions 1.2).\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, DialogTriggerState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: libraryRef,\n });\n}\n\nDialogTrigger.displayName = \"DialogTrigger\";\n"],"mappings":";;;;;;;;;AAyCA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;AAcvC,SAAgB,cAAc,EAC5B,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACkB;CACrB,MAAM,MAAM,iBAAiB,gBAAgB;CAC7C,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,OAAO,KAAK,YAAY,aAAa;CAE7C,MAAM,QAA4B;EAChC,MAAM,IAAI;EAKV,SAAS,IAAI;EACb;CACF;CAEA,MAAM,eAAe,gBACnB,WACI,YACA,CAAC,aAAa,SAAS,QAAQ,YAAY,WACvC,+BAA+B,QAAQ,QAAQ,YAAY,EAAE,4LAG7D,KACV;CACA,MAAM,aAAa,aAChB,YAAyB;EACxB,eAAe,OAAO;EACtB,OAAO,gBAAgB,YAAY,SAAS,gBAAgB;CAC9D,GACA,CAAC,cAAc,UAAU,CAC3B;CAGA,gBAAgB;EACd,IAAI,CAAC,OAAO;EACZ,IAAI,SAAS,eAAe,IAAI,KAAK,MAAM,MACzC,QAAQ,MACN,8FACF;CAEJ,GAAG,CAAC,IAAI,KAAK,CAAC;CAId,MAAM,eAAe,aAAa,CAAC;CAEnC,MAAM,gBAAgB,eAAe,QAAQ,UAAU,EAAE,cAAc,aAAa,CAAC;CAErF,MAAM,UAAU,SAAS,cAAc,WAAW,cAAc,MAAM;CAMtE,MAAM,cAAc,OAAO,KAAK;CAChC,MAAM,eAAe,CAAC,aAAa,CAAC;CACpC,MAAM,sBAAsB;EAC1B,YAAY,UAAU,SAAS,SAAS,QAAQ;CAClD;CACA,MAAM,WAAW,UAAmC;EAClD,IAAI,WAAW;GAGb,MAAM,eAAe;GACrB,IAAI,UAAU;GACd,IAAI,YAAY,MAAM,aAAa,UAAU;GAC7C;EACF;EACA,IAAI,UAAU;GAEZ,MAAM,eAAe;GACrB;EACF;EACA,MAAM,UAAU,MAAM,SAAS,KAAK,YAAY;EAChD,YAAY,UAAU;EACtB,MAAM,SAAS,SAAS;EACxB,IAAI,WAAW,QAAQ,CAAC,OAAO,QAAQ,CAAC,WAAW,OAAO,aAAa,OAAO,KAAK;CACrF;CAEA,MAAM,eAAiE;EAErE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EAGvD,GAAG,cAAc;EACjB,YAAY,UAAU,IAAI,QAAQ,KAAA;EAClC,SAAS,UAAU,eAAe,KAAA;EAGlC,GAAI,gBAAgB,EAAE,QAAQ;EAC9B,GAAI,gBAAgB,EAAE,cAAc;EACpC,aAAa,SAAS,MAAM,IAAI;EAChC,gBAAgB,SAAS,MAAM,OAAO;EAGtC,iBAAiB,SAAS,QAAQ;CACpC;CAEA,OAAO,UAA+D;EACpE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;AACH;AAEA,cAAc,cAAc"}
1
+ {"version":3,"file":"dialog-trigger.mjs","names":[],"sources":["../../src/dialog/dialog-trigger.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { registerTrigger } from \"../internal/trigger-ref.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { disabledButton, rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { useDialogContext } from \"./dialog-context.js\";\n\n/**\n * State of `Dialog.Trigger`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface DialogTriggerState {\n /** Optimistic open state (library mode); `false` in JS-free mode. */\n readonly open: boolean;\n /**\n * The Root's transition is pending: an open in flight, a close a part asked for in flight\n * (`openChangeAction(false)` awaited while the dialog is still open), a close notification in\n * flight, or a re-open requested while a close notification is still settling.\n */\n readonly pending: boolean;\n /** The `disabled` prop. */\n readonly disabled: boolean;\n}\n\n/**\n * Props of `Dialog.Trigger`.\n *\n * @see https://ui.funstack.work/components/dialog\n */\nexport interface DialogTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); with a link or\n * component `render` where the Trigger handles the click (library mode, or a non-modal\n * dialog), `aria-disabled=\"true\"` instead: the element stays focusable.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, DialogTriggerState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, DialogTriggerState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, DialogTriggerState>;\n /** Should render a `<button>`; another element works only in library mode (click handler). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, DialogTriggerState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * The opener: `<button type=\"button\" commandfor command=\"show-modal\">`. In JS-free mode the\n * browser runs the command. In library mode the click is cancelled (so the command does not run)\n * and dispatched through the Root's transition; the button shows optimistic `data-open` and\n * `data-pending` until the dialog has opened. Non-modal dialogs have no command and always use a\n * click handler (`show()`).\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled` (a\n * link or component `render` with the click handler installed), `commandfor`, `command`,\n * `onClick`, `onPointerDown` (non-modal JS-free mode), `data-open`, `data-pending`,\n * `data-disabled`.\n *\n * @see https://ui.funstack.work/components/dialog\n */\nexport function DialogTrigger({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: DialogTriggerProps) {\n const ctx = useDialogContext(\"Dialog.Trigger\");\n const isLibrary = ctx.mode === \"library\";\n const { modal, ids, triggerRef, popupRef } = ctx;\n\n const state: DialogTriggerState = {\n open: ctx.optimistic,\n // Every Root dispatch is an open, a part-initiated close or a dismissal notification, and\n // all of them belong to the Trigger (design 4.2). Not `optimistic !== committed`: a re-open\n // while a close notification is still settling has both `true` (the close never committed)\n // and is pending all the same.\n pending: ctx.pending,\n disabled,\n };\n\n const checkElement = useElementCheck(\n isDev &&\n ((element) =>\n !isLibrary && modal && element.tagName !== \"BUTTON\"\n ? `Dialog.Trigger: rendered a <${element.tagName.toLowerCase()}> in JS-free mode. Only a ` +\n '<button> runs `command=\"show-modal\"`; this trigger will not open the dialog. Render ' +\n \"a <button>, or put the Dialog in library mode (`defaultOpen={false}`).\"\n : null),\n );\n const libraryRef = useCallback(\n (element: HTMLElement) => {\n checkElement?.(element);\n return registerTrigger(triggerRef, element, \"Dialog.Trigger\");\n },\n [checkElement, triggerRef],\n );\n\n // A Trigger without a Popup opens nothing (design 14, dev warnings).\n useEffect(() => {\n if (!isDev) return;\n if (document.getElementById(ids.popup) === null) {\n console.error(\n \"Dialog.Trigger: no Dialog.Popup is rendered for this Dialog.Root; the trigger opens nothing.\",\n );\n }\n }, [ids.popup]);\n\n // Library mode (both modal and non-modal) and non-modal JS-free mode need a click handler;\n // modal JS-free mode is the browser's command.\n const installClick = isLibrary || !modal;\n // The modal JS-free command needs native `disabled` to stop it.\n const disabledProps = disabledButton(render, disabled, { handlesClick: installClick });\n // Only on a button (or a component, assumed to render one): another element is no invoker.\n const invoker = modal && disabledProps.invoker && rendersButton(render);\n // Non-modal JS-free mode: whether the dialog was open when the press began. A press on the\n // Trigger of an open `lightDismiss` dialog is a dismissal (the JS listeners or native\n // `closedby=\"any\"` close it before the click), so that click must not `show()` it again.\n // Pointer clicks only (`detail > 0`): a keyboard click has no press, and a press that never\n // became a click must not swallow a later one.\n const pressedOpen = useRef(false);\n const installPress = !isLibrary && !modal;\n const onPointerDown = () => {\n pressedOpen.current = popupRef.current?.open ?? false;\n };\n const onClick = (event: MouseEvent<HTMLElement>) => {\n if (isLibrary) {\n // Cancelling the click cancels the command (it runs as the button's activation\n // behaviour, only if the click was not cancelled).\n event.preventDefault();\n if (disabled) return;\n ctx.requestOpen(event.nativeEvent, \"activate\");\n return;\n }\n if (disabled) {\n // A disabled link must not navigate either.\n event.preventDefault();\n return;\n }\n const wasOpen = event.detail > 0 && pressedOpen.current;\n pressedOpen.current = false;\n const dialog = popupRef.current;\n if (dialog !== null && !dialog.open && !wasOpen && dialog.isConnected) dialog.show();\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n // `type` only applies to a <button>; on any other element the key is not owned.\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Trigger (in JS-free mode the\n // browser would run its command).\n ...disabledProps.props,\n commandfor: invoker ? ids.popup : undefined,\n command: invoker ? \"show-modal\" : undefined,\n // Only owned when installed, so a render element keeps its own `onClick` in modal JS-free\n // mode (Accordion's rule).\n ...(installClick && { onClick }),\n ...(installPress && { onPointerDown }),\n \"data-open\": dataAttr(state.open),\n \"data-pending\": dataAttr(state.pending),\n // Every mode: the styling hook agrees with the rendered `disabled` / `aria-disabled`\n // (conventions 1.2).\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, DialogTriggerState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: libraryRef,\n });\n}\n\nDialogTrigger.displayName = \"DialogTrigger\";\n"],"mappings":";;;;;;;;;AAuDA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;;AAgBvC,SAAgB,cAAc,EAC5B,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACkB;CACrB,MAAM,MAAM,iBAAiB,gBAAgB;CAC7C,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,OAAO,KAAK,YAAY,aAAa;CAE7C,MAAM,QAA4B;EAChC,MAAM,IAAI;EAKV,SAAS,IAAI;EACb;CACF;CAEA,MAAM,eAAe,gBACnB,WACI,YACA,CAAC,aAAa,SAAS,QAAQ,YAAY,WACvC,+BAA+B,QAAQ,QAAQ,YAAY,EAAE,4LAG7D,KACV;CACA,MAAM,aAAa,aAChB,YAAyB;EACxB,eAAe,OAAO;EACtB,OAAO,gBAAgB,YAAY,SAAS,gBAAgB;CAC9D,GACA,CAAC,cAAc,UAAU,CAC3B;CAGA,gBAAgB;EACd,IAAI,CAAC,OAAO;EACZ,IAAI,SAAS,eAAe,IAAI,KAAK,MAAM,MACzC,QAAQ,MACN,8FACF;CAEJ,GAAG,CAAC,IAAI,KAAK,CAAC;CAId,MAAM,eAAe,aAAa,CAAC;CAEnC,MAAM,gBAAgB,eAAe,QAAQ,UAAU,EAAE,cAAc,aAAa,CAAC;CAErF,MAAM,UAAU,SAAS,cAAc,WAAW,cAAc,MAAM;CAMtE,MAAM,cAAc,OAAO,KAAK;CAChC,MAAM,eAAe,CAAC,aAAa,CAAC;CACpC,MAAM,sBAAsB;EAC1B,YAAY,UAAU,SAAS,SAAS,QAAQ;CAClD;CACA,MAAM,WAAW,UAAmC;EAClD,IAAI,WAAW;GAGb,MAAM,eAAe;GACrB,IAAI,UAAU;GACd,IAAI,YAAY,MAAM,aAAa,UAAU;GAC7C;EACF;EACA,IAAI,UAAU;GAEZ,MAAM,eAAe;GACrB;EACF;EACA,MAAM,UAAU,MAAM,SAAS,KAAK,YAAY;EAChD,YAAY,UAAU;EACtB,MAAM,SAAS,SAAS;EACxB,IAAI,WAAW,QAAQ,CAAC,OAAO,QAAQ,CAAC,WAAW,OAAO,aAAa,OAAO,KAAK;CACrF;CAEA,MAAM,eAAiE;EAErE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EAGvD,GAAG,cAAc;EACjB,YAAY,UAAU,IAAI,QAAQ,KAAA;EAClC,SAAS,UAAU,eAAe,KAAA;EAGlC,GAAI,gBAAgB,EAAE,QAAQ;EAC9B,GAAI,gBAAgB,EAAE,cAAc;EACpC,aAAa,SAAS,MAAM,IAAI;EAChC,gBAAgB,SAAS,MAAM,OAAO;EAGtC,iBAAiB,SAAS,QAAQ;CACpC;CAEA,OAAO,UAA+D;EACpE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;AACH;AAEA,cAAc,cAAc"}
@@ -15,6 +15,8 @@ import { DialogTrigger, DialogTriggerProps, DialogTriggerState } from "./dialog-
15
15
  * part asks for (Close, Form, a foreign close command: `openChangeAction(false)` awaited, then
16
16
  * `close(returnValue)`); dismissals (Escape, a click outside) are the browser's, notified
17
17
  * through `openChangeAction(false)`.
18
+ *
19
+ * @see https://ui.funstack.work/components/dialog
18
20
  */
19
21
  export declare const Dialog: {
20
22
  readonly Root: typeof DialogRoot;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/dialog/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;qBAoBa;WACX,aAAI;WACJ,gBAAO;WACP,cAAK;WACL,cAAK;WACL,aAAI;WACJ,cAAK;WACL,oBAAW"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/dialog/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;qBAsBa;WACX,aAAI;WACJ,gBAAO;WACP,cAAK;WACL,cAAK;WACL,aAAI;WACJ,cAAK;WACL,oBAAW"}
@@ -14,6 +14,8 @@ import { DialogTrigger } from "./dialog-trigger.mjs";
14
14
  * part asks for (Close, Form, a foreign close command: `openChangeAction(false)` awaited, then
15
15
  * `close(returnValue)`); dismissals (Escape, a click outside) are the browser's, notified
16
16
  * through `openChangeAction(false)`.
17
+ *
18
+ * @see https://ui.funstack.work/components/dialog
17
19
  */
18
20
  const Dialog = {
19
21
  Root: DialogRoot,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/dialog/index.ts"],"sourcesContent":["// Ships the platform attribute typings (`command`, `commandfor`) with this subpath\n// (conventions 7.4). Type-only: the built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { DialogClose } from \"./dialog-close.js\";\nimport { DialogDescription } from \"./dialog-description.js\";\nimport { DialogForm } from \"./dialog-form.js\";\nimport { DialogPopup } from \"./dialog-popup.js\";\nimport { DialogRoot } from \"./dialog-root.js\";\nimport { DialogTitle } from \"./dialog-title.js\";\nimport { DialogTrigger } from \"./dialog-trigger.js\";\n\n/**\n * Dialog built on `<dialog>` and Invoker Commands: `Root` (no DOM) > `Trigger`\n * (`button[command=show-modal]`) + `Popup` (`dialog`) > `Title`, `Description`, `Form`, `Close`.\n * JS-free when the Root has none of `open` / `defaultOpen` / `openChangeAction`; otherwise\n * opening is a transition (pending Trigger, content from committed state), and so is a close a\n * part asks for (Close, Form, a foreign close command: `openChangeAction(false)` awaited, then\n * `close(returnValue)`); dismissals (Escape, a click outside) are the browser's, notified\n * through `openChangeAction(false)`.\n */\nexport const Dialog = {\n Root: DialogRoot,\n Trigger: DialogTrigger,\n Popup: DialogPopup,\n Close: DialogClose,\n Form: DialogForm,\n Title: DialogTitle,\n Description: DialogDescription,\n} as const;\n\nexport type { DialogRootProps, DialogRootState, DialogOpenChangeDetails } from \"./dialog-root.js\";\nexport type { DialogTriggerProps, DialogTriggerState } from \"./dialog-trigger.js\";\nexport type { DialogPopupProps, DialogPopupState } from \"./dialog-popup.js\";\nexport type { DialogCloseProps, DialogCloseState, DialogCloseDetails } from \"./dialog-close.js\";\nexport type { DialogFormProps, DialogFormState } from \"./dialog-form.js\";\nexport type { DialogTitleProps, DialogTitleState } from \"./dialog-title.js\";\nexport type { DialogDescriptionProps, DialogDescriptionState } from \"./dialog-description.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,MAAa,SAAS;CACpB,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,MAAM;CACN,OAAO;CACP,aAAa;AACf"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/dialog/index.ts"],"sourcesContent":["// Ships the platform attribute typings (`command`, `commandfor`) with this subpath\n// (conventions 7.4). Type-only: the built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { DialogClose } from \"./dialog-close.js\";\nimport { DialogDescription } from \"./dialog-description.js\";\nimport { DialogForm } from \"./dialog-form.js\";\nimport { DialogPopup } from \"./dialog-popup.js\";\nimport { DialogRoot } from \"./dialog-root.js\";\nimport { DialogTitle } from \"./dialog-title.js\";\nimport { DialogTrigger } from \"./dialog-trigger.js\";\n\n/**\n * Dialog built on `<dialog>` and Invoker Commands: `Root` (no DOM) > `Trigger`\n * (`button[command=show-modal]`) + `Popup` (`dialog`) > `Title`, `Description`, `Form`, `Close`.\n * JS-free when the Root has none of `open` / `defaultOpen` / `openChangeAction`; otherwise\n * opening is a transition (pending Trigger, content from committed state), and so is a close a\n * part asks for (Close, Form, a foreign close command: `openChangeAction(false)` awaited, then\n * `close(returnValue)`); dismissals (Escape, a click outside) are the browser's, notified\n * through `openChangeAction(false)`.\n *\n * @see https://ui.funstack.work/components/dialog\n */\nexport const Dialog = {\n Root: DialogRoot,\n Trigger: DialogTrigger,\n Popup: DialogPopup,\n Close: DialogClose,\n Form: DialogForm,\n Title: DialogTitle,\n Description: DialogDescription,\n} as const;\n\nexport type { DialogRootProps, DialogRootState, DialogOpenChangeDetails } from \"./dialog-root.js\";\nexport type { DialogTriggerProps, DialogTriggerState } from \"./dialog-trigger.js\";\nexport type { DialogPopupProps, DialogPopupState } from \"./dialog-popup.js\";\nexport type { DialogCloseProps, DialogCloseState, DialogCloseDetails } from \"./dialog-close.js\";\nexport type { DialogFormProps, DialogFormState } from \"./dialog-form.js\";\nexport type { DialogTitleProps, DialogTitleState } from \"./dialog-title.js\";\nexport type { DialogDescriptionProps, DialogDescriptionState } from \"./dialog-description.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,MAAa,SAAS;CACpB,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,MAAM;CACN,OAAO;CACP,aAAa;AACf"}
@@ -0,0 +1,426 @@
1
+ # Accordion
2
+
3
+ Built on `<details>` and `<summary>`. Without value props its behaviour needs no JavaScript (the parts still ship as client modules; see [Server Components](../concepts/server-components.md)); with them it becomes a regular [state owner](../concepts/pending-and-optimistic.md#state-owner) with actions, optimistic `data-open` and Suspense-friendly panels.
4
+
5
+ ```tsx title="AccordionFaq.tsx"
6
+ // No "use client": this file is a Server Component. The Accordion has no value props, so it runs
7
+ // in JS-free mode: the browser owns <details open>, `exclusive` becomes the native `name` group,
8
+ // and opening an item works before hydration (and with JavaScript off).
9
+ import { Accordion } from "@funstack/ui/accordion";
10
+
11
+ const faq = [
12
+ {
13
+ id: "what",
14
+ question: "What is FUNSTACK UI?",
15
+ answer:
16
+ "A headless React component library built for Async React: transitions by default, action props, Suspense-native content.",
17
+ },
18
+ {
19
+ id: "js",
20
+ question: "Does this accordion need JavaScript?",
21
+ answer:
22
+ "No. It renders <details> and <summary>. Try your browser's find-in-page for the word zeppelin: the browser opens the matching item by itself.",
23
+ },
24
+ {
25
+ id: "zeppelin",
26
+ question: "Is anything hidden in here?",
27
+ answer: "Only a zeppelin, to show that closed items stay searchable.",
28
+ },
29
+ ];
30
+
31
+ export function AccordionFaq() {
32
+ return (
33
+ <Accordion.Root exclusive className="demo-accordion">
34
+ {faq.map((item, index) => (
35
+ <Accordion.Item
36
+ key={item.id}
37
+ value={item.id}
38
+ defaultOpen={index === 0}
39
+ className="demo-accordion-item"
40
+ >
41
+ <Accordion.Trigger className="demo-accordion-trigger">
42
+ <h4>{item.question}</h4>
43
+ </Accordion.Trigger>
44
+ <Accordion.Panel className="demo-accordion-panel">
45
+ <p>{item.answer}</p>
46
+ </Accordion.Panel>
47
+ </Accordion.Item>
48
+ ))}
49
+ </Accordion.Root>
50
+ );
51
+ }
52
+ ```
53
+
54
+ ```css title="accordion.css"
55
+ /* Accordion: <details>/<summary> underneath. `:open` is committed state (both modes);
56
+ [data-open] is optimistic state (library mode only). */
57
+ .demo-accordion {
58
+ border: 1px solid var(--color-border);
59
+ border-radius: 8px;
60
+ overflow: hidden;
61
+ }
62
+
63
+ .demo-accordion-item + .demo-accordion-item {
64
+ border-top: 1px solid var(--color-border);
65
+ }
66
+
67
+ .demo-accordion-trigger {
68
+ display: flex;
69
+ align-items: center;
70
+ gap: 0.6em;
71
+ padding: 0.6em 0.9em;
72
+ cursor: pointer;
73
+ list-style: none; /* hides the UA marker; the chevron below replaces it */
74
+ }
75
+
76
+ .demo-accordion-trigger::-webkit-details-marker {
77
+ display: none;
78
+ }
79
+
80
+ .demo-accordion-trigger h4 {
81
+ flex: 1;
82
+ margin: 0;
83
+ font-size: 1rem;
84
+ }
85
+
86
+ .demo-accordion-trigger:focus-visible {
87
+ outline: 2px solid var(--color-primary);
88
+ outline-offset: -2px;
89
+ }
90
+
91
+ .demo-accordion-trigger[data-pending] {
92
+ cursor: progress;
93
+ }
94
+
95
+ .demo-accordion-trigger[data-disabled] {
96
+ color: GrayText;
97
+ cursor: not-allowed;
98
+ }
99
+
100
+ /* Chevron. While an item is pending, the optimistic attribute alone decides, so closing an open
101
+ item flips the chevron at once instead of waiting for :open to go. */
102
+ .demo-accordion-trigger::before {
103
+ content: "";
104
+ inline-size: 0.5em;
105
+ block-size: 0.5em;
106
+ border-inline-end: 2px solid currentColor;
107
+ border-block-end: 2px solid currentColor;
108
+ rotate: -45deg;
109
+ transition: rotate 150ms;
110
+ }
111
+
112
+ .demo-accordion-item:open > .demo-accordion-trigger:not([data-pending])::before,
113
+ .demo-accordion-trigger[data-open]::before {
114
+ rotate: 45deg;
115
+ }
116
+
117
+ /* Open/close animation on ::details-content (grid-rows form, every engine, both modes). */
118
+ .demo-accordion-item::details-content {
119
+ display: grid;
120
+ grid-template-rows: 0fr;
121
+ transition:
122
+ grid-template-rows 200ms ease,
123
+ content-visibility 200ms allow-discrete;
124
+ }
125
+
126
+ .demo-accordion-item:open::details-content {
127
+ grid-template-rows: 1fr;
128
+ }
129
+
130
+ .demo-accordion-panel {
131
+ min-height: 0; /* the grid item */
132
+ overflow: hidden;
133
+ padding: 0 0.9em;
134
+ }
135
+
136
+ .demo-accordion-panel :is(p, ul) {
137
+ margin: 0 0 0.8em;
138
+ }
139
+
140
+ @media (prefers-reduced-motion: reduce) {
141
+ .demo-accordion-item::details-content,
142
+ .demo-accordion-trigger::before {
143
+ transition: none;
144
+ }
145
+ }
146
+ ```
147
+
148
+ ## Anatomy
149
+
150
+ ```tsx
151
+ import { Accordion } from "@funstack/ui/accordion";
152
+
153
+ <Accordion.Root> {/* div: state, keyboard navigation */}
154
+ <Accordion.Item value="shipping"> {/* details */}
155
+ <Accordion.Trigger> {/* summary: must be the Item's first child */}
156
+ <h3>Shipping</h3>
157
+ </Accordion.Trigger>
158
+ <Accordion.Panel> {/* div: the content */}
159
+ We ship worldwide.
160
+ </Accordion.Panel>
161
+ </Accordion.Item>
162
+ </Accordion.Root>
163
+ ```
164
+
165
+ There is no Header part: the only valid place for a heading is inside the `<summary>`, so put it in the Trigger. If you use `render`, the Item must still render a `<details>` and the Trigger a `<summary>` (development warning otherwise).
166
+
167
+ ## How it works
168
+
169
+ ### Two modes
170
+
171
+ | | JS-free mode | Library mode |
172
+ | - | - | - |
173
+ | Selected when | Root has none of `value`, `defaultValue`, `valueChangeAction` | Root has any of them |
174
+ | Open state owner | the browser | React (committed state) |
175
+ | Initial open | `Item defaultOpen` | `Root defaultValue` / `value` |
176
+ | `exclusive` | native `<details name>` group | the library keeps at most one value |
177
+ | `data-open`, `data-pending` | not emitted; style with `:open` | emitted (optimistic) |
178
+ | Works before hydration | yes, fully | yes; reconciled on mount |
179
+ | `transition` | no effect (development warning) | animates the commit that ends an action |
180
+
181
+ See [Browser-owned state](../concepts/browser-owned-state.md) for the reasoning. Switching modes after mount is not supported.
182
+
183
+ ## Props
184
+
185
+ ### `Accordion.Root`
186
+
187
+ | Prop | Type | Default | Description |
188
+ | - | - | - | - |
189
+ | `exclusive` | `boolean` | `false` | At most one item open. Also decides the value type: string \| null when exclusive, string\[] otherwise. |
190
+ | `value` | `string[] \| string \| null (exclusive)` | – | Controlled open items. undefined means uncontrolled; \[] or null means none open. Selects library mode. |
191
+ | `defaultValue` | `string[] \| string \| null (exclusive)` | – | Initial open items in uncontrolled library mode. Selects library mode. |
192
+ | `valueChangeAction` | `ChangeAction<string[] \| string \| null, AccordionValueChangeDetails>` | – | Called with the next open items on every change, inside the Root's transition. Sync, async or a Server Function. `details`: `reason` (a `ChangeReason`; Accordion dispatches `"activate"` or `"platform"`), `item` (the item that changed) and `open` (its new state). In multiple mode the array lists items in the order they mounted. Selects library mode. |
193
+ | `disabled` | `boolean` | `false` | Disables every item: triggers get aria-disabled="true" and never toggle. |
194
+ | `experimental_interpolateSize` | `boolean` | `false` | Sets `interpolate-size: allow-keywords` on the root so `::details-content` can transition `height` to `auto`. Chromium only today; merged under your `style`. |
195
+ | `className` | `string \| ((state: AccordionRootState) => string \| undefined)` | – | A class name, or a function of the part's state. |
196
+ | `style` | `CSSProperties \| ((state: AccordionRootState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
197
+ | `children` | `ReactNode \| ((state: AccordionRootState) => ReactNode)` | – | Content, or a function of the part's state. |
198
+ | `render` | `ReactElement \| ((props, state: AccordionRootState) => ReactNode)` | – | Replace the default \<div> (element form) or take over rendering (function form). |
199
+
200
+ - **State**: `AccordionRootState` is `{ pending, disabled }`.
201
+ - **Owned**: `onKeyDown`, `data-pending`, `data-disabled`.
202
+
203
+ ### `Accordion.Item`
204
+
205
+ | Prop | Type | Default | Description |
206
+ | - | - | - | - |
207
+ | `value` | `string` | – | Required in both modes. Identifies the item in the Root's value. |
208
+ | `defaultOpen` | `boolean` | `false` | JS-free mode only: renders the initial open attribute. Ignored in library mode (development warning). |
209
+ | `disabled` | `boolean` | `false` | The Trigger gets aria-disabled and never toggles. Enforced by a click handler, so in JS-free mode it does not hold before hydration. |
210
+ | `transition` | `ViewTransitionClass` | – | Library mode only. Forwarded to the \<ViewTransition> around the \<details>; animates the open/close commit. |
211
+ | `className` | `string \| ((state: AccordionItemState) => string \| undefined)` | – | A class name, or a function of the part's state. |
212
+ | `style` | `CSSProperties \| ((state: AccordionItemState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
213
+ | `children` | `ReactNode \| ((state: AccordionItemState) => ReactNode)` | – | Content, or a function of the part's state. |
214
+ | `render` | `ReactElement \| ((props, state: AccordionItemState) => ReactNode)` | – | Replace the default \<details> (element form) or take over rendering (function form). |
215
+
216
+ - **State**: `AccordionItemState` is `{ value, open, pending, disabled }`; `open` is optimistic, and `undefined` in JS-free mode (the browser owns it).
217
+ - **Owned**: `open`, `name`, `suppressHydrationWarning`, `data-open`, `data-pending`, `data-disabled`, and `onToggle` in library mode.
218
+
219
+ ### `Accordion.Trigger`
220
+
221
+ | Prop | Type | Default | Description |
222
+ | - | - | - | - |
223
+ | `transition` | `ViewTransitionClass` | – | Library mode only. Animates the commit that ends an action (for example a spinner disappearing), not the optimistic data-open flip. |
224
+ | `className` | `string \| ((state: AccordionTriggerState) => string \| undefined)` | – | A class name, or a function of the part's state. |
225
+ | `style` | `CSSProperties \| ((state: AccordionTriggerState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
226
+ | `children` | `ReactNode \| ((state: AccordionTriggerState) => ReactNode)` | – | Rendered from optimistic state; must not suspend. A heading inside is recommended. |
227
+ | `render` | `ReactElement \| ((props, state: AccordionTriggerState) => ReactNode)` | – | Replace the default \<summary> (element form) or take over rendering (function form). |
228
+
229
+ - **State**: `AccordionTriggerState` is the Item's state.
230
+ - **Owned**: `aria-disabled`, `data-open`, `data-pending`, `data-disabled`, and `onClick` in library mode (and on disabled items).
231
+
232
+ Links and form controls inside the summary keep their own behaviour and do not toggle the item.
233
+
234
+ ### `Accordion.Panel`
235
+
236
+ | Prop | Type | Default | Description |
237
+ | - | - | - | - |
238
+ | `transition` | `ViewTransitionClass` | – | Library mode only. Animates content that mounts or changes in the commit that ends an action. |
239
+ | `className` | `string \| ((state: AccordionPanelState) => string \| undefined)` | – | A class name, or a function of the part's state. |
240
+ | `style` | `CSSProperties \| ((state: AccordionPanelState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
241
+ | `children` | `ReactNode \| ((state: AccordionPanelState) => ReactNode)` | – | Always mounted. The function form receives committed open: use it to mount content lazily. |
242
+ | `render` | `ReactElement \| ((props, state: AccordionPanelState) => ReactNode)` | – | Replace the default \<div> (element form) or take over rendering (function form). |
243
+
244
+ - **State**: `AccordionPanelState` is `{ value, open, disabled }`; `open` is committed (`undefined` in JS-free mode).
245
+ - **Owned**: `data-disabled`.
246
+
247
+ Panels have no `keepMounted`: closed content is always in the DOM, which keeps it searchable.
248
+
249
+ ## Data attributes
250
+
251
+ | Hook | On | Meaning |
252
+ | - | - | - |
253
+ | `:open` | Item (`details`) | Committed open state, both modes. |
254
+ | `data-open` | Item, Trigger | Optimistic open state (library mode only). |
255
+ | `data-pending` | Root | An action is in flight. |
256
+ | `data-pending` | Item, Trigger | This item's open state is changing. |
257
+ | `data-disabled` | Root, Item, Trigger, Panel | Disabled by prop or by the Root. |
258
+ | `aria-disabled` | Trigger | `"true"` when disabled. |
259
+ | `::details-content` | Item | The native content slot: animate it. |
260
+
261
+ ```css
262
+ .trigger { list-style: none; } /* hide the UA marker */
263
+ .trigger::-webkit-details-marker { display: none; }
264
+ .trigger::before { content: "▸"; }
265
+ .item:open > .trigger:not([data-pending])::before,
266
+ .trigger[data-open]::before { content: "▾"; } /* flips at once in library mode */
267
+
268
+ /* Open/close animation, every engine, both modes */
269
+ .item::details-content {
270
+ display: grid;
271
+ grid-template-rows: 0fr;
272
+ transition: grid-template-rows 200ms ease, content-visibility 200ms allow-discrete;
273
+ }
274
+ .item:open::details-content { grid-template-rows: 1fr; }
275
+ .panel { min-height: 0; overflow: hidden; }
276
+
277
+ @media (prefers-reduced-motion: reduce) {
278
+ .item::details-content { transition: none; }
279
+ }
280
+ ```
281
+
282
+ ## Keyboard and ARIA
283
+
284
+ | Key | Behaviour |
285
+ | - | - |
286
+ | Enter / Space on a trigger | Toggles the item (native). |
287
+ | Tab / Shift+Tab | Every trigger is a tab stop. |
288
+ | ArrowDown / ArrowUp | Next / previous trigger in the same Root, wrapping, skipping disabled triggers. |
289
+ | Home / End | First / last enabled trigger. |
290
+
291
+ - The summary's disclosure role and expanded state are native. No `aria-*` is added except `aria-disabled`.
292
+ - HTML forbids `aria-expanded` on a summary, so assistive technology hears the committed state; `data-open` is visual only. For an audible pending state, render an `aria-live` region from the Trigger's state.
293
+ - Disabled triggers stay focusable. Focus never moves on open or close.
294
+
295
+ ## Transition types
296
+
297
+ Concept: [Transitions & ViewTransition](../concepts/transitions.md#transition-types)
298
+
299
+ Library mode: `fsui-accordion` plus `fsui-accordion-expand` or `fsui-accordion-collapse`. JS-free mode starts no transitions.
300
+
301
+ ## Optimistic and pending
302
+
303
+ Concept: [Pending & optimistic state](../concepts/pending-and-optimistic.md)
304
+
305
+ Library mode: the Item and Trigger show the optimistic open state (`data-open`) and `data-pending` while their open state is changing; the Root carries `data-pending` while an action is in flight. The `<details>` element (`:open`, and what assistive technology hears) and the Panel's function child follow the committed state. JS-free mode has no optimistic or pending state.
306
+
307
+ ### Walkthrough (library mode)
308
+
309
+ ```tsx title="AccordionThreads.tsx"
310
+ "use client";
311
+ import { use, useState } from "react";
312
+ import { Accordion } from "@funstack/ui/accordion";
313
+ import { sleep } from "./fake-api.js";
314
+
315
+ const cache = new Map<string, Promise<string[]>>();
316
+ function loadReplies(thread: string): Promise<string[]> {
317
+ let promise = cache.get(thread);
318
+ if (promise === undefined) {
319
+ promise = sleep(1200).then(() => [`First reply to ${thread}`, `Second reply to ${thread}`]);
320
+ cache.set(thread, promise);
321
+ }
322
+ return promise;
323
+ }
324
+
325
+ function Replies({ thread }: { thread: string }) {
326
+ const replies = use(loadReplies(thread));
327
+ return (
328
+ <ul>
329
+ {replies.map((reply) => (
330
+ <li key={reply}>{reply}</li>
331
+ ))}
332
+ </ul>
333
+ );
334
+ }
335
+
336
+ const threads = ["Release planning", "Bug triage", "Design review"];
337
+
338
+ // Library mode (controlled, exclusive). The Panel's function child mounts <Replies> only once
339
+ // the item is open in committed state. Replies suspend for 1.2 s; because opening is a
340
+ // transition, the item stays closed with a spinner on its trigger until the data is ready, then
341
+ // opens with its content. No Suspense fallback is ever shown.
342
+ export function AccordionThreads() {
343
+ const [open, setOpen] = useState<string | null>(null);
344
+ return (
345
+ <>
346
+ <Accordion.Root
347
+ exclusive
348
+ className="demo-accordion"
349
+ value={open}
350
+ valueChangeAction={(next) => {
351
+ setOpen(next); // sync prefix: a Transition update
352
+ }}
353
+ >
354
+ {threads.map((thread) => (
355
+ <Accordion.Item key={thread} value={thread} className="demo-accordion-item">
356
+ <Accordion.Trigger className="demo-accordion-trigger">
357
+ {({ pending }) => (
358
+ <>
359
+ <h4>{thread}</h4>
360
+ {pending && <span className="demo-spinner" aria-hidden />}
361
+ </>
362
+ )}
363
+ </Accordion.Trigger>
364
+ <Accordion.Panel className="demo-accordion-panel">
365
+ {({ open }) => open && <Replies thread={thread} />}
366
+ </Accordion.Panel>
367
+ </Accordion.Item>
368
+ ))}
369
+ </Accordion.Root>
370
+ <output className="demo-readout">
371
+ value: <code>{JSON.stringify(open)}</code>
372
+ </output>
373
+ </>
374
+ );
375
+ }
376
+ ```
377
+
378
+ `accordion.css`: the same file as above.
379
+
380
+ 1. Click a trigger: the click is intercepted, the chevron flips (`data-open`), the item and trigger get `data-pending`, and `valueChangeAction(next, { reason: "activate", item, open: true })` runs.
381
+ 2. The commit renders the Panel's function child with `open: true`; the replies suspend, so React holds the commit. The `<details>` stays closed.
382
+ 3. The data arrives: the item opens with its content in one commit, and `data-pending` goes.
383
+ 4. If the action rejects, `data-open` reverts, the item never opens, and the error goes to the nearest Error Boundary.
384
+
385
+ > **Find-in-page in library mode**
386
+ >
387
+ > The browser opens a closed item when find-in-page or a text fragment matches its content. The Accordion dispatches that as `reason: "platform"` with the `toggle` event. If a controlled parent does not adopt the change, the item is closed again when the action settles. Disabled items are re-closed without dispatching.
388
+
389
+ ## Suspense
390
+
391
+ Concept: [Suspense](../concepts/suspense.md)
392
+
393
+ The Panel is always mounted; its function child receives the committed `open`, which is how you mount content lazily. If that content suspends, the item stays closed with the trigger pending until the content is ready, then opens. Trigger content must not suspend.
394
+
395
+ ## Browser-owned state
396
+
397
+ Concept: [Browser-owned state](../concepts/browser-owned-state.md)
398
+
399
+ JS-free mode: the browser owns every `<details open>`, and `exclusive` is the native `name` group; style with `:open` and animate with `::details-content`. Library mode: open state is library-owned, but the browser can still open a closed item (find-in-page, a text fragment, a click before hydration). That is dispatched with `reason: "platform"`, and the committed state is re-applied once the action settles.
400
+
401
+ ## Before hydration
402
+
403
+ Concept: [Server Components](../concepts/server-components.md#before-hydration)
404
+
405
+ JS-free mode: everything: open and close, Enter and Space, the `exclusive` group (`<details name>`), find-in-page, CSS animation. Hydration only adds arrow-key navigation and `disabled`. Library mode: the native toggle; items opened before hydration are reconciled on mount with one `valueChangeAction` call (`reason: "platform"`).
406
+
407
+ ## Recipes
408
+
409
+ ### Persist open sections with a Server Function
410
+
411
+ ```tsx
412
+ // Server Component
413
+ <Accordion.Root defaultValue={user.openSections} valueChangeAction={saveOpenSections}>
414
+ ...
415
+ </Accordion.Root>
416
+ ```
417
+
418
+ ### Animate item boxes with ViewTransition
419
+
420
+ ```tsx
421
+ <Accordion.Root exclusive defaultValue={null} valueChangeAction={save}>
422
+ <Accordion.Item value="a" transition="grow">...</Accordion.Item>
423
+ </Accordion.Root>
424
+ ```
425
+
426
+ Use either the `transition` prop or a `::details-content` CSS transition for a given change, not both.