@arc-ui/components 11.7.0 → 11.9.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 (249) hide show
  1. package/dist/Alert/Alert.cjs.d.ts +1 -1
  2. package/dist/Alert/Alert.cjs.js +10 -89
  3. package/dist/Alert/Alert.esm.d.ts +1 -1
  4. package/dist/Alert/Alert.esm.js +3 -82
  5. package/dist/Badge/Badge.cjs.d.ts +4 -0
  6. package/dist/Badge/Badge.cjs.js +4 -4
  7. package/dist/Badge/Badge.esm.d.ts +4 -0
  8. package/dist/Badge/Badge.esm.js +5 -5
  9. package/dist/Box/Box.cjs.d.ts +40 -1
  10. package/dist/Box/Box.cjs.js +25 -6
  11. package/dist/Box/Box.esm.d.ts +40 -1
  12. package/dist/Box/Box.esm.js +24 -5
  13. package/dist/Breadcrumbs/Breadcrumbs.cjs.d.ts +1 -1
  14. package/dist/Breadcrumbs/Breadcrumbs.cjs.js +2 -2
  15. package/dist/Breadcrumbs/Breadcrumbs.esm.d.ts +1 -1
  16. package/dist/Breadcrumbs/Breadcrumbs.esm.js +2 -2
  17. package/dist/Button/Button.cjs.d.ts +1 -1
  18. package/dist/Button/Button.cjs.js +1 -1
  19. package/dist/Button/Button.esm.d.ts +1 -1
  20. package/dist/Button/Button.esm.js +1 -1
  21. package/dist/Card/Card.cjs.d.ts +1 -1
  22. package/dist/Card/Card.cjs.js +2 -2
  23. package/dist/Card/Card.esm.d.ts +1 -1
  24. package/dist/Card/Card.esm.js +2 -2
  25. package/dist/Checkbox/Checkbox.cjs.d.ts +1 -1
  26. package/dist/Checkbox/Checkbox.cjs.js +4 -4
  27. package/dist/Checkbox/Checkbox.esm.d.ts +1 -1
  28. package/dist/Checkbox/Checkbox.esm.js +4 -4
  29. package/dist/Columns/Columns.cjs.d.ts +1 -1
  30. package/dist/Columns/Columns.esm.d.ts +1 -1
  31. package/dist/Curve/Curve.cjs.d.ts +1 -1
  32. package/dist/Curve/Curve.cjs.js +1 -1
  33. package/dist/Curve/Curve.esm.d.ts +1 -1
  34. package/dist/Curve/Curve.esm.js +1 -1
  35. package/dist/Disclosure/Disclosure.cjs.d.ts +1 -1
  36. package/dist/Disclosure/Disclosure.cjs.js +1 -1
  37. package/dist/Disclosure/Disclosure.esm.d.ts +1 -1
  38. package/dist/Disclosure/Disclosure.esm.js +1 -1
  39. package/dist/DisclosureMini/DisclosureMini.cjs.d.ts +1 -1
  40. package/dist/DisclosureMini/DisclosureMini.cjs.js +2 -2
  41. package/dist/DisclosureMini/DisclosureMini.esm.d.ts +1 -1
  42. package/dist/DisclosureMini/DisclosureMini.esm.js +2 -2
  43. package/dist/FormControl/FormControl.cjs.d.ts +1 -1
  44. package/dist/FormControl/FormControl.cjs.js +3 -3
  45. package/dist/FormControl/FormControl.esm.d.ts +1 -1
  46. package/dist/FormControl/FormControl.esm.js +3 -3
  47. package/dist/Heading/Heading.cjs.d.ts +1 -1
  48. package/dist/Heading/Heading.cjs.js +1 -1
  49. package/dist/Heading/Heading.esm.d.ts +1 -1
  50. package/dist/Heading/Heading.esm.js +1 -1
  51. package/dist/Modal/Modal.cjs.d.ts +31 -9
  52. package/dist/Modal/Modal.cjs.js +450 -161
  53. package/dist/Modal/Modal.esm.d.ts +31 -9
  54. package/dist/Modal/Modal.esm.js +423 -134
  55. package/dist/Pagination/Pagination.cjs.js +4 -4
  56. package/dist/Pagination/Pagination.esm.js +4 -4
  57. package/dist/PaginationSimple/PaginationSimple.cjs.js +4 -4
  58. package/dist/PaginationSimple/PaginationSimple.esm.js +4 -4
  59. package/dist/ProgressBar/ProgressBar.cjs.js +5 -5
  60. package/dist/ProgressBar/ProgressBar.esm.js +6 -6
  61. package/dist/ProgressStepper/ProgressStepper.cjs.d.ts +1 -89
  62. package/dist/ProgressStepper/ProgressStepper.cjs.js +10 -144
  63. package/dist/ProgressStepper/ProgressStepper.esm.d.ts +1 -89
  64. package/dist/ProgressStepper/ProgressStepper.esm.js +9 -143
  65. package/dist/RadioGroup/RadioGroup.cjs.d.ts +1 -1
  66. package/dist/RadioGroup/RadioGroup.cjs.js +4 -4
  67. package/dist/RadioGroup/RadioGroup.esm.d.ts +1 -1
  68. package/dist/RadioGroup/RadioGroup.esm.js +4 -4
  69. package/dist/Select/Select.cjs.d.ts +1 -1
  70. package/dist/Select/Select.cjs.js +995 -60
  71. package/dist/Select/Select.esm.d.ts +1 -1
  72. package/dist/Select/Select.esm.js +948 -32
  73. package/dist/SiteFooter/SiteFooter.cjs.d.ts +1 -1
  74. package/dist/SiteFooter/SiteFooter.cjs.js +2 -2
  75. package/dist/SiteFooter/SiteFooter.esm.d.ts +1 -1
  76. package/dist/SiteFooter/SiteFooter.esm.js +3 -3
  77. package/dist/SiteHeader/SiteHeader.cjs.d.ts +1 -1
  78. package/dist/SiteHeader/SiteHeader.cjs.js +3 -3
  79. package/dist/SiteHeader/SiteHeader.esm.d.ts +1 -1
  80. package/dist/SiteHeader/SiteHeader.esm.js +3 -3
  81. package/dist/Switch/Switch.cjs.d.ts +1 -1
  82. package/dist/Switch/Switch.cjs.js +241 -18
  83. package/dist/Switch/Switch.esm.d.ts +1 -1
  84. package/dist/Switch/Switch.esm.js +234 -11
  85. package/dist/Tabs/Tabs.cjs.d.ts +1 -0
  86. package/dist/Tabs/Tabs.cjs.js +20 -0
  87. package/dist/Tabs/Tabs.esm.d.ts +1 -0
  88. package/dist/Tabs/Tabs.esm.js +12 -0
  89. package/dist/Tabs/package.json +7 -0
  90. package/dist/Text/Text.cjs.d.ts +1 -1
  91. package/dist/Text/Text.cjs.js +1 -1
  92. package/dist/Text/Text.esm.d.ts +1 -1
  93. package/dist/Text/Text.esm.js +1 -1
  94. package/dist/TextArea/TextArea.cjs.d.ts +4 -1
  95. package/dist/TextArea/TextArea.cjs.js +30 -17
  96. package/dist/TextArea/TextArea.esm.d.ts +4 -1
  97. package/dist/TextArea/TextArea.esm.js +30 -17
  98. package/dist/TextInput/TextInput.cjs.d.ts +1 -1
  99. package/dist/TextInput/TextInput.cjs.js +4 -4
  100. package/dist/TextInput/TextInput.esm.d.ts +1 -1
  101. package/dist/TextInput/TextInput.esm.js +4 -4
  102. package/dist/Toast/Toast.cjs.d.ts +1 -0
  103. package/dist/Toast/Toast.cjs.js +23 -0
  104. package/dist/Toast/Toast.esm.d.ts +1 -0
  105. package/dist/Toast/Toast.esm.js +15 -0
  106. package/dist/Toast/package.json +7 -0
  107. package/dist/Truncate/Truncate.cjs.js +3 -2
  108. package/dist/Truncate/Truncate.esm.js +3 -2
  109. package/dist/_shared/cjs/{Breadcrumbs-9f580f69.js → Breadcrumbs-0906dd10.js} +9 -9
  110. package/dist/_shared/cjs/BtIconTick-42fcc5ec.js +91 -0
  111. package/dist/_shared/{esm/Button-9c3b0b11.d.ts → cjs/Button-5aaa6776.d.ts} +4 -0
  112. package/dist/_shared/cjs/{Button-b4d6ccc8.js → Button-5aaa6776.js} +2 -2
  113. package/dist/_shared/cjs/{Card-f1108bfe.js → Card-fd189ba8.js} +1 -1
  114. package/dist/_shared/cjs/{Checkbox-c927b62f.js → Checkbox-02c546ca.js} +1 -1
  115. package/dist/_shared/cjs/Columns-e90798f8.d.ts +1 -1
  116. package/dist/_shared/cjs/{Curve-b05589d8.d.ts → Curve-781ef633.d.ts} +5 -2
  117. package/dist/_shared/cjs/{Curve-b05589d8.js → Curve-781ef633.js} +5 -2
  118. package/dist/_shared/cjs/{DisclosureMini-2a10006e.js → DisclosureMini-52706ee6.js} +1 -1
  119. package/dist/_shared/cjs/{FormControl-78b007b7.js → FormControl-1e1bf2bf.js} +1 -1
  120. package/dist/_shared/cjs/{Heading-ed1cb455.d.ts → Heading-e3332dcf.d.ts} +4 -0
  121. package/dist/_shared/cjs/{Heading-ed1cb455.js → Heading-e3332dcf.js} +2 -2
  122. package/dist/{MediaCard/MediaCard.cjs.d.ts → _shared/cjs/MediaCard-9483ad5f.d.ts} +3 -4
  123. package/dist/_shared/cjs/ProgressStepper-f740d7bb.d.ts +89 -0
  124. package/dist/_shared/cjs/ProgressStepper-f740d7bb.js +149 -0
  125. package/dist/_shared/{esm/RadioGroup-65b8c8bf.d.ts → cjs/RadioGroup-d7664b0c.d.ts} +1 -1
  126. package/dist/_shared/cjs/{RadioGroup-8e17de70.js → RadioGroup-d7664b0c.js} +1 -1
  127. package/dist/_shared/cjs/{SiteFooter-9f7f9c2d.js → SiteFooter-5da774e1.js} +1 -1
  128. package/dist/_shared/cjs/SiteHeader-c25ee36e.d.ts +2 -2
  129. package/dist/_shared/cjs/{SiteHeader.rehydrator-ccbebde6.js → SiteHeader.rehydrator-acc9d8c4.js} +2 -2
  130. package/dist/_shared/cjs/Tabs-fda49692.d.ts +75 -0
  131. package/dist/_shared/cjs/Tabs-fda49692.js +510 -0
  132. package/dist/_shared/{esm/Text-14deb70e.d.ts → cjs/Text-fa447e2d.d.ts} +4 -0
  133. package/dist/_shared/cjs/{Text-555a29a4.js → Text-fa447e2d.js} +2 -2
  134. package/dist/_shared/cjs/{TextInput-7ed03a48.d.ts → TextInput-13050538.d.ts} +3 -1
  135. package/dist/_shared/{esm/TextInput-62bb7dee.d.ts → cjs/TextInput-f4549637.d.ts} +1 -1
  136. package/dist/_shared/cjs/{TextInput-b768e346.js → TextInput-f4549637.js} +1 -1
  137. package/dist/_shared/cjs/Toast-0cb23cae.d.ts +52 -0
  138. package/dist/_shared/cjs/Toast-0cb23cae.js +739 -0
  139. package/dist/_shared/cjs/extends-bb8ffacd.js +21 -0
  140. package/dist/_shared/cjs/index-27b53d49.js +174 -0
  141. package/dist/_shared/cjs/index-699086a7.d.ts +1 -1
  142. package/dist/_shared/cjs/index-74488a9f.d.ts +1 -1
  143. package/dist/_shared/cjs/{index.module-9b87a34d.js → index-952918c9.js} +141 -33
  144. package/dist/_shared/cjs/index-96c4d581.js +289 -0
  145. package/dist/_shared/cjs/index-c81c9401.d.ts +3 -3
  146. package/dist/_shared/cjs/index-e340924e.d.ts +1 -1
  147. package/dist/_shared/cjs/index-e6d20018.d.ts +1 -1
  148. package/dist/_shared/cjs/index-eb06f640.d.ts +1 -1
  149. package/dist/_shared/cjs/{index-31fbb076.js → index-ec260f5e.js} +0 -547
  150. package/dist/_shared/cjs/index-f419cf04.d.ts +1 -1
  151. package/dist/_shared/cjs/index-fb4b8fda.js +47 -0
  152. package/dist/_shared/cjs/index.module-bbcc4e18.js +126 -0
  153. package/dist/_shared/esm/{Breadcrumbs-5dc0afa7.js → Breadcrumbs-dafa8dde.js} +9 -9
  154. package/dist/_shared/esm/BtIconTick-5fe50cc7.js +83 -0
  155. package/dist/_shared/{cjs/Button-b4d6ccc8.d.ts → esm/Button-d1dbcf79.d.ts} +4 -0
  156. package/dist/_shared/esm/{Button-9c3b0b11.js → Button-d1dbcf79.js} +2 -2
  157. package/dist/_shared/esm/{Card-79b6eae0.js → Card-e62c3ff6.js} +1 -1
  158. package/dist/_shared/esm/{Checkbox-2d144384.js → Checkbox-d8891198.js} +1 -1
  159. package/dist/_shared/esm/Columns-8704515b.d.ts +1 -1
  160. package/dist/_shared/esm/{Curve-3e87b1bc.d.ts → Curve-bbc5589c.d.ts} +5 -2
  161. package/dist/_shared/esm/{Curve-3e87b1bc.js → Curve-bbc5589c.js} +5 -2
  162. package/dist/_shared/esm/{DisclosureMini-78a8f392.js → DisclosureMini-9b819941.js} +1 -1
  163. package/dist/_shared/esm/{FormControl-2fa7aae5.js → FormControl-f18e2f59.js} +1 -1
  164. package/dist/_shared/esm/{Heading-ee6bec51.d.ts → Heading-0f629151.d.ts} +4 -0
  165. package/dist/_shared/esm/{Heading-ee6bec51.js → Heading-0f629151.js} +2 -2
  166. package/dist/{MediaCard/MediaCard.esm.d.ts → _shared/esm/MediaCard-9483ad5f.d.ts} +3 -4
  167. package/dist/_shared/esm/ProgressStepper-7ab88f4c.d.ts +89 -0
  168. package/dist/_shared/esm/ProgressStepper-7ab88f4c.js +143 -0
  169. package/dist/_shared/{cjs/RadioGroup-8e17de70.d.ts → esm/RadioGroup-be16d5d3.d.ts} +1 -1
  170. package/dist/_shared/esm/{RadioGroup-65b8c8bf.js → RadioGroup-be16d5d3.js} +1 -1
  171. package/dist/_shared/esm/{SiteFooter-51bdc7df.js → SiteFooter-a182cb18.js} +1 -1
  172. package/dist/_shared/esm/SiteHeader-c25ee36e.d.ts +2 -2
  173. package/dist/_shared/esm/{SiteHeader.rehydrator-382d1c03.js → SiteHeader.rehydrator-023b7b76.js} +2 -2
  174. package/dist/_shared/esm/Tabs-5af0b940.d.ts +75 -0
  175. package/dist/_shared/esm/Tabs-5af0b940.js +504 -0
  176. package/dist/_shared/{cjs/Text-555a29a4.d.ts → esm/Text-40457811.d.ts} +4 -0
  177. package/dist/_shared/esm/{Text-14deb70e.js → Text-40457811.js} +2 -2
  178. package/dist/_shared/esm/{TextInput-7ed03a48.d.ts → TextInput-13050538.d.ts} +3 -1
  179. package/dist/_shared/{cjs/TextInput-b768e346.d.ts → esm/TextInput-4424c195.d.ts} +3 -3
  180. package/dist/_shared/esm/{TextInput-62bb7dee.js → TextInput-4424c195.js} +1 -1
  181. package/dist/_shared/esm/Toast-43795e91.d.ts +52 -0
  182. package/dist/_shared/esm/Toast-43795e91.js +733 -0
  183. package/dist/_shared/esm/extends-4575346e.js +19 -0
  184. package/dist/_shared/esm/{index.module-216016b5.js → index-22aad354.js} +138 -29
  185. package/dist/_shared/esm/{index-4fa635bd.js → index-369dce7f.js} +2 -541
  186. package/dist/_shared/esm/index-699086a7.d.ts +1 -1
  187. package/dist/_shared/esm/index-74488a9f.d.ts +1 -1
  188. package/dist/_shared/esm/index-8000d9e3.js +168 -0
  189. package/dist/_shared/esm/index-94ecc5f8.js +280 -0
  190. package/dist/_shared/esm/index-bed18a88.js +26 -0
  191. package/dist/_shared/esm/index-c81c9401.d.ts +3 -3
  192. package/dist/_shared/esm/index-e340924e.d.ts +1 -1
  193. package/dist/_shared/esm/index-e6d20018.d.ts +1 -1
  194. package/dist/_shared/esm/index-eb06f640.d.ts +1 -1
  195. package/dist/_shared/esm/index-f419cf04.d.ts +1 -1
  196. package/dist/_shared/esm/index.module-5ed90b21.js +122 -0
  197. package/dist/index.es.js +5036 -1358
  198. package/dist/index.es.js.map +1 -1
  199. package/dist/index.js +5358 -1668
  200. package/dist/index.js.map +1 -1
  201. package/dist/styles.css +1 -1
  202. package/dist/types/components/Badge/Badge.d.ts +4 -0
  203. package/dist/types/components/Button/Button.d.ts +4 -0
  204. package/dist/types/components/Columns/Columns.d.ts +1 -1
  205. package/dist/types/components/Columns/index.d.ts +1 -1
  206. package/dist/types/components/Curve/Curve.d.ts +5 -2
  207. package/dist/types/components/Heading/Heading.d.ts +4 -0
  208. package/dist/types/components/Modal/Modal.d.ts +31 -9
  209. package/dist/types/components/Tabs/Tab/Tab.d.ts +22 -0
  210. package/dist/types/components/Tabs/Tab/index.d.ts +1 -0
  211. package/dist/types/components/Tabs/TabContent/TabContent.d.ts +12 -0
  212. package/dist/types/components/Tabs/TabContent/index.d.ts +1 -0
  213. package/dist/types/components/Tabs/Tabs.d.ts +27 -0
  214. package/dist/types/components/Tabs/TabsList/TabsList.d.ts +20 -0
  215. package/dist/types/components/Tabs/TabsList/index.d.ts +1 -0
  216. package/dist/types/components/Tabs/index.d.ts +1 -0
  217. package/dist/types/components/Text/Text.d.ts +4 -0
  218. package/dist/types/components/TextArea/TextArea.d.ts +3 -0
  219. package/dist/types/components/TextInput/TextInput.d.ts +2 -0
  220. package/dist/types/components/Toast/Toast.d.ts +14 -0
  221. package/dist/types/components/Toast/ToastNotification.d.ts +39 -0
  222. package/dist/types/components/Toast/index.d.ts +1 -0
  223. package/dist/types/components/index.d.ts +18 -6
  224. package/dist/types/styles.d.ts +3 -2
  225. package/package.json +8 -6
  226. package/dist/MediaCard/MediaCard.cjs.js +0 -31
  227. package/dist/MediaCard/MediaCard.esm.js +0 -23
  228. package/dist/MediaCard/package.json +0 -7
  229. package/dist/_shared/cjs/Box-ebe2b7be.d.ts +0 -39
  230. package/dist/_shared/cjs/Box-ebe2b7be.js +0 -30
  231. package/dist/_shared/cjs/index.module-5ea728f4.js +0 -23
  232. package/dist/_shared/esm/Box-06d99d8a.d.ts +0 -39
  233. package/dist/_shared/esm/Box-06d99d8a.js +0 -24
  234. package/dist/_shared/esm/index.module-88179159.js +0 -21
  235. package/dist/types/components/Modal/Modal.stories-wip.d.ts +0 -9
  236. /package/dist/_shared/cjs/{Breadcrumbs-9f580f69.d.ts → Breadcrumbs-0906dd10.d.ts} +0 -0
  237. /package/dist/_shared/cjs/{Card-f1108bfe.d.ts → Card-fd189ba8.d.ts} +0 -0
  238. /package/dist/_shared/cjs/{Checkbox-c927b62f.d.ts → Checkbox-02c546ca.d.ts} +0 -0
  239. /package/dist/_shared/cjs/{DisclosureMini-2a10006e.d.ts → DisclosureMini-52706ee6.d.ts} +0 -0
  240. /package/dist/_shared/cjs/{FormControl-78b007b7.d.ts → FormControl-1e1bf2bf.d.ts} +0 -0
  241. /package/dist/_shared/cjs/{SiteFooter-9f7f9c2d.d.ts → SiteFooter-5da774e1.d.ts} +0 -0
  242. /package/dist/_shared/cjs/{SiteHeader.rehydrator-ccbebde6.d.ts → SiteHeader.rehydrator-acc9d8c4.d.ts} +0 -0
  243. /package/dist/_shared/esm/{Breadcrumbs-5dc0afa7.d.ts → Breadcrumbs-dafa8dde.d.ts} +0 -0
  244. /package/dist/_shared/esm/{Card-79b6eae0.d.ts → Card-e62c3ff6.d.ts} +0 -0
  245. /package/dist/_shared/esm/{Checkbox-2d144384.d.ts → Checkbox-d8891198.d.ts} +0 -0
  246. /package/dist/_shared/esm/{DisclosureMini-78a8f392.d.ts → DisclosureMini-9b819941.d.ts} +0 -0
  247. /package/dist/_shared/esm/{FormControl-2fa7aae5.d.ts → FormControl-f18e2f59.d.ts} +0 -0
  248. /package/dist/_shared/esm/{SiteFooter-51bdc7df.d.ts → SiteFooter-a182cb18.d.ts} +0 -0
  249. /package/dist/_shared/esm/{SiteHeader.rehydrator-382d1c03.d.ts → SiteHeader.rehydrator-023b7b76.d.ts} +0 -0
