@senvenli/react 0.0.0-stage → 0.1.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 (636) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -2
  3. package/dist/action/button-group.d.ts +26 -0
  4. package/dist/action/button-group.js +12 -0
  5. package/dist/action/button-group.js.map +1 -0
  6. package/dist/action/button.d.ts +42 -0
  7. package/dist/action/button.js +58 -0
  8. package/dist/action/button.js.map +1 -0
  9. package/dist/action/close-button.d.ts +12 -0
  10. package/dist/action/close-button.js +13 -0
  11. package/dist/action/close-button.js.map +1 -0
  12. package/dist/action/copy-button.d.ts +21 -0
  13. package/dist/action/copy-button.js +38 -0
  14. package/dist/action/copy-button.js.map +1 -0
  15. package/dist/action/fab.d.ts +29 -0
  16. package/dist/action/fab.js +57 -0
  17. package/dist/action/fab.js.map +1 -0
  18. package/dist/action/files.d.ts +70 -0
  19. package/dist/action/files.js +156 -0
  20. package/dist/action/files.js.map +1 -0
  21. package/dist/action/index.d.ts +23 -0
  22. package/dist/action/index.js +16 -0
  23. package/dist/action/index.js.map +1 -0
  24. package/dist/action/language-names.d.ts +19 -0
  25. package/dist/action/language-names.js +79 -0
  26. package/dist/action/language-names.js.map +1 -0
  27. package/dist/action/language-switcher.d.ts +57 -0
  28. package/dist/action/language-switcher.js +53 -0
  29. package/dist/action/language-switcher.js.map +1 -0
  30. package/dist/action/link-button.d.ts +57 -0
  31. package/dist/action/link-button.js +48 -0
  32. package/dist/action/link-button.js.map +1 -0
  33. package/dist/action/link.d.ts +24 -0
  34. package/dist/action/link.js +18 -0
  35. package/dist/action/link.js.map +1 -0
  36. package/dist/action/pressable.d.ts +40 -0
  37. package/dist/action/pressable.js +65 -0
  38. package/dist/action/pressable.js.map +1 -0
  39. package/dist/action/styles.d.ts +60 -0
  40. package/dist/action/styles.js +109 -0
  41. package/dist/action/styles.js.map +1 -0
  42. package/dist/action/theme-script.d.ts +12 -0
  43. package/dist/action/theme-script.js +23 -0
  44. package/dist/action/theme-script.js.map +1 -0
  45. package/dist/action/theme-switcher.d.ts +43 -0
  46. package/dist/action/theme-switcher.js +260 -0
  47. package/dist/action/theme-switcher.js.map +1 -0
  48. package/dist/action/theme-toggle.d.ts +43 -0
  49. package/dist/action/theme-toggle.js +259 -0
  50. package/dist/action/theme-toggle.js.map +1 -0
  51. package/dist/action/toggle.d.ts +44 -0
  52. package/dist/action/toggle.js +28 -0
  53. package/dist/action/toggle.js.map +1 -0
  54. package/dist/action/touch-target.d.ts +9 -0
  55. package/dist/action/touch-target.js +14 -0
  56. package/dist/action/touch-target.js.map +1 -0
  57. package/dist/charts/axis-width.d.ts +186 -0
  58. package/dist/charts/axis-width.js +1262 -0
  59. package/dist/charts/axis-width.js.map +1 -0
  60. package/dist/charts/bar-public.d.ts +16 -0
  61. package/dist/charts/bar-public.js +16 -0
  62. package/dist/charts/bar-public.js.map +1 -0
  63. package/dist/charts/chart-parts.d.ts +136 -0
  64. package/dist/charts/chart-parts.js +160 -0
  65. package/dist/charts/chart-parts.js.map +1 -0
  66. package/dist/charts/core-charts.d.ts +157 -0
  67. package/dist/charts/core-charts.js +505 -0
  68. package/dist/charts/core-charts.js.map +1 -0
  69. package/dist/charts/index.d.ts +12 -0
  70. package/dist/charts/index.js +8 -0
  71. package/dist/charts/index.js.map +1 -0
  72. package/dist/charts/list-charts.d.ts +124 -0
  73. package/dist/charts/list-charts.js +308 -0
  74. package/dist/charts/list-charts.js.map +1 -0
  75. package/dist/charts/more-charts.d.ts +138 -0
  76. package/dist/charts/more-charts.js +284 -0
  77. package/dist/charts/more-charts.js.map +1 -0
  78. package/dist/charts/report-charts.d.ts +138 -0
  79. package/dist/charts/report-charts.js +370 -0
  80. package/dist/charts/report-charts.js.map +1 -0
  81. package/dist/charts/value-tick.d.ts +178 -0
  82. package/dist/charts/value-tick.js +240 -0
  83. package/dist/charts/value-tick.js.map +1 -0
  84. package/dist/collection/data-table-url-hook.d.ts +34 -0
  85. package/dist/collection/data-table-url-hook.js +70 -0
  86. package/dist/collection/data-table-url-hook.js.map +1 -0
  87. package/dist/collection/data-table-url.d.ts +30 -0
  88. package/dist/collection/data-table-url.js +48 -0
  89. package/dist/collection/data-table-url.js.map +1 -0
  90. package/dist/collection/data-table.d.ts +112 -0
  91. package/dist/collection/data-table.js +188 -0
  92. package/dist/collection/data-table.js.map +1 -0
  93. package/dist/collection/grid-list-public.d.ts +18 -0
  94. package/dist/collection/grid-list-public.js +19 -0
  95. package/dist/collection/grid-list-public.js.map +1 -0
  96. package/dist/collection/grid-list.d.ts +73 -0
  97. package/dist/collection/grid-list.js +46 -0
  98. package/dist/collection/grid-list.js.map +1 -0
  99. package/dist/collection/index.d.ts +14 -0
  100. package/dist/collection/index.js +8 -0
  101. package/dist/collection/index.js.map +1 -0
  102. package/dist/collection/list.d.ts +61 -0
  103. package/dist/collection/list.js +38 -0
  104. package/dist/collection/list.js.map +1 -0
  105. package/dist/collection/selection-checkbox.d.ts +5 -0
  106. package/dist/collection/selection-checkbox.js +13 -0
  107. package/dist/collection/selection-checkbox.js.map +1 -0
  108. package/dist/collection/table.d.ts +91 -0
  109. package/dist/collection/table.js +183 -0
  110. package/dist/collection/table.js.map +1 -0
  111. package/dist/collection/tree.d.ts +31 -0
  112. package/dist/collection/tree.js +22 -0
  113. package/dist/collection/tree.js.map +1 -0
  114. package/dist/color/color.d.ts +87 -0
  115. package/dist/color/color.js +200 -0
  116. package/dist/color/color.js.map +1 -0
  117. package/dist/color/contrast.d.ts +34 -0
  118. package/dist/color/contrast.js +44 -0
  119. package/dist/color/contrast.js.map +1 -0
  120. package/dist/color/index.d.ts +4 -0
  121. package/dist/color/index.js +5 -0
  122. package/dist/color/index.js.map +1 -0
  123. package/dist/date/calendar.d.ts +71 -0
  124. package/dist/date/calendar.js +291 -0
  125. package/dist/date/calendar.js.map +1 -0
  126. package/dist/date/fields.d.ts +174 -0
  127. package/dist/date/fields.js +250 -0
  128. package/dist/date/fields.js.map +1 -0
  129. package/dist/date/index.d.ts +7 -0
  130. package/dist/date/index.js +6 -0
  131. package/dist/date/index.js.map +1 -0
  132. package/dist/date/month-grid.d.ts +31 -0
  133. package/dist/date/month-grid.js +115 -0
  134. package/dist/date/month-grid.js.map +1 -0
  135. package/dist/date/pickers.d.ts +118 -0
  136. package/dist/date/pickers.js +176 -0
  137. package/dist/date/pickers.js.map +1 -0
  138. package/dist/date/public.d.ts +25 -0
  139. package/dist/date/public.js +24 -0
  140. package/dist/date/public.js.map +1 -0
  141. package/dist/date/segments.d.ts +153 -0
  142. package/dist/date/segments.js +433 -0
  143. package/dist/date/segments.js.map +1 -0
  144. package/dist/defaults.d.ts +74 -0
  145. package/dist/defaults.js +100 -0
  146. package/dist/defaults.js.map +1 -0
  147. package/dist/density.d.ts +2 -0
  148. package/dist/density.js +2 -0
  149. package/dist/density.js.map +1 -0
  150. package/dist/display/avatar.d.ts +29 -0
  151. package/dist/display/avatar.js +71 -0
  152. package/dist/display/avatar.js.map +1 -0
  153. package/dist/display/badge.d.ts +65 -0
  154. package/dist/display/badge.js +99 -0
  155. package/dist/display/badge.js.map +1 -0
  156. package/dist/display/card.d.ts +72 -0
  157. package/dist/display/card.js +91 -0
  158. package/dist/display/card.js.map +1 -0
  159. package/dist/display/carousel.d.ts +47 -0
  160. package/dist/display/carousel.js +214 -0
  161. package/dist/display/carousel.js.map +1 -0
  162. package/dist/display/description-list.d.ts +25 -0
  163. package/dist/display/description-list.js +36 -0
  164. package/dist/display/description-list.js.map +1 -0
  165. package/dist/display/icon-aliases.d.ts +1 -0
  166. package/dist/display/icon-aliases.js +259 -0
  167. package/dist/display/icon-aliases.js.map +1 -0
  168. package/dist/display/icon-names.d.ts +4 -0
  169. package/dist/display/icon-names.js +2 -0
  170. package/dist/display/icon-names.js.map +1 -0
  171. package/dist/display/icon.d.ts +51 -0
  172. package/dist/display/icon.js +96 -0
  173. package/dist/display/icon.js.map +1 -0
  174. package/dist/display/image-crop.d.ts +106 -0
  175. package/dist/display/image-crop.js +117 -0
  176. package/dist/display/image-crop.js.map +1 -0
  177. package/dist/display/image-cropper.d.ts +68 -0
  178. package/dist/display/image-cropper.js +284 -0
  179. package/dist/display/image-cropper.js.map +1 -0
  180. package/dist/display/image-viewer.d.ts +54 -0
  181. package/dist/display/image-viewer.js +84 -0
  182. package/dist/display/image-viewer.js.map +1 -0
  183. package/dist/display/image.d.ts +26 -0
  184. package/dist/display/image.js +17 -0
  185. package/dist/display/image.js.map +1 -0
  186. package/dist/display/index.d.ts +29 -0
  187. package/dist/display/index.js +16 -0
  188. package/dist/display/index.js.map +1 -0
  189. package/dist/display/iso-chip.d.ts +19 -0
  190. package/dist/display/iso-chip.js +21 -0
  191. package/dist/display/iso-chip.js.map +1 -0
  192. package/dist/display/kbd.d.ts +11 -0
  193. package/dist/display/kbd.js +33 -0
  194. package/dist/display/kbd.js.map +1 -0
  195. package/dist/display/lozenge.d.ts +30 -0
  196. package/dist/display/lozenge.js +55 -0
  197. package/dist/display/lozenge.js.map +1 -0
  198. package/dist/display/scroll-area.d.ts +29 -0
  199. package/dist/display/scroll-area.js +95 -0
  200. package/dist/display/scroll-area.js.map +1 -0
  201. package/dist/display/separator.d.ts +13 -0
  202. package/dist/display/separator.js +24 -0
  203. package/dist/display/separator.js.map +1 -0
  204. package/dist/display/stat.d.ts +35 -0
  205. package/dist/display/stat.js +41 -0
  206. package/dist/display/stat.js.map +1 -0
  207. package/dist/display/timeline.d.ts +44 -0
  208. package/dist/display/timeline.js +111 -0
  209. package/dist/display/timeline.js.map +1 -0
  210. package/dist/display/typography.d.ts +37 -0
  211. package/dist/display/typography.js +53 -0
  212. package/dist/display/typography.js.map +1 -0
  213. package/dist/display/visually-hidden.d.ts +14 -0
  214. package/dist/display/visually-hidden.js +10 -0
  215. package/dist/display/visually-hidden.js.map +1 -0
  216. package/dist/feedback/banner.d.ts +46 -0
  217. package/dist/feedback/banner.js +157 -0
  218. package/dist/feedback/banner.js.map +1 -0
  219. package/dist/feedback/cooldown.d.ts +17 -0
  220. package/dist/feedback/cooldown.js +59 -0
  221. package/dist/feedback/cooldown.js.map +1 -0
  222. package/dist/feedback/empty-state.d.ts +35 -0
  223. package/dist/feedback/empty-state.js +39 -0
  224. package/dist/feedback/empty-state.js.map +1 -0
  225. package/dist/feedback/index.d.ts +12 -0
  226. package/dist/feedback/index.js +11 -0
  227. package/dist/feedback/index.js.map +1 -0
  228. package/dist/feedback/meter.d.ts +33 -0
  229. package/dist/feedback/meter.js +42 -0
  230. package/dist/feedback/meter.js.map +1 -0
  231. package/dist/feedback/motion.d.ts +9 -0
  232. package/dist/feedback/motion.js +57 -0
  233. package/dist/feedback/motion.js.map +1 -0
  234. package/dist/feedback/progress.d.ts +39 -0
  235. package/dist/feedback/progress.js +68 -0
  236. package/dist/feedback/progress.js.map +1 -0
  237. package/dist/feedback/skeleton.d.ts +48 -0
  238. package/dist/feedback/skeleton.js +61 -0
  239. package/dist/feedback/skeleton.js.map +1 -0
  240. package/dist/feedback/spinner.d.ts +19 -0
  241. package/dist/feedback/spinner.js +29 -0
  242. package/dist/feedback/spinner.js.map +1 -0
  243. package/dist/feedback/status-dot.d.ts +23 -0
  244. package/dist/feedback/status-dot.js +37 -0
  245. package/dist/feedback/status-dot.js.map +1 -0
  246. package/dist/form/countries.d.ts +34 -0
  247. package/dist/form/countries.js +273 -0
  248. package/dist/form/countries.js.map +1 -0
  249. package/dist/form/data-attributes.d.ts +11 -0
  250. package/dist/form/data-attributes.js +22 -0
  251. package/dist/form/data-attributes.js.map +1 -0
  252. package/dist/form/field-parts.d.ts +113 -0
  253. package/dist/form/field-parts.js +178 -0
  254. package/dist/form/field-parts.js.map +1 -0
  255. package/dist/form/field.d.ts +36 -0
  256. package/dist/form/field.js +65 -0
  257. package/dist/form/field.js.map +1 -0
  258. package/dist/form/files.d.ts +70 -0
  259. package/dist/form/files.js +156 -0
  260. package/dist/form/files.js.map +1 -0
  261. package/dist/form/form.d.ts +40 -0
  262. package/dist/form/form.js +74 -0
  263. package/dist/form/form.js.map +1 -0
  264. package/dist/form/image-crop.d.ts +106 -0
  265. package/dist/form/image-crop.js +117 -0
  266. package/dist/form/image-crop.js.map +1 -0
  267. package/dist/form/image-cropper.d.ts +68 -0
  268. package/dist/form/image-cropper.js +284 -0
  269. package/dist/form/image-cropper.js.map +1 -0
  270. package/dist/form/index.d.ts +24 -0
  271. package/dist/form/index.js +15 -0
  272. package/dist/form/index.js.map +1 -0
  273. package/dist/form/input-group.d.ts +63 -0
  274. package/dist/form/input-group.js +63 -0
  275. package/dist/form/input-group.js.map +1 -0
  276. package/dist/form/input-otp.d.ts +35 -0
  277. package/dist/form/input-otp.js +83 -0
  278. package/dist/form/input-otp.js.map +1 -0
  279. package/dist/form/input.d.ts +36 -0
  280. package/dist/form/input.js +41 -0
  281. package/dist/form/input.js.map +1 -0
  282. package/dist/form/number-field.d.ts +84 -0
  283. package/dist/form/number-field.js +81 -0
  284. package/dist/form/number-field.js.map +1 -0
  285. package/dist/form/otp-field.d.ts +37 -0
  286. package/dist/form/otp-field.js +116 -0
  287. package/dist/form/otp-field.js.map +1 -0
  288. package/dist/form/password-field.d.ts +61 -0
  289. package/dist/form/password-field.js +61 -0
  290. package/dist/form/password-field.js.map +1 -0
  291. package/dist/form/phone-field.d.ts +104 -0
  292. package/dist/form/phone-field.js +275 -0
  293. package/dist/form/phone-field.js.map +1 -0
  294. package/dist/form/phone-paste.d.ts +24 -0
  295. package/dist/form/phone-paste.js +40 -0
  296. package/dist/form/phone-paste.js.map +1 -0
  297. package/dist/form/phone.d.ts +159 -0
  298. package/dist/form/phone.js +309 -0
  299. package/dist/form/phone.js.map +1 -0
  300. package/dist/form/search-field.d.ts +29 -0
  301. package/dist/form/search-field.js +23 -0
  302. package/dist/form/search-field.js.map +1 -0
  303. package/dist/form/styles.d.ts +31 -0
  304. package/dist/form/styles.js +43 -0
  305. package/dist/form/styles.js.map +1 -0
  306. package/dist/form/text-area.d.ts +70 -0
  307. package/dist/form/text-area.js +93 -0
  308. package/dist/form/text-area.js.map +1 -0
  309. package/dist/form/text-field.d.ts +131 -0
  310. package/dist/form/text-field.js +59 -0
  311. package/dist/form/text-field.js.map +1 -0
  312. package/dist/form/validation.d.ts +145 -0
  313. package/dist/form/validation.js +136 -0
  314. package/dist/form/validation.js.map +1 -0
  315. package/dist/i18n.d.ts +438 -0
  316. package/dist/i18n.js +948 -0
  317. package/dist/i18n.js.map +1 -0
  318. package/dist/index.d.ts +9 -0
  319. package/dist/index.js +7 -0
  320. package/dist/index.js.map +1 -0
  321. package/dist/intl-locale.d.ts +30 -0
  322. package/dist/intl-locale.js +83 -0
  323. package/dist/intl-locale.js.map +1 -0
  324. package/dist/layers.d.ts +32 -0
  325. package/dist/layers.js +33 -0
  326. package/dist/layers.js.map +1 -0
  327. package/dist/layout/auth-form-layout.d.ts +71 -0
  328. package/dist/layout/auth-form-layout.js +61 -0
  329. package/dist/layout/auth-form-layout.js.map +1 -0
  330. package/dist/layout/auth-layout.d.ts +59 -0
  331. package/dist/layout/auth-layout.js +26 -0
  332. package/dist/layout/auth-layout.js.map +1 -0
  333. package/dist/layout/box.d.ts +26 -0
  334. package/dist/layout/box.js +16 -0
  335. package/dist/layout/box.js.map +1 -0
  336. package/dist/layout/grid.d.ts +27 -0
  337. package/dist/layout/grid.js +26 -0
  338. package/dist/layout/grid.js.map +1 -0
  339. package/dist/layout/index.d.ts +16 -0
  340. package/dist/layout/index.js +12 -0
  341. package/dist/layout/index.js.map +1 -0
  342. package/dist/layout/pressable.d.ts +40 -0
  343. package/dist/layout/pressable.js +65 -0
  344. package/dist/layout/pressable.js.map +1 -0
  345. package/dist/layout/reset-sent-card.d.ts +39 -0
  346. package/dist/layout/reset-sent-card.js +22 -0
  347. package/dist/layout/reset-sent-card.js.map +1 -0
  348. package/dist/layout/scroll-area.d.ts +29 -0
  349. package/dist/layout/scroll-area.js +95 -0
  350. package/dist/layout/scroll-area.js.map +1 -0
  351. package/dist/layout/section.d.ts +41 -0
  352. package/dist/layout/section.js +22 -0
  353. package/dist/layout/section.js.map +1 -0
  354. package/dist/layout/split.d.ts +50 -0
  355. package/dist/layout/split.js +35 -0
  356. package/dist/layout/split.js.map +1 -0
  357. package/dist/layout/stack.d.ts +44 -0
  358. package/dist/layout/stack.js +36 -0
  359. package/dist/layout/stack.js.map +1 -0
  360. package/dist/layout/tokens.d.ts +33 -0
  361. package/dist/layout/tokens.js +85 -0
  362. package/dist/layout/tokens.js.map +1 -0
  363. package/dist/layout/toolbar.d.ts +37 -0
  364. package/dist/layout/toolbar.js +334 -0
  365. package/dist/layout/toolbar.js.map +1 -0
  366. package/dist/navigate-context.d.ts +12 -0
  367. package/dist/navigate-context.js +13 -0
  368. package/dist/navigate-context.js.map +1 -0
  369. package/dist/navigation/accordion.d.ts +40 -0
  370. package/dist/navigation/accordion.js +33 -0
  371. package/dist/navigation/accordion.js.map +1 -0
  372. package/dist/navigation/bottom-nav.d.ts +29 -0
  373. package/dist/navigation/bottom-nav.js +48 -0
  374. package/dist/navigation/bottom-nav.js.map +1 -0
  375. package/dist/navigation/brand-link-context.d.ts +8 -0
  376. package/dist/navigation/brand-link-context.js +9 -0
  377. package/dist/navigation/brand-link-context.js.map +1 -0
  378. package/dist/navigation/breadcrumbs.d.ts +36 -0
  379. package/dist/navigation/breadcrumbs.js +51 -0
  380. package/dist/navigation/breadcrumbs.js.map +1 -0
  381. package/dist/navigation/dock.d.ts +27 -0
  382. package/dist/navigation/dock.js +47 -0
  383. package/dist/navigation/dock.js.map +1 -0
  384. package/dist/navigation/footer.d.ts +43 -0
  385. package/dist/navigation/footer.js +43 -0
  386. package/dist/navigation/footer.js.map +1 -0
  387. package/dist/navigation/index.d.ts +22 -0
  388. package/dist/navigation/index.js +17 -0
  389. package/dist/navigation/index.js.map +1 -0
  390. package/dist/navigation/language-names.d.ts +19 -0
  391. package/dist/navigation/language-names.js +79 -0
  392. package/dist/navigation/language-names.js.map +1 -0
  393. package/dist/navigation/language-switcher.d.ts +55 -0
  394. package/dist/navigation/language-switcher.js +53 -0
  395. package/dist/navigation/language-switcher.js.map +1 -0
  396. package/dist/navigation/nav-panel.d.ts +18 -0
  397. package/dist/navigation/nav-panel.js +51 -0
  398. package/dist/navigation/nav-panel.js.map +1 -0
  399. package/dist/navigation/navbar.d.ts +73 -0
  400. package/dist/navigation/navbar.js +64 -0
  401. package/dist/navigation/navbar.js.map +1 -0
  402. package/dist/navigation/page-header.d.ts +37 -0
  403. package/dist/navigation/page-header.js +50 -0
  404. package/dist/navigation/page-header.js.map +1 -0
  405. package/dist/navigation/pagination.d.ts +25 -0
  406. package/dist/navigation/pagination.js +51 -0
  407. package/dist/navigation/pagination.js.map +1 -0
  408. package/dist/navigation/panel-header.d.ts +37 -0
  409. package/dist/navigation/panel-header.js +50 -0
  410. package/dist/navigation/panel-header.js.map +1 -0
  411. package/dist/navigation/sidebar-script.d.ts +12 -0
  412. package/dist/navigation/sidebar-script.js +20 -0
  413. package/dist/navigation/sidebar-script.js.map +1 -0
  414. package/dist/navigation/sidebar.d.ts +149 -0
  415. package/dist/navigation/sidebar.js +332 -0
  416. package/dist/navigation/sidebar.js.map +1 -0
  417. package/dist/navigation/skip-link.d.ts +12 -0
  418. package/dist/navigation/skip-link.js +30 -0
  419. package/dist/navigation/skip-link.js.map +1 -0
  420. package/dist/navigation/stepper.d.ts +50 -0
  421. package/dist/navigation/stepper.js +96 -0
  422. package/dist/navigation/stepper.js.map +1 -0
  423. package/dist/navigation/tabs.d.ts +84 -0
  424. package/dist/navigation/tabs.js +118 -0
  425. package/dist/navigation/tabs.js.map +1 -0
  426. package/dist/navigation/toolbar.d.ts +37 -0
  427. package/dist/navigation/toolbar.js +334 -0
  428. package/dist/navigation/toolbar.js.map +1 -0
  429. package/dist/overlay/alert-dialog.d.ts +63 -0
  430. package/dist/overlay/alert-dialog.js +76 -0
  431. package/dist/overlay/alert-dialog.js.map +1 -0
  432. package/dist/overlay/command-palette.d.ts +53 -0
  433. package/dist/overlay/command-palette.js +130 -0
  434. package/dist/overlay/command-palette.js.map +1 -0
  435. package/dist/overlay/command.d.ts +53 -0
  436. package/dist/overlay/command.js +129 -0
  437. package/dist/overlay/command.js.map +1 -0
  438. package/dist/overlay/context-menu.d.ts +29 -0
  439. package/dist/overlay/context-menu.js +58 -0
  440. package/dist/overlay/context-menu.js.map +1 -0
  441. package/dist/overlay/dialog.d.ts +162 -0
  442. package/dist/overlay/dialog.js +174 -0
  443. package/dist/overlay/dialog.js.map +1 -0
  444. package/dist/overlay/drawer.d.ts +41 -0
  445. package/dist/overlay/drawer.js +114 -0
  446. package/dist/overlay/drawer.js.map +1 -0
  447. package/dist/overlay/floating.d.ts +142 -0
  448. package/dist/overlay/floating.js +226 -0
  449. package/dist/overlay/floating.js.map +1 -0
  450. package/dist/overlay/hover-card.d.ts +19 -0
  451. package/dist/overlay/hover-card.js +31 -0
  452. package/dist/overlay/hover-card.js.map +1 -0
  453. package/dist/overlay/index.d.ts +18 -0
  454. package/dist/overlay/index.js +12 -0
  455. package/dist/overlay/index.js.map +1 -0
  456. package/dist/overlay/overlay-base.d.ts +105 -0
  457. package/dist/overlay/overlay-base.js +250 -0
  458. package/dist/overlay/overlay-base.js.map +1 -0
  459. package/dist/overlay/overlay.d.ts +299 -0
  460. package/dist/overlay/overlay.js +558 -0
  461. package/dist/overlay/overlay.js.map +1 -0
  462. package/dist/overlay/toast.d.ts +58 -0
  463. package/dist/overlay/toast.js +145 -0
  464. package/dist/overlay/toast.js.map +1 -0
  465. package/dist/provider.d.ts +26 -0
  466. package/dist/provider.js +30 -0
  467. package/dist/provider.js.map +1 -0
  468. package/dist/selection/autocomplete.d.ts +54 -0
  469. package/dist/selection/autocomplete.js +122 -0
  470. package/dist/selection/autocomplete.js.map +1 -0
  471. package/dist/selection/checkbox.d.ts +56 -0
  472. package/dist/selection/checkbox.js +49 -0
  473. package/dist/selection/checkbox.js.map +1 -0
  474. package/dist/selection/choice-size.d.ts +26 -0
  475. package/dist/selection/choice-size.js +50 -0
  476. package/dist/selection/choice-size.js.map +1 -0
  477. package/dist/selection/choice-text.d.ts +21 -0
  478. package/dist/selection/choice-text.js +33 -0
  479. package/dist/selection/choice-text.js.map +1 -0
  480. package/dist/selection/combobox.d.ts +173 -0
  481. package/dist/selection/combobox.js +410 -0
  482. package/dist/selection/combobox.js.map +1 -0
  483. package/dist/selection/index.d.ts +20 -0
  484. package/dist/selection/index.js +13 -0
  485. package/dist/selection/index.js.map +1 -0
  486. package/dist/selection/list-box.d.ts +30 -0
  487. package/dist/selection/list-box.js +16 -0
  488. package/dist/selection/list-box.js.map +1 -0
  489. package/dist/selection/listbox.d.ts +44 -0
  490. package/dist/selection/listbox.js +49 -0
  491. package/dist/selection/listbox.js.map +1 -0
  492. package/dist/selection/match.d.ts +20 -0
  493. package/dist/selection/match.js +57 -0
  494. package/dist/selection/match.js.map +1 -0
  495. package/dist/selection/multi-select.d.ts +72 -0
  496. package/dist/selection/multi-select.js +138 -0
  497. package/dist/selection/multi-select.js.map +1 -0
  498. package/dist/selection/radio-card.d.ts +31 -0
  499. package/dist/selection/radio-card.js +29 -0
  500. package/dist/selection/radio-card.js.map +1 -0
  501. package/dist/selection/radio.d.ts +72 -0
  502. package/dist/selection/radio.js +64 -0
  503. package/dist/selection/radio.js.map +1 -0
  504. package/dist/selection/select-public.d.ts +19 -0
  505. package/dist/selection/select-public.js +24 -0
  506. package/dist/selection/select-public.js.map +1 -0
  507. package/dist/selection/select.d.ts +72 -0
  508. package/dist/selection/select.js +69 -0
  509. package/dist/selection/select.js.map +1 -0
  510. package/dist/selection/slider.d.ts +16 -0
  511. package/dist/selection/slider.js +44 -0
  512. package/dist/selection/slider.js.map +1 -0
  513. package/dist/selection/styles.d.ts +26 -0
  514. package/dist/selection/styles.js +78 -0
  515. package/dist/selection/styles.js.map +1 -0
  516. package/dist/selection/switch.d.ts +24 -0
  517. package/dist/selection/switch.js +27 -0
  518. package/dist/selection/switch.js.map +1 -0
  519. package/dist/selection/tag-group.d.ts +38 -0
  520. package/dist/selection/tag-group.js +45 -0
  521. package/dist/selection/tag-group.js.map +1 -0
  522. package/dist/tone.d.ts +6 -0
  523. package/dist/tone.js +2 -0
  524. package/dist/tone.js.map +1 -0
  525. package/dist/utils.d.ts +9 -0
  526. package/dist/utils.js +42 -0
  527. package/dist/utils.js.map +1 -0
  528. package/manifest/component.full.schema.json +391 -0
  529. package/manifest/component.schema.json +279 -0
  530. package/manifests/accordion.json +299 -0
  531. package/manifests/alert-dialog.json +261 -0
  532. package/manifests/area-chart.json +338 -0
  533. package/manifests/autocomplete.json +299 -0
  534. package/manifests/avatar.json +253 -0
  535. package/manifests/badge.json +288 -0
  536. package/manifests/banner.json +185 -0
  537. package/manifests/bar-chart.json +454 -0
  538. package/manifests/bar-list.json +262 -0
  539. package/manifests/bottom-nav.json +139 -0
  540. package/manifests/box.json +3450 -0
  541. package/manifests/breadcrumbs.json +199 -0
  542. package/manifests/button-group.json +2294 -0
  543. package/manifests/button.json +1211 -0
  544. package/manifests/calendar-heatmap.json +218 -0
  545. package/manifests/calendar.json +299 -0
  546. package/manifests/card.json +308 -0
  547. package/manifests/carousel.json +263 -0
  548. package/manifests/chart-parts.json +309 -0
  549. package/manifests/checkbox.json +998 -0
  550. package/manifests/close-button.json +1000 -0
  551. package/manifests/color-field.json +276 -0
  552. package/manifests/color-picker.json +161 -0
  553. package/manifests/color-swatch-picker.json +220 -0
  554. package/manifests/color-swatch.json +140 -0
  555. package/manifests/combobox.json +581 -0
  556. package/manifests/command.json +275 -0
  557. package/manifests/composed-chart.json +287 -0
  558. package/manifests/context-menu.json +148 -0
  559. package/manifests/copy-button.json +192 -0
  560. package/manifests/data-table.json +334 -0
  561. package/manifests/date-field.json +302 -0
  562. package/manifests/date-picker.json +472 -0
  563. package/manifests/description-list.json +201 -0
  564. package/manifests/dialog.json +322 -0
  565. package/manifests/donut-chart.json +264 -0
  566. package/manifests/drawer.json +211 -0
  567. package/manifests/empty-state.json +185 -0
  568. package/manifests/fab.json +172 -0
  569. package/manifests/field.json +209 -0
  570. package/manifests/file-upload.json +791 -0
  571. package/manifests/form.json +829 -0
  572. package/manifests/funnel-chart.json +223 -0
  573. package/manifests/gauge-chart.json +252 -0
  574. package/manifests/grid-list.json +335 -0
  575. package/manifests/grid.json +3482 -0
  576. package/manifests/heading.json +183 -0
  577. package/manifests/heatmap.json +265 -0
  578. package/manifests/hover-card.json +172 -0
  579. package/manifests/icon.json +201 -0
  580. package/manifests/image-cropper.json +295 -0
  581. package/manifests/image-viewer.json +198 -0
  582. package/manifests/image.json +193 -0
  583. package/manifests/index.json +2035 -0
  584. package/manifests/input-group.json +3571 -0
  585. package/manifests/input.json +1557 -0
  586. package/manifests/kbd.json +98 -0
  587. package/manifests/language-switcher.json +274 -0
  588. package/manifests/line-chart.json +342 -0
  589. package/manifests/link.json +867 -0
  590. package/manifests/list-box.json +213 -0
  591. package/manifests/menu.json +453 -0
  592. package/manifests/meter.json +145 -0
  593. package/manifests/navbar.json +281 -0
  594. package/manifests/otp-field.json +1029 -0
  595. package/manifests/page-header.json +164 -0
  596. package/manifests/pagination.json +181 -0
  597. package/manifests/popover.json +205 -0
  598. package/manifests/pressable.json +367 -0
  599. package/manifests/progress.json +282 -0
  600. package/manifests/radar-chart.json +229 -0
  601. package/manifests/radial-chart.json +195 -0
  602. package/manifests/radio.json +975 -0
  603. package/manifests/scatter-chart.json +277 -0
  604. package/manifests/scroll-area.json +127 -0
  605. package/manifests/section.json +169 -0
  606. package/manifests/select.json +474 -0
  607. package/manifests/separator.json +119 -0
  608. package/manifests/sidebar.json +584 -0
  609. package/manifests/skeleton.json +235 -0
  610. package/manifests/skip-link.json +89 -0
  611. package/manifests/slider.json +706 -0
  612. package/manifests/sparkline.json +208 -0
  613. package/manifests/spinner.json +105 -0
  614. package/manifests/split.json +6618 -0
  615. package/manifests/stack.json +3541 -0
  616. package/manifests/stat.json +192 -0
  617. package/manifests/stepper.json +279 -0
  618. package/manifests/switch.json +205 -0
  619. package/manifests/table.json +375 -0
  620. package/manifests/tabs.json +438 -0
  621. package/manifests/tag-group.json +264 -0
  622. package/manifests/text-area.json +1136 -0
  623. package/manifests/text.json +244 -0
  624. package/manifests/theme-switcher.json +152 -0
  625. package/manifests/time-field.json +284 -0
  626. package/manifests/timeline.json +196 -0
  627. package/manifests/toast.json +87 -0
  628. package/manifests/toggle-button.json +1489 -0
  629. package/manifests/toolbar.json +145 -0
  630. package/manifests/tooltip.json +181 -0
  631. package/manifests/tracker.json +192 -0
  632. package/manifests/tree.json +245 -0
  633. package/manifests/visually-hidden.json +114 -0
  634. package/package.json +117 -3
  635. package/styles/base.css +56 -0
  636. package/styles/theme.css +154 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/overlay/index.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,wEAAwE;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEvG,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC","sourcesContent":["// @senvenli/react/overlay: Dialog, AlertDialog, Drawer and DialogTrigger; Popover, Tooltip, Menu, ContextMenu and HoverCard;\n// Command, Toaster and toast(). Each is built on React Aria Components.\nexport { DialogTrigger } from \"./overlay-base\";\nexport type { OverlaySize } from \"./overlay-base\";\nexport { Dialog, useDialogClose } from \"./dialog\";\nexport type { DialogAction, DialogProps } from \"./dialog\";\nexport { AlertDialog } from \"./alert-dialog\";\nexport type { AlertDialogProps } from \"./alert-dialog\";\nexport { Drawer, useDrawerClose } from \"./drawer\";\nexport type { DrawerClose, DrawerPosition, DrawerProps } from \"./drawer\";\nexport { Menu, MenuItem, MenuSection, MenuSeparator, MenuSubmenu, Popover, Tooltip } from \"./floating\";\nexport type { MenuEntry, MenuItemDef, MenuItemProps, MenuProps, MenuSectionDef, MenuSectionProps, MenuSubmenuProps, PopoverProps, TooltipProps } from \"./floating\";\nexport { ContextMenu, ContextMenuTrigger } from \"./context-menu\";\nexport type { ContextMenuProps, ContextMenuTriggerProps } from \"./context-menu\";\nexport { HoverCard } from \"./hover-card\";\nexport type { HoverCardProps } from \"./hover-card\";\nexport { Command } from \"./command\";\nexport type { CommandGroup, CommandItem, CommandProps } from \"./command\";\nexport { Toaster, toast } from \"./toast\";\nexport type { ToastOptions, ToastPromiseMessages, ToastTone } from \"./toast\";\n"]}
