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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (558) 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 +2 -0
  13. package/dist/accordion/accordion-root.mjs.map +1 -1
  14. package/dist/accordion/accordion-trigger.d.mts +9 -0
  15. package/dist/accordion/accordion-trigger.d.mts.map +1 -1
  16. package/dist/accordion/accordion-trigger.mjs +2 -0
  17. package/dist/accordion/accordion-trigger.mjs.map +1 -1
  18. package/dist/accordion/index.d.mts +2 -0
  19. package/dist/accordion/index.d.mts.map +1 -1
  20. package/dist/accordion/index.mjs +2 -0
  21. package/dist/accordion/index.mjs.map +1 -1
  22. package/dist/bin/skill-installer.d.mts +1 -0
  23. package/dist/bin/skill-installer.mjs +12 -0
  24. package/dist/bin/skill-installer.mjs.map +1 -0
  25. package/dist/button/button.d.mts +25 -7
  26. package/dist/button/button.d.mts.map +1 -1
  27. package/dist/button/button.mjs +2 -0
  28. package/dist/button/button.mjs.map +1 -1
  29. package/dist/checkbox/checkbox.d.mts +25 -3
  30. package/dist/checkbox/checkbox.d.mts.map +1 -1
  31. package/dist/checkbox/checkbox.mjs +2 -0
  32. package/dist/checkbox/checkbox.mjs.map +1 -1
  33. package/dist/checkbox-group/checkbox-group-item.d.mts +15 -0
  34. package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
  35. package/dist/checkbox-group/checkbox-group-item.mjs +2 -0
  36. package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
  37. package/dist/checkbox-group/checkbox-group-label.d.mts +10 -0
  38. package/dist/checkbox-group/checkbox-group-label.d.mts.map +1 -1
  39. package/dist/checkbox-group/checkbox-group-label.mjs +2 -0
  40. package/dist/checkbox-group/checkbox-group-label.mjs.map +1 -1
  41. package/dist/checkbox-group/checkbox-group-parent.d.mts +19 -1
  42. package/dist/checkbox-group/checkbox-group-parent.d.mts.map +1 -1
  43. package/dist/checkbox-group/checkbox-group-parent.mjs +2 -0
  44. package/dist/checkbox-group/checkbox-group-parent.mjs.map +1 -1
  45. package/dist/checkbox-group/checkbox-group-root.d.mts +31 -4
  46. package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
  47. package/dist/checkbox-group/checkbox-group-root.mjs +2 -0
  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 +16 -0
  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 +49 -12
  82. package/dist/combobox/combobox-root.d.mts.map +1 -1
  83. package/dist/combobox/combobox-root.mjs +2 -0
  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 +2 -0
  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 +18 -0
  102. package/dist/dialog/dialog-close.d.mts.map +1 -1
  103. package/dist/dialog/dialog-close.mjs +2 -0
  104. package/dist/dialog/dialog-close.mjs.map +1 -1
  105. package/dist/dialog/dialog-description.d.mts +12 -0
  106. package/dist/dialog/dialog-description.d.mts.map +1 -1
  107. package/dist/dialog/dialog-description.mjs +2 -0
  108. package/dist/dialog/dialog-description.mjs.map +1 -1
  109. package/dist/dialog/dialog-form.d.mts +18 -1
  110. package/dist/dialog/dialog-form.d.mts.map +1 -1
  111. package/dist/dialog/dialog-form.mjs +2 -0
  112. package/dist/dialog/dialog-form.mjs.map +1 -1
  113. package/dist/dialog/dialog-popup.d.mts +25 -4
  114. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  115. package/dist/dialog/dialog-popup.mjs +2 -0
  116. package/dist/dialog/dialog-popup.mjs.map +1 -1
  117. package/dist/dialog/dialog-root.d.mts +15 -1
  118. package/dist/dialog/dialog-root.d.mts.map +1 -1
  119. package/dist/dialog/dialog-root.mjs +2 -0
  120. package/dist/dialog/dialog-root.mjs.map +1 -1
  121. package/dist/dialog/dialog-title.d.mts +11 -0
  122. package/dist/dialog/dialog-title.d.mts.map +1 -1
  123. package/dist/dialog/dialog-title.mjs +2 -0
  124. package/dist/dialog/dialog-title.mjs.map +1 -1
  125. package/dist/dialog/dialog-trigger.d.mts +16 -0
  126. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  127. package/dist/dialog/dialog-trigger.mjs +2 -0
  128. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  129. package/dist/dialog/index.d.mts +2 -0
  130. package/dist/dialog/index.d.mts.map +1 -1
  131. package/dist/dialog/index.mjs +2 -0
  132. package/dist/dialog/index.mjs.map +1 -1
  133. package/dist/docs/components/accordion.md +426 -0
  134. package/dist/docs/components/button.md +464 -0
  135. package/dist/docs/components/checkbox-group.md +474 -0
  136. package/dist/docs/components/checkbox.md +373 -0
  137. package/dist/docs/components/combobox.md +635 -0
  138. package/dist/docs/components/context-menu.md +524 -0
  139. package/dist/docs/components/dialog.md +686 -0
  140. package/dist/docs/components/field.md +587 -0
  141. package/dist/docs/components/menu.md +589 -0
  142. package/dist/docs/components/meter.md +313 -0
  143. package/dist/docs/components/number-field.md +528 -0
  144. package/dist/docs/components/popover.md +591 -0
  145. package/dist/docs/components/progress.md +450 -0
  146. package/dist/docs/components/radio-group.md +457 -0
  147. package/dist/docs/components/select.md +662 -0
  148. package/dist/docs/components/slider.md +558 -0
  149. package/dist/docs/components/switch.md +311 -0
  150. package/dist/docs/components/tabs.md +473 -0
  151. package/dist/docs/components/toast.md +576 -0
  152. package/dist/docs/components/toggle-group.md +341 -0
  153. package/dist/docs/components/toggle.md +245 -0
  154. package/dist/docs/components/toolbar.md +389 -0
  155. package/dist/docs/components/tooltip.md +494 -0
  156. package/dist/docs/concepts/action-props.md +251 -0
  157. package/dist/docs/concepts/ai-agents.md +56 -0
  158. package/dist/docs/concepts/browser-owned-state.md +118 -0
  159. package/dist/docs/concepts/content-security-policy.md +69 -0
  160. package/dist/docs/concepts/experimental.md +36 -0
  161. package/dist/docs/concepts/pending-and-optimistic.md +250 -0
  162. package/dist/docs/concepts/server-components.md +118 -0
  163. package/dist/docs/concepts/suspense.md +124 -0
  164. package/dist/docs/concepts/transitions.md +118 -0
  165. package/dist/docs/getting-started.md +115 -0
  166. package/dist/docs/index.md +181 -0
  167. package/dist/docs/roadmap.md +74 -0
  168. package/dist/docs/why.md +100 -0
  169. package/dist/field/field-control.d.mts +26 -3
  170. package/dist/field/field-control.d.mts.map +1 -1
  171. package/dist/field/field-control.mjs +2 -0
  172. package/dist/field/field-control.mjs.map +1 -1
  173. package/dist/field/field-description.d.mts +11 -0
  174. package/dist/field/field-description.d.mts.map +1 -1
  175. package/dist/field/field-description.mjs +2 -0
  176. package/dist/field/field-description.mjs.map +1 -1
  177. package/dist/field/field-error.d.mts +14 -2
  178. package/dist/field/field-error.d.mts.map +1 -1
  179. package/dist/field/field-error.mjs +2 -0
  180. package/dist/field/field-error.mjs.map +1 -1
  181. package/dist/field/field-label.d.mts +10 -0
  182. package/dist/field/field-label.d.mts.map +1 -1
  183. package/dist/field/field-label.mjs +2 -0
  184. package/dist/field/field-label.mjs.map +1 -1
  185. package/dist/field/field-root.d.mts +21 -2
  186. package/dist/field/field-root.d.mts.map +1 -1
  187. package/dist/field/field-root.mjs +2 -0
  188. package/dist/field/field-root.mjs.map +1 -1
  189. package/dist/field/index.d.mts +9 -0
  190. package/dist/field/index.d.mts.map +1 -1
  191. package/dist/field/index.mjs +9 -0
  192. package/dist/field/index.mjs.map +1 -1
  193. package/dist/form/form-root.d.mts +17 -1
  194. package/dist/form/form-root.d.mts.map +1 -1
  195. package/dist/form/form-root.mjs +2 -0
  196. package/dist/form/form-root.mjs.map +1 -1
  197. package/dist/form/form-submit.d.mts +18 -0
  198. package/dist/form/form-submit.d.mts.map +1 -1
  199. package/dist/form/form-submit.mjs +2 -0
  200. package/dist/form/form-submit.mjs.map +1 -1
  201. package/dist/form/index.d.mts +7 -0
  202. package/dist/form/index.d.mts.map +1 -1
  203. package/dist/form/index.mjs +7 -0
  204. package/dist/form/index.mjs.map +1 -1
  205. package/dist/index.d.mts +2 -1
  206. package/dist/internal/types.d.mts +3 -0
  207. package/dist/internal/types.d.mts.map +1 -1
  208. package/dist/internal/use-popover-trigger.d.mts +1 -0
  209. package/dist/internal/use-popover-trigger.d.mts.map +1 -1
  210. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  211. package/dist/internal/validity.d.mts +11 -0
  212. package/dist/internal/validity.d.mts.map +1 -1
  213. package/dist/internal/validity.mjs.map +1 -1
  214. package/dist/menu/index.d.mts +2 -0
  215. package/dist/menu/index.d.mts.map +1 -1
  216. package/dist/menu/index.mjs +2 -0
  217. package/dist/menu/index.mjs.map +1 -1
  218. package/dist/menu/menu-checkbox-item.d.mts +26 -2
  219. package/dist/menu/menu-checkbox-item.d.mts.map +1 -1
  220. package/dist/menu/menu-checkbox-item.mjs +2 -0
  221. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  222. package/dist/menu/menu-context-trigger.d.mts +24 -2
  223. package/dist/menu/menu-context-trigger.d.mts.map +1 -1
  224. package/dist/menu/menu-context-trigger.mjs +2 -0
  225. package/dist/menu/menu-context-trigger.mjs.map +1 -1
  226. package/dist/menu/menu-group.d.mts +36 -1
  227. package/dist/menu/menu-group.d.mts.map +1 -1
  228. package/dist/menu/menu-group.mjs +9 -1
  229. package/dist/menu/menu-group.mjs.map +1 -1
  230. package/dist/menu/menu-item.d.mts +23 -1
  231. package/dist/menu/menu-item.d.mts.map +1 -1
  232. package/dist/menu/menu-item.mjs +2 -0
  233. package/dist/menu/menu-item.mjs.map +1 -1
  234. package/dist/menu/menu-popup.d.mts +33 -8
  235. package/dist/menu/menu-popup.d.mts.map +1 -1
  236. package/dist/menu/menu-popup.mjs +2 -0
  237. package/dist/menu/menu-popup.mjs.map +1 -1
  238. package/dist/menu/menu-radio-group.d.mts +20 -1
  239. package/dist/menu/menu-radio-group.d.mts.map +1 -1
  240. package/dist/menu/menu-radio-group.mjs +2 -0
  241. package/dist/menu/menu-radio-group.mjs.map +1 -1
  242. package/dist/menu/menu-radio-item.d.mts +16 -0
  243. package/dist/menu/menu-radio-item.d.mts.map +1 -1
  244. package/dist/menu/menu-radio-item.mjs +2 -0
  245. package/dist/menu/menu-radio-item.mjs.map +1 -1
  246. package/dist/menu/menu-root.d.mts +22 -3
  247. package/dist/menu/menu-root.d.mts.map +1 -1
  248. package/dist/menu/menu-root.mjs +2 -0
  249. package/dist/menu/menu-root.mjs.map +1 -1
  250. package/dist/menu/menu-submenu-trigger.d.mts +13 -0
  251. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  252. package/dist/menu/menu-submenu-trigger.mjs +2 -0
  253. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  254. package/dist/menu/menu-trigger.d.mts +15 -0
  255. package/dist/menu/menu-trigger.d.mts.map +1 -1
  256. package/dist/menu/menu-trigger.mjs +2 -0
  257. package/dist/menu/menu-trigger.mjs.map +1 -1
  258. package/dist/meter/index.d.mts +2 -0
  259. package/dist/meter/index.d.mts.map +1 -1
  260. package/dist/meter/index.mjs +2 -0
  261. package/dist/meter/index.mjs.map +1 -1
  262. package/dist/meter/meter-indicator.d.mts +11 -0
  263. package/dist/meter/meter-indicator.d.mts.map +1 -1
  264. package/dist/meter/meter-indicator.mjs +2 -0
  265. package/dist/meter/meter-indicator.mjs.map +1 -1
  266. package/dist/meter/meter-label.d.mts +11 -0
  267. package/dist/meter/meter-label.d.mts.map +1 -1
  268. package/dist/meter/meter-label.mjs +2 -0
  269. package/dist/meter/meter-label.mjs.map +1 -1
  270. package/dist/meter/meter-region.d.mts +5 -0
  271. package/dist/meter/meter-region.d.mts.map +1 -1
  272. package/dist/meter/meter-region.mjs.map +1 -1
  273. package/dist/meter/meter-root.d.mts +52 -10
  274. package/dist/meter/meter-root.d.mts.map +1 -1
  275. package/dist/meter/meter-root.mjs +2 -0
  276. package/dist/meter/meter-root.mjs.map +1 -1
  277. package/dist/meter/meter-track.d.mts +11 -0
  278. package/dist/meter/meter-track.d.mts.map +1 -1
  279. package/dist/meter/meter-track.mjs +2 -0
  280. package/dist/meter/meter-track.mjs.map +1 -1
  281. package/dist/meter/meter-value.d.mts +15 -1
  282. package/dist/meter/meter-value.d.mts.map +1 -1
  283. package/dist/meter/meter-value.mjs +2 -0
  284. package/dist/meter/meter-value.mjs.map +1 -1
  285. package/dist/number-field/index.d.mts +2 -0
  286. package/dist/number-field/index.d.mts.map +1 -1
  287. package/dist/number-field/index.mjs +2 -0
  288. package/dist/number-field/index.mjs.map +1 -1
  289. package/dist/number-field/number-field-decrement.d.mts +2 -0
  290. package/dist/number-field/number-field-decrement.d.mts.map +1 -1
  291. package/dist/number-field/number-field-decrement.mjs +2 -0
  292. package/dist/number-field/number-field-decrement.mjs.map +1 -1
  293. package/dist/number-field/number-field-increment.d.mts +2 -0
  294. package/dist/number-field/number-field-increment.d.mts.map +1 -1
  295. package/dist/number-field/number-field-increment.mjs +2 -0
  296. package/dist/number-field/number-field-increment.mjs.map +1 -1
  297. package/dist/number-field/number-field-input.d.mts +9 -0
  298. package/dist/number-field/number-field-input.d.mts.map +1 -1
  299. package/dist/number-field/number-field-input.mjs +2 -0
  300. package/dist/number-field/number-field-input.mjs.map +1 -1
  301. package/dist/number-field/number-field-label.d.mts +10 -0
  302. package/dist/number-field/number-field-label.d.mts.map +1 -1
  303. package/dist/number-field/number-field-label.mjs +2 -0
  304. package/dist/number-field/number-field-label.mjs.map +1 -1
  305. package/dist/number-field/number-field-root.d.mts +62 -14
  306. package/dist/number-field/number-field-root.d.mts.map +1 -1
  307. package/dist/number-field/number-field-root.mjs +2 -0
  308. package/dist/number-field/number-field-root.mjs.map +1 -1
  309. package/dist/number-field/use-step-button.d.mts +20 -0
  310. package/dist/number-field/use-step-button.d.mts.map +1 -1
  311. package/dist/number-field/use-step-button.mjs.map +1 -1
  312. package/dist/popover/index.d.mts +2 -0
  313. package/dist/popover/index.d.mts.map +1 -1
  314. package/dist/popover/index.mjs +2 -0
  315. package/dist/popover/index.mjs.map +1 -1
  316. package/dist/popover/popover-close.d.mts +18 -0
  317. package/dist/popover/popover-close.d.mts.map +1 -1
  318. package/dist/popover/popover-close.mjs +2 -0
  319. package/dist/popover/popover-close.mjs.map +1 -1
  320. package/dist/popover/popover-description.d.mts +12 -0
  321. package/dist/popover/popover-description.d.mts.map +1 -1
  322. package/dist/popover/popover-description.mjs +2 -0
  323. package/dist/popover/popover-description.mjs.map +1 -1
  324. package/dist/popover/popover-popup.d.mts +30 -4
  325. package/dist/popover/popover-popup.d.mts.map +1 -1
  326. package/dist/popover/popover-popup.mjs +2 -0
  327. package/dist/popover/popover-popup.mjs.map +1 -1
  328. package/dist/popover/popover-root.d.mts +9 -0
  329. package/dist/popover/popover-root.d.mts.map +1 -1
  330. package/dist/popover/popover-root.mjs +2 -0
  331. package/dist/popover/popover-root.mjs.map +1 -1
  332. package/dist/popover/popover-title.d.mts +11 -0
  333. package/dist/popover/popover-title.d.mts.map +1 -1
  334. package/dist/popover/popover-title.mjs +2 -0
  335. package/dist/popover/popover-title.mjs.map +1 -1
  336. package/dist/popover/popover-trigger.d.mts +15 -0
  337. package/dist/popover/popover-trigger.d.mts.map +1 -1
  338. package/dist/popover/popover-trigger.mjs +2 -0
  339. package/dist/popover/popover-trigger.mjs.map +1 -1
  340. package/dist/progress/index.d.mts +2 -0
  341. package/dist/progress/index.d.mts.map +1 -1
  342. package/dist/progress/index.mjs +2 -0
  343. package/dist/progress/index.mjs.map +1 -1
  344. package/dist/progress/progress-indicator.d.mts +11 -0
  345. package/dist/progress/progress-indicator.d.mts.map +1 -1
  346. package/dist/progress/progress-indicator.mjs +2 -0
  347. package/dist/progress/progress-indicator.mjs.map +1 -1
  348. package/dist/progress/progress-label.d.mts +11 -0
  349. package/dist/progress/progress-label.d.mts.map +1 -1
  350. package/dist/progress/progress-label.mjs +2 -0
  351. package/dist/progress/progress-label.mjs.map +1 -1
  352. package/dist/progress/progress-root.d.mts +36 -8
  353. package/dist/progress/progress-root.d.mts.map +1 -1
  354. package/dist/progress/progress-root.mjs +2 -0
  355. package/dist/progress/progress-root.mjs.map +1 -1
  356. package/dist/progress/progress-track.d.mts +11 -0
  357. package/dist/progress/progress-track.d.mts.map +1 -1
  358. package/dist/progress/progress-track.mjs +2 -0
  359. package/dist/progress/progress-track.mjs.map +1 -1
  360. package/dist/progress/progress-value.d.mts +15 -1
  361. package/dist/progress/progress-value.d.mts.map +1 -1
  362. package/dist/progress/progress-value.mjs +2 -0
  363. package/dist/progress/progress-value.mjs.map +1 -1
  364. package/dist/radio-group/index.d.mts +2 -0
  365. package/dist/radio-group/index.d.mts.map +1 -1
  366. package/dist/radio-group/index.mjs +2 -0
  367. package/dist/radio-group/index.mjs.map +1 -1
  368. package/dist/radio-group/radio-group-item.d.mts +18 -1
  369. package/dist/radio-group/radio-group-item.d.mts.map +1 -1
  370. package/dist/radio-group/radio-group-item.mjs +2 -0
  371. package/dist/radio-group/radio-group-item.mjs.map +1 -1
  372. package/dist/radio-group/radio-group-label.d.mts +10 -0
  373. package/dist/radio-group/radio-group-label.d.mts.map +1 -1
  374. package/dist/radio-group/radio-group-label.mjs +2 -0
  375. package/dist/radio-group/radio-group-label.mjs.map +1 -1
  376. package/dist/radio-group/radio-group-root.d.mts +29 -5
  377. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  378. package/dist/radio-group/radio-group-root.mjs +2 -0
  379. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  380. package/dist/select/index.d.mts +2 -0
  381. package/dist/select/index.d.mts.map +1 -1
  382. package/dist/select/index.mjs +2 -0
  383. package/dist/select/index.mjs.map +1 -1
  384. package/dist/select/select-group-label.d.mts +10 -0
  385. package/dist/select/select-group-label.d.mts.map +1 -1
  386. package/dist/select/select-group-label.mjs +2 -0
  387. package/dist/select/select-group-label.mjs.map +1 -1
  388. package/dist/select/select-group.d.mts +15 -1
  389. package/dist/select/select-group.d.mts.map +1 -1
  390. package/dist/select/select-group.mjs +2 -0
  391. package/dist/select/select-group.mjs.map +1 -1
  392. package/dist/select/select-option.d.mts +19 -1
  393. package/dist/select/select-option.d.mts.map +1 -1
  394. package/dist/select/select-option.mjs +2 -0
  395. package/dist/select/select-option.mjs.map +1 -1
  396. package/dist/select/select-root.d.mts +24 -1
  397. package/dist/select/select-root.d.mts.map +1 -1
  398. package/dist/select/select-root.mjs +2 -0
  399. package/dist/select/select-root.mjs.map +1 -1
  400. package/dist/select/select-separator.d.mts +9 -0
  401. package/dist/select/select-separator.d.mts.map +1 -1
  402. package/dist/select/select-separator.mjs +2 -0
  403. package/dist/select/select-separator.mjs.map +1 -1
  404. package/dist/select/select-trigger.d.mts +9 -0
  405. package/dist/select/select-trigger.d.mts.map +1 -1
  406. package/dist/select/select-trigger.mjs +2 -0
  407. package/dist/select/select-trigger.mjs.map +1 -1
  408. package/dist/select/select-value.d.mts +9 -0
  409. package/dist/select/select-value.d.mts.map +1 -1
  410. package/dist/select/select-value.mjs +2 -0
  411. package/dist/select/select-value.mjs.map +1 -1
  412. package/dist/slider/index.d.mts +2 -0
  413. package/dist/slider/index.d.mts.map +1 -1
  414. package/dist/slider/index.mjs +2 -0
  415. package/dist/slider/index.mjs.map +1 -1
  416. package/dist/slider/slider-indicator.d.mts +12 -0
  417. package/dist/slider/slider-indicator.d.mts.map +1 -1
  418. package/dist/slider/slider-indicator.mjs +2 -0
  419. package/dist/slider/slider-indicator.mjs.map +1 -1
  420. package/dist/slider/slider-label.d.mts +11 -1
  421. package/dist/slider/slider-label.d.mts.map +1 -1
  422. package/dist/slider/slider-label.mjs +2 -0
  423. package/dist/slider/slider-label.mjs.map +1 -1
  424. package/dist/slider/slider-root.d.mts +53 -9
  425. package/dist/slider/slider-root.d.mts.map +1 -1
  426. package/dist/slider/slider-root.mjs +2 -0
  427. package/dist/slider/slider-root.mjs.map +1 -1
  428. package/dist/slider/slider-thumb.d.mts +32 -3
  429. package/dist/slider/slider-thumb.d.mts.map +1 -1
  430. package/dist/slider/slider-thumb.mjs +2 -0
  431. package/dist/slider/slider-thumb.mjs.map +1 -1
  432. package/dist/slider/slider-track.d.mts +17 -0
  433. package/dist/slider/slider-track.d.mts.map +1 -1
  434. package/dist/slider/slider-track.mjs +2 -0
  435. package/dist/slider/slider-track.mjs.map +1 -1
  436. package/dist/slider/slider-value.d.mts +11 -0
  437. package/dist/slider/slider-value.d.mts.map +1 -1
  438. package/dist/slider/slider-value.mjs +2 -0
  439. package/dist/slider/slider-value.mjs.map +1 -1
  440. package/dist/switch/switch.d.mts +23 -3
  441. package/dist/switch/switch.d.mts.map +1 -1
  442. package/dist/switch/switch.mjs +2 -0
  443. package/dist/switch/switch.mjs.map +1 -1
  444. package/dist/tabs/index.d.mts +2 -0
  445. package/dist/tabs/index.d.mts.map +1 -1
  446. package/dist/tabs/index.mjs +2 -0
  447. package/dist/tabs/index.mjs.map +1 -1
  448. package/dist/tabs/tabs-context.d.mts +5 -0
  449. package/dist/tabs/tabs-context.d.mts.map +1 -1
  450. package/dist/tabs/tabs-context.mjs.map +1 -1
  451. package/dist/tabs/tabs-indicator.d.mts +17 -0
  452. package/dist/tabs/tabs-indicator.d.mts.map +1 -1
  453. package/dist/tabs/tabs-indicator.mjs +2 -0
  454. package/dist/tabs/tabs-indicator.mjs.map +1 -1
  455. package/dist/tabs/tabs-list.d.mts +19 -1
  456. package/dist/tabs/tabs-list.d.mts.map +1 -1
  457. package/dist/tabs/tabs-list.mjs +2 -0
  458. package/dist/tabs/tabs-list.mjs.map +1 -1
  459. package/dist/tabs/tabs-panel.d.mts +19 -0
  460. package/dist/tabs/tabs-panel.d.mts.map +1 -1
  461. package/dist/tabs/tabs-panel.mjs +2 -0
  462. package/dist/tabs/tabs-panel.mjs.map +1 -1
  463. package/dist/tabs/tabs-root.d.mts +39 -5
  464. package/dist/tabs/tabs-root.d.mts.map +1 -1
  465. package/dist/tabs/tabs-root.mjs +2 -0
  466. package/dist/tabs/tabs-root.mjs.map +1 -1
  467. package/dist/tabs/tabs-tab.d.mts +22 -1
  468. package/dist/tabs/tabs-tab.d.mts.map +1 -1
  469. package/dist/tabs/tabs-tab.mjs +2 -0
  470. package/dist/tabs/tabs-tab.mjs.map +1 -1
  471. package/dist/toast/index.d.mts +2 -0
  472. package/dist/toast/index.d.mts.map +1 -1
  473. package/dist/toast/index.mjs +2 -0
  474. package/dist/toast/index.mjs.map +1 -1
  475. package/dist/toast/toast-action.d.mts +28 -3
  476. package/dist/toast/toast-action.d.mts.map +1 -1
  477. package/dist/toast/toast-action.mjs +2 -0
  478. package/dist/toast/toast-action.mjs.map +1 -1
  479. package/dist/toast/toast-close.d.mts +16 -0
  480. package/dist/toast/toast-close.d.mts.map +1 -1
  481. package/dist/toast/toast-close.mjs +2 -0
  482. package/dist/toast/toast-close.mjs.map +1 -1
  483. package/dist/toast/toast-description.d.mts +16 -1
  484. package/dist/toast/toast-description.d.mts.map +1 -1
  485. package/dist/toast/toast-description.mjs +2 -0
  486. package/dist/toast/toast-description.mjs.map +1 -1
  487. package/dist/toast/toast-root.d.mts +20 -0
  488. package/dist/toast/toast-root.d.mts.map +1 -1
  489. package/dist/toast/toast-root.mjs +2 -0
  490. package/dist/toast/toast-root.mjs.map +1 -1
  491. package/dist/toast/toast-title.d.mts +15 -1
  492. package/dist/toast/toast-title.d.mts.map +1 -1
  493. package/dist/toast/toast-title.mjs +2 -0
  494. package/dist/toast/toast-title.mjs.map +1 -1
  495. package/dist/toast/toast-viewport.d.mts +34 -5
  496. package/dist/toast/toast-viewport.d.mts.map +1 -1
  497. package/dist/toast/toast-viewport.mjs +2 -0
  498. package/dist/toast/toast-viewport.mjs.map +1 -1
  499. package/dist/toast/toast.d.mts +46 -6
  500. package/dist/toast/toast.d.mts.map +1 -1
  501. package/dist/toast/toast.mjs +4 -0
  502. package/dist/toast/toast.mjs.map +1 -1
  503. package/dist/toggle/toggle.d.mts +20 -2
  504. package/dist/toggle/toggle.d.mts.map +1 -1
  505. package/dist/toggle/toggle.mjs +2 -0
  506. package/dist/toggle/toggle.mjs.map +1 -1
  507. package/dist/toggle-group/index.d.mts +2 -0
  508. package/dist/toggle-group/index.d.mts.map +1 -1
  509. package/dist/toggle-group/index.mjs +2 -0
  510. package/dist/toggle-group/index.mjs.map +1 -1
  511. package/dist/toggle-group/toggle-group-context.d.mts +1 -0
  512. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -1
  513. package/dist/toggle-group/toggle-group-context.mjs.map +1 -1
  514. package/dist/toggle-group/toggle-group-item.d.mts +16 -0
  515. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
  516. package/dist/toggle-group/toggle-group-item.mjs +2 -0
  517. package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
  518. package/dist/toggle-group/toggle-group-root.d.mts +73 -12
  519. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -1
  520. package/dist/toggle-group/toggle-group-root.mjs +2 -0
  521. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  522. package/dist/toolbar/index.d.mts +2 -0
  523. package/dist/toolbar/index.d.mts.map +1 -1
  524. package/dist/toolbar/index.mjs +2 -0
  525. package/dist/toolbar/index.mjs.map +1 -1
  526. package/dist/toolbar/toolbar-root.d.mts +30 -3
  527. package/dist/toolbar/toolbar-root.d.mts.map +1 -1
  528. package/dist/toolbar/toolbar-root.mjs +2 -0
  529. package/dist/toolbar/toolbar-root.mjs.map +1 -1
  530. package/dist/toolbar/toolbar-separator.d.mts +13 -0
  531. package/dist/toolbar/toolbar-separator.d.mts.map +1 -1
  532. package/dist/toolbar/toolbar-separator.mjs +2 -0
  533. package/dist/toolbar/toolbar-separator.mjs.map +1 -1
  534. package/dist/tooltip/index.d.mts +2 -0
  535. package/dist/tooltip/index.d.mts.map +1 -1
  536. package/dist/tooltip/index.mjs +2 -0
  537. package/dist/tooltip/index.mjs.map +1 -1
  538. package/dist/tooltip/tooltip-arrow.d.mts +16 -0
  539. package/dist/tooltip/tooltip-arrow.d.mts.map +1 -1
  540. package/dist/tooltip/tooltip-arrow.mjs +2 -0
  541. package/dist/tooltip/tooltip-arrow.mjs.map +1 -1
  542. package/dist/tooltip/tooltip-context.d.mts +4 -0
  543. package/dist/tooltip/tooltip-context.d.mts.map +1 -1
  544. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  545. package/dist/tooltip/tooltip-popup.d.mts +24 -3
  546. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  547. package/dist/tooltip/tooltip-popup.mjs +2 -0
  548. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  549. package/dist/tooltip/tooltip-root.d.mts +24 -2
  550. package/dist/tooltip/tooltip-root.d.mts.map +1 -1
  551. package/dist/tooltip/tooltip-root.mjs +2 -0
  552. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  553. package/dist/tooltip/tooltip-trigger.d.mts +18 -1
  554. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  555. package/dist/tooltip/tooltip-trigger.mjs +2 -0
  556. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  557. package/package.json +9 -1
  558. package/skills/funstack-ui-knowledge/SKILL.md +75 -0
