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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (537) hide show
  1. package/dist/accordion/accordion-context.mjs.map +1 -1
  2. package/dist/accordion/accordion-item.mjs +20 -6
  3. package/dist/accordion/accordion-item.mjs.map +1 -1
  4. package/dist/accordion/accordion-panel.mjs +4 -5
  5. package/dist/accordion/accordion-panel.mjs.map +1 -1
  6. package/dist/accordion/accordion-root.d.mts.map +1 -1
  7. package/dist/accordion/accordion-root.mjs +35 -16
  8. package/dist/accordion/accordion-root.mjs.map +1 -1
  9. package/dist/accordion/accordion-trigger.mjs +6 -7
  10. package/dist/accordion/accordion-trigger.mjs.map +1 -1
  11. package/dist/button/button.d.mts +78 -0
  12. package/dist/button/button.d.mts.map +1 -0
  13. package/dist/button/button.mjs +77 -0
  14. package/dist/button/button.mjs.map +1 -0
  15. package/dist/button/index.d.mts +3 -0
  16. package/dist/button/index.mjs +1 -0
  17. package/dist/checkbox/checkbox.d.mts +5 -3
  18. package/dist/checkbox/checkbox.d.mts.map +1 -1
  19. package/dist/checkbox/checkbox.mjs +27 -11
  20. package/dist/checkbox/checkbox.mjs.map +1 -1
  21. package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -1
  22. package/dist/checkbox-group/checkbox-group-item.d.mts +2 -1
  23. package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
  24. package/dist/checkbox-group/checkbox-group-item.mjs +5 -3
  25. package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
  26. package/dist/checkbox-group/checkbox-group-parent.mjs +2 -2
  27. package/dist/checkbox-group/checkbox-group-root.d.mts +5 -2
  28. package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
  29. package/dist/checkbox-group/checkbox-group-root.mjs +25 -6
  30. package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
  31. package/dist/combobox/combobox-clear.d.mts +37 -0
  32. package/dist/combobox/combobox-clear.d.mts.map +1 -0
  33. package/dist/combobox/combobox-clear.mjs +64 -0
  34. package/dist/combobox/combobox-clear.mjs.map +1 -0
  35. package/dist/combobox/combobox-context.mjs +23 -0
  36. package/dist/combobox/combobox-context.mjs.map +1 -0
  37. package/dist/combobox/combobox-group.d.mts +72 -0
  38. package/dist/combobox/combobox-group.d.mts.map +1 -0
  39. package/dist/combobox/combobox-group.mjs +104 -0
  40. package/dist/combobox/combobox-group.mjs.map +1 -0
  41. package/dist/combobox/combobox-input.d.mts +42 -0
  42. package/dist/combobox/combobox-input.d.mts.map +1 -0
  43. package/dist/combobox/combobox-input.mjs +102 -0
  44. package/dist/combobox/combobox-input.mjs.map +1 -0
  45. package/dist/combobox/combobox-label.d.mts +22 -0
  46. package/dist/combobox/combobox-label.d.mts.map +1 -0
  47. package/dist/combobox/combobox-label.mjs +32 -0
  48. package/dist/combobox/combobox-label.mjs.map +1 -0
  49. package/dist/combobox/combobox-list.d.mts +37 -0
  50. package/dist/combobox/combobox-list.d.mts.map +1 -0
  51. package/dist/combobox/combobox-list.mjs +71 -0
  52. package/dist/combobox/combobox-list.mjs.map +1 -0
  53. package/dist/combobox/combobox-option.d.mts +45 -0
  54. package/dist/combobox/combobox-option.d.mts.map +1 -0
  55. package/dist/combobox/combobox-option.mjs +88 -0
  56. package/dist/combobox/combobox-option.mjs.map +1 -0
  57. package/dist/combobox/combobox-popup.d.mts +49 -0
  58. package/dist/combobox/combobox-popup.d.mts.map +1 -0
  59. package/dist/combobox/combobox-popup.mjs +91 -0
  60. package/dist/combobox/combobox-popup.mjs.map +1 -0
  61. package/dist/combobox/combobox-root.d.mts +136 -0
  62. package/dist/combobox/combobox-root.d.mts.map +1 -0
  63. package/dist/combobox/combobox-root.mjs +523 -0
  64. package/dist/combobox/combobox-root.mjs.map +1 -0
  65. package/dist/combobox/combobox-trigger.d.mts +40 -0
  66. package/dist/combobox/combobox-trigger.d.mts.map +1 -0
  67. package/dist/combobox/combobox-trigger.mjs +99 -0
  68. package/dist/combobox/combobox-trigger.mjs.map +1 -0
  69. package/dist/combobox/index.d.mts +36 -0
  70. package/dist/combobox/index.d.mts.map +1 -0
  71. package/dist/combobox/index.mjs +36 -0
  72. package/dist/combobox/index.mjs.map +1 -0
  73. package/dist/csp/csp-provider.d.mts +25 -0
  74. package/dist/csp/csp-provider.d.mts.map +1 -0
  75. package/dist/csp/csp-provider.mjs +24 -0
  76. package/dist/csp/csp-provider.mjs.map +1 -0
  77. package/dist/csp/index.d.mts +3 -0
  78. package/dist/csp/index.mjs +3 -0
  79. package/dist/csp/style-hashes.d.mts +19 -0
  80. package/dist/csp/style-hashes.d.mts.map +1 -0
  81. package/dist/csp/style-hashes.mjs +21 -0
  82. package/dist/csp/style-hashes.mjs.map +1 -0
  83. package/dist/dialog/dialog-close.d.mts +22 -10
  84. package/dist/dialog/dialog-close.d.mts.map +1 -1
  85. package/dist/dialog/dialog-close.mjs +41 -25
  86. package/dist/dialog/dialog-close.mjs.map +1 -1
  87. package/dist/dialog/dialog-context.mjs.map +1 -1
  88. package/dist/dialog/dialog-form.d.mts +23 -10
  89. package/dist/dialog/dialog-form.d.mts.map +1 -1
  90. package/dist/dialog/dialog-form.mjs +51 -32
  91. package/dist/dialog/dialog-form.mjs.map +1 -1
  92. package/dist/dialog/dialog-popup.d.mts +10 -4
  93. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  94. package/dist/dialog/dialog-popup.mjs +118 -45
  95. package/dist/dialog/dialog-popup.mjs.map +1 -1
  96. package/dist/dialog/dialog-root.d.mts +14 -8
  97. package/dist/dialog/dialog-root.d.mts.map +1 -1
  98. package/dist/dialog/dialog-root.mjs +68 -13
  99. package/dist/dialog/dialog-root.mjs.map +1 -1
  100. package/dist/dialog/dialog-trigger.d.mts +11 -5
  101. package/dist/dialog/dialog-trigger.d.mts.map +1 -1
  102. package/dist/dialog/dialog-trigger.mjs +16 -8
  103. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  104. package/dist/dialog/index.d.mts +4 -2
  105. package/dist/dialog/index.d.mts.map +1 -1
  106. package/dist/dialog/index.mjs +4 -2
  107. package/dist/dialog/index.mjs.map +1 -1
  108. package/dist/field/field-control.d.mts +33 -0
  109. package/dist/field/field-control.d.mts.map +1 -0
  110. package/dist/field/field-control.mjs +68 -0
  111. package/dist/field/field-control.mjs.map +1 -0
  112. package/dist/field/field-description.d.mts +24 -0
  113. package/dist/field/field-description.d.mts.map +1 -0
  114. package/dist/field/field-description.mjs +34 -0
  115. package/dist/field/field-description.mjs.map +1 -0
  116. package/dist/field/field-error.d.mts +30 -0
  117. package/dist/field/field-error.d.mts.map +1 -0
  118. package/dist/field/field-error.mjs +42 -0
  119. package/dist/field/field-error.mjs.map +1 -0
  120. package/dist/field/field-label.d.mts +25 -0
  121. package/dist/field/field-label.d.mts.map +1 -0
  122. package/dist/field/field-label.mjs +46 -0
  123. package/dist/field/field-label.mjs.map +1 -0
  124. package/dist/field/field-root.d.mts +53 -0
  125. package/dist/field/field-root.d.mts.map +1 -0
  126. package/dist/field/field-root.mjs +319 -0
  127. package/dist/field/field-root.mjs.map +1 -0
  128. package/dist/field/index.d.mts +18 -0
  129. package/dist/field/index.d.mts.map +1 -0
  130. package/dist/field/index.mjs +17 -0
  131. package/dist/field/index.mjs.map +1 -0
  132. package/dist/form/form-root.d.mts +58 -0
  133. package/dist/form/form-root.d.mts.map +1 -0
  134. package/dist/form/form-root.mjs +147 -0
  135. package/dist/form/form-root.mjs.map +1 -0
  136. package/dist/form/form-submit.d.mts +34 -0
  137. package/dist/form/form-submit.d.mts.map +1 -0
  138. package/dist/form/form-submit.mjs +53 -0
  139. package/dist/form/form-submit.mjs.map +1 -0
  140. package/dist/form/index.d.mts +11 -0
  141. package/dist/form/index.d.mts.map +1 -0
  142. package/dist/form/index.mjs +11 -0
  143. package/dist/form/index.mjs.map +1 -0
  144. package/dist/index.d.mts +79 -4
  145. package/dist/index.mjs +16 -1
  146. package/dist/internal/anchor-position.d.mts +11 -3
  147. package/dist/internal/anchor-position.d.mts.map +1 -1
  148. package/dist/internal/anchor-position.mjs +180 -6
  149. package/dist/internal/anchor-position.mjs.map +1 -1
  150. package/dist/internal/announce.mjs +53 -0
  151. package/dist/internal/announce.mjs.map +1 -0
  152. package/dist/internal/content-focus-probe.mjs +42 -0
  153. package/dist/internal/content-focus-probe.mjs.map +1 -0
  154. package/dist/internal/csp-context.mjs +8 -0
  155. package/dist/internal/csp-context.mjs.map +1 -0
  156. package/dist/internal/decimal.mjs +27 -0
  157. package/dist/internal/decimal.mjs.map +1 -0
  158. package/dist/internal/dev-warn.mjs +17 -0
  159. package/dist/internal/dev-warn.mjs.map +1 -0
  160. package/dist/internal/field-context.d.mts +19 -0
  161. package/dist/internal/field-context.d.mts.map +1 -0
  162. package/dist/internal/field-context.mjs +14 -0
  163. package/dist/internal/field-context.mjs.map +1 -0
  164. package/dist/internal/focus-first-invalid.mjs +67 -0
  165. package/dist/internal/focus-first-invalid.mjs.map +1 -0
  166. package/dist/internal/form-status-watcher.mjs +31 -0
  167. package/dist/internal/form-status-watcher.mjs.map +1 -0
  168. package/dist/internal/modal-registry.mjs +39 -0
  169. package/dist/internal/modal-registry.mjs.map +1 -0
  170. package/dist/internal/platform-attributes.d.mts +12 -1
  171. package/dist/internal/platform-attributes.d.mts.map +1 -1
  172. package/dist/internal/range-value.mjs +51 -0
  173. package/dist/internal/range-value.mjs.map +1 -0
  174. package/dist/internal/render-element.mjs +67 -0
  175. package/dist/internal/render-element.mjs.map +1 -0
  176. package/dist/internal/toolbar-context.mjs +17 -0
  177. package/dist/internal/toolbar-context.mjs.map +1 -0
  178. package/dist/internal/tooltip-warm.mjs +29 -0
  179. package/dist/internal/tooltip-warm.mjs.map +1 -0
  180. package/dist/internal/types.d.mts +11 -1
  181. package/dist/internal/types.d.mts.map +1 -1
  182. package/dist/internal/use-action-trigger.mjs +17 -6
  183. package/dist/internal/use-action-trigger.mjs.map +1 -1
  184. package/dist/internal/use-controllable-action.mjs +35 -13
  185. package/dist/internal/use-controllable-action.mjs.map +1 -1
  186. package/dist/internal/use-exit-animation.mjs +26 -6
  187. package/dist/internal/use-exit-animation.mjs.map +1 -1
  188. package/dist/internal/use-field-control.mjs +109 -0
  189. package/dist/internal/use-field-control.mjs.map +1 -0
  190. package/dist/internal/use-form-owner-event.mjs +44 -0
  191. package/dist/internal/use-form-owner-event.mjs.map +1 -0
  192. package/dist/internal/use-form-reset.mjs +12 -31
  193. package/dist/internal/use-form-reset.mjs.map +1 -1
  194. package/dist/internal/use-hydrated-mount.mjs +21 -0
  195. package/dist/internal/use-hydrated-mount.mjs.map +1 -0
  196. package/dist/internal/use-latest.mjs +32 -0
  197. package/dist/internal/use-latest.mjs.map +1 -0
  198. package/dist/internal/use-modal-registration.mjs +47 -0
  199. package/dist/internal/use-modal-registration.mjs.map +1 -0
  200. package/dist/internal/use-native-group-reconciliation.mjs +6 -5
  201. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
  202. package/dist/internal/use-native-select-value.mjs +184 -0
  203. package/dist/internal/use-native-select-value.mjs.map +1 -0
  204. package/dist/internal/use-popover-popup.mjs +33 -28
  205. package/dist/internal/use-popover-popup.mjs.map +1 -1
  206. package/dist/internal/use-popover-root.mjs +59 -24
  207. package/dist/internal/use-popover-root.mjs.map +1 -1
  208. package/dist/internal/use-popover-trigger.mjs +6 -5
  209. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  210. package/dist/internal/use-render.mjs +12 -35
  211. package/dist/internal/use-render.mjs.map +1 -1
  212. package/dist/internal/use-resolved-placement.mjs +146 -0
  213. package/dist/internal/use-resolved-placement.mjs.map +1 -0
  214. package/dist/internal/use-roving-focus.mjs +301 -0
  215. package/dist/internal/use-roving-focus.mjs.map +1 -0
  216. package/dist/internal/validity.d.mts +24 -0
  217. package/dist/internal/validity.d.mts.map +1 -0
  218. package/dist/internal/validity.mjs +108 -0
  219. package/dist/internal/validity.mjs.map +1 -0
  220. package/dist/menu/index.d.mts +5 -1
  221. package/dist/menu/index.d.mts.map +1 -1
  222. package/dist/menu/index.mjs +5 -1
  223. package/dist/menu/index.mjs.map +1 -1
  224. package/dist/menu/menu-checkbox-item.mjs +2 -1
  225. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  226. package/dist/menu/menu-context-trigger.d.mts +46 -0
  227. package/dist/menu/menu-context-trigger.d.mts.map +1 -0
  228. package/dist/menu/menu-context-trigger.mjs +405 -0
  229. package/dist/menu/menu-context-trigger.mjs.map +1 -0
  230. package/dist/menu/menu-context.mjs +44 -1
  231. package/dist/menu/menu-context.mjs.map +1 -1
  232. package/dist/menu/menu-dom.mjs +49 -3
  233. package/dist/menu/menu-dom.mjs.map +1 -1
  234. package/dist/menu/menu-group.d.mts.map +1 -1
  235. package/dist/menu/menu-group.mjs +4 -3
  236. package/dist/menu/menu-group.mjs.map +1 -1
  237. package/dist/menu/menu-item.d.mts +6 -2
  238. package/dist/menu/menu-item.d.mts.map +1 -1
  239. package/dist/menu/menu-item.mjs +7 -4
  240. package/dist/menu/menu-item.mjs.map +1 -1
  241. package/dist/menu/menu-popup.d.mts +36 -8
  242. package/dist/menu/menu-popup.d.mts.map +1 -1
  243. package/dist/menu/menu-popup.mjs +219 -22
  244. package/dist/menu/menu-popup.mjs.map +1 -1
  245. package/dist/menu/menu-radio-group.mjs +10 -5
  246. package/dist/menu/menu-radio-group.mjs.map +1 -1
  247. package/dist/menu/menu-radio-item.mjs +2 -1
  248. package/dist/menu/menu-radio-item.mjs.map +1 -1
  249. package/dist/menu/menu-root.d.mts +5 -0
  250. package/dist/menu/menu-root.d.mts.map +1 -1
  251. package/dist/menu/menu-root.mjs +57 -7
  252. package/dist/menu/menu-root.mjs.map +1 -1
  253. package/dist/menu/menu-submenu-trigger.d.mts.map +1 -1
  254. package/dist/menu/menu-submenu-trigger.mjs +28 -12
  255. package/dist/menu/menu-submenu-trigger.mjs.map +1 -1
  256. package/dist/menu/menu-trigger.d.mts +8 -4
  257. package/dist/menu/menu-trigger.d.mts.map +1 -1
  258. package/dist/menu/menu-trigger.mjs +18 -7
  259. package/dist/menu/menu-trigger.mjs.map +1 -1
  260. package/dist/meter/index.d.mts +24 -0
  261. package/dist/meter/index.d.mts.map +1 -0
  262. package/dist/meter/index.mjs +23 -0
  263. package/dist/meter/index.mjs.map +1 -0
  264. package/dist/meter/meter-context.mjs +13 -0
  265. package/dist/meter/meter-context.mjs.map +1 -0
  266. package/dist/meter/meter-indicator.d.mts +19 -0
  267. package/dist/meter/meter-indicator.d.mts.map +1 -0
  268. package/dist/meter/meter-indicator.mjs +25 -0
  269. package/dist/meter/meter-indicator.mjs.map +1 -0
  270. package/dist/meter/meter-label.d.mts +19 -0
  271. package/dist/meter/meter-label.d.mts.map +1 -0
  272. package/dist/meter/meter-label.mjs +28 -0
  273. package/dist/meter/meter-label.mjs.map +1 -0
  274. package/dist/meter/meter-region.d.mts +4 -0
  275. package/dist/meter/meter-region.d.mts.map +1 -0
  276. package/dist/meter/meter-region.mjs +39 -0
  277. package/dist/meter/meter-region.mjs.map +1 -0
  278. package/dist/meter/meter-root.d.mts +71 -0
  279. package/dist/meter/meter-root.d.mts.map +1 -0
  280. package/dist/meter/meter-root.mjs +83 -0
  281. package/dist/meter/meter-root.mjs.map +1 -0
  282. package/dist/meter/meter-track.d.mts +19 -0
  283. package/dist/meter/meter-track.d.mts.map +1 -0
  284. package/dist/meter/meter-track.mjs +25 -0
  285. package/dist/meter/meter-track.mjs.map +1 -0
  286. package/dist/meter/meter-value.d.mts +20 -0
  287. package/dist/meter/meter-value.d.mts.map +1 -0
  288. package/dist/meter/meter-value.mjs +29 -0
  289. package/dist/meter/meter-value.mjs.map +1 -0
  290. package/dist/number-field/index.d.mts +26 -0
  291. package/dist/number-field/index.d.mts.map +1 -0
  292. package/dist/number-field/index.mjs +26 -0
  293. package/dist/number-field/index.mjs.map +1 -0
  294. package/dist/number-field/number-field-arithmetic.mjs +78 -0
  295. package/dist/number-field/number-field-arithmetic.mjs.map +1 -0
  296. package/dist/number-field/number-field-context.d.mts +2 -0
  297. package/dist/number-field/number-field-context.mjs +13 -0
  298. package/dist/number-field/number-field-context.mjs.map +1 -0
  299. package/dist/number-field/number-field-decrement.d.mts +17 -0
  300. package/dist/number-field/number-field-decrement.d.mts.map +1 -0
  301. package/dist/number-field/number-field-decrement.mjs +20 -0
  302. package/dist/number-field/number-field-decrement.mjs.map +1 -0
  303. package/dist/number-field/number-field-format.mjs +279 -0
  304. package/dist/number-field/number-field-format.mjs.map +1 -0
  305. package/dist/number-field/number-field-increment.d.mts +37 -0
  306. package/dist/number-field/number-field-increment.d.mts.map +1 -0
  307. package/dist/number-field/number-field-increment.mjs +71 -0
  308. package/dist/number-field/number-field-increment.mjs.map +1 -0
  309. package/dist/number-field/number-field-input.d.mts +29 -0
  310. package/dist/number-field/number-field-input.d.mts.map +1 -0
  311. package/dist/number-field/number-field-input.mjs +163 -0
  312. package/dist/number-field/number-field-input.mjs.map +1 -0
  313. package/dist/number-field/number-field-label.d.mts +23 -0
  314. package/dist/number-field/number-field-label.d.mts.map +1 -0
  315. package/dist/number-field/number-field-label.mjs +47 -0
  316. package/dist/number-field/number-field-label.mjs.map +1 -0
  317. package/dist/number-field/number-field-root.d.mts +108 -0
  318. package/dist/number-field/number-field-root.d.mts.map +1 -0
  319. package/dist/number-field/number-field-root.mjs +523 -0
  320. package/dist/number-field/number-field-root.mjs.map +1 -0
  321. package/dist/number-field/use-step-button.mjs +112 -0
  322. package/dist/number-field/use-step-button.mjs.map +1 -0
  323. package/dist/popover/popover-close.d.mts +9 -3
  324. package/dist/popover/popover-close.d.mts.map +1 -1
  325. package/dist/popover/popover-close.mjs +13 -7
  326. package/dist/popover/popover-close.mjs.map +1 -1
  327. package/dist/popover/popover-popup.d.mts +21 -7
  328. package/dist/popover/popover-popup.d.mts.map +1 -1
  329. package/dist/popover/popover-popup.mjs +23 -8
  330. package/dist/popover/popover-popup.mjs.map +1 -1
  331. package/dist/popover/popover-root.mjs +1 -1
  332. package/dist/popover/popover-trigger.d.mts +8 -4
  333. package/dist/popover/popover-trigger.d.mts.map +1 -1
  334. package/dist/popover/popover-trigger.mjs +3 -3
  335. package/dist/popover/popover-trigger.mjs.map +1 -1
  336. package/dist/progress/index.d.mts +24 -0
  337. package/dist/progress/index.d.mts.map +1 -0
  338. package/dist/progress/index.mjs +24 -0
  339. package/dist/progress/index.mjs.map +1 -0
  340. package/dist/progress/progress-context.mjs +13 -0
  341. package/dist/progress/progress-context.mjs.map +1 -0
  342. package/dist/progress/progress-indicator.d.mts +19 -0
  343. package/dist/progress/progress-indicator.d.mts.map +1 -0
  344. package/dist/progress/progress-indicator.mjs +29 -0
  345. package/dist/progress/progress-indicator.mjs.map +1 -0
  346. package/dist/progress/progress-label.d.mts +19 -0
  347. package/dist/progress/progress-label.d.mts.map +1 -0
  348. package/dist/progress/progress-label.mjs +30 -0
  349. package/dist/progress/progress-label.mjs.map +1 -0
  350. package/dist/progress/progress-root.d.mts +68 -0
  351. package/dist/progress/progress-root.d.mts.map +1 -0
  352. package/dist/progress/progress-root.mjs +80 -0
  353. package/dist/progress/progress-root.mjs.map +1 -0
  354. package/dist/progress/progress-track.d.mts +19 -0
  355. package/dist/progress/progress-track.d.mts.map +1 -0
  356. package/dist/progress/progress-track.mjs +29 -0
  357. package/dist/progress/progress-track.mjs.map +1 -0
  358. package/dist/progress/progress-value.d.mts +20 -0
  359. package/dist/progress/progress-value.d.mts.map +1 -0
  360. package/dist/progress/progress-value.mjs +33 -0
  361. package/dist/progress/progress-value.mjs.map +1 -0
  362. package/dist/radio-group/radio-group-item.mjs +2 -2
  363. package/dist/radio-group/radio-group-root.d.mts +4 -2
  364. package/dist/radio-group/radio-group-root.d.mts.map +1 -1
  365. package/dist/radio-group/radio-group-root.mjs +35 -9
  366. package/dist/radio-group/radio-group-root.mjs.map +1 -1
  367. package/dist/select/index.d.mts +30 -0
  368. package/dist/select/index.d.mts.map +1 -0
  369. package/dist/select/index.mjs +30 -0
  370. package/dist/select/index.mjs.map +1 -0
  371. package/dist/select/select-context.mjs +13 -0
  372. package/dist/select/select-context.mjs.map +1 -0
  373. package/dist/select/select-dom.mjs +44 -0
  374. package/dist/select/select-dom.mjs.map +1 -0
  375. package/dist/select/select-group-label.d.mts +22 -0
  376. package/dist/select/select-group-label.d.mts.map +1 -0
  377. package/dist/select/select-group-label.mjs +39 -0
  378. package/dist/select/select-group-label.mjs.map +1 -0
  379. package/dist/select/select-group.d.mts +28 -0
  380. package/dist/select/select-group.d.mts.map +1 -0
  381. package/dist/select/select-group.mjs +47 -0
  382. package/dist/select/select-group.mjs.map +1 -0
  383. package/dist/select/select-option.d.mts +42 -0
  384. package/dist/select/select-option.d.mts.map +1 -0
  385. package/dist/select/select-option.mjs +65 -0
  386. package/dist/select/select-option.mjs.map +1 -0
  387. package/dist/select/select-root.d.mts +68 -0
  388. package/dist/select/select-root.d.mts.map +1 -0
  389. package/dist/select/select-root.mjs +114 -0
  390. package/dist/select/select-root.mjs.map +1 -0
  391. package/dist/select/select-separator.d.mts +20 -0
  392. package/dist/select/select-separator.d.mts.map +1 -0
  393. package/dist/select/select-separator.mjs +30 -0
  394. package/dist/select/select-separator.mjs.map +1 -0
  395. package/dist/select/select-trigger.d.mts +29 -0
  396. package/dist/select/select-trigger.d.mts.map +1 -0
  397. package/dist/select/select-trigger.mjs +48 -0
  398. package/dist/select/select-trigger.mjs.map +1 -0
  399. package/dist/select/select-value.d.mts +31 -0
  400. package/dist/select/select-value.d.mts.map +1 -0
  401. package/dist/select/select-value.mjs +101 -0
  402. package/dist/select/select-value.mjs.map +1 -0
  403. package/dist/slider/index.d.mts +32 -0
  404. package/dist/slider/index.d.mts.map +1 -0
  405. package/dist/slider/index.mjs +27 -0
  406. package/dist/slider/index.mjs.map +1 -0
  407. package/dist/slider/slider-arithmetic.mjs +104 -0
  408. package/dist/slider/slider-arithmetic.mjs.map +1 -0
  409. package/dist/slider/slider-context.mjs +13 -0
  410. package/dist/slider/slider-context.mjs.map +1 -0
  411. package/dist/slider/slider-indicator.d.mts +22 -0
  412. package/dist/slider/slider-indicator.d.mts.map +1 -0
  413. package/dist/slider/slider-indicator.mjs +36 -0
  414. package/dist/slider/slider-indicator.mjs.map +1 -0
  415. package/dist/slider/slider-label.d.mts +23 -0
  416. package/dist/slider/slider-label.d.mts.map +1 -0
  417. package/dist/slider/slider-label.mjs +44 -0
  418. package/dist/slider/slider-label.mjs.map +1 -0
  419. package/dist/slider/slider-root.d.mts +111 -0
  420. package/dist/slider/slider-root.d.mts.map +1 -0
  421. package/dist/slider/slider-root.mjs +583 -0
  422. package/dist/slider/slider-root.mjs.map +1 -0
  423. package/dist/slider/slider-thumb.d.mts +58 -0
  424. package/dist/slider/slider-thumb.d.mts.map +1 -0
  425. package/dist/slider/slider-thumb.mjs +146 -0
  426. package/dist/slider/slider-thumb.mjs.map +1 -0
  427. package/dist/slider/slider-track.d.mts +29 -0
  428. package/dist/slider/slider-track.d.mts.map +1 -0
  429. package/dist/slider/slider-track.mjs +55 -0
  430. package/dist/slider/slider-track.mjs.map +1 -0
  431. package/dist/slider/slider-value.d.mts +34 -0
  432. package/dist/slider/slider-value.d.mts.map +1 -0
  433. package/dist/slider/slider-value.mjs +38 -0
  434. package/dist/slider/slider-value.mjs.map +1 -0
  435. package/dist/switch/switch.d.mts +5 -3
  436. package/dist/switch/switch.d.mts.map +1 -1
  437. package/dist/switch/switch.mjs +26 -10
  438. package/dist/switch/switch.mjs.map +1 -1
  439. package/dist/tabs/tabs-indicator.mjs +2 -1
  440. package/dist/tabs/tabs-indicator.mjs.map +1 -1
  441. package/dist/tabs/tabs-list.mjs +1 -1
  442. package/dist/tabs/tabs-panel.mjs +1 -1
  443. package/dist/tabs/tabs-root.mjs +15 -5
  444. package/dist/tabs/tabs-root.mjs.map +1 -1
  445. package/dist/tabs/tabs-tab.mjs +3 -2
  446. package/dist/tabs/tabs-tab.mjs.map +1 -1
  447. package/dist/toast/index.d.mts +25 -0
  448. package/dist/toast/index.d.mts.map +1 -0
  449. package/dist/toast/index.mjs +26 -0
  450. package/dist/toast/index.mjs.map +1 -0
  451. package/dist/toast/toast-action.d.mts +40 -0
  452. package/dist/toast/toast-action.d.mts.map +1 -0
  453. package/dist/toast/toast-action.mjs +67 -0
  454. package/dist/toast/toast-action.mjs.map +1 -0
  455. package/dist/toast/toast-close.d.mts +25 -0
  456. package/dist/toast/toast-close.d.mts.map +1 -0
  457. package/dist/toast/toast-close.mjs +47 -0
  458. package/dist/toast/toast-close.mjs.map +1 -0
  459. package/dist/toast/toast-context.mjs +19 -0
  460. package/dist/toast/toast-context.mjs.map +1 -0
  461. package/dist/toast/toast-description.d.mts +24 -0
  462. package/dist/toast/toast-description.d.mts.map +1 -0
  463. package/dist/toast/toast-description.mjs +35 -0
  464. package/dist/toast/toast-description.mjs.map +1 -0
  465. package/dist/toast/toast-root.d.mts +43 -0
  466. package/dist/toast/toast-root.d.mts.map +1 -0
  467. package/dist/toast/toast-root.mjs +205 -0
  468. package/dist/toast/toast-root.mjs.map +1 -0
  469. package/dist/toast/toast-title.d.mts +24 -0
  470. package/dist/toast/toast-title.d.mts.map +1 -0
  471. package/dist/toast/toast-title.mjs +33 -0
  472. package/dist/toast/toast-title.mjs.map +1 -0
  473. package/dist/toast/toast-viewport.d.mts +52 -0
  474. package/dist/toast/toast-viewport.d.mts.map +1 -0
  475. package/dist/toast/toast-viewport.mjs +644 -0
  476. package/dist/toast/toast-viewport.mjs.map +1 -0
  477. package/dist/toast/toast.d.mts +119 -0
  478. package/dist/toast/toast.d.mts.map +1 -0
  479. package/dist/toast/toast.mjs +157 -0
  480. package/dist/toast/toast.mjs.map +1 -0
  481. package/dist/toggle/toggle.d.mts +4 -1
  482. package/dist/toggle/toggle.d.mts.map +1 -1
  483. package/dist/toggle/toggle.mjs +16 -9
  484. package/dist/toggle/toggle.mjs.map +1 -1
  485. package/dist/toggle-group/index.d.mts +16 -0
  486. package/dist/toggle-group/index.d.mts.map +1 -0
  487. package/dist/toggle-group/index.mjs +15 -0
  488. package/dist/toggle-group/index.mjs.map +1 -0
  489. package/dist/toggle-group/toggle-group-context.d.mts +4 -0
  490. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -0
  491. package/dist/toggle-group/toggle-group-context.mjs +13 -0
  492. package/dist/toggle-group/toggle-group-context.mjs.map +1 -0
  493. package/dist/toggle-group/toggle-group-item.d.mts +51 -0
  494. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -0
  495. package/dist/toggle-group/toggle-group-item.mjs +68 -0
  496. package/dist/toggle-group/toggle-group-item.mjs.map +1 -0
  497. package/dist/toggle-group/toggle-group-root.d.mts +95 -0
  498. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -0
  499. package/dist/toggle-group/toggle-group-root.mjs +211 -0
  500. package/dist/toggle-group/toggle-group-root.mjs.map +1 -0
  501. package/dist/toolbar/index.d.mts +17 -0
  502. package/dist/toolbar/index.d.mts.map +1 -0
  503. package/dist/toolbar/index.mjs +17 -0
  504. package/dist/toolbar/index.mjs.map +1 -0
  505. package/dist/toolbar/toolbar-root.d.mts +38 -0
  506. package/dist/toolbar/toolbar-root.d.mts.map +1 -0
  507. package/dist/toolbar/toolbar-root.mjs +66 -0
  508. package/dist/toolbar/toolbar-root.mjs.map +1 -0
  509. package/dist/toolbar/toolbar-separator.d.mts +25 -0
  510. package/dist/toolbar/toolbar-separator.d.mts.map +1 -0
  511. package/dist/toolbar/toolbar-separator.mjs +31 -0
  512. package/dist/toolbar/toolbar-separator.mjs.map +1 -0
  513. package/dist/tooltip/index.d.mts +8 -5
  514. package/dist/tooltip/index.d.mts.map +1 -1
  515. package/dist/tooltip/index.mjs +6 -3
  516. package/dist/tooltip/index.mjs.map +1 -1
  517. package/dist/tooltip/tooltip-arrow.d.mts +30 -0
  518. package/dist/tooltip/tooltip-arrow.d.mts.map +1 -0
  519. package/dist/tooltip/tooltip-arrow.mjs +45 -0
  520. package/dist/tooltip/tooltip-arrow.mjs.map +1 -0
  521. package/dist/tooltip/tooltip-context.d.mts +7 -0
  522. package/dist/tooltip/tooltip-context.d.mts.map +1 -1
  523. package/dist/tooltip/tooltip-context.mjs +2 -1
  524. package/dist/tooltip/tooltip-context.mjs.map +1 -1
  525. package/dist/tooltip/tooltip-popup.d.mts +27 -6
  526. package/dist/tooltip/tooltip-popup.d.mts.map +1 -1
  527. package/dist/tooltip/tooltip-popup.mjs +36 -7
  528. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  529. package/dist/tooltip/tooltip-root.mjs +18 -2
  530. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  531. package/dist/tooltip/tooltip-trigger.d.mts +9 -2
  532. package/dist/tooltip/tooltip-trigger.d.mts.map +1 -1
  533. package/dist/tooltip/tooltip-trigger.mjs +23 -6
  534. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  535. package/dist/tooltip/use-tooltip-interaction.mjs +126 -76
  536. package/dist/tooltip/use-tooltip-interaction.mjs.map +1 -1
  537. package/package.json +14 -1
