@funstack/ui 0.1.0-alpha.15 → 0.1.0-alpha.17

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 (588) 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 +3 -1
  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 +46 -15
  26. package/dist/button/button.d.mts.map +1 -1
  27. package/dist/button/button.mjs +10 -6
  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 +7 -1
  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-group.d.mts +49 -1
  58. package/dist/combobox/combobox-group.d.mts.map +1 -1
  59. package/dist/combobox/combobox-group.mjs +11 -1
  60. package/dist/combobox/combobox-group.mjs.map +1 -1
  61. package/dist/combobox/combobox-input.d.mts +11 -0
  62. package/dist/combobox/combobox-input.d.mts.map +1 -1
  63. package/dist/combobox/combobox-input.mjs +2 -0
  64. package/dist/combobox/combobox-input.mjs.map +1 -1
  65. package/dist/combobox/combobox-label.d.mts +16 -0
  66. package/dist/combobox/combobox-label.d.mts.map +1 -1
  67. package/dist/combobox/combobox-label.mjs +2 -0
  68. package/dist/combobox/combobox-label.mjs.map +1 -1
  69. package/dist/combobox/combobox-list.d.mts +14 -0
  70. package/dist/combobox/combobox-list.d.mts.map +1 -1
  71. package/dist/combobox/combobox-list.mjs +2 -0
  72. package/dist/combobox/combobox-list.mjs.map +1 -1
  73. package/dist/combobox/combobox-option.d.mts +25 -3
  74. package/dist/combobox/combobox-option.d.mts.map +1 -1
  75. package/dist/combobox/combobox-option.mjs +2 -0
  76. package/dist/combobox/combobox-option.mjs.map +1 -1
  77. package/dist/combobox/combobox-popup.d.mts +20 -1
  78. package/dist/combobox/combobox-popup.d.mts.map +1 -1
  79. package/dist/combobox/combobox-popup.mjs +2 -0
  80. package/dist/combobox/combobox-popup.mjs.map +1 -1
  81. package/dist/combobox/combobox-root.d.mts +64 -17
  82. package/dist/combobox/combobox-root.d.mts.map +1 -1
  83. package/dist/combobox/combobox-root.mjs +11 -11
  84. package/dist/combobox/combobox-root.mjs.map +1 -1
  85. package/dist/combobox/combobox-trigger.d.mts +16 -0
  86. package/dist/combobox/combobox-trigger.d.mts.map +1 -1
  87. package/dist/combobox/combobox-trigger.mjs +9 -2
  88. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  89. package/dist/combobox/index.d.mts +2 -0
  90. package/dist/combobox/index.d.mts.map +1 -1
  91. package/dist/combobox/index.mjs +2 -0
  92. package/dist/combobox/index.mjs.map +1 -1
  93. package/dist/csp/csp-provider.d.mts +8 -0
  94. package/dist/csp/csp-provider.d.mts.map +1 -1
  95. package/dist/csp/csp-provider.mjs +2 -0
  96. package/dist/csp/csp-provider.mjs.map +1 -1
  97. package/dist/csp/style-hashes.d.mts +2 -0
  98. package/dist/csp/style-hashes.d.mts.map +1 -1
  99. package/dist/csp/style-hashes.mjs +2 -0
  100. package/dist/csp/style-hashes.mjs.map +1 -1
  101. package/dist/dialog/dialog-close.d.mts +31 -3
  102. package/dist/dialog/dialog-close.d.mts.map +1 -1
  103. package/dist/dialog/dialog-close.mjs +5 -2
  104. package/dist/dialog/dialog-close.mjs.map +1 -1
  105. package/dist/dialog/dialog-context.mjs.map +1 -1
  106. package/dist/dialog/dialog-description.d.mts +12 -0
  107. package/dist/dialog/dialog-description.d.mts.map +1 -1
  108. package/dist/dialog/dialog-description.mjs +2 -0
  109. package/dist/dialog/dialog-description.mjs.map +1 -1
  110. package/dist/dialog/dialog-form.d.mts +20 -2
  111. package/dist/dialog/dialog-form.d.mts.map +1 -1
  112. package/dist/dialog/dialog-form.mjs +2 -0
  113. package/dist/dialog/dialog-form.mjs.map +1 -1
  114. package/dist/dialog/dialog-popup.d.mts +34 -8
  115. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  116. package/dist/dialog/dialog-popup.mjs +14 -20
  117. package/dist/dialog/dialog-popup.mjs.map +1 -1
  118. package/dist/dialog/dialog-root.d.mts +53 -25
  119. package/dist/dialog/dialog-root.d.mts.map +1 -1
  120. package/dist/dialog/dialog-root.mjs +12 -8
  121. package/dist/dialog/dialog-root.mjs.map +1 -1
  122. package/dist/dialog/dialog-title.d.mts +11 -0
  123. package/dist/dialog/dialog-title.d.mts.map +1 -1
  124. package/dist/dialog/dialog-title.mjs +2 -0
  125. package/dist/dialog/dialog-title.mjs.map +1 -1
  126. package/dist/dialog/dialog-trigger.d.mts +19 -3
  127. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  128. package/dist/dialog/dialog-trigger.mjs +2 -0
  129. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  130. package/dist/dialog/index.d.mts +7 -5
  131. package/dist/dialog/index.d.mts.map +1 -1
  132. package/dist/dialog/index.mjs +7 -5
  133. package/dist/dialog/index.mjs.map +1 -1
  134. package/dist/docs/components/accordion.md +426 -0
  135. package/dist/docs/components/button.md +508 -0
  136. package/dist/docs/components/checkbox-group.md +483 -0
  137. package/dist/docs/components/checkbox.md +373 -0
  138. package/dist/docs/components/combobox.md +698 -0
  139. package/dist/docs/components/context-menu.md +524 -0
  140. package/dist/docs/components/dialog.md +692 -0
  141. package/dist/docs/components/field.md +587 -0
  142. package/dist/docs/components/menu.md +670 -0
  143. package/dist/docs/components/meter.md +313 -0
  144. package/dist/docs/components/number-field.md +528 -0
  145. package/dist/docs/components/popover.md +656 -0
  146. package/dist/docs/components/progress.md +450 -0
  147. package/dist/docs/components/radio-group.md +457 -0
  148. package/dist/docs/components/select.md +662 -0
  149. package/dist/docs/components/slider.md +558 -0
  150. package/dist/docs/components/switch.md +311 -0
  151. package/dist/docs/components/tabs.md +473 -0
  152. package/dist/docs/components/toast.md +599 -0
  153. package/dist/docs/components/toggle-group.md +341 -0
  154. package/dist/docs/components/toggle.md +245 -0
  155. package/dist/docs/components/toolbar.md +390 -0
  156. package/dist/docs/components/tooltip.md +494 -0
  157. package/dist/docs/concepts/action-props.md +281 -0
  158. package/dist/docs/concepts/ai-agents.md +56 -0
  159. package/dist/docs/concepts/browser-owned-state.md +133 -0
  160. package/dist/docs/concepts/content-security-policy.md +69 -0
  161. package/dist/docs/concepts/experimental.md +36 -0
  162. package/dist/docs/concepts/pending-and-optimistic.md +263 -0
  163. package/dist/docs/concepts/render.md +23 -0
  164. package/dist/docs/concepts/server-components.md +132 -0
  165. package/dist/docs/concepts/suspense.md +129 -0
  166. package/dist/docs/concepts/transitions.md +112 -0
  167. package/dist/docs/getting-started.md +102 -0
  168. package/dist/docs/index.md +182 -0
  169. package/dist/docs/roadmap.md +128 -0
  170. package/dist/docs/why.md +104 -0
  171. package/dist/field/field-control.d.mts +26 -3
  172. package/dist/field/field-control.d.mts.map +1 -1
  173. package/dist/field/field-control.mjs +2 -0
  174. package/dist/field/field-control.mjs.map +1 -1
  175. package/dist/field/field-description.d.mts +11 -0
  176. package/dist/field/field-description.d.mts.map +1 -1
  177. package/dist/field/field-description.mjs +2 -0
  178. package/dist/field/field-description.mjs.map +1 -1
  179. package/dist/field/field-error.d.mts +14 -2
  180. package/dist/field/field-error.d.mts.map +1 -1
  181. package/dist/field/field-error.mjs +2 -0
  182. package/dist/field/field-error.mjs.map +1 -1
  183. package/dist/field/field-label.d.mts +10 -0
  184. package/dist/field/field-label.d.mts.map +1 -1
  185. package/dist/field/field-label.mjs +2 -0
  186. package/dist/field/field-label.mjs.map +1 -1
  187. package/dist/field/field-root.d.mts +21 -2
  188. package/dist/field/field-root.d.mts.map +1 -1
  189. package/dist/field/field-root.mjs +2 -0
  190. package/dist/field/field-root.mjs.map +1 -1
  191. package/dist/field/index.d.mts +9 -0
  192. package/dist/field/index.d.mts.map +1 -1
  193. package/dist/field/index.mjs +9 -0
  194. package/dist/field/index.mjs.map +1 -1
  195. package/dist/form/form-root.d.mts +17 -1
  196. package/dist/form/form-root.d.mts.map +1 -1
  197. package/dist/form/form-root.mjs +2 -0
  198. package/dist/form/form-root.mjs.map +1 -1
  199. package/dist/form/form-submit.d.mts +18 -0
  200. package/dist/form/form-submit.d.mts.map +1 -1
  201. package/dist/form/form-submit.mjs +2 -0
  202. package/dist/form/form-submit.mjs.map +1 -1
  203. package/dist/form/index.d.mts +7 -0
  204. package/dist/form/index.d.mts.map +1 -1
  205. package/dist/form/index.mjs +7 -0
  206. package/dist/form/index.mjs.map +1 -1
  207. package/dist/index.d.mts +3 -2
  208. package/dist/internal/call-urgent-handler.mjs +37 -0
  209. package/dist/internal/call-urgent-handler.mjs.map +1 -0
  210. package/dist/internal/css-transition-cut.mjs +66 -0
  211. package/dist/internal/css-transition-cut.mjs.map +1 -0
  212. package/dist/internal/overlay-popup.mjs.map +1 -1
  213. package/dist/internal/report-dropped.mjs +45 -0
  214. package/dist/internal/report-dropped.mjs.map +1 -0
  215. package/dist/internal/types.d.mts +36 -7
  216. package/dist/internal/types.d.mts.map +1 -1
  217. package/dist/internal/use-action-trigger.mjs +32 -17
  218. package/dist/internal/use-action-trigger.mjs.map +1 -1
  219. package/dist/internal/use-controllable-action.mjs +52 -16
  220. package/dist/internal/use-controllable-action.mjs.map +1 -1
  221. package/dist/internal/use-exit-animation.mjs +1 -1
  222. package/dist/internal/use-exit-animation.mjs.map +1 -1
  223. package/dist/internal/use-native-group-reconciliation.mjs +4 -2
  224. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
  225. package/dist/internal/use-overlay-close.mjs +10 -4
  226. package/dist/internal/use-overlay-close.mjs.map +1 -1
  227. package/dist/internal/use-overlay-root.mjs +40 -7
  228. package/dist/internal/use-overlay-root.mjs.map +1 -1
  229. package/dist/internal/use-popover-popup.mjs +22 -7
  230. package/dist/internal/use-popover-popup.mjs.map +1 -1
  231. package/dist/internal/use-popover-trigger.d.mts +2 -1
  232. package/dist/internal/use-popover-trigger.d.mts.map +1 -1
  233. package/dist/internal/use-popover-trigger.mjs +11 -3
  234. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  235. package/dist/internal/validity.d.mts +11 -0
  236. package/dist/internal/validity.d.mts.map +1 -1
  237. package/dist/internal/validity.mjs.map +1 -1
  238. package/dist/menu/index.d.mts +2 -0
  239. package/dist/menu/index.d.mts.map +1 -1
  240. package/dist/menu/index.mjs +2 -0
  241. package/dist/menu/index.mjs.map +1 -1
  242. package/dist/menu/menu-checkbox-item.d.mts +27 -3
  243. package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
  244. package/dist/menu/menu-checkbox-item.mjs +2 -0
  245. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  246. package/dist/menu/menu-context-trigger.d.mts +24 -2
  247. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  248. package/dist/menu/menu-context-trigger.mjs +2 -0
  249. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  250. package/dist/menu/menu-group.d.mts +36 -1
  251. package/dist/menu/menu-group.d.mts.map +1 -1
  252. package/dist/menu/menu-group.mjs +9 -1
  253. package/dist/menu/menu-group.mjs.map +1 -1
  254. package/dist/menu/menu-item.d.mts +38 -5
  255. package/dist/menu/menu-item.d.mts.map +1 -1
  256. package/dist/menu/menu-item.mjs +12 -5
  257. package/dist/menu/menu-item.mjs.map +1 -1
  258. package/dist/menu/menu-outside.mjs +2 -2
  259. package/dist/menu/menu-outside.mjs.map +1 -1
  260. package/dist/menu/menu-popup.d.mts +36 -8
  261. package/dist/menu/menu-popup.d.mts.map +1 -1
  262. package/dist/menu/menu-popup.mjs +2 -0
  263. package/dist/menu/menu-popup.mjs.map +1 -1
  264. package/dist/menu/menu-radio-group.d.mts +20 -1
  265. package/dist/menu/menu-radio-group.d.mts.map +1 -1
  266. package/dist/menu/menu-radio-group.mjs +2 -0
  267. package/dist/menu/menu-radio-group.mjs.map +1 -1
  268. package/dist/menu/menu-radio-item.d.mts +16 -0
  269. package/dist/menu/menu-radio-item.d.mts.map +1 -1
  270. package/dist/menu/menu-radio-item.mjs +2 -0
  271. package/dist/menu/menu-radio-item.mjs.map +1 -1
  272. package/dist/menu/menu-root.d.mts +49 -15
  273. package/dist/menu/menu-root.d.mts.map +1 -1
  274. package/dist/menu/menu-root.mjs +7 -4
  275. package/dist/menu/menu-root.mjs.map +1 -1
  276. package/dist/menu/menu-submenu-trigger.d.mts +13 -0
  277. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  278. package/dist/menu/menu-submenu-trigger.mjs +2 -0
  279. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  280. package/dist/menu/menu-trigger.d.mts +15 -0
  281. package/dist/menu/menu-trigger.d.mts.map +1 -1
  282. package/dist/menu/menu-trigger.mjs +2 -0
  283. package/dist/menu/menu-trigger.mjs.map +1 -1
  284. package/dist/meter/index.d.mts +2 -0
  285. package/dist/meter/index.d.mts.map +1 -1
  286. package/dist/meter/index.mjs +2 -0
  287. package/dist/meter/index.mjs.map +1 -1
  288. package/dist/meter/meter-indicator.d.mts +11 -0
  289. package/dist/meter/meter-indicator.d.mts.map +1 -1
  290. package/dist/meter/meter-indicator.mjs +2 -0
  291. package/dist/meter/meter-indicator.mjs.map +1 -1
  292. package/dist/meter/meter-label.d.mts +11 -0
  293. package/dist/meter/meter-label.d.mts.map +1 -1
  294. package/dist/meter/meter-label.mjs +2 -0
  295. package/dist/meter/meter-label.mjs.map +1 -1
  296. package/dist/meter/meter-region.d.mts +5 -0
  297. package/dist/meter/meter-region.d.mts.map +1 -1
  298. package/dist/meter/meter-region.mjs.map +1 -1
  299. package/dist/meter/meter-root.d.mts +52 -10
  300. package/dist/meter/meter-root.d.mts.map +1 -1
  301. package/dist/meter/meter-root.mjs +2 -0
  302. package/dist/meter/meter-root.mjs.map +1 -1
  303. package/dist/meter/meter-track.d.mts +11 -0
  304. package/dist/meter/meter-track.d.mts.map +1 -1
  305. package/dist/meter/meter-track.mjs +2 -0
  306. package/dist/meter/meter-track.mjs.map +1 -1
  307. package/dist/meter/meter-value.d.mts +15 -1
  308. package/dist/meter/meter-value.d.mts.map +1 -1
  309. package/dist/meter/meter-value.mjs +2 -0
  310. package/dist/meter/meter-value.mjs.map +1 -1
  311. package/dist/number-field/index.d.mts +2 -0
  312. package/dist/number-field/index.d.mts.map +1 -1
  313. package/dist/number-field/index.mjs +2 -0
  314. package/dist/number-field/index.mjs.map +1 -1
  315. package/dist/number-field/number-field-decrement.d.mts +2 -0
  316. package/dist/number-field/number-field-decrement.d.mts.map +1 -1
  317. package/dist/number-field/number-field-decrement.mjs +2 -0
  318. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  319. package/dist/number-field/number-field-increment.d.mts +2 -0
  320. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  321. package/dist/number-field/number-field-increment.mjs +2 -0
  322. package/dist/number-field/number-field-increment.mjs.map +1 -1
  323. package/dist/number-field/number-field-input.d.mts +9 -0
  324. package/dist/number-field/number-field-input.d.mts.map +1 -1
  325. package/dist/number-field/number-field-input.mjs +2 -0
  326. package/dist/number-field/number-field-input.mjs.map +1 -1
  327. package/dist/number-field/number-field-label.d.mts +10 -0
  328. package/dist/number-field/number-field-label.d.mts.map +1 -1
  329. package/dist/number-field/number-field-label.mjs +2 -0
  330. package/dist/number-field/number-field-label.mjs.map +1 -1
  331. package/dist/number-field/number-field-root.d.mts +62 -14
  332. package/dist/number-field/number-field-root.d.mts.map +1 -1
  333. package/dist/number-field/number-field-root.mjs +4 -8
  334. package/dist/number-field/number-field-root.mjs.map +1 -1
  335. package/dist/number-field/use-step-button.d.mts +20 -0
  336. package/dist/number-field/use-step-button.d.mts.map +1 -1
  337. package/dist/number-field/use-step-button.mjs.map +1 -1
  338. package/dist/popover/index.d.mts +5 -3
  339. package/dist/popover/index.d.mts.map +1 -1
  340. package/dist/popover/index.mjs +5 -3
  341. package/dist/popover/index.mjs.map +1 -1
  342. package/dist/popover/popover-close.d.mts +32 -3
  343. package/dist/popover/popover-close.d.mts.map +1 -1
  344. package/dist/popover/popover-close.mjs +6 -2
  345. package/dist/popover/popover-close.mjs.map +1 -1
  346. package/dist/popover/popover-description.d.mts +12 -0
  347. package/dist/popover/popover-description.d.mts.map +1 -1
  348. package/dist/popover/popover-description.mjs +2 -0
  349. package/dist/popover/popover-description.mjs.map +1 -1
  350. package/dist/popover/popover-popup.d.mts +36 -7
  351. package/dist/popover/popover-popup.d.mts.map +1 -1
  352. package/dist/popover/popover-popup.mjs +5 -2
  353. package/dist/popover/popover-popup.mjs.map +1 -1
  354. package/dist/popover/popover-root.d.mts +40 -18
  355. package/dist/popover/popover-root.d.mts.map +1 -1
  356. package/dist/popover/popover-root.mjs +11 -7
  357. package/dist/popover/popover-root.mjs.map +1 -1
  358. package/dist/popover/popover-title.d.mts +11 -0
  359. package/dist/popover/popover-title.d.mts.map +1 -1
  360. package/dist/popover/popover-title.mjs +2 -0
  361. package/dist/popover/popover-title.mjs.map +1 -1
  362. package/dist/popover/popover-trigger.d.mts +15 -0
  363. package/dist/popover/popover-trigger.d.mts.map +1 -1
  364. package/dist/popover/popover-trigger.mjs +2 -0
  365. package/dist/popover/popover-trigger.mjs.map +1 -1
  366. package/dist/progress/index.d.mts +2 -0
  367. package/dist/progress/index.d.mts.map +1 -1
  368. package/dist/progress/index.mjs +2 -0
  369. package/dist/progress/index.mjs.map +1 -1
  370. package/dist/progress/progress-indicator.d.mts +11 -0
  371. package/dist/progress/progress-indicator.d.mts.map +1 -1
  372. package/dist/progress/progress-indicator.mjs +2 -0
  373. package/dist/progress/progress-indicator.mjs.map +1 -1
  374. package/dist/progress/progress-label.d.mts +11 -0
  375. package/dist/progress/progress-label.d.mts.map +1 -1
  376. package/dist/progress/progress-label.mjs +2 -0
  377. package/dist/progress/progress-label.mjs.map +1 -1
  378. package/dist/progress/progress-root.d.mts +36 -8
  379. package/dist/progress/progress-root.d.mts.map +1 -1
  380. package/dist/progress/progress-root.mjs +2 -0
  381. package/dist/progress/progress-root.mjs.map +1 -1
  382. package/dist/progress/progress-track.d.mts +11 -0
  383. package/dist/progress/progress-track.d.mts.map +1 -1
  384. package/dist/progress/progress-track.mjs +2 -0
  385. package/dist/progress/progress-track.mjs.map +1 -1
  386. package/dist/progress/progress-value.d.mts +15 -1
  387. package/dist/progress/progress-value.d.mts.map +1 -1
  388. package/dist/progress/progress-value.mjs +2 -0
  389. package/dist/progress/progress-value.mjs.map +1 -1
  390. package/dist/radio-group/index.d.mts +2 -0
  391. package/dist/radio-group/index.d.mts.map +1 -1
  392. package/dist/radio-group/index.mjs +2 -0
  393. package/dist/radio-group/index.mjs.map +1 -1
  394. package/dist/radio-group/radio-group-item.d.mts +18 -1
  395. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  396. package/dist/radio-group/radio-group-item.mjs +2 -0
  397. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  398. package/dist/radio-group/radio-group-label.d.mts +10 -0
  399. package/dist/radio-group/radio-group-label.d.mts.map +1 -1
  400. package/dist/radio-group/radio-group-label.mjs +2 -0
  401. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  402. package/dist/radio-group/radio-group-root.d.mts +29 -5
  403. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  404. package/dist/radio-group/radio-group-root.mjs +2 -0
  405. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  406. package/dist/select/index.d.mts +2 -0
  407. package/dist/select/index.d.mts.map +1 -1
  408. package/dist/select/index.mjs +2 -0
  409. package/dist/select/index.mjs.map +1 -1
  410. package/dist/select/select-group-label.d.mts +10 -0
  411. package/dist/select/select-group-label.d.mts.map +1 -1
  412. package/dist/select/select-group-label.mjs +2 -0
  413. package/dist/select/select-group-label.mjs.map +1 -1
  414. package/dist/select/select-group.d.mts +15 -1
  415. package/dist/select/select-group.d.mts.map +1 -1
  416. package/dist/select/select-group.mjs +2 -0
  417. package/dist/select/select-group.mjs.map +1 -1
  418. package/dist/select/select-option.d.mts +19 -1
  419. package/dist/select/select-option.d.mts.map +1 -1
  420. package/dist/select/select-option.mjs +2 -0
  421. package/dist/select/select-option.mjs.map +1 -1
  422. package/dist/select/select-root.d.mts +24 -1
  423. package/dist/select/select-root.d.mts.map +1 -1
  424. package/dist/select/select-root.mjs +2 -0
  425. package/dist/select/select-root.mjs.map +1 -1
  426. package/dist/select/select-separator.d.mts +9 -0
  427. package/dist/select/select-separator.d.mts.map +1 -1
  428. package/dist/select/select-separator.mjs +2 -0
  429. package/dist/select/select-separator.mjs.map +1 -1
  430. package/dist/select/select-trigger.d.mts +9 -0
  431. package/dist/select/select-trigger.d.mts.map +1 -1
  432. package/dist/select/select-trigger.mjs +2 -0
  433. package/dist/select/select-trigger.mjs.map +1 -1
  434. package/dist/select/select-value.d.mts +9 -0
  435. package/dist/select/select-value.d.mts.map +1 -1
  436. package/dist/select/select-value.mjs +2 -0
  437. package/dist/select/select-value.mjs.map +1 -1
  438. package/dist/slider/index.d.mts +2 -0
  439. package/dist/slider/index.d.mts.map +1 -1
  440. package/dist/slider/index.mjs +2 -0
  441. package/dist/slider/index.mjs.map +1 -1
  442. package/dist/slider/slider-indicator.d.mts +12 -0
  443. package/dist/slider/slider-indicator.d.mts.map +1 -1
  444. package/dist/slider/slider-indicator.mjs +2 -0
  445. package/dist/slider/slider-indicator.mjs.map +1 -1
  446. package/dist/slider/slider-label.d.mts +11 -1
  447. package/dist/slider/slider-label.d.mts.map +1 -1
  448. package/dist/slider/slider-label.mjs +2 -0
  449. package/dist/slider/slider-label.mjs.map +1 -1
  450. package/dist/slider/slider-root.d.mts +53 -9
  451. package/dist/slider/slider-root.d.mts.map +1 -1
  452. package/dist/slider/slider-root.mjs +4 -8
  453. package/dist/slider/slider-root.mjs.map +1 -1
  454. package/dist/slider/slider-thumb.d.mts +32 -3
  455. package/dist/slider/slider-thumb.d.mts.map +1 -1
  456. package/dist/slider/slider-thumb.mjs +2 -0
  457. package/dist/slider/slider-thumb.mjs.map +1 -1
  458. package/dist/slider/slider-track.d.mts +17 -0
  459. package/dist/slider/slider-track.d.mts.map +1 -1
  460. package/dist/slider/slider-track.mjs +2 -0
  461. package/dist/slider/slider-track.mjs.map +1 -1
  462. package/dist/slider/slider-value.d.mts +11 -0
  463. package/dist/slider/slider-value.d.mts.map +1 -1
  464. package/dist/slider/slider-value.mjs +2 -0
  465. package/dist/slider/slider-value.mjs.map +1 -1
  466. package/dist/switch/switch.d.mts +23 -3
  467. package/dist/switch/switch.d.mts.map +1 -1
  468. package/dist/switch/switch.mjs +2 -0
  469. package/dist/switch/switch.mjs.map +1 -1
  470. package/dist/tabs/index.d.mts +2 -0
  471. package/dist/tabs/index.d.mts.map +1 -1
  472. package/dist/tabs/index.mjs +2 -0
  473. package/dist/tabs/index.mjs.map +1 -1
  474. package/dist/tabs/tabs-context.d.mts +5 -0
  475. package/dist/tabs/tabs-context.d.mts.map +1 -1
  476. package/dist/tabs/tabs-context.mjs.map +1 -1
  477. package/dist/tabs/tabs-indicator.d.mts +17 -0
  478. package/dist/tabs/tabs-indicator.d.mts.map +1 -1
  479. package/dist/tabs/tabs-indicator.mjs +2 -0
  480. package/dist/tabs/tabs-indicator.mjs.map +1 -1
  481. package/dist/tabs/tabs-list.d.mts +19 -1
  482. package/dist/tabs/tabs-list.d.mts.map +1 -1
  483. package/dist/tabs/tabs-list.mjs +2 -0
  484. package/dist/tabs/tabs-list.mjs.map +1 -1
  485. package/dist/tabs/tabs-panel.d.mts +19 -0
  486. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  487. package/dist/tabs/tabs-panel.mjs +2 -0
  488. package/dist/tabs/tabs-panel.mjs.map +1 -1
  489. package/dist/tabs/tabs-root.d.mts +39 -5
  490. package/dist/tabs/tabs-root.d.mts.map +1 -1
  491. package/dist/tabs/tabs-root.mjs +2 -0
  492. package/dist/tabs/tabs-root.mjs.map +1 -1
  493. package/dist/tabs/tabs-tab.d.mts +22 -1
  494. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  495. package/dist/tabs/tabs-tab.mjs +2 -0
  496. package/dist/tabs/tabs-tab.mjs.map +1 -1
  497. package/dist/toast/index.d.mts +2 -0
  498. package/dist/toast/index.d.mts.map +1 -1
  499. package/dist/toast/index.mjs +2 -0
  500. package/dist/toast/index.mjs.map +1 -1
  501. package/dist/toast/toast-action.d.mts +42 -6
  502. package/dist/toast/toast-action.d.mts.map +1 -1
  503. package/dist/toast/toast-action.mjs +8 -4
  504. package/dist/toast/toast-action.mjs.map +1 -1
  505. package/dist/toast/toast-close.d.mts +16 -0
  506. package/dist/toast/toast-close.d.mts.map +1 -1
  507. package/dist/toast/toast-close.mjs +2 -0
  508. package/dist/toast/toast-close.mjs.map +1 -1
  509. package/dist/toast/toast-context.mjs.map +1 -1
  510. package/dist/toast/toast-description.d.mts +16 -1
  511. package/dist/toast/toast-description.d.mts.map +1 -1
  512. package/dist/toast/toast-description.mjs +2 -0
  513. package/dist/toast/toast-description.mjs.map +1 -1
  514. package/dist/toast/toast-queue.mjs.map +1 -1
  515. package/dist/toast/toast-root.d.mts +20 -0
  516. package/dist/toast/toast-root.d.mts.map +1 -1
  517. package/dist/toast/toast-root.mjs +2 -0
  518. package/dist/toast/toast-root.mjs.map +1 -1
  519. package/dist/toast/toast-title.d.mts +15 -1
  520. package/dist/toast/toast-title.d.mts.map +1 -1
  521. package/dist/toast/toast-title.mjs +2 -0
  522. package/dist/toast/toast-title.mjs.map +1 -1
  523. package/dist/toast/toast-viewport.d.mts +34 -5
  524. package/dist/toast/toast-viewport.d.mts.map +1 -1
  525. package/dist/toast/toast-viewport.mjs +17 -15
  526. package/dist/toast/toast-viewport.mjs.map +1 -1
  527. package/dist/toast/toast.d.mts +56 -13
  528. package/dist/toast/toast.d.mts.map +1 -1
  529. package/dist/toast/toast.mjs +4 -0
  530. package/dist/toast/toast.mjs.map +1 -1
  531. package/dist/toggle/toggle.d.mts +20 -2
  532. package/dist/toggle/toggle.d.mts.map +1 -1
  533. package/dist/toggle/toggle.mjs +2 -0
  534. package/dist/toggle/toggle.mjs.map +1 -1
  535. package/dist/toggle-group/index.d.mts +2 -0
  536. package/dist/toggle-group/index.d.mts.map +1 -1
  537. package/dist/toggle-group/index.mjs +2 -0
  538. package/dist/toggle-group/index.mjs.map +1 -1
  539. package/dist/toggle-group/toggle-group-context.d.mts +1 -0
  540. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  541. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  542. package/dist/toggle-group/toggle-group-item.d.mts +16 -0
  543. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  544. package/dist/toggle-group/toggle-group-item.mjs +2 -0
  545. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  546. package/dist/toggle-group/toggle-group-root.d.mts +73 -12
  547. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  548. package/dist/toggle-group/toggle-group-root.mjs +3 -1
  549. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  550. package/dist/toolbar/index.d.mts +2 -0
  551. package/dist/toolbar/index.d.mts.map +1 -1
  552. package/dist/toolbar/index.mjs +2 -0
  553. package/dist/toolbar/index.mjs.map +1 -1
  554. package/dist/toolbar/toolbar-root.d.mts +30 -3
  555. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  556. package/dist/toolbar/toolbar-root.mjs +2 -0
  557. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  558. package/dist/toolbar/toolbar-separator.d.mts +13 -0
  559. package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
  560. package/dist/toolbar/toolbar-separator.mjs +2 -0
  561. package/dist/toolbar/toolbar-separator.mjs.map +1 -1
  562. package/dist/tooltip/index.d.mts +2 -0
  563. package/dist/tooltip/index.d.mts.map +1 -1
  564. package/dist/tooltip/index.mjs +2 -0
  565. package/dist/tooltip/index.mjs.map +1 -1
  566. package/dist/tooltip/tooltip-arrow.d.mts +16 -0
  567. package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
  568. package/dist/tooltip/tooltip-arrow.mjs +2 -0
  569. package/dist/tooltip/tooltip-arrow.mjs.map +1 -1
  570. package/dist/tooltip/tooltip-context.d.mts +4 -0
  571. package/dist/tooltip/tooltip-context.d.mts.map +1 -1
  572. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  573. package/dist/tooltip/tooltip-popup.d.mts +24 -3
  574. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  575. package/dist/tooltip/tooltip-popup.mjs +2 -0
  576. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  577. package/dist/tooltip/tooltip-root.d.mts +24 -2
  578. package/dist/tooltip/tooltip-root.d.mts.map +1 -1
  579. package/dist/tooltip/tooltip-root.mjs +2 -0
  580. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  581. package/dist/tooltip/tooltip-trigger.d.mts +18 -1
  582. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  583. package/dist/tooltip/tooltip-trigger.mjs +2 -0
  584. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  585. package/package.json +9 -1
  586. package/skills/funstack-ui-knowledge/SKILL.md +75 -0
  587. package/dist/internal/use-superseded-rejection.mjs +0 -47
  588. package/dist/internal/use-superseded-rejection.mjs.map +0 -1