@@ -1,140 +1,396 @@
1
- import React__default, { useCallback, Children, cloneElement, useState, useRef, useReducer, useEffect, createElement, forwardRef, Fragment, useContext } from 'react';
2
- import { $ as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, a as $9f79659886946c16$export$e5c5a5f917a5871c, b as $c512c27ab02ef895$export$50c7b4e9d9f19c1, c as $71cd76cc60e0454e$export$6f32135080cb4c3, _ as _extends, d as $5e63c961fc1ce211$export$8c6ed5c666ac1360, e as $8927f6f2acc4f386$export$250ffa63cdc0d034, f as $e42e1063c40fb3ef$export$b9ecd428b558ff10 } from '../_shared/esm/index.module-216016b5.js';
3
- import { $ as $1746a345f3d73bb7$export$f680877a34711e37, a as $f1701beae083dbae$export$602eac185826482c, b as $01b9c$RemoveScroll, h as hideOthers, c as $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c, d as $d3863c46a17e8a28$export$20e40289641fbbb6, e as $5cb92bef7577960e$export$177fb62ff3ec1f22 } from '../_shared/esm/index-4fa635bd.js';
4
- import { flushSync } from 'react-dom';
5
- import { I as Icon } from '../_shared/esm/Icon-c1af47bc.js';
1
+ import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/esm/filter-data-attrs-afdb7d32.js';
2
+ import React__default, { forwardRef, useState, useRef, useEffect, useCallback, createElement, Children, isValidElement, cloneElement, Fragment, useContext } from 'react';
3
+ import { c as classNames } from '../_shared/esm/index-2ae58626.js';
6
4
  import { B as BtIconCrossAlt2Px_2 } from '../_shared/esm/BtIconCrossAlt2Px-a6a9f431.js';
