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