@arc-ui/components 11.7.0 → 11.8.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.js +3 -3
- package/dist/Badge/Badge.esm.js +4 -4
- 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/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 +75 -0
- package/dist/Tabs/Tabs.cjs.js +514 -0
- package/dist/Tabs/Tabs.esm.d.ts +75 -0
- package/dist/Tabs/Tabs.esm.js +506 -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 +14 -13
- package/dist/TextArea/TextArea.esm.d.ts +4 -1
- package/dist/TextArea/TextArea.esm.js +14 -13
- 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 +52 -0
- package/dist/Toast/Toast.cjs.js +743 -0
- package/dist/Toast/Toast.esm.d.ts +52 -0
- package/dist/Toast/Toast.esm.js +735 -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/_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/{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/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/_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/{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/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 +2807 -1034
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +3014 -1240
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- 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 +1 -0
- package/dist/types/styles.d.ts +3 -2
- package/package.json +8 -6
- package/dist/MediaCard/MediaCard.cjs.d.ts +0 -61
- package/dist/MediaCard/MediaCard.cjs.js +0 -31
- package/dist/MediaCard/MediaCard.esm.d.ts +0 -61
- 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
|
@@ -2,32 +2,179 @@
|
|
|
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 index$1 = require('../_shared/cjs/index-45bfb67b.js');
|
|
6
7
|
var React$1 = require('react');
|
|
7
|
-
var
|
|
8
|
+
var _extends = require('../_shared/cjs/extends-bb8ffacd.js');
|
|
8
9
|
var $7SXl2$reactdom = require('react-dom');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
10
|
+
var index_module = require('../_shared/cjs/index.module-bbcc4e18.js');
|
|
11
|
+
var index = require('../_shared/cjs/index-ec260f5e.js');
|
|
11
12
|
var BtIconChevronDown2Px = require('../_shared/cjs/BtIconChevronDown2Px-8fb4e2eb.js');
|
|
12
13
|
var BtIconTickAlt2Px = require('../_shared/cjs/BtIconTickAlt2Px-bdf06f8c.js');
|
|
13
14
|
var Icon = require('../_shared/cjs/Icon-e1dd45eb.js');
|
|
14
|
-
var FormControl = require('../_shared/cjs/FormControl-
|
|
15
|
+
var FormControl = require('../_shared/cjs/FormControl-1e1bf2bf.js');
|
|
15
16
|
var Surface = require('../_shared/cjs/Surface-b7c51b2b.js');
|
|
16
17
|
var Base = require('../_shared/cjs/Base-569e4334.js');
|
|
17
|
-
require('../_shared/cjs/filter-data-attrs-a30dcf5f.js');
|
|
18
18
|
require('../_shared/cjs/suffix-modifier-1ee2da04.js');
|
|
19
19
|
require('../_shared/cjs/BtIconAlert-637db790.js');
|
|
20
|
-
require('../_shared/cjs/DisclosureMini-
|
|
21
|
-
require('../_shared/cjs/Text-
|
|
20
|
+
require('../_shared/cjs/DisclosureMini-52706ee6.js');
|
|
21
|
+
require('../_shared/cjs/Text-fa447e2d.js');
|
|
22
22
|
|
|
23
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
24
|
|
|
25
|
+
function _interopNamespace(e) {
|
|
26
|
+
if (e && e.__esModule) return e;
|
|
27
|
+
var n = Object.create(null);
|
|
28
|
+
if (e) {
|
|
29
|
+
Object.keys(e).forEach(function (k) {
|
|
30
|
+
if (k !== 'default') {
|
|
31
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
32
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return e[k]; }
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
n["default"] = e;
|
|
40
|
+
return Object.freeze(n);
|
|
41
|
+
}
|
|
42
|
+
|
|
25
43
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1);
|
|
44
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React$1);
|
|
45
|
+
var $7SXl2$reactdom__default = /*#__PURE__*/_interopDefaultLegacy($7SXl2$reactdom);
|
|
26
46
|
|
|
27
47
|
function $ae6933e535247d3d$export$7d15b64cf5a3a4c4(value, [min, max]) {
|
|
28
48
|
return Math.min(max, Math.max(min, value));
|
|
29
49
|
}
|
|
30
50
|
|
|
51
|
+
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented: checkForDefaultPrevented = true } = {}) {
|
|
52
|
+
return function handleEvent(event) {
|
|
53
|
+
originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
|
|
54
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* -------------------------------------------------------------------------------------------------
|
|
59
|
+
* createContextScope
|
|
60
|
+
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
|
|
61
|
+
let defaultContexts = [];
|
|
62
|
+
/* -----------------------------------------------------------------------------------------------
|
|
63
|
+
* createContext
|
|
64
|
+
* ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
|
|
65
|
+
const BaseContext = /*#__PURE__*/ React$1.createContext(defaultContext);
|
|
66
|
+
const index = defaultContexts.length;
|
|
67
|
+
defaultContexts = [
|
|
68
|
+
...defaultContexts,
|
|
69
|
+
defaultContext
|
|
70
|
+
];
|
|
71
|
+
function Provider(props) {
|
|
72
|
+
const { scope: scope , children: children , ...context } = props;
|
|
73
|
+
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
+
const value = React$1.useMemo(()=>context
|
|
76
|
+
, Object.values(context));
|
|
77
|
+
return /*#__PURE__*/ React$1.createElement(Context.Provider, {
|
|
78
|
+
value: value
|
|
79
|
+
}, children);
|
|
80
|
+
}
|
|
81
|
+
function useContext(consumerName, scope) {
|
|
82
|
+
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
|
|
83
|
+
const context = React$1.useContext(Context);
|
|
84
|
+
if (context) return context;
|
|
85
|
+
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
|
|
86
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
87
|
+
}
|
|
88
|
+
Provider.displayName = rootComponentName + 'Provider';
|
|
89
|
+
return [
|
|
90
|
+
Provider,
|
|
91
|
+
useContext
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
/* -----------------------------------------------------------------------------------------------
|
|
95
|
+
* createScope
|
|
96
|
+
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
|
|
97
|
+
const scopeContexts = defaultContexts.map((defaultContext)=>{
|
|
98
|
+
return /*#__PURE__*/ React$1.createContext(defaultContext);
|
|
99
|
+
});
|
|
100
|
+
return function useScope(scope) {
|
|
101
|
+
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
|
|
102
|
+
return React$1.useMemo(()=>({
|
|
103
|
+
[`__scope${scopeName}`]: {
|
|
104
|
+
...scope,
|
|
105
|
+
[scopeName]: contexts
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
, [
|
|
109
|
+
scope,
|
|
110
|
+
contexts
|
|
111
|
+
]);
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
createScope.scopeName = scopeName;
|
|
115
|
+
return [
|
|
116
|
+
$c512c27ab02ef895$export$fd42f52fd3ae1109,
|
|
117
|
+
$c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
/* -------------------------------------------------------------------------------------------------
|
|
121
|
+
* composeContextScopes
|
|
122
|
+
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
|
|
123
|
+
const baseScope = scopes[0];
|
|
124
|
+
if (scopes.length === 1) return baseScope;
|
|
125
|
+
const createScope1 = ()=>{
|
|
126
|
+
const scopeHooks = scopes.map((createScope)=>({
|
|
127
|
+
useScope: createScope(),
|
|
128
|
+
scopeName: createScope.scopeName
|
|
129
|
+
})
|
|
130
|
+
);
|
|
131
|
+
return function useComposedScopes(overrideScopes) {
|
|
132
|
+
const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope: useScope , scopeName: scopeName })=>{
|
|
133
|
+
// We are calling a hook inside a callback which React warns against to avoid inconsistent
|
|
134
|
+
// renders, however, scoping doesn't have render side effects so we ignore the rule.
|
|
135
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
136
|
+
const scopeProps = useScope(overrideScopes);
|
|
137
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
138
|
+
return {
|
|
139
|
+
...nextScopes,
|
|
140
|
+
...currentScope
|
|
141
|
+
};
|
|
142
|
+
}, {});
|
|
143
|
+
return React$1.useMemo(()=>({
|
|
144
|
+
[`__scope${baseScope.scopeName}`]: nextScopes1
|
|
145
|
+
})
|
|
146
|
+
, [
|
|
147
|
+
nextScopes1
|
|
148
|
+
]);
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
createScope1.scopeName = baseScope.scopeName;
|
|
152
|
+
return createScope1;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Set a given ref to a given value
|
|
157
|
+
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
158
|
+
*/ function $6ed0406888f73fc4$var$setRef$1(ref, value) {
|
|
159
|
+
if (typeof ref === 'function') ref(value);
|
|
160
|
+
else if (ref !== null && ref !== undefined) ref.current = value;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* A utility to compose multiple refs together
|
|
164
|
+
* Accepts callback refs and RefObject(s)
|
|
165
|
+
*/ function $6ed0406888f73fc4$export$43e446d32b3d21af$1(...refs) {
|
|
166
|
+
return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef$1(ref, node)
|
|
167
|
+
)
|
|
168
|
+
;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A custom hook that composes multiple refs
|
|
172
|
+
* Accepts callback refs and RefObject(s)
|
|
173
|
+
*/ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(...refs) {
|
|
174
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
175
|
+
return React$1.useCallback($6ed0406888f73fc4$export$43e446d32b3d21af$1(...refs), refs);
|
|
176
|
+
}
|
|
177
|
+
|
|
31
178
|
// We have resorted to returning slots directly rather than exposing primitives that can then
|
|
32
179
|
// be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.
|
|
33
180
|
// This is because we encountered issues with generic types that cannot be statically analysed
|
|
@@ -36,7 +183,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
36
183
|
/* -----------------------------------------------------------------------------------------------
|
|
37
184
|
* CollectionProvider
|
|
38
185
|
* ---------------------------------------------------------------------------------------------*/ const PROVIDER_NAME = name + 'CollectionProvider';
|
|
39
|
-
const [createCollectionContext, createCollectionScope] =
|
|
186
|
+
const [createCollectionContext, createCollectionScope] = $c512c27ab02ef895$export$50c7b4e9d9f19c1(PROVIDER_NAME);
|
|
40
187
|
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
|
|
41
188
|
collectionRef: {
|
|
42
189
|
current: null
|
|
@@ -59,7 +206,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
59
206
|
const CollectionSlot = /*#__PURE__*/ React__default["default"].forwardRef((props, forwardedRef)=>{
|
|
60
207
|
const { scope: scope , children: children } = props;
|
|
61
208
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
62
|
-
const composedRefs =
|
|
209
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, context.collectionRef);
|
|
63
210
|
return /*#__PURE__*/ React__default["default"].createElement(index_module.$5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
64
211
|
ref: composedRefs
|
|
65
212
|
}, children);
|
|
@@ -71,7 +218,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
71
218
|
const CollectionItemSlot = /*#__PURE__*/ React__default["default"].forwardRef((props, forwardedRef)=>{
|
|
72
219
|
const { scope: scope , children: children , ...itemData } = props;
|
|
73
220
|
const ref = React__default["default"].useRef(null);
|
|
74
|
-
const composedRefs =
|
|
221
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, ref);
|
|
75
222
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
76
223
|
React__default["default"].useEffect(()=>{
|
|
77
224
|
context.itemMap.set(ref, {
|
|
@@ -121,8 +268,796 @@ const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ React$1.createConte
|
|
|
121
268
|
return localDir || globalDir || 'ltr';
|
|
122
269
|
}
|
|
123
270
|
|
|
271
|
+
const $8927f6f2acc4f386$var$NODES$2 = [
|
|
272
|
+
'a',
|
|
273
|
+
'button',
|
|
274
|
+
'div',
|
|
275
|
+
'h2',
|
|
276
|
+
'h3',
|
|
277
|
+
'img',
|
|
278
|
+
'label',
|
|
279
|
+
'li',
|
|
280
|
+
'nav',
|
|
281
|
+
'ol',
|
|
282
|
+
'p',
|
|
283
|
+
'span',
|
|
284
|
+
'svg',
|
|
285
|
+
'ul'
|
|
286
|
+
]; // Temporary while we await merge of this fix:
|
|
287
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
|
|
288
|
+
// prettier-ignore
|
|
289
|
+
/* -------------------------------------------------------------------------------------------------
|
|
290
|
+
* Primitive
|
|
291
|
+
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034$2 = $8927f6f2acc4f386$var$NODES$2.reduce((primitive, node)=>{
|
|
292
|
+
const Node = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
293
|
+
const { asChild: asChild , ...primitiveProps } = props;
|
|
294
|
+
const Comp = asChild ? index_module.$5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
|
|
295
|
+
React$1.useEffect(()=>{
|
|
296
|
+
window[Symbol.for('radix-ui')] = true;
|
|
297
|
+
}, []);
|
|
298
|
+
return /*#__PURE__*/ React$1.createElement(Comp, _extends._extends({}, primitiveProps, {
|
|
299
|
+
ref: forwardedRef
|
|
300
|
+
}));
|
|
301
|
+
});
|
|
302
|
+
Node.displayName = `Primitive.${node}`;
|
|
303
|
+
return {
|
|
304
|
+
...primitive,
|
|
305
|
+
[node]: Node
|
|
306
|
+
};
|
|
307
|
+
}, {});
|
|
308
|
+
/* -------------------------------------------------------------------------------------------------
|
|
309
|
+
* Utils
|
|
310
|
+
* -----------------------------------------------------------------------------------------------*/ /**
|
|
311
|
+
* Flush custom event dispatch
|
|
312
|
+
* https://github.com/radix-ui/primitives/pull/1378
|
|
313
|
+
*
|
|
314
|
+
* React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.
|
|
315
|
+
*
|
|
316
|
+
* Internally, React prioritises events in the following order:
|
|
317
|
+
* - discrete
|
|
318
|
+
* - continuous
|
|
319
|
+
* - default
|
|
320
|
+
*
|
|
321
|
+
* https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350
|
|
322
|
+
*
|
|
323
|
+
* `discrete` is an important distinction as updates within these events are applied immediately.
|
|
324
|
+
* React however, is not able to infer the priority of custom event types due to how they are detected internally.
|
|
325
|
+
* Because of this, it's possible for updates from custom events to be unexpectedly batched when
|
|
326
|
+
* dispatched by another `discrete` event.
|
|
327
|
+
*
|
|
328
|
+
* In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.
|
|
329
|
+
* This utility should be used when dispatching a custom event from within another `discrete` event, this utility
|
|
330
|
+
* is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.
|
|
331
|
+
* For example:
|
|
332
|
+
*
|
|
333
|
+
* dispatching a known click 👎
|
|
334
|
+
* target.dispatchEvent(new Event(‘click’))
|
|
335
|
+
*
|
|
336
|
+
* dispatching a custom type within a non-discrete event 👎
|
|
337
|
+
* onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}
|
|
338
|
+
*
|
|
339
|
+
* dispatching a custom type within a `discrete` event 👍
|
|
340
|
+
* onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}
|
|
341
|
+
*
|
|
342
|
+
* Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use
|
|
343
|
+
* this utility with them. This is because it's possible for those handlers to be called implicitly during render
|
|
344
|
+
* e.g. when focus is within a component as it is unmounted, or when managing focus on mount.
|
|
345
|
+
*/ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {
|
|
346
|
+
if (target) $7SXl2$reactdom.flushSync(()=>target.dispatchEvent(event)
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
352
|
+
* prop or avoid re-executing effects when passed as a dependency
|
|
353
|
+
*/ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(callback) {
|
|
354
|
+
const callbackRef = React$1.useRef(callback);
|
|
355
|
+
React$1.useEffect(()=>{
|
|
356
|
+
callbackRef.current = callback;
|
|
357
|
+
}); // https://github.com/facebook/react/issues/19240
|
|
358
|
+
return React$1.useMemo(()=>(...args)=>{
|
|
359
|
+
var _callbackRef$current;
|
|
360
|
+
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
|
|
361
|
+
}
|
|
362
|
+
, []);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Listens for when the escape key is down
|
|
367
|
+
*/ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
368
|
+
const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onEscapeKeyDownProp);
|
|
369
|
+
React$1.useEffect(()=>{
|
|
370
|
+
const handleKeyDown = (event)=>{
|
|
371
|
+
if (event.key === 'Escape') onEscapeKeyDown(event);
|
|
372
|
+
};
|
|
373
|
+
ownerDocument.addEventListener('keydown', handleKeyDown);
|
|
374
|
+
return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown)
|
|
375
|
+
;
|
|
376
|
+
}, [
|
|
377
|
+
onEscapeKeyDown,
|
|
378
|
+
ownerDocument
|
|
379
|
+
]);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';
|
|
383
|
+
const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
|
|
384
|
+
const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
|
|
385
|
+
let $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
386
|
+
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ React$1.createContext({
|
|
387
|
+
layers: new Set(),
|
|
388
|
+
layersWithOutsidePointerEventsDisabled: new Set(),
|
|
389
|
+
branches: new Set()
|
|
390
|
+
});
|
|
391
|
+
const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
392
|
+
var _node$ownerDocument;
|
|
393
|
+
const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;
|
|
394
|
+
const context = React$1.useContext($5cb92bef7577960e$var$DismissableLayerContext);
|
|
395
|
+
const [node1, setNode] = React$1.useState(null);
|
|
396
|
+
const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
|
|
397
|
+
const [, force] = React$1.useState({});
|
|
398
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setNode(node)
|
|
399
|
+
);
|
|
400
|
+
const layers = Array.from(context.layers);
|
|
401
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [
|
|
402
|
+
...context.layersWithOutsidePointerEventsDisabled
|
|
403
|
+
].slice(-1); // prettier-ignore
|
|
404
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore
|
|
405
|
+
const index = node1 ? layers.indexOf(node1) : -1;
|
|
406
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
407
|
+
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
408
|
+
const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event)=>{
|
|
409
|
+
const target = event.target;
|
|
410
|
+
const isPointerDownOnBranch = [
|
|
411
|
+
...context.branches
|
|
412
|
+
].some((branch)=>branch.contains(target)
|
|
413
|
+
);
|
|
414
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
415
|
+
onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
|
|
416
|
+
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
|
|
417
|
+
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
418
|
+
}, ownerDocument);
|
|
419
|
+
const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event)=>{
|
|
420
|
+
const target = event.target;
|
|
421
|
+
const isFocusInBranch = [
|
|
422
|
+
...context.branches
|
|
423
|
+
].some((branch)=>branch.contains(target)
|
|
424
|
+
);
|
|
425
|
+
if (isFocusInBranch) return;
|
|
426
|
+
onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
|
|
427
|
+
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
|
|
428
|
+
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
429
|
+
}, ownerDocument);
|
|
430
|
+
$addc16e1bbe58fd0$export$3a72a57244d6e765((event)=>{
|
|
431
|
+
const isHighestLayer = index === context.layers.size - 1;
|
|
432
|
+
if (!isHighestLayer) return;
|
|
433
|
+
onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
|
|
434
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
435
|
+
event.preventDefault();
|
|
436
|
+
onDismiss();
|
|
437
|
+
}
|
|
438
|
+
}, ownerDocument);
|
|
439
|
+
React$1.useEffect(()=>{
|
|
440
|
+
if (!node1) return;
|
|
441
|
+
if (disableOutsidePointerEvents) {
|
|
442
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
443
|
+
$5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
444
|
+
ownerDocument.body.style.pointerEvents = 'none';
|
|
445
|
+
}
|
|
446
|
+
context.layersWithOutsidePointerEventsDisabled.add(node1);
|
|
447
|
+
}
|
|
448
|
+
context.layers.add(node1);
|
|
449
|
+
$5cb92bef7577960e$var$dispatchUpdate();
|
|
450
|
+
return ()=>{
|
|
451
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
452
|
+
};
|
|
453
|
+
}, [
|
|
454
|
+
node1,
|
|
455
|
+
ownerDocument,
|
|
456
|
+
disableOutsidePointerEvents,
|
|
457
|
+
context
|
|
458
|
+
]);
|
|
459
|
+
/**
|
|
460
|
+
* We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect
|
|
461
|
+
* because a change to `disableOutsidePointerEvents` would remove this layer from the stack
|
|
462
|
+
* and add it to the end again so the layering order wouldn't be _creation order_.
|
|
463
|
+
* We only want them to be removed from context stacks when unmounted.
|
|
464
|
+
*/ React$1.useEffect(()=>{
|
|
465
|
+
return ()=>{
|
|
466
|
+
if (!node1) return;
|
|
467
|
+
context.layers.delete(node1);
|
|
468
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node1);
|
|
469
|
+
$5cb92bef7577960e$var$dispatchUpdate();
|
|
470
|
+
};
|
|
471
|
+
}, [
|
|
472
|
+
node1,
|
|
473
|
+
context
|
|
474
|
+
]);
|
|
475
|
+
React$1.useEffect(()=>{
|
|
476
|
+
const handleUpdate = ()=>force({})
|
|
477
|
+
;
|
|
478
|
+
document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
|
|
479
|
+
return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)
|
|
480
|
+
;
|
|
481
|
+
}, []);
|
|
482
|
+
return /*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.div, _extends._extends({}, layerProps, {
|
|
483
|
+
ref: composedRefs,
|
|
484
|
+
style: {
|
|
485
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,
|
|
486
|
+
...props.style
|
|
487
|
+
},
|
|
488
|
+
onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
489
|
+
onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
490
|
+
onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
|
|
491
|
+
}));
|
|
492
|
+
});
|
|
493
|
+
/* -----------------------------------------------------------------------------------------------*/ /**
|
|
494
|
+
* Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`
|
|
495
|
+
* to mimic layer dismissing behaviour present in OS.
|
|
496
|
+
* Returns props to pass to the node we want to check for outside events.
|
|
497
|
+
*/ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
498
|
+
const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onPointerDownOutside);
|
|
499
|
+
const isPointerInsideReactTreeRef = React$1.useRef(false);
|
|
500
|
+
const handleClickRef = React$1.useRef(()=>{});
|
|
501
|
+
React$1.useEffect(()=>{
|
|
502
|
+
const handlePointerDown = (event)=>{
|
|
503
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
504
|
+
const eventDetail = {
|
|
505
|
+
originalEvent: event
|
|
506
|
+
};
|
|
507
|
+
function handleAndDispatchPointerDownOutsideEvent() {
|
|
508
|
+
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
|
|
509
|
+
discrete: true
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* On touch devices, we need to wait for a click event because browsers implement
|
|
514
|
+
* a ~350ms delay between the time the user stops touching the display and when the
|
|
515
|
+
* browser executres events. We need to ensure we don't reactivate pointer-events within
|
|
516
|
+
* this timeframe otherwise the browser may execute events that should have been prevented.
|
|
517
|
+
*
|
|
518
|
+
* Additionally, this also lets us deal automatically with cancellations when a click event
|
|
519
|
+
* isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.
|
|
520
|
+
*
|
|
521
|
+
* This is why we also continuously remove the previous listener, because we cannot be
|
|
522
|
+
* certain that it was raised, and therefore cleaned-up.
|
|
523
|
+
*/ if (event.pointerType === 'touch') {
|
|
524
|
+
ownerDocument.removeEventListener('click', handleClickRef.current);
|
|
525
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
|
|
526
|
+
ownerDocument.addEventListener('click', handleClickRef.current, {
|
|
527
|
+
once: true
|
|
528
|
+
});
|
|
529
|
+
} else handleAndDispatchPointerDownOutsideEvent();
|
|
530
|
+
}
|
|
531
|
+
isPointerInsideReactTreeRef.current = false;
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* if this hook executes in a component that mounts via a `pointerdown` event, the event
|
|
535
|
+
* would bubble up to the document and trigger a `pointerDownOutside` event. We avoid
|
|
536
|
+
* this by delaying the event listener registration on the document.
|
|
537
|
+
* This is not React specific, but rather how the DOM works, ie:
|
|
538
|
+
* ```
|
|
539
|
+
* button.addEventListener('pointerdown', () => {
|
|
540
|
+
* console.log('I will log');
|
|
541
|
+
* document.addEventListener('pointerdown', () => {
|
|
542
|
+
* console.log('I will also log');
|
|
543
|
+
* })
|
|
544
|
+
* });
|
|
545
|
+
*/ const timerId = window.setTimeout(()=>{
|
|
546
|
+
ownerDocument.addEventListener('pointerdown', handlePointerDown);
|
|
547
|
+
}, 0);
|
|
548
|
+
return ()=>{
|
|
549
|
+
window.clearTimeout(timerId);
|
|
550
|
+
ownerDocument.removeEventListener('pointerdown', handlePointerDown);
|
|
551
|
+
ownerDocument.removeEventListener('click', handleClickRef.current);
|
|
552
|
+
};
|
|
553
|
+
}, [
|
|
554
|
+
ownerDocument,
|
|
555
|
+
handlePointerDownOutside
|
|
556
|
+
]);
|
|
557
|
+
return {
|
|
558
|
+
// ensures we check React component tree (not just DOM tree)
|
|
559
|
+
onPointerDownCapture: ()=>isPointerInsideReactTreeRef.current = true
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Listens for when focus happens outside a react subtree.
|
|
564
|
+
* Returns props to pass to the root (node) of the subtree we want to check.
|
|
565
|
+
*/ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
566
|
+
const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onFocusOutside);
|
|
567
|
+
const isFocusInsideReactTreeRef = React$1.useRef(false);
|
|
568
|
+
React$1.useEffect(()=>{
|
|
569
|
+
const handleFocus = (event)=>{
|
|
570
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
571
|
+
const eventDetail = {
|
|
572
|
+
originalEvent: event
|
|
573
|
+
};
|
|
574
|
+
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
575
|
+
discrete: false
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
ownerDocument.addEventListener('focusin', handleFocus);
|
|
580
|
+
return ()=>ownerDocument.removeEventListener('focusin', handleFocus)
|
|
581
|
+
;
|
|
582
|
+
}, [
|
|
583
|
+
ownerDocument,
|
|
584
|
+
handleFocusOutside
|
|
585
|
+
]);
|
|
586
|
+
return {
|
|
587
|
+
onFocusCapture: ()=>isFocusInsideReactTreeRef.current = true
|
|
588
|
+
,
|
|
589
|
+
onBlurCapture: ()=>isFocusInsideReactTreeRef.current = false
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
function $5cb92bef7577960e$var$dispatchUpdate() {
|
|
593
|
+
const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);
|
|
594
|
+
document.dispatchEvent(event);
|
|
595
|
+
}
|
|
596
|
+
function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete: discrete }) {
|
|
597
|
+
const target = detail.originalEvent.target;
|
|
598
|
+
const event = new CustomEvent(name, {
|
|
599
|
+
bubbles: false,
|
|
600
|
+
cancelable: true,
|
|
601
|
+
detail: detail
|
|
602
|
+
});
|
|
603
|
+
if (handler) target.addEventListener(name, handler, {
|
|
604
|
+
once: true
|
|
605
|
+
});
|
|
606
|
+
if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
|
|
607
|
+
else target.dispatchEvent(event);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;
|
|
611
|
+
/**
|
|
612
|
+
* Injects a pair of focus guards at the edges of the whole DOM tree
|
|
613
|
+
* to ensure `focusin` & `focusout` events can be caught consistently.
|
|
614
|
+
*/ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
|
|
615
|
+
React$1.useEffect(()=>{
|
|
616
|
+
var _edgeGuards$, _edgeGuards$2;
|
|
617
|
+
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
|
|
618
|
+
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
619
|
+
document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
620
|
+
$3db38b7d1fb3fe6a$var$count++;
|
|
621
|
+
return ()=>{
|
|
622
|
+
if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()
|
|
623
|
+
);
|
|
624
|
+
$3db38b7d1fb3fe6a$var$count--;
|
|
625
|
+
};
|
|
626
|
+
}, []);
|
|
627
|
+
}
|
|
628
|
+
function $3db38b7d1fb3fe6a$var$createFocusGuard() {
|
|
629
|
+
const element = document.createElement('span');
|
|
630
|
+
element.setAttribute('data-radix-focus-guard', '');
|
|
631
|
+
element.tabIndex = 0;
|
|
632
|
+
element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';
|
|
633
|
+
return element;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Set a given ref to a given value
|
|
638
|
+
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
639
|
+
*/ function $6ed0406888f73fc4$var$setRef(ref, value) {
|
|
640
|
+
if (typeof ref === 'function') ref(value);
|
|
641
|
+
else if (ref !== null && ref !== undefined) ref.current = value;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* A utility to compose multiple refs together
|
|
645
|
+
* Accepts callback refs and RefObject(s)
|
|
646
|
+
*/ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
|
|
647
|
+
return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)
|
|
648
|
+
)
|
|
649
|
+
;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* A custom hook that composes multiple refs
|
|
653
|
+
* Accepts callback refs and RefObject(s)
|
|
654
|
+
*/ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
|
|
655
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
656
|
+
return React$1.useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
const $8927f6f2acc4f386$var$NODES$1 = [
|
|
660
|
+
'a',
|
|
661
|
+
'button',
|
|
662
|
+
'div',
|
|
663
|
+
'h2',
|
|
664
|
+
'h3',
|
|
665
|
+
'img',
|
|
666
|
+
'label',
|
|
667
|
+
'li',
|
|
668
|
+
'nav',
|
|
669
|
+
'ol',
|
|
670
|
+
'p',
|
|
671
|
+
'span',
|
|
672
|
+
'svg',
|
|
673
|
+
'ul'
|
|
674
|
+
]; // Temporary while we await merge of this fix:
|
|
675
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
|
|
676
|
+
// prettier-ignore
|
|
677
|
+
/* -------------------------------------------------------------------------------------------------
|
|
678
|
+
* Primitive
|
|
679
|
+
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034$1 = $8927f6f2acc4f386$var$NODES$1.reduce((primitive, node)=>{
|
|
680
|
+
const Node = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
681
|
+
const { asChild: asChild , ...primitiveProps } = props;
|
|
682
|
+
const Comp = asChild ? index_module.$5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
|
|
683
|
+
React$1.useEffect(()=>{
|
|
684
|
+
window[Symbol.for('radix-ui')] = true;
|
|
685
|
+
}, []);
|
|
686
|
+
return /*#__PURE__*/ React$1.createElement(Comp, _extends._extends({}, primitiveProps, {
|
|
687
|
+
ref: forwardedRef
|
|
688
|
+
}));
|
|
689
|
+
});
|
|
690
|
+
Node.displayName = `Primitive.${node}`;
|
|
691
|
+
return {
|
|
692
|
+
...primitive,
|
|
693
|
+
[node]: Node
|
|
694
|
+
};
|
|
695
|
+
}, {});
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
699
|
+
* prop or avoid re-executing effects when passed as a dependency
|
|
700
|
+
*/ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
|
|
701
|
+
const callbackRef = React$1.useRef(callback);
|
|
702
|
+
React$1.useEffect(()=>{
|
|
703
|
+
callbackRef.current = callback;
|
|
704
|
+
}); // https://github.com/facebook/react/issues/19240
|
|
705
|
+
return React$1.useMemo(()=>(...args)=>{
|
|
706
|
+
var _callbackRef$current;
|
|
707
|
+
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
|
|
708
|
+
}
|
|
709
|
+
, []);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
|
|
713
|
+
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
|
|
714
|
+
const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
|
|
715
|
+
bubbles: false,
|
|
716
|
+
cancelable: true
|
|
717
|
+
};
|
|
718
|
+
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
719
|
+
const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
|
|
720
|
+
const [container1, setContainer] = React$1.useState(null);
|
|
721
|
+
const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
|
|
722
|
+
const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
|
|
723
|
+
const lastFocusedElementRef = React$1.useRef(null);
|
|
724
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
|
|
725
|
+
);
|
|
726
|
+
const focusScope = React$1.useRef({
|
|
727
|
+
paused: false,
|
|
728
|
+
pause () {
|
|
729
|
+
this.paused = true;
|
|
730
|
+
},
|
|
731
|
+
resume () {
|
|
732
|
+
this.paused = false;
|
|
733
|
+
}
|
|
734
|
+
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
|
|
735
|
+
React$1.useEffect(()=>{
|
|
736
|
+
if (trapped) {
|
|
737
|
+
function handleFocusIn(event) {
|
|
738
|
+
if (focusScope.paused || !container1) return;
|
|
739
|
+
const target = event.target;
|
|
740
|
+
if (container1.contains(target)) lastFocusedElementRef.current = target;
|
|
741
|
+
else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
742
|
+
select: true
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
function handleFocusOut(event) {
|
|
746
|
+
if (focusScope.paused || !container1) return;
|
|
747
|
+
if (!container1.contains(event.relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
748
|
+
select: true
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
document.addEventListener('focusin', handleFocusIn);
|
|
752
|
+
document.addEventListener('focusout', handleFocusOut);
|
|
753
|
+
return ()=>{
|
|
754
|
+
document.removeEventListener('focusin', handleFocusIn);
|
|
755
|
+
document.removeEventListener('focusout', handleFocusOut);
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
}, [
|
|
759
|
+
trapped,
|
|
760
|
+
container1,
|
|
761
|
+
focusScope.paused
|
|
762
|
+
]);
|
|
763
|
+
React$1.useEffect(()=>{
|
|
764
|
+
if (container1) {
|
|
765
|
+
$d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
|
|
766
|
+
const previouslyFocusedElement = document.activeElement;
|
|
767
|
+
const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
|
|
768
|
+
if (!hasFocusedCandidate) {
|
|
769
|
+
const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
770
|
+
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
771
|
+
container1.dispatchEvent(mountEvent);
|
|
772
|
+
if (!mountEvent.defaultPrevented) {
|
|
773
|
+
$d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
|
|
774
|
+
select: true
|
|
775
|
+
});
|
|
776
|
+
if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
return ()=>{
|
|
780
|
+
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
|
|
781
|
+
// We need to delay the focus a little to get around it for now.
|
|
782
|
+
// See: https://github.com/facebook/react/issues/17894
|
|
783
|
+
setTimeout(()=>{
|
|
784
|
+
const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
785
|
+
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
786
|
+
container1.dispatchEvent(unmountEvent);
|
|
787
|
+
if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
|
|
788
|
+
select: true
|
|
789
|
+
});
|
|
790
|
+
// we need to remove the listener after we `dispatchEvent`
|
|
791
|
+
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
792
|
+
$d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
|
|
793
|
+
}, 0);
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
}, [
|
|
797
|
+
container1,
|
|
798
|
+
onMountAutoFocus,
|
|
799
|
+
onUnmountAutoFocus,
|
|
800
|
+
focusScope
|
|
801
|
+
]); // Takes care of looping focus (when tabbing whilst at the edges)
|
|
802
|
+
const handleKeyDown = React$1.useCallback((event)=>{
|
|
803
|
+
if (!loop && !trapped) return;
|
|
804
|
+
if (focusScope.paused) return;
|
|
805
|
+
const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
806
|
+
const focusedElement = document.activeElement;
|
|
807
|
+
if (isTabKey && focusedElement) {
|
|
808
|
+
const container = event.currentTarget;
|
|
809
|
+
const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
|
|
810
|
+
const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
|
|
811
|
+
if (!hasTabbableElementsInside) {
|
|
812
|
+
if (focusedElement === container) event.preventDefault();
|
|
813
|
+
} else {
|
|
814
|
+
if (!event.shiftKey && focusedElement === last) {
|
|
815
|
+
event.preventDefault();
|
|
816
|
+
if (loop) $d3863c46a17e8a28$var$focus(first, {
|
|
817
|
+
select: true
|
|
818
|
+
});
|
|
819
|
+
} else if (event.shiftKey && focusedElement === first) {
|
|
820
|
+
event.preventDefault();
|
|
821
|
+
if (loop) $d3863c46a17e8a28$var$focus(last, {
|
|
822
|
+
select: true
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}, [
|
|
828
|
+
loop,
|
|
829
|
+
trapped,
|
|
830
|
+
focusScope.paused
|
|
831
|
+
]);
|
|
832
|
+
return /*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$1.div, _extends._extends({
|
|
833
|
+
tabIndex: -1
|
|
834
|
+
}, scopeProps, {
|
|
835
|
+
ref: composedRefs,
|
|
836
|
+
onKeyDown: handleKeyDown
|
|
837
|
+
}));
|
|
838
|
+
});
|
|
839
|
+
/* -------------------------------------------------------------------------------------------------
|
|
840
|
+
* Utils
|
|
841
|
+
* -----------------------------------------------------------------------------------------------*/ /**
|
|
842
|
+
* Attempts focusing the first element in a list of candidates.
|
|
843
|
+
* Stops when focus has actually moved.
|
|
844
|
+
*/ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
|
|
845
|
+
const previouslyFocusedElement = document.activeElement;
|
|
846
|
+
for (const candidate of candidates){
|
|
847
|
+
$d3863c46a17e8a28$var$focus(candidate, {
|
|
848
|
+
select: select
|
|
849
|
+
});
|
|
850
|
+
if (document.activeElement !== previouslyFocusedElement) return;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Returns the first and last tabbable elements inside a container.
|
|
855
|
+
*/ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
|
|
856
|
+
const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
|
|
857
|
+
const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
|
|
858
|
+
const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
|
|
859
|
+
return [
|
|
860
|
+
first,
|
|
861
|
+
last
|
|
862
|
+
];
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Returns a list of potential tabbable candidates.
|
|
866
|
+
*
|
|
867
|
+
* NOTE: This is only a close approximation. For example it doesn't take into account cases like when
|
|
868
|
+
* elements are not visible. This cannot be worked out easily by just reading a property, but rather
|
|
869
|
+
* necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
|
|
870
|
+
*
|
|
871
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
|
|
872
|
+
* Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
|
|
873
|
+
*/ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
|
|
874
|
+
const nodes = [];
|
|
875
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
876
|
+
acceptNode: (node)=>{
|
|
877
|
+
const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
|
|
878
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
|
|
879
|
+
// runtime's understanding of tabbability, so this automatically accounts
|
|
880
|
+
// for any kind of element that could be tabbed to.
|
|
881
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
|
|
885
|
+
// hinders accessibility to have tab order different from visual order.
|
|
886
|
+
return nodes;
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Returns the first visible element in a list.
|
|
890
|
+
* NOTE: Only checks visibility up to the `container`.
|
|
891
|
+
*/ function $d3863c46a17e8a28$var$findVisible(elements, container) {
|
|
892
|
+
for (const element of elements){
|
|
893
|
+
// we stop checking if it's hidden at the `container` level (excluding)
|
|
894
|
+
if (!$d3863c46a17e8a28$var$isHidden(element, {
|
|
895
|
+
upTo: container
|
|
896
|
+
})) return element;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
|
|
900
|
+
if (getComputedStyle(node).visibility === 'hidden') return true;
|
|
901
|
+
while(node){
|
|
902
|
+
// we stop at `upTo` (excluding it)
|
|
903
|
+
if (upTo !== undefined && node === upTo) return false;
|
|
904
|
+
if (getComputedStyle(node).display === 'none') return true;
|
|
905
|
+
node = node.parentElement;
|
|
906
|
+
}
|
|
907
|
+
return false;
|
|
908
|
+
}
|
|
909
|
+
function $d3863c46a17e8a28$var$isSelectableInput(element) {
|
|
910
|
+
return element instanceof HTMLInputElement && 'select' in element;
|
|
911
|
+
}
|
|
912
|
+
function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
|
|
913
|
+
// only focus if that element is focusable
|
|
914
|
+
if (element && element.focus) {
|
|
915
|
+
const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
|
|
916
|
+
element.focus({
|
|
917
|
+
preventScroll: true
|
|
918
|
+
}); // only select if its not the same element, it supports selection and we need to select
|
|
919
|
+
if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
/* -------------------------------------------------------------------------------------------------
|
|
923
|
+
* FocusScope stack
|
|
924
|
+
* -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
|
|
925
|
+
function $d3863c46a17e8a28$var$createFocusScopesStack() {
|
|
926
|
+
/** A stack of focus scopes, with the active one at the top */ let stack = [];
|
|
927
|
+
return {
|
|
928
|
+
add (focusScope) {
|
|
929
|
+
// pause the currently active focus scope (at the top of the stack)
|
|
930
|
+
const activeFocusScope = stack[0];
|
|
931
|
+
if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
|
|
932
|
+
// remove in case it already exists (because we'll re-add it at the top of the stack)
|
|
933
|
+
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
934
|
+
stack.unshift(focusScope);
|
|
935
|
+
},
|
|
936
|
+
remove (focusScope) {
|
|
937
|
+
var _stack$;
|
|
938
|
+
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
939
|
+
(_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
function $d3863c46a17e8a28$var$arrayRemove(array, item) {
|
|
944
|
+
const updatedArray = [
|
|
945
|
+
...array
|
|
946
|
+
];
|
|
947
|
+
const index = updatedArray.indexOf(item);
|
|
948
|
+
if (index !== -1) updatedArray.splice(index, 1);
|
|
949
|
+
return updatedArray;
|
|
950
|
+
}
|
|
951
|
+
function $d3863c46a17e8a28$var$removeLinks(items) {
|
|
952
|
+
return items.filter((item)=>item.tagName !== 'A'
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
const $1746a345f3d73bb7$var$useReactId = React__namespace['useId'.toString()] || (()=>undefined
|
|
957
|
+
);
|
|
958
|
+
let $1746a345f3d73bb7$var$count = 0;
|
|
959
|
+
function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
960
|
+
const [id, setId] = React__namespace.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only.
|
|
961
|
+
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
962
|
+
if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
|
|
963
|
+
);
|
|
964
|
+
}, [
|
|
965
|
+
deterministicId
|
|
966
|
+
]);
|
|
967
|
+
return deterministicId || (id ? `radix-${id}` : '');
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
971
|
+
var _globalThis$document;
|
|
972
|
+
const { container: container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body , ...portalProps } = props;
|
|
973
|
+
return container ? /*#__PURE__*/ $7SXl2$reactdom__default["default"].createPortal(/*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.div, _extends._extends({}, portalProps, {
|
|
974
|
+
ref: forwardedRef
|
|
975
|
+
})), container) : null;
|
|
976
|
+
});
|
|
977
|
+
|
|
978
|
+
function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: defaultProp , onChange: onChange = ()=>{} }) {
|
|
979
|
+
const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
|
|
980
|
+
defaultProp: defaultProp,
|
|
981
|
+
onChange: onChange
|
|
982
|
+
});
|
|
983
|
+
const isControlled = prop !== undefined;
|
|
984
|
+
const value1 = isControlled ? prop : uncontrolledProp;
|
|
985
|
+
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onChange);
|
|
986
|
+
const setValue = React$1.useCallback((nextValue)=>{
|
|
987
|
+
if (isControlled) {
|
|
988
|
+
const setter = nextValue;
|
|
989
|
+
const value = typeof nextValue === 'function' ? setter(prop) : nextValue;
|
|
990
|
+
if (value !== prop) handleChange(value);
|
|
991
|
+
} else setUncontrolledProp(nextValue);
|
|
992
|
+
}, [
|
|
993
|
+
isControlled,
|
|
994
|
+
prop,
|
|
995
|
+
setUncontrolledProp,
|
|
996
|
+
handleChange
|
|
997
|
+
]);
|
|
998
|
+
return [
|
|
999
|
+
value1,
|
|
1000
|
+
setValue
|
|
1001
|
+
];
|
|
1002
|
+
}
|
|
1003
|
+
function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp , onChange: onChange }) {
|
|
1004
|
+
const uncontrolledState = React$1.useState(defaultProp);
|
|
1005
|
+
const [value] = uncontrolledState;
|
|
1006
|
+
const prevValueRef = React$1.useRef(value);
|
|
1007
|
+
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onChange);
|
|
1008
|
+
React$1.useEffect(()=>{
|
|
1009
|
+
if (prevValueRef.current !== value) {
|
|
1010
|
+
handleChange(value);
|
|
1011
|
+
prevValueRef.current = value;
|
|
1012
|
+
}
|
|
1013
|
+
}, [
|
|
1014
|
+
value,
|
|
1015
|
+
prevValueRef,
|
|
1016
|
+
handleChange
|
|
1017
|
+
]);
|
|
1018
|
+
return uncontrolledState;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
const $8927f6f2acc4f386$var$NODES = [
|
|
1022
|
+
'a',
|
|
1023
|
+
'button',
|
|
1024
|
+
'div',
|
|
1025
|
+
'h2',
|
|
1026
|
+
'h3',
|
|
1027
|
+
'img',
|
|
1028
|
+
'label',
|
|
1029
|
+
'li',
|
|
1030
|
+
'nav',
|
|
1031
|
+
'ol',
|
|
1032
|
+
'p',
|
|
1033
|
+
'span',
|
|
1034
|
+
'svg',
|
|
1035
|
+
'ul'
|
|
1036
|
+
]; // Temporary while we await merge of this fix:
|
|
1037
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
|
|
1038
|
+
// prettier-ignore
|
|
1039
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1040
|
+
* Primitive
|
|
1041
|
+
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{
|
|
1042
|
+
const Node = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
1043
|
+
const { asChild: asChild , ...primitiveProps } = props;
|
|
1044
|
+
const Comp = asChild ? index_module.$5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
|
|
1045
|
+
React$1.useEffect(()=>{
|
|
1046
|
+
window[Symbol.for('radix-ui')] = true;
|
|
1047
|
+
}, []);
|
|
1048
|
+
return /*#__PURE__*/ React$1.createElement(Comp, _extends._extends({}, primitiveProps, {
|
|
1049
|
+
ref: forwardedRef
|
|
1050
|
+
}));
|
|
1051
|
+
});
|
|
1052
|
+
Node.displayName = `Primitive.${node}`;
|
|
1053
|
+
return {
|
|
1054
|
+
...primitive,
|
|
1055
|
+
[node]: Node
|
|
1056
|
+
};
|
|
1057
|
+
}, {});
|
|
1058
|
+
|
|
124
1059
|
const $ea1ef594cf570d83$export$439d29a4e110a164 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
125
|
-
return /*#__PURE__*/ React$1.createElement(
|
|
1060
|
+
return /*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends._extends({}, props, {
|
|
126
1061
|
ref: forwardedRef,
|
|
127
1062
|
style: {
|
|
128
1063
|
// See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
|
|
@@ -155,7 +1090,7 @@ const $cc7e05a45900e73f$var$SELECTION_KEYS = [
|
|
|
155
1090
|
* Select
|
|
156
1091
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SELECT_NAME = 'Select';
|
|
157
1092
|
const [$cc7e05a45900e73f$var$Collection, $cc7e05a45900e73f$var$useCollection, $cc7e05a45900e73f$var$createCollectionScope] = $e02a7d9cb1dc128c$export$c74125a8e3af6bb2($cc7e05a45900e73f$var$SELECT_NAME);
|
|
158
|
-
const [$cc7e05a45900e73f$var$createSelectContext, $cc7e05a45900e73f$export$286727a75dc039bd] =
|
|
1093
|
+
const [$cc7e05a45900e73f$var$createSelectContext, $cc7e05a45900e73f$export$286727a75dc039bd] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($cc7e05a45900e73f$var$SELECT_NAME, [
|
|
159
1094
|
$cc7e05a45900e73f$var$createCollectionScope
|
|
160
1095
|
]);
|
|
161
1096
|
const [$cc7e05a45900e73f$var$SelectProvider, $cc7e05a45900e73f$var$useSelectContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$SELECT_NAME);
|
|
@@ -166,12 +1101,12 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
166
1101
|
const [valueNode, setValueNode] = React$1.useState(null);
|
|
167
1102
|
const [valueNodeHasChildren, setValueNodeHasChildren] = React$1.useState(false);
|
|
168
1103
|
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
169
|
-
const [open = false, setOpen] =
|
|
1104
|
+
const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
170
1105
|
prop: openProp,
|
|
171
1106
|
defaultProp: defaultOpen,
|
|
172
1107
|
onChange: onOpenChange
|
|
173
1108
|
});
|
|
174
|
-
const [value, setValue] =
|
|
1109
|
+
const [value, setValue] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
175
1110
|
prop: valueProp,
|
|
176
1111
|
defaultProp: defaultValue,
|
|
177
1112
|
onChange: onValueChange
|
|
@@ -194,7 +1129,7 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
194
1129
|
onValueNodeChange: setValueNode,
|
|
195
1130
|
valueNodeHasChildren: valueNodeHasChildren,
|
|
196
1131
|
onValueNodeHasChildrenChange: setValueNodeHasChildren,
|
|
197
|
-
contentId:
|
|
1132
|
+
contentId: $1746a345f3d73bb7$export$f680877a34711e37(),
|
|
198
1133
|
value: value,
|
|
199
1134
|
onValueChange: setValue,
|
|
200
1135
|
open: open,
|
|
@@ -240,7 +1175,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$1.forwardRe
|
|
|
240
1175
|
const { __scopeSelect: __scopeSelect , disabled: disabled = false , ...triggerProps } = props;
|
|
241
1176
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$TRIGGER_NAME, __scopeSelect);
|
|
242
1177
|
const isDisabled = context.disabled || disabled;
|
|
243
|
-
const composedRefs =
|
|
1178
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, context.onTriggerChange);
|
|
244
1179
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
245
1180
|
const [searchRef, handleTypeaheadSearch, resetTypeahead] = $cc7e05a45900e73f$var$useTypeaheadSearch((search)=>{
|
|
246
1181
|
const enabledItems = getItems().filter((item)=>!item.disabled
|
|
@@ -256,7 +1191,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$1.forwardRe
|
|
|
256
1191
|
resetTypeahead();
|
|
257
1192
|
}
|
|
258
1193
|
};
|
|
259
|
-
return /*#__PURE__*/ React$1.createElement(
|
|
1194
|
+
return /*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.button, _extends._extends({
|
|
260
1195
|
type: "button",
|
|
261
1196
|
role: "combobox",
|
|
262
1197
|
"aria-controls": context.contentId,
|
|
@@ -271,7 +1206,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$1.forwardRe
|
|
|
271
1206
|
}, triggerProps, {
|
|
272
1207
|
ref: composedRefs // Enable compatibility with native label or custom `Label` "click" for Safari:
|
|
273
1208
|
,
|
|
274
|
-
onClick:
|
|
1209
|
+
onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onClick, (event)=>{
|
|
275
1210
|
// Whilst browsers generally have no issue focusing the trigger when clicking
|
|
276
1211
|
// on a label, Safari seems to struggle with the fact that there's no `onClick`.
|
|
277
1212
|
// We force `focus` in this case. Note: this doesn't create any other side-effect
|
|
@@ -279,7 +1214,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$1.forwardRe
|
|
|
279
1214
|
// this only runs for a label "click"
|
|
280
1215
|
event.currentTarget.focus();
|
|
281
1216
|
}),
|
|
282
|
-
onPointerDown:
|
|
1217
|
+
onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onPointerDown, (event)=>{
|
|
283
1218
|
// prevent implicit pointer capture
|
|
284
1219
|
// https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture
|
|
285
1220
|
const target = event.target;
|
|
@@ -295,7 +1230,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$1.forwardRe
|
|
|
295
1230
|
event.preventDefault();
|
|
296
1231
|
}
|
|
297
1232
|
}),
|
|
298
|
-
onKeyDown:
|
|
1233
|
+
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onKeyDown, (event)=>{
|
|
299
1234
|
const isTypingAhead = searchRef.current !== '';
|
|
300
1235
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
301
1236
|
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
@@ -316,14 +1251,14 @@ const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ React$1.forwardR
|
|
|
316
1251
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$VALUE_NAME, __scopeSelect);
|
|
317
1252
|
const { onValueNodeHasChildrenChange: onValueNodeHasChildrenChange } = context;
|
|
318
1253
|
const hasChildren = children !== undefined;
|
|
319
|
-
const composedRefs =
|
|
1254
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, context.onValueNodeChange);
|
|
320
1255
|
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
321
1256
|
onValueNodeHasChildrenChange(hasChildren);
|
|
322
1257
|
}, [
|
|
323
1258
|
onValueNodeHasChildrenChange,
|
|
324
1259
|
hasChildren
|
|
325
1260
|
]);
|
|
326
|
-
return /*#__PURE__*/ React$1.createElement(
|
|
1261
|
+
return /*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.span, _extends._extends({}, valueProps, {
|
|
327
1262
|
ref: composedRefs // we don't want events from the portalled `SelectValue` children to bubble
|
|
328
1263
|
,
|
|
329
1264
|
style: {
|
|
@@ -333,14 +1268,14 @@ const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ React$1.forwardR
|
|
|
333
1268
|
});
|
|
334
1269
|
const $cc7e05a45900e73f$export$99b400cabb58c515 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
335
1270
|
const { __scopeSelect: __scopeSelect , children: children , ...iconProps } = props;
|
|
336
|
-
return /*#__PURE__*/ React$1.createElement(
|
|
1271
|
+
return /*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.span, _extends._extends({
|
|
337
1272
|
"aria-hidden": true
|
|
338
1273
|
}, iconProps, {
|
|
339
1274
|
ref: forwardedRef
|
|
340
1275
|
}), children || '▼');
|
|
341
1276
|
});
|
|
342
1277
|
const $cc7e05a45900e73f$export$b2af6c9944296213 = (props)=>{
|
|
343
|
-
return /*#__PURE__*/ React$1.createElement(
|
|
1278
|
+
return /*#__PURE__*/ React$1.createElement($f1701beae083dbae$export$602eac185826482c, _extends._extends({
|
|
344
1279
|
asChild: true
|
|
345
1280
|
}, props));
|
|
346
1281
|
};
|
|
@@ -353,7 +1288,7 @@ const $cc7e05a45900e73f$export$c973a4b3cb86a03d = /*#__PURE__*/ React$1.forwardR
|
|
|
353
1288
|
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
354
1289
|
setFragment(new DocumentFragment());
|
|
355
1290
|
}, []);
|
|
356
|
-
return /*#__PURE__*/ React$1.createElement(React$1.Fragment, null, context.open ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectContentImpl,
|
|
1291
|
+
return /*#__PURE__*/ React$1.createElement(React$1.Fragment, null, context.open ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectContentImpl, _extends._extends({}, props, {
|
|
357
1292
|
ref: forwardedRef
|
|
358
1293
|
})) : fragment ? /*#__PURE__*/ $7SXl2$reactdom.createPortal(/*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectContentProvider, {
|
|
359
1294
|
scope: props.__scopeSelect
|
|
@@ -369,7 +1304,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$1.forwardRef
|
|
|
369
1304
|
const [contentWrapper, setContentWrapper] = React$1.useState(null);
|
|
370
1305
|
const [content, setContent] = React$1.useState(null);
|
|
371
1306
|
const [viewport, setViewport] = React$1.useState(null);
|
|
372
|
-
const composedRefs =
|
|
1307
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setContent(node)
|
|
373
1308
|
);
|
|
374
1309
|
const [selectedItem, setSelectedItem] = React$1.useState(null);
|
|
375
1310
|
const [selectedItemText, setSelectedItemText] = React$1.useState(null);
|
|
@@ -384,7 +1319,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$1.forwardRef
|
|
|
384
1319
|
content
|
|
385
1320
|
]); // Make sure the whole tree has focus guards as our `Select` may be
|
|
386
1321
|
// the last element in the DOM (because of the `Portal`)
|
|
387
|
-
|
|
1322
|
+
$3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
|
|
388
1323
|
const [contentZIndex, setContentZIndex] = React$1.useState();
|
|
389
1324
|
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
390
1325
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
@@ -648,7 +1583,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$1.forwardRef
|
|
|
648
1583
|
position: 'fixed',
|
|
649
1584
|
zIndex: contentZIndex
|
|
650
1585
|
}
|
|
651
|
-
}, /*#__PURE__*/ React$1.createElement(
|
|
1586
|
+
}, /*#__PURE__*/ React$1.createElement($d3863c46a17e8a28$export$20e40289641fbbb6, {
|
|
652
1587
|
asChild: true // we make sure we're not trapping once it's been closed
|
|
653
1588
|
,
|
|
654
1589
|
trapped: context.open,
|
|
@@ -656,14 +1591,14 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$1.forwardRef
|
|
|
656
1591
|
// we prevent open autofocus because we manually focus the selected item
|
|
657
1592
|
event.preventDefault();
|
|
658
1593
|
},
|
|
659
|
-
onUnmountAutoFocus:
|
|
1594
|
+
onUnmountAutoFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(onCloseAutoFocus, (event)=>{
|
|
660
1595
|
var _context$trigger;
|
|
661
1596
|
(_context$trigger = context.trigger) === null || _context$trigger === void 0 || _context$trigger.focus({
|
|
662
1597
|
preventScroll: true
|
|
663
1598
|
});
|
|
664
1599
|
event.preventDefault();
|
|
665
1600
|
})
|
|
666
|
-
}, /*#__PURE__*/ React$1.createElement(
|
|
1601
|
+
}, /*#__PURE__*/ React$1.createElement($5cb92bef7577960e$export$177fb62ff3ec1f22, _extends._extends({
|
|
667
1602
|
role: "listbox",
|
|
668
1603
|
id: context.contentId,
|
|
669
1604
|
"data-state": context.open ? 'open' : 'closed',
|
|
@@ -687,7 +1622,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$1.forwardRef
|
|
|
687
1622
|
,
|
|
688
1623
|
onDismiss: ()=>context.onOpenChange(false)
|
|
689
1624
|
,
|
|
690
|
-
onKeyDown:
|
|
1625
|
+
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(contentProps.onKeyDown, (event)=>{
|
|
691
1626
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey; // select should not be navigated using tab key so we prevent it
|
|
692
1627
|
if (event.key === 'Tab') event.preventDefault();
|
|
693
1628
|
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
@@ -729,7 +1664,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$1.forwardRef
|
|
|
729
1664
|
const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
730
1665
|
const { __scopeSelect: __scopeSelect , ...viewportProps } = props;
|
|
731
1666
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
732
|
-
const composedRefs =
|
|
1667
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, contentContext.onViewportChange);
|
|
733
1668
|
const prevScrollTopRef = React$1.useRef(0);
|
|
734
1669
|
return /*#__PURE__*/ React$1.createElement(React$1.Fragment, null, /*#__PURE__*/ React$1.createElement("style", {
|
|
735
1670
|
dangerouslySetInnerHTML: {
|
|
@@ -737,7 +1672,7 @@ const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React$1.forwardR
|
|
|
737
1672
|
}
|
|
738
1673
|
}), /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
739
1674
|
scope: __scopeSelect
|
|
740
|
-
}, /*#__PURE__*/ React$1.createElement(
|
|
1675
|
+
}, /*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.div, _extends._extends({
|
|
741
1676
|
"data-radix-select-viewport": "",
|
|
742
1677
|
role: "presentation"
|
|
743
1678
|
}, viewportProps, {
|
|
@@ -751,7 +1686,7 @@ const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React$1.forwardR
|
|
|
751
1686
|
overflow: 'auto',
|
|
752
1687
|
...viewportProps.style
|
|
753
1688
|
},
|
|
754
|
-
onScroll:
|
|
1689
|
+
onScroll: $e42e1063c40fb3ef$export$b9ecd428b558ff10(viewportProps.onScroll, (event)=>{
|
|
755
1690
|
const viewport = event.currentTarget;
|
|
756
1691
|
const { contentWrapper: contentWrapper , shouldExpandOnScrollRef: shouldExpandOnScrollRef } = contentContext;
|
|
757
1692
|
if (shouldExpandOnScrollRef !== null && shouldExpandOnScrollRef !== void 0 && shouldExpandOnScrollRef.current && contentWrapper) {
|
|
@@ -792,11 +1727,11 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$1.forwardR
|
|
|
792
1727
|
const isSelected = context.value === value;
|
|
793
1728
|
const [textValue, setTextValue] = React$1.useState(textValueProp !== null && textValueProp !== void 0 ? textValueProp : '');
|
|
794
1729
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
795
|
-
const composedRefs =
|
|
1730
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>{
|
|
796
1731
|
var _contentContext$itemR;
|
|
797
1732
|
return (_contentContext$itemR = contentContext.itemRefCallback) === null || _contentContext$itemR === void 0 ? void 0 : _contentContext$itemR.call(contentContext, node, value, disabled);
|
|
798
1733
|
});
|
|
799
|
-
const textId =
|
|
1734
|
+
const textId = $1746a345f3d73bb7$export$f680877a34711e37();
|
|
800
1735
|
const handleSelect = ()=>{
|
|
801
1736
|
if (!disabled) {
|
|
802
1737
|
context.onValueChange(value);
|
|
@@ -820,7 +1755,7 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$1.forwardR
|
|
|
820
1755
|
value: value,
|
|
821
1756
|
disabled: disabled,
|
|
822
1757
|
textValue: textValue
|
|
823
|
-
}, /*#__PURE__*/ React$1.createElement(
|
|
1758
|
+
}, /*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.div, _extends._extends({
|
|
824
1759
|
role: "option",
|
|
825
1760
|
"aria-labelledby": textId,
|
|
826
1761
|
"data-highlighted": isFocused ? '' : undefined // `isFocused` caveat fixes stuttering in VoiceOver
|
|
@@ -832,12 +1767,12 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$1.forwardR
|
|
|
832
1767
|
tabIndex: disabled ? undefined : -1
|
|
833
1768
|
}, itemProps, {
|
|
834
1769
|
ref: composedRefs,
|
|
835
|
-
onFocus:
|
|
1770
|
+
onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onFocus, ()=>setIsFocused(true)
|
|
836
1771
|
),
|
|
837
|
-
onBlur:
|
|
1772
|
+
onBlur: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onBlur, ()=>setIsFocused(false)
|
|
838
1773
|
),
|
|
839
|
-
onPointerUp:
|
|
840
|
-
onPointerMove:
|
|
1774
|
+
onPointerUp: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerUp, handleSelect),
|
|
1775
|
+
onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerMove, (event)=>{
|
|
841
1776
|
if (disabled) {
|
|
842
1777
|
var _contentContext$onIte;
|
|
843
1778
|
(_contentContext$onIte = contentContext.onItemLeave) === null || _contentContext$onIte === void 0 || _contentContext$onIte.call(contentContext);
|
|
@@ -847,13 +1782,13 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$1.forwardR
|
|
|
847
1782
|
preventScroll: true
|
|
848
1783
|
});
|
|
849
1784
|
}),
|
|
850
|
-
onPointerLeave:
|
|
1785
|
+
onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerLeave, (event)=>{
|
|
851
1786
|
if (event.currentTarget === document.activeElement) {
|
|
852
1787
|
var _contentContext$onIte2;
|
|
853
1788
|
(_contentContext$onIte2 = contentContext.onItemLeave) === null || _contentContext$onIte2 === void 0 || _contentContext$onIte2.call(contentContext);
|
|
854
1789
|
}
|
|
855
1790
|
}),
|
|
856
|
-
onKeyDown:
|
|
1791
|
+
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onKeyDown, (event)=>{
|
|
857
1792
|
var _contentContext$searc;
|
|
858
1793
|
const isTypingAhead = ((_contentContext$searc = contentContext.searchRef) === null || _contentContext$searc === void 0 ? void 0 : _contentContext$searc.current) !== '';
|
|
859
1794
|
if (isTypingAhead && event.key === ' ') return;
|
|
@@ -873,7 +1808,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$1.forwardR
|
|
|
873
1808
|
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
874
1809
|
const nativeOptionsContext = $cc7e05a45900e73f$var$useSelectNativeOptionsContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
875
1810
|
const [itemTextNode, setItemTextNode] = React$1.useState(null);
|
|
876
|
-
const composedRefs =
|
|
1811
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setItemTextNode(node)
|
|
877
1812
|
, itemContext.onItemTextChange, (node)=>{
|
|
878
1813
|
var _contentContext$itemT;
|
|
879
1814
|
return (_contentContext$itemT = contentContext.itemTextRefCallback) === null || _contentContext$itemT === void 0 ? void 0 : _contentContext$itemT.call(contentContext, node, itemContext.value, itemContext.disabled);
|
|
@@ -899,7 +1834,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$1.forwardR
|
|
|
899
1834
|
onNativeOptionRemove,
|
|
900
1835
|
nativeOption
|
|
901
1836
|
]);
|
|
902
|
-
return /*#__PURE__*/ React$1.createElement(React$1.Fragment, null, /*#__PURE__*/ React$1.createElement(
|
|
1837
|
+
return /*#__PURE__*/ React$1.createElement(React$1.Fragment, null, /*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.span, _extends._extends({
|
|
903
1838
|
id: itemContext.textId
|
|
904
1839
|
}, itemTextProps, {
|
|
905
1840
|
ref: composedRefs
|
|
@@ -911,7 +1846,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$1.forwardR
|
|
|
911
1846
|
const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
912
1847
|
const { __scopeSelect: __scopeSelect , ...itemIndicatorProps } = props;
|
|
913
1848
|
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_INDICATOR_NAME, __scopeSelect);
|
|
914
|
-
return itemContext.isSelected ? /*#__PURE__*/ React$1.createElement(
|
|
1849
|
+
return itemContext.isSelected ? /*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.span, _extends._extends({
|
|
915
1850
|
"aria-hidden": true
|
|
916
1851
|
}, itemIndicatorProps, {
|
|
917
1852
|
ref: forwardedRef
|
|
@@ -923,7 +1858,7 @@ const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ React$1.forwardR
|
|
|
923
1858
|
const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
924
1859
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
925
1860
|
const [canScrollUp1, setCanScrollUp] = React$1.useState(false);
|
|
926
|
-
const composedRefs =
|
|
1861
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, contentContext.onScrollButtonChange);
|
|
927
1862
|
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
928
1863
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
929
1864
|
const viewport = contentContext.viewport;
|
|
@@ -940,7 +1875,7 @@ const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React$1.forwardR
|
|
|
940
1875
|
contentContext.viewport,
|
|
941
1876
|
contentContext.isPositioned
|
|
942
1877
|
]);
|
|
943
|
-
return canScrollUp1 ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl,
|
|
1878
|
+
return canScrollUp1 ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl, _extends._extends({}, props, {
|
|
944
1879
|
ref: composedRefs,
|
|
945
1880
|
onAutoScroll: ()=>{
|
|
946
1881
|
const { viewport: viewport , selectedItem: selectedItem } = contentContext;
|
|
@@ -954,7 +1889,7 @@ const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React$1.forwardR
|
|
|
954
1889
|
const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
955
1890
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
956
1891
|
const [canScrollDown1, setCanScrollDown] = React$1.useState(false);
|
|
957
|
-
const composedRefs =
|
|
1892
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, contentContext.onScrollButtonChange);
|
|
958
1893
|
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
959
1894
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
960
1895
|
const viewport = contentContext.viewport;
|
|
@@ -973,7 +1908,7 @@ const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React$1.forwardRe
|
|
|
973
1908
|
contentContext.viewport,
|
|
974
1909
|
contentContext.isPositioned
|
|
975
1910
|
]);
|
|
976
|
-
return canScrollDown1 ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl,
|
|
1911
|
+
return canScrollDown1 ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl, _extends._extends({}, props, {
|
|
977
1912
|
ref: composedRefs,
|
|
978
1913
|
onAutoScroll: ()=>{
|
|
979
1914
|
const { viewport: viewport , selectedItem: selectedItem } = contentContext;
|
|
@@ -1011,7 +1946,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$1.forwa
|
|
|
1011
1946
|
}, [
|
|
1012
1947
|
getItems
|
|
1013
1948
|
]);
|
|
1014
|
-
return /*#__PURE__*/ React$1.createElement(
|
|
1949
|
+
return /*#__PURE__*/ React$1.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.div, _extends._extends({
|
|
1015
1950
|
"aria-hidden": true
|
|
1016
1951
|
}, scrollIndicatorProps, {
|
|
1017
1952
|
ref: forwardedRef,
|
|
@@ -1019,12 +1954,12 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$1.forwa
|
|
|
1019
1954
|
flexShrink: 0,
|
|
1020
1955
|
...scrollIndicatorProps.style
|
|
1021
1956
|
},
|
|
1022
|
-
onPointerMove:
|
|
1957
|
+
onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerMove, ()=>{
|
|
1023
1958
|
var _contentContext$onIte3;
|
|
1024
1959
|
(_contentContext$onIte3 = contentContext.onItemLeave) === null || _contentContext$onIte3 === void 0 || _contentContext$onIte3.call(contentContext);
|
|
1025
1960
|
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
1026
1961
|
}),
|
|
1027
|
-
onPointerLeave:
|
|
1962
|
+
onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerLeave, ()=>{
|
|
1028
1963
|
clearAutoScrollTimer();
|
|
1029
1964
|
})
|
|
1030
1965
|
}));
|
|
@@ -1032,8 +1967,8 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$1.forwa
|
|
|
1032
1967
|
/* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$BubbleSelect = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
1033
1968
|
const { value: value , ...selectProps } = props;
|
|
1034
1969
|
const ref = React$1.useRef(null);
|
|
1035
|
-
const composedRefs =
|
|
1036
|
-
const prevValue = index_module
|
|
1970
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, ref);
|
|
1971
|
+
const prevValue = index_module.$010c2913dbd2fe3d$export$5cae361ad82dce8b(value); // Bubble value change to parents (e.g form change event)
|
|
1037
1972
|
React$1.useEffect(()=>{
|
|
1038
1973
|
const select = ref.current;
|
|
1039
1974
|
const selectProto = window.HTMLSelectElement.prototype;
|
|
@@ -1063,14 +1998,14 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$1.forwa
|
|
|
1063
1998
|
* won't work otherwise.
|
|
1064
1999
|
*/ return /*#__PURE__*/ React$1.createElement($ea1ef594cf570d83$export$439d29a4e110a164, {
|
|
1065
2000
|
asChild: true
|
|
1066
|
-
}, /*#__PURE__*/ React$1.createElement("select",
|
|
2001
|
+
}, /*#__PURE__*/ React$1.createElement("select", _extends._extends({}, selectProps, {
|
|
1067
2002
|
ref: composedRefs,
|
|
1068
2003
|
defaultValue: value
|
|
1069
2004
|
})));
|
|
1070
2005
|
});
|
|
1071
2006
|
$cc7e05a45900e73f$var$BubbleSelect.displayName = 'BubbleSelect';
|
|
1072
2007
|
function $cc7e05a45900e73f$var$useTypeaheadSearch(onSearchChange) {
|
|
1073
|
-
const handleSearchChange =
|
|
2008
|
+
const handleSearchChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onSearchChange);
|
|
1074
2009
|
const searchRef = React$1.useRef('');
|
|
1075
2010
|
const timerRef = React$1.useRef(0);
|
|
1076
2011
|
const handleTypeaheadSearch = React$1.useCallback((key)=>{
|
|
@@ -1170,7 +2105,7 @@ var BtIconChevronUp2Px_2 = BtIconChevronUp2Px;
|
|
|
1170
2105
|
|
|
1171
2106
|
/** Use `Select` to choose from a dropdown list of options. */
|
|
1172
2107
|
var Select = function (_a) {
|
|
1173
|
-
var isRequired = _a.isRequired, isDisabled = _a.isDisabled, placeholder = _a.placeholder, label = _a.label, options = _a.options, onOpenChange = _a.onOpenChange, isDefaultOpen = _a.isDefaultOpen, defaultValue = _a.defaultValue, errorMessage = _a.errorMessage, labelSize = _a.labelSize, helper = _a.helper, name = _a.name, isFluid = _a.isFluid, onBlur = _a.onBlur, onChange = _a.onChange, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, onClickDisclosure = _a.onClickDisclosure;
|
|
2108
|
+
var isRequired = _a.isRequired, isDisabled = _a.isDisabled, placeholder = _a.placeholder, label = _a.label, options = _a.options, onOpenChange = _a.onOpenChange, isDefaultOpen = _a.isDefaultOpen, defaultValue = _a.defaultValue, errorMessage = _a.errorMessage, labelSize = _a.labelSize, helper = _a.helper, name = _a.name, isFluid = _a.isFluid, onBlur = _a.onBlur, onChange = _a.onChange, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, onClickDisclosure = _a.onClickDisclosure, props = filterDataAttrs.__rest(_a, ["isRequired", "isDisabled", "placeholder", "label", "options", "onOpenChange", "isDefaultOpen", "defaultValue", "errorMessage", "labelSize", "helper", "name", "isFluid", "onBlur", "onChange", "disclosureTitle", "disclosureText", "onClickDisclosure"]);
|
|
1174
2109
|
var id = React$1.useId();
|
|
1175
2110
|
var arcRootElement = React$1.useContext(Base.ArcRootElementContext);
|
|
1176
2111
|
var surface = React$1.useContext(Surface.Context).surface;
|
|
@@ -1185,11 +2120,11 @@ var Select = function (_a) {
|
|
|
1185
2120
|
};
|
|
1186
2121
|
return (React__default["default"].createElement(FormControl.FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional", isDisabled: isDisabled, disclosureText: disclosureText, disclosureTitle: disclosureTitle, onClickDisclosure: onClickDisclosure },
|
|
1187
2122
|
React__default["default"].createElement($cc7e05a45900e73f$export$be92b6f5f03c0fe9, { name: name, required: isRequired, disabled: isDisabled, defaultOpen: isDefaultOpen, value: selectedValue, onOpenChange: onOpenChange, onValueChange: function (value) { return onValueChange(value); } },
|
|
1188
|
-
React__default["default"].createElement($cc7e05a45900e73f$export$41fb9f06171c75f4, { id: id, name: name, onBlur: onBlur, className: index$1.classNames("arc-Select-trigger", {
|
|
2123
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$41fb9f06171c75f4, filterDataAttrs.__assign({ id: id, name: name, onBlur: onBlur, className: index$1.classNames("arc-Select-trigger", {
|
|
1189
2124
|
"arc-Select-trigger--constrained": !isFluid,
|
|
1190
2125
|
"arc-Select-trigger--onDarkSurface": surface === "dark",
|
|
1191
2126
|
"arc-Select-trigger--invalid": errorMessage
|
|
1192
|
-
}) },
|
|
2127
|
+
}) }, filterDataAttrs.filterDataAttrs(props)),
|
|
1193
2128
|
React__default["default"].createElement($cc7e05a45900e73f$export$4c8d1a57a761ef94, { asChild: true, "aria-label": getSelectedValueName(selectedValue) }, !selectedValue ? (React__default["default"].createElement("span", { "aria-hidden": true, className: "arc-Select-placeHolder" }, placeholder)) : (React__default["default"].createElement("span", { className: "arc-Select-valueItem" }, getSelectedValueName(selectedValue)))),
|
|
1194
2129
|
React__default["default"].createElement($cc7e05a45900e73f$export$f04a61298a47a40f, { className: "arc-Select-triggerIcon" },
|
|
1195
2130
|
React__default["default"].createElement(Icon.Icon, { icon: BtIconChevronDown2Px.BtIconChevronDown2Px_2, size: 20 }))),
|