7
- import { V as VisuallyHidden } from '../_shared/esm/VisuallyHidden-b9eebf71.js';
5
+ import { _ as _extends } from '../_shared/esm/extends-4575346e.js';
6
+ import { $ as $b1b2314f5f9a1d84$export$25bec8c6f54ee79a, a as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, b as $8927f6f2acc4f386$export$250ffa63cdc0d034, c as $6ed0406888f73fc4$export$43e446d32b3d21af, d as $c512c27ab02ef895$export$50c7b4e9d9f19c1, e as $71cd76cc60e0454e$export$6f32135080cb4c3, f as $921a889cee6df7e8$export$99c2b779aa4e8b8b, g as $e42e1063c40fb3ef$export$b9ecd428b558ff10 } from '../_shared/esm/index-22aad354.js';
7
+ import { $ as $1746a345f3d73bb7$export$f680877a34711e37 } from '../_shared/esm/index-bed18a88.js';
8
+ import { $ as $f1701beae083dbae$export$602eac185826482c, a as $5cb92bef7577960e$export$177fb62ff3ec1f22 } from '../_shared/esm/index-94ecc5f8.js';
9
+ import { $ as $01b9c$RemoveScroll, h as hideOthers } from '../_shared/esm/index-369dce7f.js';
10
+ import { I as Icon } from '../_shared/esm/Icon-c1af47bc.js';
8
11
  import { A as ArcRootElementContext } from '../_shared/esm/Base-6c01e0ec.js';
