@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
|
@@ -1,25 +1,153 @@
|
|
|
1
|
+
import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/esm/filter-data-attrs-afdb7d32.js';
|
|
1
2
|
import { c as classNames } from '../_shared/esm/index-2ae58626.js';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { $ as $010c2913dbd2fe3d$export$5cae361ad82dce8b } from '../_shared/esm/index.module-
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import React__default, { createContext, useMemo, createElement, useContext, useCallback, forwardRef, useEffect, useRef, useState, Fragment, useId } from 'react';
|
|
5
|
+
import { _ as _extends } from '../_shared/esm/extends-4575346e.js';
|
|
6
|
+
import $7SXl2$reactdom, { flushSync, createPortal } from 'react-dom';
|
|
7
|
+
import { $ as $5e63c961fc1ce211$export$8c6ed5c666ac1360, a as $9f79659886946c16$export$e5c5a5f917a5871c, b as $010c2913dbd2fe3d$export$5cae361ad82dce8b } from '../_shared/esm/index.module-5ed90b21.js';
|
|
8
|
+
import { h as hideOthers, $ as $01b9c$RemoveScroll } from '../_shared/esm/index-369dce7f.js';
|
|
7
9
|
import { B as BtIconChevronDown2Px_2 } from '../_shared/esm/BtIconChevronDown2Px-782876e2.js';
|
|
8
10
|
import { B as BtIconTickAlt2Px_2 } from '../_shared/esm/BtIconTickAlt2Px-da97e9ae.js';
|
|
9
11
|
import { I as Icon } from '../_shared/esm/Icon-c1af47bc.js';
|
|
10
|
-
import { F as FormControl } from '../_shared/esm/FormControl-
|
|
12
|
+
import { F as FormControl } from '../_shared/esm/FormControl-f18e2f59.js';
|
|
11
13
|
import { C as Context } from '../_shared/esm/Surface-dde51789.js';
|
|
12
14
|
import { A as ArcRootElementContext } from '../_shared/esm/Base-6c01e0ec.js';
|
|
13
|
-
import '../_shared/esm/filter-data-attrs-afdb7d32.js';
|
|
14
15
|
import '../_shared/esm/suffix-modifier-7e640670.js';
|
|
15
16
|
import '../_shared/esm/BtIconAlert-55a6ed5c.js';
|
|
16
|
-
import '../_shared/esm/DisclosureMini-
|
|
17
|
-
import '../_shared/esm/Text-
|
|
17
|
+
import '../_shared/esm/DisclosureMini-9b819941.js';
|
|
18
|
+
import '../_shared/esm/Text-40457811.js';
|
|
18
19
|
|
|
19
20
|
function $ae6933e535247d3d$export$7d15b64cf5a3a4c4(value, [min, max]) {
|
|
20
21
|
return Math.min(max, Math.max(min, value));
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented: checkForDefaultPrevented = true } = {}) {
|
|
25
|
+
return function handleEvent(event) {
|
|
26
|
+
originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
|
|
27
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* -------------------------------------------------------------------------------------------------
|
|
32
|
+
* createContextScope
|
|
33
|
+
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
|
|
34
|
+
let defaultContexts = [];
|
|
35
|
+
/* -----------------------------------------------------------------------------------------------
|
|
36
|
+
* createContext
|
|
37
|
+
* ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
|
|
38
|
+
const BaseContext = /*#__PURE__*/ createContext(defaultContext);
|
|
39
|
+
const index = defaultContexts.length;
|
|
40
|
+
defaultContexts = [
|
|
41
|
+
...defaultContexts,
|
|
42
|
+
defaultContext
|
|
43
|
+
];
|
|
44
|
+
function Provider(props) {
|
|
45
|
+
const { scope: scope , children: children , ...context } = props;
|
|
46
|
+
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
const value = useMemo(()=>context
|
|
49
|
+
, Object.values(context));
|
|
50
|
+
return /*#__PURE__*/ createElement(Context.Provider, {
|
|
51
|
+
value: value
|
|
52
|
+
}, children);
|
|
53
|
+
}
|
|
54
|
+
function useContext$1(consumerName, scope) {
|
|
55
|
+
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
|
|
56
|
+
const context = useContext(Context);
|
|
57
|
+
if (context) return context;
|
|
58
|
+
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
|
|
59
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
60
|
+
}
|
|
61
|
+
Provider.displayName = rootComponentName + 'Provider';
|
|
62
|
+
return [
|
|
63
|
+
Provider,
|
|
64
|
+
useContext$1
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
/* -----------------------------------------------------------------------------------------------
|
|
68
|
+
* createScope
|
|
69
|
+
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
|
|
70
|
+
const scopeContexts = defaultContexts.map((defaultContext)=>{
|
|
71
|
+
return /*#__PURE__*/ createContext(defaultContext);
|
|
72
|
+
});
|
|
73
|
+
return function useScope(scope) {
|
|
74
|
+
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
|
|
75
|
+
return useMemo(()=>({
|
|
76
|
+
[`__scope${scopeName}`]: {
|
|
77
|
+
...scope,
|
|
78
|
+
[scopeName]: contexts
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
, [
|
|
82
|
+
scope,
|
|
83
|
+
contexts
|
|
84
|
+
]);
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
createScope.scopeName = scopeName;
|
|
88
|
+
return [
|
|
89
|
+
$c512c27ab02ef895$export$fd42f52fd3ae1109,
|
|
90
|
+
$c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
/* -------------------------------------------------------------------------------------------------
|
|
94
|
+
* composeContextScopes
|
|
95
|
+
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
|
|
96
|
+
const baseScope = scopes[0];
|
|
97
|
+
if (scopes.length === 1) return baseScope;
|
|
98
|
+
const createScope1 = ()=>{
|
|
99
|
+
const scopeHooks = scopes.map((createScope)=>({
|
|
100
|
+
useScope: createScope(),
|
|
101
|
+
scopeName: createScope.scopeName
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
return function useComposedScopes(overrideScopes) {
|
|
105
|
+
const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope: useScope , scopeName: scopeName })=>{
|
|
106
|
+
// We are calling a hook inside a callback which React warns against to avoid inconsistent
|
|
107
|
+
// renders, however, scoping doesn't have render side effects so we ignore the rule.
|
|
108
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
109
|
+
const scopeProps = useScope(overrideScopes);
|
|
110
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
111
|
+
return {
|
|
112
|
+
...nextScopes,
|
|
113
|
+
...currentScope
|
|
114
|
+
};
|
|
115
|
+
}, {});
|
|
116
|
+
return useMemo(()=>({
|
|
117
|
+
[`__scope${baseScope.scopeName}`]: nextScopes1
|
|
118
|
+
})
|
|
119
|
+
, [
|
|
120
|
+
nextScopes1
|
|
121
|
+
]);
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
createScope1.scopeName = baseScope.scopeName;
|
|
125
|
+
return createScope1;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Set a given ref to a given value
|
|
130
|
+
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
131
|
+
*/ function $6ed0406888f73fc4$var$setRef$1(ref, value) {
|
|
132
|
+
if (typeof ref === 'function') ref(value);
|
|
133
|
+
else if (ref !== null && ref !== undefined) ref.current = value;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A utility to compose multiple refs together
|
|
137
|
+
* Accepts callback refs and RefObject(s)
|
|
138
|
+
*/ function $6ed0406888f73fc4$export$43e446d32b3d21af$1(...refs) {
|
|
139
|
+
return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef$1(ref, node)
|
|
140
|
+
)
|
|
141
|
+
;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A custom hook that composes multiple refs
|
|
145
|
+
* Accepts callback refs and RefObject(s)
|
|
146
|
+
*/ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(...refs) {
|
|
147
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
148
|
+
return useCallback($6ed0406888f73fc4$export$43e446d32b3d21af$1(...refs), refs);
|
|
149
|
+
}
|
|
150
|
+
|
|
23
151
|
// We have resorted to returning slots directly rather than exposing primitives that can then
|
|
24
152
|
// be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.
|
|
25
153
|
// This is because we encountered issues with generic types that cannot be statically analysed
|
|
@@ -51,7 +179,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
51
179
|
const CollectionSlot = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
|
|
52
180
|
const { scope: scope , children: children } = props;
|
|
53
181
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
54
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.collectionRef);
|
|
182
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, context.collectionRef);
|
|
55
183
|
return /*#__PURE__*/ React__default.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
56
184
|
ref: composedRefs
|
|
57
185
|
}, children);
|
|
@@ -63,7 +191,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
63
191
|
const CollectionItemSlot = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
|
|
64
192
|
const { scope: scope , children: children , ...itemData } = props;
|
|
65
193
|
const ref = React__default.useRef(null);
|
|
66
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
194
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, ref);
|
|
67
195
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
68
196
|
React__default.useEffect(()=>{
|
|
69
197
|
context.itemMap.set(ref, {
|
|
@@ -113,6 +241,794 @@ const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ createContext(undef
|
|
|
113
241
|
return localDir || globalDir || 'ltr';
|
|
114
242
|
}
|
|
115
243
|
|
|
244
|
+
const $8927f6f2acc4f386$var$NODES$2 = [
|
|
245
|
+
'a',
|
|
246
|
+
'button',
|
|
247
|
+
'div',
|
|
248
|
+
'h2',
|
|
249
|
+
'h3',
|
|
250
|
+
'img',
|
|
251
|
+
'label',
|
|
252
|
+
'li',
|
|
253
|
+
'nav',
|
|
254
|
+
'ol',
|
|
255
|
+
'p',
|
|
256
|
+
'span',
|
|
257
|
+
'svg',
|
|
258
|
+
'ul'
|
|
259
|
+
]; // Temporary while we await merge of this fix:
|
|
260
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
|
|
261
|
+
// prettier-ignore
|
|
262
|
+
/* -------------------------------------------------------------------------------------------------
|
|
263
|
+
* Primitive
|
|
264
|
+
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034$2 = $8927f6f2acc4f386$var$NODES$2.reduce((primitive, node)=>{
|
|
265
|
+
const Node = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
266
|
+
const { asChild: asChild , ...primitiveProps } = props;
|
|
267
|
+
const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
|
|
268
|
+
useEffect(()=>{
|
|
269
|
+
window[Symbol.for('radix-ui')] = true;
|
|
270
|
+
}, []);
|
|
271
|
+
return /*#__PURE__*/ createElement(Comp, _extends({}, primitiveProps, {
|
|
272
|
+
ref: forwardedRef
|
|
273
|
+
}));
|
|
274
|
+
});
|
|
275
|
+
Node.displayName = `Primitive.${node}`;
|
|
276
|
+
return {
|
|
277
|
+
...primitive,
|
|
278
|
+
[node]: Node
|
|
279
|
+
};
|
|
280
|
+
}, {});
|
|
281
|
+
/* -------------------------------------------------------------------------------------------------
|
|
282
|
+
* Utils
|
|
283
|
+
* -----------------------------------------------------------------------------------------------*/ /**
|
|
284
|
+
* Flush custom event dispatch
|
|
285
|
+
* https://github.com/radix-ui/primitives/pull/1378
|
|
286
|
+
*
|
|
287
|
+
* React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.
|
|
288
|
+
*
|
|
289
|
+
* Internally, React prioritises events in the following order:
|
|
290
|
+
* - discrete
|
|
291
|
+
* - continuous
|
|
292
|
+
* - default
|
|
293
|
+
*
|
|
294
|
+
* https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350
|
|
295
|
+
*
|
|
296
|
+
* `discrete` is an important distinction as updates within these events are applied immediately.
|
|
297
|
+
* React however, is not able to infer the priority of custom event types due to how they are detected internally.
|
|
298
|
+
* Because of this, it's possible for updates from custom events to be unexpectedly batched when
|
|
299
|
+
* dispatched by another `discrete` event.
|
|
300
|
+
*
|
|
301
|
+
* In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.
|
|
302
|
+
* This utility should be used when dispatching a custom event from within another `discrete` event, this utility
|
|
303
|
+
* is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.
|
|
304
|
+
* For example:
|
|
305
|
+
*
|
|
306
|
+
* dispatching a known click 👎
|
|
307
|
+
* target.dispatchEvent(new Event(‘click’))
|
|
308
|
+
*
|
|
309
|
+
* dispatching a custom type within a non-discrete event 👎
|
|
310
|
+
* onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}
|
|
311
|
+
*
|
|
312
|
+
* dispatching a custom type within a `discrete` event 👍
|
|
313
|
+
* onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}
|
|
314
|
+
*
|
|
315
|
+
* Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use
|
|
316
|
+
* this utility with them. This is because it's possible for those handlers to be called implicitly during render
|
|
317
|
+
* e.g. when focus is within a component as it is unmounted, or when managing focus on mount.
|
|
318
|
+
*/ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {
|
|
319
|
+
if (target) flushSync(()=>target.dispatchEvent(event)
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
325
|
+
* prop or avoid re-executing effects when passed as a dependency
|
|
326
|
+
*/ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(callback) {
|
|
327
|
+
const callbackRef = useRef(callback);
|
|
328
|
+
useEffect(()=>{
|
|
329
|
+
callbackRef.current = callback;
|
|
330
|
+
}); // https://github.com/facebook/react/issues/19240
|
|
331
|
+
return useMemo(()=>(...args)=>{
|
|
332
|
+
var _callbackRef$current;
|
|
333
|
+
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
|
|
334
|
+
}
|
|
335
|
+
, []);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Listens for when the escape key is down
|
|
340
|
+
*/ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
341
|
+
const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onEscapeKeyDownProp);
|
|
342
|
+
useEffect(()=>{
|
|
343
|
+
const handleKeyDown = (event)=>{
|
|
344
|
+
if (event.key === 'Escape') onEscapeKeyDown(event);
|
|
345
|
+
};
|
|
346
|
+
ownerDocument.addEventListener('keydown', handleKeyDown);
|
|
347
|
+
return ()=>ownerDocument.removeEventListener('keydown', handleKeyDown)
|
|
348
|
+
;
|
|
349
|
+
}, [
|
|
350
|
+
onEscapeKeyDown,
|
|
351
|
+
ownerDocument
|
|
352
|
+
]);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';
|
|
356
|
+
const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
|
|
357
|
+
const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
|
|
358
|
+
let $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
359
|
+
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ createContext({
|
|
360
|
+
layers: new Set(),
|
|
361
|
+
layersWithOutsidePointerEventsDisabled: new Set(),
|
|
362
|
+
branches: new Set()
|
|
363
|
+
});
|
|
364
|
+
const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
365
|
+
var _node$ownerDocument;
|
|
366
|
+
const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;
|
|
367
|
+
const context = useContext($5cb92bef7577960e$var$DismissableLayerContext);
|
|
368
|
+
const [node1, setNode] = useState(null);
|
|
369
|
+
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;
|
|
370
|
+
const [, force] = useState({});
|
|
371
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setNode(node)
|
|
372
|
+
);
|
|
373
|
+
const layers = Array.from(context.layers);
|
|
374
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [
|
|
375
|
+
...context.layersWithOutsidePointerEventsDisabled
|
|
376
|
+
].slice(-1); // prettier-ignore
|
|
377
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore
|
|
378
|
+
const index = node1 ? layers.indexOf(node1) : -1;
|
|
379
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
380
|
+
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
381
|
+
const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event)=>{
|
|
382
|
+
const target = event.target;
|
|
383
|
+
const isPointerDownOnBranch = [
|
|
384
|
+
...context.branches
|
|
385
|
+
].some((branch)=>branch.contains(target)
|
|
386
|
+
);
|
|
387
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
388
|
+
onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
|
|
389
|
+
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
|
|
390
|
+
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
391
|
+
}, ownerDocument);
|
|
392
|
+
const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event)=>{
|
|
393
|
+
const target = event.target;
|
|
394
|
+
const isFocusInBranch = [
|
|
395
|
+
...context.branches
|
|
396
|
+
].some((branch)=>branch.contains(target)
|
|
397
|
+
);
|
|
398
|
+
if (isFocusInBranch) return;
|
|
399
|
+
onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
|
|
400
|
+
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
|
|
401
|
+
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
402
|
+
}, ownerDocument);
|
|
403
|
+
$addc16e1bbe58fd0$export$3a72a57244d6e765((event)=>{
|
|
404
|
+
const isHighestLayer = index === context.layers.size - 1;
|
|
405
|
+
if (!isHighestLayer) return;
|
|
406
|
+
onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
|
|
407
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
408
|
+
event.preventDefault();
|
|
409
|
+
onDismiss();
|
|
410
|
+
}
|
|
411
|
+
}, ownerDocument);
|
|
412
|
+
useEffect(()=>{
|
|
413
|
+
if (!node1) return;
|
|
414
|
+
if (disableOutsidePointerEvents) {
|
|
415
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
416
|
+
$5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
417
|
+
ownerDocument.body.style.pointerEvents = 'none';
|
|
418
|
+
}
|
|
419
|
+
context.layersWithOutsidePointerEventsDisabled.add(node1);
|
|
420
|
+
}
|
|
421
|
+
context.layers.add(node1);
|
|
422
|
+
$5cb92bef7577960e$var$dispatchUpdate();
|
|
423
|
+
return ()=>{
|
|
424
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
425
|
+
};
|
|
426
|
+
}, [
|
|
427
|
+
node1,
|
|
428
|
+
ownerDocument,
|
|
429
|
+
disableOutsidePointerEvents,
|
|
430
|
+
context
|
|
431
|
+
]);
|
|
432
|
+
/**
|
|
433
|
+
* We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect
|
|
434
|
+
* because a change to `disableOutsidePointerEvents` would remove this layer from the stack
|
|
435
|
+
* and add it to the end again so the layering order wouldn't be _creation order_.
|
|
436
|
+
* We only want them to be removed from context stacks when unmounted.
|
|
437
|
+
*/ useEffect(()=>{
|
|
438
|
+
return ()=>{
|
|
439
|
+
if (!node1) return;
|
|
440
|
+
context.layers.delete(node1);
|
|
441
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node1);
|
|
442
|
+
$5cb92bef7577960e$var$dispatchUpdate();
|
|
443
|
+
};
|
|
444
|
+
}, [
|
|
445
|
+
node1,
|
|
446
|
+
context
|
|
447
|
+
]);
|
|
448
|
+
useEffect(()=>{
|
|
449
|
+
const handleUpdate = ()=>force({})
|
|
450
|
+
;
|
|
451
|
+
document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
|
|
452
|
+
return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)
|
|
453
|
+
;
|
|
454
|
+
}, []);
|
|
455
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.div, _extends({}, layerProps, {
|
|
456
|
+
ref: composedRefs,
|
|
457
|
+
style: {
|
|
458
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,
|
|
459
|
+
...props.style
|
|
460
|
+
},
|
|
461
|
+
onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
462
|
+
onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
463
|
+
onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
|
|
464
|
+
}));
|
|
465
|
+
});
|
|
466
|
+
/* -----------------------------------------------------------------------------------------------*/ /**
|
|
467
|
+
* Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`
|
|
468
|
+
* to mimic layer dismissing behaviour present in OS.
|
|
469
|
+
* Returns props to pass to the node we want to check for outside events.
|
|
470
|
+
*/ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
471
|
+
const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onPointerDownOutside);
|
|
472
|
+
const isPointerInsideReactTreeRef = useRef(false);
|
|
473
|
+
const handleClickRef = useRef(()=>{});
|
|
474
|
+
useEffect(()=>{
|
|
475
|
+
const handlePointerDown = (event)=>{
|
|
476
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
477
|
+
const eventDetail = {
|
|
478
|
+
originalEvent: event
|
|
479
|
+
};
|
|
480
|
+
function handleAndDispatchPointerDownOutsideEvent() {
|
|
481
|
+
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
|
|
482
|
+
discrete: true
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* On touch devices, we need to wait for a click event because browsers implement
|
|
487
|
+
* a ~350ms delay between the time the user stops touching the display and when the
|
|
488
|
+
* browser executres events. We need to ensure we don't reactivate pointer-events within
|
|
489
|
+
* this timeframe otherwise the browser may execute events that should have been prevented.
|
|
490
|
+
*
|
|
491
|
+
* Additionally, this also lets us deal automatically with cancellations when a click event
|
|
492
|
+
* isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.
|
|
493
|
+
*
|
|
494
|
+
* This is why we also continuously remove the previous listener, because we cannot be
|
|
495
|
+
* certain that it was raised, and therefore cleaned-up.
|
|
496
|
+
*/ if (event.pointerType === 'touch') {
|
|
497
|
+
ownerDocument.removeEventListener('click', handleClickRef.current);
|
|
498
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
|
|
499
|
+
ownerDocument.addEventListener('click', handleClickRef.current, {
|
|
500
|
+
once: true
|
|
501
|
+
});
|
|
502
|
+
} else handleAndDispatchPointerDownOutsideEvent();
|
|
503
|
+
}
|
|
504
|
+
isPointerInsideReactTreeRef.current = false;
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* if this hook executes in a component that mounts via a `pointerdown` event, the event
|
|
508
|
+
* would bubble up to the document and trigger a `pointerDownOutside` event. We avoid
|
|
509
|
+
* this by delaying the event listener registration on the document.
|
|
510
|
+
* This is not React specific, but rather how the DOM works, ie:
|
|
511
|
+
* ```
|
|
512
|
+
* button.addEventListener('pointerdown', () => {
|
|
513
|
+
* console.log('I will log');
|
|
514
|
+
* document.addEventListener('pointerdown', () => {
|
|
515
|
+
* console.log('I will also log');
|
|
516
|
+
* })
|
|
517
|
+
* });
|
|
518
|
+
*/ const timerId = window.setTimeout(()=>{
|
|
519
|
+
ownerDocument.addEventListener('pointerdown', handlePointerDown);
|
|
520
|
+
}, 0);
|
|
521
|
+
return ()=>{
|
|
522
|
+
window.clearTimeout(timerId);
|
|
523
|
+
ownerDocument.removeEventListener('pointerdown', handlePointerDown);
|
|
524
|
+
ownerDocument.removeEventListener('click', handleClickRef.current);
|
|
525
|
+
};
|
|
526
|
+
}, [
|
|
527
|
+
ownerDocument,
|
|
528
|
+
handlePointerDownOutside
|
|
529
|
+
]);
|
|
530
|
+
return {
|
|
531
|
+
// ensures we check React component tree (not just DOM tree)
|
|
532
|
+
onPointerDownCapture: ()=>isPointerInsideReactTreeRef.current = true
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Listens for when focus happens outside a react subtree.
|
|
537
|
+
* Returns props to pass to the root (node) of the subtree we want to check.
|
|
538
|
+
*/ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
539
|
+
const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onFocusOutside);
|
|
540
|
+
const isFocusInsideReactTreeRef = useRef(false);
|
|
541
|
+
useEffect(()=>{
|
|
542
|
+
const handleFocus = (event)=>{
|
|
543
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
544
|
+
const eventDetail = {
|
|
545
|
+
originalEvent: event
|
|
546
|
+
};
|
|
547
|
+
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
548
|
+
discrete: false
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
ownerDocument.addEventListener('focusin', handleFocus);
|
|
553
|
+
return ()=>ownerDocument.removeEventListener('focusin', handleFocus)
|
|
554
|
+
;
|
|
555
|
+
}, [
|
|
556
|
+
ownerDocument,
|
|
557
|
+
handleFocusOutside
|
|
558
|
+
]);
|
|
559
|
+
return {
|
|
560
|
+
onFocusCapture: ()=>isFocusInsideReactTreeRef.current = true
|
|
561
|
+
,
|
|
562
|
+
onBlurCapture: ()=>isFocusInsideReactTreeRef.current = false
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
function $5cb92bef7577960e$var$dispatchUpdate() {
|
|
566
|
+
const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);
|
|
567
|
+
document.dispatchEvent(event);
|
|
568
|
+
}
|
|
569
|
+
function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete: discrete }) {
|
|
570
|
+
const target = detail.originalEvent.target;
|
|
571
|
+
const event = new CustomEvent(name, {
|
|
572
|
+
bubbles: false,
|
|
573
|
+
cancelable: true,
|
|
574
|
+
detail: detail
|
|
575
|
+
});
|
|
576
|
+
if (handler) target.addEventListener(name, handler, {
|
|
577
|
+
once: true
|
|
578
|
+
});
|
|
579
|
+
if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
|
|
580
|
+
else target.dispatchEvent(event);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;
|
|
584
|
+
/**
|
|
585
|
+
* Injects a pair of focus guards at the edges of the whole DOM tree
|
|
586
|
+
* to ensure `focusin` & `focusout` events can be caught consistently.
|
|
587
|
+
*/ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
|
|
588
|
+
useEffect(()=>{
|
|
589
|
+
var _edgeGuards$, _edgeGuards$2;
|
|
590
|
+
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
|
|
591
|
+
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
592
|
+
document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
593
|
+
$3db38b7d1fb3fe6a$var$count++;
|
|
594
|
+
return ()=>{
|
|
595
|
+
if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()
|
|
596
|
+
);
|
|
597
|
+
$3db38b7d1fb3fe6a$var$count--;
|
|
598
|
+
};
|
|
599
|
+
}, []);
|
|
600
|
+
}
|
|
601
|
+
function $3db38b7d1fb3fe6a$var$createFocusGuard() {
|
|
602
|
+
const element = document.createElement('span');
|
|
603
|
+
element.setAttribute('data-radix-focus-guard', '');
|
|
604
|
+
element.tabIndex = 0;
|
|
605
|
+
element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';
|
|
606
|
+
return element;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Set a given ref to a given value
|
|
611
|
+
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
612
|
+
*/ function $6ed0406888f73fc4$var$setRef(ref, value) {
|
|
613
|
+
if (typeof ref === 'function') ref(value);
|
|
614
|
+
else if (ref !== null && ref !== undefined) ref.current = value;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* A utility to compose multiple refs together
|
|
618
|
+
* Accepts callback refs and RefObject(s)
|
|
619
|
+
*/ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
|
|
620
|
+
return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)
|
|
621
|
+
)
|
|
622
|
+
;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* A custom hook that composes multiple refs
|
|
626
|
+
* Accepts callback refs and RefObject(s)
|
|
627
|
+
*/ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
|
|
628
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
629
|
+
return useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
const $8927f6f2acc4f386$var$NODES$1 = [
|
|
633
|
+
'a',
|
|
634
|
+
'button',
|
|
635
|
+
'div',
|
|
636
|
+
'h2',
|
|
637
|
+
'h3',
|
|
638
|
+
'img',
|
|
639
|
+
'label',
|
|
640
|
+
'li',
|
|
641
|
+
'nav',
|
|
642
|
+
'ol',
|
|
643
|
+
'p',
|
|
644
|
+
'span',
|
|
645
|
+
'svg',
|
|
646
|
+
'ul'
|
|
647
|
+
]; // Temporary while we await merge of this fix:
|
|
648
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
|
|
649
|
+
// prettier-ignore
|
|
650
|
+
/* -------------------------------------------------------------------------------------------------
|
|
651
|
+
* Primitive
|
|
652
|
+
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034$1 = $8927f6f2acc4f386$var$NODES$1.reduce((primitive, node)=>{
|
|
653
|
+
const Node = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
654
|
+
const { asChild: asChild , ...primitiveProps } = props;
|
|
655
|
+
const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
|
|
656
|
+
useEffect(()=>{
|
|
657
|
+
window[Symbol.for('radix-ui')] = true;
|
|
658
|
+
}, []);
|
|
659
|
+
return /*#__PURE__*/ createElement(Comp, _extends({}, primitiveProps, {
|
|
660
|
+
ref: forwardedRef
|
|
661
|
+
}));
|
|
662
|
+
});
|
|
663
|
+
Node.displayName = `Primitive.${node}`;
|
|
664
|
+
return {
|
|
665
|
+
...primitive,
|
|
666
|
+
[node]: Node
|
|
667
|
+
};
|
|
668
|
+
}, {});
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
672
|
+
* prop or avoid re-executing effects when passed as a dependency
|
|
673
|
+
*/ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
|
|
674
|
+
const callbackRef = useRef(callback);
|
|
675
|
+
useEffect(()=>{
|
|
676
|
+
callbackRef.current = callback;
|
|
677
|
+
}); // https://github.com/facebook/react/issues/19240
|
|
678
|
+
return useMemo(()=>(...args)=>{
|
|
679
|
+
var _callbackRef$current;
|
|
680
|
+
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
|
|
681
|
+
}
|
|
682
|
+
, []);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
|
|
686
|
+
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
|
|
687
|
+
const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
|
|
688
|
+
bubbles: false,
|
|
689
|
+
cancelable: true
|
|
690
|
+
};
|
|
691
|
+
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
692
|
+
const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
|
|
693
|
+
const [container1, setContainer] = useState(null);
|
|
694
|
+
const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
|
|
695
|
+
const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
|
|
696
|
+
const lastFocusedElementRef = useRef(null);
|
|
697
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
|
|
698
|
+
);
|
|
699
|
+
const focusScope = useRef({
|
|
700
|
+
paused: false,
|
|
701
|
+
pause () {
|
|
702
|
+
this.paused = true;
|
|
703
|
+
},
|
|
704
|
+
resume () {
|
|
705
|
+
this.paused = false;
|
|
706
|
+
}
|
|
707
|
+
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
|
|
708
|
+
useEffect(()=>{
|
|
709
|
+
if (trapped) {
|
|
710
|
+
function handleFocusIn(event) {
|
|
711
|
+
if (focusScope.paused || !container1) return;
|
|
712
|
+
const target = event.target;
|
|
713
|
+
if (container1.contains(target)) lastFocusedElementRef.current = target;
|
|
714
|
+
else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
715
|
+
select: true
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
function handleFocusOut(event) {
|
|
719
|
+
if (focusScope.paused || !container1) return;
|
|
720
|
+
if (!container1.contains(event.relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
|
|
721
|
+
select: true
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
document.addEventListener('focusin', handleFocusIn);
|
|
725
|
+
document.addEventListener('focusout', handleFocusOut);
|
|
726
|
+
return ()=>{
|
|
727
|
+
document.removeEventListener('focusin', handleFocusIn);
|
|
728
|
+
document.removeEventListener('focusout', handleFocusOut);
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
}, [
|
|
732
|
+
trapped,
|
|
733
|
+
container1,
|
|
734
|
+
focusScope.paused
|
|
735
|
+
]);
|
|
736
|
+
useEffect(()=>{
|
|
737
|
+
if (container1) {
|
|
738
|
+
$d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
|
|
739
|
+
const previouslyFocusedElement = document.activeElement;
|
|
740
|
+
const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
|
|
741
|
+
if (!hasFocusedCandidate) {
|
|
742
|
+
const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
743
|
+
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
744
|
+
container1.dispatchEvent(mountEvent);
|
|
745
|
+
if (!mountEvent.defaultPrevented) {
|
|
746
|
+
$d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
|
|
747
|
+
select: true
|
|
748
|
+
});
|
|
749
|
+
if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return ()=>{
|
|
753
|
+
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
|
|
754
|
+
// We need to delay the focus a little to get around it for now.
|
|
755
|
+
// See: https://github.com/facebook/react/issues/17894
|
|
756
|
+
setTimeout(()=>{
|
|
757
|
+
const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
|
|
758
|
+
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
759
|
+
container1.dispatchEvent(unmountEvent);
|
|
760
|
+
if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
|
|
761
|
+
select: true
|
|
762
|
+
});
|
|
763
|
+
// we need to remove the listener after we `dispatchEvent`
|
|
764
|
+
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
765
|
+
$d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
|
|
766
|
+
}, 0);
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
}, [
|
|
770
|
+
container1,
|
|
771
|
+
onMountAutoFocus,
|
|
772
|
+
onUnmountAutoFocus,
|
|
773
|
+
focusScope
|
|
774
|
+
]); // Takes care of looping focus (when tabbing whilst at the edges)
|
|
775
|
+
const handleKeyDown = useCallback((event)=>{
|
|
776
|
+
if (!loop && !trapped) return;
|
|
777
|
+
if (focusScope.paused) return;
|
|
778
|
+
const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
779
|
+
const focusedElement = document.activeElement;
|
|
780
|
+
if (isTabKey && focusedElement) {
|
|
781
|
+
const container = event.currentTarget;
|
|
782
|
+
const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
|
|
783
|
+
const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
|
|
784
|
+
if (!hasTabbableElementsInside) {
|
|
785
|
+
if (focusedElement === container) event.preventDefault();
|
|
786
|
+
} else {
|
|
787
|
+
if (!event.shiftKey && focusedElement === last) {
|
|
788
|
+
event.preventDefault();
|
|
789
|
+
if (loop) $d3863c46a17e8a28$var$focus(first, {
|
|
790
|
+
select: true
|
|
791
|
+
});
|
|
792
|
+
} else if (event.shiftKey && focusedElement === first) {
|
|
793
|
+
event.preventDefault();
|
|
794
|
+
if (loop) $d3863c46a17e8a28$var$focus(last, {
|
|
795
|
+
select: true
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}, [
|
|
801
|
+
loop,
|
|
802
|
+
trapped,
|
|
803
|
+
focusScope.paused
|
|
804
|
+
]);
|
|
805
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$1.div, _extends({
|
|
806
|
+
tabIndex: -1
|
|
807
|
+
}, scopeProps, {
|
|
808
|
+
ref: composedRefs,
|
|
809
|
+
onKeyDown: handleKeyDown
|
|
810
|
+
}));
|
|
811
|
+
});
|
|
812
|
+
/* -------------------------------------------------------------------------------------------------
|
|
813
|
+
* Utils
|
|
814
|
+
* -----------------------------------------------------------------------------------------------*/ /**
|
|
815
|
+
* Attempts focusing the first element in a list of candidates.
|
|
816
|
+
* Stops when focus has actually moved.
|
|
817
|
+
*/ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
|
|
818
|
+
const previouslyFocusedElement = document.activeElement;
|
|
819
|
+
for (const candidate of candidates){
|
|
820
|
+
$d3863c46a17e8a28$var$focus(candidate, {
|
|
821
|
+
select: select
|
|
822
|
+
});
|
|
823
|
+
if (document.activeElement !== previouslyFocusedElement) return;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Returns the first and last tabbable elements inside a container.
|
|
828
|
+
*/ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
|
|
829
|
+
const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
|
|
830
|
+
const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
|
|
831
|
+
const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
|
|
832
|
+
return [
|
|
833
|
+
first,
|
|
834
|
+
last
|
|
835
|
+
];
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Returns a list of potential tabbable candidates.
|
|
839
|
+
*
|
|
840
|
+
* NOTE: This is only a close approximation. For example it doesn't take into account cases like when
|
|
841
|
+
* elements are not visible. This cannot be worked out easily by just reading a property, but rather
|
|
842
|
+
* necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
|
|
843
|
+
*
|
|
844
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
|
|
845
|
+
* Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
|
|
846
|
+
*/ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
|
|
847
|
+
const nodes = [];
|
|
848
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
849
|
+
acceptNode: (node)=>{
|
|
850
|
+
const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
|
|
851
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
|
|
852
|
+
// runtime's understanding of tabbability, so this automatically accounts
|
|
853
|
+
// for any kind of element that could be tabbed to.
|
|
854
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
|
|
858
|
+
// hinders accessibility to have tab order different from visual order.
|
|
859
|
+
return nodes;
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Returns the first visible element in a list.
|
|
863
|
+
* NOTE: Only checks visibility up to the `container`.
|
|
864
|
+
*/ function $d3863c46a17e8a28$var$findVisible(elements, container) {
|
|
865
|
+
for (const element of elements){
|
|
866
|
+
// we stop checking if it's hidden at the `container` level (excluding)
|
|
867
|
+
if (!$d3863c46a17e8a28$var$isHidden(element, {
|
|
868
|
+
upTo: container
|
|
869
|
+
})) return element;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
|
|
873
|
+
if (getComputedStyle(node).visibility === 'hidden') return true;
|
|
874
|
+
while(node){
|
|
875
|
+
// we stop at `upTo` (excluding it)
|
|
876
|
+
if (upTo !== undefined && node === upTo) return false;
|
|
877
|
+
if (getComputedStyle(node).display === 'none') return true;
|
|
878
|
+
node = node.parentElement;
|
|
879
|
+
}
|
|
880
|
+
return false;
|
|
881
|
+
}
|
|
882
|
+
function $d3863c46a17e8a28$var$isSelectableInput(element) {
|
|
883
|
+
return element instanceof HTMLInputElement && 'select' in element;
|
|
884
|
+
}
|
|
885
|
+
function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
|
|
886
|
+
// only focus if that element is focusable
|
|
887
|
+
if (element && element.focus) {
|
|
888
|
+
const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
|
|
889
|
+
element.focus({
|
|
890
|
+
preventScroll: true
|
|
891
|
+
}); // only select if its not the same element, it supports selection and we need to select
|
|
892
|
+
if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
/* -------------------------------------------------------------------------------------------------
|
|
896
|
+
* FocusScope stack
|
|
897
|
+
* -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
|
|
898
|
+
function $d3863c46a17e8a28$var$createFocusScopesStack() {
|
|
899
|
+
/** A stack of focus scopes, with the active one at the top */ let stack = [];
|
|
900
|
+
return {
|
|
901
|
+
add (focusScope) {
|
|
902
|
+
// pause the currently active focus scope (at the top of the stack)
|
|
903
|
+
const activeFocusScope = stack[0];
|
|
904
|
+
if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
|
|
905
|
+
// remove in case it already exists (because we'll re-add it at the top of the stack)
|
|
906
|
+
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
907
|
+
stack.unshift(focusScope);
|
|
908
|
+
},
|
|
909
|
+
remove (focusScope) {
|
|
910
|
+
var _stack$;
|
|
911
|
+
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
|
|
912
|
+
(_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function $d3863c46a17e8a28$var$arrayRemove(array, item) {
|
|
917
|
+
const updatedArray = [
|
|
918
|
+
...array
|
|
919
|
+
];
|
|
920
|
+
const index = updatedArray.indexOf(item);
|
|
921
|
+
if (index !== -1) updatedArray.splice(index, 1);
|
|
922
|
+
return updatedArray;
|
|
923
|
+
}
|
|
924
|
+
function $d3863c46a17e8a28$var$removeLinks(items) {
|
|
925
|
+
return items.filter((item)=>item.tagName !== 'A'
|
|
926
|
+
);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
const $1746a345f3d73bb7$var$useReactId = React$1['useId'.toString()] || (()=>undefined
|
|
930
|
+
);
|
|
931
|
+
let $1746a345f3d73bb7$var$count = 0;
|
|
932
|
+
function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
933
|
+
const [id, setId] = React$1.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only.
|
|
934
|
+
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
935
|
+
if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
|
|
936
|
+
);
|
|
937
|
+
}, [
|
|
938
|
+
deterministicId
|
|
939
|
+
]);
|
|
940
|
+
return deterministicId || (id ? `radix-${id}` : '');
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
944
|
+
var _globalThis$document;
|
|
945
|
+
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;
|
|
946
|
+
return container ? /*#__PURE__*/ $7SXl2$reactdom.createPortal(/*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.div, _extends({}, portalProps, {
|
|
947
|
+
ref: forwardedRef
|
|
948
|
+
})), container) : null;
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: defaultProp , onChange: onChange = ()=>{} }) {
|
|
952
|
+
const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
|
|
953
|
+
defaultProp: defaultProp,
|
|
954
|
+
onChange: onChange
|
|
955
|
+
});
|
|
956
|
+
const isControlled = prop !== undefined;
|
|
957
|
+
const value1 = isControlled ? prop : uncontrolledProp;
|
|
958
|
+
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onChange);
|
|
959
|
+
const setValue = useCallback((nextValue)=>{
|
|
960
|
+
if (isControlled) {
|
|
961
|
+
const setter = nextValue;
|
|
962
|
+
const value = typeof nextValue === 'function' ? setter(prop) : nextValue;
|
|
963
|
+
if (value !== prop) handleChange(value);
|
|
964
|
+
} else setUncontrolledProp(nextValue);
|
|
965
|
+
}, [
|
|
966
|
+
isControlled,
|
|
967
|
+
prop,
|
|
968
|
+
setUncontrolledProp,
|
|
969
|
+
handleChange
|
|
970
|
+
]);
|
|
971
|
+
return [
|
|
972
|
+
value1,
|
|
973
|
+
setValue
|
|
974
|
+
];
|
|
975
|
+
}
|
|
976
|
+
function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp , onChange: onChange }) {
|
|
977
|
+
const uncontrolledState = useState(defaultProp);
|
|
978
|
+
const [value] = uncontrolledState;
|
|
979
|
+
const prevValueRef = useRef(value);
|
|
980
|
+
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onChange);
|
|
981
|
+
useEffect(()=>{
|
|
982
|
+
if (prevValueRef.current !== value) {
|
|
983
|
+
handleChange(value);
|
|
984
|
+
prevValueRef.current = value;
|
|
985
|
+
}
|
|
986
|
+
}, [
|
|
987
|
+
value,
|
|
988
|
+
prevValueRef,
|
|
989
|
+
handleChange
|
|
990
|
+
]);
|
|
991
|
+
return uncontrolledState;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
const $8927f6f2acc4f386$var$NODES = [
|
|
995
|
+
'a',
|
|
996
|
+
'button',
|
|
997
|
+
'div',
|
|
998
|
+
'h2',
|
|
999
|
+
'h3',
|
|
1000
|
+
'img',
|
|
1001
|
+
'label',
|
|
1002
|
+
'li',
|
|
1003
|
+
'nav',
|
|
1004
|
+
'ol',
|
|
1005
|
+
'p',
|
|
1006
|
+
'span',
|
|
1007
|
+
'svg',
|
|
1008
|
+
'ul'
|
|
1009
|
+
]; // Temporary while we await merge of this fix:
|
|
1010
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
|
|
1011
|
+
// prettier-ignore
|
|
1012
|
+
/* -------------------------------------------------------------------------------------------------
|
|
1013
|
+
* Primitive
|
|
1014
|
+
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{
|
|
1015
|
+
const Node = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1016
|
+
const { asChild: asChild , ...primitiveProps } = props;
|
|
1017
|
+
const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
|
|
1018
|
+
useEffect(()=>{
|
|
1019
|
+
window[Symbol.for('radix-ui')] = true;
|
|
1020
|
+
}, []);
|
|
1021
|
+
return /*#__PURE__*/ createElement(Comp, _extends({}, primitiveProps, {
|
|
1022
|
+
ref: forwardedRef
|
|
1023
|
+
}));
|
|
1024
|
+
});
|
|
1025
|
+
Node.displayName = `Primitive.${node}`;
|
|
1026
|
+
return {
|
|
1027
|
+
...primitive,
|
|
1028
|
+
[node]: Node
|
|
1029
|
+
};
|
|
1030
|
+
}, {});
|
|
1031
|
+
|
|
116
1032
|
const $ea1ef594cf570d83$export$439d29a4e110a164 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
117
1033
|
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, props, {
|
|
118
1034
|
ref: forwardedRef,
|
|
@@ -232,7 +1148,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ forwardRef((props
|
|
|
232
1148
|
const { __scopeSelect: __scopeSelect , disabled: disabled = false , ...triggerProps } = props;
|
|
233
1149
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$TRIGGER_NAME, __scopeSelect);
|
|
234
1150
|
const isDisabled = context.disabled || disabled;
|
|
235
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onTriggerChange);
|
|
1151
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, context.onTriggerChange);
|
|
236
1152
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
237
1153
|
const [searchRef, handleTypeaheadSearch, resetTypeahead] = $cc7e05a45900e73f$var$useTypeaheadSearch((search)=>{
|
|
238
1154
|
const enabledItems = getItems().filter((item)=>!item.disabled
|
|
@@ -248,7 +1164,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ forwardRef((props
|
|
|
248
1164
|
resetTypeahead();
|
|
249
1165
|
}
|
|
250
1166
|
};
|
|
251
|
-
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
|
|
1167
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.button, _extends({
|
|
252
1168
|
type: "button",
|
|
253
1169
|
role: "combobox",
|
|
254
1170
|
"aria-controls": context.contentId,
|
|
@@ -308,14 +1224,14 @@ const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ forwardRef((prop
|
|
|
308
1224
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$VALUE_NAME, __scopeSelect);
|
|
309
1225
|
const { onValueNodeHasChildrenChange: onValueNodeHasChildrenChange } = context;
|
|
310
1226
|
const hasChildren = children !== undefined;
|
|
311
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onValueNodeChange);
|
|
1227
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, context.onValueNodeChange);
|
|
312
1228
|
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
313
1229
|
onValueNodeHasChildrenChange(hasChildren);
|
|
314
1230
|
}, [
|
|
315
1231
|
onValueNodeHasChildrenChange,
|
|
316
1232
|
hasChildren
|
|
317
1233
|
]);
|
|
318
|
-
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, valueProps, {
|
|
1234
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.span, _extends({}, valueProps, {
|
|
319
1235
|
ref: composedRefs // we don't want events from the portalled `SelectValue` children to bubble
|
|
320
1236
|
,
|
|
321
1237
|
style: {
|
|
@@ -325,7 +1241,7 @@ const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ forwardRef((prop
|
|
|
325
1241
|
});
|
|
326
1242
|
const $cc7e05a45900e73f$export$99b400cabb58c515 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
327
1243
|
const { __scopeSelect: __scopeSelect , children: children , ...iconProps } = props;
|
|
328
|
-
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
|
|
1244
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.span, _extends({
|
|
329
1245
|
"aria-hidden": true
|
|
330
1246
|
}, iconProps, {
|
|
331
1247
|
ref: forwardedRef
|
|
@@ -361,7 +1277,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
361
1277
|
const [contentWrapper, setContentWrapper] = useState(null);
|
|
362
1278
|
const [content, setContent] = useState(null);
|
|
363
1279
|
const [viewport, setViewport] = useState(null);
|
|
364
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
|
|
1280
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setContent(node)
|
|
365
1281
|
);
|
|
366
1282
|
const [selectedItem, setSelectedItem] = useState(null);
|
|
367
1283
|
const [selectedItemText, setSelectedItemText] = useState(null);
|
|
@@ -721,7 +1637,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
721
1637
|
const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
722
1638
|
const { __scopeSelect: __scopeSelect , ...viewportProps } = props;
|
|
723
1639
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
724
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onViewportChange);
|
|
1640
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, contentContext.onViewportChange);
|
|
725
1641
|
const prevScrollTopRef = useRef(0);
|
|
726
1642
|
return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement("style", {
|
|
727
1643
|
dangerouslySetInnerHTML: {
|
|
@@ -729,7 +1645,7 @@ const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ forwardRef((prop
|
|
|
729
1645
|
}
|
|
730
1646
|
}), /*#__PURE__*/ createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
731
1647
|
scope: __scopeSelect
|
|
732
|
-
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
1648
|
+
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.div, _extends({
|
|
733
1649
|
"data-radix-select-viewport": "",
|
|
734
1650
|
role: "presentation"
|
|
735
1651
|
}, viewportProps, {
|
|
@@ -784,7 +1700,7 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ forwardRef((prop
|
|
|
784
1700
|
const isSelected = context.value === value;
|
|
785
1701
|
const [textValue, setTextValue] = useState(textValueProp !== null && textValueProp !== void 0 ? textValueProp : '');
|
|
786
1702
|
const [isFocused, setIsFocused] = useState(false);
|
|
787
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>{
|
|
1703
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>{
|
|
788
1704
|
var _contentContext$itemR;
|
|
789
1705
|
return (_contentContext$itemR = contentContext.itemRefCallback) === null || _contentContext$itemR === void 0 ? void 0 : _contentContext$itemR.call(contentContext, node, value, disabled);
|
|
790
1706
|
});
|
|
@@ -812,7 +1728,7 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ forwardRef((prop
|
|
|
812
1728
|
value: value,
|
|
813
1729
|
disabled: disabled,
|
|
814
1730
|
textValue: textValue
|
|
815
|
-
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
1731
|
+
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.div, _extends({
|
|
816
1732
|
role: "option",
|
|
817
1733
|
"aria-labelledby": textId,
|
|
818
1734
|
"data-highlighted": isFocused ? '' : undefined // `isFocused` caveat fixes stuttering in VoiceOver
|
|
@@ -865,7 +1781,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ forwardRef((prop
|
|
|
865
1781
|
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
866
1782
|
const nativeOptionsContext = $cc7e05a45900e73f$var$useSelectNativeOptionsContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
867
1783
|
const [itemTextNode, setItemTextNode] = useState(null);
|
|
868
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setItemTextNode(node)
|
|
1784
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setItemTextNode(node)
|
|
869
1785
|
, itemContext.onItemTextChange, (node)=>{
|
|
870
1786
|
var _contentContext$itemT;
|
|
871
1787
|
return (_contentContext$itemT = contentContext.itemTextRefCallback) === null || _contentContext$itemT === void 0 ? void 0 : _contentContext$itemT.call(contentContext, node, itemContext.value, itemContext.disabled);
|
|
@@ -891,7 +1807,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ forwardRef((prop
|
|
|
891
1807
|
onNativeOptionRemove,
|
|
892
1808
|
nativeOption
|
|
893
1809
|
]);
|
|
894
|
-
return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
|
|
1810
|
+
return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.span, _extends({
|
|
895
1811
|
id: itemContext.textId
|
|
896
1812
|
}, itemTextProps, {
|
|
897
1813
|
ref: composedRefs
|
|
@@ -903,7 +1819,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ forwardRef((prop
|
|
|
903
1819
|
const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
904
1820
|
const { __scopeSelect: __scopeSelect , ...itemIndicatorProps } = props;
|
|
905
1821
|
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_INDICATOR_NAME, __scopeSelect);
|
|
906
|
-
return itemContext.isSelected ? /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
|
|
1822
|
+
return itemContext.isSelected ? /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.span, _extends({
|
|
907
1823
|
"aria-hidden": true
|
|
908
1824
|
}, itemIndicatorProps, {
|
|
909
1825
|
ref: forwardedRef
|
|
@@ -915,7 +1831,7 @@ const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ forwardRef((prop
|
|
|
915
1831
|
const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
916
1832
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
917
1833
|
const [canScrollUp1, setCanScrollUp] = useState(false);
|
|
918
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onScrollButtonChange);
|
|
1834
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, contentContext.onScrollButtonChange);
|
|
919
1835
|
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
920
1836
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
921
1837
|
const viewport = contentContext.viewport;
|
|
@@ -946,7 +1862,7 @@ const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ forwardRef((prop
|
|
|
946
1862
|
const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
947
1863
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
948
1864
|
const [canScrollDown1, setCanScrollDown] = useState(false);
|
|
949
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onScrollButtonChange);
|
|
1865
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, contentContext.onScrollButtonChange);
|
|
950
1866
|
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
951
1867
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
952
1868
|
const viewport = contentContext.viewport;
|
|
@@ -1003,7 +1919,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ forwardRef((p
|
|
|
1003
1919
|
}, [
|
|
1004
1920
|
getItems
|
|
1005
1921
|
]);
|
|
1006
|
-
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
1922
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$2.div, _extends({
|
|
1007
1923
|
"aria-hidden": true
|
|
1008
1924
|
}, scrollIndicatorProps, {
|
|
1009
1925
|
ref: forwardedRef,
|
|
@@ -1024,7 +1940,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ forwardRef((p
|
|
|
1024
1940
|
/* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$BubbleSelect = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1025
1941
|
const { value: value , ...selectProps } = props;
|
|
1026
1942
|
const ref = useRef(null);
|
|
1027
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
1943
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, ref);
|
|
1028
1944
|
const prevValue = $010c2913dbd2fe3d$export$5cae361ad82dce8b(value); // Bubble value change to parents (e.g form change event)
|
|
1029
1945
|
useEffect(()=>{
|
|
1030
1946
|
const select = ref.current;
|
|
@@ -1062,7 +1978,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ forwardRef((p
|
|
|
1062
1978
|
});
|
|
1063
1979
|
$cc7e05a45900e73f$var$BubbleSelect.displayName = 'BubbleSelect';
|
|
1064
1980
|
function $cc7e05a45900e73f$var$useTypeaheadSearch(onSearchChange) {
|
|
1065
|
-
const handleSearchChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onSearchChange);
|
|
1981
|
+
const handleSearchChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onSearchChange);
|
|
1066
1982
|
const searchRef = useRef('');
|
|
1067
1983
|
const timerRef = useRef(0);
|
|
1068
1984
|
const handleTypeaheadSearch = useCallback((key)=>{
|
|
@@ -1162,7 +2078,7 @@ var BtIconChevronUp2Px_2 = BtIconChevronUp2Px;
|
|
|
1162
2078
|
|
|
1163
2079
|
/** Use `Select` to choose from a dropdown list of options. */
|
|
1164
2080
|
var Select = function (_a) {
|
|
1165
|
-
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;
|
|
2081
|
+
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 = __rest(_a, ["isRequired", "isDisabled", "placeholder", "label", "options", "onOpenChange", "isDefaultOpen", "defaultValue", "errorMessage", "labelSize", "helper", "name", "isFluid", "onBlur", "onChange", "disclosureTitle", "disclosureText", "onClickDisclosure"]);
|
|
1166
2082
|
var id = useId();
|
|
1167
2083
|
var arcRootElement = useContext(ArcRootElementContext);
|
|
1168
2084
|
var surface = useContext(Context).surface;
|
|
@@ -1177,11 +2093,11 @@ var Select = function (_a) {
|
|
|
1177
2093
|
};
|
|
1178
2094
|
return (React__default.createElement(FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional", isDisabled: isDisabled, disclosureText: disclosureText, disclosureTitle: disclosureTitle, onClickDisclosure: onClickDisclosure },
|
|
1179
2095
|
React__default.createElement($cc7e05a45900e73f$export$be92b6f5f03c0fe9, { name: name, required: isRequired, disabled: isDisabled, defaultOpen: isDefaultOpen, value: selectedValue, onOpenChange: onOpenChange, onValueChange: function (value) { return onValueChange(value); } },
|
|
1180
|
-
React__default.createElement($cc7e05a45900e73f$export$41fb9f06171c75f4, { id: id, name: name, onBlur: onBlur, className: classNames("arc-Select-trigger", {
|
|
2096
|
+
React__default.createElement($cc7e05a45900e73f$export$41fb9f06171c75f4, __assign({ id: id, name: name, onBlur: onBlur, className: classNames("arc-Select-trigger", {
|
|
1181
2097
|
"arc-Select-trigger--constrained": !isFluid,
|
|
1182
2098
|
"arc-Select-trigger--onDarkSurface": surface === "dark",
|
|
1183
2099
|
"arc-Select-trigger--invalid": errorMessage
|
|
1184
|
-
}) },
|
|
2100
|
+
}) }, filterDataAttrs(props)),
|
|
1185
2101
|
React__default.createElement($cc7e05a45900e73f$export$4c8d1a57a761ef94, { asChild: true, "aria-label": getSelectedValueName(selectedValue) }, !selectedValue ? (React__default.createElement("span", { "aria-hidden": true, className: "arc-Select-placeHolder" }, placeholder)) : (React__default.createElement("span", { className: "arc-Select-valueItem" }, getSelectedValueName(selectedValue)))),
|
|
1186
2102
|
React__default.createElement($cc7e05a45900e73f$export$f04a61298a47a40f, { className: "arc-Select-triggerIcon" },
|
|
1187
2103
|
React__default.createElement(Icon, { icon: BtIconChevronDown2Px_2, size: 20 }))),
|