@@ -0,0 +1,112 @@
1
+ "use client";
2
+ import { useEffect, useRef } from "react";
3
+ /**
4
+ * The press-and-hold of `NumberField.Increment` / `Decrement` (design 4.3): one step at
5
+ * `pointerdown`, a repeat after 400 ms then every 60 ms, one commit at the release
6
+ * (`pointerup`, `pointercancel`, `lostpointercapture`, or `blur` on the window). The press is
7
+ * `preventDefault()`ed so focus stays where it is. A `click` with no pointer gesture before it
8
+ * (assistive technology: `detail === 0`) is a one-step gesture.
9
+ */
10
+ function useStepButton(ctx, direction, disabled) {
11
+ const active = useRef(null);
12
+ /** A pointer gesture started on this button; the click that follows it is not an activation. */
13
+ const pointerSeen = useRef(false);
14
+ const latest = useRef({
15
+ ctx,
16
+ disabled
17
+ });
18
+ useEffect(() => {
19
+ latest.current = {
20
+ ctx,
21
+ disabled
22
+ };
23
+ });
24
+ useEffect(() => () => {
25
+ active.current?.detach();
26
+ active.current = null;
27
+ }, []);
28
+ const onPointerDown = (event) => {
29
+ if (event.button !== 0 || !event.isPrimary) return;
30
+ if (disabled) {
31
+ event.preventDefault();
32
+ return;
33
+ }
34
+ if (active.current !== null) return;
35
+ const element = event.currentTarget;
36
+ const native = event.nativeEvent;
37
+ event.preventDefault();
38
+ pointerSeen.current = true;
39
+ const pointerId = native.pointerId;
40
+ try {
41
+ element.setPointerCapture(pointerId);
42
+ } catch {}
43
+ let timer;
44
+ const view = element.ownerDocument.defaultView;
45
+ const detach = () => {
46
+ if (timer !== void 0) clearTimeout(timer);
47
+ timer = void 0;
48
+ element.removeEventListener("pointerup", onEnd);
49
+ element.removeEventListener("pointercancel", onEnd);
50
+ element.removeEventListener("lostpointercapture", onEnd);
51
+ view?.removeEventListener("blur", onBlur);
52
+ if (active.current?.pointerId === pointerId) active.current = null;
53
+ setTimeout(() => {
54
+ pointerSeen.current = false;
55
+ }, 0);
56
+ };
57
+ function onEnd(endEvent) {
58
+ if (endEvent.pointerId !== pointerId) return;
59
+ detach();
60
+ latest.current.ctx.endHold(direction, endEvent);
61
+ }
62
+ function onBlur(blurEvent) {
63
+ detach();
64
+ latest.current.ctx.endHold(direction, blurEvent);
65
+ }
66
+ const tick = () => {
67
+ timer = setTimeout(() => {
68
+ timer = void 0;
69
+ if (latest.current.ctx.tickHold(direction, void 0)) tick();
70
+ else detach();
71
+ }, 60);
72
+ };
73
+ if (!ctx.beginHold(direction, native)) {
74
+ detach();
75
+ return;
76
+ }
77
+ element.addEventListener("pointerup", onEnd);
78
+ element.addEventListener("pointercancel", onEnd);
79
+ element.addEventListener("lostpointercapture", onEnd);
80
+ view?.addEventListener("blur", onBlur);
81
+ active.current = {
82
+ pointerId,
83
+ detach
84
+ };
85
+ timer = setTimeout(() => {
86
+ timer = void 0;
87
+ if (latest.current.ctx.tickHold(direction, void 0)) tick();
88
+ else detach();
89
+ }, 400);
90
+ };
91
+ const onClick = (event) => {
92
+ if (disabled) event.preventDefault();
93
+ if (pointerSeen.current || active.current !== null || event.detail !== 0) {
94
+ pointerSeen.current = false;
95
+ return;
96
+ }
97
+ if (disabled) return;
98
+ ctx.activate(direction, event.nativeEvent);
99
+ };
100
+ const onContextMenu = (event) => {
101
+ if (active.current !== null) event.preventDefault();
102
+ };
103
+ return {
104
+ onPointerDown,
105
+ onClick,
106
+ onContextMenu
107
+ };
108
+ }
109
+ //#endregion
110
+ export { useStepButton };
111
+
112
+ //# sourceMappingURL=use-step-button.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-step-button.mjs","names":[],"sources":["../../src/number-field/use-step-button.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport type { MouseEvent as ReactMouseEvent, PointerEvent as ReactPointerEvent } from \"react\";\nimport type { NumberFieldContextValue, StepDirection } from \"./number-field-context.js\";\n\n/** First repeat after the press, then the interval between repeats (Base UI, React Aria). */\nexport const HOLD_DELAY = 400;\nexport const HOLD_INTERVAL = 60;\n\ninterface ActiveHold {\n readonly pointerId: number;\n readonly detach: () => void;\n}\n\nexport interface StepButtonHandlers {\n readonly onPointerDown: (event: ReactPointerEvent<HTMLElement>) => void;\n readonly onClick: (event: ReactMouseEvent<HTMLElement>) => void;\n readonly onContextMenu: (event: ReactMouseEvent<HTMLElement>) => void;\n}\n\n/**\n * The press-and-hold of `NumberField.Increment` / `Decrement` (design 4.3): one step at\n * `pointerdown`, a repeat after 400 ms then every 60 ms, one commit at the release\n * (`pointerup`, `pointercancel`, `lostpointercapture`, or `blur` on the window). The press is\n * `preventDefault()`ed so focus stays where it is. A `click` with no pointer gesture before it\n * (assistive technology: `detail === 0`) is a one-step gesture.\n */\nexport function useStepButton(\n ctx: NumberFieldContextValue,\n direction: StepDirection,\n disabled: boolean,\n): StepButtonHandlers {\n const active = useRef<ActiveHold | null>(null);\n /** A pointer gesture started on this button; the click that follows it is not an activation. */\n const pointerSeen = useRef(false);\n const latest = useRef({ ctx, disabled });\n useEffect(() => {\n latest.current = { ctx, disabled };\n });\n\n // An unmount mid-hold leaves no timer or listener behind.\n useEffect(\n () => () => {\n active.current?.detach();\n active.current = null;\n },\n [],\n );\n\n const onPointerDown = (event: ReactPointerEvent<HTMLElement>): void => {\n if (event.button !== 0 || !event.isPrimary) return;\n if (disabled) {\n // A focusable disabled render (`aria-disabled`, #83) must not take focus from the input\n // either; native `disabled` focused nothing.\n event.preventDefault();\n return;\n }\n if (active.current !== null) return;\n const element = event.currentTarget;\n const native = event.nativeEvent;\n // No focus move off the input, no touch keyboard, no text selection.\n event.preventDefault();\n pointerSeen.current = true;\n const pointerId = native.pointerId;\n try {\n element.setPointerCapture(pointerId);\n } catch {\n // An inactive pointer id (a synthetic event): the hold still follows the element.\n }\n\n let timer: ReturnType<typeof setTimeout> | undefined;\n const view = element.ownerDocument.defaultView;\n const detach = (): void => {\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n element.removeEventListener(\"pointerup\", onEnd);\n element.removeEventListener(\"pointercancel\", onEnd);\n element.removeEventListener(\"lostpointercapture\", onEnd);\n view?.removeEventListener(\"blur\", onBlur);\n if (active.current?.pointerId === pointerId) active.current = null;\n // A click that follows this release (same task, or a touch tap later) is ignored; an\n // activation without a pointer afterwards is not.\n setTimeout(() => {\n pointerSeen.current = false;\n }, 0);\n };\n function onEnd(endEvent: Event): void {\n if ((endEvent as PointerEvent).pointerId !== pointerId) return;\n detach();\n latest.current.ctx.endHold(direction, endEvent);\n }\n function onBlur(blurEvent: Event): void {\n detach();\n latest.current.ctx.endHold(direction, blurEvent);\n }\n const tick = (): void => {\n timer = setTimeout(() => {\n timer = undefined;\n if (latest.current.ctx.tickHold(direction, undefined)) tick();\n else detach();\n }, HOLD_INTERVAL);\n };\n\n if (!ctx.beginHold(direction, native)) {\n // The first step reached the bound: the hold already committed.\n detach();\n return;\n }\n element.addEventListener(\"pointerup\", onEnd);\n element.addEventListener(\"pointercancel\", onEnd);\n element.addEventListener(\"lostpointercapture\", onEnd);\n view?.addEventListener(\"blur\", onBlur);\n active.current = { pointerId, detach };\n timer = setTimeout(() => {\n timer = undefined;\n if (latest.current.ctx.tickHold(direction, undefined)) tick();\n else detach();\n }, HOLD_DELAY);\n };\n\n const onClick = (event: ReactMouseEvent<HTMLElement>): void => {\n // A disabled link or component render (`aria-disabled`, #83) must not navigate either.\n if (disabled) event.preventDefault();\n if (pointerSeen.current || active.current !== null || event.detail !== 0) {\n pointerSeen.current = false;\n return;\n }\n if (disabled) return;\n ctx.activate(direction, event.nativeEvent);\n };\n\n const onContextMenu = (event: ReactMouseEvent<HTMLElement>): void => {\n // A touch long-press would open the context menu mid-hold.\n if (active.current !== null) event.preventDefault();\n };\n\n return { onPointerDown, onClick, onContextMenu };\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgB,cACd,KACA,WACA,UACoB;CACpB,MAAM,SAAS,OAA0B,IAAI;;CAE7C,MAAM,cAAc,OAAO,KAAK;CAChC,MAAM,SAAS,OAAO;EAAE;EAAK;CAAS,CAAC;CACvC,gBAAgB;EACd,OAAO,UAAU;GAAE;GAAK;EAAS;CACnC,CAAC;CAGD,sBACc;EACV,OAAO,SAAS,OAAO;EACvB,OAAO,UAAU;CACnB,GACA,CAAC,CACH;CAEA,MAAM,iBAAiB,UAAgD;EACrE,IAAI,MAAM,WAAW,KAAK,CAAC,MAAM,WAAW;EAC5C,IAAI,UAAU;GAGZ,MAAM,eAAe;GACrB;EACF;EACA,IAAI,OAAO,YAAY,MAAM;EAC7B,MAAM,UAAU,MAAM;EACtB,MAAM,SAAS,MAAM;EAErB,MAAM,eAAe;EACrB,YAAY,UAAU;EACtB,MAAM,YAAY,OAAO;EACzB,IAAI;GACF,QAAQ,kBAAkB,SAAS;EACrC,QAAQ,CAER;EAEA,IAAI;EACJ,MAAM,OAAO,QAAQ,cAAc;EACnC,MAAM,eAAqB;GACzB,IAAI,UAAU,KAAA,GAAW,aAAa,KAAK;GAC3C,QAAQ,KAAA;GACR,QAAQ,oBAAoB,aAAa,KAAK;GAC9C,QAAQ,oBAAoB,iBAAiB,KAAK;GAClD,QAAQ,oBAAoB,sBAAsB,KAAK;GACvD,MAAM,oBAAoB,QAAQ,MAAM;GACxC,IAAI,OAAO,SAAS,cAAc,WAAW,OAAO,UAAU;GAG9D,iBAAiB;IACf,YAAY,UAAU;GACxB,GAAG,CAAC;EACN;EACA,SAAS,MAAM,UAAuB;GACpC,IAAK,SAA0B,cAAc,WAAW;GACxD,OAAO;GACP,OAAO,QAAQ,IAAI,QAAQ,WAAW,QAAQ;EAChD;EACA,SAAS,OAAO,WAAwB;GACtC,OAAO;GACP,OAAO,QAAQ,IAAI,QAAQ,WAAW,SAAS;EACjD;EACA,MAAM,aAAmB;GACvB,QAAQ,iBAAiB;IACvB,QAAQ,KAAA;IACR,IAAI,OAAO,QAAQ,IAAI,SAAS,WAAW,KAAA,CAAS,GAAG,KAAK;SACvD,OAAO;GACd,GAAA,EAAgB;EAClB;EAEA,IAAI,CAAC,IAAI,UAAU,WAAW,MAAM,GAAG;GAErC,OAAO;GACP;EACF;EACA,QAAQ,iBAAiB,aAAa,KAAK;EAC3C,QAAQ,iBAAiB,iBAAiB,KAAK;EAC/C,QAAQ,iBAAiB,sBAAsB,KAAK;EACpD,MAAM,iBAAiB,QAAQ,MAAM;EACrC,OAAO,UAAU;GAAE;GAAW;EAAO;EACrC,QAAQ,iBAAiB;GACvB,QAAQ,KAAA;GACR,IAAI,OAAO,QAAQ,IAAI,SAAS,WAAW,KAAA,CAAS,GAAG,KAAK;QACvD,OAAO;EACd,GAAA,GAAa;CACf;CAEA,MAAM,WAAW,UAA8C;EAE7D,IAAI,UAAU,MAAM,eAAe;EACnC,IAAI,YAAY,WAAW,OAAO,YAAY,QAAQ,MAAM,WAAW,GAAG;GACxE,YAAY,UAAU;GACtB;EACF;EACA,IAAI,UAAU;EACd,IAAI,SAAS,WAAW,MAAM,WAAW;CAC3C;CAEA,MAAM,iBAAiB,UAA8C;EAEnE,IAAI,OAAO,YAAY,MAAM,MAAM,eAAe;CACpD;CAEA,OAAO;EAAE;EAAe;EAAS;CAAc;AACjD"}
@@ -16,7 +16,11 @@ export interface PopoverCloseProps extends Omit<ComponentPropsWithRef<"button">,
16
16
  * mode the button is a native `command="hide-popover"` invoker.