9
- import { H as Heading } from '../_shared/esm/Heading-ee6bec51.js';
10
- import { T as Text } from '../_shared/esm/Text-14deb70e.js';
11
- import '../_shared/esm/filter-data-attrs-afdb7d32.js';
12
- import '../_shared/esm/index-2ae58626.js';
12
+ import { H as Heading } from '../_shared/esm/Heading-0f629151.js';
13
+ import { B as Button } from '../_shared/esm/Button-d1dbcf79.js';
14
+ import { T as Text } from '../_shared/esm/Text-40457811.js';
15
+ import { V as VerticalSpace } from '../_shared/esm/VerticalSpace-93980c9c.js';
16
+ import 'react-dom';
13
17
  import '../_shared/esm/suffix-modifier-7e640670.js';
14
18
  import '../_shared/esm/Surface-dde51789.js';
19
+ import '../_shared/esm/BtIconChevronLeftMid-9f4f3a3d.js';
20
+ import '../_shared/esm/BtIconChevronRightMid-d9b11761.js';
15
21
 
16
- function $fe963b355347cc68$export$3e6543de14f8614f(initialState, machine) {
17
- return useReducer((state, event)=>{
18
- const nextState = machine[state][event];
19
- return nextState !== null && nextState !== void 0 ? nextState : state;
20
- }, initialState);
21
- }
22
-
23
-
24
- const $921a889cee6df7e8$export$99c2b779aa4e8b8b = (props)=>{
25
- const { present: present , children: children } = props;
26
- const presence = $921a889cee6df7e8$var$usePresence(present);
27
- const child = typeof children === 'function' ? children({
28
- present: presence.isPresent
29
- }) : Children.only(children);
30
- const ref = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(presence.ref, child.ref);
31
- const forceMount = typeof children === 'function';
32
- return forceMount || presence.isPresent ? /*#__PURE__*/ cloneElement(child, {
33
- ref: ref
34
- }) : null;
22
+ const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
23
+ const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
24
+ const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
25
+ bubbles: false,
26
+ cancelable: true
35
27
  };