@@ -1 +1 @@
1
- {"version":3,"file":"form-submit.mjs","names":[],"sources":["../../src/form/form-submit.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useFormStatus } from \"react-dom\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nexport interface FormSubmitState {\n /** The enclosing form's submission is in flight (`useFormStatus().pending`). */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface FormSubmitProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"type\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Native `disabled`; owned. Never set by the library (conventions 3.6). Always native, also\n * with a component `render`: a submitter has no handler to honour `aria-disabled`.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, FormSubmitState>;\n style?: StateValue<CSSProperties | undefined, FormSubmitState>;\n children?: StateValue<ReactNode, FormSubmitState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, FormSubmitState>;\n}\n\n/**\n * The form's submit button: `<button type=\"submit\">` with `data-pending` while the enclosing\n * form's submission is in flight (`useFormStatus`). Works in any React-rendered form\n * (`Form.Root`, `Dialog.Form`, a plain `<form action>`). Never disabled while pending: block\n * repeat clicks with CSS on `[data-pending]` if you need to.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>`), `disabled`, `data-pending`,\n * `data-disabled`.\n */\nexport function FormSubmit({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: FormSubmitProps) {\n const { pending } = useFormStatus();\n const ref = useElementCheck(\n isDev &&\n ((el) => {\n const submitter =\n el.tagName === \"BUTTON\" ||\n (el.tagName === \"INPUT\" && [\"submit\", \"image\"].includes((el as HTMLInputElement).type));\n return submitter\n ? null\n : `Form.Submit: expected to render a <button> (or <input type=\"submit\">) but got ` +\n `<${el.tagName.toLowerCase()}>. Only a submit button submits the form natively.`;\n }),\n );\n const state: FormSubmitState = { pending, disabled };\n return useRender<ComponentPropsWithRef<\"button\">, FormSubmitState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n ...(rendersButton(render) && { type: \"submit\" as const }),\n disabled,\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n },\n ref,\n });\n}\n\nFormSubmit.displayName = \"FormSubmit\";\n"],"mappings":";;;;;;;AAQA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;AAgCvC,SAAgB,WAAW,EACzB,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACe;CAClB,MAAM,EAAE,YAAY,cAAc;CAClC,MAAM,MAAM,gBACV,WACI,OAAO;EAIP,OAFE,GAAG,YAAY,YACd,GAAG,YAAY,WAAW,CAAC,UAAU,OAAO,CAAC,CAAC,SAAU,GAAwB,IAAI,IAEnF,OACA,kFACM,GAAG,QAAQ,YAAY,EAAE;CACrC,EACJ;CAEA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA,OAAA;GAJ+B;GAAS;EAIpC;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;GACvD;GACA,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;EACpC;EACA;CACF,CAAC;AACH;AAEA,WAAW,cAAc"}
1
+ {"version":3,"file":"form-submit.mjs","names":[],"sources":["../../src/form/form-submit.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { useFormStatus } from \"react-dom\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useElementCheck } from \"../internal/use-element-check.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * State of `Form.Submit`, passed to the function forms of `className`, `style`, `children` and\n * `render`.\n */\nexport interface FormSubmitState {\n /** The enclosing form's submission is in flight (`useFormStatus().pending`). */\n readonly pending: boolean;\n /** The `disabled` prop (never set by the library while pending). */\n readonly disabled: boolean;\n}\n\n/**\n * Props of `Form.Submit`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport interface FormSubmitProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"type\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Native `disabled`; owned. Never set by the library (conventions 3.6). Always native, also\n * with a component `render`: a submitter has no handler to honour `aria-disabled`.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, FormSubmitState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, FormSubmitState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, FormSubmitState>;\n /** Replace the default `<button>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, FormSubmitState>;\n}\n\n/**\n * The form's submit button: `<button type=\"submit\">` with `data-pending` while the enclosing\n * form's submission is in flight (`useFormStatus`). Works in any React-rendered form\n * (`Form.Root`, `Dialog.Form`, a plain `<form action>`). Never disabled while pending: block\n * repeat clicks with CSS on `[data-pending]` if you need to.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>`), `disabled`, `data-pending`,\n * `data-disabled`.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport function FormSubmit({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: FormSubmitProps) {\n const { pending } = useFormStatus();\n const ref = useElementCheck(\n isDev &&\n ((el) => {\n const submitter =\n el.tagName === \"BUTTON\" ||\n (el.tagName === \"INPUT\" && [\"submit\", \"image\"].includes((el as HTMLInputElement).type));\n return submitter\n ? null\n : `Form.Submit: expected to render a <button> (or <input type=\"submit\">) but got ` +\n `<${el.tagName.toLowerCase()}>. Only a submit button submits the form natively.`;\n }),\n );\n const state: FormSubmitState = { pending, disabled };\n return useRender<ComponentPropsWithRef<\"button\">, FormSubmitState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n ...(rendersButton(render) && { type: \"submit\" as const }),\n disabled,\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n },\n ref,\n });\n}\n\nFormSubmit.displayName = \"FormSubmit\";\n"],"mappings":";;;;;;;AAQA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;AAkDvC,SAAgB,WAAW,EACzB,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACe;CAClB,MAAM,EAAE,YAAY,cAAc;CAClC,MAAM,MAAM,gBACV,WACI,OAAO;EAIP,OAFE,GAAG,YAAY,YACd,GAAG,YAAY,WAAW,CAAC,UAAU,OAAO,CAAC,CAAC,SAAU,GAAwB,IAAI,IAEnF,OACA,kFACM,GAAG,QAAQ,YAAY,EAAE;CACrC,EACJ;CAEA,OAAO,UAA4D;EACjE,gBAAgB;EAChB;EACA,OAAA;GAJ+B;GAAS;EAIpC;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;GACvD;GACA,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;EACpC;EACA;CACF,CAAC;AACH;AAEA,WAAW,cAAc"}
@@ -2,6 +2,13 @@ import { FieldErrorValue, FormErrors } from "../internal/validity.mjs";
2
2
  import { FormRoot, FormRootProps, FormRootState } from "./form-root.mjs";
3
3
  import { FormSubmit, FormSubmitProps, FormSubmitState } from "./form-submit.mjs";
4
4
  //#region src/form/index.d.ts
5
+ /**
6
+ * Form: `Root` (`form`) runs its `action` in a transition with `data-pending`, routes server
7
+ * `errors` to the matching `Field.Root`s, focuses the first invalid field and resets only when the
8
+ * action reported no errors; `Submit` (`button[type=submit]`) shows the form's pending state.
9
+ *
10
+ * @see https://ui.funstack.work/components/field
11
+ */
5
12
  export declare const Form: {
6
13
  readonly Root: typeof FormRoot;
7
14
  readonly Submit: typeof FormSubmit;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/form/index.ts"],"mappings":";;;;qBAGa;WAAS,aAAI;WAAY,eAAM"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/form/index.ts"],"mappings":";;;;;;;;;;;qBAUa;WAAS,aAAI;WAAY,eAAM"}
@@ -1,6 +1,13 @@
1
1
  import { FormRoot } from "./form-root.mjs";
2
2
  import { FormSubmit } from "./form-submit.mjs";
3
3
  //#region src/form/index.ts
4
+ /**
5
+ * Form: `Root` (`form`) runs its `action` in a transition with `data-pending`, routes server
6
+ * `errors` to the matching `Field.Root`s, focuses the first invalid field and resets only when the
7
+ * action reported no errors; `Submit` (`button[type=submit]`) shows the form's pending state.
8
+ *
9
+ * @see https://ui.funstack.work/components/field
10
+ */
4
11
  const Form = {
5
12
  Root: FormRoot,
6
13
  Submit: FormSubmit
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/form/index.ts"],"sourcesContent":["import { FormRoot } from \"./form-root.js\";\nimport { FormSubmit } from \"./form-submit.js\";\n\nexport const Form = { Root: FormRoot, Submit: FormSubmit } as const;\n\nexport type { FormRootProps, FormRootState, FormErrors, FieldErrorValue } from \"./form-root.js\";\nexport type { FormSubmitProps, FormSubmitState } from \"./form-submit.js\";\n"],"mappings":";;;AAGA,MAAa,OAAO;CAAE,MAAM;CAAU,QAAQ;AAAW"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/form/index.ts"],"sourcesContent":["import { FormRoot } from \"./form-root.js\";\nimport { FormSubmit } from \"./form-submit.js\";\n\n/**\n * Form: `Root` (`form`) runs its `action` in a transition with `data-pending`, routes server\n * `errors` to the matching `Field.Root`s, focuses the first invalid field and resets only when the\n * action reported no errors; `Submit` (`button[type=submit]`) shows the form's pending state.\n *\n * @see https://ui.funstack.work/components/field\n */\nexport const Form = { Root: FormRoot, Submit: FormSubmit } as const;\n\nexport type { FormRootProps, FormRootState, FormErrors, FieldErrorValue } from \"./form-root.js\";\nexport type { FormSubmitProps, FormSubmitState } from \"./form-submit.js\";\n"],"mappings":";;;;;;;;;;AAUA,MAAa,OAAO;CAAE,MAAM;CAAU,QAAQ;AAAW"}
package/dist/index.d.mts CHANGED
@@ -80,6 +80,7 @@ import { Popover } from "./popover/index.mjs";
80
80
  import { MenuItemDetails, MenuItemProps, MenuItemState } from "./menu/menu-item.mjs";
81
81
  import { MenuCheckboxItemProps, MenuCheckboxItemState } from "./menu/menu-checkbox-item.mjs";
82
82
  import { MenuTriggerProps, MenuTriggerState } from "./menu/menu-trigger.mjs";
83
+ import { MenuContextTriggerProps, MenuContextTriggerState } from "./menu/menu-context-trigger.mjs";
83
84
  import { MenuGroupLabelProps, MenuGroupLabelState, MenuGroupProps, MenuGroupState, MenuSeparatorProps, MenuSeparatorState } from "./menu/menu-group.mjs";
84
85
  import { MenuAlign, MenuPopupProps, MenuPopupState, MenuSide } from "./menu/menu-popup.mjs";
85
86
  import { MenuRadioGroupProps, MenuRadioGroupState } from "./menu/menu-radio-group.mjs";
@@ -132,4 +133,4 @@ import { MeterLabelProps } from "./meter/meter-label.mjs";
132
133
  import { MeterTrackProps } from "./meter/meter-track.mjs";
133
134
  import { MeterValueProps } from "./meter/meter-value.mjs";
134
135
  import { Meter } from "./meter/index.mjs";
135
- export { Accordion, type AccordionItemProps, type AccordionItemState, type AccordionPanelProps, type AccordionPanelState, type AccordionRootExclusiveProps, type AccordionRootMultipleProps, type AccordionRootProps, type AccordionRootState, type AccordionTriggerProps, type AccordionTriggerState, type AccordionValueChangeDetails, type Action, type ActionDetails, Button, type ButtonActionDetails, type ButtonProps, type ButtonState, CSPProvider, type CSPProviderProps, type ChangeAction, type ChangeReason, Checkbox, type CheckboxCheckedChangeDetails, CheckboxGroup, type CheckboxGroupItemProps, type CheckboxGroupItemState, type CheckboxGroupLabelProps, type CheckboxGroupParentProps, type CheckboxGroupParentState, type CheckboxGroupRootProps, type CheckboxGroupRootState, type CheckboxGroupValueChangeDetails, type CheckboxProps, type CheckboxState, Combobox, type ComboboxClearProps, type ComboboxClearState, type ComboboxEmptyProps, type ComboboxEmptyState, type ComboboxGroupLabelProps, type ComboboxGroupLabelState, type ComboboxGroupProps, type ComboboxGroupState, type ComboboxInputProps, type ComboboxInputState, type ComboboxInputValueChangeDetails, type ComboboxLabelProps, type ComboboxLabelState, type ComboboxListProps, type ComboboxListState, type ComboboxOpenChangeDetails, type ComboboxOptionProps, type ComboboxOptionState, type ComboboxPopupProps, type ComboboxPopupState, type ComboboxRootProps, type ComboboxRootState, type ComboboxStatusProps, type ComboboxStatusState, type ComboboxTriggerProps, type ComboboxTriggerState, type ComboboxValueChangeDetails, Dialog, type DialogCloseDetails, type DialogCloseProps, type DialogCloseState, type DialogDescriptionProps, type DialogDescriptionState, type DialogFormProps, type DialogFormState, type DialogOpenChangeDetails, type DialogPopupProps, type DialogPopupState, type DialogRootProps, type DialogRootState, type DialogTitleProps, type DialogTitleState, type DialogTriggerProps, type DialogTriggerState, Field, type FieldControlProps, type FieldDescriptionProps, type FieldErrorProps, type FieldErrorValue, type FieldLabelProps, type FieldRootProps, type FieldState, type FieldValidate, type FieldValidity, Form, type FormErrors, type FormRootProps, type FormRootState, type FormSubmitProps, type FormSubmitState, Menu, type MenuAlign, type MenuCheckboxItemProps, type MenuCheckboxItemState, type MenuGroupLabelProps, type MenuGroupLabelState, type MenuGroupProps, type MenuGroupState, type MenuItemDetails, type MenuItemProps, type MenuItemState, type MenuOpenChangeDetails, type MenuPopupProps, type MenuPopupState, type MenuRadioGroupProps, type MenuRadioGroupState, type MenuRadioItemProps, type MenuRadioItemState, type MenuRootProps, type MenuRootState, type MenuSeparatorProps, type MenuSeparatorState, type MenuSide, type MenuSubmenuTriggerProps, type MenuSubmenuTriggerState, type MenuTriggerProps, type MenuTriggerState, Meter, type MeterIndicatorProps, type MeterLabelProps, type MeterRegion, type MeterRootProps, type MeterState, type MeterTrackProps, type MeterValueProps, NumberField, type NumberFieldButtonState, type NumberFieldDecrementProps, type NumberFieldIncrementProps, type NumberFieldInputProps, type NumberFieldLabelProps, type NumberFieldRootProps, type NumberFieldState, type NumberFieldValueChangeDetails, Popover, type PopoverAlign, type PopoverCloseProps, type PopoverCloseState, type PopoverDescriptionProps, type PopoverDescriptionState, type PopoverOpenChangeDetails, type PopoverPopupProps, type PopoverPopupState, type PopoverRootProps, type PopoverRootState, type PopoverSide, type PopoverTitleProps, type PopoverTitleState, type PopoverTriggerProps, type PopoverTriggerState, Progress, type ProgressIndicatorProps, type ProgressLabelProps, type ProgressRootProps, type ProgressState, type ProgressTrackProps, type ProgressValueProps, RadioGroup, type RadioGroupItemProps, type RadioGroupItemState, type RadioGroupLabelProps, type RadioGroupRootProps, type RadioGroupRootState, type RadioGroupValueChangeDetails, type RenderProp, STYLE_SHA256, Select, type SelectGroupLabelProps, type SelectGroupProps, type SelectOptionProps, type SelectOptionState, type SelectRootProps, type SelectRootState, type SelectSeparatorProps, type SelectTriggerProps, type SelectValueChangeDetails, type SelectValueProps, Slider, type SliderIndicatorProps, type SliderIndicatorState, type SliderLabelProps, type SliderOrientation, type SliderRootProps, type SliderRootState, type SliderThumbProps, type SliderThumbState, type SliderTrackProps, type SliderTrackState, type SliderValue, type SliderValueChangeDetails, type SliderValueCommitDetails, type SliderValueProps, type SliderValueState, type StateValue, Switch, type SwitchCheckedChangeDetails, type SwitchProps, type SwitchState, Tabs, type TabsActivationMode, type TabsIndicatorProps, type TabsIndicatorState, type TabsListProps, type TabsListState, type TabsOrientation, type TabsPanelProps, type TabsPanelState, type TabsRootProps, type TabsRootState, type TabsTabProps, type TabsTabState, type TabsValueChangeDetails, Toast, type ToastActionDetails, type ToastActionOptions, type ToastActionProps, type ToastActionState, type ToastCloseDetails, type ToastCloseProps, type ToastCloseState, type ToastDescriptionProps, type ToastItem, type ToastManager, type ToastOptions, type ToastPriority, type ToastPromiseOptions, type ToastRootProps, type ToastRootState, type ToastTitleProps, type ToastViewportProps, type ToastViewportState, Toggle, ToggleGroup, type ToggleGroupExclusiveProps, type ToggleGroupItemProps, type ToggleGroupItemState, type ToggleGroupMultipleProps, type ToggleGroupOrientation, type ToggleGroupRootProps, type ToggleGroupRootState, type ToggleGroupValueChangeDetails, type TogglePressedChangeDetails, type ToggleProps, type ToggleState, Toolbar, type ToolbarOrientation, type ToolbarRootProps, type ToolbarRootState, type ToolbarSeparatorProps, type ToolbarSeparatorState, Tooltip, type TooltipAlign, type TooltipArrowProps, type TooltipArrowState, type TooltipPopupProps, type TooltipPopupState, type TooltipProvides, type TooltipRootProps, type TooltipRootState, type TooltipSide, type TooltipTriggerProps, type TooltipTriggerState, type UrgentChangeHandler, createToastManager, toast };
136
+ export { Accordion, type AccordionItemProps, type AccordionItemState, type AccordionPanelProps, type AccordionPanelState, type AccordionRootExclusiveProps, type AccordionRootMultipleProps, type AccordionRootProps, type AccordionRootState, type AccordionTriggerProps, type AccordionTriggerState, type AccordionValueChangeDetails, type Action, type ActionDetails, Button, type ButtonActionDetails, type ButtonProps, type ButtonState, CSPProvider, type CSPProviderProps, type ChangeAction, type ChangeReason, Checkbox, type CheckboxCheckedChangeDetails, CheckboxGroup, type CheckboxGroupItemProps, type CheckboxGroupItemState, type CheckboxGroupLabelProps, type CheckboxGroupParentProps, type CheckboxGroupParentState, type CheckboxGroupRootProps, type CheckboxGroupRootState, type CheckboxGroupValueChangeDetails, type CheckboxProps, type CheckboxState, Combobox, type ComboboxClearProps, type ComboboxClearState, type ComboboxEmptyProps, type ComboboxEmptyState, type ComboboxGroupLabelProps, type ComboboxGroupLabelState, type ComboboxGroupProps, type ComboboxGroupState, type ComboboxInputProps, type ComboboxInputState, type ComboboxInputValueChangeDetails, type ComboboxLabelProps, type ComboboxLabelState, type ComboboxListProps, type ComboboxListState, type ComboboxOpenChangeDetails, type ComboboxOptionProps, type ComboboxOptionState, type ComboboxPopupProps, type ComboboxPopupState, type ComboboxRootProps, type ComboboxRootState, type ComboboxStatusProps, type ComboboxStatusState, type ComboboxTriggerProps, type ComboboxTriggerState, type ComboboxValueChangeDetails, Dialog, type DialogCloseDetails, type DialogCloseProps, type DialogCloseState, type DialogDescriptionProps, type DialogDescriptionState, type DialogFormProps, type DialogFormState, type DialogOpenChangeDetails, type DialogPopupProps, type DialogPopupState, type DialogRootProps, type DialogRootState, type DialogTitleProps, type DialogTitleState, type DialogTriggerProps, type DialogTriggerState, Field, type FieldControlProps, type FieldDescriptionProps, type FieldErrorProps, type FieldErrorValue, type FieldLabelProps, type FieldRootProps, type FieldState, type FieldValidate, type FieldValidity, Form, type FormErrors, type FormRootProps, type FormRootState, type FormSubmitProps, type FormSubmitState, Menu, type MenuAlign, type MenuCheckboxItemProps, type MenuCheckboxItemState, type MenuContextTriggerProps, type MenuContextTriggerState, type MenuGroupLabelProps, type MenuGroupLabelState, type MenuGroupProps, type MenuGroupState, type MenuItemDetails, type MenuItemProps, type MenuItemState, type MenuOpenChangeDetails, type MenuPopupProps, type MenuPopupState, type MenuRadioGroupProps, type MenuRadioGroupState, type MenuRadioItemProps, type MenuRadioItemState, type MenuRootProps, type MenuRootState, type MenuSeparatorProps, type MenuSeparatorState, type MenuSide, type MenuSubmenuTriggerProps, type MenuSubmenuTriggerState, type MenuTriggerProps, type MenuTriggerState, Meter, type MeterIndicatorProps, type MeterLabelProps, type MeterRegion, type MeterRootProps, type MeterState, type MeterTrackProps, type MeterValueProps, NumberField, type NumberFieldButtonState, type NumberFieldDecrementProps, type NumberFieldIncrementProps, type NumberFieldInputProps, type NumberFieldLabelProps, type NumberFieldRootProps, type NumberFieldState, type NumberFieldValueChangeDetails, Popover, type PopoverAlign, type PopoverCloseProps, type PopoverCloseState, type PopoverDescriptionProps, type PopoverDescriptionState, type PopoverOpenChangeDetails, type PopoverPopupProps, type PopoverPopupState, type PopoverRootProps, type PopoverRootState, type PopoverSide, type PopoverTitleProps, type PopoverTitleState, type PopoverTriggerProps, type PopoverTriggerState, Progress, type ProgressIndicatorProps, type ProgressLabelProps, type ProgressRootProps, type ProgressState, type ProgressTrackProps, type ProgressValueProps, RadioGroup, type RadioGroupItemProps, type RadioGroupItemState, type RadioGroupLabelProps, type RadioGroupRootProps, type RadioGroupRootState, type RadioGroupValueChangeDetails, type RenderProp, STYLE_SHA256, Select, type SelectGroupLabelProps, type SelectGroupProps, type SelectOptionProps, type SelectOptionState, type SelectRootProps, type SelectRootState, type SelectSeparatorProps, type SelectTriggerProps, type SelectValueChangeDetails, type SelectValueProps, Slider, type SliderIndicatorProps, type SliderIndicatorState, type SliderLabelProps, type SliderOrientation, type SliderRootProps, type SliderRootState, type SliderThumbProps, type SliderThumbState, type SliderTrackProps, type SliderTrackState, type SliderValue, type SliderValueChangeDetails, type SliderValueCommitDetails, type SliderValueProps, type SliderValueState, type StateValue, Switch, type SwitchCheckedChangeDetails, type SwitchProps, type SwitchState, Tabs, type TabsActivationMode, type TabsIndicatorProps, type TabsIndicatorState, type TabsListProps, type TabsListState, type TabsOrientation, type TabsPanelProps, type TabsPanelState, type TabsRootProps, type TabsRootState, type TabsTabProps, type TabsTabState, type TabsValueChangeDetails, Toast, type ToastActionDetails, type ToastActionOptions, type ToastActionProps, type ToastActionState, type ToastCloseDetails, type ToastCloseProps, type ToastCloseState, type ToastDescriptionProps, type ToastItem, type ToastManager, type ToastOptions, type ToastPriority, type ToastPromiseOptions, type ToastRootProps, type ToastRootState, type ToastTitleProps, type ToastViewportProps, type ToastViewportState, Toggle, ToggleGroup, type ToggleGroupExclusiveProps, type ToggleGroupItemProps, type ToggleGroupItemState, type ToggleGroupMultipleProps, type ToggleGroupOrientation, type ToggleGroupRootProps, type ToggleGroupRootState, type ToggleGroupValueChangeDetails, type TogglePressedChangeDetails, type ToggleProps, type ToggleState, Toolbar, type ToolbarOrientation, type ToolbarRootProps, type ToolbarRootState, type ToolbarSeparatorProps, type ToolbarSeparatorState, Tooltip, type TooltipAlign, type TooltipArrowProps, type TooltipArrowState, type TooltipPopupProps, type TooltipPopupState, type TooltipProvides, type TooltipRootProps, type TooltipRootState, type TooltipSide, type TooltipTriggerProps, type TooltipTriggerState, type UrgentChangeHandler, createToastManager, toast };
@@ -9,6 +9,9 @@ export type Orientation = "horizontal" | "vertical";
9
9
  * returns data, as Server Functions usually do (conventions 2.2).
10
10
  */
11
11
  export type Action<Args extends readonly unknown[] = []> = (...args: Args) => unknown;
12
+ /**
13
+ * The base of every `details` object an action receives (the second argument of a change action).
14
+ */
12
15
  export interface ActionDetails {
13
16
  /** The DOM event that caused the action, or `undefined` for programmatic changes. */
14
17
  readonly event: Event | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/internal/types.ts"],"mappings":";;;YAGY;;;;;;;YAQA,OAAO,4CAA4C,MAAM;iBAEpD;;WAEN,OAAO;;;YAIN,aAAa,GAAG,gBAAgB,gBAAgB,iBAAiB,QAC1E,MAAM,GAAG,SAAS;;;;;;;;YAUT,oBAAoB,GAAG,gBAAgB,gBAAgB,kBACjE,MAAM,GACN,SAAS;;;;;;;;;;;;;;;YAiBC;;YAGA,WAAW,GAAG,SAAS,MAAM,OAAO,UAAU;;;;;;YAO9C,WAAW,OAAO,SAC1B,aAAa,QAAQ,YACnB,OAAO,OAAO,OAAO,UAAU"}
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/internal/types.ts"],"mappings":";;;YAGY;;;;;;;YAQA,OAAO,4CAA4C,MAAM;;;;iBAKpD;;WAEN,OAAO;;;YAIN,aAAa,GAAG,gBAAgB,gBAAgB,iBAAiB,QAC1E,MAAM,GAAG,SAAS;;;;;;;;YAUT,oBAAoB,GAAG,gBAAgB,gBAAgB,kBACjE,MAAM,GACN,SAAS;;;;;;;;;;;;;;;YAiBC;;YAGA,WAAW,GAAG,SAAS,MAAM,OAAO,UAAU;;;;;;YAO9C,WAAW,OAAO,SAC1B,aAAa,QAAQ,YACnB,OAAO,OAAO,OAAO,UAAU"}
@@ -9,6 +9,7 @@ export interface PopoverTriggerHookState {
9
9
  readonly open: boolean;
10
10
  /** The Root's transition is pending (an open, a part-initiated close or a dismissal notification). */
11
11
  readonly pending: boolean;
12
+ /** The `disabled` prop. */
12
13
  readonly disabled: boolean;
13
14
  }
14
15
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"use-popover-trigger.d.mts","names":[],"sources":["../../src/internal/use-popover-trigger.ts"],"mappings":";;;;;;iBA6CiB;;WAEN;;WAEA;WACA"}
1
+ {"version":3,"file":"use-popover-trigger.d.mts","names":[],"sources":["../../src/internal/use-popover-trigger.ts"],"mappings":";;;;;;iBA6CiB;;WAEN;;WAEA;;WAEA"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-popover-trigger.mjs","names":[],"sources":["../../src/internal/use-popover-trigger.ts"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type { ComponentPropsWithRef, DOMAttributes, MouseEvent } from \"react\";\nimport { dataAttr } from \"./data-attr.js\";\nimport { isPopoverOpen } from \"./popover-open.js\";\nimport { registerTrigger } from \"./trigger-ref.js\";\nimport type { RenderProp } from \"./types.js\";\nimport { useElementCheck } from \"./use-element-check.js\";\nimport { disabledButton, rendersButton } from \"./use-render.js\";\nimport type { DataAttributes } from \"./use-render.js\";\nimport type { PopoverRootValue } from \"./use-overlay-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * Owned and never written on an overlay Trigger (Popover, Menu, Combobox): the default\n * `popovertarget` action, which a render element must not change, and an Invoker Command, which\n * would take precedence over `popovertarget` and act on another element.\n */\nexport const RESERVED_INVOKER_KEYS = {\n popoverTargetAction: undefined,\n commandfor: undefined,\n command: undefined,\n} as const;\n\n/**\n * The library-mode dev warning for a Trigger rendered as another element than a `<button>`: only\n * an invoker button is spared by the popover's light dismiss, so a press while the popup is open\n * hides it before the click. `popover` and `popup` are the nouns the text uses for it.\n */\nexport function nonInvokerMessage(\n part: string,\n tag: string,\n popover: string,\n popup: string,\n): string {\n return (\n `${part}: rendered a <${tag}>. Only a <button> is the ${popover}'s invoker: a press on ` +\n `this element while the ${popup} is open closes it through light dismiss before the ` +\n \"click, so the close is not awaited, openChangeAction(false) cannot veto it and \" +\n \"there is no exit transition. Render a <button>.\"\n );\n}\n\n/** The state of an overlay Trigger (Popover.Trigger, Menu.Trigger and its siblings). */\nexport interface PopoverTriggerHookState {\n /** Optimistic open state. A Popover in JS-free mode (the browser owns it) reports `false`. */\n readonly open: boolean;\n /** The Root's transition is pending (an open, a part-initiated close or a dismissal notification). */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\n/** Event handlers a component layers onto the Trigger's own (Menu's keys and hover intent). */\nexport type PopoverTriggerHandlers = Pick<\n DOMAttributes<HTMLButtonElement>,\n \"onClick\" | \"onKeyDown\" | \"onMouseDown\" | \"onPointerMove\" | \"onPointerEnter\" | \"onPointerLeave\"\n>;\n\nexport interface UsePopoverTriggerOptions<State> {\n /** Public name of the part for development warnings (`\"Popover.Trigger\"`). */\n readonly part: string;\n readonly disabled: boolean;\n readonly render: RenderProp<ComponentPropsWithRef<\"button\">, State> | undefined;\n /**\n * Extra handlers, merged in front of the Trigger's own: for a key both define, the extra one\n * runs first (the consumer's pass-through handler still runs before both, conventions 1.2).\n */\n readonly handlers?: PopoverTriggerHandlers;\n /**\n * What a click does in library mode, after the command has been cancelled and `disabled`\n * checked, replacing the default toggle against `intended()` (`requestOpen` / `requestClose`).\n * Menu's SubmenuTrigger opens, or moves focus into an already open submenu, and never closes;\n * so with `activate` the library-mode non-button warning says a press while open dismisses the\n * popup instead of moving focus into it.\n */\n readonly activate?: (event: MouseEvent<HTMLElement>) => void;\n /** Runs right before the default toggle's `requestOpen` (Menu.Trigger: the open cause). */\n readonly beforeOpen?: (event: MouseEvent<HTMLElement>) => void;\n /**\n * How `disabled` is rendered. `\"native\"` (default): the `disabled` attribute, so the button is\n * no invoker at all; in library mode a link or component `render` still gets the `\"aria\"`\n * branch, because native `disabled` means nothing on a link and the installed click handler is\n * what refuses. `\"aria\"`: `aria-disabled=\"true\"` and no `disabled` (a menu item stays\n * focusable); the click handler still refuses.\n */\n readonly disabledAs?: \"native\" | \"aria\";\n}\n\nexport interface PopoverTriggerHook {\n readonly state: PopoverTriggerHookState;\n /** Owned props (conventions 1.2) for `useRender`'s `libraryProps`. */\n readonly libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes;\n /** Registers the element as the Root's Trigger; pass as `useRender`'s `ref`. */\n readonly ref: (element: HTMLElement) => () => void;\n}\n\n/**\n * The Trigger of a popover-like component (design/components/popover.md 14.3):\n * `button[popoverTarget]`, with no `aria-expanded` on an invoker: every engine exposes the\n * popover's shown state from the invoker relationship. In JS-free mode the browser toggles\n * the popover and the Popup keeps `data-open` current on the element. In library mode the click\n * is cancelled (so the activation does not run) and toggles against what the user already\n * intends: an open through `requestOpen`, a library-owned close through `requestClose`. There\n * `data-open` and `state.open` are optimistic; a non-button `render` (no invoker) renders\n * `aria-expanded` from whether the popup is shown (in the top layer).\n *\n * Menu adds `aria-haspopup=\"menu\"` and its own key handling on top.\n */\nexport function usePopoverTrigger<State>(\n ctx: PopoverRootValue,\n options: UsePopoverTriggerOptions<State>,\n): PopoverTriggerHook {\n const { part, disabled, render, handlers, activate, beforeOpen, disabledAs = \"native\" } = options;\n const isLibrary = ctx.mode === \"library\";\n const { ids, triggerRef, popupRef } = ctx;\n\n const state: PopoverTriggerHookState = {\n open: ctx.optimistic,\n // Opens, part-initiated closes and dismissal notifications all belong to the Trigger (4.2).\n pending: ctx.pending,\n disabled,\n };\n\n const checkElement = useElementCheck(\n isDev &&\n ((element) => {\n if (element.tagName === \"BUTTON\") return null;\n const tag = element.tagName.toLowerCase();\n // Library mode: the click handler works, but only an invoker button is spared by the\n // popover's light dismiss, so a press while open hides the popup before the click.\n if (isLibrary && activate !== undefined) {\n return (\n `${part}: rendered a <${tag}>. Only a <button> is the popover's invoker: a press on ` +\n \"this element while its popup is open dismisses the popup through light dismiss \" +\n \"instead of moving focus into it. Render a <button>.\"\n );\n }\n return isLibrary\n ? nonInvokerMessage(part, tag, \"popover\", \"popup\")\n : `${part}: rendered a <${tag}> in JS-free mode. Only a <button> is a ` +\n \"`popovertarget` invoker; this trigger will not open the popover. Render a \" +\n \"<button>, or put the component in library mode (`defaultOpen={false}`).\";\n }),\n );\n const ref = useCallback(\n (element: HTMLElement) => {\n checkElement?.(element);\n const unregister = registerTrigger(triggerRef, element, part);\n // JS-free mode: the DOM owns `data-open` (design 9). A Trigger that mounts after the\n // Popup (or is re-created) picks up the current state here.\n if (!isLibrary && popupRef.current !== null) {\n element.toggleAttribute(\"data-open\", isPopoverOpen(popupRef.current));\n }\n return unregister;\n },\n [isLibrary, checkElement, triggerRef, popupRef, part],\n );\n\n const onClick = (event: MouseEvent<HTMLElement>) => {\n // Cancelling the click cancels the popover toggle (it runs as the button's activation\n // behaviour, only if the click was not cancelled). Enter and Space synthesise the same click.\n event.preventDefault();\n if (disabled) return;\n if (activate !== undefined) {\n activate(event);\n return;\n }\n const native = event.nativeEvent;\n if (ctx.intended()) {\n ctx.requestClose(native, \"activate\");\n } else {\n // First: what it records (Menu's open cause) must be in place before anything can show the\n // popup. Today the show waits for the apply effect, so the order is not observable.\n beforeOpen?.(event);\n ctx.requestOpen(native, \"activate\");\n }\n };\n\n // The component's handlers first, then the Trigger's (design/components/menu.md 14). The click\n // handler is only owned when installed, so a render element keeps its own `onClick` in JS-free\n // mode.\n const merged: PopoverTriggerHandlers = { ...handlers };\n if (isLibrary) {\n const extra = handlers?.onClick;\n merged.onClick =\n extra === undefined\n ? onClick\n : (event) => {\n extra(event);\n onClick(event);\n };\n }\n // The click handler is installed in library mode only; in JS-free mode the activation needs\n // native `disabled` to stop it.\n const disabledProps = disabledButton(render, disabled, {\n handlesClick: isLibrary,\n alwaysFocusable: disabledAs === \"aria\",\n });\n\n const invoker = disabledProps.invoker && rendersButton(render);\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n // `type` only applies to a <button>; on any other element the key is not owned.\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Trigger (in JS-free mode the browser\n // would toggle the popover).\n ...disabledProps.props,\n // Only on a button (or a component, assumed to render one): another element is no invoker,\n // and the attribute would claim otherwise.\n popoverTarget: invoker ? ids.popup : undefined,\n ...RESERVED_INVOKER_KEYS,\n // No `aria-expanded` on an invoker: every engine exposes the popover's shown state from\n // `popovertarget`, and ARIA in HTML forbids the attribute there. Otherwise nothing else\n // exposes the state: library mode renders shown (the popup is in the top layer; `data-open`\n // is the optimistic one), JS-free mode cannot know it and renders \"false\".\n \"aria-expanded\": invoker ? undefined : isLibrary ? ctx.shown : false,\n ...merged,\n \"data-open\": dataAttr(state.open),\n \"data-pending\": dataAttr(state.pending),\n // Every mode: the styling hook agrees with the rendered `disabled` / `aria-disabled`\n // (conventions 1.2).\n \"data-disabled\": dataAttr(disabled),\n };\n\n return { state, libraryProps, ref };\n}\n"],"mappings":";;;;;;;;AAYA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;AAOvC,MAAa,wBAAwB;CACnC,qBAAqB,KAAA;CACrB,YAAY,KAAA;CACZ,SAAS,KAAA;AACX;;;;;;AAOA,SAAgB,kBACd,MACA,KACA,SACA,OACQ;CACR,OACE,GAAG,KAAK,gBAAgB,IAAI,4BAA4B,QAAQ,gDACtC,MAAM;AAIpC;;;;;;;;;;;;;AAmEA,SAAgB,kBACd,KACA,SACoB;CACpB,MAAM,EAAE,MAAM,UAAU,QAAQ,UAAU,UAAU,YAAY,aAAa,aAAa;CAC1F,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,KAAK,YAAY,aAAa;CAEtC,MAAM,QAAiC;EACrC,MAAM,IAAI;EAEV,SAAS,IAAI;EACb;CACF;CAEA,MAAM,eAAe,gBACnB,WACI,YAAY;EACZ,IAAI,QAAQ,YAAY,UAAU,OAAO;EACzC,MAAM,MAAM,QAAQ,QAAQ,YAAY;EAGxC,IAAI,aAAa,aAAa,KAAA,GAC5B,OACE,GAAG,KAAK,gBAAgB,IAAI;EAKhC,OAAO,YACH,kBAAkB,MAAM,KAAK,WAAW,OAAO,IAC/C,GAAG,KAAK,gBAAgB,IAAI;CAGlC,EACJ;CACA,MAAM,MAAM,aACT,YAAyB;EACxB,eAAe,OAAO;EACtB,MAAM,aAAa,gBAAgB,YAAY,SAAS,IAAI;EAG5D,IAAI,CAAC,aAAa,SAAS,YAAY,MACrC,QAAQ,gBAAgB,aAAa,cAAc,SAAS,OAAO,CAAC;EAEtE,OAAO;CACT,GACA;EAAC;EAAW;EAAc;EAAY;EAAU;CAAI,CACtD;CAEA,MAAM,WAAW,UAAmC;EAGlD,MAAM,eAAe;EACrB,IAAI,UAAU;EACd,IAAI,aAAa,KAAA,GAAW;GAC1B,SAAS,KAAK;GACd;EACF;EACA,MAAM,SAAS,MAAM;EACrB,IAAI,IAAI,SAAS,GACf,IAAI,aAAa,QAAQ,UAAU;OAC9B;GAGL,aAAa,KAAK;GAClB,IAAI,YAAY,QAAQ,UAAU;EACpC;CACF;CAKA,MAAM,SAAiC,EAAE,GAAG,SAAS;CACrD,IAAI,WAAW;EACb,MAAM,QAAQ,UAAU;EACxB,OAAO,UACL,UAAU,KAAA,IACN,WACC,UAAU;GACT,MAAM,KAAK;GACX,QAAQ,KAAK;EACf;CACR;CAGA,MAAM,gBAAgB,eAAe,QAAQ,UAAU;EACrD,cAAc;EACd,iBAAiB,eAAe;CAClC,CAAC;CAED,MAAM,UAAU,cAAc,WAAW,cAAc,MAAM;CAyB7D,OAAO;EAAE;EAAO,cAAA;GArBd,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;GAGvD,GAAG,cAAc;GAGjB,eAAe,UAAU,IAAI,QAAQ,KAAA;GACrC,GAAG;GAKH,iBAAiB,UAAU,KAAA,IAAY,YAAY,IAAI,QAAQ;GAC/D,GAAG;GACH,aAAa,SAAS,MAAM,IAAI;GAChC,gBAAgB,SAAS,MAAM,OAAO;GAGtC,iBAAiB,SAAS,QAAQ;EAGT;EAAG;CAAI;AACpC"}
1
+ {"version":3,"file":"use-popover-trigger.mjs","names":[],"sources":["../../src/internal/use-popover-trigger.ts"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type { ComponentPropsWithRef, DOMAttributes, MouseEvent } from \"react\";\nimport { dataAttr } from \"./data-attr.js\";\nimport { isPopoverOpen } from \"./popover-open.js\";\nimport { registerTrigger } from \"./trigger-ref.js\";\nimport type { RenderProp } from \"./types.js\";\nimport { useElementCheck } from \"./use-element-check.js\";\nimport { disabledButton, rendersButton } from \"./use-render.js\";\nimport type { DataAttributes } from \"./use-render.js\";\nimport type { PopoverRootValue } from \"./use-overlay-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * Owned and never written on an overlay Trigger (Popover, Menu, Combobox): the default\n * `popovertarget` action, which a render element must not change, and an Invoker Command, which\n * would take precedence over `popovertarget` and act on another element.\n */\nexport const RESERVED_INVOKER_KEYS = {\n popoverTargetAction: undefined,\n commandfor: undefined,\n command: undefined,\n} as const;\n\n/**\n * The library-mode dev warning for a Trigger rendered as another element than a `<button>`: only\n * an invoker button is spared by the popover's light dismiss, so a press while the popup is open\n * hides it before the click. `popover` and `popup` are the nouns the text uses for it.\n */\nexport function nonInvokerMessage(\n part: string,\n tag: string,\n popover: string,\n popup: string,\n): string {\n return (\n `${part}: rendered a <${tag}>. Only a <button> is the ${popover}'s invoker: a press on ` +\n `this element while the ${popup} is open closes it through light dismiss before the ` +\n \"click, so the close is not awaited, openChangeAction(false) cannot veto it and \" +\n \"there is no exit transition. Render a <button>.\"\n );\n}\n\n/** The state of an overlay Trigger (Popover.Trigger, Menu.Trigger and its siblings). */\nexport interface PopoverTriggerHookState {\n /** Optimistic open state. A Popover in JS-free mode (the browser owns it) reports `false`. */\n readonly open: boolean;\n /** The Root's transition is pending (an open, a part-initiated close or a dismissal notification). */\n readonly pending: boolean;\n /** The `disabled` prop. */\n readonly disabled: boolean;\n}\n\n/** Event handlers a component layers onto the Trigger's own (Menu's keys and hover intent). */\nexport type PopoverTriggerHandlers = Pick<\n DOMAttributes<HTMLButtonElement>,\n \"onClick\" | \"onKeyDown\" | \"onMouseDown\" | \"onPointerMove\" | \"onPointerEnter\" | \"onPointerLeave\"\n>;\n\nexport interface UsePopoverTriggerOptions<State> {\n /** Public name of the part for development warnings (`\"Popover.Trigger\"`). */\n readonly part: string;\n readonly disabled: boolean;\n readonly render: RenderProp<ComponentPropsWithRef<\"button\">, State> | undefined;\n /**\n * Extra handlers, merged in front of the Trigger's own: for a key both define, the extra one\n * runs first (the consumer's pass-through handler still runs before both, conventions 1.2).\n */\n readonly handlers?: PopoverTriggerHandlers;\n /**\n * What a click does in library mode, after the command has been cancelled and `disabled`\n * checked, replacing the default toggle against `intended()` (`requestOpen` / `requestClose`).\n * Menu's SubmenuTrigger opens, or moves focus into an already open submenu, and never closes;\n * so with `activate` the library-mode non-button warning says a press while open dismisses the\n * popup instead of moving focus into it.\n */\n readonly activate?: (event: MouseEvent<HTMLElement>) => void;\n /** Runs right before the default toggle's `requestOpen` (Menu.Trigger: the open cause). */\n readonly beforeOpen?: (event: MouseEvent<HTMLElement>) => void;\n /**\n * How `disabled` is rendered. `\"native\"` (default): the `disabled` attribute, so the button is\n * no invoker at all; in library mode a link or component `render` still gets the `\"aria\"`\n * branch, because native `disabled` means nothing on a link and the installed click handler is\n * what refuses. `\"aria\"`: `aria-disabled=\"true\"` and no `disabled` (a menu item stays\n * focusable); the click handler still refuses.\n */\n readonly disabledAs?: \"native\" | \"aria\";\n}\n\nexport interface PopoverTriggerHook {\n readonly state: PopoverTriggerHookState;\n /** Owned props (conventions 1.2) for `useRender`'s `libraryProps`. */\n readonly libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes;\n /** Registers the element as the Root's Trigger; pass as `useRender`'s `ref`. */\n readonly ref: (element: HTMLElement) => () => void;\n}\n\n/**\n * The Trigger of a popover-like component (design/components/popover.md 14.3):\n * `button[popoverTarget]`, with no `aria-expanded` on an invoker: every engine exposes the\n * popover's shown state from the invoker relationship. In JS-free mode the browser toggles\n * the popover and the Popup keeps `data-open` current on the element. In library mode the click\n * is cancelled (so the activation does not run) and toggles against what the user already\n * intends: an open through `requestOpen`, a library-owned close through `requestClose`. There\n * `data-open` and `state.open` are optimistic; a non-button `render` (no invoker) renders\n * `aria-expanded` from whether the popup is shown (in the top layer).\n *\n * Menu adds `aria-haspopup=\"menu\"` and its own key handling on top.\n */\nexport function usePopoverTrigger<State>(\n ctx: PopoverRootValue,\n options: UsePopoverTriggerOptions<State>,\n): PopoverTriggerHook {\n const { part, disabled, render, handlers, activate, beforeOpen, disabledAs = \"native\" } = options;\n const isLibrary = ctx.mode === \"library\";\n const { ids, triggerRef, popupRef } = ctx;\n\n const state: PopoverTriggerHookState = {\n open: ctx.optimistic,\n // Opens, part-initiated closes and dismissal notifications all belong to the Trigger (4.2).\n pending: ctx.pending,\n disabled,\n };\n\n const checkElement = useElementCheck(\n isDev &&\n ((element) => {\n if (element.tagName === \"BUTTON\") return null;\n const tag = element.tagName.toLowerCase();\n // Library mode: the click handler works, but only an invoker button is spared by the\n // popover's light dismiss, so a press while open hides the popup before the click.\n if (isLibrary && activate !== undefined) {\n return (\n `${part}: rendered a <${tag}>. Only a <button> is the popover's invoker: a press on ` +\n \"this element while its popup is open dismisses the popup through light dismiss \" +\n \"instead of moving focus into it. Render a <button>.\"\n );\n }\n return isLibrary\n ? nonInvokerMessage(part, tag, \"popover\", \"popup\")\n : `${part}: rendered a <${tag}> in JS-free mode. Only a <button> is a ` +\n \"`popovertarget` invoker; this trigger will not open the popover. Render a \" +\n \"<button>, or put the component in library mode (`defaultOpen={false}`).\";\n }),\n );\n const ref = useCallback(\n (element: HTMLElement) => {\n checkElement?.(element);\n const unregister = registerTrigger(triggerRef, element, part);\n // JS-free mode: the DOM owns `data-open` (design 9). A Trigger that mounts after the\n // Popup (or is re-created) picks up the current state here.\n if (!isLibrary && popupRef.current !== null) {\n element.toggleAttribute(\"data-open\", isPopoverOpen(popupRef.current));\n }\n return unregister;\n },\n [isLibrary, checkElement, triggerRef, popupRef, part],\n );\n\n const onClick = (event: MouseEvent<HTMLElement>) => {\n // Cancelling the click cancels the popover toggle (it runs as the button's activation\n // behaviour, only if the click was not cancelled). Enter and Space synthesise the same click.\n event.preventDefault();\n if (disabled) return;\n if (activate !== undefined) {\n activate(event);\n return;\n }\n const native = event.nativeEvent;\n if (ctx.intended()) {\n ctx.requestClose(native, \"activate\");\n } else {\n // First: what it records (Menu's open cause) must be in place before anything can show the\n // popup. Today the show waits for the apply effect, so the order is not observable.\n beforeOpen?.(event);\n ctx.requestOpen(native, \"activate\");\n }\n };\n\n // The component's handlers first, then the Trigger's (design/components/menu.md 14). The click\n // handler is only owned when installed, so a render element keeps its own `onClick` in JS-free\n // mode.\n const merged: PopoverTriggerHandlers = { ...handlers };\n if (isLibrary) {\n const extra = handlers?.onClick;\n merged.onClick =\n extra === undefined\n ? onClick\n : (event) => {\n extra(event);\n onClick(event);\n };\n }\n // The click handler is installed in library mode only; in JS-free mode the activation needs\n // native `disabled` to stop it.\n const disabledProps = disabledButton(render, disabled, {\n handlesClick: isLibrary,\n alwaysFocusable: disabledAs === \"aria\",\n });\n\n const invoker = disabledProps.invoker && rendersButton(render);\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n // `type` only applies to a <button>; on any other element the key is not owned.\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Trigger (in JS-free mode the browser\n // would toggle the popover).\n ...disabledProps.props,\n // Only on a button (or a component, assumed to render one): another element is no invoker,\n // and the attribute would claim otherwise.\n popoverTarget: invoker ? ids.popup : undefined,\n ...RESERVED_INVOKER_KEYS,\n // No `aria-expanded` on an invoker: every engine exposes the popover's shown state from\n // `popovertarget`, and ARIA in HTML forbids the attribute there. Otherwise nothing else\n // exposes the state: library mode renders shown (the popup is in the top layer; `data-open`\n // is the optimistic one), JS-free mode cannot know it and renders \"false\".\n \"aria-expanded\": invoker ? undefined : isLibrary ? ctx.shown : false,\n ...merged,\n \"data-open\": dataAttr(state.open),\n \"data-pending\": dataAttr(state.pending),\n // Every mode: the styling hook agrees with the rendered `disabled` / `aria-disabled`\n // (conventions 1.2).\n \"data-disabled\": dataAttr(disabled),\n };\n\n return { state, libraryProps, ref };\n}\n"],"mappings":";;;;;;;;AAYA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;AAOvC,MAAa,wBAAwB;CACnC,qBAAqB,KAAA;CACrB,YAAY,KAAA;CACZ,SAAS,KAAA;AACX;;;;;;AAOA,SAAgB,kBACd,MACA,KACA,SACA,OACQ;CACR,OACE,GAAG,KAAK,gBAAgB,IAAI,4BAA4B,QAAQ,gDACtC,MAAM;AAIpC;;;;;;;;;;;;;AAoEA,SAAgB,kBACd,KACA,SACoB;CACpB,MAAM,EAAE,MAAM,UAAU,QAAQ,UAAU,UAAU,YAAY,aAAa,aAAa;CAC1F,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,KAAK,YAAY,aAAa;CAEtC,MAAM,QAAiC;EACrC,MAAM,IAAI;EAEV,SAAS,IAAI;EACb;CACF;CAEA,MAAM,eAAe,gBACnB,WACI,YAAY;EACZ,IAAI,QAAQ,YAAY,UAAU,OAAO;EACzC,MAAM,MAAM,QAAQ,QAAQ,YAAY;EAGxC,IAAI,aAAa,aAAa,KAAA,GAC5B,OACE,GAAG,KAAK,gBAAgB,IAAI;EAKhC,OAAO,YACH,kBAAkB,MAAM,KAAK,WAAW,OAAO,IAC/C,GAAG,KAAK,gBAAgB,IAAI;CAGlC,EACJ;CACA,MAAM,MAAM,aACT,YAAyB;EACxB,eAAe,OAAO;EACtB,MAAM,aAAa,gBAAgB,YAAY,SAAS,IAAI;EAG5D,IAAI,CAAC,aAAa,SAAS,YAAY,MACrC,QAAQ,gBAAgB,aAAa,cAAc,SAAS,OAAO,CAAC;EAEtE,OAAO;CACT,GACA;EAAC;EAAW;EAAc;EAAY;EAAU;CAAI,CACtD;CAEA,MAAM,WAAW,UAAmC;EAGlD,MAAM,eAAe;EACrB,IAAI,UAAU;EACd,IAAI,aAAa,KAAA,GAAW;GAC1B,SAAS,KAAK;GACd;EACF;EACA,MAAM,SAAS,MAAM;EACrB,IAAI,IAAI,SAAS,GACf,IAAI,aAAa,QAAQ,UAAU;OAC9B;GAGL,aAAa,KAAK;GAClB,IAAI,YAAY,QAAQ,UAAU;EACpC;CACF;CAKA,MAAM,SAAiC,EAAE,GAAG,SAAS;CACrD,IAAI,WAAW;EACb,MAAM,QAAQ,UAAU;EACxB,OAAO,UACL,UAAU,KAAA,IACN,WACC,UAAU;GACT,MAAM,KAAK;GACX,QAAQ,KAAK;EACf;CACR;CAGA,MAAM,gBAAgB,eAAe,QAAQ,UAAU;EACrD,cAAc;EACd,iBAAiB,eAAe;CAClC,CAAC;CAED,MAAM,UAAU,cAAc,WAAW,cAAc,MAAM;CAyB7D,OAAO;EAAE;EAAO,cAAA;GArBd,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;GAGvD,GAAG,cAAc;GAGjB,eAAe,UAAU,IAAI,QAAQ,KAAA;GACrC,GAAG;GAKH,iBAAiB,UAAU,KAAA,IAAY,YAAY,IAAI,QAAQ;GAC/D,GAAG;GACH,aAAa,SAAS,MAAM,IAAI;GAChC,gBAAgB,SAAS,MAAM,OAAO;GAGtC,iBAAiB,SAAS,QAAQ;EAGT;EAAG;CAAI;AACpC"}
@@ -8,16 +8,27 @@ export type FormErrors = Readonly<Record<string, FieldErrorValue>>;
8
8
  * `valid: true` on the server and before the first read).
9
9
  */
10
10
  export interface FieldValidity {
11
+ /** A required control has no value. */
11
12
  readonly valueMissing: boolean;
13
+ /** The value does not match the `type` (email, url). */
12
14
  readonly typeMismatch: boolean;
15
+ /** The value does not match `pattern`. */
13
16
  readonly patternMismatch: boolean;
17
+ /** The value is longer than `maxLength`. */
14
18
  readonly tooLong: boolean;
19
+ /** The value is shorter than `minLength`. */
15
20
  readonly tooShort: boolean;
21
+ /** The value is below `min`. */
16
22
  readonly rangeUnderflow: boolean;
23
+ /** The value is above `max`. */
17
24
  readonly rangeOverflow: boolean;
25
+ /** The value is not on the `step` grid. */
18
26
  readonly stepMismatch: boolean;
27
+ /** The browser cannot convert the input to a value. */
19
28
  readonly badInput: boolean;
29
+ /** A custom message is set (`validate` or a shown server error). */
20
30
  readonly customError: boolean;
31
+ /** No constraint is violated. */
21
32
  readonly valid: boolean;
22
33
  }
23
34
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"validity.d.mts","names":[],"sources":["../../src/internal/validity.ts"],"mappings":";;YAIY;;YAGA,aAAa,SAAS,eAAe;;;;;iBAMhC;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA"}
1
+ {"version":3,"file":"validity.d.mts","names":[],"sources":["../../src/internal/validity.ts"],"mappings":";;YAIY;;YAGA,aAAa,SAAS,eAAe;;;;;iBAMhC;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA"}
@@ -1 +1 @@
1
- {"version":3,"file":"validity.mjs","names":[],"sources":["../../src/internal/validity.ts"],"sourcesContent":["// Directive-free helpers for Field and Form (design/components/field-form.md 2, 14): the validity\n// snapshot, error-value normalisation, the `:user-invalid` read and the element resolution.\n\n/** A field error: a message, several messages, or nothing (`\"\"`, `[]`, `null`, `undefined`). */\nexport type FieldErrorValue = string | readonly string[] | null | undefined;\n\n/** Field errors keyed by field `name` (usually `state.errors` from `useActionState`). */\nexport type FormErrors = Readonly<Record<string, FieldErrorValue>>;\n\n/**\n * A plain, serialisable snapshot of the control's `ValidityState` (all `false` and\n * `valid: true` on the server and before the first read).\n */\nexport interface FieldValidity {\n readonly valueMissing: boolean;\n readonly typeMismatch: boolean;\n readonly patternMismatch: boolean;\n readonly tooLong: boolean;\n readonly tooShort: boolean;\n readonly rangeUnderflow: boolean;\n readonly rangeOverflow: boolean;\n readonly stepMismatch: boolean;\n readonly badInput: boolean;\n readonly customError: boolean;\n readonly valid: boolean;\n}\n\nconst VALIDITY_KEYS = [\n \"valueMissing\",\n \"typeMismatch\",\n \"patternMismatch\",\n \"tooLong\",\n \"tooShort\",\n \"rangeUnderflow\",\n \"rangeOverflow\",\n \"stepMismatch\",\n \"badInput\",\n \"customError\",\n \"valid\",\n] as const satisfies readonly (keyof FieldValidity)[];\n\nexport const VALID: FieldValidity = Object.freeze({\n valueMissing: false,\n typeMismatch: false,\n patternMismatch: false,\n tooLong: false,\n tooShort: false,\n rangeUnderflow: false,\n rangeOverflow: false,\n stepMismatch: false,\n badInput: false,\n customError: false,\n valid: true,\n});\n\nexport function snapshotValidity(validity: ValidityState): FieldValidity {\n const result = {} as Record<keyof FieldValidity, boolean>;\n for (const key of VALIDITY_KEYS) result[key] = validity[key];\n return result;\n}\n\nexport function validityEquals(a: FieldValidity, b: FieldValidity): boolean {\n return VALIDITY_KEYS.every((key) => a[key] === b[key]);\n}\n\nconst NONE: readonly string[] = Object.freeze([]);\n\n/** `\"\"`, `[]`, `null` and `undefined` mean no error; empty strings inside an array are dropped. */\nexport function normaliseErrorValue(value: FieldErrorValue): readonly string[] {\n if (value === null || value === undefined || value === \"\") return NONE;\n if (typeof value === \"string\") return [value];\n const list = value.filter((v) => typeof v === \"string\" && v !== \"\");\n return list.length === 0 ? NONE : list;\n}\n\n/** Some entry of `errors` is a non-empty error. */\nexport function hasAnyError(errors: FormErrors | undefined): boolean {\n if (errors === undefined) return false;\n return Object.values(errors).some((v) => normaliseErrorValue(v).length > 0);\n}\n\nlet userInvalidSupport: boolean | undefined;\n\n/**\n * Whether the environment implements `:user-invalid` (every engine the library supports does).\n * Decided once per module, so the read is not on a hot path.\n *\n * Detected with `CSS.supports(\"selector(:user-invalid)\")` rather than by `matches()` throwing:\n * jsdom 30's selector engine knows the name and silently answers `false` (it does not throw), and\n * its `CSS.supports` reports `false`, so the fallback engages there and nowhere else\n * (memo/developer/field-form.md).\n */\nexport function supportsUserInvalid(): boolean {\n if (userInvalidSupport === undefined) {\n try {\n userInvalidSupport =\n typeof CSS !== \"undefined\" &&\n typeof CSS.supports === \"function\" &&\n CSS.supports(\"selector(:user-invalid)\");\n } catch {\n userInvalidSupport = false;\n }\n }\n return userInvalidSupport;\n}\n\n/** An element that takes part in constraint validation. */\nexport type ValidatableElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\n\nfunction isValidatable(el: Element): el is ValidatableElement {\n return (\n el instanceof HTMLInputElement ||\n el instanceof HTMLSelectElement ||\n el instanceof HTMLTextAreaElement\n );\n}\n\n/**\n * Where `validity`, `validationMessage`, `:user-invalid` and `setCustomValidity` are read and\n * written (design 7.1): the element itself when it is a form control, else the first named\n * `willValidate` member of a `<fieldset>` (a group's first enabled item, not a CheckboxGroup\n * Parent, which has no name), else the first `input` / `select` / `textarea` inside.\n */\nexport function validityElementOf(el: Element | null): ValidatableElement | null {\n if (el === null) return null;\n if (isValidatable(el)) return el;\n const members =\n el instanceof HTMLFieldSetElement\n ? [...el.elements]\n : [...el.querySelectorAll(\"input, select, textarea\")];\n const controls = members.filter(isValidatable);\n return (\n controls.find((c) => c.willValidate && c.name !== \"\") ??\n controls.find((c) => c.willValidate) ??\n controls[0] ??\n null\n );\n}\n\n/**\n * What the Field focuses (design 2.5): the control itself, or for a group the checked radio if\n * any, else the first enabled named member (a group's first item, not a CheckboxGroup Parent,\n * which has no name), else the first enabled member.\n */\nexport function focusTargetOf(el: Element | null): HTMLElement | null {\n if (el === null) return null;\n if (isValidatable(el)) return el;\n const members = (\n el instanceof HTMLFieldSetElement\n ? [...el.elements]\n : [...el.querySelectorAll(\"input, select, textarea, button\")]\n ).filter(\n (m): m is HTMLElement =>\n m instanceof HTMLElement &&\n !(m as HTMLInputElement).disabled &&\n (m as HTMLInputElement).type !== \"hidden\",\n );\n const checkedRadio = members.find(\n (m) => m instanceof HTMLInputElement && m.type === \"radio\" && m.checked,\n );\n return (\n checkedRadio ??\n members.find((m) => isValidatable(m) && m.name !== \"\") ??\n members.find(isValidatable) ??\n members[0] ??\n null\n );\n}\n"],"mappings":";AA2BA,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,QAAuB,OAAO,OAAO;CAChD,cAAc;CACd,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,UAAU;CACV,gBAAgB;CAChB,eAAe;CACf,cAAc;CACd,UAAU;CACV,aAAa;CACb,OAAO;AACT,CAAC;AAED,SAAgB,iBAAiB,UAAwC;CACvE,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,OAAO,eAAe,OAAO,OAAO,SAAS;CACxD,OAAO;AACT;AAEA,SAAgB,eAAe,GAAkB,GAA2B;CAC1E,OAAO,cAAc,OAAO,QAAQ,EAAE,SAAS,EAAE,IAAI;AACvD;AAEA,MAAM,OAA0B,OAAO,OAAO,CAAC,CAAC;;AAGhD,SAAgB,oBAAoB,OAA2C;CAC7E,IAAI,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,IAAI,OAAO;CAClE,IAAI,OAAO,UAAU,UAAU,OAAO,CAAC,KAAK;CAC5C,MAAM,OAAO,MAAM,QAAQ,MAAM,OAAO,MAAM,YAAY,MAAM,EAAE;CAClE,OAAO,KAAK,WAAW,IAAI,OAAO;AACpC;;AAGA,SAAgB,YAAY,QAAyC;CACnE,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,OAAO,OAAO,OAAO,MAAM,CAAC,CAAC,MAAM,MAAM,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5E;AAEA,IAAI;;;;;;;;;;AAWJ,SAAgB,sBAA+B;CAC7C,IAAI,uBAAuB,KAAA,GACzB,IAAI;EACF,qBACE,OAAO,QAAQ,eACf,OAAO,IAAI,aAAa,cACxB,IAAI,SAAS,yBAAyB;CAC1C,QAAQ;EACN,qBAAqB;CACvB;CAEF,OAAO;AACT;AAKA,SAAS,cAAc,IAAuC;CAC5D,OACE,cAAc,oBACd,cAAc,qBACd,cAAc;AAElB;;;;;;;AAQA,SAAgB,kBAAkB,IAA+C;CAC/E,IAAI,OAAO,MAAM,OAAO;CACxB,IAAI,cAAc,EAAE,GAAG,OAAO;CAK9B,MAAM,YAHJ,cAAc,sBACV,CAAC,GAAG,GAAG,QAAQ,IACf,CAAC,GAAG,GAAG,iBAAiB,yBAAyB,CAAC,EAAA,CAC/B,OAAO,aAAa;CAC7C,OACE,SAAS,MAAM,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,KACpD,SAAS,MAAM,MAAM,EAAE,YAAY,KACnC,SAAS,MACT;AAEJ;;;;;;AAOA,SAAgB,cAAc,IAAwC;CACpE,IAAI,OAAO,MAAM,OAAO;CACxB,IAAI,cAAc,EAAE,GAAG,OAAO;CAC9B,MAAM,WACJ,cAAc,sBACV,CAAC,GAAG,GAAG,QAAQ,IACf,CAAC,GAAG,GAAG,iBAAiB,iCAAiC,CAAC,EAAA,CAC9D,QACC,MACC,aAAa,eACb,CAAE,EAAuB,YACxB,EAAuB,SAAS,QACrC;CAIA,OAHqB,QAAQ,MAC1B,MAAM,aAAa,oBAAoB,EAAE,SAAS,WAAW,EAAE,OAGrD,KACX,QAAQ,MAAM,MAAM,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,KACrD,QAAQ,KAAK,aAAa,KAC1B,QAAQ,MACR;AAEJ"}
1
+ {"version":3,"file":"validity.mjs","names":[],"sources":["../../src/internal/validity.ts"],"sourcesContent":["// Directive-free helpers for Field and Form (design/components/field-form.md 2, 14): the validity\n// snapshot, error-value normalisation, the `:user-invalid` read and the element resolution.\n\n/** A field error: a message, several messages, or nothing (`\"\"`, `[]`, `null`, `undefined`). */\nexport type FieldErrorValue = string | readonly string[] | null | undefined;\n\n/** Field errors keyed by field `name` (usually `state.errors` from `useActionState`). */\nexport type FormErrors = Readonly<Record<string, FieldErrorValue>>;\n\n/**\n * A plain, serialisable snapshot of the control's `ValidityState` (all `false` and\n * `valid: true` on the server and before the first read).\n */\nexport interface FieldValidity {\n /** A required control has no value. */\n readonly valueMissing: boolean;\n /** The value does not match the `type` (email, url). */\n readonly typeMismatch: boolean;\n /** The value does not match `pattern`. */\n readonly patternMismatch: boolean;\n /** The value is longer than `maxLength`. */\n readonly tooLong: boolean;\n /** The value is shorter than `minLength`. */\n readonly tooShort: boolean;\n /** The value is below `min`. */\n readonly rangeUnderflow: boolean;\n /** The value is above `max`. */\n readonly rangeOverflow: boolean;\n /** The value is not on the `step` grid. */\n readonly stepMismatch: boolean;\n /** The browser cannot convert the input to a value. */\n readonly badInput: boolean;\n /** A custom message is set (`validate` or a shown server error). */\n readonly customError: boolean;\n /** No constraint is violated. */\n readonly valid: boolean;\n}\n\nconst VALIDITY_KEYS = [\n \"valueMissing\",\n \"typeMismatch\",\n \"patternMismatch\",\n \"tooLong\",\n \"tooShort\",\n \"rangeUnderflow\",\n \"rangeOverflow\",\n \"stepMismatch\",\n \"badInput\",\n \"customError\",\n \"valid\",\n] as const satisfies readonly (keyof FieldValidity)[];\n\nexport const VALID: FieldValidity = Object.freeze({\n valueMissing: false,\n typeMismatch: false,\n patternMismatch: false,\n tooLong: false,\n tooShort: false,\n rangeUnderflow: false,\n rangeOverflow: false,\n stepMismatch: false,\n badInput: false,\n customError: false,\n valid: true,\n});\n\nexport function snapshotValidity(validity: ValidityState): FieldValidity {\n const result = {} as Record<keyof FieldValidity, boolean>;\n for (const key of VALIDITY_KEYS) result[key] = validity[key];\n return result;\n}\n\nexport function validityEquals(a: FieldValidity, b: FieldValidity): boolean {\n return VALIDITY_KEYS.every((key) => a[key] === b[key]);\n}\n\nconst NONE: readonly string[] = Object.freeze([]);\n\n/** `\"\"`, `[]`, `null` and `undefined` mean no error; empty strings inside an array are dropped. */\nexport function normaliseErrorValue(value: FieldErrorValue): readonly string[] {\n if (value === null || value === undefined || value === \"\") return NONE;\n if (typeof value === \"string\") return [value];\n const list = value.filter((v) => typeof v === \"string\" && v !== \"\");\n return list.length === 0 ? NONE : list;\n}\n\n/** Some entry of `errors` is a non-empty error. */\nexport function hasAnyError(errors: FormErrors | undefined): boolean {\n if (errors === undefined) return false;\n return Object.values(errors).some((v) => normaliseErrorValue(v).length > 0);\n}\n\nlet userInvalidSupport: boolean | undefined;\n\n/**\n * Whether the environment implements `:user-invalid` (every engine the library supports does).\n * Decided once per module, so the read is not on a hot path.\n *\n * Detected with `CSS.supports(\"selector(:user-invalid)\")` rather than by `matches()` throwing:\n * jsdom 30's selector engine knows the name and silently answers `false` (it does not throw), and\n * its `CSS.supports` reports `false`, so the fallback engages there and nowhere else\n * (memo/developer/field-form.md).\n */\nexport function supportsUserInvalid(): boolean {\n if (userInvalidSupport === undefined) {\n try {\n userInvalidSupport =\n typeof CSS !== \"undefined\" &&\n typeof CSS.supports === \"function\" &&\n CSS.supports(\"selector(:user-invalid)\");\n } catch {\n userInvalidSupport = false;\n }\n }\n return userInvalidSupport;\n}\n\n/** An element that takes part in constraint validation. */\nexport type ValidatableElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\n\nfunction isValidatable(el: Element): el is ValidatableElement {\n return (\n el instanceof HTMLInputElement ||\n el instanceof HTMLSelectElement ||\n el instanceof HTMLTextAreaElement\n );\n}\n\n/**\n * Where `validity`, `validationMessage`, `:user-invalid` and `setCustomValidity` are read and\n * written (design 7.1): the element itself when it is a form control, else the first named\n * `willValidate` member of a `<fieldset>` (a group's first enabled item, not a CheckboxGroup\n * Parent, which has no name), else the first `input` / `select` / `textarea` inside.\n */\nexport function validityElementOf(el: Element | null): ValidatableElement | null {\n if (el === null) return null;\n if (isValidatable(el)) return el;\n const members =\n el instanceof HTMLFieldSetElement\n ? [...el.elements]\n : [...el.querySelectorAll(\"input, select, textarea\")];\n const controls = members.filter(isValidatable);\n return (\n controls.find((c) => c.willValidate && c.name !== \"\") ??\n controls.find((c) => c.willValidate) ??\n controls[0] ??\n null\n );\n}\n\n/**\n * What the Field focuses (design 2.5): the control itself, or for a group the checked radio if\n * any, else the first enabled named member (a group's first item, not a CheckboxGroup Parent,\n * which has no name), else the first enabled member.\n */\nexport function focusTargetOf(el: Element | null): HTMLElement | null {\n if (el === null) return null;\n if (isValidatable(el)) return el;\n const members = (\n el instanceof HTMLFieldSetElement\n ? [...el.elements]\n : [...el.querySelectorAll(\"input, select, textarea, button\")]\n ).filter(\n (m): m is HTMLElement =>\n m instanceof HTMLElement &&\n !(m as HTMLInputElement).disabled &&\n (m as HTMLInputElement).type !== \"hidden\",\n );\n const checkedRadio = members.find(\n (m) => m instanceof HTMLInputElement && m.type === \"radio\" && m.checked,\n );\n return (\n checkedRadio ??\n members.find((m) => isValidatable(m) && m.name !== \"\") ??\n members.find(isValidatable) ??\n members[0] ??\n null\n );\n}\n"],"mappings":";AAsCA,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,QAAuB,OAAO,OAAO;CAChD,cAAc;CACd,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,UAAU;CACV,gBAAgB;CAChB,eAAe;CACf,cAAc;CACd,UAAU;CACV,aAAa;CACb,OAAO;AACT,CAAC;AAED,SAAgB,iBAAiB,UAAwC;CACvE,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,OAAO,eAAe,OAAO,OAAO,SAAS;CACxD,OAAO;AACT;AAEA,SAAgB,eAAe,GAAkB,GAA2B;CAC1E,OAAO,cAAc,OAAO,QAAQ,EAAE,SAAS,EAAE,IAAI;AACvD;AAEA,MAAM,OAA0B,OAAO,OAAO,CAAC,CAAC;;AAGhD,SAAgB,oBAAoB,OAA2C;CAC7E,IAAI,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,IAAI,OAAO;CAClE,IAAI,OAAO,UAAU,UAAU,OAAO,CAAC,KAAK;CAC5C,MAAM,OAAO,MAAM,QAAQ,MAAM,OAAO,MAAM,YAAY,MAAM,EAAE;CAClE,OAAO,KAAK,WAAW,IAAI,OAAO;AACpC;;AAGA,SAAgB,YAAY,QAAyC;CACnE,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,OAAO,OAAO,OAAO,MAAM,CAAC,CAAC,MAAM,MAAM,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5E;AAEA,IAAI;;;;;;;;;;AAWJ,SAAgB,sBAA+B;CAC7C,IAAI,uBAAuB,KAAA,GACzB,IAAI;EACF,qBACE,OAAO,QAAQ,eACf,OAAO,IAAI,aAAa,cACxB,IAAI,SAAS,yBAAyB;CAC1C,QAAQ;EACN,qBAAqB;CACvB;CAEF,OAAO;AACT;AAKA,SAAS,cAAc,IAAuC;CAC5D,OACE,cAAc,oBACd,cAAc,qBACd,cAAc;AAElB;;;;;;;AAQA,SAAgB,kBAAkB,IAA+C;CAC/E,IAAI,OAAO,MAAM,OAAO;CACxB,IAAI,cAAc,EAAE,GAAG,OAAO;CAK9B,MAAM,YAHJ,cAAc,sBACV,CAAC,GAAG,GAAG,QAAQ,IACf,CAAC,GAAG,GAAG,iBAAiB,yBAAyB,CAAC,EAAA,CAC/B,OAAO,aAAa;CAC7C,OACE,SAAS,MAAM,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,KACpD,SAAS,MAAM,MAAM,EAAE,YAAY,KACnC,SAAS,MACT;AAEJ;;;;;;AAOA,SAAgB,cAAc,IAAwC;CACpE,IAAI,OAAO,MAAM,OAAO;CACxB,IAAI,cAAc,EAAE,GAAG,OAAO;CAC9B,MAAM,WACJ,cAAc,sBACV,CAAC,GAAG,GAAG,QAAQ,IACf,CAAC,GAAG,GAAG,iBAAiB,iCAAiC,CAAC,EAAA,CAC9D,QACC,MACC,aAAa,eACb,CAAE,EAAuB,YACxB,EAAuB,SAAS,QACrC;CAIA,OAHqB,QAAQ,MAC1B,MAAM,aAAa,oBAAoB,EAAE,SAAS,WAAW,EAAE,OAGrD,KACX,QAAQ,MAAM,MAAM,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,KACrD,QAAQ,KAAK,aAAa,KAC1B,QAAQ,MACR;AAEJ"}
@@ -18,6 +18,8 @@ import { MenuSubmenuTrigger, MenuSubmenuTriggerProps, MenuSubmenuTriggerState }
18
18
  * transition with `data-pending` on the item, and the whole menu closes when it settles.