17
17
  */
18
18
  action?: Action<[details: ActionDetails]>;
19
- /** Native `disabled`; owned, so a `render` element cannot re-enable the button. */
19
+ /**
20
+ * Never closes. Native `disabled` on a `<button>`; owned, so a `render` element cannot
21
+ * re-enable it. With a link or component `render` whose click this part handles (library mode,
22
+ * or with `action`), `aria-disabled="true"` instead: the element stays focusable.
23
+ */
20
24
  disabled?: boolean;
21
25
  className?: StateValue<string | undefined, PopoverCloseState>;
22
26
  style?: StateValue<CSSProperties | undefined, PopoverCloseState>;
@@ -28,10 +32,12 @@ export interface PopoverCloseProps extends Omit<ComponentPropsWithRef<"button">,
28
32
  * without `action` the browser hides the popover. In library mode the click is always cancelled
29
33
  * and the close goes through the Root (`openChangeAction(false)` awaited, `hidePopover()` in the
30
34
  * commit). With `action` the action runs first in this part's own transition (`data-pending` on
31
- * the button); a rejection leaves the popover open.
35
+ * the button, with `aria-disabled`; a second click meanwhile is ignored); a rejection leaves the
36
+ * popover open.
32
37
  *
33
38
  * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,
34
- * `command`, `onClick` (library mode, or with `action`), `data-pending`, `data-disabled`.
39
+ * `command`, `onClick` (library mode, or with `action`), `aria-disabled`, `data-pending`,
40
+ * `data-disabled`.
35
41
  */
