@mortenbrudvik/waveui 0.4.0 → 0.7.0

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 (574) hide show
  1. package/README.md +1221 -173
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  3. package/dist/components/button/Button.cjs +2 -0
  4. package/dist/components/button/Button.cjs.map +1 -0
  5. package/dist/components/button/Button.mjs +50 -0
  6. package/dist/components/button/Button.mjs.map +1 -0
  7. package/dist/components/button/Button.semantics.cjs +2 -0
  8. package/dist/components/button/Button.semantics.cjs.map +1 -0
  9. package/dist/components/button/Button.semantics.mjs +61 -0
  10. package/dist/components/button/Button.semantics.mjs.map +1 -0
  11. package/dist/components/button/Button.slots.cjs +2 -0
  12. package/dist/components/button/Button.slots.cjs.map +1 -0
  13. package/dist/components/button/Button.slots.mjs +47 -0
  14. package/dist/components/button/Button.slots.mjs.map +1 -0
  15. package/dist/components/button/CompoundButton.cjs +2 -0
  16. package/dist/components/button/CompoundButton.cjs.map +1 -0
  17. package/dist/components/button/CompoundButton.mjs +53 -0
  18. package/dist/components/button/CompoundButton.mjs.map +1 -0
  19. package/dist/components/button/Link.cjs +2 -0
  20. package/dist/components/button/Link.cjs.map +1 -0
  21. package/dist/components/button/Link.mjs +37 -0
  22. package/dist/components/button/Link.mjs.map +1 -0
  23. package/dist/components/button/MenuButton.cjs +2 -0
  24. package/dist/components/button/MenuButton.cjs.map +1 -0
  25. package/dist/components/button/MenuButton.mjs +45 -0
  26. package/dist/components/button/MenuButton.mjs.map +1 -0
  27. package/dist/components/button/SplitButton.cjs +2 -0
  28. package/dist/components/button/SplitButton.cjs.map +1 -0
  29. package/dist/components/button/SplitButton.mjs +66 -0
  30. package/dist/components/button/SplitButton.mjs.map +1 -0
  31. package/dist/components/button/ToggleButton.cjs +2 -0
  32. package/dist/components/button/ToggleButton.cjs.map +1 -0
  33. package/dist/components/button/ToggleButton.mjs +65 -0
  34. package/dist/components/button/ToggleButton.mjs.map +1 -0
  35. package/dist/components/button/Toolbar.cjs +2 -0
  36. package/dist/components/button/Toolbar.cjs.map +1 -0
  37. package/dist/components/button/Toolbar.context.cjs +2 -0
  38. package/dist/components/button/Toolbar.context.cjs.map +1 -0
  39. package/dist/components/button/Toolbar.context.mjs +31 -0
  40. package/dist/components/button/Toolbar.context.mjs.map +1 -0
  41. package/dist/components/button/Toolbar.mjs +63 -0
  42. package/dist/components/button/Toolbar.mjs.map +1 -0
  43. package/dist/components/button/Toolbar.parts.cjs +2 -0
  44. package/dist/components/button/Toolbar.parts.cjs.map +1 -0
  45. package/dist/components/button/Toolbar.parts.mjs +131 -0
  46. package/dist/components/button/Toolbar.parts.mjs.map +1 -0
  47. package/dist/components/button/buttonStyles.cjs +2 -0
  48. package/dist/components/button/buttonStyles.cjs.map +1 -0
  49. package/dist/components/button/buttonStyles.mjs +39 -0
  50. package/dist/components/button/buttonStyles.mjs.map +1 -0
  51. package/dist/components/data-display/Avatar.cjs +2 -0
  52. package/dist/components/data-display/Avatar.cjs.map +1 -0
  53. package/dist/components/data-display/Avatar.mjs +157 -0
  54. package/dist/components/data-display/Avatar.mjs.map +1 -0
  55. package/dist/components/data-display/AvatarGroup.cjs +2 -0
  56. package/dist/components/data-display/AvatarGroup.cjs.map +1 -0
  57. package/dist/components/data-display/AvatarGroup.mjs +134 -0
  58. package/dist/components/data-display/AvatarGroup.mjs.map +1 -0
  59. package/dist/components/data-display/Badge.cjs +2 -0
  60. package/dist/components/data-display/Badge.cjs.map +1 -0
  61. package/dist/components/data-display/Badge.colors.cjs +2 -0
  62. package/dist/components/data-display/Badge.colors.cjs.map +1 -0
  63. package/dist/components/data-display/Badge.colors.mjs +58 -0
  64. package/dist/components/data-display/Badge.colors.mjs.map +1 -0
  65. package/dist/components/data-display/Badge.mjs +32 -0
  66. package/dist/components/data-display/Badge.mjs.map +1 -0
  67. package/dist/components/data-display/CounterBadge.cjs +2 -0
  68. package/dist/components/data-display/CounterBadge.cjs.map +1 -0
  69. package/dist/components/data-display/CounterBadge.mjs +28 -0
  70. package/dist/components/data-display/CounterBadge.mjs.map +1 -0
  71. package/dist/components/data-display/Divider.cjs +2 -0
  72. package/dist/components/data-display/Divider.cjs.map +1 -0
  73. package/dist/components/data-display/Divider.mjs +52 -0
  74. package/dist/components/data-display/Divider.mjs.map +1 -0
  75. package/dist/components/data-display/Image.cjs +2 -0
  76. package/dist/components/data-display/Image.cjs.map +1 -0
  77. package/dist/components/data-display/Image.mjs +32 -0
  78. package/dist/components/data-display/Image.mjs.map +1 -0
  79. package/dist/components/data-display/InfoLabel.cjs +2 -0
  80. package/dist/components/data-display/InfoLabel.cjs.map +1 -0
  81. package/dist/components/data-display/InfoLabel.mjs +104 -0
  82. package/dist/components/data-display/InfoLabel.mjs.map +1 -0
  83. package/dist/components/data-display/List.cjs +2 -0
  84. package/dist/components/data-display/List.cjs.map +1 -0
  85. package/dist/components/data-display/List.mjs +381 -0
  86. package/dist/components/data-display/List.mjs.map +1 -0
  87. package/dist/components/data-display/List.registry.cjs +2 -0
  88. package/dist/components/data-display/List.registry.cjs.map +1 -0
  89. package/dist/components/data-display/List.registry.mjs +101 -0
  90. package/dist/components/data-display/List.registry.mjs.map +1 -0
  91. package/dist/components/data-display/Persona.cjs +2 -0
  92. package/dist/components/data-display/Persona.cjs.map +1 -0
  93. package/dist/components/data-display/Persona.mjs +48 -0
  94. package/dist/components/data-display/Persona.mjs.map +1 -0
  95. package/dist/components/data-display/PresenceBadge.cjs +2 -0
  96. package/dist/components/data-display/PresenceBadge.cjs.map +1 -0
  97. package/dist/components/data-display/PresenceBadge.mjs +71 -0
  98. package/dist/components/data-display/PresenceBadge.mjs.map +1 -0
  99. package/dist/components/data-display/Tag.cjs +2 -0
  100. package/dist/components/data-display/Tag.cjs.map +1 -0
  101. package/dist/components/data-display/Tag.mjs +147 -0
  102. package/dist/components/data-display/Tag.mjs.map +1 -0
  103. package/dist/components/feedback/MessageBar.cjs +2 -0
  104. package/dist/components/feedback/MessageBar.cjs.map +1 -0
  105. package/dist/components/feedback/MessageBar.mjs +144 -0
  106. package/dist/components/feedback/MessageBar.mjs.map +1 -0
  107. package/dist/components/feedback/MessageBar.status.cjs +2 -0
  108. package/dist/components/feedback/MessageBar.status.cjs.map +1 -0
  109. package/dist/components/feedback/MessageBar.status.mjs +45 -0
  110. package/dist/components/feedback/MessageBar.status.mjs.map +1 -0
  111. package/dist/components/feedback/ProgressBar.cjs +2 -0
  112. package/dist/components/feedback/ProgressBar.cjs.map +1 -0
  113. package/dist/components/feedback/ProgressBar.mjs +72 -0
  114. package/dist/components/feedback/ProgressBar.mjs.map +1 -0
  115. package/dist/components/feedback/Skeleton.cjs +2 -0
  116. package/dist/components/feedback/Skeleton.cjs.map +1 -0
  117. package/dist/components/feedback/Skeleton.mjs +47 -0
  118. package/dist/components/feedback/Skeleton.mjs.map +1 -0
  119. package/dist/components/feedback/Spinner.cjs +2 -0
  120. package/dist/components/feedback/Spinner.cjs.map +1 -0
  121. package/dist/components/feedback/Spinner.mjs +60 -0
  122. package/dist/components/feedback/Spinner.mjs.map +1 -0
  123. package/dist/components/feedback/Toast.cjs +2 -0
  124. package/dist/components/feedback/Toast.cjs.map +1 -0
  125. package/dist/components/feedback/Toast.mjs +347 -0
  126. package/dist/components/feedback/Toast.mjs.map +1 -0
  127. package/dist/components/input/Checkbox.cjs +2 -0
  128. package/dist/components/input/Checkbox.cjs.map +1 -0
  129. package/dist/components/input/Checkbox.mjs +96 -0
  130. package/dist/components/input/Checkbox.mjs.map +1 -0
  131. package/dist/components/input/ColorPicker.cjs +6 -0
  132. package/dist/components/input/ColorPicker.cjs.map +1 -0
  133. package/dist/components/input/ColorPicker.mjs +236 -0
  134. package/dist/components/input/ColorPicker.mjs.map +1 -0
  135. package/dist/components/input/Combobox.cjs +2 -0
  136. package/dist/components/input/Combobox.cjs.map +1 -0
  137. package/dist/components/input/Combobox.expand.cjs +2 -0
  138. package/dist/components/input/Combobox.expand.cjs.map +1 -0
  139. package/dist/components/input/Combobox.expand.mjs +38 -0
  140. package/dist/components/input/Combobox.expand.mjs.map +1 -0
  141. package/dist/components/input/Combobox.mjs +187 -0
  142. package/dist/components/input/Combobox.mjs.map +1 -0
  143. package/dist/components/input/DatePicker.cjs +2 -0
  144. package/dist/components/input/DatePicker.cjs.map +1 -0
  145. package/dist/components/input/DatePicker.mjs +340 -0
  146. package/dist/components/input/DatePicker.mjs.map +1 -0
  147. package/dist/components/input/Dropdown.cjs +2 -0
  148. package/dist/components/input/Dropdown.cjs.map +1 -0
  149. package/dist/components/input/Dropdown.mjs +128 -0
  150. package/dist/components/input/Dropdown.mjs.map +1 -0
  151. package/dist/components/input/Field.cjs +2 -0
  152. package/dist/components/input/Field.cjs.map +1 -0
  153. package/dist/components/input/Field.mjs +200 -0
  154. package/dist/components/input/Field.mjs.map +1 -0
  155. package/dist/components/input/Input.cjs +2 -0
  156. package/dist/components/input/Input.cjs.map +1 -0
  157. package/dist/components/input/Input.mjs +81 -0
  158. package/dist/components/input/Input.mjs.map +1 -0
  159. package/dist/components/input/Label.cjs +2 -0
  160. package/dist/components/input/Label.cjs.map +1 -0
  161. package/dist/components/input/Label.mjs +28 -0
  162. package/dist/components/input/Label.mjs.map +1 -0
  163. package/dist/components/input/Option.cjs +2 -0
  164. package/dist/components/input/Option.cjs.map +1 -0
  165. package/dist/components/input/Option.mjs +169 -0
  166. package/dist/components/input/Option.mjs.map +1 -0
  167. package/dist/components/input/RadioGroup.cjs +2 -0
  168. package/dist/components/input/RadioGroup.cjs.map +1 -0
  169. package/dist/components/input/RadioGroup.mjs +139 -0
  170. package/dist/components/input/RadioGroup.mjs.map +1 -0
  171. package/dist/components/input/Rating.cjs +2 -0
  172. package/dist/components/input/Rating.cjs.map +1 -0
  173. package/dist/components/input/Rating.mjs +196 -0
  174. package/dist/components/input/Rating.mjs.map +1 -0
  175. package/dist/components/input/SearchBox.cjs +2 -0
  176. package/dist/components/input/SearchBox.cjs.map +1 -0
  177. package/dist/components/input/SearchBox.mjs +205 -0
  178. package/dist/components/input/SearchBox.mjs.map +1 -0
  179. package/dist/components/input/Select.cjs +2 -0
  180. package/dist/components/input/Select.cjs.map +1 -0
  181. package/dist/components/input/Select.mjs +33 -0
  182. package/dist/components/input/Select.mjs.map +1 -0
  183. package/dist/components/input/Slider.cjs +2 -0
  184. package/dist/components/input/Slider.cjs.map +1 -0
  185. package/dist/components/input/Slider.mjs +79 -0
  186. package/dist/components/input/Slider.mjs.map +1 -0
  187. package/dist/components/input/SpinButton.cjs +2 -0
  188. package/dist/components/input/SpinButton.cjs.map +1 -0
  189. package/dist/components/input/SpinButton.mjs +157 -0
  190. package/dist/components/input/SpinButton.mjs.map +1 -0
  191. package/dist/components/input/SwatchPicker.cjs +2 -0
  192. package/dist/components/input/SwatchPicker.cjs.map +1 -0
  193. package/dist/components/input/SwatchPicker.mjs +113 -0
  194. package/dist/components/input/SwatchPicker.mjs.map +1 -0
  195. package/dist/components/input/Switch.cjs +2 -0
  196. package/dist/components/input/Switch.cjs.map +1 -0
  197. package/dist/components/input/Switch.mjs +92 -0
  198. package/dist/components/input/Switch.mjs.map +1 -0
  199. package/dist/components/input/TagPicker.cjs +2 -0
  200. package/dist/components/input/TagPicker.cjs.map +1 -0
  201. package/dist/components/input/TagPicker.mjs +249 -0
  202. package/dist/components/input/TagPicker.mjs.map +1 -0
  203. package/dist/components/input/Textarea.cjs +2 -0
  204. package/dist/components/input/Textarea.cjs.map +1 -0
  205. package/dist/components/input/Textarea.mjs +32 -0
  206. package/dist/components/input/Textarea.mjs.map +1 -0
  207. package/dist/components/input/TimePicker.cjs +2 -0
  208. package/dist/components/input/TimePicker.cjs.map +1 -0
  209. package/dist/components/input/TimePicker.mjs +292 -0
  210. package/dist/components/input/TimePicker.mjs.map +1 -0
  211. package/dist/components/input/colorUtils.cjs +2 -0
  212. package/dist/components/input/colorUtils.cjs.map +1 -0
  213. package/dist/components/input/colorUtils.mjs +96 -0
  214. package/dist/components/input/colorUtils.mjs.map +1 -0
  215. package/dist/components/input/dateUtils.cjs +2 -0
  216. package/dist/components/input/dateUtils.cjs.map +1 -0
  217. package/dist/components/input/dateUtils.mjs +250 -0
  218. package/dist/components/input/dateUtils.mjs.map +1 -0
  219. package/dist/components/input/pickerStyles.cjs +2 -0
  220. package/dist/components/input/pickerStyles.cjs.map +1 -0
  221. package/dist/components/input/pickerStyles.mjs +10 -0
  222. package/dist/components/input/pickerStyles.mjs.map +1 -0
  223. package/dist/components/internal/HiddenInput.cjs +2 -0
  224. package/dist/components/internal/HiddenInput.cjs.map +1 -0
  225. package/dist/components/internal/HiddenInput.mjs +88 -0
  226. package/dist/components/internal/HiddenInput.mjs.map +1 -0
  227. package/dist/components/layout/Accordion.cjs +2 -0
  228. package/dist/components/layout/Accordion.cjs.map +1 -0
  229. package/dist/components/layout/Accordion.mjs +236 -0
  230. package/dist/components/layout/Accordion.mjs.map +1 -0
  231. package/dist/components/layout/Card.cjs +2 -0
  232. package/dist/components/layout/Card.cjs.map +1 -0
  233. package/dist/components/layout/Card.mjs +121 -0
  234. package/dist/components/layout/Card.mjs.map +1 -0
  235. package/dist/components/layout/Carousel.cjs +2 -0
  236. package/dist/components/layout/Carousel.cjs.map +1 -0
  237. package/dist/components/layout/Carousel.mjs +205 -0
  238. package/dist/components/layout/Carousel.mjs.map +1 -0
  239. package/dist/components/layout/Flex.cjs +2 -0
  240. package/dist/components/layout/Flex.cjs.map +1 -0
  241. package/dist/components/layout/Flex.mjs +54 -0
  242. package/dist/components/layout/Flex.mjs.map +1 -0
  243. package/dist/components/layout/Grid.cjs +2 -0
  244. package/dist/components/layout/Grid.cjs.map +1 -0
  245. package/dist/components/layout/Grid.mjs +62 -0
  246. package/dist/components/layout/Grid.mjs.map +1 -0
  247. package/dist/components/layout/Overflow.cjs +2 -0
  248. package/dist/components/layout/Overflow.cjs.map +1 -0
  249. package/dist/components/layout/Overflow.mjs +269 -0
  250. package/dist/components/layout/Overflow.mjs.map +1 -0
  251. package/dist/components/layout/Stack.cjs +2 -0
  252. package/dist/components/layout/Stack.cjs.map +1 -0
  253. package/dist/components/layout/Stack.mjs +39 -0
  254. package/dist/components/layout/Stack.mjs.map +1 -0
  255. package/dist/components/layout/TabList.cjs +2 -0
  256. package/dist/components/layout/TabList.cjs.map +1 -0
  257. package/dist/components/layout/TabList.mjs +238 -0
  258. package/dist/components/layout/TabList.mjs.map +1 -0
  259. package/dist/components/layout/Tree.cjs +2 -0
  260. package/dist/components/layout/Tree.cjs.map +1 -0
  261. package/dist/components/layout/Tree.mjs +220 -0
  262. package/dist/components/layout/Tree.mjs.map +1 -0
  263. package/dist/components/layout/disclosureIds.cjs +2 -0
  264. package/dist/components/layout/disclosureIds.cjs.map +1 -0
  265. package/dist/components/layout/disclosureIds.mjs +12 -0
  266. package/dist/components/layout/disclosureIds.mjs.map +1 -0
  267. package/dist/components/motion/Presence.cjs +2 -0
  268. package/dist/components/motion/Presence.cjs.map +1 -0
  269. package/dist/components/motion/Presence.mjs +35 -0
  270. package/dist/components/motion/Presence.mjs.map +1 -0
  271. package/dist/components/navigation/Breadcrumb.cjs +2 -0
  272. package/dist/components/navigation/Breadcrumb.cjs.map +1 -0
  273. package/dist/components/navigation/Breadcrumb.mjs +144 -0
  274. package/dist/components/navigation/Breadcrumb.mjs.map +1 -0
  275. package/dist/components/navigation/Menu.cjs +2 -0
  276. package/dist/components/navigation/Menu.cjs.map +1 -0
  277. package/dist/components/navigation/Menu.context.cjs +2 -0
  278. package/dist/components/navigation/Menu.context.cjs.map +1 -0
  279. package/dist/components/navigation/Menu.context.mjs +82 -0
  280. package/dist/components/navigation/Menu.context.mjs.map +1 -0
  281. package/dist/components/navigation/Menu.group.cjs +2 -0
  282. package/dist/components/navigation/Menu.group.cjs.map +1 -0
  283. package/dist/components/navigation/Menu.group.mjs +58 -0
  284. package/dist/components/navigation/Menu.group.mjs.map +1 -0
  285. package/dist/components/navigation/Menu.items.cjs +2 -0
  286. package/dist/components/navigation/Menu.items.cjs.map +1 -0
  287. package/dist/components/navigation/Menu.items.mjs +127 -0
  288. package/dist/components/navigation/Menu.items.mjs.map +1 -0
  289. package/dist/components/navigation/Menu.link.cjs +2 -0
  290. package/dist/components/navigation/Menu.link.cjs.map +1 -0
  291. package/dist/components/navigation/Menu.link.mjs +41 -0
  292. package/dist/components/navigation/Menu.link.mjs.map +1 -0
  293. package/dist/components/navigation/Menu.mjs +27 -0
  294. package/dist/components/navigation/Menu.mjs.map +1 -0
  295. package/dist/components/navigation/Menu.popover.cjs +2 -0
  296. package/dist/components/navigation/Menu.popover.cjs.map +1 -0
  297. package/dist/components/navigation/Menu.popover.mjs +231 -0
  298. package/dist/components/navigation/Menu.popover.mjs.map +1 -0
  299. package/dist/components/navigation/Menu.root.cjs +2 -0
  300. package/dist/components/navigation/Menu.root.cjs.map +1 -0
  301. package/dist/components/navigation/Menu.root.mjs +308 -0
  302. package/dist/components/navigation/Menu.root.mjs.map +1 -0
  303. package/dist/components/navigation/Menu.selectable.cjs +2 -0
  304. package/dist/components/navigation/Menu.selectable.cjs.map +1 -0
  305. package/dist/components/navigation/Menu.selectable.mjs +89 -0
  306. package/dist/components/navigation/Menu.selectable.mjs.map +1 -0
  307. package/dist/components/navigation/Menu.shared.cjs +2 -0
  308. package/dist/components/navigation/Menu.shared.cjs.map +1 -0
  309. package/dist/components/navigation/Menu.shared.mjs +23 -0
  310. package/dist/components/navigation/Menu.shared.mjs.map +1 -0
  311. package/dist/components/navigation/Menu.splitGroup.cjs +2 -0
  312. package/dist/components/navigation/Menu.splitGroup.cjs.map +1 -0
  313. package/dist/components/navigation/Menu.splitGroup.mjs +51 -0
  314. package/dist/components/navigation/Menu.splitGroup.mjs.map +1 -0
  315. package/dist/components/navigation/Menu.trigger.cjs +2 -0
  316. package/dist/components/navigation/Menu.trigger.cjs.map +1 -0
  317. package/dist/components/navigation/Menu.trigger.mjs +79 -0
  318. package/dist/components/navigation/Menu.trigger.mjs.map +1 -0
  319. package/dist/components/navigation/Nav.cjs +2 -0
  320. package/dist/components/navigation/Nav.cjs.map +1 -0
  321. package/dist/components/navigation/Nav.mjs +276 -0
  322. package/dist/components/navigation/Nav.mjs.map +1 -0
  323. package/dist/components/navigation/Pagination.cjs +2 -0
  324. package/dist/components/navigation/Pagination.cjs.map +1 -0
  325. package/dist/components/navigation/Pagination.mjs +110 -0
  326. package/dist/components/navigation/Pagination.mjs.map +1 -0
  327. package/dist/components/navigation/Stepper.cjs +2 -0
  328. package/dist/components/navigation/Stepper.cjs.map +1 -0
  329. package/dist/components/navigation/Stepper.mjs +204 -0
  330. package/dist/components/navigation/Stepper.mjs.map +1 -0
  331. package/dist/components/overlays/Dialog.cjs +2 -0
  332. package/dist/components/overlays/Dialog.cjs.map +1 -0
  333. package/dist/components/overlays/Dialog.mjs +180 -0
  334. package/dist/components/overlays/Dialog.mjs.map +1 -0
  335. package/dist/components/overlays/Dialog.shared.cjs +2 -0
  336. package/dist/components/overlays/Dialog.shared.cjs.map +1 -0
  337. package/dist/components/overlays/Dialog.shared.mjs +227 -0
  338. package/dist/components/overlays/Dialog.shared.mjs.map +1 -0
  339. package/dist/components/overlays/Drawer.cjs +2 -0
  340. package/dist/components/overlays/Drawer.cjs.map +1 -0
  341. package/dist/components/overlays/Drawer.mjs +192 -0
  342. package/dist/components/overlays/Drawer.mjs.map +1 -0
  343. package/dist/components/overlays/Popover.cjs +2 -0
  344. package/dist/components/overlays/Popover.cjs.map +1 -0
  345. package/dist/components/overlays/Popover.mjs +365 -0
  346. package/dist/components/overlays/Popover.mjs.map +1 -0
  347. package/dist/components/overlays/Popover.shared.cjs +2 -0
  348. package/dist/components/overlays/Popover.shared.cjs.map +1 -0
  349. package/dist/components/overlays/Popover.shared.mjs +182 -0
  350. package/dist/components/overlays/Popover.shared.mjs.map +1 -0
  351. package/dist/components/overlays/TeachingPopover.cjs +2 -0
  352. package/dist/components/overlays/TeachingPopover.cjs.map +1 -0
  353. package/dist/components/overlays/TeachingPopover.mjs +181 -0
  354. package/dist/components/overlays/TeachingPopover.mjs.map +1 -0
  355. package/dist/components/overlays/Tooltip.cjs +2 -0
  356. package/dist/components/overlays/Tooltip.cjs.map +1 -0
  357. package/dist/components/overlays/Tooltip.mjs +160 -0
  358. package/dist/components/overlays/Tooltip.mjs.map +1 -0
  359. package/dist/components/portal/Portal.cjs +2 -0
  360. package/dist/components/portal/Portal.cjs.map +1 -0
  361. package/dist/components/portal/Portal.mjs +45 -0
  362. package/dist/components/portal/Portal.mjs.map +1 -0
  363. package/dist/components/provider/WaveProvider.cjs +2 -0
  364. package/dist/components/provider/WaveProvider.cjs.map +1 -0
  365. package/dist/components/provider/WaveProvider.mjs +51 -0
  366. package/dist/components/provider/WaveProvider.mjs.map +1 -0
  367. package/dist/components/table/DataGrid.cjs +2 -0
  368. package/dist/components/table/DataGrid.cjs.map +1 -0
  369. package/dist/components/table/DataGrid.mjs +489 -0
  370. package/dist/components/table/DataGrid.mjs.map +1 -0
  371. package/dist/components/table/Table.cjs +2 -0
  372. package/dist/components/table/Table.cjs.map +1 -0
  373. package/dist/components/table/Table.mjs +99 -0
  374. package/dist/components/table/Table.mjs.map +1 -0
  375. package/dist/components/table/useGridNavigation.cjs +2 -0
  376. package/dist/components/table/useGridNavigation.cjs.map +1 -0
  377. package/dist/components/table/useGridNavigation.mjs +336 -0
  378. package/dist/components/table/useGridNavigation.mjs.map +1 -0
  379. package/dist/components/typography/Text.cjs +2 -0
  380. package/dist/components/typography/Text.cjs.map +1 -0
  381. package/dist/components/typography/Text.mjs +38 -0
  382. package/dist/components/typography/Text.mjs.map +1 -0
  383. package/dist/hooks/useAnnounce.cjs +2 -0
  384. package/dist/hooks/useAnnounce.cjs.map +1 -0
  385. package/dist/hooks/useAnnounce.mjs +88 -0
  386. package/dist/hooks/useAnnounce.mjs.map +1 -0
  387. package/dist/hooks/useCheckedValues.cjs +2 -0
  388. package/dist/hooks/useCheckedValues.cjs.map +1 -0
  389. package/dist/hooks/useCheckedValues.mjs +102 -0
  390. package/dist/hooks/useCheckedValues.mjs.map +1 -0
  391. package/dist/hooks/useContextMenuAnchor.cjs +2 -0
  392. package/dist/hooks/useContextMenuAnchor.cjs.map +1 -0
  393. package/dist/hooks/useContextMenuAnchor.mjs +132 -0
  394. package/dist/hooks/useContextMenuAnchor.mjs.map +1 -0
  395. package/dist/hooks/useControllable.cjs +2 -0
  396. package/dist/hooks/useControllable.cjs.map +1 -0
  397. package/dist/hooks/useControllable.mjs +37 -0
  398. package/dist/hooks/useControllable.mjs.map +1 -0
  399. package/dist/hooks/useDirection.cjs +2 -0
  400. package/dist/hooks/useDirection.cjs.map +1 -0
  401. package/dist/hooks/useDirection.mjs +57 -0
  402. package/dist/hooks/useDirection.mjs.map +1 -0
  403. package/dist/hooks/useDismiss.cjs +2 -0
  404. package/dist/hooks/useDismiss.cjs.map +1 -0
  405. package/dist/hooks/useDismiss.mjs +57 -0
  406. package/dist/hooks/useDismiss.mjs.map +1 -0
  407. package/dist/hooks/useEventCallback.cjs +2 -0
  408. package/dist/hooks/useEventCallback.cjs.map +1 -0
  409. package/dist/hooks/useEventCallback.mjs +16 -0
  410. package/dist/hooks/useEventCallback.mjs.map +1 -0
  411. package/dist/hooks/useFieldControl.cjs +2 -0
  412. package/dist/hooks/useFieldControl.cjs.map +1 -0
  413. package/dist/hooks/useFieldControl.mjs +62 -0
  414. package/dist/hooks/useFieldControl.mjs.map +1 -0
  415. package/dist/hooks/useFocusTrap.cjs +2 -0
  416. package/dist/hooks/useFocusTrap.cjs.map +1 -0
  417. package/dist/hooks/useFocusTrap.mjs +266 -0
  418. package/dist/hooks/useFocusTrap.mjs.map +1 -0
  419. package/dist/hooks/useFormReset.cjs +2 -0
  420. package/dist/hooks/useFormReset.cjs.map +1 -0
  421. package/dist/hooks/useFormReset.mjs +33 -0
  422. package/dist/hooks/useFormReset.mjs.map +1 -0
  423. package/dist/hooks/useHoverIntent.cjs +2 -0
  424. package/dist/hooks/useHoverIntent.cjs.map +1 -0
  425. package/dist/hooks/useHoverIntent.mjs +201 -0
  426. package/dist/hooks/useHoverIntent.mjs.map +1 -0
  427. package/dist/hooks/useId.cjs +2 -0
  428. package/dist/hooks/useId.cjs.map +1 -0
  429. package/dist/hooks/useId.mjs +11 -0
  430. package/dist/hooks/useId.mjs.map +1 -0
  431. package/dist/hooks/useIsClient.cjs +2 -0
  432. package/dist/hooks/useIsClient.cjs.map +1 -0
  433. package/dist/hooks/useIsClient.mjs +19 -0
  434. package/dist/hooks/useIsClient.mjs.map +1 -0
  435. package/dist/hooks/useListbox.cjs +2 -0
  436. package/dist/hooks/useListbox.cjs.map +1 -0
  437. package/dist/hooks/useListbox.mjs +492 -0
  438. package/dist/hooks/useListbox.mjs.map +1 -0
  439. package/dist/hooks/useMergedRefs.cjs +2 -0
  440. package/dist/hooks/useMergedRefs.cjs.map +1 -0
  441. package/dist/hooks/useMergedRefs.mjs +57 -0
  442. package/dist/hooks/useMergedRefs.mjs.map +1 -0
  443. package/dist/hooks/useModalIsolation.cjs +2 -0
  444. package/dist/hooks/useModalIsolation.cjs.map +1 -0
  445. package/dist/hooks/useModalIsolation.mjs +87 -0
  446. package/dist/hooks/useModalIsolation.mjs.map +1 -0
  447. package/dist/hooks/useModalLayer.cjs +2 -0
  448. package/dist/hooks/useModalLayer.cjs.map +1 -0
  449. package/dist/hooks/useModalLayer.mjs +30 -0
  450. package/dist/hooks/useModalLayer.mjs.map +1 -0
  451. package/dist/hooks/usePopupPosition.cjs +2 -0
  452. package/dist/hooks/usePopupPosition.cjs.map +1 -0
  453. package/dist/hooks/usePopupPosition.mjs +117 -0
  454. package/dist/hooks/usePopupPosition.mjs.map +1 -0
  455. package/dist/hooks/usePrefersReducedMotion.cjs +2 -0
  456. package/dist/hooks/usePrefersReducedMotion.cjs.map +1 -0
  457. package/dist/hooks/usePrefersReducedMotion.mjs +24 -0
  458. package/dist/hooks/usePrefersReducedMotion.mjs.map +1 -0
  459. package/dist/hooks/usePresence.cjs +2 -0
  460. package/dist/hooks/usePresence.cjs.map +1 -0
  461. package/dist/hooks/usePresence.mjs +136 -0
  462. package/dist/hooks/usePresence.mjs.map +1 -0
  463. package/dist/hooks/usePreserveFocus.cjs +2 -0
  464. package/dist/hooks/usePreserveFocus.cjs.map +1 -0
  465. package/dist/hooks/usePreserveFocus.mjs +50 -0
  466. package/dist/hooks/usePreserveFocus.mjs.map +1 -0
  467. package/dist/hooks/useRestoreFocus.cjs +2 -0
  468. package/dist/hooks/useRestoreFocus.cjs.map +1 -0
  469. package/dist/hooks/useRestoreFocus.mjs +271 -0
  470. package/dist/hooks/useRestoreFocus.mjs.map +1 -0
  471. package/dist/hooks/useRovingTabIndex.cjs +2 -0
  472. package/dist/hooks/useRovingTabIndex.cjs.map +1 -0
  473. package/dist/hooks/useRovingTabIndex.mjs +389 -0
  474. package/dist/hooks/useRovingTabIndex.mjs.map +1 -0
  475. package/dist/hooks/useScrollLock.cjs +2 -0
  476. package/dist/hooks/useScrollLock.cjs.map +1 -0
  477. package/dist/hooks/useScrollLock.mjs +71 -0
  478. package/dist/hooks/useScrollLock.mjs.map +1 -0
  479. package/dist/hooks/useTriggerElement.cjs +2 -0
  480. package/dist/hooks/useTriggerElement.cjs.map +1 -0
  481. package/dist/hooks/useTriggerElement.mjs +126 -0
  482. package/dist/hooks/useTriggerElement.mjs.map +1 -0
  483. package/dist/hooks/useTypeahead.cjs +2 -0
  484. package/dist/hooks/useTypeahead.cjs.map +1 -0
  485. package/dist/hooks/useTypeahead.mjs +38 -0
  486. package/dist/hooks/useTypeahead.mjs.map +1 -0
  487. package/dist/index.cjs +1 -1
  488. package/dist/index.d.cts +9099 -0
  489. package/dist/index.d.ts +7688 -1027
  490. package/dist/index.mjs +91 -5695
  491. package/dist/lib/aria.cjs +2 -0
  492. package/dist/lib/aria.cjs.map +1 -0
  493. package/dist/lib/aria.mjs +29 -0
  494. package/dist/lib/aria.mjs.map +1 -0
  495. package/dist/lib/children.cjs +2 -0
  496. package/dist/lib/children.cjs.map +1 -0
  497. package/dist/lib/children.mjs +37 -0
  498. package/dist/lib/children.mjs.map +1 -0
  499. package/dist/lib/cn.cjs +2 -0
  500. package/dist/lib/cn.cjs.map +1 -0
  501. package/dist/lib/cn.mjs +64 -0
  502. package/dist/lib/cn.mjs.map +1 -0
  503. package/dist/lib/composeEventHandlers.cjs +2 -0
  504. package/dist/lib/composeEventHandlers.cjs.map +1 -0
  505. package/dist/lib/composeEventHandlers.mjs +11 -0
  506. package/dist/lib/composeEventHandlers.mjs.map +1 -0
  507. package/dist/lib/dev.cjs +2 -0
  508. package/dist/lib/dev.cjs.map +1 -0
  509. package/dist/lib/dev.mjs +42 -0
  510. package/dist/lib/dev.mjs.map +1 -0
  511. package/dist/lib/direction.cjs +2 -0
  512. package/dist/lib/direction.cjs.map +1 -0
  513. package/dist/lib/direction.mjs +35 -0
  514. package/dist/lib/direction.mjs.map +1 -0
  515. package/dist/lib/events.cjs +2 -0
  516. package/dist/lib/events.cjs.map +1 -0
  517. package/dist/lib/events.mjs +31 -0
  518. package/dist/lib/events.mjs.map +1 -0
  519. package/dist/lib/focus.cjs +2 -0
  520. package/dist/lib/focus.cjs.map +1 -0
  521. package/dist/lib/focus.mjs +119 -0
  522. package/dist/lib/focus.mjs.map +1 -0
  523. package/dist/lib/globalRegistry.cjs +2 -0
  524. package/dist/lib/globalRegistry.cjs.map +1 -0
  525. package/dist/lib/globalRegistry.mjs +13 -0
  526. package/dist/lib/globalRegistry.mjs.map +1 -0
  527. package/dist/lib/icons.cjs +2 -0
  528. package/dist/lib/icons.cjs.map +1 -0
  529. package/dist/lib/icons.mjs +254 -0
  530. package/dist/lib/icons.mjs.map +1 -0
  531. package/dist/lib/labelInName.cjs +2 -0
  532. package/dist/lib/labelInName.cjs.map +1 -0
  533. package/dist/lib/labelInName.mjs +54 -0
  534. package/dist/lib/labelInName.mjs.map +1 -0
  535. package/dist/lib/layers.cjs +2 -0
  536. package/dist/lib/layers.cjs.map +1 -0
  537. package/dist/lib/layers.mjs +224 -0
  538. package/dist/lib/layers.mjs.map +1 -0
  539. package/dist/lib/mergeProps.cjs +2 -0
  540. package/dist/lib/mergeProps.cjs.map +1 -0
  541. package/dist/lib/mergeProps.mjs +21 -0
  542. package/dist/lib/mergeProps.mjs.map +1 -0
  543. package/dist/lib/mergeRefs.cjs +2 -0
  544. package/dist/lib/mergeRefs.cjs.map +1 -0
  545. package/dist/lib/mergeRefs.mjs +29 -0
  546. package/dist/lib/mergeRefs.mjs.map +1 -0
  547. package/dist/lib/renderTrigger.cjs +2 -0
  548. package/dist/lib/renderTrigger.cjs.map +1 -0
  549. package/dist/lib/renderTrigger.mjs +29 -0
  550. package/dist/lib/renderTrigger.mjs.map +1 -0
  551. package/dist/lib/slot.cjs +2 -0
  552. package/dist/lib/slot.cjs.map +1 -0
  553. package/dist/lib/slot.mjs +122 -0
  554. package/dist/lib/slot.mjs.map +1 -0
  555. package/dist/lib/styles.cjs +2 -0
  556. package/dist/lib/styles.cjs.map +1 -0
  557. package/dist/lib/styles.mjs +16 -0
  558. package/dist/lib/styles.mjs.map +1 -0
  559. package/dist/lib/theme.cjs +2 -0
  560. package/dist/lib/theme.cjs.map +1 -0
  561. package/dist/lib/theme.mjs +16 -0
  562. package/dist/lib/theme.mjs.map +1 -0
  563. package/dist/preflight.css +2 -0
  564. package/dist/styles.css +2 -0
  565. package/package.json +149 -100
  566. package/src/styles/animations.css +7 -39
  567. package/src/styles/base.css +103 -0
  568. package/src/styles/globals.css +10 -22
  569. package/src/styles/legacy-tokens.css +184 -0
  570. package/src/styles/preflight.css +7 -0
  571. package/src/styles/styles.css +32 -0
  572. package/src/styles/tailwind.css +17 -0
  573. package/src/styles/tokens.css +561 -221
  574. package/src/styles/variants.css +29 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.cjs","names":["React","inertModalTrigger","useRequiredContext","useModalOpenState","useIsClient","useModalTrigger","useModalTriggerPart","useModalClosePart","useId","useTitleRegistry","useMergedRefs","useBackdropPress","useModalDismiss","useModalLayer","slotRendersContent","Portal","cn","ModalSurfaceContext","Button","DismissIcon","useModalTitle","require_runtime","require_cn","require_dev","require_slot","require_useId","require_useMergedRefs","require_useIsClient","require_Portal","require_Button","require_icons","require_useModalLayer","require_Dialog_shared","react","react_jsx_runtime","DialogContext","inertDialogContext","useDialogContext","componentName","DialogRoot","openState","requestOpen","open","defaultOpen","onOpenChange","isClient","isOpen","trigger","contentId","setContentId","registerContentId","id","current","context","modalType","finalFocusRef","DialogTrigger","props","DialogClose","sizeClasses","DialogContent","rest","generatedId","propTitleId","titles","surface","setSurface","surfaceRef","attachSurface","node","registerId","mergedRef","ref","closesOnBackdropPress","backdropPress","onDismiss","layer","footerHeight","setFooterHeight","surfaceContext","hasTitle","title","size","className","closeLabel","event","DialogTitle","titleId","titleRef","stickyFooterClasses","footerRowClasses","DialogFooter","outsideContent","footer","setFooter","observer","entry","entries","Dialog"],"sources":["../../../src/components/overlays/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { warnOnce } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport { slotRendersContent } from '../../lib/slot';\nimport type { ModalOpenChangeReason, ModalType, OpenChangeDetails } from '../../lib/types';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useModalLayer } from '../../hooks/useModalLayer';\nimport { Button } from '../button/Button';\nimport { Portal } from '../portal/Portal';\nimport {\n inertModalTrigger,\n ModalSurfaceContext,\n useBackdropPress,\n useModalClosePart,\n useModalDismiss,\n useModalOpenState,\n useModalTitle,\n useModalTrigger,\n useModalTriggerPart,\n useModalTriggerSession,\n useRequiredContext,\n useTitleRegistry,\n useUnnamedModalWarning,\n type ModalRequestOpen,\n type ModalSurfaceContextValue,\n type ModalTrigger,\n} from './Dialog.shared';\n\n/**\n * Why a {@link Dialog} asks to open or close: `trigger` (`Dialog.Trigger`), `close`\n * (`Dialog.Close`), `close-button` (the built-in Close button), `escape`, `outside-press` (the\n * backdrop). The shared `ModalOpenChangeReason`.\n */\nexport type DialogOpenChangeReason = ModalOpenChangeReason;\n\n/** The second argument of a {@link Dialog}'s `onOpenChange`: the reason and the DOM event. */\nexport type DialogOpenChangeDetails = OpenChangeDetails<DialogOpenChangeReason>;\n\n/**\n * How a {@link Dialog} blocks the page (the shared `ModalType`; Drawer reuses it when it gains\n * `modalType`).\n */\nexport type DialogModalType = ModalType;\n\n/** Properties for the Dialog component. */\nexport interface DialogProps {\n /**\n * Controlled open state of the dialog. The surface renders only in the browser: an open dialog\n * is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Default open state for uncontrolled usage. The surface renders only in the browser: a dialog\n * open by default is closed in the server HTML and opens once it has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Called with the new open state when it changes. `details.reason` tells how — `trigger`,\n * `close` (a `.Close` part), `close-button` (the built-in Close button), `escape` or\n * `outside-press` (the backdrop) — so a controlled dialog can refuse only some ways of closing\n * (for example keep a form with unsaved changes open on `outside-press`); `details.event` is the\n * DOM event behind the request. WaveUI always passes `details`; it is typed optional until 1.0\n * so that code which calls this prop itself keeps compiling.\n *\n * Fires only when the value changes; a controlled dialog stays as it is until the parent updates\n * `open`.\n */\n onOpenChange?: (open: boolean, details?: DialogOpenChangeDetails) => void;\n /**\n * `modal`: a backdrop press, Escape, the Close button and `Dialog.Close` close it. `alert`: a\n * confirmation that needs an answer — `role=\"alertdialog\"`, and a backdrop press does not close\n * it (Escape still does). Initial focus goes to the first focusable element, the built-in Close\n * button; give the least destructive action `autoFocus` to focus it instead. (`'non-modal'` is\n * planned.)\n * @default 'modal'\n */\n modalType?: DialogModalType;\n /**\n * Where focus goes when the dialog closes, if it can take focus. Otherwise focus returns to the\n * element that had focus when the dialog opened, then to the trigger, then to an element next to\n * where that opener was (the next row's action after a confirm dialog deleted the row). Use it to\n * send focus somewhere else.\n */\n finalFocusRef?: React.RefObject<HTMLElement | null>;\n /** `Dialog.Trigger` and `Dialog.Content`. */\n children: React.ReactNode;\n}\n\n/** Properties for the DialogContent sub-component. */\nexport interface DialogContentProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n /**\n * Title rendered as the dialog's heading; it names the dialog (`aria-labelledby`). Without it,\n * render a `Dialog.Title` or pass `aria-label`/`aria-labelledby`. A title that renders nothing\n * (`''`, `[]`, `true`) counts as none.\n */\n title?: React.ReactNode;\n /** Maximum width of the dialog: 400px (`small`) or 600px (`medium`); it never exceeds the viewport.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n /**\n * Accessible name of the built-in Close button (an icon-only button). Localize it with the\n * page's language.\n * @default 'Close'\n */\n closeLabel?: string;\n /** Content rendered inside the dialog body (put `Dialog.Footer` here as well). */\n children: React.ReactNode;\n /** Ref to the dialog surface (`role=\"dialog\"`, or `alertdialog` with `modalType=\"alert\"`). */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the DialogFooter sub-component. */\nexport interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Footer content, typically action buttons (wrap closing buttons in `Dialog.Close`). */\n children: React.ReactNode;\n /** Ref to the footer element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the DialogTitle sub-component. */\nexport interface DialogTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\n /** The title; any content. */\n children: React.ReactNode;\n /** Ref to the heading element. */\n ref?: React.Ref<HTMLHeadingElement>;\n}\n\n/** Props a `Dialog.Trigger` puts on its element (and passes to a render-prop child). */\nexport interface DialogTriggerRenderProps extends React.HTMLAttributes<HTMLElement> {\n 'aria-haspopup': 'dialog';\n 'aria-expanded': boolean;\n /** The dialog surface's id, while the dialog is open. */\n 'aria-controls'?: string;\n onClick: React.MouseEventHandler<HTMLElement>;\n /** A callback ref, so the props spread onto any element type. */\n ref: React.RefCallback<HTMLElement>;\n}\n\n/** Properties for the DialogTrigger sub-component. */\nexport interface DialogTriggerProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * The element that opens the dialog. A single element receives the trigger props (merged with\n * its own: handlers composed, classes joined, its own `id` kept); a function receives them.\n */\n children: React.ReactNode | ((props: DialogTriggerRenderProps) => React.ReactNode);\n /**\n * `false` renders the 0.4 wrapper `<span>` around the children instead of merging the trigger\n * props onto the child. The span carries the click handler; `aria-haspopup`, `aria-expanded`\n * and `aria-controls` go to the first element in the tab order inside it.\n * @default true\n */\n asChild?: boolean;\n /** Ref to the trigger element (the child, or the wrapper span). */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** Props a `Dialog.Close` puts on its element (and passes to a render-prop child). */\nexport interface DialogCloseRenderProps extends React.HTMLAttributes<HTMLElement> {\n onClick: React.MouseEventHandler<HTMLElement>;\n /** A callback ref, so the props spread onto any element type. */\n ref: React.RefCallback<HTMLElement>;\n}\n\n/** Properties for the DialogClose sub-component. */\nexport interface DialogCloseProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * The element that closes the dialog, typically a footer button. A single element receives an\n * `onClick` composed with its own (its handler runs first; `preventDefault()` keeps the dialog\n * open); a function receives the props.\n */\n children: React.ReactNode | ((props: DialogCloseRenderProps) => React.ReactNode);\n /** `false` renders a wrapper `<span>` that closes the dialog on click. @default true */\n asChild?: boolean;\n /** Ref to the close element (the child, or the wrapper span). */\n ref?: React.Ref<HTMLElement>;\n}\n\ninterface DialogContextValue {\n open: boolean;\n /** Asks the root to open or close, with the reason and event for `onOpenChange`. */\n requestOpen: ModalRequestOpen;\n /** The resolved `modalType`. */\n modalType: DialogModalType;\n /** The trigger element (`attach`) and the focus-restore target resolved from it (`focusRef`). */\n trigger: ModalTrigger;\n finalFocusRef: React.RefObject<HTMLElement | null> | undefined;\n /** The id of the open dialog surface (for the trigger's `aria-controls`), or `undefined`. */\n contentId: string | undefined;\n /** Registers the surface's id while it is mounted; returns the unregister function. */\n registerContentId: (id: string) => () => void;\n}\n\nconst DialogContext = React.createContext<DialogContextValue | null>(null);\nDialogContext.displayName = 'DialogContext';\n\nconst inertDialogContext: DialogContextValue = {\n open: false,\n requestOpen: () => {},\n modalType: 'modal',\n trigger: inertModalTrigger,\n finalFocusRef: undefined,\n contentId: undefined,\n registerContentId: () => () => {},\n};\n\nfunction useDialogContext(componentName: string): DialogContextValue {\n return useRequiredContext(DialogContext, componentName, 'Dialog', () => inertDialogContext);\n}\n\n// The root of `Dialog` (documented on the export below). A const arrow (like DrawerRoot): its type\n// can be named in consumers' declaration files, e.g. a story's `satisfies Meta<typeof Dialog>` (a\n// function declaration's `typeof` cannot, TS4023).\nconst DialogRoot = ({\n open,\n defaultOpen,\n onOpenChange,\n modalType = 'modal',\n finalFocusRef,\n children,\n}: DialogProps) => {\n const [openState, requestOpen] = useModalOpenState(open, defaultOpen, onOpenChange);\n // The surface lives in a portal, which renders only in the browser: until then (the server\n // HTML, hydration) the dialog reports itself closed, so the trigger's aria-expanded never\n // describes a dialog that is not there.\n const isClient = useIsClient();\n const isOpen = openState && isClient;\n const trigger = useModalTrigger();\n // After Dialog.Content's focus restore (a child's layout effects run first), start the trigger\n // session, or end it and forget the trigger that opened it.\n useModalTriggerSession(trigger, isOpen);\n const [contentId, setContentId] = React.useState<string | undefined>(undefined);\n const registerContentId = React.useCallback((id: string) => {\n setContentId(id);\n return () => setContentId((current) => (current === id ? undefined : current));\n }, []);\n\n const context = React.useMemo<DialogContextValue>(\n () => ({\n open: isOpen,\n requestOpen,\n modalType,\n trigger,\n finalFocusRef,\n contentId,\n registerContentId,\n }),\n [isOpen, requestOpen, modalType, trigger, finalFocusRef, contentId, registerContentId],\n );\n\n return <DialogContext.Provider value={context}>{children}</DialogContext.Provider>;\n};\nDialogRoot.displayName = 'Dialog';\n\n/**\n * Opens the dialog. Puts `aria-haspopup=\"dialog\"`, `aria-expanded`, `aria-controls` (while open), a\n * click handler and a ref on its single child (no wrapper element), or passes them to a\n * render-prop child. A custom child component must forward `ref` and spread its props; one that\n * does not is wrapped in a `<span>` automatically (with a development warning), the span that\n * `asChild={false}` renders. Focus returns to the trigger when the dialog closes (with several\n * triggers, to the one that opened it). On the span, the state ARIA goes to the first element in\n * the tab order inside it, and focus returns to that element (to the span when you made it the\n * trigger with a `role` such as `button` and `tabIndex={0}`, or when nothing inside it can take\n * focus).\n */\nexport const DialogTrigger = (props: DialogTriggerProps) => {\n const { open, requestOpen, trigger, contentId } = useDialogContext('Dialog.Trigger');\n return useModalTriggerPart<DialogTriggerRenderProps>(\n { open, requestOpen, trigger, controlsId: contentId },\n props,\n 'Dialog.Trigger',\n );\n};\nDialogTrigger.displayName = 'DialogTrigger';\n\n/**\n * Closes the dialog: composes a click handler onto its single child (its own `onClick` runs first;\n * calling `preventDefault()` there keeps the dialog open), or passes it to a render-prop child.\n *\n * @example\n * <Dialog.Close><Button appearance=\"subtle\">Cancel</Button></Dialog.Close>\n */\nexport const DialogClose = (props: DialogCloseProps) => {\n const { requestOpen } = useDialogContext('Dialog.Close');\n return useModalClosePart<DialogCloseRenderProps>(requestOpen, props, 'Dialog.Close');\n};\nDialogClose.displayName = 'DialogClose';\n\nconst sizeClasses: Record<'small' | 'medium', string> = {\n small: 'max-w-[400px]',\n medium: 'max-w-[600px]',\n};\n\n/**\n * The dialog surface, rendered in a portal (inheriting the WaveProvider theme) while the dialog is\n * open: backdrop, title, Close button and a scrolling body. It takes the full width up to its\n * `size` and never exceeds the viewport (the body scrolls). It is `role=\"dialog\"`, or\n * `role=\"alertdialog\"` when the Dialog has `modalType=\"alert\"` (a `role` you pass wins), and\n * carries `data-modal-type` with the resolved type.\n */\nexport const DialogContent = ({\n title,\n size = 'medium',\n closeLabel = 'Close',\n children,\n className,\n id,\n ref,\n ...rest\n}: DialogContentProps) => {\n const { open, requestOpen, modalType, trigger, finalFocusRef, registerContentId } =\n useDialogContext('Dialog.Content');\n const generatedId = useId('wave-dialog');\n const contentId = id ?? generatedId;\n const propTitleId = useId('wave-dialog-title');\n const titles = useTitleRegistry();\n\n const [surface, setSurface] = React.useState<HTMLDivElement | null>(null);\n const surfaceRef = React.useRef<HTMLDivElement | null>(null);\n const attachSurface = React.useCallback((node: HTMLDivElement | null) => {\n surfaceRef.current = node;\n setSurface(node);\n }, []);\n // Reports the surface's id to the root (the trigger's `aria-controls`) while it is mounted. A new\n // `id` makes a new callback, which useMergedRefs re-attaches after the commit (re-registering).\n const registerId = React.useCallback(\n (node: HTMLDivElement | null) => (node ? registerContentId(contentId) : undefined),\n [registerContentId, contentId],\n );\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, attachSurface, registerId);\n\n // An alert dialog needs an answer: a backdrop press does not close it (Escape still does).\n const closesOnBackdropPress = modalType !== 'alert';\n const backdropPress = useBackdropPress(surfaceRef, closesOnBackdropPress);\n const onDismiss = useModalDismiss(requestOpen, 'Dialog', backdropPress.afterOutsidePress);\n const layer = useModalLayer({\n open,\n onDismiss,\n refs: [surfaceRef],\n outsidePress: closesOnBackdropPress,\n container: surface,\n triggerRef: trigger.focusRef,\n finalFocusRef,\n });\n useUnnamedModalWarning(open ? surface : null, titles.hasTitle, 'Dialog.Content', 'Dialog.Title');\n\n // The height of the sticky Dialog.Footer, reserved as the body's scroll padding.\n const [footerHeight, setFooterHeight] = React.useState<number | null>(null);\n const surfaceContext = React.useMemo<ModalSurfaceContextValue>(\n () => ({ ...titles.context, setFooterHeight }),\n [titles.context],\n );\n\n if (!open) return null;\n\n const hasTitle = slotRendersContent(title);\n\n return (\n <Portal layerId={layer.layerId}>\n <div\n className=\"fixed inset-0 flex items-center justify-center bg-backdrop p-4\"\n onMouseDown={backdropPress.onMouseDown}\n >\n <div\n ref={mergedRef}\n role={modalType === 'alert' ? 'alertdialog' : 'dialog'}\n id={contentId}\n aria-labelledby={hasTitle ? propTitleId : titles.titleId}\n tabIndex={-1}\n data-modal-type={modalType}\n {...rest}\n className={cn(\n // The border marks the surface where the shadow cannot: in high contrast the page,\n // the backdrop and the surface are black, and forced colors drop shadows.\n 'relative flex max-h-[calc(100dvh-2rem)] w-full flex-col rounded-lg border border-border bg-background p-6 text-foreground shadow-64',\n sizeClasses[size],\n className,\n )}\n >\n <ModalSurfaceContext.Provider value={surfaceContext}>\n {hasTitle && (\n <h2 id={propTitleId} className=\"pe-8 text-subtitle-1 font-semibold\">\n {title}\n </h2>\n )}\n <Button\n appearance=\"subtle\"\n size=\"small\"\n icon={<DismissIcon />}\n aria-label={closeLabel}\n onClick={(event) =>\n requestOpen(false, { reason: 'close-button', event: event.nativeEvent })\n }\n className=\"absolute end-4 top-4 text-muted-foreground\"\n />\n <div\n // The scroll padding keeps a focused field above the sticky footer (WCAG 2.4.11).\n className=\"-mx-1 mt-1 min-h-0 flex-1 overflow-y-auto scroll-pb-(--wave-dialog-footer-height) p-1 text-body-1 text-muted-foreground\"\n style={\n footerHeight === null\n ? undefined\n : ({ '--wave-dialog-footer-height': `${footerHeight}px` } as React.CSSProperties)\n }\n >\n {children}\n </div>\n </ModalSurfaceContext.Provider>\n </div>\n </div>\n </Portal>\n );\n};\nDialogContent.displayName = 'DialogContent';\n\n/**\n * A heading that names the dialog (`aria-labelledby`), for rich titles or custom layouts. Render it\n * inside `Dialog.Content` (instead of the `title` prop). Like the `title` heading it reserves end\n * padding (`pe-8`) so a long first line stays clear of the Close button; a `className` padding wins.\n */\nexport const DialogTitle = ({ id, className, children, ref, ...rest }: DialogTitleProps) => {\n const { id: titleId, ref: titleRef } = useModalTitle('Dialog.Title', 'Dialog.Content', id, ref);\n return (\n <h2\n {...rest}\n id={titleId}\n ref={titleRef}\n className={cn('pe-8 text-subtitle-1 font-semibold text-foreground', className)}\n >\n {children}\n </h2>\n );\n};\nDialogTitle.displayName = 'DialogTitle';\n\n/**\n * `Dialog.Footer` inside `Dialog.Content`. The body is `p-1`, and sticky positioning stops at its\n * padding edge: `-bottom-1` with `-mb-1 pb-2` covers the body's bottom padding, `-mx-1 px-1` its\n * focus-ring inset, and `pt-3` separates the actions from the content scrolling under them.\n */\nconst stickyFooterClasses =\n 'sticky -bottom-1 z-10 -mx-1 -mb-1 mt-6 flex justify-end gap-2 bg-background px-1 pb-2 pt-3';\n\n/**\n * `Dialog.Footer` where no body reserves its height as scroll padding (a Drawer's body): a plain\n * action row, which never covers a focused field.\n */\nconst footerRowClasses = 'mt-6 flex justify-end gap-2';\n\n/**\n * Action row at the end of the dialog body. It stays where you render it in the DOM and sticks to\n * the bottom of the body while long content scrolls under it (with an opaque background); the body\n * reserves its height as scroll padding, so a focused field is never hidden behind it. Inside a\n * `<form>` that wraps the fields and the footer it sticks too: make it the form's last child.\n * Render it inside `Dialog.Content`: outside it, it would stay on the page while the dialog is\n * closed (a development warning says so). Inside a `Drawer`, whose body reserves no footer height,\n * it does not stick: it is an action row at the end of the content. Render one `Dialog.Footer` per\n * `Dialog.Content`: with two at once, the body reserves the height of the one measured last, and\n * unmounting either clears it until the other resizes (swapping one footer for another is fine).\n */\nexport const DialogFooter = ({ children, className, ref, ...rest }: DialogFooterProps) => {\n const surfaceContext = React.useContext(ModalSurfaceContext);\n const outsideContent = surfaceContext === null;\n const setFooterHeight = surfaceContext?.setFooterHeight;\n const [footer, setFooter] = React.useState<HTMLDivElement | null>(null);\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, setFooter);\n\n React.useEffect(() => {\n if (!outsideContent) return;\n warnOnce(\n 'Dialog.Footer:outside-content',\n 'Dialog.Footer must be rendered inside Dialog.Content. Outside it, the footer stays on the page while the dialog is closed.',\n );\n }, [outsideContent]);\n\n // Reports the footer's border-box height to Dialog.Content. The observer's first callback,\n // delivered before the next paint, supplies the first value; without ResizeObserver the body\n // keeps its default scroll padding.\n React.useLayoutEffect(() => {\n if (!footer || !setFooterHeight || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver((entries) => {\n const entry = entries[entries.length - 1];\n if (!entry) return;\n setFooterHeight(entry.borderBoxSize?.[0]?.blockSize ?? footer.offsetHeight);\n });\n observer.observe(footer, { box: 'border-box' });\n return () => {\n observer.disconnect();\n setFooterHeight(null);\n };\n }, [footer, setFooterHeight]);\n\n return (\n <div\n ref={mergedRef}\n {...rest}\n // Sticky only where the surface reserves the footer's height (Dialog.Content).\n className={cn(setFooterHeight ? stickyFooterClasses : footerRowClasses, className)}\n >\n {children}\n </div>\n );\n};\nDialogFooter.displayName = 'DialogFooter';\n\n/**\n * A modal dialog (Fluent UI v2 style): `Dialog` holds the open state; `Dialog.Trigger` opens it and\n * `Dialog.Content` renders the surface in a portal while open.\n *\n * - **Modal**: focus moves into the dialog and Tab stays inside it (toasts included), the rest of\n * the page is `inert` (instead of `aria-modal`, so toasts and live regions stay announced), and\n * the page does not scroll.\n * - **Closing**: Escape (only the topmost layer: a popup opened inside closes first), a click on\n * the backdrop (a drag that starts inside does not close it), the Close button and `Dialog.Close`.\n * `onOpenChange` gets the reason as its second argument (`details.reason`), so a controlled\n * dialog can refuse some of them. A backdrop press blurs the focused field before the dialog\n * closes, so a typed value is committed as with the Close button; when a controlled dialog\n * refuses the press, the field gets focus back (an alert dialog's press leaves focus where it\n * was). Focus returns to the first of these that can take focus: `finalFocusRef`, the element\n * that had focus when the dialog opened, the trigger, an element next to where that opener was.\n * - **Alert dialogs**: `modalType=\"alert\"` renders `role=\"alertdialog\"` for a confirmation that\n * needs an answer; a backdrop press does not close it.\n * - **Footer**: `Dialog.Footer` sticks to the bottom of the scrolling body, and the body keeps a\n * focused field above it.\n * - **Naming**: give `Dialog.Content` a `title`, a `Dialog.Title`, or `aria-label`.\n *\n * The sub-components are also exported under flat names (`DialogTrigger`, `DialogContent`,\n * `DialogFooter`, `DialogTitle`, `DialogClose`) for React Server Components, which cannot use the\n * dotted form; dotted access (`Dialog.Content`) needs a client file.\n *\n * @example\n * <Dialog>\n * <Dialog.Trigger><Button>Delete</Button></Dialog.Trigger>\n * <Dialog.Content title=\"Delete file?\">\n * This cannot be undone.\n * <Dialog.Footer>\n * <Dialog.Close><Button appearance=\"subtle\">Cancel</Button></Dialog.Close>\n * <Button appearance=\"primary\" onClick={remove}>Delete</Button>\n * </Dialog.Footer>\n * </Dialog.Content>\n * </Dialog>\n */\nexport const Dialog = /* @__PURE__ */ Object.assign(DialogRoot, {\n Trigger: DialogTrigger,\n Content: DialogContent,\n Footer: DialogFooter,\n Title: DialogTitle,\n Close: DialogClose,\n});\n"],"mappings":"qhBAqMA,IAAMmC,EAAgBnC,EAAM,cAAyC,IAAI,EACzE,EAAc,YAAc,gBAE5B,IAAMoC,EAAyC,CAC7C,KAAM,GACN,gBAAmB,CAAC,EACpB,UAAW,QACX,QAASnC,EAAAA,kBACT,cAAe,IAAA,GACf,UAAW,IAAA,GACX,0BAA+B,CAAC,CAClC,EAEA,SAASoC,EAAiB,EAA2C,CACnE,OAAOnC,EAAAA,mBAAmBiC,EAAeG,EAAe,aAAgBF,CAAkB,CAC5F,CAKA,IAAMG,GAAc,CAClB,OACA,cACA,eACA,YAAY,QACZ,gBACA,cACiB,CACjB,GAAM,CAACC,EAAWC,GAAetC,EAAAA,kBAAkBuC,EAAMC,EAAaC,CAAY,EAI5EC,EAAWzC,EAAAA,YAAY,EACvB0C,EAASN,GAAaK,EACtBE,EAAU1C,EAAAA,gBAAgB,EAGhC2B,EAAA,uBAAuBe,EAASD,CAAM,EACtC,GAAM,CAACE,EAAWC,GAAgBjD,EAAM,SAA6B,IAAA,EAAS,EACxEkD,EAAoBlD,EAAM,YAAa,IAC3CiD,EAAaE,CAAE,MACFF,EAAc,GAAaG,IAAYD,EAAK,IAAA,GAAYC,CAAQ,GAC5E,CAAC,CAAC,EAECC,EAAUrD,EAAM,aACb,CACL,KAAM8C,EACN,cACA,YACA,UACA,gBACA,YACA,mBACF,GACA,CAACA,EAAQL,EAAaa,EAAWP,EAASQ,EAAeP,EAAWE,CAAiB,CACvF,EAEA,OAAO,EAAAhB,EAAA,IAAA,CAACC,EAAc,SAAf,CAAwB,MAAOkB,EAAU,UAAiC,CAAA,CACnF,EACA,EAAW,YAAc,SAazB,IAAaG,EAAiB,GAA8B,CAC1D,GAAM,CAAE,OAAM,cAAa,UAAS,aAAcnB,EAAiB,gBAAgB,EACnF,OAA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C,EAAAA,GAAG8D,EAAkBW,EAAsBC,EAAkBP,CAAS,EAEhF,UACE,CAAA,CAET,EACA,EAAa,YAAc,eAuC3B,IAAae,EAAyB,OAAO,OAAO3D,EAAY,CAC9D,QAASiB,EACT,QAASI,EACT,OAAQ+B,EACR,MAAOL,EACP,MAAO5B,CACT,CAAC"}