36
- $921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = 'Presence';
37
- /* -------------------------------------------------------------------------------------------------
38
- * usePresence
39
- * -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$usePresence(present) {
40
- const [node1, setNode] = useState();
41
- const stylesRef = useRef({});
42
- const prevPresentRef = useRef(present);
43
- const prevAnimationNameRef = useRef('none');
44
- const initialState = present ? 'mounted' : 'unmounted';
45
- const [state, send] = $fe963b355347cc68$export$3e6543de14f8614f(initialState, {
46
- mounted: {
47
- UNMOUNT: 'unmounted',
48
- ANIMATION_OUT: 'unmountSuspended'
28
+ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
29
+ const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
30
+ const [container1, setContainer] = useState(null);
31
+ const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
32
+ const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
33
+ const lastFocusedElementRef = useRef(null);
34
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
35
+ );
36
+ const focusScope = useRef({
37
+ paused: false,
38
+ pause () {
39
+ this.paused = true;
49
40
  },
50
- unmountSuspended: {
51
- MOUNT: 'mounted',
52
- ANIMATION_END: 'unmounted'
53
- },
54
- unmounted: {
55
- MOUNT: 'mounted'
41
+ resume () {
42
+ this.paused = false;
56
43
  }
57
- });
44
+ }).current; // Takes care of trapping focus if focus is moved outside programmatically for example
58
45
  useEffect(()=>{
59
- const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
60
- prevAnimationNameRef.current = state === 'mounted' ? currentAnimationName : 'none';
61
- }, [
62
- state
63
- ]);
64
- $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
65
- const styles = stylesRef.current;
66
- const wasPresent = prevPresentRef.current;
67
- const hasPresentChanged = wasPresent !== present;
68
- if (hasPresentChanged) {
69
- const prevAnimationName = prevAnimationNameRef.current;
70
- const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles);
71
- if (present) send('MOUNT');
72
- else if (currentAnimationName === 'none' || (styles === null || styles === void 0 ? void 0 : styles.display) === 'none') // If there is no exit animation or the element is hidden, animations won't run
73
- // so we unmount instantly
74
- send('UNMOUNT');
75
- else {
76
- /**
77
- * When `present` changes to `false`, we check changes to animation-name to
78
- * determine whether an animation has started. We chose this approach (reading
79
- * computed styles) because there is no `animationrun` event and `animationstart`
80
- * fires after `animation-delay` has expired which would be too late.
81
- */ const isAnimating = prevAnimationName !== currentAnimationName;
82
- if (wasPresent && isAnimating) send('ANIMATION_OUT');
83
- else send('UNMOUNT');
46
+ if (trapped) {
47
+ function handleFocusIn(event) {
48
+ if (focusScope.paused || !container1) return;
49
+ const target = event.target;
50
+ if (container1.contains(target)) lastFocusedElementRef.current = target;
51
+ else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
52
+ select: true
53
+ });
84
54
  }
85
- prevPresentRef.current = present;
55
+ function handleFocusOut(event) {
56
+ if (focusScope.paused || !container1) return;
57
+ const relatedTarget = event.relatedTarget; // A `focusout` event with a `null` `relatedTarget` will happen in at least two cases:
58
+ //
59
+ // 1. When the user switches app/tabs/windows/the browser itself loses focus.
60
+ // 2. In Google Chrome, when the focused element is removed from the DOM.
61
+ //
62
+ // We let the browser do its thing here because:
63
+ //
64
+ // 1. The browser already keeps a memory of what's focused for when the page gets refocused.
65
+ // 2. In Google Chrome, if we try to focus the deleted focused element (as per below), it
66
+ // throws the CPU to 100%, so we avoid doing anything for this reason here too.
67
+ if (relatedTarget === null) return; // If the focus has moved to an actual legitimate element (`relatedTarget !== null`)
68
+ // that is outside the container, we move focus to the last valid focused element inside.
69
+ if (!container1.contains(relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
70
+ select: true
71
+ });
72
+ } // When the focused element gets removed from the DOM, browsers move focus
73
+ // back to the document.body. In this case, we move focus to the container
74
+ // to keep focus trapped correctly.
75
+ function handleMutations(mutations) {
76
+ const focusedElement = document.activeElement;
77
+ for (const mutation of mutations){
78
+ if (mutation.removedNodes.length > 0) {
79
+ if (!(container1 !== null && container1 !== void 0 && container1.contains(focusedElement))) $d3863c46a17e8a28$var$focus(container1);
80
+ }
81
+ }
82
+ }
83
+ document.addEventListener('focusin', handleFocusIn);
84
+ document.addEventListener('focusout', handleFocusOut);
85
+ const mutationObserver = new MutationObserver(handleMutations);
86
+ if (container1) mutationObserver.observe(container1, {
87
+ childList: true,
88
+ subtree: true
89
+ });
90
+ return ()=>{
91
+ document.removeEventListener('focusin', handleFocusIn);
92
+ document.removeEventListener('focusout', handleFocusOut);
93
+ mutationObserver.disconnect();
94
+ };
86
95
  }
87
96
  }, [
88
- present,
89
- send
97
+ trapped,
98
+ container1,
99
+ focusScope.paused
90
100
  ]);