@@ -9,6 +9,10 @@ export interface ToggleGroupValueChangeDetails extends ActionDetails {
9
9
  /** Values this dispatch released. Exclusive mode: `[previous]` or `[]`. */
10
10
  readonly removed: readonly string[];
11
11
  }
12
+ /**
13
+ * State of `ToggleGroup.Root`, passed to the function forms of `className`, `style`, `children` and
14
+ * `render`.
15
+ */
12
16
  export interface ToggleGroupRootState {
13
17
  /**
14
18
  * Optimistic pressed values in document order of the Items (exclusive mode: `[value]` or `[]`,
@@ -18,34 +22,70 @@ export interface ToggleGroupRootState {
18
22
  readonly value: readonly string[];
19
23
  /** An action dispatched through this group is in flight. */
20
24
  readonly pending: boolean;
25
+ /** The `disabled` prop. */
21
26
  readonly disabled: boolean;
22
27
  /** The effective orientation: the Toolbar's when inside one. */
23
28
  readonly orientation: ToggleGroupOrientation;
24
29
  }
25
30
  interface ToggleGroupRootBaseProps extends Omit<ComponentPropsWithRef<"div">, "role" | "onKeyDown" | "onFocus" | "onBlur" | "onPointerDown" | "defaultValue" | "className" | "style" | "children"> {
26
- /** Axis of the arrow keys and `data-orientation`. Default `"horizontal"`. Ignored inside a Toolbar (dev warning). */
31
+ /**
32
+ * Axis of the arrow keys and `data-orientation`. Ignored inside a Toolbar (dev warning).
33
+ *
34
+ * @defaultValue `"horizontal"`
35
+ */
27
36
  orientation?: ToggleGroupOrientation;
28
- /** Whether arrows wrap from the last Item to the first. Default `true`. Ignored inside a Toolbar (dev warning). */
37
+ /**
38
+ * Whether arrows wrap from the last Item to the first. Ignored inside a Toolbar (dev warning).
39
+ *
40
+ * @defaultValue `true`
41
+ */
29
42
  loop?: boolean;
30
- /** Disables every Item (native `disabled`). */
43
+ /**
44
+ * Disables every Item (native `disabled`).
45
+ *
46
+ * @defaultValue `false`
47
+ */
31
48
  disabled?: boolean;
32
49
  /**
33
50
  * Render `focusgroup="toolbar …"` and, where the browser implements it, let the browser move
34
51
  * focus between the Items. Chromium 150+ only; elsewhere the JS path stays active. Ignored
35
52
  * inside a Toolbar (a nested focusgroup would split the Toolbar's sequence; dev warning).
36
- * Default `false`.
53
+ *
54
+ * @defaultValue `false`
37
55
  */
38
56
  experimental_focusgroup?: boolean;
57
+ /** Class name, or a function of the part's state that returns one. */
39
58
  className?: StateValue<string | undefined, ToggleGroupRootState>;
59
+ /** Inline style, or a function of the part's state that returns one. */
40
60
  style?: StateValue<CSSProperties | undefined, ToggleGroupRootState>;
61
+ /** Content, or a function of the part's state. */
41
62
  children?: StateValue<ReactNode, ToggleGroupRootState>;
63
+ /** Replace the default `<div>` (element form) or take over rendering (function form). */
42
64
  render?: RenderProp<ComponentPropsWithRef<"div">, ToggleGroupRootState>;
43
65
  }