19
19
  * `ContextTrigger` is a region whose right-click (or Shift+F10, or a touch long-press) opens the
20
20
  * same `Popup` at the pointer; a Root may hold a `Trigger` and a `ContextTrigger`.
21
+ *
22
+ * @see https://ui.funstack.work/components/menu
21
23
  */
22
24
  export declare const Menu: {
23
25
  readonly Root: typeof MenuRoot;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/menu/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;qBAuBa;WACX,aAAI;WACJ,gBAAO;WACP,cAAK;WACL,aAAI;WACJ,qBAAY;WACZ,mBAAU;WACV,kBAAS;WACT,cAAK;WACL,mBAAU;WACV,kBAAS;WACT,uBAAc;WACd,uBAAc"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/menu/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;qBAyBa;WACX,aAAI;WACJ,gBAAO;WACP,cAAK;WACL,aAAI;WACJ,qBAAY;WACZ,mBAAU;WACV,kBAAS;WACT,cAAK;WACL,mBAAU;WACV,kBAAS;WACT,uBAAc;WACd,uBAAc"}
@@ -17,6 +17,8 @@ import { MenuSubmenuTrigger } from "./menu-submenu-trigger.mjs";
17
17
  * transition with `data-pending` on the item, and the whole menu closes when it settles.
18
18
  * `ContextTrigger` is a region whose right-click (or Shift+F10, or a touch long-press) opens the