91
- $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
92
- if (node1) {
93
- /**
94
- * Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`
95
- * event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we
96
- * make sure we only trigger ANIMATION_END for the currently active animation.
97
- */ const handleAnimationEnd = (event)=>{
98
- const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
99
- const isCurrentAnimation = currentAnimationName.includes(event.animationName);
100
- if (event.target === node1 && isCurrentAnimation) // With React 18 concurrency this update is applied
101
- // a frame after the animation ends, creating a flash of visible content.
102
- // By manually flushing we ensure they sync within a frame, removing the flash.
103
- flushSync(()=>send('ANIMATION_END')
104
- );
105
- };
106
- const handleAnimationStart = (event)=>{
107
- if (event.target === node1) // if animation occurred, store its name as the previous animation.
108
- prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
109
- };
110
- node1.addEventListener('animationstart', handleAnimationStart);
111
- node1.addEventListener('animationcancel', handleAnimationEnd);
112
- node1.addEventListener('animationend', handleAnimationEnd);
101
+ useEffect(()=>{
102
+ if (container1) {
103
+ $d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
104
+ const previouslyFocusedElement = document.activeElement;
105
+ const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
106
+ if (!hasFocusedCandidate) {
107
+ const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
108
+ container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
109
+ container1.dispatchEvent(mountEvent);
110
+ if (!mountEvent.defaultPrevented) {
111
+ $d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
112
+ select: true
113
+ });
114
+ if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
115
+ }
116
+ }
113
117
  return ()=>{
114
- node1.removeEventListener('animationstart', handleAnimationStart);
115
- node1.removeEventListener('animationcancel', handleAnimationEnd);
116
- node1.removeEventListener('animationend', handleAnimationEnd);
118
+ container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
119
+ // We need to delay the focus a little to get around it for now.
120
+ // See: https://github.com/facebook/react/issues/17894
121
+ setTimeout(()=>{
122
+ const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
123
+ container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
124
+ container1.dispatchEvent(unmountEvent);
125
+ if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
126
+ select: true
127
+ });
128
+ // we need to remove the listener after we `dispatchEvent`
129
+ container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
130
+ $d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
131
+ }, 0);
117
132
  };
118
- } else // Transition to the unmounted state if the node is removed prematurely.
119
- // We avoid doing so during cleanup as the node may change but still exist.
120
- send('ANIMATION_END');
133
+ }
134
+ }, [
135
+ container1,
136
+ onMountAutoFocus,
137
+ onUnmountAutoFocus,
138
+ focusScope
139
+ ]); // Takes care of looping focus (when tabbing whilst at the edges)
140
+ const handleKeyDown = useCallback((event)=>{
141
+ if (!loop && !trapped) return;
142
+ if (focusScope.paused) return;
143
+ const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
144
+ const focusedElement = document.activeElement;
145
+ if (isTabKey && focusedElement) {
146
+ const container = event.currentTarget;
147
+ const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
148
+ const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
149
+ if (!hasTabbableElementsInside) {
150
+ if (focusedElement === container) event.preventDefault();
151
+ } else {
152
+ if (!event.shiftKey && focusedElement === last) {
153
+ event.preventDefault();
154
+ if (loop) $d3863c46a17e8a28$var$focus(first, {
155
+ select: true
156
+ });
157
+ } else if (event.shiftKey && focusedElement === first) {
158
+ event.preventDefault();
159
+ if (loop) $d3863c46a17e8a28$var$focus(last, {
160
+ select: true
161
+ });
162
+ }
163
+ }
164
+ }
121
165
  }, [
122
- node1,
123
- send
166
+ loop,
167
+ trapped,
168
+ focusScope.paused
124
169
  ]);
170
+ return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
171
+ tabIndex: -1
172
+ }, scopeProps, {
173
+ ref: composedRefs,
174
+ onKeyDown: handleKeyDown
175
+ }));
176
+ });
177
+ /* -------------------------------------------------------------------------------------------------
178
+ * Utils
179
+ * -----------------------------------------------------------------------------------------------*/ /**
180
+ * Attempts focusing the first element in a list of candidates.
181
+ * Stops when focus has actually moved.
182
+ */ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
183
+ const previouslyFocusedElement = document.activeElement;
184
+ for (const candidate of candidates){
185
+ $d3863c46a17e8a28$var$focus(candidate, {
186
+ select: select
187
+ });
188
+ if (document.activeElement !== previouslyFocusedElement) return;
189
+ }
190
+ }
191
+ /**
192
+ * Returns the first and last tabbable elements inside a container.
193
+ */ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
194
+ const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
195
+ const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
196
+ const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
197
+ return [
198
+ first,
199
+ last
200
+ ];
201
+ }
202
+ /**
203
+ * Returns a list of potential tabbable candidates.
204
+ *
205
+ * NOTE: This is only a close approximation. For example it doesn't take into account cases like when
206
+ * elements are not visible. This cannot be worked out easily by just reading a property, but rather
207
+ * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
208
+ *
209
+ * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
210
+ * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
211
+ */ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
212
+ const nodes = [];
213
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
214
+ acceptNode: (node)=>{
215
+ const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
216
+ if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
217
+ // runtime's understanding of tabbability, so this automatically accounts
218
+ // for any kind of element that could be tabbed to.
219
+ return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
220
+ }
221
+ });
222
+ while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
223
+ // hinders accessibility to have tab order different from visual order.
224
+ return nodes;
225
+ }
226
+ /**
227
+ * Returns the first visible element in a list.
228
+ * NOTE: Only checks visibility up to the `container`.
229
+ */ function $d3863c46a17e8a28$var$findVisible(elements, container) {
230
+ for (const element of elements){
231
+ // we stop checking if it's hidden at the `container` level (excluding)
232
+ if (!$d3863c46a17e8a28$var$isHidden(element, {
233
+ upTo: container
234
+ })) return element;
235
+ }
236
+ }
237
+ function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
238
+ if (getComputedStyle(node).visibility === 'hidden') return true;
239
+ while(node){
240
+ // we stop at `upTo` (excluding it)
241
+ if (upTo !== undefined && node === upTo) return false;
242
+ if (getComputedStyle(node).display === 'none') return true;
243
+ node = node.parentElement;
244
+ }
245
+ return false;
246
+ }
247
+ function $d3863c46a17e8a28$var$isSelectableInput(element) {
248
+ return element instanceof HTMLInputElement && 'select' in element;
249
+ }
250
+ function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
251
+ // only focus if that element is focusable
252
+ if (element && element.focus) {
253
+ const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
254
+ element.focus({
255
+ preventScroll: true
256
+ }); // only select if its not the same element, it supports selection and we need to select
257
+ if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
258
+ }
259
+ }
260
+ /* -------------------------------------------------------------------------------------------------
261
+ * FocusScope stack
262
+ * -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
263
+ function $d3863c46a17e8a28$var$createFocusScopesStack() {
264
+ /** A stack of focus scopes, with the active one at the top */ let stack = [];
125
265
  return {
126
- isPresent: [
127
- 'mounted',
128
- 'unmountSuspended'
129
- ].includes(state),
130
- ref: useCallback((node)=>{
131
- if (node) stylesRef.current = getComputedStyle(node);
132
- setNode(node);
133
- }, [])
266
+ add (focusScope) {
267
+ // pause the currently active focus scope (at the top of the stack)
268
+ const activeFocusScope = stack[0];
269
+ if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
270
+ // remove in case it already exists (because we'll re-add it at the top of the stack)
271
+ stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
272
+ stack.unshift(focusScope);
273
+ },
274
+ remove (focusScope) {
275
+ var _stack$;
276
+ stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
277
+ (_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
278
+ }
134
279
  };
135
280
  }