66
+ /**
67
+ * Props of `ToggleGroup.Root` in multiple mode (the default): any number of Items pressed, `value`
68
+ * is a `string[]`.
69
+ *
70
+ * @see https://ui.funstack.work/components/toggle-group
71
+ */
44
72
  export interface ToggleGroupMultipleProps extends ToggleGroupRootBaseProps {
73
+ /**
74
+ * `true` switches to exclusive mode (at most one Item pressed; see `ToggleGroupExclusiveProps`).
75
+ *
76
+ * @defaultValue `false`
77
+ */
45
78
  exclusive?: false;
46
- /** Controlled pressed values. `[]` presses nothing; `undefined` means uncontrolled. Order is not significant; duplicates ignored. */
79
+ /**
80
+ * Controlled pressed values. `[]` presses nothing; `undefined` means uncontrolled. Order is not
81
+ * significant; duplicates ignored.
82
+ */
47
83
  value?: string[];
48
- /** Initial pressed values in uncontrolled mode. Default `[]`. */
84
+ /**
85
+ * Initial pressed values in uncontrolled mode.
86
+ *
87
+ * @defaultValue `[]`
88
+ */
49
89
  defaultValue?: string[];
50
90
  /**
51
91
  * Runs inside the Root's transition whenever the set of pressed Items changes. Sync or async (a
@@ -56,26 +96,45 @@ export interface ToggleGroupMultipleProps extends ToggleGroupRootBaseProps {
56
96
  * `added` / `removed` when controlled.
57
97
  */
58
98
  valueChangeAction?: ChangeAction<string[], ToggleGroupValueChangeDetails>;
59
- /** Exclusive mode only: a type error here (TypeScript's union excess-property check would let it through otherwise). */
99
+ /**
100
+ * Exclusive mode only: a type error here (TypeScript's union excess-property check would let it
101
+ * through otherwise).
102
+ */
60
103
  deselectable?: never;
61
104
  }
105
+ /**
106
+ * Props of `ToggleGroup.Root` in exclusive mode (`exclusive`): at most one Item pressed, `value` is
107
+ * `string | null`.
108
+ *
109
+ * @see https://ui.funstack.work/components/toggle-group
110
+ */
62
111
  export interface ToggleGroupExclusiveProps extends ToggleGroupRootBaseProps {
63
112
  /** At most one Item is pressed; `value` is `string | null`. */
64
113
  exclusive: true;
65
114
  /** Controlled pressed value. `null` presses nothing; `undefined` means uncontrolled. */
66
115
  value?: string | null;
67
- /** Initial pressed value in uncontrolled mode. Default `null`. */
116
+ /**
117
+ * Initial pressed value in uncontrolled mode.
118
+ *
119
+ * @defaultValue `null`
120
+ */
68
121
  defaultValue?: string | null;
69
122
  /**
70
- * Whether pressing the pressed Item releases it (`next === null`). Default `true`. With
71
- * `false` that press is a no-op and dispatches nothing; `value` stays `string | null` because
72
- * the group may start with nothing pressed, but the action is then never called with `null`.
123
+ * Whether pressing the pressed Item releases it (`next === null`). With `false` that press is a
124
+ * no-op and dispatches nothing; `value` stays `string | null` because the group may start with
125
+ * nothing pressed, but the action is then never called with `null`.
126
+ *
127
+ * @defaultValue `true`
73
128
  */
74
129
  deselectable?: boolean;
75
130
  /** See {@link ToggleGroupMultipleProps.valueChangeAction}; `next` is the pressed value or `null`. */
76
131
  valueChangeAction?: ChangeAction<string | null, ToggleGroupValueChangeDetails>;
77
132
  }
78
- /** Props of `ToggleGroup.Root`, discriminated on `exclusive`. */
133
+ /**
134
+ * Props of `ToggleGroup.Root`, discriminated on `exclusive`.
135
+ *
136
+ * @see https://ui.funstack.work/components/toggle-group
137
+ */
79
138
  export type ToggleGroupRootProps = ToggleGroupMultipleProps | ToggleGroupExclusiveProps;
80
139
  /**
81
140
  * `<div role="group">` that owns the pressed set, the transition and, when standalone, the roving
@@ -85,6 +144,8 @@ export type ToggleGroupRootProps = ToggleGroupMultipleProps | ToggleGroupExclusi
85
144
  * Owned keys (conventions 1.2): `role`, `data-orientation`, `data-pending`, `data-disabled`;
86
145
  * standalone also `onKeyDown`, `onFocus`, `onBlur`, `onPointerDown` and, with the flag,
87
146
  * `focusgroup`.
147
+ *
148
+ * @see https://ui.funstack.work/components/toggle-group
88
149
  */
89
150
  export declare function ToggleGroupRoot(props: ToggleGroupRootProps): import("react").JSX.Element;