19
19
  * same `Popup` at the pointer; a Root may hold a `Trigger` and a `ContextTrigger`.
20
+ *
21
+ * @see https://ui.funstack.work/components/menu
20
22
  */
21
23
  const Menu = {
22
24
  Root: MenuRoot,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/menu/index.ts"],"sourcesContent":["// Ships the platform attribute typings (`command`, `commandfor`, `focusgroup`) with this subpath\n// (conventions 7.4). Type-only: the built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { MenuCheckboxItem } from \"./menu-checkbox-item.js\";\nimport { MenuContextTrigger } from \"./menu-context-trigger.js\";\nimport { MenuGroup, MenuGroupLabel, MenuSeparator } from \"./menu-group.js\";\nimport { MenuItem } from \"./menu-item.js\";\nimport { MenuPopup } from \"./menu-popup.js\";\nimport { MenuRadioGroup } from \"./menu-radio-group.js\";\nimport { MenuRadioItem } from \"./menu-radio-item.js\";\nimport { MenuRoot } from \"./menu-root.js\";\nimport { MenuSubmenuTrigger } from \"./menu-submenu-trigger.js\";\nimport { MenuTrigger } from \"./menu-trigger.js\";\n\n/**\n * Menu button (WAI-ARIA APG Menu Button + Menu) on `popover=\"auto\"`: `Root` (no DOM) > `Trigger`\n * (`button[aria-haspopup=menu]`) + `Popup` (`div[popover=auto][role=menu]`) > `Item`,\n * `CheckboxItem`, `RadioGroup` > `RadioItem`, `Group` > `GroupLabel`, `Separator`, and submenus\n * (a `Root` inside a `Popup`, opened by its `SubmenuTrigger`). An item's `action` runs in its own\n * transition with `data-pending` on the item, and the whole menu closes when it settles.\n * `ContextTrigger` is a region whose right-click (or Shift+F10, or a touch long-press) opens the\n * same `Popup` at the pointer; a Root may hold a `Trigger` and a `ContextTrigger`.\n */\nexport const Menu = {\n Root: MenuRoot,\n Trigger: MenuTrigger,\n Popup: MenuPopup,\n Item: MenuItem,\n CheckboxItem: MenuCheckboxItem,\n RadioGroup: MenuRadioGroup,\n RadioItem: MenuRadioItem,\n Group: MenuGroup,\n GroupLabel: MenuGroupLabel,\n Separator: MenuSeparator,\n SubmenuTrigger: MenuSubmenuTrigger,\n ContextTrigger: MenuContextTrigger,\n} as const;\n\nexport type { MenuRootProps, MenuRootState, MenuOpenChangeDetails } from \"./menu-root.js\";\nexport type { MenuTriggerProps, MenuTriggerState } from \"./menu-trigger.js\";\nexport type { MenuPopupProps, MenuPopupState, MenuSide, MenuAlign } from \"./menu-popup.js\";\nexport type { MenuItemProps, MenuItemState, MenuItemDetails } from \"./menu-item.js\";\nexport type { MenuCheckboxItemProps, MenuCheckboxItemState } from \"./menu-checkbox-item.js\";\nexport type { MenuRadioGroupProps, MenuRadioGroupState } from \"./menu-radio-group.js\";\nexport type { MenuRadioItemProps, MenuRadioItemState } from \"./menu-radio-item.js\";\nexport type {\n MenuGroupProps,\n MenuGroupState,\n MenuGroupLabelProps,\n MenuGroupLabelState,\n MenuSeparatorProps,\n MenuSeparatorState,\n} from \"./menu-group.js\";\nexport type { MenuSubmenuTriggerProps, MenuSubmenuTriggerState } from \"./menu-submenu-trigger.js\";\nexport type { MenuContextTriggerProps, MenuContextTriggerState } from \"./menu-context-trigger.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,OAAO;CAClB,MAAM;CACN,SAAS;CACT,OAAO;CACP,MAAM;CACN,cAAc;CACd,YAAY;CACZ,WAAW;CACX,OAAO;CACP,YAAY;CACZ,WAAW;CACX,gBAAgB;CAChB,gBAAgB;AAClB"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/menu/index.ts"],"sourcesContent":["// Ships the platform attribute typings (`command`, `commandfor`, `focusgroup`) with this subpath\n// (conventions 7.4). Type-only: the built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { MenuCheckboxItem } from \"./menu-checkbox-item.js\";\nimport { MenuContextTrigger } from \"./menu-context-trigger.js\";\nimport { MenuGroup, MenuGroupLabel, MenuSeparator } from \"./menu-group.js\";\nimport { MenuItem } from \"./menu-item.js\";\nimport { MenuPopup } from \"./menu-popup.js\";\nimport { MenuRadioGroup } from \"./menu-radio-group.js\";\nimport { MenuRadioItem } from \"./menu-radio-item.js\";\nimport { MenuRoot } from \"./menu-root.js\";\nimport { MenuSubmenuTrigger } from \"./menu-submenu-trigger.js\";\nimport { MenuTrigger } from \"./menu-trigger.js\";\n\n/**\n * Menu button (WAI-ARIA APG Menu Button + Menu) on `popover=\"auto\"`: `Root` (no DOM) > `Trigger`\n * (`button[aria-haspopup=menu]`) + `Popup` (`div[popover=auto][role=menu]`) > `Item`,\n * `CheckboxItem`, `RadioGroup` > `RadioItem`, `Group` > `GroupLabel`, `Separator`, and submenus\n * (a `Root` inside a `Popup`, opened by its `SubmenuTrigger`). An item's `action` runs in its own\n * transition with `data-pending` on the item, and the whole menu closes when it settles.\n * `ContextTrigger` is a region whose right-click (or Shift+F10, or a touch long-press) opens the\n * same `Popup` at the pointer; a Root may hold a `Trigger` and a `ContextTrigger`.\n *\n * @see https://ui.funstack.work/components/menu\n */\nexport const Menu = {\n Root: MenuRoot,\n Trigger: MenuTrigger,\n Popup: MenuPopup,\n Item: MenuItem,\n CheckboxItem: MenuCheckboxItem,\n RadioGroup: MenuRadioGroup,\n RadioItem: MenuRadioItem,\n Group: MenuGroup,\n GroupLabel: MenuGroupLabel,\n Separator: MenuSeparator,\n SubmenuTrigger: MenuSubmenuTrigger,\n ContextTrigger: MenuContextTrigger,\n} as const;\n\nexport type { MenuRootProps, MenuRootState, MenuOpenChangeDetails } from \"./menu-root.js\";\nexport type { MenuTriggerProps, MenuTriggerState } from \"./menu-trigger.js\";\nexport type { MenuPopupProps, MenuPopupState, MenuSide, MenuAlign } from \"./menu-popup.js\";\nexport type { MenuItemProps, MenuItemState, MenuItemDetails } from \"./menu-item.js\";\nexport type { MenuCheckboxItemProps, MenuCheckboxItemState } from \"./menu-checkbox-item.js\";\nexport type { MenuRadioGroupProps, MenuRadioGroupState } from \"./menu-radio-group.js\";\nexport type { MenuRadioItemProps, MenuRadioItemState } from \"./menu-radio-item.js\";\nexport type {\n MenuGroupProps,\n MenuGroupState,\n MenuGroupLabelProps,\n MenuGroupLabelState,\n MenuSeparatorProps,\n MenuSeparatorState,\n} from \"./menu-group.js\";\nexport type { MenuSubmenuTriggerProps, MenuSubmenuTriggerState } from \"./menu-submenu-trigger.js\";\nexport type { MenuContextTriggerProps, MenuContextTriggerState } from \"./menu-context-trigger.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,OAAO;CAClB,MAAM;CACN,SAAS;CACT,OAAO;CACP,MAAM;CACN,cAAc;CACd,YAAY;CACZ,WAAW;CACX,OAAO;CACP,YAAY;CACZ,WAAW;CACX,gBAAgB;CAChB,gBAAgB;AAClB"}
@@ -2,17 +2,31 @@ import { ChangeAction, RenderProp, StateValue } from "../internal/types.mjs";
2
2
  import { MenuItemProps } from "./menu-item.mjs";
3
3
  import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
4
4
  //#region src/menu/menu-checkbox-item.d.ts
5
+ /**
6
+ * State of `Menu.CheckboxItem`, passed to the function forms of `className`, `style`, `children`
7
+ * and `render`.
8
+ */
5
9
  export interface MenuCheckboxItemState {
6
10
  /** Optimistic checked state (`aria-checked`). */
7
11
  readonly checked: boolean;
8
12
  /** `checkedChangeAction` is in flight. */
9
13
  readonly pending: boolean;
14
+ /** The `disabled` prop. */
10
15
  readonly disabled: boolean;
11
16
  }
17
+ /**
18
+ * Props of `Menu.CheckboxItem`.
19
+ *
20
+ * @see https://ui.funstack.work/components/menu
21
+ */
12
22
  export interface MenuCheckboxItemProps extends Omit<MenuItemProps, "action" | "closeOnActivate" | "className" | "style" | "children" | "render"> {
13
23
  /** Controlled checked state. `undefined` means uncontrolled. */
14
24
  checked?: boolean;
15
- /** Initial checked state when uncontrolled. Default `false`. */
25
+ /**
26
+ * Initial checked state when uncontrolled.
27
+ *
28
+ * @defaultValue `false`
29
+ */
16
30
  defaultChecked?: boolean;
17
31
  /**
18
32
  * Awaited inside the item's transition; `aria-checked` flips at once and rolls back on
@@ -20,11 +34,19 @@ export interface MenuCheckboxItemProps extends Omit<MenuItemProps, "action" | "c
20
34
  * Function.
21
35
  */
22
36
  checkedChangeAction?: ChangeAction<boolean>;
23
- /** Close the whole menu once the change settles. Default `false`: the menu stays open. */
37
+ /**
38
+ * Close the whole menu once the change settles. When `false` the menu stays open.
39
+ *
40
+ * @defaultValue `false`
41
+ */
24
42
  closeOnActivate?: boolean;
43
+ /** Class name, or a function of the part's state that returns one. */
25
44
  className?: StateValue<string | undefined, MenuCheckboxItemState>;
45
+ /** Inline style, or a function of the part's state that returns one. */
26
46
  style?: StateValue<CSSProperties | undefined, MenuCheckboxItemState>;
47
+ /** Content, or a function of the part's state. */
27
48
  children?: StateValue<ReactNode, MenuCheckboxItemState>;
49
+ /** Replace the default `<button>` (element form) or take over rendering (function form). */
28
50
  render?: RenderProp<ComponentPropsWithRef<"button">, MenuCheckboxItemState>;
29
51
  }
30
52
  /**
@@ -33,6 +55,8 @@ export interface MenuCheckboxItemProps extends Omit<MenuItemProps, "action" | "c
33
55
  * `data-checked` and `data-pending`; the menu stays open unless `closeOnActivate`.
34
56
  *
35
57
  * Owned keys (conventions 1.2): those of `Menu.Item`, plus `aria-checked` and `data-checked`.
58
+ *
59
+ * @see https://ui.funstack.work/components/menu
36
60
  */
37
61
  export declare function MenuCheckboxItem({ checked, defaultChecked, checkedChangeAction, closeOnActivate, disabled, label, className, style, children, render, ...rest }: MenuCheckboxItemProps): ReactNode;
38
62
  export declare namespace MenuCheckboxItem {
@@ -1 +1 @@
1
- {"version":3,"file":"menu-checkbox-item.d.mts","names":[],"sources":["../../src/menu/menu-checkbox-item.tsx"],"mappings":";;;;iBAaiB;;WAEN;;WAEA;WACA;;iBAGM,8BAA8B,KAC7C;;EAIA;;EAEA;;;;;;EAMA,sBAAsB;;EAEtB;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,iCAAiC;;;;;;;;;wBAUvC,mBACd,SACA,gBACA,qBACA,iBACA,UACA,OACA,WACA,OACA,UACA,WACG,QACF,wBAAqB;yBAZR"}
1
+ {"version":3,"file":"menu-checkbox-item.d.mts","names":[],"sources":["../../src/menu/menu-checkbox-item.tsx"],"mappings":";;;;;;;;iBAiBiB;;WAEN;;WAEA;;WAEA;;;;;;;iBAQM,8BAA8B,KAC7C;;EAIA;;;;;;EAMA;;;;;;EAMA,sBAAsB;;;;;;EAMtB;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;wBAYvC,mBACd,SACA,gBACA,qBACA,iBACA,UACA,OACA,WACA,OACA,UACA,WACG,QACF,wBAAqB;yBAZR"}
@@ -15,6 +15,8 @@ import { useRef } from "react";
15
15
  * `data-checked` and `data-pending`; the menu stays open unless `closeOnActivate`.
16
16
  *
17
17
  * Owned keys (conventions 1.2): those of `Menu.Item`, plus `aria-checked` and `data-checked`.
18
+ *
19
+ * @see https://ui.funstack.work/components/menu
18
20
  */
19
21
  function MenuCheckboxItem({ checked, defaultChecked, checkedChangeAction, closeOnActivate = false, disabled = false, label, className, style, children, render, ...rest }) {
20
22
  const menu = useMenuContext("Menu.CheckboxItem");
@@ -1 +1 @@
1
- {"version":3,"file":"menu-checkbox-item.mjs","names":[],"sources":["../../src/menu/menu-checkbox-item.tsx"],"sourcesContent":["\"use client\";\nimport { useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type { ChangeAction, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport { closeStackLater, useMenuContext } from \"./menu-context.js\";\nimport type { MenuItemProps } from \"./menu-item.js\";\nimport { useMenuItem } from \"./use-menu-item.js\";\n\nexport interface MenuCheckboxItemState {\n /** Optimistic checked state (`aria-checked`). */\n readonly checked: boolean;\n /** `checkedChangeAction` is in flight. */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface MenuCheckboxItemProps extends Omit<\n MenuItemProps,\n \"action\" | \"closeOnActivate\" | \"className\" | \"style\" | \"children\" | \"render\"\n> {\n /** Controlled checked state. `undefined` means uncontrolled. */\n checked?: boolean;\n /** Initial checked state when uncontrolled. Default `false`. */\n defaultChecked?: boolean;\n /**\n * Awaited inside the item's transition; `aria-checked` flips at once and rolls back on\n * rejection (which reaches the nearest Error Boundary above the item). May be a Server\n * Function.\n */\n checkedChangeAction?: ChangeAction<boolean>;\n /** Close the whole menu once the change settles. Default `false`: the menu stays open. */\n closeOnActivate?: boolean;\n className?: StateValue<string | undefined, MenuCheckboxItemState>;\n style?: StateValue<CSSProperties | undefined, MenuCheckboxItemState>;\n children?: StateValue<ReactNode, MenuCheckboxItemState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, MenuCheckboxItemState>;\n}\n\n/**\n * A checkable menu item: `<button type=\"button\" role=\"menuitemcheckbox\" aria-checked>`. Click,\n * Enter or Space toggles it through its own transition with optimistic `aria-checked` /\n * `data-checked` and `data-pending`; the menu stays open unless `closeOnActivate`.\n *\n * Owned keys (conventions 1.2): those of `Menu.Item`, plus `aria-checked` and `data-checked`.\n */\nexport function MenuCheckboxItem({\n checked,\n defaultChecked,\n checkedChangeAction,\n closeOnActivate = false,\n disabled = false,\n label,\n className,\n style,\n children,\n render,\n ...rest\n}: MenuCheckboxItemProps) {\n const menu = useMenuContext(\"Menu.CheckboxItem\");\n // The close to run after a dispatch's action resolved, keyed by the dispatch's details.\n const after = useRef(new WeakMap<object, () => void>());\n const { optimistic, pending, dispatch } = useControllableAction<boolean>({\n controlled: checked,\n defaultValue: defaultChecked,\n initialValue: false,\n action: async (next, details) => {\n await checkedChangeAction?.(next, details);\n after.current.get(details)?.();\n },\n transitionTypes: (next) => transitionTypes(\"menu\", next ? \"check\" : \"uncheck\"),\n warn: { component: \"Menu.CheckboxItem\", prop: \"checked\" },\n });\n\n const { libraryProps } = useMenuItem({\n part: \"Menu.CheckboxItem\",\n role: \"menuitemcheckbox\",\n disabled,\n label,\n activate: (event) => {\n const details = createActionDetails(event, {});\n if (closeOnActivate) after.current.set(details, closeStackLater(menu, event));\n dispatch(!optimistic, details);\n },\n });\n\n const state: MenuCheckboxItemState = { checked: optimistic, pending, disabled };\n\n return useRender<ComponentPropsWithRef<\"button\">, MenuCheckboxItemState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n ...(rendersButton(render) && { type: \"button\" as const }),\n ...libraryProps,\n \"aria-checked\": optimistic,\n \"data-checked\": dataAttr(optimistic),\n \"data-pending\": dataAttr(pending),\n },\n });\n}\n\nMenuCheckboxItem.displayName = \"MenuCheckboxItem\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkDA,SAAgB,iBAAiB,EAC/B,SACA,gBACA,qBACA,kBAAkB,OAClB,WAAW,OACX,OACA,WACA,OACA,UACA,QACA,GAAG,QACqB;CACxB,MAAM,OAAO,eAAe,mBAAmB;CAE/C,MAAM,QAAQ,uBAAO,IAAI,QAA4B,CAAC;CACtD,MAAM,EAAE,YAAY,SAAS,aAAa,sBAA+B;EACvE,YAAY;EACZ,cAAc;EACd,cAAc;EACd,QAAQ,OAAO,MAAM,YAAY;GAC/B,MAAM,sBAAsB,MAAM,OAAO;GACzC,MAAM,QAAQ,IAAI,OAAO,CAAC,GAAG;EAC/B;EACA,kBAAkB,SAAS,gBAAgB,QAAQ,OAAO,UAAU,SAAS;EAC7E,MAAM;GAAE,WAAW;GAAqB,MAAM;EAAU;CAC1D,CAAC;CAED,MAAM,EAAE,iBAAiB,YAAY;EACnC,MAAM;EACN,MAAM;EACN;EACA;EACA,WAAW,UAAU;GACnB,MAAM,UAAU,oBAAoB,OAAO,CAAC,CAAC;GAC7C,IAAI,iBAAiB,MAAM,QAAQ,IAAI,SAAS,gBAAgB,MAAM,KAAK,CAAC;GAC5E,SAAS,CAAC,YAAY,OAAO;EAC/B;CACF,CAAC;CAID,OAAO,UAAkE;EACvE,gBAAgB;EAChB;EACA,OAAA;GALqC,SAAS;GAAY;GAAS;EAK/D;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;GACvD,GAAG;GACH,gBAAgB;GAChB,gBAAgB,SAAS,UAAU;GACnC,gBAAgB,SAAS,OAAO;EAClC;CACF,CAAC;AACH;AAEA,iBAAiB,cAAc"}
1
+ {"version":3,"file":"menu-checkbox-item.mjs","names":[],"sources":["../../src/menu/menu-checkbox-item.tsx"],"sourcesContent":["\"use client\";\nimport { useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type { ChangeAction, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport { closeStackLater, useMenuContext } from \"./menu-context.js\";\nimport type { MenuItemProps } from \"./menu-item.js\";\nimport { useMenuItem } from \"./use-menu-item.js\";\n\n/**\n * State of `Menu.CheckboxItem`, passed to the function forms of `className`, `style`, `children`\n * and `render`.\n */\nexport interface MenuCheckboxItemState {\n /** Optimistic checked state (`aria-checked`). */\n readonly checked: boolean;\n /** `checkedChangeAction` is in flight. */\n readonly pending: boolean;\n /** The `disabled` prop. */\n readonly disabled: boolean;\n}\n\n/**\n * Props of `Menu.CheckboxItem`.\n *\n * @see https://ui.funstack.work/components/menu\n */\nexport interface MenuCheckboxItemProps extends Omit<\n MenuItemProps,\n \"action\" | \"closeOnActivate\" | \"className\" | \"style\" | \"children\" | \"render\"\n> {\n /** Controlled checked state. `undefined` means uncontrolled. */\n checked?: boolean;\n /**\n * Initial checked state when uncontrolled.\n *\n * @defaultValue `false`\n */\n defaultChecked?: boolean;\n /**\n * Awaited inside the item's transition; `aria-checked` flips at once and rolls back on\n * rejection (which reaches the nearest Error Boundary above the item). May be a Server\n * Function.\n */\n checkedChangeAction?: ChangeAction<boolean>;\n /**\n * Close the whole menu once the change settles. When `false` the menu stays open.\n *\n * @defaultValue `false`\n */\n closeOnActivate?: boolean;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, MenuCheckboxItemState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, MenuCheckboxItemState>;\n /** Content, or a function of the part's state. */\n children?: StateValue<ReactNode, MenuCheckboxItemState>;\n /** Replace the default `<button>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, MenuCheckboxItemState>;\n}\n\n/**\n * A checkable menu item: `<button type=\"button\" role=\"menuitemcheckbox\" aria-checked>`. Click,\n * Enter or Space toggles it through its own transition with optimistic `aria-checked` /\n * `data-checked` and `data-pending`; the menu stays open unless `closeOnActivate`.\n *\n * Owned keys (conventions 1.2): those of `Menu.Item`, plus `aria-checked` and `data-checked`.\n *\n * @see https://ui.funstack.work/components/menu\n */\nexport function MenuCheckboxItem({\n checked,\n defaultChecked,\n checkedChangeAction,\n closeOnActivate = false,\n disabled = false,\n label,\n className,\n style,\n children,\n render,\n ...rest\n}: MenuCheckboxItemProps) {\n const menu = useMenuContext(\"Menu.CheckboxItem\");\n // The close to run after a dispatch's action resolved, keyed by the dispatch's details.\n const after = useRef(new WeakMap<object, () => void>());\n const { optimistic, pending, dispatch } = useControllableAction<boolean>({\n controlled: checked,\n defaultValue: defaultChecked,\n initialValue: false,\n action: async (next, details) => {\n await checkedChangeAction?.(next, details);\n after.current.get(details)?.();\n },\n transitionTypes: (next) => transitionTypes(\"menu\", next ? \"check\" : \"uncheck\"),\n warn: { component: \"Menu.CheckboxItem\", prop: \"checked\" },\n });\n\n const { libraryProps } = useMenuItem({\n part: \"Menu.CheckboxItem\",\n role: \"menuitemcheckbox\",\n disabled,\n label,\n activate: (event) => {\n const details = createActionDetails(event, {});\n if (closeOnActivate) after.current.set(details, closeStackLater(menu, event));\n dispatch(!optimistic, details);\n },\n });\n\n const state: MenuCheckboxItemState = { checked: optimistic, pending, disabled };\n\n return useRender<ComponentPropsWithRef<\"button\">, MenuCheckboxItemState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n ...(rendersButton(render) && { type: \"button\" as const }),\n ...libraryProps,\n \"aria-checked\": optimistic,\n \"data-checked\": dataAttr(optimistic),\n \"data-pending\": dataAttr(pending),\n },\n });\n}\n\nMenuCheckboxItem.displayName = \"MenuCheckboxItem\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0EA,SAAgB,iBAAiB,EAC/B,SACA,gBACA,qBACA,kBAAkB,OAClB,WAAW,OACX,OACA,WACA,OACA,UACA,QACA,GAAG,QACqB;CACxB,MAAM,OAAO,eAAe,mBAAmB;CAE/C,MAAM,QAAQ,uBAAO,IAAI,QAA4B,CAAC;CACtD,MAAM,EAAE,YAAY,SAAS,aAAa,sBAA+B;EACvE,YAAY;EACZ,cAAc;EACd,cAAc;EACd,QAAQ,OAAO,MAAM,YAAY;GAC/B,MAAM,sBAAsB,MAAM,OAAO;GACzC,MAAM,QAAQ,IAAI,OAAO,CAAC,GAAG;EAC/B;EACA,kBAAkB,SAAS,gBAAgB,QAAQ,OAAO,UAAU,SAAS;EAC7E,MAAM;GAAE,WAAW;GAAqB,MAAM;EAAU;CAC1D,CAAC;CAED,MAAM,EAAE,iBAAiB,YAAY;EACnC,MAAM;EACN,MAAM;EACN;EACA;EACA,WAAW,UAAU;GACnB,MAAM,UAAU,oBAAoB,OAAO,CAAC,CAAC;GAC7C,IAAI,iBAAiB,MAAM,QAAQ,IAAI,SAAS,gBAAgB,MAAM,KAAK,CAAC;GAC5E,SAAS,CAAC,YAAY,OAAO;EAC/B;CACF,CAAC;CAID,OAAO,UAAkE;EACvE,gBAAgB;EAChB;EACA,OAAA;GALqC,SAAS;GAAY;GAAS;EAK/D;EACJ;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;GACvD,GAAG;GACH,gBAAgB;GAChB,gBAAgB,SAAS,UAAU;GACnC,gBAAgB,SAAS,OAAO;EAClC;CACF,CAAC;AACH;AAEA,iBAAiB,cAAc"}
@@ -2,21 +2,41 @@ import { RenderProp, StateValue } from "../internal/types.mjs";
2
2
  import { MenuTriggerState } from "./menu-trigger.mjs";
3
3
  import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
4
4
  //#region src/menu/menu-context-trigger.d.ts
5
+ /** State of `Menu.ContextTrigger`: the same shape as `MenuTriggerState`. */
5
6
  export type MenuContextTriggerState = MenuTriggerState;
7
+ /**
8
+ * Props of `Menu.ContextTrigger`.
9
+ *
10
+ * @see https://ui.funstack.work/components/context-menu
11
+ */
6
12
  export interface MenuContextTriggerProps extends Omit<ComponentPropsWithRef<"div">, "onContextMenu" | "onPointerDown" | "onPointerMove" | "onPointerUp" | "onPointerCancel" | "className" | "style" | "children"> {
7
- /** The region does nothing; a `contextmenu` bubbles on to an outer region. `data-disabled`. */
13
+ /**
14
+ * The region does nothing; a `contextmenu` bubbles on to an outer region. `data-disabled`.
15
+ *
16
+ * @defaultValue `false`
17
+ */
8
18
  disabled?: boolean;
9
19
  /**
10
20
  * What a `contextmenu` (or long-press) on an editable target inside the region opens: the
11
21
  * browser's own menu (`"native"`, default: copy and paste keep working) or this menu.
12
22
  * Editable: a text-taking `<input>`, a `<textarea>`, an element with `isContentEditable`.
23
+ *
24
+ * @defaultValue `"native"`
13
25
  */
14
26
  editableTargets?: "native" | "menu";
15
- /** Milliseconds a touch or pen pointer must stay down (within 10 px) to open. Default 500. */
27
+ /**
28
+ * Milliseconds a touch or pen pointer must stay down (within 10 px) to open.
29
+ *
30
+ * @defaultValue `500`
31
+ */
16
32
  longPressDelay?: number;
33
+ /** Class name, or a function of the part's state that returns one. */
17
34
  className?: StateValue<string | undefined, MenuContextTriggerState>;
35
+ /** Inline style, or a function of the part's state that returns one. */
18
36
  style?: StateValue<CSSProperties | undefined, MenuContextTriggerState>;
37
+ /** Content, or a function of the part's state. */
19
38
  children?: StateValue<ReactNode, MenuContextTriggerState>;
39
+ /** Replace the default `<div>` (element form) or take over rendering (function form). */
20
40
  render?: RenderProp<ComponentPropsWithRef<"div">, MenuContextTriggerState>;
21
41
  }
22
42
  /**
@@ -32,6 +52,8 @@ export interface MenuContextTriggerProps extends Omit<ComponentPropsWithRef<"div
32
52
  * Owned keys (conventions 1.2): `onContextMenu`, `onPointerDown`, `onPointerMove`,
33
53
  * `onPointerUp`, `onPointerCancel`, `data-open`, `data-pending`, `data-disabled`, and the style
34
54
  * key `WebkitTouchCallout` (`"none"`; the consumer's `style` wins).
55
+ *
56
+ * @see https://ui.funstack.work/components/context-menu
35
57
  */
36
58
  export declare function MenuContextTrigger({ disabled, editableTargets, longPressDelay, className, style, children, render, ...rest }: MenuContextTriggerProps): ReactNode;
37
59
  export declare namespace MenuContextTrigger {
@@ -1 +1 @@
1
- {"version":3,"file":"menu-context-trigger.d.mts","names":[],"sources":["../../src/menu/menu-context-trigger.tsx"],"mappings":";;;;YAiCY,0BAA0B;iBAErB,gCAAgC,KAC/C;;EAWA;;;;;;EAMA;;EAEA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;;;;;;wBA2BpC,qBACd,UACA,iBACA,gBACA,WACA,OACA,UACA,WACG,QACF,0BAAuB;yBATV"}
1
+ {"version":3,"file":"menu-context-trigger.d.mts","names":[],"sources":["../../src/menu/menu-context-trigger.tsx"],"mappings":";;;;;YAkCY,0BAA0B;;;;;;iBAOrB,gCAAgC,KAC/C;;;;;;EAeA;;;;;;;;EAQA;;;;;;EAMA;;EAEA,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,8BAA8B;;;;;;;;;;;;;;;;;;wBA6BpC,qBACd,UACA,iBACA,gBACA,WACA,OACA,UACA,WACG,QACF,0BAAuB;yBATV"}
@@ -24,6 +24,8 @@ const isDev = process.env.NODE_ENV !== "production";
24
24
  * Owned keys (conventions 1.2): `onContextMenu`, `onPointerDown`, `onPointerMove`,
25
25
  * `onPointerUp`, `onPointerCancel`, `data-open`, `data-pending`, `data-disabled`, and the style
26
26
  * key `WebkitTouchCallout` (`"none"`; the consumer's `style` wins).
27
+ *
28
+ * @see https://ui.funstack.work/components/context-menu
27
29
  */
28
30
  function MenuContextTrigger({ disabled = false, editableTargets = "native", longPressDelay = 500, className, style, children, render, ...rest }) {
29
31
  const menu = useMenuContext("Menu.ContextTrigger");