136
- /* -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$getAnimationName(styles) {
137
- return (styles === null || styles === void 0 ? void 0 : styles.animationName) || 'none';
281
+ function $d3863c46a17e8a28$var$arrayRemove(array, item) {
282
+ const updatedArray = [
283
+ ...array
284
+ ];
285
+ const index = updatedArray.indexOf(item);
286
+ if (index !== -1) updatedArray.splice(index, 1);
287
+ return updatedArray;
288
+ }
289
+ function $d3863c46a17e8a28$var$removeLinks(items) {
290
+ return items.filter((item)=>item.tagName !== 'A'
291
+ );
292
+ }
293
+
294
+ /** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;
295
+ /**
296
+ * Injects a pair of focus guards at the edges of the whole DOM tree
297
+ * to ensure `focusin` & `focusout` events can be caught consistently.
298
+ */ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
299
+ useEffect(()=>{
300
+ var _edgeGuards$, _edgeGuards$2;
301
+ const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
302
+ document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
303
+ document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
304
+ $3db38b7d1fb3fe6a$var$count++;
305
+ return ()=>{
306
+ if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()
307
+ );
308
+ $3db38b7d1fb3fe6a$var$count--;
309
+ };
310
+ }, []);
311
+ }
312
+ function $3db38b7d1fb3fe6a$var$createFocusGuard() {
313
+ const element = document.createElement('span');
314
+ element.setAttribute('data-radix-focus-guard', '');
315
+ element.tabIndex = 0;
316
+ element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';
317
+ return element;
318
+ }
319
+
320
+ /* -------------------------------------------------------------------------------------------------
321
+ * Slot
322
+ * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
323
+ const { children: children , ...slotProps } = props;
324
+ const childrenArray = Children.toArray(children);
325
+ const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
326
+ if (slottable) {
327
+ // the new element to render is the one passed as a child of `Slottable`
328
+ const newElement = slottable.props.children;
329
+ const newChildren = childrenArray.map((child)=>{
330
+ if (child === slottable) {
331
+ // because the new element will be the one rendered, we are only interested
332
+ // in grabbing its children (`newElement.props.children`)
333
+ if (Children.count(newElement) > 1) return Children.only(null);
334
+ return /*#__PURE__*/ isValidElement(newElement) ? newElement.props.children : null;
335
+ } else return child;
336
+ });
337
+ return /*#__PURE__*/ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
338
+ ref: forwardedRef
339
+ }), /*#__PURE__*/ isValidElement(newElement) ? /*#__PURE__*/ cloneElement(newElement, undefined, newChildren) : null);
340
+ }
341
+ return /*#__PURE__*/ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
342
+ ref: forwardedRef
343
+ }), children);
344
+ });
345
+ $5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot';
346
+ /* -------------------------------------------------------------------------------------------------
347
+ * SlotClone
348
+ * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
349
+ const { children: children , ...slotProps } = props;
350
+ if (/*#__PURE__*/ isValidElement(children)) return /*#__PURE__*/ cloneElement(children, {
351
+ ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),
352
+ ref: forwardedRef ? $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref) : children.ref
353
+ });
354
+ return Children.count(children) > 1 ? Children.only(null) : null;
355
+ });
356
+ $5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone';
357
+ /* -------------------------------------------------------------------------------------------------
358
+ * Slottable
359
+ * -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{
360
+ return /*#__PURE__*/ createElement(Fragment, null, children);
361
+ };
362
+ /* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) {
363
+ return /*#__PURE__*/ isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
364
+ }
365
+ function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
366
+ // all child props should override
367
+ const overrideProps = {
368
+ ...childProps
369
+ };
370
+ for(const propName in childProps){
371
+ const slotPropValue = slotProps[propName];
372
+ const childPropValue = childProps[propName];
373
+ const isHandler = /^on[A-Z]/.test(propName);
374
+ if (isHandler) {
375
+ // if the handler exists on both, we compose them
376
+ if (slotPropValue && childPropValue) overrideProps[propName] = (...args)=>{
377
+ childPropValue(...args);
378
+ slotPropValue(...args);
379
+ };
380
+ else if (slotPropValue) overrideProps[propName] = slotPropValue;
381
+ } else if (propName === 'style') overrideProps[propName] = {
382
+ ...slotPropValue,
383
+ ...childPropValue
384
+ };
385
+ else if (propName === 'className') overrideProps[propName] = [
386
+ slotPropValue,
387
+ childPropValue
388
+ ].filter(Boolean).join(' ');
389
+ }
390
+ return {
391
+ ...slotProps,
392
+ ...overrideProps
393
+ };
138
394
  }
139
395
 
140
396
  /* -------------------------------------------------------------------------------------------------
@@ -271,6 +527,7 @@ const $5d3850c4d0b4e6c7$export$b6d9565de1e068cf = /*#__PURE__*/ forwardRef((prop
271
527
  /* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentNonModal = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
272
528
  const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
273
529
  const hasInteractedOutsideRef = useRef(false);
530
+ const hasPointerDownOutsideRef = useRef(false);
274
531
  return /*#__PURE__*/ createElement($5d3850c4d0b4e6c7$var$DialogContentImpl, _extends({}, props, {
275
532
  ref: forwardedRef,
276
533
  trapFocus: false,
@@ -284,19 +541,24 @@ const $5d3850c4d0b4e6c7$export$b6d9565de1e068cf = /*#__PURE__*/ forwardRef((prop
284
541
  event.preventDefault();
285
542
  }
286
543
  hasInteractedOutsideRef.current = false;
544
+ hasPointerDownOutsideRef.current = false;
287
545
  },
288
546
  onInteractOutside: (event)=>{
289
547
  var _props$onInteractOuts, _context$triggerRef$c3;
290
548
  (_props$onInteractOuts = props.onInteractOutside) === null || _props$onInteractOuts === void 0 || _props$onInteractOuts.call(props, event);
291
- if (!event.defaultPrevented) hasInteractedOutsideRef.current = true; // Prevent dismissing when clicking the trigger.
549
+ if (!event.defaultPrevented) {
550
+ hasInteractedOutsideRef.current = true;
551
+ if (event.detail.originalEvent.type === 'pointerdown') hasPointerDownOutsideRef.current = true;
552
+ } // Prevent dismissing when clicking the trigger.
292
553
  // As the trigger is already setup to close, without doing so would
293
554
  // cause it to close and immediately open.
294
- //
295
- // We use `onInteractOutside` as some browsers also
296
- // focus on pointer down, creating the same issue.
297
555
  const target = event.target;
298
556
  const targetIsTrigger = (_context$triggerRef$c3 = context.triggerRef.current) === null || _context$triggerRef$c3 === void 0 ? void 0 : _context$triggerRef$c3.contains(target);
299
- if (targetIsTrigger) event.preventDefault();
557
+ if (targetIsTrigger) event.preventDefault(); // On Safari if the trigger is inside a container with tabIndex={0}, when clicked
558
+ // we will get the pointer down outside event on the trigger, but then a subsequent
559
+ // focus outside event on the container, we ignore any focus outside event when we've
560
+ // already had a pointer down outside event.
561
+ if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) event.preventDefault();
300
562
  }
301
563
  }));
302
564
  });