90
151
  export declare namespace ToggleGroupRoot {
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-group-root.d.mts","names":[],"sources":["../../src/toggle-group/toggle-group-root.tsx"],"mappings":";;;;;iBA4BiB,sCAAsC;;WAE5C;;WAEA;;iBAGM;;;;;;WAMN;;WAEA;WACA;;WAEA,aAAa;;UAGd,iCAAiC,KACzC;;EAYA,cAAc;;EAEd;;EAEA;;;;;;;EAOA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,8BAA8B;;iBAGnC,iCAAiC;EAChD;;EAEA;;EAEA;;;;;;;;;EASA,oBAAoB,uBAAuB;;EAE3C;;iBAGe,kCAAkC;;EAEjD;;EAEA;;EAEA;;;;;;EAMA;;EAEA,oBAAoB,4BAA4B;;;YAItC,uBAAuB,2BAA2B;;;;;;;;;;wBAkC9C,gBAAgB,OAAO,uCAAoB,IAAA;yBAA3C"}
1
+ {"version":3,"file":"toggle-group-root.d.mts","names":[],"sources":["../../src/toggle-group/toggle-group-root.tsx"],"mappings":";;;;;iBA4BiB,sCAAsC;;WAE5C;;WAEA;;;;;;iBAOM;;;;;;WAMN;;WAEA;;WAEA;;WAEA,aAAa;;UAGd,iCAAiC,KACzC;;;;;;EAgBA,cAAc;;;;;;EAMd;;;;;;EAMA;;;;;;;;EAQA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,8BAA8B;;;;;;;;iBASnC,iCAAiC;;;;;;EAMhD;;;;;EAKA;;;;;;EAMA;;;;;;;;;EASA,oBAAoB,uBAAuB;;;;;EAK3C;;;;;;;;iBASe,kCAAkC;;EAEjD;;EAEA;;;;;;EAMA;;;;;;;;EAQA;;EAEA,oBAAoB,4BAA4B;;;;;;;YAQtC,uBAAuB,2BAA2B;;;;;;;;;;;;wBAoC9C,gBAAgB,OAAO,uCAAoB,IAAA;yBAA3C"}
@@ -34,6 +34,8 @@ const NO_LAYOUT = {
34
34
  * Owned keys (conventions 1.2): `role`, `data-orientation`, `data-pending`, `data-disabled`;
35
35
  * standalone also `onKeyDown`, `onFocus`, `onBlur`, `onPointerDown` and, with the flag,
36
36
  * `focusgroup`.
37
+ *
38
+ * @see https://ui.funstack.work/components/toggle-group
37
39
  */
38
40
  function ToggleGroupRoot(props) {
39
41
  const { exclusive = false, value, defaultValue, valueChangeAction, deselectable = true, orientation: orientationProp, loop: loopProp, disabled = false, experimental_focusgroup: focusgroupProp, className, style, children, render, ...rest } = props;
@@ -69,7 +71,7 @@ function ToggleGroupRoot(props) {
69
71
  ...details.added.length > 0 ? ["fsui-toggle-group-press"] : [],
70
72
  ...details.removed.length > 0 ? ["fsui-toggle-group-release"] : []
71
73
  ],
72
- reducer: (prev, _next, details) => applyPatch(prev, details),
74
+ reducer: mountExclusive ? void 0 : (prev, _next, details) => applyPatch(prev, details),
73
75
  warn: {
74
76
  component: "ToggleGroup.Root",
75
77
  prop: "value"
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-group-root.mjs","names":[],"sources":["../../src/toggle-group/toggle-group-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { compareDocumentOrder } from \"../internal/dom-order.js\";\nimport { useToolbarContext } from \"../internal/toolbar-context.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type { ActionDetails, ChangeAction, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useItemOrder } from \"../internal/use-item-order.js\";\nimport type { ItemLayout } from \"../internal/use-item-order.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useNativeFocusgroup } from \"../internal/use-native-focusgroup.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useRovingFocus } from \"../internal/use-roving-focus.js\";\nimport { useValueSet } from \"../internal/use-value-set.js\";\nimport { applyPatch, EMPTY_SET, arraysEqual, sortByOrder } from \"../internal/value-set.js\";\nimport type { SetPatch, ValueSet } from \"../internal/value-set.js\";\nimport { ToggleGroupContext } from \"./toggle-group-context.js\";\nimport type { ToggleGroupContextValue, ToggleGroupOrientation } from \"./toggle-group-context.js\";\n\nexport type { ToggleGroupOrientation } from \"./toggle-group-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** Details passed as the second argument of `valueChangeAction`, in both modes. */\nexport interface ToggleGroupValueChangeDetails extends ActionDetails {\n /** Values this dispatch pressed (document order of their Items). Exclusive mode: `[next]` or `[]`. */\n readonly added: readonly string[];\n /** Values this dispatch released. Exclusive mode: `[previous]` or `[]`. */\n readonly removed: readonly string[];\n}\n\nexport interface ToggleGroupRootState {\n /**\n * Optimistic pressed values in document order of the Items (exclusive mode: `[value]` or `[]`,\n * so one state shape serves both modes). The server render and the first client render use the\n * 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 readonly disabled: boolean;\n /** The effective orientation: the Toolbar's when inside one. */\n readonly orientation: ToggleGroupOrientation;\n}\n\ninterface ToggleGroupRootBaseProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n | \"role\"\n | \"onKeyDown\"\n | \"onFocus\"\n | \"onBlur\"\n | \"onPointerDown\"\n | \"defaultValue\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /** Axis of the arrow keys and `data-orientation`. Default `\"horizontal\"`. Ignored inside a Toolbar (dev warning). */\n orientation?: ToggleGroupOrientation;\n /** Whether arrows wrap from the last Item to the first. Default `true`. Ignored inside a Toolbar (dev warning). */\n loop?: boolean;\n /** Disables every Item (native `disabled`). */\n disabled?: boolean;\n /**\n * Render `focusgroup=\"toolbar …\"` and, where the browser implements it, let the browser move\n * focus between the Items. Chromium 150+ only; elsewhere the JS path stays active. Ignored\n * inside a Toolbar (a nested focusgroup would split the Toolbar's sequence; dev warning).\n * Default `false`.\n */\n experimental_focusgroup?: boolean;\n className?: StateValue<string | undefined, ToggleGroupRootState>;\n style?: StateValue<CSSProperties | undefined, ToggleGroupRootState>;\n children?: StateValue<ReactNode, ToggleGroupRootState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, ToggleGroupRootState>;\n}\n\nexport interface ToggleGroupMultipleProps extends ToggleGroupRootBaseProps {\n exclusive?: false;\n /** Controlled pressed values. `[]` presses nothing; `undefined` means uncontrolled. Order is not significant; duplicates ignored. */\n value?: string[];\n /** Initial pressed values in uncontrolled mode. Default `[]`. */\n defaultValue?: string[];\n /**\n * Runs inside the Root's transition whenever the set of pressed Items changes. Sync or async (a\n * Server Function may be passed directly); rejections reach the nearest Error Boundary and roll\n * the change back. `next` is the whole set as a fresh array in document order;\n * `details.added` / `details.removed` say what changed. A `setState` after your own `await` is\n * not a Transition update; wrap it in `startTransition`. Prefer a functional update keyed by\n * `added` / `removed` when controlled.\n */\n valueChangeAction?: ChangeAction<string[], ToggleGroupValueChangeDetails>;\n /** Exclusive mode only: a type error here (TypeScript's union excess-property check would let it through otherwise). */\n deselectable?: never;\n}\n\nexport interface ToggleGroupExclusiveProps extends ToggleGroupRootBaseProps {\n /** At most one Item is pressed; `value` is `string | null`. */\n exclusive: true;\n /** Controlled pressed value. `null` presses nothing; `undefined` means uncontrolled. */\n value?: string | null;\n /** Initial pressed value in uncontrolled mode. Default `null`. */\n defaultValue?: string | null;\n /**\n * Whether pressing the pressed Item releases it (`next === null`). Default `true`. With\n * `false` that press is a no-op and dispatches nothing; `value` stays `string | null` because\n * the group may start with nothing pressed, but the action is then never called with `null`.\n */\n deselectable?: boolean;\n /** See {@link ToggleGroupMultipleProps.valueChangeAction}; `next` is the pressed value or `null`. */\n valueChangeAction?: ChangeAction<string | null, ToggleGroupValueChangeDetails>;\n}\n\n/** Props of `ToggleGroup.Root`, discriminated on `exclusive`. */\nexport type ToggleGroupRootProps = ToggleGroupMultipleProps | ToggleGroupExclusiveProps;\n\ntype GroupValue = string[] | string | null;\n\n/** Both variants as one shape, for the implementation. */\ninterface InternalProps extends ToggleGroupRootBaseProps {\n exclusive?: boolean;\n value?: GroupValue;\n defaultValue?: GroupValue;\n deselectable?: boolean;\n valueChangeAction?: ChangeAction<GroupValue, ToggleGroupValueChangeDetails>;\n}\n\n/** Standalone entry (design 6.2): the first pressed item, else the first item (radio-like). */\nfunction pressedFirst(items: readonly HTMLElement[]): HTMLElement | undefined {\n return items.find((el) => el.getAttribute(\"aria-pressed\") === \"true\") ?? items[0];\n}\n\n/** The Items' document order and their disabled values, as of the Root's last commit. */\ninterface ToggleGroupLayout extends ItemLayout {\n readonly disabled: readonly string[];\n}\n\nconst NO_LAYOUT: ToggleGroupLayout = { order: [], disabled: [] };\n\n/**\n * `<div role=\"group\">` that owns the pressed set, the transition and, when standalone, the roving\n * focus over its Items (design/components/toggle-group.md 16.2). Inside a `Toolbar.Root` it runs\n * no engine of its own: its Items are members of the Toolbar's sequence.\n *\n * Owned keys (conventions 1.2): `role`, `data-orientation`, `data-pending`, `data-disabled`;\n * standalone also `onKeyDown`, `onFocus`, `onBlur`, `onPointerDown` and, with the flag,\n * `focusgroup`.\n */\nexport function ToggleGroupRoot(props: ToggleGroupRootProps) {\n const {\n exclusive = false,\n value,\n defaultValue,\n valueChangeAction,\n deselectable = true,\n orientation: orientationProp,\n loop: loopProp,\n disabled = false,\n experimental_focusgroup: focusgroupProp,\n className,\n style,\n children,\n render,\n ...rest\n } = props as InternalProps;\n\n const toolbar = useToolbarContext();\n const inToolbar = toolbar !== null;\n useDevWarning(\n inToolbar && orientationProp !== undefined,\n isDev &&\n \"ToggleGroup.Root: `orientation` is ignored inside a Toolbar.Root; the group follows the \" +\n \"Toolbar's orientation.\",\n );\n useDevWarning(\n inToolbar && loopProp !== undefined,\n isDev &&\n \"ToggleGroup.Root: `loop` is ignored inside a Toolbar.Root; the Toolbar's `loop` applies.\",\n );\n useDevWarning(\n inToolbar && focusgroupProp === true,\n isDev &&\n \"ToggleGroup.Root: `experimental_focusgroup` is ignored inside a Toolbar.Root. A nested \" +\n \"focusgroup would split the Toolbar's single Tab stop; set the flag on the Toolbar.Root.\",\n );\n const orientation: ToggleGroupOrientation =\n toolbar?.orientation ?? orientationProp ?? \"horizontal\";\n const loop = loopProp ?? true;\n const flag = !inToolbar && focusgroupProp === true;\n\n // The mode is fixed at mount (design 3.1).\n const [mountExclusive] = useState(exclusive);\n useDevWarning(\n mountExclusive !== exclusive,\n isDev &&\n \"ToggleGroup.Root: `exclusive` changed after mount. Switching between exclusive and \" +\n \"multiple mode is not supported; the group keeps the mode it mounted with.\",\n );\n\n const controlledSet = useValueSet(value);\n const defaultSet = useValueSet(defaultValue);\n\n // Item registration (design 16.2): element → value, written from the Items' callback refs.\n const registry = useRef(new Map<HTMLElement, string>());\n const registerItem = useCallback((element: HTMLElement, itemValue: string) => {\n registry.current.set(element, itemValue);\n return () => {\n registry.current.delete(element);\n };\n }, []);\n const sortedItems = (): [HTMLElement, string][] =>\n [...registry.current].sort(([a], [b]) => compareDocumentOrder(a, b));\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 sortedItems().map(([, v]) => v),\n );\n\n const { optimistic, committed, pending, dispatch } = useControllableAction<\n ValueSet,\n ToggleGroupValueChangeDetails\n >({\n controlled: controlledSet,\n defaultValue: defaultSet,\n initialValue: EMPTY_SET,\n action:\n valueChangeAction &&\n ((next, details) =>\n valueChangeAction(mountExclusive ? ([...next][0] ?? null) : sortByDocument(next), details)),\n transitionTypes: (_next, _prev, details) => [\n ...transitionTypes(\"toggle-group\"),\n ...(details.added.length > 0 ? [\"fsui-toggle-group-press\"] : []),\n ...(details.removed.length > 0 ? [\"fsui-toggle-group-release\"] : []),\n ],\n reducer: (prev, _next, details) => applyPatch(prev, details),\n warn: { component: \"ToggleGroup.Root\", prop: \"value\" },\n });\n\n // Read by the stable `toggle`: a handler only runs against the committed UI.\n const latest = useLatest({ optimistic, exclusive: mountExclusive, deselectable });\n const toggle = useCallback(\n (itemValue: string, event: Event) => {\n const { optimistic, exclusive, deselectable } = latest.current;\n let patch: SetPatch;\n if (optimistic.has(itemValue)) {\n // Exclusive and not deselectable: pressing the pressed Item is a no-op (design 5.2).\n if (exclusive && !deselectable) return;\n patch = { added: [], removed: [itemValue] };\n } else {\n patch = { added: [itemValue], removed: exclusive ? [...optimistic] : [] };\n }\n dispatch(applyPatch(optimistic, patch), createActionDetails(event, patch));\n },\n [dispatch, latest],\n );\n\n // `state.value` is in document order; `focusgroupstart` also renders from which values have a\n // disabled Item.\n const { layout, renderedValue } = useItemOrder<ToggleGroupLayout>({\n optimistic,\n initial: NO_LAYOUT,\n read: () => {\n const items = sortedItems();\n return {\n order: items.map(([, v]) => v),\n disabled: items.filter(([el]) => el.matches(\":disabled\")).map(([, v]) => v),\n };\n },\n changed: (prev, next) =>\n flag && (!arraysEqual(next.order, prev.order) || !arraysEqual(next.disabled, prev.disabled)),\n duplicateMessage:\n isDev &&\n ((duplicate) =>\n `ToggleGroup.Item: two Items share the value \"${duplicate}\" in one ToggleGroup.Root. ` +\n \"Item values must be unique; both follow the same pressed state.\"),\n });\n\n const native = useNativeFocusgroup(flag);\n\n const focusgroupStartValue =\n flag && !disabled\n ? (renderedValue.find(\n (v) =>\n (layout.order.length === 0 || layout.order.includes(v)) && !layout.disabled.includes(v),\n ) ?? null)\n : null;\n\n const rootRef = useRef<HTMLElement | null>(null);\n const roving = useRovingFocus(rootRef, {\n enabled: !inToolbar,\n orientation,\n loop,\n native,\n entry: pressedFirst,\n memory: false,\n });\n\n const context = useMemo<ToggleGroupContextValue>(\n () => ({\n optimistic,\n committed,\n pending,\n disabled,\n orientation,\n focusgroupStartValue,\n toggle,\n registerItem,\n }),\n [\n optimistic,\n committed,\n pending,\n disabled,\n orientation,\n focusgroupStartValue,\n toggle,\n registerItem,\n ],\n );\n\n const state: ToggleGroupRootState = { value: renderedValue, pending, disabled, orientation };\n\n const focusgroup = flag\n ? `toolbar ${orientation === \"vertical\" ? \"block\" : \"inline\"} ${loop ? \"wrap\" : \"nowrap\"} nomemory`\n : undefined;\n\n const element = useRender<ComponentPropsWithRef<\"div\">, ToggleGroupRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n role: \"group\",\n \"data-orientation\": orientation,\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n // Inside a Toolbar the group has no engine: the keys are not owned there.\n ...(!inToolbar && roving),\n ...(focusgroup !== undefined && { focusgroup }),\n },\n ref: rootRef,\n });\n\n return <ToggleGroupContext value={context}>{element}</ToggleGroupContext>;\n}\n\nToggleGroupRoot.displayName = \"ToggleGroupRoot\";\n"],"mappings":"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"}
1
+ {"version":3,"file":"toggle-group-root.mjs","names":[],"sources":["../../src/toggle-group/toggle-group-root.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { compareDocumentOrder } from \"../internal/dom-order.js\";\nimport { useToolbarContext } from \"../internal/toolbar-context.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type { ActionDetails, ChangeAction, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useItemOrder } from \"../internal/use-item-order.js\";\nimport type { ItemLayout } from \"../internal/use-item-order.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useNativeFocusgroup } from \"../internal/use-native-focusgroup.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useRovingFocus } from \"../internal/use-roving-focus.js\";\nimport { useValueSet } from \"../internal/use-value-set.js\";\nimport { applyPatch, EMPTY_SET, arraysEqual, sortByOrder } from \"../internal/value-set.js\";\nimport type { SetPatch, ValueSet } from \"../internal/value-set.js\";\nimport { ToggleGroupContext } from \"./toggle-group-context.js\";\nimport type { ToggleGroupContextValue, ToggleGroupOrientation } from \"./toggle-group-context.js\";\n\nexport type { ToggleGroupOrientation } from \"./toggle-group-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** Details passed as the second argument of `valueChangeAction`, in both modes. */\nexport interface ToggleGroupValueChangeDetails extends ActionDetails {\n /** Values this dispatch pressed (document order of their Items). Exclusive mode: `[next]` or `[]`. */\n readonly added: readonly string[];\n /** Values this dispatch released. Exclusive mode: `[previous]` or `[]`. */\n readonly removed: readonly string[];\n}\n\n/**\n * State of `ToggleGroup.Root`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface ToggleGroupRootState {\n /**\n * Optimistic pressed values in document order of the Items (exclusive mode: `[value]` or `[]`,\n * so one state shape serves both modes). The server render and the first client render use the\n * 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 /** The effective orientation: the Toolbar's when inside one. */\n readonly orientation: ToggleGroupOrientation;\n}\n\ninterface ToggleGroupRootBaseProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n | \"role\"\n | \"onKeyDown\"\n | \"onFocus\"\n | \"onBlur\"\n | \"onPointerDown\"\n | \"defaultValue\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Axis of the arrow keys and `data-orientation`. Ignored inside a Toolbar (dev warning).\n *\n * @defaultValue `\"horizontal\"`\n */\n orientation?: ToggleGroupOrientation;\n /**\n * Whether arrows wrap from the last Item to the first. Ignored inside a Toolbar (dev warning).\n *\n * @defaultValue `true`\n */\n loop?: boolean;\n /**\n * Disables every Item (native `disabled`).\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /**\n * Render `focusgroup=\"toolbar …\"` and, where the browser implements it, let the browser move\n * focus between the Items. Chromium 150+ only; elsewhere the JS path stays active. Ignored\n * inside a Toolbar (a nested focusgroup would split the Toolbar's sequence; dev warning).\n *\n * @defaultValue `false`\n */\n experimental_focusgroup?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, ToggleGroupRootState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, ToggleGroupRootState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, ToggleGroupRootState>;\n /** Replace the default `<div>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"div\">, ToggleGroupRootState>;\n}\n\n/**\n * Props of `ToggleGroup.Root` in multiple mode (the default): any number of Items pressed, `value`\n * is a `string[]`.\n *\n * @see https://ui.funstack.work/components/toggle-group\n */\nexport interface ToggleGroupMultipleProps extends ToggleGroupRootBaseProps {\n /**\n * `true` switches to exclusive mode (at most one Item pressed; see `ToggleGroupExclusiveProps`).\n *\n * @defaultValue `false`\n */\n exclusive?: false;\n /**\n * Controlled pressed values. `[]` presses nothing; `undefined` means uncontrolled. Order is not\n * significant; duplicates ignored.\n */\n value?: string[];\n /**\n * Initial pressed values in uncontrolled mode.\n *\n * @defaultValue `[]`\n */\n defaultValue?: string[];\n /**\n * Runs inside the Root's transition whenever the set of pressed Items changes. Sync or async (a\n * Server Function may be passed directly); rejections reach the nearest Error Boundary and roll\n * the change back. `next` is the whole set as a fresh array in document order;\n * `details.added` / `details.removed` say what changed. A `setState` after your own `await` is\n * not a Transition update; wrap it in `startTransition`. Prefer a functional update keyed by\n * `added` / `removed` when controlled.\n */\n valueChangeAction?: ChangeAction<string[], ToggleGroupValueChangeDetails>;\n /**\n * Exclusive mode only: a type error here (TypeScript's union excess-property check would let it\n * through otherwise).\n */\n deselectable?: never;\n}\n\n/**\n * Props of `ToggleGroup.Root` in exclusive mode (`exclusive`): at most one Item pressed, `value` is\n * `string | null`.\n *\n * @see https://ui.funstack.work/components/toggle-group\n */\nexport interface ToggleGroupExclusiveProps extends ToggleGroupRootBaseProps {\n /** At most one Item is pressed; `value` is `string | null`. */\n exclusive: true;\n /** Controlled pressed value. `null` presses nothing; `undefined` means uncontrolled. */\n value?: string | null;\n /**\n * Initial pressed value in uncontrolled mode.\n *\n * @defaultValue `null`\n */\n defaultValue?: string | null;\n /**\n * Whether pressing the pressed Item releases it (`next === null`). With `false` that press is a\n * no-op and dispatches nothing; `value` stays `string | null` because the group may start with\n * nothing pressed, but the action is then never called with `null`.\n *\n * @defaultValue `true`\n */\n deselectable?: boolean;\n /** See {@link ToggleGroupMultipleProps.valueChangeAction}; `next` is the pressed value or `null`. */\n valueChangeAction?: ChangeAction<string | null, ToggleGroupValueChangeDetails>;\n}\n\n/**\n * Props of `ToggleGroup.Root`, discriminated on `exclusive`.\n *\n * @see https://ui.funstack.work/components/toggle-group\n */\nexport type ToggleGroupRootProps = ToggleGroupMultipleProps | ToggleGroupExclusiveProps;\n\ntype GroupValue = string[] | string | null;\n\n/** Both variants as one shape, for the implementation. */\ninterface InternalProps extends ToggleGroupRootBaseProps {\n exclusive?: boolean;\n value?: GroupValue;\n defaultValue?: GroupValue;\n deselectable?: boolean;\n valueChangeAction?: ChangeAction<GroupValue, ToggleGroupValueChangeDetails>;\n}\n\n/** Standalone entry (design 6.2): the first pressed item, else the first item (radio-like). */\nfunction pressedFirst(items: readonly HTMLElement[]): HTMLElement | undefined {\n return items.find((el) => el.getAttribute(\"aria-pressed\") === \"true\") ?? items[0];\n}\n\n/** The Items' document order and their disabled values, as of the Root's last commit. */\ninterface ToggleGroupLayout extends ItemLayout {\n readonly disabled: readonly string[];\n}\n\nconst NO_LAYOUT: ToggleGroupLayout = { order: [], disabled: [] };\n\n/**\n * `<div role=\"group\">` that owns the pressed set, the transition and, when standalone, the roving\n * focus over its Items (design/components/toggle-group.md 16.2). Inside a `Toolbar.Root` it runs\n * no engine of its own: its Items are members of the Toolbar's sequence.\n *\n * Owned keys (conventions 1.2): `role`, `data-orientation`, `data-pending`, `data-disabled`;\n * standalone also `onKeyDown`, `onFocus`, `onBlur`, `onPointerDown` and, with the flag,\n * `focusgroup`.\n *\n * @see https://ui.funstack.work/components/toggle-group\n */\nexport function ToggleGroupRoot(props: ToggleGroupRootProps) {\n const {\n exclusive = false,\n value,\n defaultValue,\n valueChangeAction,\n deselectable = true,\n orientation: orientationProp,\n loop: loopProp,\n disabled = false,\n experimental_focusgroup: focusgroupProp,\n className,\n style,\n children,\n render,\n ...rest\n } = props as InternalProps;\n\n const toolbar = useToolbarContext();\n const inToolbar = toolbar !== null;\n useDevWarning(\n inToolbar && orientationProp !== undefined,\n isDev &&\n \"ToggleGroup.Root: `orientation` is ignored inside a Toolbar.Root; the group follows the \" +\n \"Toolbar's orientation.\",\n );\n useDevWarning(\n inToolbar && loopProp !== undefined,\n isDev &&\n \"ToggleGroup.Root: `loop` is ignored inside a Toolbar.Root; the Toolbar's `loop` applies.\",\n );\n useDevWarning(\n inToolbar && focusgroupProp === true,\n isDev &&\n \"ToggleGroup.Root: `experimental_focusgroup` is ignored inside a Toolbar.Root. A nested \" +\n \"focusgroup would split the Toolbar's single Tab stop; set the flag on the Toolbar.Root.\",\n );\n const orientation: ToggleGroupOrientation =\n toolbar?.orientation ?? orientationProp ?? \"horizontal\";\n const loop = loopProp ?? true;\n const flag = !inToolbar && focusgroupProp === true;\n\n // The mode is fixed at mount (design 3.1).\n const [mountExclusive] = useState(exclusive);\n useDevWarning(\n mountExclusive !== exclusive,\n isDev &&\n \"ToggleGroup.Root: `exclusive` changed after mount. Switching between exclusive and \" +\n \"multiple mode is not supported; the group keeps the mode it mounted with.\",\n );\n\n const controlledSet = useValueSet(value);\n const defaultSet = useValueSet(defaultValue);\n\n // Item registration (design 16.2): element → value, written from the Items' callback refs.\n const registry = useRef(new Map<HTMLElement, string>());\n const registerItem = useCallback((element: HTMLElement, itemValue: string) => {\n registry.current.set(element, itemValue);\n return () => {\n registry.current.delete(element);\n };\n }, []);\n const sortedItems = (): [HTMLElement, string][] =>\n [...registry.current].sort(([a], [b]) => compareDocumentOrder(a, b));\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 sortedItems().map(([, v]) => v),\n );\n\n const { optimistic, committed, pending, dispatch } = useControllableAction<\n ValueSet,\n ToggleGroupValueChangeDetails\n >({\n controlled: controlledSet,\n defaultValue: defaultSet,\n initialValue: EMPTY_SET,\n action:\n valueChangeAction &&\n ((next, details) =>\n valueChangeAction(mountExclusive ? ([...next][0] ?? null) : sortByDocument(next), details)),\n transitionTypes: (_next, _prev, details) => [\n ...transitionTypes(\"toggle-group\"),\n ...(details.added.length > 0 ? [\"fsui-toggle-group-press\"] : []),\n ...(details.removed.length > 0 ? [\"fsui-toggle-group-release\"] : []),\n ],\n // Multiple: a patch, re-based on the committed set; it is also how the uncontrolled commit is\n // folded over the resolved dispatches (#150). Exclusive is single-valued: no reducer, so the\n // optimistic value is `next` and the latest dispatch commits it, like Tabs.\n reducer: mountExclusive ? undefined : (prev, _next, details) => applyPatch(prev, details),\n warn: { component: \"ToggleGroup.Root\", prop: \"value\" },\n });\n\n // Read by the stable `toggle`: a handler only runs against the committed UI.\n const latest = useLatest({ optimistic, exclusive: mountExclusive, deselectable });\n const toggle = useCallback(\n (itemValue: string, event: Event) => {\n const { optimistic, exclusive, deselectable } = latest.current;\n let patch: SetPatch;\n if (optimistic.has(itemValue)) {\n // Exclusive and not deselectable: pressing the pressed Item is a no-op (design 5.2).\n if (exclusive && !deselectable) return;\n patch = { added: [], removed: [itemValue] };\n } else {\n patch = { added: [itemValue], removed: exclusive ? [...optimistic] : [] };\n }\n dispatch(applyPatch(optimistic, patch), createActionDetails(event, patch));\n },\n [dispatch, latest],\n );\n\n // `state.value` is in document order; `focusgroupstart` also renders from which values have a\n // disabled Item.\n const { layout, renderedValue } = useItemOrder<ToggleGroupLayout>({\n optimistic,\n initial: NO_LAYOUT,\n read: () => {\n const items = sortedItems();\n return {\n order: items.map(([, v]) => v),\n disabled: items.filter(([el]) => el.matches(\":disabled\")).map(([, v]) => v),\n };\n },\n changed: (prev, next) =>\n flag && (!arraysEqual(next.order, prev.order) || !arraysEqual(next.disabled, prev.disabled)),\n duplicateMessage:\n isDev &&\n ((duplicate) =>\n `ToggleGroup.Item: two Items share the value \"${duplicate}\" in one ToggleGroup.Root. ` +\n \"Item values must be unique; both follow the same pressed state.\"),\n });\n\n const native = useNativeFocusgroup(flag);\n\n const focusgroupStartValue =\n flag && !disabled\n ? (renderedValue.find(\n (v) =>\n (layout.order.length === 0 || layout.order.includes(v)) && !layout.disabled.includes(v),\n ) ?? null)\n : null;\n\n const rootRef = useRef<HTMLElement | null>(null);\n const roving = useRovingFocus(rootRef, {\n enabled: !inToolbar,\n orientation,\n loop,\n native,\n entry: pressedFirst,\n memory: false,\n });\n\n const context = useMemo<ToggleGroupContextValue>(\n () => ({\n optimistic,\n committed,\n pending,\n disabled,\n orientation,\n focusgroupStartValue,\n toggle,\n registerItem,\n }),\n [\n optimistic,\n committed,\n pending,\n disabled,\n orientation,\n focusgroupStartValue,\n toggle,\n registerItem,\n ],\n );\n\n const state: ToggleGroupRootState = { value: renderedValue, pending, disabled, orientation };\n\n const focusgroup = flag\n ? `toolbar ${orientation === \"vertical\" ? \"block\" : \"inline\"} ${loop ? \"wrap\" : \"nowrap\"} nomemory`\n : undefined;\n\n const element = useRender<ComponentPropsWithRef<\"div\">, ToggleGroupRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n role: \"group\",\n \"data-orientation\": orientation,\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n // Inside a Toolbar the group has no engine: the keys are not owned there.\n ...(!inToolbar && roving),\n ...(focusgroup !== undefined && { focusgroup }),\n },\n ref: rootRef,\n });\n\n return <ToggleGroupContext value={context}>{element}</ToggleGroupContext>;\n}\n\nToggleGroupRoot.displayName = \"ToggleGroupRoot\";\n"],"mappings":"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"}
@@ -7,6 +7,8 @@ import { ToolbarSeparator, ToolbarSeparatorProps, ToolbarSeparatorState } from "
7
7
  * arrow keys over its focusable descendants, and `Separator` (hr). Any focusable element is an
8
8
  * item: no wrapper parts. A command button is `Button` from `@funstack/ui/button`, which stays
9
9
  * focusable when disabled inside a Toolbar (design/components/button.md 7.3).
10
+ *
11
+ * @see https://ui.funstack.work/components/toolbar
10
12
  */
11
13
  export declare const Toolbar: {
12
14
  readonly Root: typeof ToolbarRoot;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/toolbar/index.ts"],"mappings":";;;;;;;;;;qBAWa;WACX,aAAI;WACJ,kBAAS"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/toolbar/index.ts"],"mappings":";;;;;;;;;;;;qBAaa;WACX,aAAI;WACJ,kBAAS"}
@@ -6,6 +6,8 @@ import { ToolbarSeparator } from "./toolbar-separator.mjs";
6
6
  * arrow keys over its focusable descendants, and `Separator` (hr). Any focusable element is an
7
7
  * item: no wrapper parts. A command button is `Button` from `@funstack/ui/button`, which stays
8
8
  * focusable when disabled inside a Toolbar (design/components/button.md 7.3).
9
+ *
10
+ * @see https://ui.funstack.work/components/toolbar
9
11
  */
10
12
  const Toolbar = {
11
13
  Root: ToolbarRoot,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/toolbar/index.ts"],"sourcesContent":["// Ships the platform attribute typings with this subpath (conventions 7.4). Type-only.\nimport \"../internal/platform-attributes.js\";\nimport { ToolbarRoot } from \"./toolbar-root.js\";\nimport { ToolbarSeparator } from \"./toolbar-separator.js\";\n\n/**\n * Toolbar (WAI-ARIA APG Toolbar pattern): `Root` (div role=\"toolbar\") with one Tab stop and\n * arrow keys over its focusable descendants, and `Separator` (hr). Any focusable element is an\n * item: no wrapper parts. A command button is `Button` from `@funstack/ui/button`, which stays\n * focusable when disabled inside a Toolbar (design/components/button.md 7.3).\n */\nexport const Toolbar = {\n Root: ToolbarRoot,\n Separator: ToolbarSeparator,\n} as const;\n\nexport type { ToolbarRootProps, ToolbarRootState, ToolbarOrientation } from \"./toolbar-root.js\";\nexport type { ToolbarSeparatorProps, ToolbarSeparatorState } from \"./toolbar-separator.js\";\n"],"mappings":";;;;;;;;;AAWA,MAAa,UAAU;CACrB,MAAM;CACN,WAAW;AACb"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/toolbar/index.ts"],"sourcesContent":["// Ships the platform attribute typings with this subpath (conventions 7.4). Type-only.\nimport \"../internal/platform-attributes.js\";\nimport { ToolbarRoot } from \"./toolbar-root.js\";\nimport { ToolbarSeparator } from \"./toolbar-separator.js\";\n\n/**\n * Toolbar (WAI-ARIA APG Toolbar pattern): `Root` (div role=\"toolbar\") with one Tab stop and\n * arrow keys over its focusable descendants, and `Separator` (hr). Any focusable element is an\n * item: no wrapper parts. A command button is `Button` from `@funstack/ui/button`, which stays\n * focusable when disabled inside a Toolbar (design/components/button.md 7.3).\n *\n * @see https://ui.funstack.work/components/toolbar\n */\nexport const Toolbar = {\n Root: ToolbarRoot,\n Separator: ToolbarSeparator,\n} as const;\n\nexport type { ToolbarRootProps, ToolbarRootState, ToolbarOrientation } from \"./toolbar-root.js\";\nexport type { ToolbarSeparatorProps, ToolbarSeparatorState } from \"./toolbar-separator.js\";\n"],"mappings":";;;;;;;;;;;AAaA,MAAa,UAAU;CACrB,MAAM;CACN,WAAW;AACb"}
@@ -1,24 +1,49 @@
1
1
  import { Orientation, RenderProp, StateValue } from "../internal/types.mjs";
2
2
  import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
3
  //#region src/toolbar/toolbar-root.d.ts
4
+ /** The arrow-key axis of a Toolbar. */
4
5
  export type ToolbarOrientation = Orientation;
6
+ /**
7
+ * State of `Toolbar.Root`, passed to the function forms of `className`, `style`, `children` and
8
+ * `render`.
9
+ */
5
10
  export interface ToolbarRootState {
11
+ /** The `orientation` prop. */
6
12
  readonly orientation: ToolbarOrientation;
7
13
  }
14
+ /**
15
+ * Props of `Toolbar.Root`.
16
+ *
17
+ * @see https://ui.funstack.work/components/toolbar
18
+ */
8
19
  export interface ToolbarRootProps extends Omit<ComponentPropsWithRef<"div">, "role" | "aria-orientation" | "onKeyDown" | "onFocus" | "onBlur" | "onPointerDown" | "className" | "style" | "children"> {
9
- /** Axis of the arrow keys; also `aria-orientation`. Default `"horizontal"`. */
20
+ /**
21
+ * Axis of the arrow keys; also `aria-orientation`.
22
+ *
23
+ * @defaultValue `"horizontal"`
24
+ */
10
25
  orientation?: ToolbarOrientation;
11
- /** Whether arrows wrap from the last item to the first. Default `true`. */
26
+ /**
27
+ * Whether arrows wrap from the last item to the first.
28
+ *
29
+ * @defaultValue `true`
30
+ */
12
31
  loop?: boolean;
13
32
  /**
14
33
  * Render `focusgroup="toolbar …"` and, where the browser implements it, let the browser handle
15
34
  * arrow keys, Home and End and the single Tab stop. Chromium 150+ only; elsewhere the JS path
16
- * stays active. Default `false`.
35
+ * stays active.
36
+ *
37
+ * @defaultValue `false`
17
38
  */
18
39
  experimental_focusgroup?: boolean;
40
+ /** Class name, or a function of the part's state that returns one. */
19
41
  className?: StateValue<string | undefined, ToolbarRootState>;
42
+ /** Inline style, or a function of the part's state that returns one. */
20
43
  style?: StateValue<CSSProperties | undefined, ToolbarRootState>;
44
+ /** Content, or a function of the part's state. */
21
45
  children?: StateValue<ReactNode, ToolbarRootState>;
46
+ /** Replace the default `<div>` (element form) or take over rendering (function form). */
22
47
  render?: RenderProp<ComponentPropsWithRef<"div">, ToolbarRootState>;
23
48
  }
24
49
  /**
@@ -29,6 +54,8 @@ export interface ToolbarRootProps extends Omit<ComponentPropsWithRef<"div">, "ro
29
54
  *
30
55
  * Owned keys (conventions 1.2): `role`, `aria-orientation`, `data-orientation`, `onKeyDown`,
31
56
  * `onFocus`, `onBlur`, `onPointerDown`, and `focusgroup` while the flag is on.
57
+ *
58
+ * @see https://ui.funstack.work/components/toolbar
32
59
  */
33
60
  export declare function ToolbarRoot({ orientation, loop, experimental_focusgroup, className, style, children, render, ...rest }: ToolbarRootProps): import("react").JSX.Element;
34
61
  export declare namespace ToolbarRoot {
@@ -1 +1 @@
1
- {"version":3,"file":"toolbar-root.d.mts","names":[],"sources":["../../src/toolbar/toolbar-root.tsx"],"mappings":";;;YAUY,qBAAqB;iBAEhB;WACN,aAAa;;iBAGP,yBAAyB,KACxC;;EAYA,cAAc;;EAEd;;;;;;EAMA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;wBAqBpC,cACd,aACA,MACA,yBACA,WACA,OACA,UACA,WACG,QACF,mCAAgB,IAAA;yBATH"}
1
+ {"version":3,"file":"toolbar-root.d.mts","names":[],"sources":["../../src/toolbar/toolbar-root.tsx"],"mappings":";;;;YAWY,qBAAqB;;;;;iBAMhB;;WAEN,aAAa;;;;;;;iBAQP,yBAAyB,KACxC;;;;;;EAgBA,cAAc;;;;;;EAMd;;;;;;;;EAQA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;;;wBAuBpC,cACd,aACA,MACA,yBACA,WACA,OACA,UACA,WACG,QACF,mCAAgB,IAAA;yBATH"}
@@ -22,6 +22,8 @@ function firstItem(items) {
22
22
  *
23
23
  * Owned keys (conventions 1.2): `role`, `aria-orientation`, `data-orientation`, `onKeyDown`,
24
24
  * `onFocus`, `onBlur`, `onPointerDown`, and `focusgroup` while the flag is on.
25
+ *
26
+ * @see https://ui.funstack.work/components/toolbar
25
27
  */
26
28
  function ToolbarRoot({ orientation = "horizontal", loop = true, experimental_focusgroup = false, className, style, children, render, ...rest }) {
27
29
  const native = useNativeFocusgroup(experimental_focusgroup);
@@ -1 +1 @@
1
- {"version":3,"file":"toolbar-root.mjs","names":[],"sources":["../../src/toolbar/toolbar-root.tsx"],"sourcesContent":["\"use client\";\nimport { useMemo, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { ToolbarContext } from \"../internal/toolbar-context.js\";\nimport type { ToolbarContextValue } from \"../internal/toolbar-context.js\";\nimport type { Orientation, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useNativeFocusgroup } from \"../internal/use-native-focusgroup.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useRovingFocus } from \"../internal/use-roving-focus.js\";\n\nexport type ToolbarOrientation = Orientation;\n\nexport interface ToolbarRootState {\n readonly orientation: ToolbarOrientation;\n}\n\nexport interface ToolbarRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n | \"role\"\n | \"aria-orientation\"\n | \"onKeyDown\"\n | \"onFocus\"\n | \"onBlur\"\n | \"onPointerDown\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /** Axis of the arrow keys; also `aria-orientation`. Default `\"horizontal\"`. */\n orientation?: ToolbarOrientation;\n /** Whether arrows wrap from the last item to the first. Default `true`. */\n loop?: boolean;\n /**\n * Render `focusgroup=\"toolbar …\"` and, where the browser implements it, let the browser handle\n * arrow keys, Home and End and the single Tab stop. Chromium 150+ only; elsewhere the JS path\n * stays active. Default `false`.\n */\n experimental_focusgroup?: boolean;\n className?: StateValue<string | undefined, ToolbarRootState>;\n style?: StateValue<CSSProperties | undefined, ToolbarRootState>;\n children?: StateValue<ReactNode, ToolbarRootState>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, ToolbarRootState>;\n}\n\n/**\n * First entry: the first item. Natively `disabled` controls are not items; `aria-disabled` ones\n * are, and are entered like any other, as Chromium's native `focusgroup` does (the APG allows\n * focusable disabled items in a toolbar).\n */\nfunction firstItem(items: readonly HTMLElement[]): HTMLElement | undefined {\n return items[0];\n}\n\n/**\n * `<div role=\"toolbar\" aria-orientation>` (WAI-ARIA APG Toolbar). Its items are its focusable\n * descendants, found in the DOM: one Tab stop (the last focused item), arrow keys, Home and End\n * between them (design/components/toggle-group.md section 6). Name it with `aria-label` or\n * `aria-labelledby`.\n *\n * Owned keys (conventions 1.2): `role`, `aria-orientation`, `data-orientation`, `onKeyDown`,\n * `onFocus`, `onBlur`, `onPointerDown`, and `focusgroup` while the flag is on.\n */\nexport function ToolbarRoot({\n orientation = \"horizontal\",\n loop = true,\n experimental_focusgroup = false,\n className,\n style,\n children,\n render,\n ...rest\n}: ToolbarRootProps) {\n const native = useNativeFocusgroup(experimental_focusgroup);\n const rootRef = useRef<HTMLElement | null>(null);\n const roving = useRovingFocus(rootRef, {\n orientation,\n loop,\n native,\n entry: firstItem,\n memory: true,\n });\n\n const context = useMemo<ToolbarContextValue>(() => ({ orientation }), [orientation]);\n const state: ToolbarRootState = { orientation };\n\n const focusgroup = experimental_focusgroup\n ? `toolbar ${orientation === \"vertical\" ? \"block\" : \"inline\"} ${loop ? \"wrap\" : \"nowrap\"}`\n : undefined;\n\n const element = useRender<ComponentPropsWithRef<\"div\">, ToolbarRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n role: \"toolbar\",\n \"aria-orientation\": orientation,\n \"data-orientation\": orientation,\n ...roving,\n ...(focusgroup !== undefined && { focusgroup }),\n },\n ref: rootRef,\n });\n\n return <ToolbarContext value={context}>{element}</ToolbarContext>;\n}\n\nToolbarRoot.displayName = \"ToolbarRoot\";\n"],"mappings":";;;;;;;;;;;;;AAiDA,SAAS,UAAU,OAAwD;CACzE,OAAO,MAAM;AACf;;;;;;;;;;AAWA,SAAgB,YAAY,EAC1B,cAAc,cACd,OAAO,MACP,0BAA0B,OAC1B,WACA,OACA,UACA,QACA,GAAG,QACgB;CACnB,MAAM,SAAS,oBAAoB,uBAAuB;CAC1D,MAAM,UAAU,OAA2B,IAAI;CAC/C,MAAM,SAAS,eAAe,SAAS;EACrC;EACA;EACA;EACA,OAAO;EACP,QAAQ;CACV,CAAC;CAED,MAAM,UAAU,eAAoC,EAAE,YAAY,IAAI,CAAC,WAAW,CAAC;CACnF,MAAM,QAA0B,EAAE,YAAY;CAE9C,MAAM,aAAa,0BACf,WAAW,gBAAgB,aAAa,UAAU,SAAS,GAAG,OAAO,SAAS,aAC9E,KAAA;CAEJ,MAAM,UAAU,UAA0D;EACxE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,MAAM;GACN,oBAAoB;GACpB,oBAAoB;GACpB,GAAG;GACH,GAAI,eAAe,KAAA,KAAa,EAAE,WAAW;EAC/C;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,gBAAD;EAAgB,OAAO;EAAU,UAAA;CAAwB,CAAA;AAClE;AAEA,YAAY,cAAc"}
1
+ {"version":3,"file":"toolbar-root.mjs","names":[],"sources":["../../src/toolbar/toolbar-root.tsx"],"sourcesContent":["\"use client\";\nimport { useMemo, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { ToolbarContext } from \"../internal/toolbar-context.js\";\nimport type { ToolbarContextValue } from \"../internal/toolbar-context.js\";\nimport type { Orientation, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useNativeFocusgroup } from \"../internal/use-native-focusgroup.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useRovingFocus } from \"../internal/use-roving-focus.js\";\n\n/** The arrow-key axis of a Toolbar. */\nexport type ToolbarOrientation = Orientation;\n\n/**\n * State of `Toolbar.Root`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface ToolbarRootState {\n /** The `orientation` prop. */\n readonly orientation: ToolbarOrientation;\n}\n\n/**\n * Props of `Toolbar.Root`.\n *\n * @see https://ui.funstack.work/components/toolbar\n */\nexport interface ToolbarRootProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n | \"role\"\n | \"aria-orientation\"\n | \"onKeyDown\"\n | \"onFocus\"\n | \"onBlur\"\n | \"onPointerDown\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Axis of the arrow keys; also `aria-orientation`.\n *\n * @defaultValue `\"horizontal\"`\n */\n orientation?: ToolbarOrientation;\n /**\n * Whether arrows wrap from the last item to the first.\n *\n * @defaultValue `true`\n */\n loop?: boolean;\n /**\n * Render `focusgroup=\"toolbar …\"` and, where the browser implements it, let the browser handle\n * arrow keys, Home and End and the single Tab stop. Chromium 150+ only; elsewhere the JS path\n * stays active.\n *\n * @defaultValue `false`\n */\n experimental_focusgroup?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, ToolbarRootState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, ToolbarRootState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, ToolbarRootState>;\n /** Replace the default `<div>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"div\">, ToolbarRootState>;\n}\n\n/**\n * First entry: the first item. Natively `disabled` controls are not items; `aria-disabled` ones\n * are, and are entered like any other, as Chromium's native `focusgroup` does (the APG allows\n * focusable disabled items in a toolbar).\n */\nfunction firstItem(items: readonly HTMLElement[]): HTMLElement | undefined {\n return items[0];\n}\n\n/**\n * `<div role=\"toolbar\" aria-orientation>` (WAI-ARIA APG Toolbar). Its items are its focusable\n * descendants, found in the DOM: one Tab stop (the last focused item), arrow keys, Home and End\n * between them (design/components/toggle-group.md section 6). Name it with `aria-label` or\n * `aria-labelledby`.\n *\n * Owned keys (conventions 1.2): `role`, `aria-orientation`, `data-orientation`, `onKeyDown`,\n * `onFocus`, `onBlur`, `onPointerDown`, and `focusgroup` while the flag is on.\n *\n * @see https://ui.funstack.work/components/toolbar\n */\nexport function ToolbarRoot({\n orientation = \"horizontal\",\n loop = true,\n experimental_focusgroup = false,\n className,\n style,\n children,\n render,\n ...rest\n}: ToolbarRootProps) {\n const native = useNativeFocusgroup(experimental_focusgroup);\n const rootRef = useRef<HTMLElement | null>(null);\n const roving = useRovingFocus(rootRef, {\n orientation,\n loop,\n native,\n entry: firstItem,\n memory: true,\n });\n\n const context = useMemo<ToolbarContextValue>(() => ({ orientation }), [orientation]);\n const state: ToolbarRootState = { orientation };\n\n const focusgroup = experimental_focusgroup\n ? `toolbar ${orientation === \"vertical\" ? \"block\" : \"inline\"} ${loop ? \"wrap\" : \"nowrap\"}`\n : undefined;\n\n const element = useRender<ComponentPropsWithRef<\"div\">, ToolbarRootState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n role: \"toolbar\",\n \"aria-orientation\": orientation,\n \"data-orientation\": orientation,\n ...roving,\n ...(focusgroup !== undefined && { focusgroup }),\n },\n ref: rootRef,\n });\n\n return <ToolbarContext value={context}>{element}</ToolbarContext>;\n}\n\nToolbarRoot.displayName = \"ToolbarRoot\";\n"],"mappings":";;;;;;;;;;;;;AA0EA,SAAS,UAAU,OAAwD;CACzE,OAAO,MAAM;AACf;;;;;;;;;;;;AAaA,SAAgB,YAAY,EAC1B,cAAc,cACd,OAAO,MACP,0BAA0B,OAC1B,WACA,OACA,UACA,QACA,GAAG,QACgB;CACnB,MAAM,SAAS,oBAAoB,uBAAuB;CAC1D,MAAM,UAAU,OAA2B,IAAI;CAC/C,MAAM,SAAS,eAAe,SAAS;EACrC;EACA;EACA;EACA,OAAO;EACP,QAAQ;CACV,CAAC;CAED,MAAM,UAAU,eAAoC,EAAE,YAAY,IAAI,CAAC,WAAW,CAAC;CACnF,MAAM,QAA0B,EAAE,YAAY;CAE9C,MAAM,aAAa,0BACf,WAAW,gBAAgB,aAAa,UAAU,SAAS,GAAG,OAAO,SAAS,aAC9E,KAAA;CAEJ,MAAM,UAAU,UAA0D;EACxE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,MAAM;GACN,oBAAoB;GACpB,oBAAoB;GACpB,GAAG;GACH,GAAI,eAAe,KAAA,KAAa,EAAE,WAAW;EAC/C;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,gBAAD;EAAgB,OAAO;EAAU,UAAA;CAAwB,CAAA;AAClE;AAEA,YAAY,cAAc"}
@@ -2,13 +2,24 @@ import { RenderProp, StateValue } from "../internal/types.mjs";
2
2
  import { ToolbarOrientation } from "./toolbar-root.mjs";
3
3
  import { CSSProperties, ComponentPropsWithRef } from "react";
4
4
  //#region src/toolbar/toolbar-separator.d.ts
5
+ /**
6
+ * State of `Toolbar.Separator`, passed to the function forms of `className`, `style` and `render`.
7
+ */
5
8
  export interface ToolbarSeparatorState {
6
9
  /** The separator's own orientation: perpendicular to the Toolbar's. */
7
10
  readonly orientation: ToolbarOrientation;
8
11
  }
12
+ /**
13
+ * Props of `Toolbar.Separator`.
14
+ *
15
+ * @see https://ui.funstack.work/components/toolbar
16
+ */
9
17
  export interface ToolbarSeparatorProps extends Omit<ComponentPropsWithRef<"hr">, "aria-orientation" | "className" | "style" | "children"> {
18
+ /** Class name, or a function of the part's state that returns one. */
10
19
  className?: StateValue<string | undefined, ToolbarSeparatorState>;
20
+ /** Inline style, or a function of the part's state that returns one. */
11
21
  style?: StateValue<CSSProperties | undefined, ToolbarSeparatorState>;
22
+ /** Replace the default `<hr>` (element form) or take over rendering (function form). */
12
23
  render?: RenderProp<ComponentPropsWithRef<"hr">, ToolbarSeparatorState>;
13
24
  }
14
25
  /**
@@ -16,6 +27,8 @@ export interface ToolbarSeparatorProps extends Omit<ComponentPropsWithRef<"hr">,
16
27
  * a vertical one. Not focusable, not an item.
17
28
  *
18
29
  * Owned keys (conventions 1.2): `aria-orientation`, `data-orientation`.
30
+ *
31
+ * @see https://ui.funstack.work/components/toolbar
19
32
  */
20
33
  export declare function ToolbarSeparator({ className, style, render, ...rest }: ToolbarSeparatorProps): import("react").ReactNode;
21
34
  export declare namespace ToolbarSeparator {
@@ -1 +1 @@
1
- {"version":3,"file":"toolbar-separator.d.mts","names":[],"sources":["../../src/toolbar/toolbar-separator.tsx"],"mappings":";;;;iBAOiB;;WAEN,aAAa;;iBAGP,8BAA8B,KAC7C;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,6BAA6B;;;;;;;;wBASnC,mBAAmB,WAAW,OAAO,WAAW,QAAQ,wCAAqB;yBAA7E"}
1
+ {"version":3,"file":"toolbar-separator.d.mts","names":[],"sources":["../../src/toolbar/toolbar-separator.tsx"],"mappings":";;;;;;;iBAUiB;;WAEN,aAAa;;;;;;;iBAQP,8BAA8B,KAC7C;;EAIA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,SAAS,WAAW,6BAA6B;;;;;;;;;;wBAWnC,mBAAmB,WAAW,OAAO,WAAW,QAAQ,wCAAqB;yBAA7E"}
@@ -7,6 +7,8 @@ import { useRender } from "../internal/use-render.mjs";
7
7
  * a vertical one. Not focusable, not an item.
8
8
  *
9
9
  * Owned keys (conventions 1.2): `aria-orientation`, `data-orientation`.
10
+ *
11
+ * @see https://ui.funstack.work/components/toolbar
10
12
  */
11
13
  function ToolbarSeparator({ className, style, render, ...rest }) {
12
14
  const orientation = useToolbarContext()?.orientation === "vertical" ? "horizontal" : "vertical";
@@ -1 +1 @@
1
- {"version":3,"file":"toolbar-separator.mjs","names":[],"sources":["../../src/toolbar/toolbar-separator.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport { useToolbarContext } from \"../internal/toolbar-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport type { ToolbarOrientation } from \"./toolbar-root.js\";\n\nexport interface ToolbarSeparatorState {\n /** The separator's own orientation: perpendicular to the Toolbar's. */\n readonly orientation: ToolbarOrientation;\n}\n\nexport interface ToolbarSeparatorProps extends Omit<\n ComponentPropsWithRef<\"hr\">,\n \"aria-orientation\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, ToolbarSeparatorState>;\n style?: StateValue<CSSProperties | undefined, ToolbarSeparatorState>;\n render?: RenderProp<ComponentPropsWithRef<\"hr\">, ToolbarSeparatorState>;\n}\n\n/**\n * `<hr aria-orientation>` between toolbar items: vertical in a horizontal Toolbar, horizontal in\n * a vertical one. Not focusable, not an item.\n *\n * Owned keys (conventions 1.2): `aria-orientation`, `data-orientation`.\n */\nexport function ToolbarSeparator({ className, style, render, ...rest }: ToolbarSeparatorProps) {\n const toolbar = useToolbarContext();\n const orientation: ToolbarOrientation =\n toolbar?.orientation === \"vertical\" ? \"horizontal\" : \"vertical\";\n const state: ToolbarSeparatorState = { orientation };\n\n return useRender<ComponentPropsWithRef<\"hr\">, ToolbarSeparatorState>({\n defaultElement: \"hr\",\n render,\n state,\n className,\n style,\n children: undefined,\n props: rest,\n libraryProps: {\n \"aria-orientation\": orientation,\n \"data-orientation\": orientation,\n },\n });\n}\n\nToolbarSeparator.displayName = \"ToolbarSeparator\";\n"],"mappings":";;;;;;;;;;AA2BA,SAAgB,iBAAiB,EAAE,WAAW,OAAO,QAAQ,GAAG,QAA+B;CAE7F,MAAM,cADU,kBAER,CAAC,EAAE,gBAAgB,aAAa,eAAe;CAGvD,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA,OAAA,EALqC,YAKjC;EACJ;EACA;EACA,UAAU,KAAA;EACV,OAAO;EACP,cAAc;GACZ,oBAAoB;GACpB,oBAAoB;EACtB;CACF,CAAC;AACH;AAEA,iBAAiB,cAAc"}
1
+ {"version":3,"file":"toolbar-separator.mjs","names":[],"sources":["../../src/toolbar/toolbar-separator.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties } from \"react\";\nimport { useToolbarContext } from \"../internal/toolbar-context.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport type { ToolbarOrientation } from \"./toolbar-root.js\";\n\n/**\n * State of `Toolbar.Separator`, passed to the function forms of `className`, `style` and `render`.\n */\nexport interface ToolbarSeparatorState {\n /** The separator's own orientation: perpendicular to the Toolbar's. */\n readonly orientation: ToolbarOrientation;\n}\n\n/**\n * Props of `Toolbar.Separator`.\n *\n * @see https://ui.funstack.work/components/toolbar\n */\nexport interface ToolbarSeparatorProps extends Omit<\n ComponentPropsWithRef<\"hr\">,\n \"aria-orientation\" | \"className\" | \"style\" | \"children\"\n> {\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, ToolbarSeparatorState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, ToolbarSeparatorState>;\n /** Replace the default `<hr>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"hr\">, ToolbarSeparatorState>;\n}\n\n/**\n * `<hr aria-orientation>` between toolbar items: vertical in a horizontal Toolbar, horizontal in\n * a vertical one. Not focusable, not an item.\n *\n * Owned keys (conventions 1.2): `aria-orientation`, `data-orientation`.\n *\n * @see https://ui.funstack.work/components/toolbar\n */\nexport function ToolbarSeparator({ className, style, render, ...rest }: ToolbarSeparatorProps) {\n const toolbar = useToolbarContext();\n const orientation: ToolbarOrientation =\n toolbar?.orientation === \"vertical\" ? \"horizontal\" : \"vertical\";\n const state: ToolbarSeparatorState = { orientation };\n\n return useRender<ComponentPropsWithRef<\"hr\">, ToolbarSeparatorState>({\n defaultElement: \"hr\",\n render,\n state,\n className,\n style,\n children: undefined,\n props: rest,\n libraryProps: {\n \"aria-orientation\": orientation,\n \"data-orientation\": orientation,\n },\n });\n}\n\nToolbarSeparator.displayName = \"ToolbarSeparator\";\n"],"mappings":";;;;;;;;;;;;AAwCA,SAAgB,iBAAiB,EAAE,WAAW,OAAO,QAAQ,GAAG,QAA+B;CAE7F,MAAM,cADU,kBAER,CAAC,EAAE,gBAAgB,aAAa,eAAe;CAGvD,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA,OAAA,EALqC,YAKjC;EACJ;EACA;EACA,UAAU,KAAA;EACV,OAAO;EACP,cAAc;GACZ,oBAAoB;GACpB,oBAAoB;EACtB;CACF,CAAC;AACH;AAEA,iBAAiB,cAAc"}
@@ -11,6 +11,8 @@ import { TooltipTrigger, TooltipTriggerProps, TooltipTriggerState } from "./tool
11
11
  * top layer and is placed with CSS Anchor Positioning, `Arrow` (decorative `span`) echoes the
12
12
  * Popup's resolved side. Open state is browser-owned: no `open` prop, no action, style with
13
13
  * `:popover-open`. Render the Popup immediately after the Trigger.
14
+ *
15
+ * @see https://ui.funstack.work/components/tooltip
14
16
  */
15
17
  export declare const Tooltip: {
16
18
  readonly Root: typeof TooltipRoot;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/tooltip/index.ts"],"mappings":";;;;;;;;;;;;;;qBAea;WACX,aAAI;WACJ,gBAAO;WACP,cAAK;WACL,cAAK"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/tooltip/index.ts"],"mappings":";;;;;;;;;;;;;;;;qBAiBa;WACX,aAAI;WACJ,gBAAO;WACP,cAAK;WACL,cAAK"}
@@ -9,6 +9,8 @@ import { TooltipTrigger } from "./tooltip-trigger.mjs";
9
9
  * top layer and is placed with CSS Anchor Positioning, `Arrow` (decorative `span`) echoes the
10
10
  * Popup's resolved side. Open state is browser-owned: no `open` prop, no action, style with
11
11
  * `:popover-open`. Render the Popup immediately after the Trigger.
12
+ *
13
+ * @see https://ui.funstack.work/components/tooltip
12
14
  */
13
15
  const Tooltip = {
14
16
  Root: TooltipRoot,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/tooltip/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 { TooltipArrow } from \"./tooltip-arrow.js\";\nimport { TooltipPopup } from \"./tooltip-popup.js\";\nimport { TooltipRoot } from \"./tooltip-root.js\";\nimport { TooltipTrigger } from \"./tooltip-trigger.js\";\n\n/**\n * Tooltip (WAI-ARIA APG Tooltip pattern): `Root` (no DOM) owns the id and the interaction,\n * `Trigger` (button) is hovered or focused, `Popup` (`div[popover] role=\"tooltip\"`) lives in the\n * top layer and is placed with CSS Anchor Positioning, `Arrow` (decorative `span`) echoes the\n * Popup's resolved side. Open state is browser-owned: no `open` prop, no action, style with\n * `:popover-open`. Render the Popup immediately after the Trigger.\n */\nexport const Tooltip = {\n Root: TooltipRoot,\n Trigger: TooltipTrigger,\n Popup: TooltipPopup,\n Arrow: TooltipArrow,\n} as const;\n\nexport type { TooltipRootProps, TooltipRootState, TooltipProvides } from \"./tooltip-root.js\";\nexport type { TooltipTriggerProps, TooltipTriggerState } from \"./tooltip-trigger.js\";\nexport type {\n TooltipPopupProps,\n TooltipPopupState,\n TooltipSide,\n TooltipAlign,\n} from \"./tooltip-popup.js\";\nexport type { TooltipArrowProps, TooltipArrowState } from \"./tooltip-arrow.js\";\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,UAAU;CACrB,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;AACT"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/tooltip/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 { TooltipArrow } from \"./tooltip-arrow.js\";\nimport { TooltipPopup } from \"./tooltip-popup.js\";\nimport { TooltipRoot } from \"./tooltip-root.js\";\nimport { TooltipTrigger } from \"./tooltip-trigger.js\";\n\n/**\n * Tooltip (WAI-ARIA APG Tooltip pattern): `Root` (no DOM) owns the id and the interaction,\n * `Trigger` (button) is hovered or focused, `Popup` (`div[popover] role=\"tooltip\"`) lives in the\n * top layer and is placed with CSS Anchor Positioning, `Arrow` (decorative `span`) echoes the\n * Popup's resolved side. Open state is browser-owned: no `open` prop, no action, style with\n * `:popover-open`. Render the Popup immediately after the Trigger.\n *\n * @see https://ui.funstack.work/components/tooltip\n */\nexport const Tooltip = {\n Root: TooltipRoot,\n Trigger: TooltipTrigger,\n Popup: TooltipPopup,\n Arrow: TooltipArrow,\n} as const;\n\nexport type { TooltipRootProps, TooltipRootState, TooltipProvides } from \"./tooltip-root.js\";\nexport type { TooltipTriggerProps, TooltipTriggerState } from \"./tooltip-trigger.js\";\nexport type {\n TooltipPopupProps,\n TooltipPopupState,\n TooltipSide,\n TooltipAlign,\n} from \"./tooltip-popup.js\";\nexport type { TooltipArrowProps, TooltipArrowState } from \"./tooltip-arrow.js\";\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAa,UAAU;CACrB,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;AACT"}
@@ -2,15 +2,29 @@ import { RenderProp, StateValue } from "../internal/types.mjs";
2
2
  import { TooltipAlign, TooltipSide } from "./tooltip-context.mjs";
3
3
  import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
4
4
  //#region src/tooltip/tooltip-arrow.d.ts
5
+ /**
6
+ * State of `Tooltip.Arrow`, passed to the function forms of `className`, `style`, `children` and
7
+ * `render`.
8
+ */
5
9
  export interface TooltipArrowState {
6
10
  /** The Popup's side: resolved while shown (after any flip), requested otherwise. */
7
11
  readonly side: TooltipSide | null;
12
+ /** The Popup's alignment: resolved while shown, requested otherwise. */
8
13
  readonly align: TooltipAlign;
9
14
  }
15
+ /**
16
+ * Props of `Tooltip.Arrow`.
17
+ *
18
+ * @see https://ui.funstack.work/components/tooltip
19
+ */
10
20
  export interface TooltipArrowProps extends Omit<ComponentPropsWithRef<"span">, "aria-hidden" | "className" | "style" | "children"> {
21
+ /** Class name, or a function of the part's state that returns one. */
11
22
  className?: StateValue<string | undefined, TooltipArrowState>;
23
+ /** Inline style, or a function of the part's state that returns one. */
12
24
  style?: StateValue<CSSProperties | undefined, TooltipArrowState>;
25
+ /** Content, or a function of the part's state. */
13
26
  children?: StateValue<ReactNode, TooltipArrowState>;
27
+ /** Replace the default `<span>` (element form) or take over rendering (function form). */
14
28
  render?: RenderProp<ComponentPropsWithRef<"span">, TooltipArrowState>;
15
29
  }
16
30
  /**
@@ -21,6 +35,8 @@ export interface TooltipArrowProps extends Omit<ComponentPropsWithRef<"span">, "
21
35
  *
22
36
  * Owned keys (conventions 1.2): `aria-hidden`, and `data-side` / `data-align` unless the Popup's
23
37
  * `side` is `null`.
38
+ *
39
+ * @see https://ui.funstack.work/components/tooltip
24
40
  */
25
41
  export declare function TooltipArrow({ className, style, children, render, ...rest }: TooltipArrowProps): ReactNode;
26
42
  export declare namespace TooltipArrow {
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-arrow.d.mts","names":[],"sources":["../../src/tooltip/tooltip-arrow.tsx"],"mappings":";;;;iBASiB;;WAEN,MAAM;WACN,OAAO;;iBAGD,0BAA0B,KACzC;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,+BAA+B;;;;;;;;;;;wBAYrC,eAAe,WAAW,OAAO,UAAU,WAAW,QAAQ,oBAAiB;yBAA/E"}
1
+ {"version":3,"file":"tooltip-arrow.d.mts","names":[],"sources":["../../src/tooltip/tooltip-arrow.tsx"],"mappings":";;;;;;;;iBAaiB;;WAEN,MAAM;;WAEN,OAAO;;;;;;;iBAQD,0BAA0B,KACzC;;EAIA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,+BAA+B;;;;;;;;;;;;;wBAcrC,eAAe,WAAW,OAAO,UAAU,WAAW,QAAQ,oBAAiB;yBAA/E"}
@@ -11,6 +11,8 @@ import { use } from "react";
11
11
  *
12
12
  * Owned keys (conventions 1.2): `aria-hidden`, and `data-side` / `data-align` unless the Popup's
13
13
  * `side` is `null`.
14
+ *
15
+ * @see https://ui.funstack.work/components/tooltip
14
16
  */
15
17
  function TooltipArrow({ className, style, children, render, ...rest }) {
16
18
  const placement = use(TooltipPopupContext);
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-arrow.mjs","names":[],"sources":["../../src/tooltip/tooltip-arrow.tsx"],"sourcesContent":["\"use client\";\nimport { use } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { TooltipPopupContext } from \"./tooltip-context.js\";\nimport type { TooltipAlign, TooltipSide } from \"./tooltip-context.js\";\n\nexport interface TooltipArrowState {\n /** The Popup's side: resolved while shown (after any flip), requested otherwise. */\n readonly side: TooltipSide | null;\n readonly align: TooltipAlign;\n}\n\nexport interface TooltipArrowProps extends Omit<\n ComponentPropsWithRef<\"span\">,\n \"aria-hidden\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, TooltipArrowState>;\n style?: StateValue<CSSProperties | undefined, TooltipArrowState>;\n children?: StateValue<ReactNode, TooltipArrowState>;\n render?: RenderProp<ComponentPropsWithRef<\"span\">, TooltipArrowState>;\n}\n\n/**\n * A decorative `<span aria-hidden=\"true\">` inside `Tooltip.Popup` that draws nothing itself: it\n * echoes the Popup's `data-side` / `data-align`, which are the **resolved** placement while the\n * tooltip is shown (design 7.4), so CSS keyed on `[data-side]` puts it on the edge that faces the\n * trigger, after a `position-try-fallbacks` flip as well.\n *\n * Owned keys (conventions 1.2): `aria-hidden`, and `data-side` / `data-align` unless the Popup's\n * `side` is `null`.\n */\nexport function TooltipArrow({ className, style, children, render, ...rest }: TooltipArrowProps) {\n const placement = use(TooltipPopupContext);\n if (placement === null) {\n throw new Error(\"Tooltip.Arrow must be rendered inside a Tooltip.Popup.\");\n }\n const { side, align } = placement;\n const state: TooltipArrowState = { side, align };\n\n const libraryProps: ComponentPropsWithRef<\"span\"> & DataAttributes = {\n \"aria-hidden\": true,\n ...(side !== null && { \"data-side\": side, \"data-align\": align }),\n };\n\n return useRender<ComponentPropsWithRef<\"span\">, TooltipArrowState>({\n defaultElement: \"span\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n });\n}\n\nTooltipArrow.displayName = \"TooltipArrow\";\n"],"mappings":";;;;;;;;;;;;;;AAkCA,SAAgB,aAAa,EAAE,WAAW,OAAO,UAAU,QAAQ,GAAG,QAA2B;CAC/F,MAAM,YAAY,IAAI,mBAAmB;CACzC,IAAI,cAAc,MAChB,MAAM,IAAI,MAAM,wDAAwD;CAE1E,MAAM,EAAE,MAAM,UAAU;CACxB,MAAM,QAA2B;EAAE;EAAM;CAAM;CAE/C,MAAM,eAA+D;EACnE,eAAe;EACf,GAAI,SAAS,QAAQ;GAAE,aAAa;GAAM,cAAc;EAAM;CAChE;CAEA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;CACF,CAAC;AACH;AAEA,aAAa,cAAc"}
1
+ {"version":3,"file":"tooltip-arrow.mjs","names":[],"sources":["../../src/tooltip/tooltip-arrow.tsx"],"sourcesContent":["\"use client\";\nimport { use } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { TooltipPopupContext } from \"./tooltip-context.js\";\nimport type { TooltipAlign, TooltipSide } from \"./tooltip-context.js\";\n\n/**\n * State of `Tooltip.Arrow`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface TooltipArrowState {\n /** The Popup's side: resolved while shown (after any flip), requested otherwise. */\n readonly side: TooltipSide | null;\n /** The Popup's alignment: resolved while shown, requested otherwise. */\n readonly align: TooltipAlign;\n}\n\n/**\n * Props of `Tooltip.Arrow`.\n *\n * @see https://ui.funstack.work/components/tooltip\n */\nexport interface TooltipArrowProps extends Omit<\n ComponentPropsWithRef<\"span\">,\n \"aria-hidden\" | \"className\" | \"style\" | \"children\"\n> {\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, TooltipArrowState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, TooltipArrowState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, TooltipArrowState>;\n /** Replace the default `<span>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"span\">, TooltipArrowState>;\n}\n\n/**\n * A decorative `<span aria-hidden=\"true\">` inside `Tooltip.Popup` that draws nothing itself: it\n * echoes the Popup's `data-side` / `data-align`, which are the **resolved** placement while the\n * tooltip is shown (design 7.4), so CSS keyed on `[data-side]` puts it on the edge that faces the\n * trigger, after a `position-try-fallbacks` flip as well.\n *\n * Owned keys (conventions 1.2): `aria-hidden`, and `data-side` / `data-align` unless the Popup's\n * `side` is `null`.\n *\n * @see https://ui.funstack.work/components/tooltip\n */\nexport function TooltipArrow({ className, style, children, render, ...rest }: TooltipArrowProps) {\n const placement = use(TooltipPopupContext);\n if (placement === null) {\n throw new Error(\"Tooltip.Arrow must be rendered inside a Tooltip.Popup.\");\n }\n const { side, align } = placement;\n const state: TooltipArrowState = { side, align };\n\n const libraryProps: ComponentPropsWithRef<\"span\"> & DataAttributes = {\n \"aria-hidden\": true,\n ...(side !== null && { \"data-side\": side, \"data-align\": align }),\n };\n\n return useRender<ComponentPropsWithRef<\"span\">, TooltipArrowState>({\n defaultElement: \"span\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n });\n}\n\nTooltipArrow.displayName = \"TooltipArrow\";\n"],"mappings":";;;;;;;;;;;;;;;;AAkDA,SAAgB,aAAa,EAAE,WAAW,OAAO,UAAU,QAAQ,GAAG,QAA2B;CAC/F,MAAM,YAAY,IAAI,mBAAmB;CACzC,IAAI,cAAc,MAChB,MAAM,IAAI,MAAM,wDAAwD;CAE1E,MAAM,EAAE,MAAM,UAAU;CACxB,MAAM,QAA2B;EAAE;EAAM;CAAM;CAE/C,MAAM,eAA+D;EACnE,eAAe;EACf,GAAI,SAAS,QAAQ;GAAE,aAAa;GAAM,cAAc;EAAM;CAChE;CAEA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;CACF,CAAC;AACH;AAEA,aAAa,cAAc"}
@@ -5,6 +5,10 @@ import { AnchorAlign, AnchorSide } from "../internal/anchor-position.mjs";
5
5
  * shown, the state carries the resolved physical side.
6
6
  */
7
7
  export type TooltipSide = AnchorSide;
8
+ /**
9
+ * Alignment of the Popup along its side: inline-relative on a top / bottom side, the top / bottom
10
+ * edges on the others.
11
+ */
8
12
  export type TooltipAlign = AnchorAlign;
9
13
  /** Which accessibility relation the tooltip provides for its trigger (design section 5.1). */
10
14
  export type TooltipProvides = "description" | "name";
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-context.d.mts","names":[],"sources":["../../src/tooltip/tooltip-context.ts"],"mappings":";;;;;;YAQY,cAAc;YACd,eAAe;;YAGf"}
1
+ {"version":3,"file":"tooltip-context.d.mts","names":[],"sources":["../../src/tooltip/tooltip-context.ts"],"mappings":";;;;;;YAQY,cAAc;;;;;YAKd,eAAe;;YAGf"}