36
42
  export declare function PopoverClose({ action, disabled, className, style, children, render, ...rest }: PopoverCloseProps): ReactNode;
37
43
  export declare namespace PopoverClose {
@@ -1 +1 @@
1
- {"version":3,"file":"popover-close.d.mts","names":[],"sources":["../../src/popover/popover-close.tsx"],"mappings":";;;iBAWiB;;WAEN;WACA;;iBAGM,0BAA0B,KACzC;;;;;;;;;EAWA,SAAS,QAAQ,SAAS;;EAE1B;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;wBAuBvC,eACd,QACA,UACA,WACA,OACA,UACA,WACG,QACF,oBAAiB;yBARJ"}
1
+ {"version":3,"file":"popover-close.d.mts","names":[],"sources":["../../src/popover/popover-close.tsx"],"mappings":";;;iBAWiB;;WAEN;WACA;;iBAGM,0BAA0B,KACzC;;;;;;;;;EAWA,SAAS,QAAQ,SAAS;;;;;;EAM1B;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;wBAyBvC,eACd,QACA,UACA,WACA,OACA,UACA,WACG,QACF,oBAAiB;yBARJ"}
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  import { createActionDetails } from "../internal/action-details.mjs";
3
3
  import { dataAttr } from "../internal/data-attr.mjs";
4
- import { rendersButton, useRender } from "../internal/use-render.mjs";
5
4
  import { useActionTrigger } from "../internal/use-action-trigger.mjs";
5
+ import { isHostButton, rendersButton } from "../internal/render-element.mjs";
6
+ import { useRender } from "../internal/use-render.mjs";
6
7
  import { usePopoverContext } from "./popover-context.mjs";
7
8
  import { useCallback } from "react";
8
9
  //#region src/popover/popover-close.tsx
@@ -19,17 +20,21 @@ function isPopoverOpen(element) {
19
20
  * without `action` the browser hides the popover. In library mode the click is always cancelled
20
21
  * and the close goes through the Root (`openChangeAction(false)` awaited, `hidePopover()` in the
21
22
  * commit). With `action` the action runs first in this part's own transition (`data-pending` on
22
- * the button); a rejection leaves the popover open.
23
+ * the button, with `aria-disabled`; a second click meanwhile is ignored); a rejection leaves the
24
+ * popover open.
23
25
  *
24
26
  * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,
25
- * `command`, `onClick` (library mode, or with `action`), `data-pending`, `data-disabled`.
27
+ * `command`, `onClick` (library mode, or with `action`), `aria-disabled`, `data-pending`,
28
+ * `data-disabled`.
26
29
  */