@@ -358,23 +620,50 @@ const $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 = $5d3850c4d0b4e6c7$export$b6d95
358
620
  const $5d3850c4d0b4e6c7$export$f99233281efd08a0 = $5d3850c4d0b4e6c7$export$16f7638e4a34b909;
359
621
  const $5d3850c4d0b4e6c7$export$393edc798c47379d = $5d3850c4d0b4e6c7$export$94e94c2ec2c954d5;
360
622
 
623
+ /** Use `Modal` to focus a user's attention to an urgent or required prompt for interaction or input. */
361
624
  var Modal = function (_a) {
362
- var title = _a.title, isOpen = _a.isOpen, onClose = _a.onClose, description = _a.description, children = _a.children, _b = _a.showDescription, showDescription = _b === void 0 ? true : _b;
625
+ var title = _a.title, description = _a.description, ariaDescribedBy = _a.ariaDescribedBy, isOpen = _a.isOpen, actions = _a.actions, onRequestClose = _a.onRequestClose, children = _a.children, _b = _a.role, role = _b === void 0 ? "dialog" : _b, _c = _a.shouldReturnFocus, shouldReturnFocus = _c === void 0 ? true : _c, _d = _a.isContentScrollable, isContentScrollable = _d === void 0 ? false : _d, _e = _a.size, size = _e === void 0 ? "l" : _e, props = __rest(_a, ["title", "description", "ariaDescribedBy", "isOpen", "actions", "onRequestClose", "children", "role", "shouldReturnFocus", "isContentScrollable", "size"]);
363
626
  var arcRootElement = useContext(ArcRootElementContext);
364
- var modalDescription = React__default.createElement(showDescription ? Text : VisuallyHidden, { children: description });
627
+ var triggerRef = useRef(null);
628
+ var setTriggerElement = function () {
629
+ return shouldReturnFocus &&
630
+ (triggerRef.current = document.activeElement);
631
+ };
632
+ var focusTriggerElement = function () {
633
+ if (triggerRef.current) {
634
+ triggerRef.current.focus();
635
+ }
636
+ };
637
+ var canShowClose = role !== "alertdialog" && onRequestClose;
638
+ var hasContent = description || children;
639
+ var ariaProps = __assign({}, (ariaDescribedBy ? { "aria-describedby": ariaDescribedBy } : {}));
640
+ var closeModal = function () {
641
+ if (role !== "alertdialog" && onRequestClose) {
642
+ onRequestClose();
643
+ }
644
+ };
365
645
  return (React__default.createElement($5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9, { open: isOpen },
366
646
  React__default.createElement($5d3850c4d0b4e6c7$export$602eac185826482c, { container: arcRootElement },
367
647
  React__default.createElement($5d3850c4d0b4e6c7$export$c6fdb837b070b4ff, { className: "arc-Modal-overlay" },
368
- React__default.createElement($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2, { onEscapeKeyDown: onClose, onInteractOutside: onClose, className: "arc-Modal-dialog" },
369
- React__default.createElement("div", { className: "arc-Modal-content" },
370
- React__default.createElement("div", { className: "arc-Modal-textWrapper" },
371
- React__default.createElement($5d3850c4d0b4e6c7$export$f99233281efd08a0, { className: "arc-Modal-title" },
372
- React__default.createElement(Heading, { size: "m" }, title)),
373
- React__default.createElement($5d3850c4d0b4e6c7$export$393edc798c47379d, null, modalDescription)),
374
- children),
375
- React__default.createElement("div", { className: "arc-Modal-iconContainer" },
376
- React__default.createElement("button", { "aria-label": "close", onClick: onClose, className: "arc-Modal-closeButton" },
377
- React__default.createElement(Icon, { size: 32, icon: BtIconCrossAlt2Px_2 }))))))));
648
+ React__default.createElement($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2, __assign({}, ariaProps, { role: role, onOpenAutoFocus: setTriggerElement, onCloseAutoFocus: focusTriggerElement, onEscapeKeyDown: closeModal, onInteractOutside: closeModal, className: classNames("arc-Modal-dialog", "arc-Modal-dialog--".concat(size), {
649
+ "arc-Modal-dialog--maxHeightWindow": isContentScrollable
650
+ }) }, filterDataAttrs(props)),
651
+ React__default.createElement("div", { className: "arc-Modal-section" },
652
+ React__default.createElement($5d3850c4d0b4e6c7$export$f99233281efd08a0, { asChild: true },
653
+ React__default.createElement(Heading, { level: "1", size: "m" }, title))),
654
+ React__default.createElement(VerticalSpace, { size: "12" }),
655
+ hasContent && (React__default.createElement("div", { className: "arc-Modal-content" },
656
+ React__default.createElement("div", { className: "arc-Modal-section" },
657
+ description && (React__default.createElement($5d3850c4d0b4e6c7$export$393edc798c47379d, { asChild: true },
658
+ React__default.createElement(Text, null, description))),
659
+ description && children && (React__default.createElement(VerticalSpace, { "data-testid": "arc-modal-vertical-space", size: "20" })),
660
+ children))),
661
+ actions && (React__default.createElement("div", { className: "arc-Modal-section" },
662
+ React__default.createElement("div", { className: "arc-Modal-actions" }, actions.map(function (props, i) { return (React__default.createElement("div", { key: "arc-modal-button-".concat(i), className: "arc-Modal-actionButton" },
663
+ React__default.createElement(Button, __assign({ isFullWidth: true }, props)))); })))),
664
+ canShowClose && (React__default.createElement("div", { className: "arc-Modal-iconContainer" },
665
+ React__default.createElement("button", { "aria-label": "close", onClick: closeModal, className: "arc-Modal-closeButton" },
666
+ React__default.createElement(Icon, { size: 32, icon: BtIconCrossAlt2Px_2 })))))))));
378
667
  };
379
668
 
380
669
  export { Modal };