@@ -0,0 +1,180 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { warnOnce as t } from "../../lib/dev.mjs";
4
+ import { slotRendersContent as n } from "../../lib/slot.mjs";
5
+ import { useId as r } from "../../hooks/useId.mjs";
6
+ import { useMergedRefs as i } from "../../hooks/useMergedRefs.mjs";
7
+ import { useIsClient as a } from "../../hooks/useIsClient.mjs";
8
+ import { Portal as o } from "../portal/Portal.mjs";
9
+ import { Button as s } from "../button/Button.mjs";
10
+ import { DismissIcon as c } from "../../lib/icons.mjs";
11
+ import { useModalLayer as l } from "../../hooks/useModalLayer.mjs";
12
+ import { ModalSurfaceContext as u, inertModalTrigger as d, useBackdropPress as f, useModalClosePart as p, useModalDismiss as m, useModalOpenState as h, useModalTitle as g, useModalTrigger as _, useModalTriggerPart as v, useModalTriggerSession as y, useRequiredContext as b, useTitleRegistry as x, useUnnamedModalWarning as S } from "./Dialog.shared.mjs";
13
+ import * as C from "react";
14
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
15
+ //#region src/components/overlays/Dialog.tsx
16
+ var E = C.createContext(null);
17
+ E.displayName = "DialogContext";
18
+ var D = {
19
+ open: !1,
20
+ requestOpen: () => {},
21
+ modalType: "modal",
22
+ trigger: d,
23
+ finalFocusRef: void 0,
24
+ contentId: void 0,
25
+ registerContentId: () => () => {}
26
+ };
27
+ function O(e) {
28
+ return b(E, e, "Dialog", () => D);
29
+ }
30
+ var k = ({ open: e, defaultOpen: t, onOpenChange: n, modalType: r = "modal", finalFocusRef: i, children: o }) => {
31
+ let [s, c] = h(e, t, n), l = a(), u = s && l, d = _();
32
+ y(d, u);
33
+ let [f, p] = C.useState(void 0), m = C.useCallback((e) => (p(e), () => p((t) => t === e ? void 0 : t)), []), g = C.useMemo(() => ({
34
+ open: u,
35
+ requestOpen: c,
36
+ modalType: r,
37
+ trigger: d,
38
+ finalFocusRef: i,
39
+ contentId: f,
40
+ registerContentId: m
41
+ }), [
42
+ u,
43
+ c,
44
+ r,
45
+ d,
46
+ i,
47
+ f,
48
+ m
49
+ ]);
50
+ return /* @__PURE__ */ w(E.Provider, {
51
+ value: g,
52
+ children: o
53
+ });
54
+ };
55
+ k.displayName = "Dialog";
56
+ var A = (e) => {
57
+ let { open: t, requestOpen: n, trigger: r, contentId: i } = O("Dialog.Trigger");
58
+ return v({
59
+ open: t,
60
+ requestOpen: n,
61
+ trigger: r,
62
+ controlsId: i
63
+ }, e, "Dialog.Trigger");
64
+ };
65
+ A.displayName = "DialogTrigger";
66
+ var j = (e) => {
67
+ let { requestOpen: t } = O("Dialog.Close");
68
+ return p(t, e, "Dialog.Close");
69
+ };
70
+ j.displayName = "DialogClose";
71
+ var M = {
72
+ small: "max-w-[400px]",
73
+ medium: "max-w-[600px]"
74
+ }, N = ({ title: t, size: a = "medium", closeLabel: d = "Close", children: p, className: h, id: g, ref: _, ...v }) => {
75
+ let { open: y, requestOpen: b, modalType: E, trigger: D, finalFocusRef: k, registerContentId: A } = O("Dialog.Content"), j = r("wave-dialog"), N = g ?? j, P = r("wave-dialog-title"), F = x(), [I, L] = C.useState(null), R = C.useRef(null), z = C.useCallback((e) => {
76
+ R.current = e, L(e);
77
+ }, []), B = C.useCallback((e) => e ? A(N) : void 0, [A, N]), V = i(_, z, B), H = E !== "alert", U = f(R, H), W = m(b, "Dialog", U.afterOutsidePress), G = l({
78
+ open: y,
79
+ onDismiss: W,
80
+ refs: [R],
81
+ outsidePress: H,
82
+ container: I,
83
+ triggerRef: D.focusRef,
84
+ finalFocusRef: k
85
+ });
86
+ S(y ? I : null, F.hasTitle, "Dialog.Content", "Dialog.Title");
87
+ let [K, q] = C.useState(null), J = C.useMemo(() => ({
88
+ ...F.context,
89
+ setFooterHeight: q
90
+ }), [F.context]);
91
+ if (!y) return null;
92
+ let Y = n(t);
93
+ return /* @__PURE__ */ w(o, {
94
+ layerId: G.layerId,
95
+ children: /* @__PURE__ */ w("div", {
96
+ className: "fixed inset-0 flex items-center justify-center bg-backdrop p-4",
97
+ onMouseDown: U.onMouseDown,
98
+ children: /* @__PURE__ */ w("div", {
99
+ ref: V,
100
+ role: E === "alert" ? "alertdialog" : "dialog",
101
+ id: N,
102
+ "aria-labelledby": Y ? P : F.titleId,
103
+ tabIndex: -1,
104
+ "data-modal-type": E,
105
+ ...v,
106
+ className: e("relative flex max-h-[calc(100dvh-2rem)] w-full flex-col rounded-lg border border-border bg-background p-6 text-foreground shadow-64", M[a], h),
107
+ children: /* @__PURE__ */ T(u.Provider, {
108
+ value: J,
109
+ children: [
110
+ Y && /* @__PURE__ */ w("h2", {
111
+ id: P,
112
+ className: "pe-8 text-subtitle-1 font-semibold",
113
+ children: t
114
+ }),
115
+ /* @__PURE__ */ w(s, {
116
+ appearance: "subtle",
117
+ size: "small",
118
+ icon: /* @__PURE__ */ w(c, {}),
119
+ "aria-label": d,
120
+ onClick: (e) => b(!1, {
121
+ reason: "close-button",
122
+ event: e.nativeEvent
123
+ }),
124
+ className: "absolute end-4 top-4 text-muted-foreground"
125
+ }),
126
+ /* @__PURE__ */ w("div", {
127
+ className: "-mx-1 mt-1 min-h-0 flex-1 overflow-y-auto scroll-pb-(--wave-dialog-footer-height) p-1 text-body-1 text-muted-foreground",
128
+ style: K === null ? void 0 : { "--wave-dialog-footer-height": `${K}px` },
129
+ children: p
130
+ })
131
+ ]
132
+ })
133
+ })
134
+ })
135
+ });
136
+ };
137
+ N.displayName = "DialogContent";
138
+ var P = ({ id: t, className: n, children: r, ref: i, ...a }) => {
139
+ let { id: o, ref: s } = g("Dialog.Title", "Dialog.Content", t, i);
140
+ return /* @__PURE__ */ w("h2", {
141
+ ...a,
142
+ id: o,
143
+ ref: s,
144
+ className: e("pe-8 text-subtitle-1 font-semibold text-foreground", n),
145
+ children: r
146
+ });
147
+ };
148
+ P.displayName = "DialogTitle";
149
+ var F = "sticky -bottom-1 z-10 -mx-1 -mb-1 mt-6 flex justify-end gap-2 bg-background px-1 pb-2 pt-3", I = "mt-6 flex justify-end gap-2", L = ({ children: n, className: r, ref: a, ...o }) => {
150
+ let s = C.useContext(u), c = s === null, l = s?.setFooterHeight, [d, f] = C.useState(null), p = i(a, f);
151
+ return C.useEffect(() => {
152
+ c && t("Dialog.Footer:outside-content", "Dialog.Footer must be rendered inside Dialog.Content. Outside it, the footer stays on the page while the dialog is closed.");
153
+ }, [c]), C.useLayoutEffect(() => {
154
+ if (!d || !l || typeof ResizeObserver > "u") return;
155
+ let e = new ResizeObserver((e) => {
156
+ let t = e[e.length - 1];
157
+ t && l(t.borderBoxSize?.[0]?.blockSize ?? d.offsetHeight);
158
+ });
159
+ return e.observe(d, { box: "border-box" }), () => {
160
+ e.disconnect(), l(null);
161
+ };
162
+ }, [d, l]), /* @__PURE__ */ w("div", {
163
+ ref: p,
164
+ ...o,
165
+ className: e(l ? F : I, r),
166
+ children: n
167
+ });
168
+ };
169
+ L.displayName = "DialogFooter";
170
+ var R = /* @__PURE__ */ Object.assign(k, {
171
+ Trigger: A,
172
+ Content: N,
173
+ Footer: L,
174
+ Title: P,
175
+ Close: j
176
+ });
177
+ //#endregion
178
+ export { R as Dialog, j as DialogClose, N as DialogContent, L as DialogFooter, P as DialogTitle, A as DialogTrigger };
179
+
180
+ //# sourceMappingURL=Dialog.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.mjs","names":["useId","useId$1","React","DialogContext","inertDialogContext","inertModalTrigger","useDialogContext","useRequiredContext","componentName","DialogRoot","openState","requestOpen","useModalOpenState","open","defaultOpen","onOpenChange","isClient","useIsClient","isOpen","trigger","useModalTrigger","contentId","setContentId","registerContentId","id","current","context","modalType","finalFocusRef","DialogTrigger","useModalTriggerPart","props","DialogClose","useModalClosePart","sizeClasses","DialogContent","rest","generatedId","propTitleId","titles","useTitleRegistry","surface","setSurface","surfaceRef","attachSurface","node","registerId","mergedRef","useMergedRefs","ref","closesOnBackdropPress","backdropPress","useBackdropPress","onDismiss","useModalDismiss","layer","useModalLayer","footerHeight","setFooterHeight","surfaceContext","hasTitle","slotRendersContent","title","Portal","cn","size","className","ModalSurfaceContext","Button","DismissIcon","closeLabel","event","DialogTitle","titleId","titleRef","useModalTitle","stickyFooterClasses","footerRowClasses","DialogFooter","outsideContent","footer","setFooter","warnOnce","observer","entry","entries","Dialog"],"sources":["../../../src/components/overlays/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport { warnOnce } from '../../lib/dev';\nimport { DismissIcon } from '../../lib/icons';\nimport { slotRendersContent } from '../../lib/slot';\nimport type { ModalOpenChangeReason, ModalType, OpenChangeDetails } from '../../lib/types';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { useModalLayer } from '../../hooks/useModalLayer';\nimport { Button } from '../button/Button';\nimport { Portal } from '../portal/Portal';\nimport {\n inertModalTrigger,\n ModalSurfaceContext,\n useBackdropPress,\n useModalClosePart,\n useModalDismiss,\n useModalOpenState,\n useModalTitle,\n useModalTrigger,\n useModalTriggerPart,\n useModalTriggerSession,\n useRequiredContext,\n useTitleRegistry,\n useUnnamedModalWarning,\n type ModalRequestOpen,\n type ModalSurfaceContextValue,\n type ModalTrigger,\n} from './Dialog.shared';\n\n/**\n * Why a {@link Dialog} asks to open or close: `trigger` (`Dialog.Trigger`), `close`\n * (`Dialog.Close`), `close-button` (the built-in Close button), `escape`, `outside-press` (the\n * backdrop). The shared `ModalOpenChangeReason`.\n */\nexport type DialogOpenChangeReason = ModalOpenChangeReason;\n\n/** The second argument of a {@link Dialog}'s `onOpenChange`: the reason and the DOM event. */\nexport type DialogOpenChangeDetails = OpenChangeDetails<DialogOpenChangeReason>;\n\n/**\n * How a {@link Dialog} blocks the page (the shared `ModalType`; Drawer reuses it when it gains\n * `modalType`).\n */\nexport type DialogModalType = ModalType;\n\n/** Properties for the Dialog component. */\nexport interface DialogProps {\n /**\n * Controlled open state of the dialog. The surface renders only in the browser: an open dialog\n * is closed in the server HTML and opens once it has hydrated.\n */\n open?: boolean;\n /**\n * Default open state for uncontrolled usage. The surface renders only in the browser: a dialog\n * open by default is closed in the server HTML and opens once it has hydrated.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Called with the new open state when it changes. `details.reason` tells how — `trigger`,\n * `close` (a `.Close` part), `close-button` (the built-in Close button), `escape` or\n * `outside-press` (the backdrop) — so a controlled dialog can refuse only some ways of closing\n * (for example keep a form with unsaved changes open on `outside-press`); `details.event` is the\n * DOM event behind the request. WaveUI always passes `details`; it is typed optional until 1.0\n * so that code which calls this prop itself keeps compiling.\n *\n * Fires only when the value changes; a controlled dialog stays as it is until the parent updates\n * `open`.\n */\n onOpenChange?: (open: boolean, details?: DialogOpenChangeDetails) => void;\n /**\n * `modal`: a backdrop press, Escape, the Close button and `Dialog.Close` close it. `alert`: a\n * confirmation that needs an answer — `role=\"alertdialog\"`, and a backdrop press does not close\n * it (Escape still does). Initial focus goes to the first focusable element, the built-in Close\n * button; give the least destructive action `autoFocus` to focus it instead. (`'non-modal'` is\n * planned.)\n * @default 'modal'\n */\n modalType?: DialogModalType;\n /**\n * Where focus goes when the dialog closes, if it can take focus. Otherwise focus returns to the\n * element that had focus when the dialog opened, then to the trigger, then to an element next to\n * where that opener was (the next row's action after a confirm dialog deleted the row). Use it to\n * send focus somewhere else.\n */\n finalFocusRef?: React.RefObject<HTMLElement | null>;\n /** `Dialog.Trigger` and `Dialog.Content`. */\n children: React.ReactNode;\n}\n\n/** Properties for the DialogContent sub-component. */\nexport interface DialogContentProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n /**\n * Title rendered as the dialog's heading; it names the dialog (`aria-labelledby`). Without it,\n * render a `Dialog.Title` or pass `aria-label`/`aria-labelledby`. A title that renders nothing\n * (`''`, `[]`, `true`) counts as none.\n */\n title?: React.ReactNode;\n /** Maximum width of the dialog: 400px (`small`) or 600px (`medium`); it never exceeds the viewport.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n /**\n * Accessible name of the built-in Close button (an icon-only button). Localize it with the\n * page's language.\n * @default 'Close'\n */\n closeLabel?: string;\n /** Content rendered inside the dialog body (put `Dialog.Footer` here as well). */\n children: React.ReactNode;\n /** Ref to the dialog surface (`role=\"dialog\"`, or `alertdialog` with `modalType=\"alert\"`). */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the DialogFooter sub-component. */\nexport interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Footer content, typically action buttons (wrap closing buttons in `Dialog.Close`). */\n children: React.ReactNode;\n /** Ref to the footer element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/** Properties for the DialogTitle sub-component. */\nexport interface DialogTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\n /** The title; any content. */\n children: React.ReactNode;\n /** Ref to the heading element. */\n ref?: React.Ref<HTMLHeadingElement>;\n}\n\n/** Props a `Dialog.Trigger` puts on its element (and passes to a render-prop child). */\nexport interface DialogTriggerRenderProps extends React.HTMLAttributes<HTMLElement> {\n 'aria-haspopup': 'dialog';\n 'aria-expanded': boolean;\n /** The dialog surface's id, while the dialog is open. */\n 'aria-controls'?: string;\n onClick: React.MouseEventHandler<HTMLElement>;\n /** A callback ref, so the props spread onto any element type. */\n ref: React.RefCallback<HTMLElement>;\n}\n\n/** Properties for the DialogTrigger sub-component. */\nexport interface DialogTriggerProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * The element that opens the dialog. A single element receives the trigger props (merged with\n * its own: handlers composed, classes joined, its own `id` kept); a function receives them.\n */\n children: React.ReactNode | ((props: DialogTriggerRenderProps) => React.ReactNode);\n /**\n * `false` renders the 0.4 wrapper `<span>` around the children instead of merging the trigger\n * props onto the child. The span carries the click handler; `aria-haspopup`, `aria-expanded`\n * and `aria-controls` go to the first element in the tab order inside it.\n * @default true\n */\n asChild?: boolean;\n /** Ref to the trigger element (the child, or the wrapper span). */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** Props a `Dialog.Close` puts on its element (and passes to a render-prop child). */\nexport interface DialogCloseRenderProps extends React.HTMLAttributes<HTMLElement> {\n onClick: React.MouseEventHandler<HTMLElement>;\n /** A callback ref, so the props spread onto any element type. */\n ref: React.RefCallback<HTMLElement>;\n}\n\n/** Properties for the DialogClose sub-component. */\nexport interface DialogCloseProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n /**\n * The element that closes the dialog, typically a footer button. A single element receives an\n * `onClick` composed with its own (its handler runs first; `preventDefault()` keeps the dialog\n * open); a function receives the props.\n */\n children: React.ReactNode | ((props: DialogCloseRenderProps) => React.ReactNode);\n /** `false` renders a wrapper `<span>` that closes the dialog on click. @default true */\n asChild?: boolean;\n /** Ref to the close element (the child, or the wrapper span). */\n ref?: React.Ref<HTMLElement>;\n}\n\ninterface DialogContextValue {\n open: boolean;\n /** Asks the root to open or close, with the reason and event for `onOpenChange`. */\n requestOpen: ModalRequestOpen;\n /** The resolved `modalType`. */\n modalType: DialogModalType;\n /** The trigger element (`attach`) and the focus-restore target resolved from it (`focusRef`). */\n trigger: ModalTrigger;\n finalFocusRef: React.RefObject<HTMLElement | null> | undefined;\n /** The id of the open dialog surface (for the trigger's `aria-controls`), or `undefined`. */\n contentId: string | undefined;\n /** Registers the surface's id while it is mounted; returns the unregister function. */\n registerContentId: (id: string) => () => void;\n}\n\nconst DialogContext = React.createContext<DialogContextValue | null>(null);\nDialogContext.displayName = 'DialogContext';\n\nconst inertDialogContext: DialogContextValue = {\n open: false,\n requestOpen: () => {},\n modalType: 'modal',\n trigger: inertModalTrigger,\n finalFocusRef: undefined,\n contentId: undefined,\n registerContentId: () => () => {},\n};\n\nfunction useDialogContext(componentName: string): DialogContextValue {\n return useRequiredContext(DialogContext, componentName, 'Dialog', () => inertDialogContext);\n}\n\n// The root of `Dialog` (documented on the export below). A const arrow (like DrawerRoot): its type\n// can be named in consumers' declaration files, e.g. a story's `satisfies Meta<typeof Dialog>` (a\n// function declaration's `typeof` cannot, TS4023).\nconst DialogRoot = ({\n open,\n defaultOpen,\n onOpenChange,\n modalType = 'modal',\n finalFocusRef,\n children,\n}: DialogProps) => {\n const [openState, requestOpen] = useModalOpenState(open, defaultOpen, onOpenChange);\n // The surface lives in a portal, which renders only in the browser: until then (the server\n // HTML, hydration) the dialog reports itself closed, so the trigger's aria-expanded never\n // describes a dialog that is not there.\n const isClient = useIsClient();\n const isOpen = openState && isClient;\n const trigger = useModalTrigger();\n // After Dialog.Content's focus restore (a child's layout effects run first), start the trigger\n // session, or end it and forget the trigger that opened it.\n useModalTriggerSession(trigger, isOpen);\n const [contentId, setContentId] = React.useState<string | undefined>(undefined);\n const registerContentId = React.useCallback((id: string) => {\n setContentId(id);\n return () => setContentId((current) => (current === id ? undefined : current));\n }, []);\n\n const context = React.useMemo<DialogContextValue>(\n () => ({\n open: isOpen,\n requestOpen,\n modalType,\n trigger,\n finalFocusRef,\n contentId,\n registerContentId,\n }),\n [isOpen, requestOpen, modalType, trigger, finalFocusRef, contentId, registerContentId],\n );\n\n return <DialogContext.Provider value={context}>{children}</DialogContext.Provider>;\n};\nDialogRoot.displayName = 'Dialog';\n\n/**\n * Opens the dialog. Puts `aria-haspopup=\"dialog\"`, `aria-expanded`, `aria-controls` (while open), a\n * click handler and a ref on its single child (no wrapper element), or passes them to a\n * render-prop child. A custom child component must forward `ref` and spread its props; one that\n * does not is wrapped in a `<span>` automatically (with a development warning), the span that\n * `asChild={false}` renders. Focus returns to the trigger when the dialog closes (with several\n * triggers, to the one that opened it). On the span, the state ARIA goes to the first element in\n * the tab order inside it, and focus returns to that element (to the span when you made it the\n * trigger with a `role` such as `button` and `tabIndex={0}`, or when nothing inside it can take\n * focus).\n */\nexport const DialogTrigger = (props: DialogTriggerProps) => {\n const { open, requestOpen, trigger, contentId } = useDialogContext('Dialog.Trigger');\n return useModalTriggerPart<DialogTriggerRenderProps>(\n { open, requestOpen, trigger, controlsId: contentId },\n props,\n 'Dialog.Trigger',\n );\n};\nDialogTrigger.displayName = 'DialogTrigger';\n\n/**\n * Closes the dialog: composes a click handler onto its single child (its own `onClick` runs first;\n * calling `preventDefault()` there keeps the dialog open), or passes it to a render-prop child.\n *\n * @example\n * <Dialog.Close><Button appearance=\"subtle\">Cancel</Button></Dialog.Close>\n */\nexport const DialogClose = (props: DialogCloseProps) => {\n const { requestOpen } = useDialogContext('Dialog.Close');\n return useModalClosePart<DialogCloseRenderProps>(requestOpen, props, 'Dialog.Close');\n};\nDialogClose.displayName = 'DialogClose';\n\nconst sizeClasses: Record<'small' | 'medium', string> = {\n small: 'max-w-[400px]',\n medium: 'max-w-[600px]',\n};\n\n/**\n * The dialog surface, rendered in a portal (inheriting the WaveProvider theme) while the dialog is\n * open: backdrop, title, Close button and a scrolling body. It takes the full width up to its\n * `size` and never exceeds the viewport (the body scrolls). It is `role=\"dialog\"`, or\n * `role=\"alertdialog\"` when the Dialog has `modalType=\"alert\"` (a `role` you pass wins), and\n * carries `data-modal-type` with the resolved type.\n */\nexport const DialogContent = ({\n title,\n size = 'medium',\n closeLabel = 'Close',\n children,\n className,\n id,\n ref,\n ...rest\n}: DialogContentProps) => {\n const { open, requestOpen, modalType, trigger, finalFocusRef, registerContentId } =\n useDialogContext('Dialog.Content');\n const generatedId = useId('wave-dialog');\n const contentId = id ?? generatedId;\n const propTitleId = useId('wave-dialog-title');\n const titles = useTitleRegistry();\n\n const [surface, setSurface] = React.useState<HTMLDivElement | null>(null);\n const surfaceRef = React.useRef<HTMLDivElement | null>(null);\n const attachSurface = React.useCallback((node: HTMLDivElement | null) => {\n surfaceRef.current = node;\n setSurface(node);\n }, []);\n // Reports the surface's id to the root (the trigger's `aria-controls`) while it is mounted. A new\n // `id` makes a new callback, which useMergedRefs re-attaches after the commit (re-registering).\n const registerId = React.useCallback(\n (node: HTMLDivElement | null) => (node ? registerContentId(contentId) : undefined),\n [registerContentId, contentId],\n );\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, attachSurface, registerId);\n\n // An alert dialog needs an answer: a backdrop press does not close it (Escape still does).\n const closesOnBackdropPress = modalType !== 'alert';\n const backdropPress = useBackdropPress(surfaceRef, closesOnBackdropPress);\n const onDismiss = useModalDismiss(requestOpen, 'Dialog', backdropPress.afterOutsidePress);\n const layer = useModalLayer({\n open,\n onDismiss,\n refs: [surfaceRef],\n outsidePress: closesOnBackdropPress,\n container: surface,\n triggerRef: trigger.focusRef,\n finalFocusRef,\n });\n useUnnamedModalWarning(open ? surface : null, titles.hasTitle, 'Dialog.Content', 'Dialog.Title');\n\n // The height of the sticky Dialog.Footer, reserved as the body's scroll padding.\n const [footerHeight, setFooterHeight] = React.useState<number | null>(null);\n const surfaceContext = React.useMemo<ModalSurfaceContextValue>(\n () => ({ ...titles.context, setFooterHeight }),\n [titles.context],\n );\n\n if (!open) return null;\n\n const hasTitle = slotRendersContent(title);\n\n return (\n <Portal layerId={layer.layerId}>\n <div\n className=\"fixed inset-0 flex items-center justify-center bg-backdrop p-4\"\n onMouseDown={backdropPress.onMouseDown}\n >\n <div\n ref={mergedRef}\n role={modalType === 'alert' ? 'alertdialog' : 'dialog'}\n id={contentId}\n aria-labelledby={hasTitle ? propTitleId : titles.titleId}\n tabIndex={-1}\n data-modal-type={modalType}\n {...rest}\n className={cn(\n // The border marks the surface where the shadow cannot: in high contrast the page,\n // the backdrop and the surface are black, and forced colors drop shadows.\n 'relative flex max-h-[calc(100dvh-2rem)] w-full flex-col rounded-lg border border-border bg-background p-6 text-foreground shadow-64',\n sizeClasses[size],\n className,\n )}\n >\n <ModalSurfaceContext.Provider value={surfaceContext}>\n {hasTitle && (\n <h2 id={propTitleId} className=\"pe-8 text-subtitle-1 font-semibold\">\n {title}\n </h2>\n )}\n <Button\n appearance=\"subtle\"\n size=\"small\"\n icon={<DismissIcon />}\n aria-label={closeLabel}\n onClick={(event) =>\n requestOpen(false, { reason: 'close-button', event: event.nativeEvent })\n }\n className=\"absolute end-4 top-4 text-muted-foreground\"\n />\n <div\n // The scroll padding keeps a focused field above the sticky footer (WCAG 2.4.11).\n className=\"-mx-1 mt-1 min-h-0 flex-1 overflow-y-auto scroll-pb-(--wave-dialog-footer-height) p-1 text-body-1 text-muted-foreground\"\n style={\n footerHeight === null\n ? undefined\n : ({ '--wave-dialog-footer-height': `${footerHeight}px` } as React.CSSProperties)\n }\n >\n {children}\n </div>\n </ModalSurfaceContext.Provider>\n </div>\n </div>\n </Portal>\n );\n};\nDialogContent.displayName = 'DialogContent';\n\n/**\n * A heading that names the dialog (`aria-labelledby`), for rich titles or custom layouts. Render it\n * inside `Dialog.Content` (instead of the `title` prop). Like the `title` heading it reserves end\n * padding (`pe-8`) so a long first line stays clear of the Close button; a `className` padding wins.\n */\nexport const DialogTitle = ({ id, className, children, ref, ...rest }: DialogTitleProps) => {\n const { id: titleId, ref: titleRef } = useModalTitle('Dialog.Title', 'Dialog.Content', id, ref);\n return (\n <h2\n {...rest}\n id={titleId}\n ref={titleRef}\n className={cn('pe-8 text-subtitle-1 font-semibold text-foreground', className)}\n >\n {children}\n </h2>\n );\n};\nDialogTitle.displayName = 'DialogTitle';\n\n/**\n * `Dialog.Footer` inside `Dialog.Content`. The body is `p-1`, and sticky positioning stops at its\n * padding edge: `-bottom-1` with `-mb-1 pb-2` covers the body's bottom padding, `-mx-1 px-1` its\n * focus-ring inset, and `pt-3` separates the actions from the content scrolling under them.\n */\nconst stickyFooterClasses =\n 'sticky -bottom-1 z-10 -mx-1 -mb-1 mt-6 flex justify-end gap-2 bg-background px-1 pb-2 pt-3';\n\n/**\n * `Dialog.Footer` where no body reserves its height as scroll padding (a Drawer's body): a plain\n * action row, which never covers a focused field.\n */\nconst footerRowClasses = 'mt-6 flex justify-end gap-2';\n\n/**\n * Action row at the end of the dialog body. It stays where you render it in the DOM and sticks to\n * the bottom of the body while long content scrolls under it (with an opaque background); the body\n * reserves its height as scroll padding, so a focused field is never hidden behind it. Inside a\n * `<form>` that wraps the fields and the footer it sticks too: make it the form's last child.\n * Render it inside `Dialog.Content`: outside it, it would stay on the page while the dialog is\n * closed (a development warning says so). Inside a `Drawer`, whose body reserves no footer height,\n * it does not stick: it is an action row at the end of the content. Render one `Dialog.Footer` per\n * `Dialog.Content`: with two at once, the body reserves the height of the one measured last, and\n * unmounting either clears it until the other resizes (swapping one footer for another is fine).\n */\nexport const DialogFooter = ({ children, className, ref, ...rest }: DialogFooterProps) => {\n const surfaceContext = React.useContext(ModalSurfaceContext);\n const outsideContent = surfaceContext === null;\n const setFooterHeight = surfaceContext?.setFooterHeight;\n const [footer, setFooter] = React.useState<HTMLDivElement | null>(null);\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, setFooter);\n\n React.useEffect(() => {\n if (!outsideContent) return;\n warnOnce(\n 'Dialog.Footer:outside-content',\n 'Dialog.Footer must be rendered inside Dialog.Content. Outside it, the footer stays on the page while the dialog is closed.',\n );\n }, [outsideContent]);\n\n // Reports the footer's border-box height to Dialog.Content. The observer's first callback,\n // delivered before the next paint, supplies the first value; without ResizeObserver the body\n // keeps its default scroll padding.\n React.useLayoutEffect(() => {\n if (!footer || !setFooterHeight || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver((entries) => {\n const entry = entries[entries.length - 1];\n if (!entry) return;\n setFooterHeight(entry.borderBoxSize?.[0]?.blockSize ?? footer.offsetHeight);\n });\n observer.observe(footer, { box: 'border-box' });\n return () => {\n observer.disconnect();\n setFooterHeight(null);\n };\n }, [footer, setFooterHeight]);\n\n return (\n <div\n ref={mergedRef}\n {...rest}\n // Sticky only where the surface reserves the footer's height (Dialog.Content).\n className={cn(setFooterHeight ? stickyFooterClasses : footerRowClasses, className)}\n >\n {children}\n </div>\n );\n};\nDialogFooter.displayName = 'DialogFooter';\n\n/**\n * A modal dialog (Fluent UI v2 style): `Dialog` holds the open state; `Dialog.Trigger` opens it and\n * `Dialog.Content` renders the surface in a portal while open.\n *\n * - **Modal**: focus moves into the dialog and Tab stays inside it (toasts included), the rest of\n * the page is `inert` (instead of `aria-modal`, so toasts and live regions stay announced), and\n * the page does not scroll.\n * - **Closing**: Escape (only the topmost layer: a popup opened inside closes first), a click on\n * the backdrop (a drag that starts inside does not close it), the Close button and `Dialog.Close`.\n * `onOpenChange` gets the reason as its second argument (`details.reason`), so a controlled\n * dialog can refuse some of them. A backdrop press blurs the focused field before the dialog\n * closes, so a typed value is committed as with the Close button; when a controlled dialog\n * refuses the press, the field gets focus back (an alert dialog's press leaves focus where it\n * was). Focus returns to the first of these that can take focus: `finalFocusRef`, the element\n * that had focus when the dialog opened, the trigger, an element next to where that opener was.\n * - **Alert dialogs**: `modalType=\"alert\"` renders `role=\"alertdialog\"` for a confirmation that\n * needs an answer; a backdrop press does not close it.\n * - **Footer**: `Dialog.Footer` sticks to the bottom of the scrolling body, and the body keeps a\n * focused field above it.\n * - **Naming**: give `Dialog.Content` a `title`, a `Dialog.Title`, or `aria-label`.\n *\n * The sub-components are also exported under flat names (`DialogTrigger`, `DialogContent`,\n * `DialogFooter`, `DialogTitle`, `DialogClose`) for React Server Components, which cannot use the\n * dotted form; dotted access (`Dialog.Content`) needs a client file.\n *\n * @example\n * <Dialog>\n * <Dialog.Trigger><Button>Delete</Button></Dialog.Trigger>\n * <Dialog.Content title=\"Delete file?\">\n * This cannot be undone.\n * <Dialog.Footer>\n * <Dialog.Close><Button appearance=\"subtle\">Cancel</Button></Dialog.Close>\n * <Button appearance=\"primary\" onClick={remove}>Delete</Button>\n * </Dialog.Footer>\n * </Dialog.Content>\n * </Dialog>\n */\nexport const Dialog = /* @__PURE__ */ Object.assign(DialogRoot, {\n Trigger: DialogTrigger,\n Content: DialogContent,\n Footer: DialogFooter,\n Title: DialogTitle,\n Close: DialogClose,\n});\n"],"mappings":";;;;;;;;;;;;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AAkBC,GAAgB,iBAClC,CAACqB,GAAQC,KAAa/E,EAAM,SAAgC,IAAI,GAChE6C,IAAYC,EAA8BC,GAAKgC,CAAS;CA2B9D,OAzBA/E,EAAM,gBAAgB;EACpB,AAAK6E,KACLG,EACE,iCACA,4HACF;CACF,GAAG,CAACH,CAAc,CAAC,GAKnB7E,EAAM,sBAAsB;EAC1B,IAAI,CAAC8E,KAAU,CAACtB,KAAmB,OAAO,iBAAmB,KAAa;EAC1E,IAAMyB,IAAW,IAAI,gBAAgB,MAAY;GAC/C,IAAMC,IAAQC,EAAQA,EAAQ,SAAS;GACvC,AAAKD,KACL1B,EAAgB0B,EAAM,gBAAgB,EAAE,EAAE,aAAaJ,EAAO,YAAY;EAC5E,CAAC;EAED,OADAG,EAAS,QAAQH,GAAQ,EAAE,KAAK,aAAa,CAAC,SACjC;GAEX,AADAG,EAAS,WAAW,GACpBzB,EAAgB,IAAI;EACtB;CACF,GAAG,CAACsB,GAAQtB,CAAe,CAAC,GAG1B,kBAAC,OAAD;EACE,KAAKX;EACL,GAAIX;EAEJ,WAAW4B,EAAGN,IAAkBkB,IAAsBC,GAAkBX,CAAS;EAEhF;CACE,CAAA;AAET;AACA,EAAa,cAAc;AAuC3B,IAAaoB,IAAyB,uBAAO,OAAO7E,GAAY;CAC9D,SAASoB;CACT,SAASM;CACT,QAAQ2C;CACR,OAAON;CACP,OAAOxC;AACT,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/dev.cjs"),n=require("../../hooks/useControllable.cjs"),r=require("../../hooks/useId.cjs"),i=require("../../lib/focus.cjs"),a=require("../../hooks/useMergedRefs.cjs"),o=require("../../lib/mergeProps.cjs"),s=require("../../lib/renderTrigger.cjs"),c=require("../../hooks/useTriggerElement.cjs");let l=require("react");l=e.__toESM(l,1);function u(e,t,r){let i=l.useRef(void 0),[a,o]=n.useControllable(e,t??!1,e=>r?.(e,i.current));return[a,l.useCallback((e,t)=>{i.current=t;try{o(e)}finally{i.current=void 0}},[o])]}function d(e,n,r){return l.useCallback((i,a)=>{switch(i){case`escape`:e(!1,{reason:i,event:a});break;case`outside-press`:e(!1,{reason:i,event:a}),r?.();break;case`focus-outside`:t.warnOnce(`${n}:focus-outside`,`${n} ignored a focus-outside dismissal: a modal surface does not close when focus leaves it.`);break;default:return i}},[e,n,r])}function f(e,t){let n=l.useRef(null);return{onMouseDown:l.useCallback(r=>{if(r.target!==r.currentTarget)return;if(!t){r.preventDefault();return}let i=_();n.current=i&&e.current?.contains(i)?i:null},[t,e]),afterOutsidePress:l.useCallback(()=>{let t=n.current;n.current=null,t&&queueMicrotask(()=>{_()===null&&e.current?.contains(t)&&i.focusElement(t,{preventScroll:!0})})},[e])}}function p(e){return typeof e==`object`&&!!e&&typeof e.type==`string`&&typeof e.stopPropagation==`function`&&!(`nativeEvent`in e)}function m(e){let t=typeof e==`object`&&e?e.nativeEvent:void 0;return p(t)?t:p(e)?e:new Event(`click`)}var h={attach:()=>void 0,activate:()=>{},startSession:()=>{},endSession:()=>{},focusRef:{current:null}};function g(e){return typeof e==`object`&&!!e&&e.nodeType===1}function _(){if(typeof document>`u`)return null;let e=document.activeElement;return!e||e===document.body||e===document.documentElement?null:e.isConnected?e:null}function v(){let e=new Set,t=null,n=!1;return{attach:n=>{if(n)return e.add(n),()=>{e.delete(n),t===n&&(t=null)}},activate:e=>{g(e)&&(t=e,!n&&setTimeout(()=>{!n&&t===e&&(t=null)},0))},startSession:()=>{n=!0},endSession:()=>{n=!1,t=null},focusRef:{get current(){let n=_();if(n)return e.has(n)?c.getTriggerFocusTarget(n):null;if(t?.isConnected)return c.getTriggerFocusTarget(t);for(let t of e){if(!t.isConnected)continue;let e=c.getTriggerFocusTarget(t);if(e)return e}return null}}}}function y(){let[e]=l.useState(v);return e}function b(e){let t=null;return{attach:n=>{if(!n)return;t=n;let r=e.attach(n);return()=>{t===n&&(t=null),typeof r==`function`&&r()}},activate:n=>{let r=typeof n==`object`&&n?n.currentTarget:void 0;e.activate(t??r)}}}function x(e){return l.useMemo(()=>b(e),[e])}function S(e,{children:t,asChild:n,ref:r,...i},u){let{open:d,requestOpen:f,trigger:p,controlsId:h}=e,{attach:g,activate:_}=x(p),v=a.useMergedRefs(g,r),y=l.useCallback(e=>{_(e),f(!0,{reason:`trigger`,event:m(e)})},[_,f]),b=o.mergeProps({"aria-haspopup":`dialog`,"aria-expanded":d,"aria-controls":d?h:void 0,onClick:y,ref:v},i,{oursWin:s.STATE_ARIA});return c.useTriggerElement(t,b,{componentName:u,asChild:n})}function C(e,{children:t,asChild:n,ref:r,...i},s){let u=a.useMergedRefs(r),d=l.useCallback(t=>e(!1,{reason:`close`,event:m(t)}),[e]),f=o.mergeProps({onClick:d,ref:u},i);return c.useTriggerElement(t,f,{componentName:s,asChild:n})}function w(e,t){l.useLayoutEffect(()=>{t?e.startSession():e.endSession()},[e,t])}function T(e,n,r,i){let a=l.useContext(e);return a===null?(t.reportMissingContext(n,r),i()):a}var E=l.createContext(null);E.displayName=`ModalSurfaceContext`;var D={registerTitle:()=>()=>{}};function O(){let[e,t]=l.useState([]),n=l.useRef(0),r=l.useCallback(e=>{n.current+=1,t(t=>[...t,e]);let r=!0;return()=>{r&&(r=!1,--n.current,t(t=>{let n=t.indexOf(e);return n===-1?t:[...t.slice(0,n),...t.slice(n+1)]}))}},[]),i=l.useCallback(()=>n.current>0,[]),a=l.useMemo(()=>({registerTitle:r}),[r]);return{titleId:e[0],hasTitle:i,context:a}}function k(e,t,n,i){let{registerTitle:o}=T(E,e,t,()=>D),s=r.useId(`wave-modal-title`),c=n??s,u=l.useCallback(e=>e?o(c):void 0,[o,c]);return{id:c,ref:a.useMergedRefs(i,u)}}function A(e,n,r,i){l.useEffect(()=>{e&&(e.hasAttribute(`aria-label`)||e.hasAttribute(`aria-labelledby`)||n()||t.warnOnce(`${r}:unnamed`,`${r} has no accessible name. Pass \`title\`, render a ${i} inside it, or give it \`aria-label\` or \`aria-labelledby\`.`))},[e,n,r,i])}exports.ModalSurfaceContext=E,exports.getNativeEvent=m,exports.inertModalTrigger=h,exports.useBackdropPress=f,exports.useModalClosePart=C,exports.useModalDismiss=d,exports.useModalOpenState=u,exports.useModalTitle=k,exports.useModalTrigger=y,exports.useModalTriggerPart=S,exports.useModalTriggerSession=w,exports.useRequiredContext=T,exports.useTitleRegistry=O,exports.useUnnamedModalWarning=A;
2
+ //# sourceMappingURL=Dialog.shared.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.shared.cjs","names":["React","useControllable","unmapped","getTriggerFocusTarget","useMergedRefs","mergeProps","STATE_ARIA","useTriggerElement","useId","require_runtime","require_dev","require_useControllable","require_useId","require_focus","require_useMergedRefs","require_mergeProps","require_renderTrigger","require_useTriggerElement","react","useModalOpenState","detailsRef","value","setOpen","open","defaultOpen","onOpenChange","next","details","useModalDismiss","reason","requestOpen","afterOutsidePress","componentName","useBackdropPress","pressFocusRef","event","closesOnPress","focused","getFocusedElement","surfaceRef","element","isDomEvent","getNativeEvent","native","inertModalTrigger","isElementTarget","target","active","createModalTrigger","attached","activated","sessionOpen","useModalTrigger","trigger","createModalTriggerElement","node","detach","currentTarget","useModalTriggerElement","useModalTriggerPart","rest","modal","mergedRef","attach","ref","openModal","activate","triggerProps","controlsId","children","useModalClosePart","close","closeProps","useModalTriggerSession","useRequiredContext","context","parentName","getInert","ModalSurfaceContext","inertSurface","useTitleRegistry","ids","setIds","countRef","registerTitle","current","id","registered","index","hasTitle","useModalTitle","generatedId","idProp","register","useUnnamedModalWarning","surface","titleName"],"sources":["../../../src/components/overlays/Dialog.shared.tsx"],"sourcesContent":["import * as React from 'react';\nimport { reportMissingContext, warnOnce } from '../../lib/dev';\nimport { focusElement } from '../../lib/focus';\nimport type { DismissReason } from '../../lib/layers';\nimport { mergeProps } from '../../lib/mergeProps';\nimport { STATE_ARIA } from '../../lib/renderTrigger';\nimport type { ModalOpenChangeReason, OpenChangeDetails } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { getTriggerFocusTarget, useTriggerElement } from '../../hooks/useTriggerElement';\n\n/*\n * Internal helpers shared by Dialog and Drawer (P15). Not exported from the package.\n */\n\n/** Why a modal root asks to open or close, and the event (`DialogOpenChangeDetails`). */\nexport type ModalOpenChangeDetails = OpenChangeDetails<ModalOpenChangeReason>;\n\n/** Asks a modal root to open or close; see {@link useModalOpenState}. */\nexport type ModalRequestOpen = (open: boolean, details: ModalOpenChangeDetails) => void;\n\n/**\n * The open state of a modal root (`Dialog`, `Drawer`): `useControllable`, plus the details of the\n * request behind each change. Every internal path asks through `requestOpen(next, details)`, which\n * writes `details` to a ref, calls the setter and clears the ref once the setter returns.\n * `useControllable` calls its `onChange` synchronously inside the setter, only when the value\n * changes, and that `onChange` passes the ref's details on as `onOpenChange(next, details)`.\n * Clearing the ref afterwards means a change that no request caused can never report a stale\n * reason.\n */\nexport function useModalOpenState(\n open: boolean | undefined,\n defaultOpen: boolean | undefined,\n onOpenChange: ((open: boolean, details?: ModalOpenChangeDetails) => void) | undefined,\n): [open: boolean, requestOpen: ModalRequestOpen] {\n const detailsRef = React.useRef<ModalOpenChangeDetails | undefined>(undefined);\n const [value, setOpen] = useControllable(open, defaultOpen ?? false, (next: boolean) =>\n onOpenChange?.(next, detailsRef.current),\n );\n const requestOpen = React.useCallback<ModalRequestOpen>(\n (next, details) => {\n detailsRef.current = details;\n try {\n setOpen(next);\n } finally {\n detailsRef.current = undefined;\n }\n },\n [setOpen],\n );\n return [value, requestOpen];\n}\n\n/**\n * The `onDismiss` of a modal root's layer (`useModalLayer`): Escape and a backdrop press ask the\n * root to close, with their reason and event. `focus-outside` never reaches a modal layer (only a\n * layer registered with `focusOutside: true` gets it), so it is ignored with a development warning.\n *\n * @param requestOpen The root's request function, from {@link useModalOpenState}.\n * @param componentName The public name for the warning, e.g. `'Dialog'`.\n * @param afterOutsidePress Called right after an `outside-press` request (see\n * {@link useBackdropPress}).\n */\nexport function useModalDismiss(\n requestOpen: ModalRequestOpen,\n componentName: string,\n afterOutsidePress?: () => void,\n): (reason: DismissReason, event: Event) => void {\n return React.useCallback(\n (reason: DismissReason, event: Event) => {\n switch (reason) {\n case 'escape':\n requestOpen(false, { reason, event });\n break;\n case 'outside-press':\n requestOpen(false, { reason, event });\n afterOutsidePress?.();\n break;\n case 'focus-outside':\n warnOnce(\n `${componentName}:focus-outside`,\n `${componentName} ignored a focus-outside dismissal: a modal surface does not close when focus leaves it.`,\n );\n break;\n default: {\n // Exhaustive: a new DismissReason does not compile here until it is mapped.\n const unmapped: never = reason;\n return unmapped;\n }\n }\n },\n [requestOpen, componentName, afterOutsidePress],\n );\n}\n\n/** Returned by {@link useBackdropPress}. */\nexport interface BackdropPress {\n /** `onMouseDown` of the backdrop element. Stable while `closesOnPress` stays the same. */\n onMouseDown: (event: React.MouseEvent<HTMLElement>) => void;\n /** Pass it to {@link useModalDismiss}, which calls it after an `outside-press` request. Stable. */\n afterOutsidePress: () => void;\n}\n\n/**\n * What a press on a modal's backdrop does to focus (`Dialog.Content`, the Drawer panel). Presses\n * that start inside the surface bubble through unchanged.\n *\n * - When the press closes the modal (`closesOnPress`), the browser moves focus to `<body>` as\n * usual, so the focused control blurs while it is still mounted and its blur-time commit runs\n * (the typed text of a SpinButton or a picker, a consumer's `onBlur` autosave or validation)\n * before the click closes the surface. The element inside the surface that had focus is\n * remembered: when the surface is still open after the `outside-press` request (a controlled\n * modal refused it), it gets focus back, in a microtask that runs after React has committed the\n * request, and only while focus is still on `<body>` (a confirm dialog the refusal opened keeps\n * its focus).\n * - When the press never closes the modal (an alert dialog), the press does not move focus at all\n * (`preventDefault()`), so nothing blurs.\n *\n * @param surfaceRef The surface element (the dialog or the drawer panel).\n * @param closesOnPress Whether a backdrop press asks the modal to close (its layer's `outsidePress`).\n */\nexport function useBackdropPress(\n surfaceRef: React.RefObject<HTMLElement | null>,\n closesOnPress: boolean,\n): BackdropPress {\n // The element inside the surface that had focus when the last backdrop press started.\n const pressFocusRef = React.useRef<HTMLElement | null>(null);\n\n const onMouseDown = React.useCallback(\n (event: React.MouseEvent<HTMLElement>) => {\n if (event.target !== event.currentTarget) return;\n if (!closesOnPress) {\n event.preventDefault();\n return;\n }\n const focused = getFocusedElement();\n pressFocusRef.current = focused && surfaceRef.current?.contains(focused) ? focused : null;\n },\n [closesOnPress, surfaceRef],\n );\n\n const afterOutsidePress = React.useCallback(() => {\n const element = pressFocusRef.current;\n pressFocusRef.current = null;\n if (!element) return;\n // A close requested from the click is committed first (React flushes the update in a\n // microtask queued before this one), so a closed surface no longer contains the element.\n queueMicrotask(() => {\n if (getFocusedElement() !== null || !surfaceRef.current?.contains(element)) return;\n focusElement(element, { preventScroll: true });\n });\n }, [surfaceRef]);\n\n return { onMouseDown, afterOutsidePress };\n}\n\n/** Whether `value` is a DOM event (duck-typed, so an event from another window counts too). */\nfunction isDomEvent(value: unknown): value is Event {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as Partial<Event>).type === 'string' &&\n typeof (value as Partial<Event>).stopPropagation === 'function' &&\n !('nativeEvent' in value)\n );\n}\n\n/**\n * The DOM event behind a part's click handler call: a React event's `nativeEvent`, or a DOM event\n * passed as is. A render-prop child that calls the handler without its event (or with another\n * value) gets a new `click` event, so `details.event` is always an event.\n */\nexport function getNativeEvent(value: unknown): Event {\n const native =\n typeof value === 'object' && value !== null\n ? (value as { nativeEvent?: unknown }).nativeEvent\n : undefined;\n if (isDomEvent(native)) return native;\n if (isDomEvent(value)) return value;\n return new Event('click');\n}\n\n/** Returned by {@link useModalTrigger}. */\nexport interface ModalTrigger {\n /**\n * Callback ref for the element a trigger renders: the consumer's child, or the wrapper `<span>`\n * of `asChild={false}` and of the automatic fallback for a child that does not forward its ref.\n * Every trigger of the root attaches it (a root may have several). It returns a React 19 cleanup\n * that forgets that one element, so a trigger that unmounts never unregisters another. Stable.\n */\n attach: React.RefCallback<HTMLElement>;\n /**\n * Records the trigger that is opening the modal, for the open session that follows (anything that\n * is not an element is ignored). Focus returns to that trigger, not to another one of the same\n * root. Triggers call it through {@link useModalTriggerPart}.\n *\n * An activation the modal did not open for by the end of the task (a click that the parent of a\n * controlled modal rejected) is dropped, so it does not decide where focus returns after a later\n * open that no trigger started. React commits an accepted open within the same task.\n */\n activate: (target: unknown) => void;\n /**\n * Starts the open session: the activated trigger belongs to it until {@link endSession}.\n * {@link useModalTriggerSession} calls it when the modal opens.\n */\n startSession: () => void;\n /**\n * Ends the open session: forgets the activated trigger, so it does not decide where focus\n * returns after a later open that no trigger started. {@link useModalTriggerSession} calls it\n * when the modal closes.\n */\n endSession: () => void;\n /**\n * The focus-restore target, for the modal layer's `triggerRef`. Its `current` is resolved when it\n * is read (when the modal opens, and again on close if the opener captured then cannot take\n * focus any more):\n *\n * 1. `null` while an element other than `<body>` has focus: that element opened the modal (the\n * clicked trigger, the button inside a trigger's wrapper span, or the parent's own button of\n * a controlled modal), and the restore captures it. A trigger element itself with focus (a\n * `tabIndex={-1}` wrapper span that a press focused, as Safari does for a click on the button\n * inside it) resolves like any trigger instead.\n * 2. Otherwise (Safari does not focus a clicked button; a modal opened from code), the trigger\n * activated in this open session while it is still in the document.\n * 3. Otherwise the first mounted trigger that can take focus.\n *\n * A trigger resolves with `getTriggerFocusTarget`, the rule of every trigger's focus return: the\n * element that carries the state ARIA (the button inside a wrapper span, the span when you made\n * it the trigger), else the first tabbable element inside it, else itself when it can take\n * focus, else `null`. Read-only.\n */\n focusRef: React.RefObject<HTMLElement | null>;\n}\n\n/** A trigger for components rendered outside their root (C-CONTEXT inert fallback). */\nexport const inertModalTrigger: ModalTrigger = {\n attach: () => undefined,\n activate: () => {},\n startSession: () => {},\n endSession: () => {},\n focusRef: { current: null },\n};\n\nfunction isElementTarget(target: unknown): target is HTMLElement {\n return typeof target === 'object' && target !== null && (target as Partial<Node>).nodeType === 1;\n}\n\n/** The element that has focus, or `null` when focus is on `<body>` (or nowhere). */\nfunction getFocusedElement(): HTMLElement | null {\n if (typeof document === 'undefined') return null;\n const active = document.activeElement;\n if (!active || active === document.body || active === document.documentElement) return null;\n return active.isConnected ? (active as HTMLElement) : null;\n}\n\nfunction createModalTrigger(): ModalTrigger {\n // Every mounted trigger element, in the order they attached.\n const attached = new Set<HTMLElement>();\n // The trigger clicked in the current open session (or in the task that is opening it);\n // forgotten when the modal closes, when the element detaches, or when no open followed the click.\n let activated: HTMLElement | null = null;\n // Whether an open session is running (between startSession and endSession).\n let sessionOpen = false;\n return {\n attach: (element) => {\n // Detaching runs the cleanup below (React 19 and useMergedRefs call it instead of passing\n // `null`), which knows which element leaves.\n if (!element) return undefined;\n attached.add(element);\n return () => {\n attached.delete(element);\n if (activated === element) activated = null;\n };\n },\n activate: (target) => {\n if (!isElementTarget(target)) return;\n activated = target;\n if (sessionOpen) return;\n // An accepted open commits before the next task starts; a rejected click leaves the modal\n // closed, and its activation must not outlive the task.\n setTimeout(() => {\n if (!sessionOpen && activated === target) activated = null;\n }, 0);\n },\n startSession: () => {\n sessionOpen = true;\n },\n endSession: () => {\n sessionOpen = false;\n activated = null;\n },\n focusRef: {\n get current() {\n // A focused element is the opener: the restore captures it (see ModalTrigger.focusRef),\n // unless it is a trigger element, which resolves like any trigger.\n const focused = getFocusedElement();\n if (focused) return attached.has(focused) ? getTriggerFocusTarget(focused) : null;\n // The trigger that opened the modal decides, also when it cannot take focus any more.\n if (activated?.isConnected) return getTriggerFocusTarget(activated);\n for (const element of attached) {\n if (!element.isConnected) continue;\n const target = getTriggerFocusTarget(element);\n if (target) return target;\n }\n return null;\n },\n },\n };\n}\n\n/**\n * The triggers of a modal root (`Dialog`, `Drawer`), overlays#9. Each `Dialog.Trigger`/\n * `Drawer.Trigger` attaches its element and activates it from its click handler through\n * {@link useModalTriggerPart}; the root passes `focusRef` to `useModalLayer` as its\n * `triggerRef` and scopes the activation to one open session with {@link useModalTriggerSession}.\n * Focus returns to the element that had focus when the modal opened; when nothing had focus, to\n * the trigger that opened it, else to the first mounted trigger. For a wrapper `<span>`, the\n * restore target is the element inside it that carries the state ARIA. Resolving when the ref is\n * read, not when it attaches, keeps a trigger that was disabled at mount (or whose content\n * changed) a valid target.\n */\nexport function useModalTrigger(): ModalTrigger {\n const [trigger] = React.useState(createModalTrigger);\n return trigger;\n}\n\n/** Returned by {@link useModalTriggerElement}. */\ninterface ModalTriggerElement {\n /**\n * Callback ref for the element one trigger renders (merge it with the consumer's ref): registers\n * it with the root's triggers and remembers it for `activate`. Stable.\n */\n attach: React.RefCallback<HTMLElement>;\n /**\n * Records this trigger as the one opening the modal: call it from the click handler, before\n * opening, with whatever the handler received. The element `attach` received wins, else the\n * event's `currentTarget`, so a render-prop child that calls `onClick()` without the event (or\n * with another value) is still recorded. Stable.\n */\n activate: (event?: unknown) => void;\n}\n\nfunction createModalTriggerElement(trigger: ModalTrigger): ModalTriggerElement {\n // The element this trigger rendered; a closure variable, not a React ref, so the click handler\n // that reads it can be passed around during render (C-HOOKS).\n let element: HTMLElement | null = null;\n return {\n attach: (node) => {\n if (!node) return undefined;\n element = node;\n const detach = trigger.attach(node);\n return () => {\n if (element === node) element = null;\n if (typeof detach === 'function') detach();\n };\n },\n activate: (event) => {\n const currentTarget =\n typeof event === 'object' && event !== null\n ? (event as { currentTarget?: unknown }).currentTarget\n : undefined;\n trigger.activate(element ?? currentTarget);\n },\n };\n}\n\n/**\n * One `Dialog.Trigger`/`Drawer.Trigger` of a modal root (overlays#9): attach `attach` to the\n * element the trigger renders and call `activate` from its click handler.\n */\nfunction useModalTriggerElement(trigger: ModalTrigger): ModalTriggerElement {\n return React.useMemo(() => createModalTriggerElement(trigger), [trigger]);\n}\n\n/** The props of a trigger or close part (`Dialog.Trigger`, `Drawer.Close`, …). */\nexport interface ModalPartProps<RenderProps> extends Omit<\n React.HTMLAttributes<HTMLElement>,\n 'children'\n> {\n /** A single element that receives the part's props, or a function that receives them. */\n children: React.ReactNode | ((props: RenderProps) => React.ReactNode);\n /** `false` renders a wrapper `<span>` carrying the click handler. */\n asChild?: boolean;\n /** Ref to the element the part renders. */\n ref?: React.Ref<HTMLElement>;\n}\n\n/** What {@link useModalTriggerPart} reads from the modal root. */\nexport interface ModalTriggerState {\n open: boolean;\n /** Asks the root to open (reason `trigger`). */\n requestOpen: ModalRequestOpen;\n trigger: ModalTrigger;\n /** The surface's id for `aria-controls` while the modal is open. */\n controlsId: string | undefined;\n}\n\n/**\n * Renders a `Dialog.Trigger`/`Drawer.Trigger`: its element gets `aria-haspopup=\"dialog\"`,\n * `aria-expanded`, `aria-controls` (while open; these always win over the child's own), a click\n * handler that records the trigger (for the focus return) and asks the root to open (reason\n * `trigger`, with the click event), and a ref that registers it with the root's triggers. On a\n * wrapper span (`asChild={false}`, the automatic fallback), the state ARIA goes to the first\n * element in the tab order inside it (`useTriggerElement`).\n *\n * @param modal The root's state, from its context.\n * @param props The part's props.\n * @param componentName The public name for development warnings, e.g. `'Dialog.Trigger'`.\n */\nexport function useModalTriggerPart<RenderProps>(\n modal: ModalTriggerState,\n { children, asChild, ref, ...rest }: ModalPartProps<RenderProps>,\n componentName: string,\n): React.ReactNode {\n const { open, requestOpen, trigger, controlsId } = modal;\n const { attach, activate } = useModalTriggerElement(trigger);\n const mergedRef = useMergedRefs<HTMLElement>(attach, ref);\n const openModal = React.useCallback(\n (event?: React.MouseEvent<HTMLElement>) => {\n // Focus returns to this trigger, also when the root has several (overlays#9), and also when\n // a render-prop child calls `onClick()` without the event.\n activate(event);\n requestOpen(true, { reason: 'trigger', event: getNativeEvent(event) });\n },\n [activate, requestOpen],\n );\n\n const stateAria = {\n 'aria-haspopup': 'dialog' as const,\n 'aria-expanded': open,\n 'aria-controls': open ? controlsId : undefined,\n };\n const triggerProps = mergeProps({ ...stateAria, onClick: openModal, ref: mergedRef }, rest, {\n oursWin: STATE_ARIA,\n });\n\n return useTriggerElement(children, triggerProps as RenderProps, { componentName, asChild });\n}\n\n/**\n * Renders a `Dialog.Close`/`Drawer.Close`: composes a click handler that asks the root to close\n * (reason `close`, with the click event) onto its element (the child's own `onClick` runs first;\n * `preventDefault()` there keeps the modal open).\n *\n * @param requestOpen The root's request function, from its context.\n * @param props The part's props.\n * @param componentName The public name for development warnings, e.g. `'Dialog.Close'`.\n */\nexport function useModalClosePart<RenderProps>(\n requestOpen: ModalRequestOpen,\n { children, asChild, ref, ...rest }: ModalPartProps<RenderProps>,\n componentName: string,\n): React.ReactNode {\n const mergedRef = useMergedRefs<HTMLElement>(ref);\n const close = React.useCallback(\n (event?: React.MouseEvent<HTMLElement>) =>\n requestOpen(false, { reason: 'close', event: getNativeEvent(event) }),\n [requestOpen],\n );\n const closeProps = mergeProps({ onClick: close, ref: mergedRef }, rest);\n return useTriggerElement(children, closeProps as RenderProps, { componentName, asChild });\n}\n\n/**\n * Scopes a trigger's activation to one open session (overlays#9): when the modal opens, the\n * activated trigger joins the session; when it closes, the trigger is forgotten, so a later open\n * that no trigger started (a controlled modal opened by the parent) does not return focus to it.\n *\n * It updates the session in a layout effect, after the modal's focus restore has used the\n * activation: call it in the root component (whose effects run after its children's) and, when\n * that component also calls `useModalLayer`, after that call (a component's effects run in order).\n */\nexport function useModalTriggerSession(trigger: ModalTrigger, open: boolean): void {\n React.useLayoutEffect(() => {\n if (open) trigger.startSession();\n else trigger.endSession();\n }, [trigger, open]);\n}\n\n/**\n * C-CONTEXT: reads a compound component's context. Outside its root it throws\n * `[WaveUI] <componentName> must be used within <parentName>` in development, and in production\n * logs the same message once per page (`reportMissingContext`) and returns the inert value from\n * `getInert`.\n */\nexport function useRequiredContext<T>(\n context: React.Context<T | null>,\n componentName: string,\n parentName: string,\n getInert: () => T,\n): T {\n const value = React.useContext(context);\n if (value !== null) return value;\n reportMissingContext(componentName, parentName);\n return getInert();\n}\n\n/** What a modal surface (`Dialog.Content`, the Drawer panel) provides to its descendants. */\nexport interface ModalSurfaceContextValue {\n /**\n * Registers the id of a title element (`Dialog.Title`, `Drawer.Title`) for the surface's\n * `aria-labelledby`. Returns the unregister function.\n */\n registerTitle: (id: string) => () => void;\n /**\n * Receives the measured border-box height of the surface's sticky footer (`Dialog.Footer`) in\n * px, or `null` once it unmounts; the surface reserves it as the scroll padding of its body.\n * Absent on a surface without a footer part (the Drawer panel).\n */\n setFooterHeight?: (px: number | null) => void;\n}\n\n/**\n * Provided by every modal surface; `null` outside one. Titles register with it, and\n * `Dialog.Footer` reads it to report its height and to warn when it is rendered outside\n * `Dialog.Content`.\n */\nexport const ModalSurfaceContext = React.createContext<ModalSurfaceContextValue | null>(null);\nModalSurfaceContext.displayName = 'ModalSurfaceContext';\n\nconst inertSurface: ModalSurfaceContextValue = { registerTitle: () => () => {} };\n\n/** Returned by {@link useTitleRegistry}. */\nexport interface TitleRegistry {\n /** The id of the first registered title, for `aria-labelledby`. */\n titleId: string | undefined;\n /** Whether a title is registered right now. Read it in effects and handlers, not during render. */\n hasTitle: () => boolean;\n /** The memoised value for `ModalSurfaceContext.Provider`. */\n context: ModalSurfaceContextValue;\n}\n\n/**\n * The title registry of a modal surface. A title registers its id from its ref callback (when its\n * element attaches), so the surface's `aria-labelledby` follows the title elements that are\n * actually rendered.\n */\nexport function useTitleRegistry(): TitleRegistry {\n const [ids, setIds] = React.useState<readonly string[]>([]);\n const countRef = React.useRef(0);\n\n const registerTitle = React.useCallback((id: string) => {\n countRef.current += 1;\n setIds((current) => [...current, id]);\n let registered = true;\n return () => {\n if (!registered) return;\n registered = false;\n countRef.current -= 1;\n setIds((current) => {\n const index = current.indexOf(id);\n return index === -1 ? current : [...current.slice(0, index), ...current.slice(index + 1)];\n });\n };\n }, []);\n\n const hasTitle = React.useCallback(() => countRef.current > 0, []);\n const context = React.useMemo(() => ({ registerTitle }), [registerTitle]);\n return { titleId: ids[0], hasTitle, context };\n}\n\n/**\n * The `id` and `ref` of a title sub-component (`Dialog.Title`, `Drawer.Title`): the consumer's\n * `id` (or a generated one), registered with the enclosing surface while the element is mounted.\n */\nexport function useModalTitle(\n componentName: string,\n parentName: string,\n idProp: string | undefined,\n ref: React.Ref<HTMLHeadingElement> | undefined,\n): { id: string; ref: React.RefCallback<HTMLHeadingElement> } {\n const { registerTitle } = useRequiredContext(\n ModalSurfaceContext,\n componentName,\n parentName,\n () => inertSurface,\n );\n const generatedId = useId('wave-modal-title');\n const id = idProp ?? generatedId;\n const register = React.useCallback(\n (node: HTMLHeadingElement | null) => (node ? registerTitle(id) : undefined),\n [registerTitle, id],\n );\n const mergedRef = useMergedRefs<HTMLHeadingElement>(ref, register);\n return { id, ref: mergedRef };\n}\n\n/**\n * Development warning (once per component) when an open modal surface has no accessible name:\n * no `title`, no registered title element, no `aria-label` and no `aria-labelledby`.\n *\n * @param surface The open surface element (`null` while closed).\n * @param hasTitle From {@link useTitleRegistry}.\n * @param componentName The public name, e.g. `'Dialog.Content'`.\n * @param titleName The title sub-component to recommend, e.g. `'Dialog.Title'`.\n */\nexport function useUnnamedModalWarning(\n surface: HTMLElement | null,\n hasTitle: () => boolean,\n componentName: string,\n titleName: string,\n): void {\n React.useEffect(() => {\n if (!surface) return;\n if (\n surface.hasAttribute('aria-label') ||\n surface.hasAttribute('aria-labelledby') ||\n hasTitle()\n ) {\n return;\n }\n warnOnce(\n `${componentName}:unnamed`,\n `${componentName} has no accessible name. Pass \\`title\\`, render a ${titleName} inside it, or give it \\`aria-label\\` or \\`aria-labelledby\\`.`,\n );\n }, [surface, hasTitle, componentName, titleName]);\n}\n"],"mappings":"saA+BA,SAAgBmB,EACd,EACA,EACA,EACgD,CAChD,IAAMC,EAAapB,EAAM,OAA2C,IAAA,EAAS,EACvE,CAACqB,EAAOC,GAAWrB,EAAAA,gBAAgBsB,EAAMC,GAAe,GAAQ,GACpEC,IAAeC,EAAMN,EAAW,OAAO,CACzC,EAYA,MAAO,CAACC,EAXYrB,EAAM,aACvB,EAAM,IAAY,CACjB,EAAW,QAAU2B,EACrB,GAAI,CACFL,EAAQI,CAAI,CACd,QAAU,CACR,EAAW,QAAU,IAAA,EACvB,CACF,EACA,C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