@@ -0,0 +1,105 @@
1
+ import * as React from "react";
2
+ import { type DialogTriggerProps } from "react-aria-components";
3
+ /**
4
+ * One size dictionary for Dialog and Drawer: small, medium, large. A dialog is 440, 600 or
5
+ * 800px wide; a drawer is 380 or 560px (it has no medium; medium reads as large).
6
+ */
7
+ export type OverlaySize = "small" | "medium" | "large";
8
+ /**
9
+ * `xlarge` is Dialog's only: 1152px, for a two- or three-column form over the page it edits
10
+ * (an order edit). Below that it takes the viewport less the frame's padding, as every size does.
11
+ */
12
+ export type DialogWidth = OverlaySize | "xlarge";
13
+ export declare const DRAWER_WIDTH: Record<OverlaySize, string>;
14
+ /** The scrim: `ds-blanket`, fading in `ds-duration-slow`; still for reduced motion. */
15
+ export declare const BLANKET: string;
16
+ /** Every overlay's inner focus target: React Aria's dialog element, never outlined itself. */
17
+ export declare const DIALOG_ELEMENT = "flex min-h-0 flex-1 flex-col outline-hidden";
18
+ /** Overlay contents: a nested overlay must not see the outer one's trigger. */
19
+ export declare function OverlayContents({ children }: {
20
+ children: React.ReactNode;
21
+ }): React.JSX.Element;
22
+ /**
23
+ * The button that opens a Dialog, AlertDialog or Drawer: put it first, the overlay after it. Inside another
24
+ * overlay (a Dialog in a Drawer) use this one, not React Aria's own DialogTrigger, which there only sees the
25
+ * outer overlay's state.
26
+ */
27
+ export declare function DialogTrigger({ children, ...props }: DialogTriggerProps): React.JSX.Element;
28
+ export type OpenProps = {
29
+ /**
30
+ * Open without a DialogTrigger (a URL, a row click). Inside a DialogTrigger, put `onOpenChange` on the
31
+ * trigger instead: the trigger owns the state there.
32
+ */
33
+ isOpen?: boolean;
34
+ defaultOpen?: boolean;
35
+ onOpenChange?: (isOpen: boolean) => void;
36
+ };
37
+ /**
38
+ * Open state for an overlay that can sit in a DialogTrigger or stand alone. Inside a trigger the trigger's
39
+ * state is used; otherwise `isOpen`/`defaultOpen`. `close` is the one way to close, so `onOpenChange(false)`
40
+ * fires once whichever control asked (button, Esc, scrim).
41
+ */
42
+ export declare function useOverlayOpen({ isOpen, defaultOpen, onOpenChange }: OpenProps): {
43
+ isOpen: boolean;
44
+ open: () => void;
45
+ close: () => void;
46
+ };
47
+ /**
48
+ * `data-*` attributes, such as `data-testid`, passed through to a part of the dialog. `data-slot`
49
+ * (and the footer's `data-layout`) is the DS's own and is never overridden. Not exported: the props that take it name it.
50
+ */
51
+ export type DataAttributes = {
52
+ [name: `data-${string}`]: string | number | boolean | undefined;
53
+ };
54
+ /** The `data-*` entries of a props object, without the DS's own `data-slot`. */
55
+ export declare function dataAttributes(source: object | null | undefined): DataAttributes;
56
+ /**
57
+ * Focus on open: the first field of the body, or the secondary action when the primary one destroys
58
+ * something. Runs after React Aria's own first-focus, so it wins. A destructive primary with no secondary
59
+ * (`secondaryAction={null}` on a full-screen dialog) has no safe button to start on, so focus goes to the first
60
+ * field as it does for any other dialog, and to the dialog itself when the body has none. The
61
+ * app's `initialFocusRef`, when it holds an element, comes before every rule.
62
+ */
63
+ export declare function useInitialFocus(body: React.RefObject<HTMLElement | null>, secondary: React.RefObject<HTMLElement | null>, safeFirst: boolean, initial?: React.RefObject<HTMLElement | null>): void;
64
+ /**
65
+ * `returnFocusRef`: when the dialog's contents unmount (it closed), focus goes to the ref's element
66
+ * instead of the opener. React Aria's own return to the opener is cancelled for that one close, so the opener
67
+ * never flashes focus (and its focus handlers never run). Focus the app moved elsewhere on purpose is left alone.
68
+ * Without the ref, or with it empty, nothing here runs and React Aria returns focus to the opener as before.
69
+ */
70
+ export declare function useReturnFocus(target: React.RefObject<HTMLElement | null> | undefined): void;
71
+ /**
72
+ * A form-submit primary while pending: React Aria turns the button into `type="button"`, so a click
73
+ * no longer submits, but Enter in a form with one field still would (HTML's implicit submission needs no
74
+ * button). Every submit of that form is stopped here until the action settles, before React's `onSubmit` sees it.
75
+ * The listener sits on `document` (capture) and matches the form by its id when the submit happens, so a form
76
+ * remounted with the same id while pending is stopped too; another form still submits. React's capture
77
+ * handlers on the form (`onSubmitCapture`) still run while pending: the event is cancelled on `document` but
78
+ * stopped only on the form itself, after React's root has seen its capture phase and before its bubble.
79
+ */
80
+ export declare function useBlockedSubmit(formId: string | undefined, blocked: boolean): void;
81
+ /**
82
+ * Development only: with the close button hidden and no control a keyboard can reach inside, a
83
+ * keyboard user can neither go on nor, without `isDismissable`, leave; even with it (Esc), a touch user on
84
+ * `fullscreen` has no press outside. So it warns whenever the close button is hidden and nothing inside is
85
+ * tabbable, whatever `isDismissable` says. Checked once it opens.
86
+ */
87
+ export declare function useStrandedWarning(closeHidden: boolean, body: React.RefObject<HTMLElement | null>): void;
88
+ export declare function DialogFrame({ size, children, role, isDismissable, escapeCloses, isOpen, onClose, describedBy, rootData }: {
89
+ size: DialogWidth;
90
+ children: React.ReactNode;
91
+ role?: "dialog" | "alertdialog";
92
+ isDismissable: boolean;
93
+ escapeCloses: boolean;
94
+ isOpen: boolean;
95
+ /** The app's `data-*` attributes for the dialog element; its own `data-slot` comes after them. */
96
+ rootData?: DataAttributes;
97
+ /** Every close request (Esc, scrim, the parts' buttons) comes here. */
98
+ onClose: () => void;
99
+ /** The element whose text describes the dialog (an alert's consequence). */
100
+ describedBy?: string;
101
+ }): React.JSX.Element;
102
+ /** An empty description (`""`, `false`, `true`, `null`) renders nothing, so it is the same as none. */
103
+ export declare function hasDescription(description: React.ReactNode): boolean;
104
+ /** Below 640px: the full-screen dialog's sheet presentation; decided after mount. */
105
+ export declare function useNarrow(): boolean;
@@ -0,0 +1,250 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Dialog as AriaDialog, DialogTrigger as AriaDialogTrigger, Modal, ModalOverlay, OverlayTriggerStateContext } from "react-aria-components";
5
+ import { cn } from "../utils.js";
6
+ import { useMotionAttribute } from "../defaults.js";
7
+ const DIALOG_WIDTH = {
8
+ small: "max-w-110",
9
+ medium: "max-w-150",
10
+ large: "max-w-200",
11
+ xlarge: "max-w-288",
12
+ };
13
+ export const DRAWER_WIDTH = {
14
+ small: "w-95",
15
+ medium: "w-140",
16
+ large: "w-140",
17
+ };
18
+ /** The scrim: `ds-blanket`, fading in `ds-duration-slow`; still for reduced motion. */
19
+ export const BLANKET = "fixed inset-0 z-50 bg-ds-blanket transition-opacity duration-(--ds-duration-slow) ease-ds-enter " +
20
+ "data-[entering]:opacity-0 data-[exiting]:opacity-0 data-[exiting]:ease-ds-exit motion-reduce:transition-none";
21
+ /** Every overlay's inner focus target: React Aria's dialog element, never outlined itself. */
22
+ export const DIALOG_ELEMENT = "flex min-h-0 flex-1 flex-col outline-hidden";
23
+ /**
24
+ * The state of the DialogTrigger an overlay belongs to. React Aria's own context is also provided by every
25
+ * open modal, so a Dialog nested in a Drawer would bind to the drawer; this one is set by DialogTrigger only
26
+ * and cleared inside every overlay.
27
+ */
28
+ const OwnTriggerContext = React.createContext(null);
29
+ function TriggerBridge({ children }) {
30
+ const state = React.useContext(OverlayTriggerStateContext);
31
+ return _jsx(OwnTriggerContext.Provider, { value: state, children: children });
32
+ }
33
+ /** True inside an open overlay's contents, where React Aria's trigger context is that overlay's own. */
34
+ const InsideOverlayContext = React.createContext(false);
35
+ /** Overlay contents: a nested overlay must not see the outer one's trigger. */
36
+ export function OverlayContents({ children }) {
37
+ return (_jsx(InsideOverlayContext.Provider, { value: true, children: _jsx(OwnTriggerContext.Provider, { value: null, children: children }) }));
38
+ }
39
+ /**
40
+ * The button that opens a Dialog, AlertDialog or Drawer: put it first, the overlay after it. Inside another
41
+ * overlay (a Dialog in a Drawer) use this one, not React Aria's own DialogTrigger, which there only sees the
42
+ * outer overlay's state.
43
+ */
44
+ export function DialogTrigger({ children, ...props }) {
45
+ return (_jsx(AriaDialogTrigger, { ...props, children: _jsx(TriggerBridge, { children: children }) }));
46
+ }
47
+ /**
48
+ * Open state for an overlay that can sit in a DialogTrigger or stand alone. Inside a trigger the trigger's
49
+ * state is used; otherwise `isOpen`/`defaultOpen`. `close` is the one way to close, so `onOpenChange(false)`
50
+ * fires once whichever control asked (button, Esc, scrim).
51
+ */
52
+ export function useOverlayOpen({ isOpen, defaultOpen, onOpenChange }) {
53
+ const ownTrigger = React.useContext(OwnTriggerContext);
54
+ const ariaTrigger = React.useContext(OverlayTriggerStateContext);
55
+ const inside = React.useContext(InsideOverlayContext);
56
+ // Our DialogTrigger first; React Aria's own DialogTrigger also works, except inside another overlay, where
57
+ // that context belongs to the outer overlay.
58
+ const trigger = ownTrigger ?? (inside ? null : ariaTrigger);
59
+ const [own, setOwn] = React.useState(defaultOpen ?? false);
60
+ const open = trigger ? trigger.isOpen : (isOpen ?? own);
61
+ const set = (next) => {
62
+ if (trigger) {
63
+ if (next)
64
+ trigger.open();
65
+ else
66
+ trigger.close();
67
+ return;
68
+ }
69
+ if (isOpen === undefined)
70
+ setOwn(next);
71
+ onOpenChange?.(next);
72
+ };
73
+ return { isOpen: open, open: () => set(true), close: () => set(false) };
74
+ }
75
+ /** The `data-*` entries of a props object, without the DS's own `data-slot`. */
76
+ export function dataAttributes(source) {
77
+ const picked = {};
78
+ if (!source)
79
+ return picked;
80
+ for (const [name, value] of Object.entries(source)) {
81
+ if (name.startsWith("data-") && name !== "data-slot")
82
+ picked[name] = value;
83
+ }
84
+ return picked;
85
+ }
86
+ /**
87
+ * Focus on open: the first field of the body, or the secondary action when the primary one destroys
88
+ * something. Runs after React Aria's own first-focus, so it wins. A destructive primary with no secondary
89
+ * (`secondaryAction={null}` on a full-screen dialog) has no safe button to start on, so focus goes to the first
90
+ * field as it does for any other dialog, and to the dialog itself when the body has none. The
91
+ * app's `initialFocusRef`, when it holds an element, comes before every rule.
92
+ */
93
+ export function useInitialFocus(body, secondary, safeFirst, initial) {
94
+ React.useEffect(() => {
95
+ if (initial?.current) {
96
+ initial.current.focus();
97
+ // An element that cannot take focus (a hidden title, which has no tabIndex; UI#528 review, or a
98
+ // container without one) leaves focus where it was, and a focus handler on the ref may move it
99
+ // outside: in both cases the dialog's own rule below picks the target instead (UI#529 review).
100
+ if (initial.current.contains(document.activeElement))
101
+ return;
102
+ }
103
+ if (safeFirst && secondary.current) {
104
+ secondary.current.focus();
105
+ return;
106
+ }
107
+ const field = [...(body.current?.querySelectorAll(FIRST_FIELD) ?? [])].find(isReachableField);
108
+ field?.focus();
109
+ }, []);
110
+ }
111
+ /**
112
+ * A field the dialog may start on: a text input, a text area, a native select, a combobox, a date or time segment,
113
+ * or a Select or MultiSelect's button (it opens a listbox). In document order.
114
+ */
115
+ const FIRST_FIELD = "input:not([type='hidden']):not([disabled]), textarea:not([disabled]), select:not([disabled]), [role='combobox'], [role='spinbutton'][tabindex], " +
116
+ "button[aria-haspopup='listbox']:not([disabled])";
117
+ /**
118
+ * Not the native fields React Aria keeps for forms and autofill behind a Select (its hidden `<select>` and input),
119
+ * which are hidden from assistive tech, marked to take no focus and out of the tab order: the dialog
120
+ * started on that `<select>` and not on the Select's button. Anything under `aria-hidden` or `inert`, or with a
121
+ * negative tabindex on a native field, is passed over.
122
+ */
123
+ function isReachableField(element) {
124
+ if (element.closest("[aria-hidden='true'], [inert], [data-react-aria-prevent-focus]"))
125
+ return false;
126
+ if (element.matches("input, textarea, select") && element.tabIndex < 0)
127
+ return false;
128
+ return true;
129
+ }
130
+ /** React Aria's FocusScope dispatches this on the element it is about to give focus back to; cancelling it stops that. */
131
+ const RESTORE_FOCUS_EVENT = "react-aria-focus-scope-restore";
132
+ /**
133
+ * `returnFocusRef`: when the dialog's contents unmount (it closed), focus goes to the ref's element
134
+ * instead of the opener. React Aria's own return to the opener is cancelled for that one close, so the opener
135
+ * never flashes focus (and its focus handlers never run). Focus the app moved elsewhere on purpose is left alone.
136
+ * Without the ref, or with it empty, nothing here runs and React Aria returns focus to the opener as before.
137
+ */
138
+ export function useReturnFocus(target) {
139
+ const latest = React.useRef(target);
140
+ latest.current = target;
141
+ // The element focused as the dialog opens is the one React Aria would return to.
142
+ const [opener] = React.useState(() => (typeof document === "undefined" ? null : document.activeElement));
143
+ // Strict Mode unmounts and remounts effects once in development: that is not a close.
144
+ const mounted = React.useRef(false);
145
+ React.useLayoutEffect(() => {
146
+ mounted.current = true;
147
+ return () => {
148
+ mounted.current = false;
149
+ if (!latest.current)
150
+ return;
151
+ const ref = latest.current;
152
+ const cancel = (event) => {
153
+ if (!mounted.current && ref.current && event.target === opener)
154
+ event.preventDefault();
155
+ };
156
+ document.addEventListener(RESTORE_FOCUS_EVENT, cancel, true);
157
+ requestAnimationFrame(() => {
158
+ document.removeEventListener(RESTORE_FOCUS_EVENT, cancel, true);
159
+ if (mounted.current)
160
+ return;
161
+ const element = ref.current;
162
+ const active = document.activeElement;
163
+ const unclaimed = !active || active === document.body || active === opener || !active.isConnected;
164
+ if (element?.isConnected && unclaimed)
165
+ element.focus();
166
+ });
167
+ };
168
+ }, [opener]);
169
+ }
170
+ /**
171
+ * A form-submit primary while pending: React Aria turns the button into `type="button"`, so a click
172
+ * no longer submits, but Enter in a form with one field still would (HTML's implicit submission needs no
173
+ * button). Every submit of that form is stopped here until the action settles, before React's `onSubmit` sees it.
174
+ * The listener sits on `document` (capture) and matches the form by its id when the submit happens, so a form
175
+ * remounted with the same id while pending is stopped too; another form still submits. React's capture
176
+ * handlers on the form (`onSubmitCapture`) still run while pending: the event is cancelled on `document` but
177
+ * stopped only on the form itself, after React's root has seen its capture phase and before its bubble.
178
+ */
179
+ export function useBlockedSubmit(formId, blocked) {
180
+ React.useEffect(() => {
181
+ if (!formId || !blocked)
182
+ return;
183
+ const stopAtForm = (event) => event.stopPropagation();
184
+ const block = (event) => {
185
+ const form = event.target;
186
+ if (!(form instanceof HTMLFormElement) || form.id !== formId)
187
+ return;
188
+ event.preventDefault();
189
+ // Added while the event is on its way down, so it runs when the event reaches the form; taken off after this
190
+ // dispatch in case something above stopped the event first (a task, so never in the middle of it).
191
+ form.addEventListener("submit", stopAtForm, { capture: true, once: true });
192
+ setTimeout(() => form.removeEventListener("submit", stopAtForm, { capture: true }), 0);
193
+ };
194
+ document.addEventListener("submit", block, true);
195
+ return () => document.removeEventListener("submit", block, true);
196
+ }, [formId, blocked]);
197
+ }
198
+ const TABBABLE = [
199
+ "button:not([disabled])",
200
+ "[href]",
201
+ "input:not([type='hidden']):not([disabled])",
202
+ "select:not([disabled])",
203
+ "textarea:not([disabled])",
204
+ "[tabindex]:not([tabindex='-1'])",
205
+ "[contenteditable]:not([contenteditable='false'])",
206
+ "summary",
207
+ "audio[controls]",
208
+ "video[controls]",
209
+ ].join(", ");
210
+ /**
211
+ * Development only: with the close button hidden and no control a keyboard can reach inside, a
212
+ * keyboard user can neither go on nor, without `isDismissable`, leave; even with it (Esc), a touch user on
213
+ * `fullscreen` has no press outside. So it warns whenever the close button is hidden and nothing inside is
214
+ * tabbable, whatever `isDismissable` says. Checked once it opens.
215
+ */
216
+ export function useStrandedWarning(closeHidden, body) {
217
+ React.useEffect(() => {
218
+ if (process.env.NODE_ENV === "production" || !closeHidden)
219
+ return;
220
+ const dialog = body.current?.closest("[data-slot='dialog']");
221
+ if (dialog && !dialog.querySelector(TABBABLE)) {
222
+ console.warn("Dialog: isCloseButtonHidden leaves no close button, and the dialog has no control a keyboard can reach, so a user may be unable to go on or leave. Give it a primaryAction or a control in the body.");
223
+ }
224
+ }, [closeHidden]);
225
+ }
226
+ export function DialogFrame({ size, children, role, isDismissable, escapeCloses, isOpen, onClose, describedBy, rootData }) {
227
+ return (_jsx(ModalOverlay, { ...useMotionAttribute(),
228
+ // Always controlled here: closing goes through `onClose` only, so it is reported once.
229
+ isOpen: isOpen, onOpenChange: (next) => {
230
+ if (!next)
231
+ onClose();
232
+ }, isDismissable: isDismissable, isKeyboardDismissDisabled: !escapeCloses, "data-slot": "dialog-overlay", className: cn(BLANKET, "grid place-items-center overflow-y-auto p-ds-300 pt-[max(var(--ds-space-300),env(safe-area-inset-top,0px))] pb-[max(var(--ds-space-300),env(safe-area-inset-bottom,0px))]"), children: _jsx(Modal, { "data-slot": "dialog-modal", "data-size": size, className: cn(
233
+ // A default max height with the body scrolling inside, so a small screen never pushes the footer away.
234
+ "flex max-h-[calc(100dvh-2*var(--ds-space-300))] w-full flex-col overflow-hidden rounded-ds-xlarge bg-ds-surface-overlay text-ds-text shadow-ds-overlay outline-hidden", "transition-[opacity,translate] duration-(--ds-duration-slow) ease-ds-enter data-[entering]:translate-y-2 data-[entering]:opacity-0 data-[exiting]:opacity-0 data-[exiting]:ease-ds-exit motion-reduce:transition-none", DIALOG_WIDTH[size]), children: _jsx(AriaDialog, { ...rootData, role: role, "aria-describedby": describedBy, "data-slot": "dialog", className: DIALOG_ELEMENT, children: _jsx(OverlayContents, { children: children }) }) }) }));
235
+ }
236
+ /** An empty description (`""`, `false`, `true`, `null`) renders nothing, so it is the same as none. */
237
+ export function hasDescription(description) {
238
+ return description != null && typeof description !== "boolean" && description !== "";
239
+ }
240
+ /** Below 640px: the full-screen dialog's sheet presentation; decided after mount. */
241
+ export function useNarrow() {
242
+ return React.useSyncExternalStore((notify) => {
243
+ if (typeof window.matchMedia !== "function")
244
+ return () => { };
245
+ const query = window.matchMedia("(max-width: 639px)");
246
+ query.addEventListener("change", notify);
247
+ return () => query.removeEventListener("change", notify);
248
+ }, () => typeof window.matchMedia === "function" && window.matchMedia("(max-width: 639px)").matches, () => false);
249
+ }
250
+ //# sourceMappingURL=overlay-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-base.js","sourceRoot":"","sources":["../../src/overlay/overlay-base.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,aAAa,IAAI,iBAAiB,EAAE,KAAK,EAAE,YAAY,EAAE,0BAA0B,EAA2B,MAAM,uBAAuB,CAAC;AAC3K,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAcjD,MAAM,YAAY,GAAgC;IAChD,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,WAAW;IACnB,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAgC;IACvD,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,uFAAuF;AACvF,MAAM,CAAC,MAAM,OAAO,GAClB,kGAAkG;IAClG,8GAA8G,CAAC;AAEjH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,cAAc,GAAG,6CAA6C,CAAC;AAI5E;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAsB,IAAI,CAAC,CAAC;AAEzE,SAAS,aAAa,CAAC,EAAE,QAAQ,EAAiC;IAChE,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;IAC3D,OAAO,KAAC,iBAAiB,CAAC,QAAQ,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AU,cAAc,CAAC,WAA4B;IACzD,OAAO,WAAW,IAAI,IAAI,IAAI,OAAO,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,EAAE,CAAC;AACvF,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,SAAS;IACvB,OAAO,KAAK,CAAC,oBAAoB,CAC/B,CAAC,MAAM,EAAE,EAAE;QACT,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;YAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;QAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;QACtD,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACzC,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC,EACD,GAAG,EAAE,CAAC,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,OAAO,EAChG,GAAG,EAAE,CAAC,KAAK,CACZ,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Dialog as AriaDialog, DialogTrigger as AriaDialogTrigger, Modal, ModalOverlay, OverlayTriggerStateContext, type DialogTriggerProps } from \"react-aria-components\";\nimport { cn } from \"../utils\";\nimport { useMotionAttribute } from \"../defaults\";\n\n/**\n * One size dictionary for Dialog and Drawer: small, medium, large. A dialog is 440, 600 or\n * 800px wide; a drawer is 380 or 560px (it has no medium; medium reads as large).\n */\nexport type OverlaySize = \"small\" | \"medium\" | \"large\";\n\n/**\n * `xlarge` is Dialog's only: 1152px, for a two- or three-column form over the page it edits\n * (an order edit). Below that it takes the viewport less the frame's padding, as every size does.\n */\nexport type DialogWidth = OverlaySize | \"xlarge\";\n\nconst DIALOG_WIDTH: Record<DialogWidth, string> = {\n small: \"max-w-110\",\n medium: \"max-w-150\",\n large: \"max-w-200\",\n xlarge: \"max-w-288\",\n};\n\nexport const DRAWER_WIDTH: Record<OverlaySize, string> = {\n small: \"w-95\",\n medium: \"w-140\",\n large: \"w-140\",\n};\n\n/** The scrim: `ds-blanket`, fading in `ds-duration-slow`; still for reduced motion. */\nexport const BLANKET =\n \"fixed inset-0 z-50 bg-ds-blanket transition-opacity duration-(--ds-duration-slow) ease-ds-enter \" +\n \"data-[entering]:opacity-0 data-[exiting]:opacity-0 data-[exiting]:ease-ds-exit motion-reduce:transition-none\";\n\n/** Every overlay's inner focus target: React Aria's dialog element, never outlined itself. */\nexport const DIALOG_ELEMENT = \"flex min-h-0 flex-1 flex-col outline-hidden\";\n\ntype TriggerState = NonNullable<React.ContextType<typeof OverlayTriggerStateContext>>;\n\n/**\n * The state of the DialogTrigger an overlay belongs to. React Aria's own context is also provided by every\n * open modal, so a Dialog nested in a Drawer would bind to the drawer; this one is set by DialogTrigger only\n * and cleared inside every overlay.\n */\nconst OwnTriggerContext = React.createContext<TriggerState | null>(null);\n\nfunction TriggerBridge({ children }: { children: React.ReactNode }) {\n const state = React.useContext(OverlayTriggerStateContext);\n return <OwnTriggerContext.Provider value={state}>{children}</OwnTriggerContext.Provider>;\n}\n\n/** True inside an open overlay's contents, where React Aria's trigger context is that overlay's own. */\nconst InsideOverlayContext = React.createContext(false);\n\n/** Overlay contents: a nested overlay must not see the outer one's trigger. */\nexport function OverlayContents({ children }: { children: React.ReactNode }) {\n return (\n <InsideOverlayContext.Provider value>\n <OwnTriggerContext.Provider value={null}>{children}</OwnTriggerContext.Provider>\n </InsideOverlayContext.Provider>\n );\n}\n\n/**\n * The button that opens a Dialog, AlertDialog or Drawer: put it first, the overlay after it. Inside another\n * overlay (a Dialog in a Drawer) use this one, not React Aria's own DialogTrigger, which there only sees the\n * outer overlay's state.\n */\nexport function DialogTrigger({ children, ...props }: DialogTriggerProps) {\n return (\n <AriaDialogTrigger {...props}>\n <TriggerBridge>{children}</TriggerBridge>\n </AriaDialogTrigger>\n );\n}\n\nexport type OpenProps = {\n /**\n * Open without a DialogTrigger (a URL, a row click). Inside a DialogTrigger, put `onOpenChange` on the\n * trigger instead: the trigger owns the state there.\n */\n isOpen?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n};\n\n/**\n * Open state for an overlay that can sit in a DialogTrigger or stand alone. Inside a trigger the trigger's\n * state is used; otherwise `isOpen`/`defaultOpen`. `close` is the one way to close, so `onOpenChange(false)`\n * fires once whichever control asked (button, Esc, scrim).\n */\nexport function useOverlayOpen({ isOpen, defaultOpen, onOpenChange }: OpenProps) {\n const ownTrigger = React.useContext(OwnTriggerContext);\n const ariaTrigger = React.useContext(OverlayTriggerStateContext);\n const inside = React.useContext(InsideOverlayContext);\n // Our DialogTrigger first; React Aria's own DialogTrigger also works, except inside another overlay, where\n // that context belongs to the outer overlay.\n const trigger = ownTrigger ?? (inside ? null : ariaTrigger);\n const [own, setOwn] = React.useState(defaultOpen ?? false);\n const open = trigger ? trigger.isOpen : (isOpen ?? own);\n const set = (next: boolean) => {\n if (trigger) {\n if (next) trigger.open();\n else trigger.close();\n return;\n }\n if (isOpen === undefined) setOwn(next);\n onOpenChange?.(next);\n };\n return { isOpen: open, open: () => set(true), close: () => set(false) };\n}\n\n/**\n * `data-*` attributes, such as `data-testid`, passed through to a part of the dialog. `data-slot`\n * (and the footer's `data-layout`) is the DS's own and is never overridden. Not exported: the props that take it name it.\n */\nexport type DataAttributes = { [name: `data-${string}`]: string | number | boolean | undefined };\n\n/** The `data-*` entries of a props object, without the DS's own `data-slot`. */\nexport function dataAttributes(source: object | null | undefined): DataAttributes {\n const picked: DataAttributes = {};\n if (!source) return picked;\n for (const [name, value] of Object.entries(source)) {\n if (name.startsWith(\"data-\") && name !== \"data-slot\") picked[name as `data-${string}`] = value as DataAttributes[`data-${string}`];\n }\n return picked;\n}\n\n/**\n * Focus on open: the first field of the body, or the secondary action when the primary one destroys\n * something. Runs after React Aria's own first-focus, so it wins. A destructive primary with no secondary\n * (`secondaryAction={null}` on a full-screen dialog) has no safe button to start on, so focus goes to the first\n * field as it does for any other dialog, and to the dialog itself when the body has none. The\n * app's `initialFocusRef`, when it holds an element, comes before every rule.\n */\nexport function useInitialFocus(\n body: React.RefObject<HTMLElement | null>,\n secondary: React.RefObject<HTMLElement | null>,\n safeFirst: boolean,\n initial?: React.RefObject<HTMLElement | null>,\n) {\n React.useEffect(() => {\n if (initial?.current) {\n initial.current.focus();\n // An element that cannot take focus (a hidden title, which has no tabIndex; UI#528 review, or a\n // container without one) leaves focus where it was, and a focus handler on the ref may move it\n // outside: in both cases the dialog's own rule below picks the target instead (UI#529 review).\n if (initial.current.contains(document.activeElement)) return;\n }\n if (safeFirst && secondary.current) {\n secondary.current.focus();\n return;\n }\n const field = [...(body.current?.querySelectorAll<HTMLElement>(FIRST_FIELD) ?? [])].find(isReachableField);\n field?.focus();\n }, []);\n}\n\n/**\n * A field the dialog may start on: a text input, a text area, a native select, a combobox, a date or time segment,\n * or a Select or MultiSelect's button (it opens a listbox). In document order.\n */\nconst FIRST_FIELD =\n \"input:not([type='hidden']):not([disabled]), textarea:not([disabled]), select:not([disabled]), [role='combobox'], [role='spinbutton'][tabindex], \" +\n \"button[aria-haspopup='listbox']:not([disabled])\";\n\n/**\n * Not the native fields React Aria keeps for forms and autofill behind a Select (its hidden `<select>` and input),\n * which are hidden from assistive tech, marked to take no focus and out of the tab order: the dialog\n * started on that `<select>` and not on the Select's button. Anything under `aria-hidden` or `inert`, or with a\n * negative tabindex on a native field, is passed over.\n */\nfunction isReachableField(element: HTMLElement) {\n if (element.closest(\"[aria-hidden='true'], [inert], [data-react-aria-prevent-focus]\")) return false;\n if (element.matches(\"input, textarea, select\") && element.tabIndex < 0) return false;\n return true;\n}\n\n/** React Aria's FocusScope dispatches this on the element it is about to give focus back to; cancelling it stops that. */\nconst RESTORE_FOCUS_EVENT = \"react-aria-focus-scope-restore\";\n\n/**\n * `returnFocusRef`: when the dialog's contents unmount (it closed), focus goes to the ref's element\n * instead of the opener. React Aria's own return to the opener is cancelled for that one close, so the opener\n * never flashes focus (and its focus handlers never run). Focus the app moved elsewhere on purpose is left alone.\n * Without the ref, or with it empty, nothing here runs and React Aria returns focus to the opener as before.\n */\nexport function useReturnFocus(target: React.RefObject<HTMLElement | null> | undefined) {\n const latest = React.useRef(target);\n latest.current = target;\n // The element focused as the dialog opens is the one React Aria would return to.\n const [opener] = React.useState(() => (typeof document === \"undefined\" ? null : document.activeElement));\n // Strict Mode unmounts and remounts effects once in development: that is not a close.\n const mounted = React.useRef(false);\n React.useLayoutEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n if (!latest.current) return;\n const ref = latest.current;\n const cancel = (event: Event) => {\n if (!mounted.current && ref.current && event.target === opener) event.preventDefault();\n };\n document.addEventListener(RESTORE_FOCUS_EVENT, cancel, true);\n requestAnimationFrame(() => {\n document.removeEventListener(RESTORE_FOCUS_EVENT, cancel, true);\n if (mounted.current) return;\n const element = ref.current;\n const active = document.activeElement;\n const unclaimed = !active || active === document.body || active === opener || !active.isConnected;\n if (element?.isConnected && unclaimed) element.focus();\n });\n };\n }, [opener]);\n}\n\n/**\n * A form-submit primary while pending: React Aria turns the button into `type=\"button\"`, so a click\n * no longer submits, but Enter in a form with one field still would (HTML's implicit submission needs no\n * button). Every submit of that form is stopped here until the action settles, before React's `onSubmit` sees it.\n * The listener sits on `document` (capture) and matches the form by its id when the submit happens, so a form\n * remounted with the same id while pending is stopped too; another form still submits. React's capture\n * handlers on the form (`onSubmitCapture`) still run while pending: the event is cancelled on `document` but\n * stopped only on the form itself, after React's root has seen its capture phase and before its bubble.\n */\nexport function useBlockedSubmit(formId: string | undefined, blocked: boolean) {\n React.useEffect(() => {\n if (!formId || !blocked) return;\n const stopAtForm = (event: Event) => event.stopPropagation();\n const block = (event: Event) => {\n const form = event.target;\n if (!(form instanceof HTMLFormElement) || form.id !== formId) return;\n event.preventDefault();\n // Added while the event is on its way down, so it runs when the event reaches the form; taken off after this\n // dispatch in case something above stopped the event first (a task, so never in the middle of it).\n form.addEventListener(\"submit\", stopAtForm, { capture: true, once: true });\n setTimeout(() => form.removeEventListener(\"submit\", stopAtForm, { capture: true }), 0);\n };\n document.addEventListener(\"submit\", block, true);\n return () => document.removeEventListener(\"submit\", block, true);\n }, [formId, blocked]);\n}\n\nconst TABBABLE = [\n \"button:not([disabled])\",\n \"[href]\",\n \"input:not([type='hidden']):not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"[tabindex]:not([tabindex='-1'])\",\n \"[contenteditable]:not([contenteditable='false'])\",\n \"summary\",\n \"audio[controls]\",\n \"video[controls]\",\n].join(\", \");\n\n/**\n * Development only: with the close button hidden and no control a keyboard can reach inside, a\n * keyboard user can neither go on nor, without `isDismissable`, leave; even with it (Esc), a touch user on\n * `fullscreen` has no press outside. So it warns whenever the close button is hidden and nothing inside is\n * tabbable, whatever `isDismissable` says. Checked once it opens.\n */\nexport function useStrandedWarning(closeHidden: boolean, body: React.RefObject<HTMLElement | null>) {\n React.useEffect(() => {\n if (process.env.NODE_ENV === \"production\" || !closeHidden) return;\n const dialog = body.current?.closest(\"[data-slot='dialog']\");\n if (dialog && !dialog.querySelector(TABBABLE)) {\n console.warn(\"Dialog: isCloseButtonHidden leaves no close button, and the dialog has no control a keyboard can reach, so a user may be unable to go on or leave. Give it a primaryAction or a control in the body.\");\n }\n }, [closeHidden]);\n}\n\nexport function DialogFrame({ size, children, role, isDismissable, escapeCloses, isOpen, onClose, describedBy, rootData }: {\n size: DialogWidth; children: React.ReactNode; role?: \"dialog\" | \"alertdialog\"; isDismissable: boolean; escapeCloses: boolean;\n isOpen: boolean;\n /** The app's `data-*` attributes for the dialog element; its own `data-slot` comes after them. */\n rootData?: DataAttributes;\n /** Every close request (Esc, scrim, the parts' buttons) comes here. */\n onClose: () => void;\n /** The element whose text describes the dialog (an alert's consequence). */\n describedBy?: string;\n}) {\n return (\n <ModalOverlay\n {...useMotionAttribute()}\n // Always controlled here: closing goes through `onClose` only, so it is reported once.\n isOpen={isOpen}\n onOpenChange={(next) => {\n if (!next) onClose();\n }}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={!escapeCloses}\n data-slot=\"dialog-overlay\"\n className={cn(BLANKET, \"grid place-items-center overflow-y-auto p-ds-300 pt-[max(var(--ds-space-300),env(safe-area-inset-top,0px))] pb-[max(var(--ds-space-300),env(safe-area-inset-bottom,0px))]\")}\n >\n <Modal\n data-slot=\"dialog-modal\"\n // Every size names itself, as fullscreen already did: an app's test reads it, never the width class.\n data-size={size}\n className={cn(\n // A default max height with the body scrolling inside, so a small screen never pushes the footer away.\n \"flex max-h-[calc(100dvh-2*var(--ds-space-300))] w-full flex-col overflow-hidden rounded-ds-xlarge bg-ds-surface-overlay text-ds-text shadow-ds-overlay outline-hidden\",\n \"transition-[opacity,translate] duration-(--ds-duration-slow) ease-ds-enter data-[entering]:translate-y-2 data-[entering]:opacity-0 data-[exiting]:opacity-0 data-[exiting]:ease-ds-exit motion-reduce:transition-none\",\n DIALOG_WIDTH[size],\n )}\n >\n <AriaDialog {...rootData} role={role} aria-describedby={describedBy} data-slot=\"dialog\" className={DIALOG_ELEMENT}>\n <OverlayContents>{children}</OverlayContents>\n </AriaDialog>\n </Modal>\n </ModalOverlay>\n );\n}\n\n/** An empty description (`\"\"`, `false`, `true`, `null`) renders nothing, so it is the same as none. */\nexport function hasDescription(description: React.ReactNode) {\n return description != null && typeof description !== \"boolean\" && description !== \"\";\n}\n\n/** Below 640px: the full-screen dialog's sheet presentation; decided after mount. */\nexport function useNarrow() {\n return React.useSyncExternalStore(\n (notify) => {\n if (typeof window.matchMedia !== \"function\") return () => {};\n const query = window.matchMedia(\"(max-width: 639px)\");\n query.addEventListener(\"change\", notify);\n return () => query.removeEventListener(\"change\", notify);\n },\n () => typeof window.matchMedia === \"function\" && window.matchMedia(\"(max-width: 639px)\").matches,\n () => false,\n );\n}\n"]}