27
30
  function PopoverClose({ action, disabled = false, className, style, children, render, ...rest }) {
28
31
  const ctx = usePopoverContext("Popover.Close");
29
32
  const { ids, popupRef, recordCloseIntent, openGeneration } = ctx;
30
- const { pending, run } = useActionTrigger(openGeneration);
33
+ const { pending, run } = useActionTrigger({ openGeneration });
31
34
  const isLibrary = ctx.mode === "library";
32
35
  const installClick = isLibrary || action !== void 0;
36
+ const focusable = installClick && !isHostButton(render);
37
+ const noInvoker = focusable && disabled;
33
38
  const state = {
34
39
  pending,
35
40
  disabled
@@ -64,10 +69,11 @@ function PopoverClose({ action, disabled = false, className, style, children, re
64
69
  };
65
70
  const libraryProps = {
66
71
  ...rendersButton(render) && { type: "button" },
67
- disabled,
68
- commandfor: ids.popup,
69
- command: "hide-popover",
72
+ disabled: focusable ? void 0 : disabled,
73
+ commandfor: noInvoker ? void 0 : ids.popup,
74
+ command: noInvoker ? void 0 : "hide-popover",
70
75
  ...installClick && { onClick },
76
+ "aria-disabled": pending || focusable && disabled ? true : void 0,
71
77
  "data-pending": dataAttr(pending),
72
78
  "data-disabled": dataAttr(disabled)
73
79
  };
@@ -1 +1 @@
1
- {"version":3,"file":"popover-close.mjs","names":[],"sources":["../../src/popover/popover-close.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { Action, ActionDetails, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport interface PopoverCloseState {\n /** The `action` is in flight. */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface PopoverCloseProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Runs inside this part's own transition (`data-pending` on the button), then closes the\n * popover: in library mode through the Root (`openChangeAction(false)` awaited, view\n * transition if set), in JS-free mode with `hidePopover()`. A rejection reaches the nearest\n * Error Boundary above the Close part and leaves the popover open. If the popover was\n * dismissed and opened again while the action ran, the close is dropped. Without `action` in JS-free\n * mode the button is a native `command=\"hide-popover\"` invoker.\n */\n action?: Action<[details: ActionDetails]>;\n /** Native `disabled`; owned, so a `render` element cannot re-enable the button. */\n disabled?: boolean;\n className?: StateValue<string | undefined, PopoverCloseState>;\n style?: StateValue<CSSProperties | undefined, PopoverCloseState>;\n children?: StateValue<ReactNode, PopoverCloseState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, PopoverCloseState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nfunction isPopoverOpen(element: Element): boolean {\n try {\n return element.matches(\":popover-open\");\n } catch {\n return false;\n }\n}\n\n/**\n * A close button: `<button type=\"button\" commandfor command=\"hide-popover\">`. In JS-free mode\n * without `action` the browser hides the popover. In library mode the click is always cancelled\n * and the close goes through the Root (`openChangeAction(false)` awaited, `hidePopover()` in the\n * commit). With `action` the action runs first in this part's own transition (`data-pending` on\n * the button); a rejection leaves the popover open.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,\n * `command`, `onClick` (library mode, or with `action`), `data-pending`, `data-disabled`.\n */\nexport function PopoverClose({\n action,\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverCloseProps) {\n const ctx = usePopoverContext(\"Popover.Close\");\n const { ids, popupRef, recordCloseIntent, openGeneration } = ctx;\n const { pending, run } = useActionTrigger(openGeneration);\n const isLibrary = ctx.mode === \"library\";\n const hasAction = action !== undefined;\n const installClick = isLibrary || hasAction;\n\n const state: PopoverCloseState = { pending, disabled };\n\n const devRef = useCallback(\n (element: HTMLElement) => {\n if (isDev && !installClick && element.tagName !== \"BUTTON\") {\n console.error(\n `Popover.Close: rendered a <${element.tagName.toLowerCase()}> in JS-free mode without ` +\n '`action`. Only a <button> runs `command=\"hide-popover\"`; this element will not ' +\n \"close the popover.\",\n );\n }\n // A cleanup, so the merged ref never calls back with `null`.\n return () => {};\n },\n [installClick],\n );\n\n const close = (event: Event): void => {\n if (isLibrary) {\n // A library-owned close (design 2.3): awaited, then hidden in the commit.\n ctx.requestClose(event, \"activate\");\n return;\n }\n // JS-free mode with `action`: a browser-owned close; there is no Root state to notify.\n const popup = popupRef.current;\n if (popup === null || !popup.isConnected || !isPopoverOpen(popup)) return;\n recordCloseIntent({ reason: \"activate\", event });\n popup.hidePopover();\n };\n\n const onClick = (event: MouseEvent<HTMLElement>) => {\n // Cancelling the click cancels the command.\n event.preventDefault();\n if (disabled) return;\n const native = event.nativeEvent;\n if (action === undefined) {\n close(native);\n return;\n }\n const details = createActionDetails(native, {});\n // Repeated clicks re-run the action; the first close wins (design 3.4). A close whose open\n // was superseded by a newer one (dismissed and re-opened meanwhile) is dropped by the hook.\n run(\n () => action(details),\n () => close(native),\n );\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Close.\n disabled,\n commandfor: ids.popup,\n command: \"hide-popover\",\n ...(installClick && { onClick }),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, PopoverCloseState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: devRef,\n });\n}\n\nPopoverClose.displayName = \"PopoverClose\";\n"],"mappings":";;;;;;;;AAsCA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,SAAS,cAAc,SAA2B;CAChD,IAAI;EACF,OAAO,QAAQ,QAAQ,eAAe;CACxC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;;;AAYA,SAAgB,aAAa,EAC3B,QACA,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,EAAE,KAAK,UAAU,mBAAmB,mBAAmB;CAC7D,MAAM,EAAE,SAAS,QAAQ,iBAAiB,cAAc;CACxD,MAAM,YAAY,IAAI,SAAS;CAE/B,MAAM,eAAe,aADH,WAAW,KAAA;CAG7B,MAAM,QAA2B;EAAE;EAAS;CAAS;CAErD,MAAM,SAAS,aACZ,YAAyB;EACxB,IAAI,SAAS,CAAC,gBAAgB,QAAQ,YAAY,UAChD,QAAQ,MACN,8BAA8B,QAAQ,QAAQ,YAAY,EAAE,gIAG9D;EAGF,aAAa,CAAC;CAChB,GACA,CAAC,YAAY,CACf;CAEA,MAAM,SAAS,UAAuB;EACpC,IAAI,WAAW;GAEb,IAAI,aAAa,OAAO,UAAU;GAClC;EACF;EAEA,MAAM,QAAQ,SAAS;EACvB,IAAI,UAAU,QAAQ,CAAC,MAAM,eAAe,CAAC,cAAc,KAAK,GAAG;EACnE,kBAAkB;GAAE,QAAQ;GAAY;EAAM,CAAC;EAC/C,MAAM,YAAY;CACpB;CAEA,MAAM,WAAW,UAAmC;EAElD,MAAM,eAAe;EACrB,IAAI,UAAU;EACd,MAAM,SAAS,MAAM;EACrB,IAAI,WAAW,KAAA,GAAW;GACxB,MAAM,MAAM;GACZ;EACF;EACA,MAAM,UAAU,oBAAoB,QAAQ,CAAC,CAAC;EAG9C,UACQ,OAAO,OAAO,SACd,MAAM,MAAM,CACpB;CACF;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EAEvD;EACA,YAAY,IAAI;EAChB,SAAS;EACT,GAAI,gBAAgB,EAAE,QAAQ;EAC9B,gBAAgB,SAAS,OAAO;EAChC,iBAAiB,SAAS,QAAQ;CACpC;CAEA,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;AACH;AAEA,aAAa,cAAc"}
1
+ {"version":3,"file":"popover-close.mjs","names":[],"sources":["../../src/popover/popover-close.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { Action, ActionDetails, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { isHostButton, rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport interface PopoverCloseState {\n /** The `action` is in flight. */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface PopoverCloseProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Runs inside this part's own transition (`data-pending` on the button), then closes the\n * popover: in library mode through the Root (`openChangeAction(false)` awaited, view\n * transition if set), in JS-free mode with `hidePopover()`. A rejection reaches the nearest\n * Error Boundary above the Close part and leaves the popover open. If the popover was\n * dismissed and opened again while the action ran, the close is dropped. Without `action` in JS-free\n * mode the button is a native `command=\"hide-popover\"` invoker.\n */\n action?: Action<[details: ActionDetails]>;\n /**\n * Never closes. Native `disabled` on a `<button>`; owned, so a `render` element cannot\n * re-enable it. With a link or component `render` whose click this part handles (library mode,\n * or with `action`), `aria-disabled=\"true\"` instead: the element stays focusable.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, PopoverCloseState>;\n style?: StateValue<CSSProperties | undefined, PopoverCloseState>;\n children?: StateValue<ReactNode, PopoverCloseState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, PopoverCloseState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nfunction isPopoverOpen(element: Element): boolean {\n try {\n return element.matches(\":popover-open\");\n } catch {\n return false;\n }\n}\n\n/**\n * A close button: `<button type=\"button\" commandfor command=\"hide-popover\">`. In JS-free mode\n * without `action` the browser hides the popover. In library mode the click is always cancelled\n * and the close goes through the Root (`openChangeAction(false)` awaited, `hidePopover()` in the\n * commit). With `action` the action runs first in this part's own transition (`data-pending` on\n * the button, with `aria-disabled`; a second click meanwhile is ignored); a rejection leaves the\n * popover open.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,\n * `command`, `onClick` (library mode, or with `action`), `aria-disabled`, `data-pending`,\n * `data-disabled`.\n */\nexport function PopoverClose({\n action,\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverCloseProps) {\n const ctx = usePopoverContext(\"Popover.Close\");\n const { ids, popupRef, recordCloseIntent, openGeneration } = ctx;\n const { pending, run } = useActionTrigger({ openGeneration });\n const isLibrary = ctx.mode === \"library\";\n const hasAction = action !== undefined;\n const installClick = isLibrary || hasAction;\n // A link or component render whose click this part handles: `aria-disabled`, enforced by the\n // handler (#83). JS-free mode without `action` is the browser's `hide-popover` command,\n // which only native `disabled` stops.\n const focusable = installClick && !isHostButton(render);\n // Disabled in the `aria-disabled` branch: no `commandfor` / `command` either. Without native\n // `disabled` the element would still be a live invoker before hydration (a component render\n // spreading onto a real <button>), and the command would run (wave 9 review M1).\n const noInvoker = focusable && disabled;\n\n const state: PopoverCloseState = { pending, disabled };\n\n const devRef = useCallback(\n (element: HTMLElement) => {\n if (isDev && !installClick && element.tagName !== \"BUTTON\") {\n console.error(\n `Popover.Close: rendered a <${element.tagName.toLowerCase()}> in JS-free mode without ` +\n '`action`. Only a <button> runs `command=\"hide-popover\"`; this element will not ' +\n \"close the popover.\",\n );\n }\n // A cleanup, so the merged ref never calls back with `null`.\n return () => {};\n },\n [installClick],\n );\n\n const close = (event: Event): void => {\n if (isLibrary) {\n // A library-owned close (design 2.3): awaited, then hidden in the commit.\n ctx.requestClose(event, \"activate\");\n return;\n }\n // JS-free mode with `action`: a browser-owned close; there is no Root state to notify.\n const popup = popupRef.current;\n if (popup === null || !popup.isConnected || !isPopoverOpen(popup)) return;\n recordCloseIntent({ reason: \"activate\", event });\n popup.hidePopover();\n };\n\n const onClick = (event: MouseEvent<HTMLElement>) => {\n // Cancelling the click cancels the command.\n event.preventDefault();\n if (disabled) return;\n const native = event.nativeEvent;\n if (action === undefined) {\n close(native);\n return;\n }\n const details = createActionDetails(native, {});\n // A second activation while this Close's own run is in flight starts nothing (the hook's\n // guard; the click is already cancelled above, #81). A close whose open was superseded by a\n // newer one (dismissed and re-opened meanwhile) is dropped by the hook.\n run(\n () => action(details),\n () => close(native),\n );\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Close. Absent in the focusable branch.\n disabled: focusable ? undefined : disabled,\n commandfor: noInvoker ? undefined : ids.popup,\n command: noInvoker ? undefined : \"hide-popover\",\n ...(installClick && { onClick }),\n // Exactly while `data-pending` (#81): a Close that will not act is unavailable to AT. Owned,\n // so an idle Close removes a render element's own `aria-disabled`.\n \"aria-disabled\": pending || (focusable && disabled) ? true : undefined,\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, PopoverCloseState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: devRef,\n });\n}\n\nPopoverClose.displayName = \"PopoverClose\";\n"],"mappings":";;;;;;;;;AA0CA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,SAAS,cAAc,SAA2B;CAChD,IAAI;EACF,OAAO,QAAQ,QAAQ,eAAe;CACxC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;;;;;AAcA,SAAgB,aAAa,EAC3B,QACA,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,EAAE,KAAK,UAAU,mBAAmB,mBAAmB;CAC7D,MAAM,EAAE,SAAS,QAAQ,iBAAiB,EAAE,eAAe,CAAC;CAC5D,MAAM,YAAY,IAAI,SAAS;CAE/B,MAAM,eAAe,aADH,WAAW,KAAA;CAK7B,MAAM,YAAY,gBAAgB,CAAC,aAAa,MAAM;CAItD,MAAM,YAAY,aAAa;CAE/B,MAAM,QAA2B;EAAE;EAAS;CAAS;CAErD,MAAM,SAAS,aACZ,YAAyB;EACxB,IAAI,SAAS,CAAC,gBAAgB,QAAQ,YAAY,UAChD,QAAQ,MACN,8BAA8B,QAAQ,QAAQ,YAAY,EAAE,gIAG9D;EAGF,aAAa,CAAC;CAChB,GACA,CAAC,YAAY,CACf;CAEA,MAAM,SAAS,UAAuB;EACpC,IAAI,WAAW;GAEb,IAAI,aAAa,OAAO,UAAU;GAClC;EACF;EAEA,MAAM,QAAQ,SAAS;EACvB,IAAI,UAAU,QAAQ,CAAC,MAAM,eAAe,CAAC,cAAc,KAAK,GAAG;EACnE,kBAAkB;GAAE,QAAQ;GAAY;EAAM,CAAC;EAC/C,MAAM,YAAY;CACpB;CAEA,MAAM,WAAW,UAAmC;EAElD,MAAM,eAAe;EACrB,IAAI,UAAU;EACd,MAAM,SAAS,MAAM;EACrB,IAAI,WAAW,KAAA,GAAW;GACxB,MAAM,MAAM;GACZ;EACF;EACA,MAAM,UAAU,oBAAoB,QAAQ,CAAC,CAAC;EAI9C,UACQ,OAAO,OAAO,SACd,MAAM,MAAM,CACpB;CACF;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EAEvD,UAAU,YAAY,KAAA,IAAY;EAClC,YAAY,YAAY,KAAA,IAAY,IAAI;EACxC,SAAS,YAAY,KAAA,IAAY;EACjC,GAAI,gBAAgB,EAAE,QAAQ;EAG9B,iBAAiB,WAAY,aAAa,WAAY,OAAO,KAAA;EAC7D,gBAAgB,SAAS,OAAO;EAChC,iBAAiB,SAAS,QAAQ;CACpC;CAEA,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;AACH;AAEA,aAAa,cAAc"}
@@ -1,22 +1,34 @@
1
1
  import { RenderProp, StateValue } from "../internal/types.mjs";
2
+ import { AnchorAlign, AnchorSide } from "../internal/anchor-position.mjs";
2
3
  import { CSSProperties, ComponentPropsWithRef, ReactNode, RefObject, ViewTransitionClass } from "react";
3
4
  //#region src/popover/popover-popup.d.ts
4
- export type PopoverSide = "top" | "bottom" | "left" | "right";
5
- export type PopoverAlign = "start" | "center" | "end";
5
+ /** `inline-start` / `inline-end` follow the popup's `direction` (wave 11; conventions 13.1). */
6
+ export type PopoverSide = AnchorSide;
7
+ export type PopoverAlign = AnchorAlign;
6
8
  export interface PopoverPopupState {
7
9
  /** Committed open state (library mode); `false` in JS-free mode. Read `:popover-open` for the DOM truth. */
8
10
  readonly open: boolean;
11
+ /**
12
+ * While shown: the physical side the browser placed the popup on (after any fallback flip;
13
+ * conventions 13.2). Otherwise the `side` prop. `null` with `side={null}`.
14
+ */
9
15
  readonly side: PopoverSide | null;
16
+ /** While shown: the resolved alignment; otherwise the `align` prop. */
10
17
  readonly align: PopoverAlign;
11
18
  }
12
19
  export interface PopoverPopupProps extends Omit<ComponentPropsWithRef<"dialog">, "id" | "popover" | "open" | "aria-modal" | "onToggle" | "onBeforeToggle" | "className" | "style" | "children"> {
13
20
  /**
14
21
  * Placement relative to the Trigger through inline `position-area`, with
15
- * `position-try-fallbacks` flipping it when it does not fit. Default `"bottom"`. `null` emits
16
- * no inline positioning (and no `data-side` / `data-align`), so a stylesheet owns placement.
22
+ * `position-try-fallbacks` flipping it when it does not fit. Default `"bottom"`.
23
+ * `"inline-start"` / `"inline-end"` follow the popup's direction. `null` emits no inline
24
+ * positioning (and no `data-side` / `data-align`), so a stylesheet owns placement.
17
25
  */
18
26
  side?: PopoverSide | null;
19
- /** Alignment along the side. Default `"center"`. Ignored when `side` is `null`. */
27
+ /**
28
+ * Alignment along the side. Default `"center"`. On a top / bottom side `start` / `end` are
29
+ * inline-relative (mirrored under `direction: rtl`); on the other sides the top / bottom
30
+ * edges. Ignored when `side` is `null`.
31
+ */
20
32
  align?: PopoverAlign;
21
33
  /**
22
34
  * Library mode: what happens to the children while the popover is closed.
@@ -62,7 +74,9 @@ export interface PopoverPopupProps extends Omit<ComponentPropsWithRef<"dialog">,
62
74
  * The popover itself: a `<dialog popover="auto" aria-modal="false" role="dialog">` with the id
63
75
  * the Trigger's `commandfor` names, placed against the Trigger with CSS Anchor Positioning and
64
76
  * wired to Title and Description through `aria-labelledby` / `aria-describedby`. Style it with
65
- * `:popover-open`; it emits `data-side` / `data-align` but no `data-open`.
77
+ * `:popover-open`; it emits `data-side` / `data-align` but no `data-open`. While shown, those are
78
+ * where the browser placed it (the applied `position-try-fallbacks` option; conventions 13.2),
79
+ * in both modes; otherwise the requested values.
66
80
  *
67
81
  * In library mode the children render from committed state, so content that suspends keeps the
68
82
  * popover closed (and the Trigger pending) until it is ready; `showPopover({ source: trigger })`
@@ -74,7 +88,7 @@ export interface PopoverPopupProps extends Omit<ComponentPropsWithRef<"dialog">,
74
88
  * `aria-describedby` (token-merged), and `data-side` / `data-align` unless `side` is `null`.
75
89
  * `role` is a default (`"dialog"`) the consumer may override.
76
90
  */
77
- export declare function PopoverPopup({ side, align, keepMounted, initialFocus, transition, className, style, children, render, ...rest }: PopoverPopupProps): ReactNode;
91
+ export declare function PopoverPopup({ side: sideProp, align: alignProp, keepMounted, initialFocus, transition, className, style, children, render, ...rest }: PopoverPopupProps): ReactNode;
78
92
  export declare namespace PopoverPopup {
79
93
  var displayName: string;
80
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"popover-popup.d.mts","names":[],"sources":["../../src/popover/popover-popup.tsx"],"mappings":";;;YAkBY;YACA;iBAEK;;WAEN;WACA,MAAM;WACN,OAAO;;iBAGD,0BAA0B,KACzC;;;;;;EAgBA,OAAO;;EAEP,QAAQ;;;;;;;;;;;EAWR;;;;;;;;;;EAUA,eAAe,UAAU;;;;;;;;;;;;;EAazB,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;;;;;wBAmBvC,eACd,MACA,OACA,aACA,cACA,YACA,WACA,OACA,UACA,WACG,QACF,oBAAiB;yBAXJ"}
1
+ {"version":3,"file":"popover-popup.d.mts","names":[],"sources":["../../src/popover/popover-popup.tsx"],"mappings":";;;;;YAuBY,cAAc;YACd,eAAe;iBAEV;;WAEN;;;;;WAKA,MAAM;;WAEN,OAAO;;iBAGD,0BAA0B,KACzC;;;;;;;EAiBA,OAAO;;;;;;EAMP,QAAQ;;;;;;;;;;;EAWR;;;;;;;;;;EAUA,eAAe,UAAU;;;;;;;;;;;;;EAazB,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;;;;;;;wBAqBvC,eACd,MAAM,UACN,OAAO,WACP,aACA,cACA,YACA,WACA,OACA,UACA,WACG,QACF,oBAAiB;yBAXJ"}
@@ -1,18 +1,24 @@
1
1
  "use client";
2
+ import { ToolbarContext } from "../internal/toolbar-context.mjs";
2
3
  import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
3
- import { resolveStateValue, useRender } from "../internal/use-render.mjs";
4
4
  import { useDevWarning } from "../internal/use-dev-warning.mjs";
5
+ import { mergeRefs } from "../internal/merge-props.mjs";
6
+ import { resolveStateValue } from "../internal/render-element.mjs";
7
+ import { useRender } from "../internal/use-render.mjs";
5
8
  import { POSITION_TRY_FALLBACKS, positionArea } from "../internal/anchor-position.mjs";
9
+ import { useResolvedPlacement } from "../internal/use-resolved-placement.mjs";
6
10
  import { PopoverPopupContext, usePopoverContext } from "./popover-context.mjs";
7
11
  import { usePopoverPopup } from "../internal/use-popover-popup.mjs";
8
- import { Activity } from "react";
12
+ import { Activity, useMemo } from "react";
9
13
  import { jsx } from "react/jsx-runtime";
10
14
  //#region src/popover/popover-popup.tsx
11
15
  /**
12
16
  * The popover itself: a `<dialog popover="auto" aria-modal="false" role="dialog">` with the id
13
17
  * the Trigger's `commandfor` names, placed against the Trigger with CSS Anchor Positioning and
14
18
  * wired to Title and Description through `aria-labelledby` / `aria-describedby`. Style it with
15
- * `:popover-open`; it emits `data-side` / `data-align` but no `data-open`.
19
+ * `:popover-open`; it emits `data-side` / `data-align` but no `data-open`. While shown, those are
20
+ * where the browser placed it (the applied `position-try-fallbacks` option; conventions 13.2),
21
+ * in both modes; otherwise the requested values.
16
22
  *
17
23
  * In library mode the children render from committed state, so content that suspends keeps the
18
24
  * popover closed (and the Trigger pending) until it is ready; `showPopover({ source: trigger })`
@@ -24,7 +30,7 @@ import { jsx } from "react/jsx-runtime";
24
30
  * `aria-describedby` (token-merged), and `data-side` / `data-align` unless `side` is `null`.
25
31
  * `role` is a default (`"dialog"`) the consumer may override.
26
32
  */
27
- function PopoverPopup({ side = "bottom", align = "center", keepMounted, initialFocus, transition, className, style, children, render, ...rest }) {
33
+ function PopoverPopup({ side: sideProp = "bottom", align: alignProp = "center", keepMounted, initialFocus, transition, className, style, children, render, ...rest }) {
28
34
  const ctx = usePopoverContext("Popover.Popup");
29
35
  const isLibrary = ctx.mode === "library";
30
36
  const { ids } = ctx;
@@ -36,6 +42,12 @@ function PopoverPopup({ side = "bottom", align = "center", keepMounted, initialF
36
42
  keepMounted,
37
43
  transition: isLibrary ? transition : void 0
38
44
  });
45
+ const placement = useResolvedPlacement({
46
+ side: sideProp,
47
+ align: alignProp
48
+ });
49
+ const { side, align } = placement;
50
+ const ref = useMemo(() => mergeRefs(setElement, placement.ref), [setElement, placement.ref]);
39
51
  const state = {
40
52
  open: ctx.committed,
41
53
  side,
@@ -51,7 +63,10 @@ function PopoverPopup({ side = "bottom", align = "center", keepMounted, initialF
51
63
  else node = visible ? wrapContent(resolveStateValue(children, s)) : null;
52
64
  return /* @__PURE__ */ jsx(PopoverPopupContext, {
53
65
  value: s,
54
- children: node
66
+ children: /* @__PURE__ */ jsx(ToolbarContext, {
67
+ value: null,
68
+ children: node
69
+ })
55
70
  });
56
71
  };
57
72
  const libraryProps = {
@@ -71,8 +86,8 @@ function PopoverPopup({ side = "bottom", align = "center", keepMounted, initialF
71
86
  render,
72
87
  state,
73
88
  className,
74
- style: side === null ? style : (s) => ({
75
- positionArea: positionArea(side, align),
89
+ style: sideProp === null ? style : (s) => ({
90
+ positionArea: positionArea(sideProp, alignProp),
76
91
  positionTryFallbacks: POSITION_TRY_FALLBACKS,
77
92
  ...resolveStateValue(style, s)
78
93
  }),
@@ -82,7 +97,7 @@ function PopoverPopup({ side = "bottom", align = "center", keepMounted, initialF
82
97
  ...rest
83
98
  },
84
99
  libraryProps,
85
- ref: setElement
100
+ ref
86
101
  });
87
102
  return useTransitionBoundary("Popover.Popup", isLibrary ? transition : void 0, element);
88
103
  }
@@ -1 +1 @@
1
- {"version":3,"file":"popover-popup.mjs","names":[],"sources":["../../src/popover/popover-popup.tsx"],"sourcesContent":["\"use client\";\nimport { Activity } from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n ReactNode,\n RefObject,\n ViewTransitionClass,\n} from \"react\";\nimport { POSITION_TRY_FALLBACKS, positionArea } from \"../internal/anchor-position.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { usePopoverPopup } from \"../internal/use-popover-popup.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { PopoverPopupContext, usePopoverContext } from \"./popover-context.js\";\n\nexport type PopoverSide = \"top\" | \"bottom\" | \"left\" | \"right\";\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\nexport interface PopoverPopupState {\n /** Committed open state (library mode); `false` in JS-free mode. Read `:popover-open` for the DOM truth. */\n readonly open: boolean;\n readonly side: PopoverSide | null;\n readonly align: PopoverAlign;\n}\n\nexport interface PopoverPopupProps extends Omit<\n ComponentPropsWithRef<\"dialog\">,\n | \"id\"\n | \"popover\"\n | \"open\"\n | \"aria-modal\"\n | \"onToggle\"\n | \"onBeforeToggle\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Placement relative to the Trigger through inline `position-area`, with\n * `position-try-fallbacks` flipping it when it does not fit. Default `\"bottom\"`. `null` emits\n * no inline positioning (and no `data-side` / `data-align`), so a stylesheet owns placement.\n */\n side?: PopoverSide | null;\n /** Alignment along the side. Default `\"center\"`. Ignored when `side` is `null`. */\n align?: PopoverAlign;\n /**\n * Library mode: what happens to the children while the popover is closed.\n * - `false` (default): not rendered. Mounting them is part of the opening transition, so\n * content that suspends holds the open until it is ready. Unmount waits for the popover's\n * exit animation (CSS), or happens in the close commit when `transition` is set.\n * - `true`: rendered inside `<Activity mode=\"hidden\">`: DOM and state preserved, effects\n * stopped, pre-rendered at low priority. Not in the server HTML.\n *\n * Ignored in JS-free mode (always mounted).\n */\n keepMounted?: boolean;\n /**\n * Element to focus when the popover opens: a ref, or a selector resolved inside the popup.\n * The library writes `autofocus` on it right before `showPopover()` and the platform focuses\n * it. Default: the platform's choice for a `<dialog>` (first focusable descendant; the popup\n * itself if none); for `render={<div />}` focus stays on the Trigger.\n *\n * In JS-free mode the browser opens the popover itself, so the attribute is written after\n * hydration and kept while mounted; before hydration only `autoFocus` in the markup works.\n */\n initialFocus?: RefObject<HTMLElement | null> | string;\n /**\n * Library mode only. Forwarded to the `<ViewTransition default>` around the popover element\n * itself. Animates the opening commit, content changes while open, and every library-driven\n * close (Trigger, Close, controlled `open={false}`), in all engines; dismissals (Escape,\n * click outside) are the browser's and animate with CSS only. Ignored (dev warning) in JS-free\n * mode.\n *\n * Static: without `transition` the part renders no `<ViewTransition>`; changing it between\n * `undefined` and a value remounts the element. A Root inserted by a transition with\n * `transition` set on its Popup pays the page cross-fade (issue #35); a plain open does not,\n * because the children mount under the already-mounted popover element.\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, PopoverPopupState>;\n style?: StateValue<CSSProperties | undefined, PopoverPopupState>;\n children?: StateValue<ReactNode, PopoverPopupState>;\n /** A `<dialog>` (default) or a `<div>` (focus stays on the Trigger). */\n render?: RenderProp<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>;\n}\n\n/**\n * The popover itself: a `<dialog popover=\"auto\" aria-modal=\"false\" role=\"dialog\">` with the id\n * the Trigger's `commandfor` names, placed against the Trigger with CSS Anchor Positioning and\n * wired to Title and Description through `aria-labelledby` / `aria-describedby`. Style it with\n * `:popover-open`; it emits `data-side` / `data-align` but no `data-open`.\n *\n * In library mode the children render from committed state, so content that suspends keeps the\n * popover closed (and the Trigger pending) until it is ready; `showPopover({ source: trigger })`\n * runs in the layout effect of the commit that mounted them, and a library-driven close runs\n * `hidePopover()` in the commit that ends it. Dismissals are the browser's: the native `toggle`\n * event becomes `openChangeAction(false, { reason: \"dismiss\" })`.\n *\n * Owned keys (conventions 1.2): `id`, `popover`, `open`, `aria-modal`, `aria-labelledby` and\n * `aria-describedby` (token-merged), and `data-side` / `data-align` unless `side` is `null`.\n * `role` is a default (`\"dialog\"`) the consumer may override.\n */\nexport function PopoverPopup({\n side = \"bottom\",\n align = \"center\",\n keepMounted,\n initialFocus,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverPopupProps) {\n const ctx = usePopoverContext(\"Popover.Popup\");\n const isLibrary = ctx.mode === \"library\";\n const { ids } = ctx;\n\n useDevWarning(\n !isLibrary && transition !== undefined,\n \"Popover.Popup: `transition` has no effect in JS-free mode; the browser opens and closes the \" +\n \"popover outside any React transition. Animate it with CSS (`@starting-style`).\",\n );\n useDevWarning(\n !isLibrary && keepMounted === false,\n \"Popover.Popup: `keepMounted={false}` cannot be honoured in JS-free mode; the content is \" +\n \"always mounted so that the server HTML is complete.\",\n );\n\n const { setElement, visible, wrapContent } = usePopoverPopup(ctx, {\n part: \"Popover.Popup\",\n initialFocus,\n keepMounted,\n transition: isLibrary ? transition : undefined,\n });\n\n const state: PopoverPopupState = { open: ctx.committed, side, align };\n\n const content = (s: PopoverPopupState): ReactNode => {\n let node: ReactNode;\n if (!isLibrary) {\n node = resolveStateValue(children, s);\n } else if (keepMounted === true) {\n // The mode changes with committed state, inside the Root's transition (conventions 5.5);\n // it stays visible while an exit animation runs.\n node = (\n <Activity mode={visible ? \"visible\" : \"hidden\"}>\n {wrapContent(resolveStateValue(children, s))}\n </Activity>\n );\n } else {\n node = visible ? wrapContent(resolveStateValue(children, s)) : null;\n }\n return <PopoverPopupContext value={s}>{node}</PopoverPopupContext>;\n };\n\n const libraryProps: ComponentPropsWithRef<\"dialog\"> & DataAttributes = {\n id: ids.popup,\n popover: \"auto\",\n // Never rendered: `showPopover()` does not set it, and an `open` attribute would show the\n // <dialog> outside the top layer. Owned so a `render` element cannot add it.\n open: undefined,\n // Chromium exposes a <dialog popover> as modal without it (research; issue #44).\n \"aria-modal\": \"false\",\n \"aria-labelledby\": ids.title,\n \"aria-describedby\": ids.description,\n // Not owned with `side={null}`: the stylesheet (or a render element) may set them.\n ...(side !== null && { \"data-side\": side, \"data-align\": align }),\n };\n\n const element = useRender<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>({\n defaultElement: \"dialog\",\n render,\n state,\n className,\n // The inline placement sits under the consumer's style: the consumer wins (design 8).\n style:\n side === null\n ? style\n : (s) => ({\n positionArea: positionArea(side, align),\n positionTryFallbacks: POSITION_TRY_FALLBACKS,\n ...resolveStateValue(style, s),\n }),\n children: content,\n // `role` is a default the consumer's `rest` overrides (design 3.3): WebKit implements no\n // minimum role for `[popover]`, and a `<div>` popup needs it.\n props: { role: \"dialog\", ...rest },\n libraryProps,\n ref: setElement,\n });\n\n return useTransitionBoundary(\"Popover.Popup\", isLibrary ? transition : undefined, element);\n}\n\nPopoverPopup.displayName = \"PopoverPopup\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,SAAgB,aAAa,EAC3B,OAAO,UACP,QAAQ,UACR,aACA,cACA,YACA,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,QAAQ;CAEhB,cACE,CAAC,aAAa,eAAe,KAAA,GAC7B,4KAEF;CACA,cACE,CAAC,aAAa,gBAAgB,OAC9B,6IAEF;CAEA,MAAM,EAAE,YAAY,SAAS,gBAAgB,gBAAgB,KAAK;EAChE,MAAM;EACN;EACA;EACA,YAAY,YAAY,aAAa,KAAA;CACvC,CAAC;CAED,MAAM,QAA2B;EAAE,MAAM,IAAI;EAAW;EAAM;CAAM;CAEpE,MAAM,WAAW,MAAoC;EACnD,IAAI;EACJ,IAAI,CAAC,WACH,OAAO,kBAAkB,UAAU,CAAC;OAC/B,IAAI,gBAAgB,MAGzB,OACE,oBAAC,UAAD;GAAU,MAAM,UAAU,YAAY;GACnC,UAAA,YAAY,kBAAkB,UAAU,CAAC,CAAC;EACnC,CAAA;OAGZ,OAAO,UAAU,YAAY,kBAAkB,UAAU,CAAC,CAAC,IAAI;EAEjE,OAAO,oBAAC,qBAAD;GAAqB,OAAO;GAAI,UAAA;EAA0B,CAAA;CACnE;CAEA,MAAM,eAAiE;EACrE,IAAI,IAAI;EACR,SAAS;EAGT,MAAM,KAAA;EAEN,cAAc;EACd,mBAAmB,IAAI;EACvB,oBAAoB,IAAI;EAExB,GAAI,SAAS,QAAQ;GAAE,aAAa;GAAM,cAAc;EAAM;CAChE;CAEA,MAAM,UAAU,UAA8D;EAC5E,gBAAgB;EAChB;EACA;EACA;EAEA,OACE,SAAS,OACL,SACC,OAAO;GACN,cAAc,aAAa,MAAM,KAAK;GACtC,sBAAsB;GACtB,GAAG,kBAAkB,OAAO,CAAC;EAC/B;EACN,UAAU;EAGV,OAAO;GAAE,MAAM;GAAU,GAAG;EAAK;EACjC;EACA,KAAK;CACP,CAAC;CAED,OAAO,sBAAsB,iBAAiB,YAAY,aAAa,KAAA,GAAW,OAAO;AAC3F;AAEA,aAAa,cAAc"}
1
+ {"version":3,"file":"popover-popup.mjs","names":[],"sources":["../../src/popover/popover-popup.tsx"],"sourcesContent":["\"use client\";\nimport { Activity, useMemo } from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n ReactNode,\n RefObject,\n ViewTransitionClass,\n} from \"react\";\nimport { POSITION_TRY_FALLBACKS, positionArea } from \"../internal/anchor-position.js\";\nimport type { AnchorAlign, AnchorSide } from \"../internal/anchor-position.js\";\nimport { mergeRefs } from \"../internal/merge-props.js\";\nimport { ToolbarContext } from \"../internal/toolbar-context.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { usePopoverPopup } from \"../internal/use-popover-popup.js\";\nimport { useResolvedPlacement } from \"../internal/use-resolved-placement.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { PopoverPopupContext, usePopoverContext } from \"./popover-context.js\";\n\n/** `inline-start` / `inline-end` follow the popup's `direction` (wave 11; conventions 13.1). */\nexport type PopoverSide = AnchorSide;\nexport type PopoverAlign = AnchorAlign;\n\nexport interface PopoverPopupState {\n /** Committed open state (library mode); `false` in JS-free mode. Read `:popover-open` for the DOM truth. */\n readonly open: boolean;\n /**\n * While shown: the physical side the browser placed the popup on (after any fallback flip;\n * conventions 13.2). Otherwise the `side` prop. `null` with `side={null}`.\n */\n readonly side: PopoverSide | null;\n /** While shown: the resolved alignment; otherwise the `align` prop. */\n readonly align: PopoverAlign;\n}\n\nexport interface PopoverPopupProps extends Omit<\n ComponentPropsWithRef<\"dialog\">,\n | \"id\"\n | \"popover\"\n | \"open\"\n | \"aria-modal\"\n | \"onToggle\"\n | \"onBeforeToggle\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Placement relative to the Trigger through inline `position-area`, with\n * `position-try-fallbacks` flipping it when it does not fit. Default `\"bottom\"`.\n * `\"inline-start\"` / `\"inline-end\"` follow the popup's direction. `null` emits no inline\n * positioning (and no `data-side` / `data-align`), so a stylesheet owns placement.\n */\n side?: PopoverSide | null;\n /**\n * Alignment along the side. Default `\"center\"`. On a top / bottom side `start` / `end` are\n * inline-relative (mirrored under `direction: rtl`); on the other sides the top / bottom\n * edges. Ignored when `side` is `null`.\n */\n align?: PopoverAlign;\n /**\n * Library mode: what happens to the children while the popover is closed.\n * - `false` (default): not rendered. Mounting them is part of the opening transition, so\n * content that suspends holds the open until it is ready. Unmount waits for the popover's\n * exit animation (CSS), or happens in the close commit when `transition` is set.\n * - `true`: rendered inside `<Activity mode=\"hidden\">`: DOM and state preserved, effects\n * stopped, pre-rendered at low priority. Not in the server HTML.\n *\n * Ignored in JS-free mode (always mounted).\n */\n keepMounted?: boolean;\n /**\n * Element to focus when the popover opens: a ref, or a selector resolved inside the popup.\n * The library writes `autofocus` on it right before `showPopover()` and the platform focuses\n * it. Default: the platform's choice for a `<dialog>` (first focusable descendant; the popup\n * itself if none); for `render={<div />}` focus stays on the Trigger.\n *\n * In JS-free mode the browser opens the popover itself, so the attribute is written after\n * hydration and kept while mounted; before hydration only `autoFocus` in the markup works.\n */\n initialFocus?: RefObject<HTMLElement | null> | string;\n /**\n * Library mode only. Forwarded to the `<ViewTransition default>` around the popover element\n * itself. Animates the opening commit, content changes while open, and every library-driven\n * close (Trigger, Close, controlled `open={false}`), in all engines; dismissals (Escape,\n * click outside) are the browser's and animate with CSS only. Ignored (dev warning) in JS-free\n * mode.\n *\n * Static: without `transition` the part renders no `<ViewTransition>`; changing it between\n * `undefined` and a value remounts the element. A Root inserted by a transition with\n * `transition` set on its Popup pays the page cross-fade (issue #35); a plain open does not,\n * because the children mount under the already-mounted popover element.\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, PopoverPopupState>;\n style?: StateValue<CSSProperties | undefined, PopoverPopupState>;\n children?: StateValue<ReactNode, PopoverPopupState>;\n /** A `<dialog>` (default) or a `<div>` (focus stays on the Trigger). */\n render?: RenderProp<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>;\n}\n\n/**\n * The popover itself: a `<dialog popover=\"auto\" aria-modal=\"false\" role=\"dialog\">` with the id\n * the Trigger's `commandfor` names, placed against the Trigger with CSS Anchor Positioning and\n * wired to Title and Description through `aria-labelledby` / `aria-describedby`. Style it with\n * `:popover-open`; it emits `data-side` / `data-align` but no `data-open`. While shown, those are\n * where the browser placed it (the applied `position-try-fallbacks` option; conventions 13.2),\n * in both modes; otherwise the requested values.\n *\n * In library mode the children render from committed state, so content that suspends keeps the\n * popover closed (and the Trigger pending) until it is ready; `showPopover({ source: trigger })`\n * runs in the layout effect of the commit that mounted them, and a library-driven close runs\n * `hidePopover()` in the commit that ends it. Dismissals are the browser's: the native `toggle`\n * event becomes `openChangeAction(false, { reason: \"dismiss\" })`.\n *\n * Owned keys (conventions 1.2): `id`, `popover`, `open`, `aria-modal`, `aria-labelledby` and\n * `aria-describedby` (token-merged), and `data-side` / `data-align` unless `side` is `null`.\n * `role` is a default (`\"dialog\"`) the consumer may override.\n */\nexport function PopoverPopup({\n side: sideProp = \"bottom\",\n align: alignProp = \"center\",\n keepMounted,\n initialFocus,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverPopupProps) {\n const ctx = usePopoverContext(\"Popover.Popup\");\n const isLibrary = ctx.mode === \"library\";\n const { ids } = ctx;\n\n useDevWarning(\n !isLibrary && transition !== undefined,\n \"Popover.Popup: `transition` has no effect in JS-free mode; the browser opens and closes the \" +\n \"popover outside any React transition. Animate it with CSS (`@starting-style`).\",\n );\n useDevWarning(\n !isLibrary && keepMounted === false,\n \"Popover.Popup: `keepMounted={false}` cannot be honoured in JS-free mode; the content is \" +\n \"always mounted so that the server HTML is complete.\",\n );\n\n const { setElement, visible, wrapContent } = usePopoverPopup(ctx, {\n part: \"Popover.Popup\",\n initialFocus,\n keepMounted,\n transition: isLibrary ? transition : undefined,\n });\n\n // Resolved while shown, in library and JS-free mode alike (it hangs off the element's ref and\n // the platform's `toggle`, not off library state).\n const placement = useResolvedPlacement({ side: sideProp, align: alignProp });\n const { side, align } = placement;\n const ref = useMemo(() => mergeRefs(setElement, placement.ref), [setElement, placement.ref]);\n\n const state: PopoverPopupState = { open: ctx.committed, side, align };\n\n const content = (s: PopoverPopupState): ReactNode => {\n let node: ReactNode;\n if (!isLibrary) {\n node = resolveStateValue(children, s);\n } else if (keepMounted === true) {\n // The mode changes with committed state, inside the Root's transition (conventions 5.5);\n // it stays visible while an exit animation runs.\n node = (\n <Activity mode={visible ? \"visible\" : \"hidden\"}>\n {wrapContent(resolveStateValue(children, s))}\n </Activity>\n );\n } else {\n node = visible ? wrapContent(resolveStateValue(children, s)) : null;\n }\n // Popup content is not part of an enclosing Toolbar's sequence (the engine excludes\n // `[popover]`), so parts inside it must not see the Toolbar either.\n return (\n <PopoverPopupContext value={s}>\n <ToolbarContext value={null}>{node}</ToolbarContext>\n </PopoverPopupContext>\n );\n };\n\n const libraryProps: ComponentPropsWithRef<\"dialog\"> & DataAttributes = {\n id: ids.popup,\n popover: \"auto\",\n // Never rendered: `showPopover()` does not set it, and an `open` attribute would show the\n // <dialog> outside the top layer. Owned so a `render` element cannot add it.\n open: undefined,\n // Chromium exposes a <dialog popover> as modal without it (research; issue #44).\n \"aria-modal\": \"false\",\n \"aria-labelledby\": ids.title,\n \"aria-describedby\": ids.description,\n // Not owned with `side={null}`: the stylesheet (or a render element) may set them.\n ...(side !== null && { \"data-side\": side, \"data-align\": align }),\n };\n\n const element = useRender<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>({\n defaultElement: \"dialog\",\n render,\n state,\n className,\n // The inline placement is the requested one (the browser keeps choosing from it) and sits\n // under the consumer's style: the consumer wins (design 8).\n style:\n sideProp === null\n ? style\n : (s) => ({\n positionArea: positionArea(sideProp, alignProp),\n positionTryFallbacks: POSITION_TRY_FALLBACKS,\n ...resolveStateValue(style, s),\n }),\n children: content,\n // `role` is a default the consumer's `rest` overrides (design 3.3): WebKit implements no\n // minimum role for `[popover]`, and a `<div>` popup needs it.\n props: { role: \"dialog\", ...rest },\n libraryProps,\n ref,\n });\n\n return useTransitionBoundary(\"Popover.Popup\", isLibrary ? transition : undefined, element);\n}\n\nPopoverPopup.displayName = \"PopoverPopup\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0HA,SAAgB,aAAa,EAC3B,MAAM,WAAW,UACjB,OAAO,YAAY,UACnB,aACA,cACA,YACA,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,QAAQ;CAEhB,cACE,CAAC,aAAa,eAAe,KAAA,GAC7B,4KAEF;CACA,cACE,CAAC,aAAa,gBAAgB,OAC9B,6IAEF;CAEA,MAAM,EAAE,YAAY,SAAS,gBAAgB,gBAAgB,KAAK;EAChE,MAAM;EACN;EACA;EACA,YAAY,YAAY,aAAa,KAAA;CACvC,CAAC;CAID,MAAM,YAAY,qBAAqB;EAAE,MAAM;EAAU,OAAO;CAAU,CAAC;CAC3E,MAAM,EAAE,MAAM,UAAU;CACxB,MAAM,MAAM,cAAc,UAAU,YAAY,UAAU,GAAG,GAAG,CAAC,YAAY,UAAU,GAAG,CAAC;CAE3F,MAAM,QAA2B;EAAE,MAAM,IAAI;EAAW;EAAM;CAAM;CAEpE,MAAM,WAAW,MAAoC;EACnD,IAAI;EACJ,IAAI,CAAC,WACH,OAAO,kBAAkB,UAAU,CAAC;OAC/B,IAAI,gBAAgB,MAGzB,OACE,oBAAC,UAAD;GAAU,MAAM,UAAU,YAAY;GACnC,UAAA,YAAY,kBAAkB,UAAU,CAAC,CAAC;EACnC,CAAA;OAGZ,OAAO,UAAU,YAAY,kBAAkB,UAAU,CAAC,CAAC,IAAI;EAIjE,OACE,oBAAC,qBAAD;GAAqB,OAAO;GAC1B,UAAA,oBAAC,gBAAD;IAAgB,OAAO;IAAO,UAAA;GAAqB,CAAA;EAChC,CAAA;CAEzB;CAEA,MAAM,eAAiE;EACrE,IAAI,IAAI;EACR,SAAS;EAGT,MAAM,KAAA;EAEN,cAAc;EACd,mBAAmB,IAAI;EACvB,oBAAoB,IAAI;EAExB,GAAI,SAAS,QAAQ;GAAE,aAAa;GAAM,cAAc;EAAM;CAChE;CAEA,MAAM,UAAU,UAA8D;EAC5E,gBAAgB;EAChB;EACA;EACA;EAGA,OACE,aAAa,OACT,SACC,OAAO;GACN,cAAc,aAAa,UAAU,SAAS;GAC9C,sBAAsB;GACtB,GAAG,kBAAkB,OAAO,CAAC;EAC/B;EACN,UAAU;EAGV,OAAO;GAAE,MAAM;GAAU,GAAG;EAAK;EACjC;EACA;CACF,CAAC;CAED,OAAO,sBAAsB,iBAAiB,YAAY,aAAa,KAAA,GAAW,OAAO;AAC3F;AAEA,aAAa,cAAc"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { resolveStateValue } from "../internal/use-render.mjs";
2
+ import { resolveStateValue } from "../internal/render-element.mjs";
3
3
  import { PopoverContext } from "./popover-context.mjs";
4
4
  import { usePopoverRoot } from "../internal/use-popover-root.mjs";
5
5
  import { jsx } from "react/jsx-runtime";
@@ -9,7 +9,11 @@ export interface PopoverTriggerState {
9
9
  readonly disabled: boolean;
10
10
  }
11
11
  export interface PopoverTriggerProps extends Omit<ComponentPropsWithRef<"button">, "onClick" | "aria-expanded" | "className" | "style" | "children"> {
12
- /** Native `disabled`: a disabled button is not a valid invoker and never dispatches. */
12
+ /**
13
+ * Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); in library mode
14
+ * with a link or component `render`, `aria-disabled="true"` instead: the element stays
15
+ * focusable.
16
+ */
13
17
  disabled?: boolean;
14
18
  className?: StateValue<string | undefined, PopoverTriggerState>;
15
19
  style?: StateValue<CSSProperties | undefined, PopoverTriggerState>;
@@ -25,9 +29,9 @@ export interface PopoverTriggerProps extends Omit<ComponentPropsWithRef<"button"
25
29
  * Root's transition: an open, or a library-owned close while open. The button shows optimistic
26
30
  * `data-open` / `aria-expanded` and `data-pending` until the change has landed.
27
31
  *
28
- * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,
29
- * `command`, `aria-expanded`, `onClick` (library mode), `data-open`, `data-pending`,
30
- * `data-disabled`. `aria-haspopup` and `aria-controls` pass through.
32
+ * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled`
33
+ * (library mode, link or component `render`), `commandfor`, `command`, `aria-expanded`,
34
+ * `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`. `aria-haspopup` and `aria-controls` pass through.
31
35
  */
32
36
  export declare function PopoverTrigger({ disabled, className, style, children, render, ...rest }: PopoverTriggerProps): ReactNode;
33
37
  export declare namespace PopoverTrigger {
@@ -1 +1 @@
1
- {"version":3,"file":"popover-trigger.d.mts","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"mappings":";;;iBAOiB;;WAEN;;WAEA;WACA;;iBAGM,4BAA4B,KAC3C;;EAIA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;wBAcvC,iBACd,UACA,WACA,OACA,UACA,WACG,QACF,sBAAmB;yBAPN"}
1
+ {"version":3,"file":"popover-trigger.d.mts","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"mappings":";;;iBAOiB;;WAEN;;WAEA;WACA;;iBAGM,4BAA4B,KAC3C;;;;;;EAQA;EACA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;wBAcvC,iBACd,UACA,WACA,OACA,UACA,WACG,QACF,sBAAmB;yBAPN"}
@@ -10,9 +10,9 @@ import { usePopoverTrigger } from "../internal/use-popover-trigger.mjs";
10
10
  * Root's transition: an open, or a library-owned close while open. The button shows optimistic
11
11
  * `data-open` / `aria-expanded` and `data-pending` until the change has landed.
12
12
  *
13
- * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,
14
- * `command`, `aria-expanded`, `onClick` (library mode), `data-open`, `data-pending`,
15
- * `data-disabled`. `aria-haspopup` and `aria-controls` pass through.
13
+ * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled`
14
+ * (library mode, link or component `render`), `commandfor`, `command`, `aria-expanded`,
15
+ * `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`. `aria-haspopup` and `aria-controls` pass through.
16
16
  */
17
17
  function PopoverTrigger({ disabled = false, className, style, children, render, ...rest }) {
18
18
  const ctx = usePopoverContext("Popover.Trigger");
@@ -1 +1 @@
1
- {"version":3,"file":"popover-trigger.mjs","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { usePopoverTrigger } from \"../internal/use-popover-trigger.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport interface PopoverTriggerState {\n /** Optimistic open state (library mode); `false` in JS-free mode. */\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\nexport interface PopoverTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"aria-expanded\" | \"className\" | \"style\" | \"children\"\n> {\n /** Native `disabled`: a disabled button is not a valid invoker and never dispatches. */\n disabled?: boolean;\n className?: StateValue<string | undefined, PopoverTriggerState>;\n style?: StateValue<CSSProperties | undefined, PopoverTriggerState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, PopoverTriggerState>;\n /** Should render a `<button>`; another element works only in library mode (click handler). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, PopoverTriggerState>;\n}\n\n/**\n * The toggle: `<button type=\"button\" commandfor command=\"toggle-popover\" aria-expanded>`. In\n * JS-free mode the browser runs the command and the Popup keeps `aria-expanded` current. In\n * library mode the click is cancelled (so the command does not run) and dispatched through the\n * Root's transition: an open, or a library-owned close while open. The button shows optimistic\n * `data-open` / `aria-expanded` and `data-pending` until the change has landed.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,\n * `command`, `aria-expanded`, `onClick` (library mode), `data-open`, `data-pending`,\n * `data-disabled`. `aria-haspopup` and `aria-controls` pass through.\n */\nexport function PopoverTrigger({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverTriggerProps) {\n const ctx = usePopoverContext(\"Popover.Trigger\");\n const { state, libraryProps, ref } = usePopoverTrigger(ctx, {\n part: \"Popover.Trigger\",\n disabled,\n render,\n });\n\n return useRender<ComponentPropsWithRef<\"button\">, PopoverTriggerState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref,\n });\n}\n\nPopoverTrigger.displayName = \"PopoverTrigger\";\n"],"mappings":";;;;;;;;;;;;;;;;AAwCA,SAAgB,eAAe,EAC7B,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACmB;CACtB,MAAM,MAAM,kBAAkB,iBAAiB;CAC/C,MAAM,EAAE,OAAO,cAAc,QAAQ,kBAAkB,KAAK;EAC1D,MAAM;EACN;EACA;CACF,CAAC;CAED,OAAO,UAAgE;EACrE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;CACF,CAAC;AACH;AAEA,eAAe,cAAc"}
1
+ {"version":3,"file":"popover-trigger.mjs","names":[],"sources":["../../src/popover/popover-trigger.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { usePopoverTrigger } from \"../internal/use-popover-trigger.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport interface PopoverTriggerState {\n /** Optimistic open state (library mode); `false` in JS-free mode. */\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\nexport interface PopoverTriggerProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"aria-expanded\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Never dispatches. Native `disabled` on a `<button>` (no longer an invoker); in library mode\n * with a link or component `render`, `aria-disabled=\"true\"` instead: the element stays\n * focusable.\n */\n disabled?: boolean;\n className?: StateValue<string | undefined, PopoverTriggerState>;\n style?: StateValue<CSSProperties | undefined, PopoverTriggerState>;\n /** Rendered from optimistic state; must not suspend. */\n children?: StateValue<ReactNode, PopoverTriggerState>;\n /** Should render a `<button>`; another element works only in library mode (click handler). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, PopoverTriggerState>;\n}\n\n/**\n * The toggle: `<button type=\"button\" commandfor command=\"toggle-popover\" aria-expanded>`. In\n * JS-free mode the browser runs the command and the Popup keeps `aria-expanded` current. In\n * library mode the click is cancelled (so the command does not run) and dispatched through the\n * Root's transition: an open, or a library-owned close while open. The button shows optimistic\n * `data-open` / `aria-expanded` and `data-pending` until the change has landed.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `aria-disabled`\n * (library mode, link or component `render`), `commandfor`, `command`, `aria-expanded`,\n * `onClick` (library mode), `data-open`, `data-pending`, `data-disabled`. `aria-haspopup` and `aria-controls` pass through.\n */\nexport function PopoverTrigger({\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverTriggerProps) {\n const ctx = usePopoverContext(\"Popover.Trigger\");\n const { state, libraryProps, ref } = usePopoverTrigger(ctx, {\n part: \"Popover.Trigger\",\n disabled,\n render,\n });\n\n return useRender<ComponentPropsWithRef<\"button\">, PopoverTriggerState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref,\n });\n}\n\nPopoverTrigger.displayName = \"PopoverTrigger\";\n"],"mappings":";;;;;;;;;;;;;;;;AA4CA,SAAgB,eAAe,EAC7B,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACmB;CACtB,MAAM,MAAM,kBAAkB,iBAAiB;CAC/C,MAAM,EAAE,OAAO,cAAc,QAAQ,kBAAkB,KAAK;EAC1D,MAAM;EACN;EACA;CACF,CAAC;CAED,OAAO,UAAgE;EACrE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA;CACF,CAAC;AACH;AAEA,eAAe,cAAc"}
@@ -0,0 +1,24 @@
1
+ import "../internal/platform-attributes.mjs";
2
+ import { ProgressRoot, ProgressRootProps, ProgressState } from "./progress-root.mjs";
3
+ import { ProgressIndicator, ProgressIndicatorProps } from "./progress-indicator.mjs";
4
+ import { ProgressLabel, ProgressLabelProps } from "./progress-label.mjs";
5
+ import { ProgressTrack, ProgressTrackProps } from "./progress-track.mjs";
6
+ import { ProgressValue, ProgressValueProps } from "./progress-value.mjs";
7
+ //#region src/progress/index.d.ts
8
+ /**
9
+ * Progress (WAI-ARIA `progressbar`): `Root` (`div[role=progressbar]`, directive-free, so a
10
+ * Server Component may render it and it runs on the server), `Track` (the rail), `Indicator`
11
+ * (the fill, sized by your CSS from `--progress-value`), `Label` and `Value`. Output-only: no
12
+ * actions and no pending state; a `value` of `null` (the default) is indeterminate. Write a value
13
+ * that reports on a pending action with a plain `setState`, never inside `startTransition`.
14
+ */
15
+ export declare const Progress: {
16
+ readonly Root: typeof ProgressRoot;
17
+ readonly Track: typeof ProgressTrack;
18
+ readonly Indicator: typeof ProgressIndicator;
19
+ readonly Label: typeof ProgressLabel;
20
+ readonly Value: typeof ProgressValue;
21
+ };
22
+ //#endregion
23
+ export type { ProgressIndicatorProps, ProgressLabelProps, ProgressRootProps, ProgressState, ProgressTrackProps, ProgressValueProps };
24
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/progress/index.ts"],"mappings":";;;;;;;;;;;;;;qBAgBa;WACX,aAAI;WACJ,cAAK;WACL,kBAAS;WACT,cAAK;WACL,cAAK"}
@@ -0,0 +1,24 @@
1
+ import { ProgressIndicator } from "./progress-indicator.mjs";
2
+ import { ProgressLabel } from "./progress-label.mjs";
3
+ import { ProgressRoot } from "./progress-root.mjs";
4
+ import { ProgressTrack } from "./progress-track.mjs";
5
+ import { ProgressValue } from "./progress-value.mjs";
6
+ //#region src/progress/index.ts
7
+ /**
8
+ * Progress (WAI-ARIA `progressbar`): `Root` (`div[role=progressbar]`, directive-free, so a
9
+ * Server Component may render it and it runs on the server), `Track` (the rail), `Indicator`
10
+ * (the fill, sized by your CSS from `--progress-value`), `Label` and `Value`. Output-only: no
11
+ * actions and no pending state; a `value` of `null` (the default) is indeterminate. Write a value
12
+ * that reports on a pending action with a plain `setState`, never inside `startTransition`.
13
+ */
14
+ const Progress = {
15
+ Root: ProgressRoot,
16
+ Track: ProgressTrack,
17
+ Indicator: ProgressIndicator,
18
+ Label: ProgressLabel,
19
+ Value: ProgressValue
20
+ };
21
+ //#endregion
22
+ export { Progress };
23
+
24
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/progress/index.ts"],"sourcesContent":["// Ships the platform attribute typings with this subpath (conventions 7.4). Type-only: the\n// built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { ProgressIndicator } from \"./progress-indicator.js\";\nimport { ProgressLabel } from \"./progress-label.js\";\nimport { ProgressRoot } from \"./progress-root.js\";\nimport { ProgressTrack } from \"./progress-track.js\";\nimport { ProgressValue } from \"./progress-value.js\";\n\n/**\n * Progress (WAI-ARIA `progressbar`): `Root` (`div[role=progressbar]`, directive-free, so a\n * Server Component may render it and it runs on the server), `Track` (the rail), `Indicator`\n * (the fill, sized by your CSS from `--progress-value`), `Label` and `Value`. Output-only: no\n * actions and no pending state; a `value` of `null` (the default) is indeterminate. Write a value\n * that reports on a pending action with a plain `setState`, never inside `startTransition`.\n */\nexport const Progress = {\n Root: ProgressRoot,\n Track: ProgressTrack,\n Indicator: ProgressIndicator,\n Label: ProgressLabel,\n Value: ProgressValue,\n} as const;\n\nexport type { ProgressRootProps, ProgressState } from \"./progress-root.js\";\nexport type { ProgressTrackProps } from \"./progress-track.js\";\nexport type { ProgressIndicatorProps } from \"./progress-indicator.js\";\nexport type { ProgressLabelProps } from \"./progress-label.js\";\nexport type { ProgressValueProps } from \"./progress-value.js\";\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAa,WAAW;CACtB,MAAM;CACN,OAAO;CACP,WAAW;CACX,OAAO;CACP,OAAO;AACT"}
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { createContext, use } from "react";
3
+ //#region src/progress/progress-context.ts
4
+ const ProgressContext = createContext(null);
5
+ function useProgressContext(part) {
6
+ const context = use(ProgressContext);
7
+ if (context === null) throw new Error(`${part} must be rendered inside a Progress.Root.`);
8
+ return context;
9
+ }
10
+ //#endregion
11
+ export { ProgressContext, useProgressContext };
12
+
13
+ //# sourceMappingURL=progress-context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-context.mjs","names":[],"sources":["../../src/progress/progress-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { ProgressState } from \"./progress-root.js\";\n\n/**\n * What the directive-free `Progress.Root` provides to its parts: plain serialisable data, so the\n * provider can be rendered by a Root running as a Server Component (design 8.1).\n */\nexport interface ProgressContextValue {\n /** The Root's `useId`; `Progress.Label` renders `${id}-label`. */\n readonly id: string;\n readonly state: ProgressState;\n}\n\nexport const ProgressContext = createContext<ProgressContextValue | null>(null);\n\nexport function useProgressContext(part: string): ProgressContextValue {\n const context = use(ProgressContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Progress.Root.`);\n }\n return context;\n}\n"],"mappings":";;;AAcA,MAAa,kBAAkB,cAA2C,IAAI;AAE9E,SAAgB,mBAAmB,MAAoC;CACrE,MAAM,UAAU,IAAI,eAAe;CACnC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,0CAA0C;CAEpE,OAAO;AACT"}