@qualtrics/ui-react 2.85.2 → 2.85.4
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/CHANGELOG.md +17 -0
- package/dist/__node_modules/@radix-ui/primitive/dist/index.js +14 -3
- package/dist/__node_modules/@radix-ui/primitive/dist/internal/is-development.false.js +4 -0
- package/dist/__node_modules/@radix-ui/react-arrow/dist/index.js +7 -4
- package/dist/__node_modules/@radix-ui/react-collection/dist/index.js +58 -39
- package/dist/__node_modules/@radix-ui/react-compose-refs/dist/index.js +8 -1
- package/dist/__node_modules/@radix-ui/react-context/dist/index.js +35 -12
- package/dist/__node_modules/@radix-ui/react-direction/dist/index.js +10 -3
- package/dist/__node_modules/@radix-ui/react-dismissable-layer/dist/index.js +172 -41
- package/dist/__node_modules/@radix-ui/react-dropdown-menu/dist/index.js +58 -61
- package/dist/__node_modules/@radix-ui/react-focus-guards/dist/index.js +30 -6
- package/dist/__node_modules/@radix-ui/react-focus-scope/dist/index.js +33 -9
- package/dist/__node_modules/@radix-ui/react-id/dist/index.js +6 -0
- package/dist/__node_modules/@radix-ui/react-menu/dist/index.js +107 -79
- package/dist/__node_modules/@radix-ui/react-popper/dist/index.js +79 -38
- package/dist/__node_modules/@radix-ui/react-portal/dist/index.js +9 -6
- package/dist/__node_modules/@radix-ui/react-presence/dist/index.js +71 -12
- package/dist/__node_modules/@radix-ui/react-primitive/dist/index.js +6 -0
- package/dist/__node_modules/@radix-ui/react-roving-focus/dist/index.js +36 -12
- package/dist/__node_modules/@radix-ui/react-slot/dist/index.js +85 -54
- package/dist/__node_modules/@radix-ui/react-use-callback-ref/dist/index.js +6 -1
- package/dist/__node_modules/@radix-ui/react-use-controllable-state/dist/index.js +14 -4
- package/dist/__node_modules/@radix-ui/react-use-effect-event/dist/index.js +6 -1
- package/dist/__node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +37 -0
- package/dist/__node_modules/@radix-ui/react-use-layout-effect/dist/index.js +1 -1
- package/dist/__node_modules/@radix-ui/react-use-size/dist/index.js +6 -0
- package/dist/__shared/cjs/{index-e03dac36.js → index-08198ff4.js} +140 -136
- package/dist/__shared/cjs/{index-507024ee.js → index-e51bbd75.js} +3 -3
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
- package/dist/components/Checkbox/Checkbox2.js +3 -3
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/ConfigPane/ConfigPane.js +6 -2
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +1 -1
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/FilePicker/FilePicker2.js +3 -3
- package/dist/components/FormField/Caption.js +3 -3
- package/dist/components/FormField/FormField2.js +3 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/InputGroup/InputGroup2.js +3 -3
- package/dist/components/Label/Label2.js +3 -3
- package/dist/components/Link/Link2.js +3 -3
- package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Switch/Switch2.js +3 -3
- package/dist/components/Table/Table2.js +3 -3
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
- package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
- package/dist/design-tokens/less/typography.js +3 -3
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/index.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
- package/dist/next/Combobox/Combobox2.js +3 -3
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Form/FormFields/InputField.js +3 -3
- package/dist/next/Indicator/Indicator2.js +3 -3
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/next/Menu/Hooks/useFlyoutNode.js +48 -0
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuButton.js +4 -3
- package/dist/next/Menu/MenuItem.js +3 -2
- package/dist/next/Menu/MenuPane.js +17 -16
- package/dist/next/Menu/PaneChildren.js +15 -10
- package/dist/next/Menu/SubMenu.js +17 -16
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/Select/Select2.js +3 -3
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.js +1055 -519
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/icons/package.json +4 -4
- package/next/package.json +5 -5
- package/package.json +14 -14
- package/dist/__node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
**All notable changes to `@qualtrics/ui-react` will be documented in this file. This project adheres to <a href="https://semver.org/spec/v2.0.0.html" target="_blank">Semantic Versioning</a>. To be notified of new releases, subscribe to the `design-system-changelog@qualtrics.com` email group in [Odo](https://odo.corp.qualtrics.com/)**
|
|
2
2
|
|
|
3
|
+
## 2.85.4 - October 13, 2026
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- **next/Select, next/Menu**: Fix "Maximum update depth exceeded" error when opening a virtualized (25 or more items) `Select` or `Menu` under React strict mode.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 2.85.3 - October 07, 2026
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Update `@dnd-kit/core`, `@radix-ui/react-dropdown-menu`, `libphonenumber-js` and `react-virtuoso` to their latest compatible versions.
|
|
16
|
+
`libphonenumber-js` 1.12 updates phone number length data for some countries, which can change `PhoneNumberInput`'s `isValidLength`. See the [libphonenumber-js 1.12.43 changelog](https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/CHANGELOG.md#11243--752026).
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
3
20
|
## 2.85.2 - September 29, 2026
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
3
|
+
value,
|
|
4
|
+
configurable: true
|
|
5
|
+
});
|
|
6
|
+
|
|
1
7
|
// src/primitive.tsx
|
|
2
8
|
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
3
9
|
function composeEventHandlers(originalEventHandler, ourEventHandler) {
|
|
4
10
|
let _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
5
11
|
_ref$checkForDefaultP = _ref.checkForDefaultPrevented,
|
|
6
12
|
checkForDefaultPrevented = _ref$checkForDefaultP === void 0 ? true : _ref$checkForDefaultP;
|
|
7
|
-
return function handleEvent(event) {
|
|
13
|
+
return /* @__PURE__ */__name(function handleEvent(event) {
|
|
8
14
|
originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
|
|
9
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
15
|
+
if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) {
|
|
10
16
|
return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
|
|
11
17
|
}
|
|
12
|
-
};
|
|
18
|
+
}, "handleEvent");
|
|
13
19
|
}
|
|
20
|
+
__name(composeEventHandlers, "composeEventHandlers");
|
|
14
21
|
function getOwnerWindow(element) {
|
|
15
22
|
var _element$ownerDocumen, _element$ownerDocumen2;
|
|
16
23
|
if (!canUseDOM) {
|
|
@@ -18,6 +25,7 @@ function getOwnerWindow(element) {
|
|
|
18
25
|
}
|
|
19
26
|
return (_element$ownerDocumen = element === null || element === void 0 || (_element$ownerDocumen2 = element.ownerDocument) === null || _element$ownerDocumen2 === void 0 ? void 0 : _element$ownerDocumen2.defaultView) !== null && _element$ownerDocumen !== void 0 ? _element$ownerDocumen : window;
|
|
20
27
|
}
|
|
28
|
+
__name(getOwnerWindow, "getOwnerWindow");
|
|
21
29
|
function getOwnerDocument(element) {
|
|
22
30
|
var _element$ownerDocumen3;
|
|
23
31
|
if (!canUseDOM) {
|
|
@@ -25,6 +33,7 @@ function getOwnerDocument(element) {
|
|
|
25
33
|
}
|
|
26
34
|
return (_element$ownerDocumen3 = element === null || element === void 0 ? void 0 : element.ownerDocument) !== null && _element$ownerDocumen3 !== void 0 ? _element$ownerDocumen3 : document;
|
|
27
35
|
}
|
|
36
|
+
__name(getOwnerDocument, "getOwnerDocument");
|
|
28
37
|
function getActiveElement(node) {
|
|
29
38
|
let activeDescendant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
30
39
|
const _getOwnerDocument = getOwnerDocument(node),
|
|
@@ -46,8 +55,10 @@ function getActiveElement(node) {
|
|
|
46
55
|
}
|
|
47
56
|
return activeElement;
|
|
48
57
|
}
|
|
58
|
+
__name(getActiveElement, "getActiveElement");
|
|
49
59
|
function isFrame(element) {
|
|
50
60
|
return element.tagName === "IFRAME";
|
|
51
61
|
}
|
|
62
|
+
__name(isFrame, "isFrame");
|
|
52
63
|
|
|
53
64
|
export { canUseDOM, composeEventHandlers, getActiveElement, getOwnerDocument, getOwnerWindow, isFrame };
|
|
@@ -3,8 +3,12 @@ import * as React from 'react';
|
|
|
3
3
|
import { Primitive } from '../../react-primitive/dist/index.js';
|
|
4
4
|
|
|
5
5
|
const _excluded = ["children", "width", "height"];
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
8
|
+
value,
|
|
9
|
+
configurable: true
|
|
10
|
+
});
|
|
11
|
+
var Arrow = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function Arrow2(props, forwardedRef) {
|
|
8
12
|
const children = props.children,
|
|
9
13
|
_props$width = props.width,
|
|
10
14
|
width = _props$width === void 0 ? 10 : _props$width,
|
|
@@ -22,8 +26,7 @@ var Arrow = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
22
26
|
points: "0,0 30,0 15,10"
|
|
23
27
|
})
|
|
24
28
|
});
|
|
25
|
-
});
|
|
26
|
-
Arrow.displayName = NAME;
|
|
29
|
+
}, "Arrow"));
|
|
27
30
|
var Root = Arrow;
|
|
28
31
|
|
|
29
32
|
export { Arrow, Root };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
2
2
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
3
|
-
import
|
|
3
|
+
import * as React from 'react';
|
|
4
4
|
import { createContextScope } from '../../react-context/dist/index.js';
|
|
5
5
|
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
6
6
|
import { createSlot } from '../../react-slot/dist/index.js';
|
|
7
7
|
|
|
8
8
|
"use client";
|
|
9
|
-
var _keys;
|
|
9
|
+
var _OrderedDict2, _keys;
|
|
10
10
|
const _excluded = ["scope", "children"],
|
|
11
11
|
_excluded2 = ["state"],
|
|
12
12
|
_excluded3 = ["scope", "children"];
|
|
@@ -15,6 +15,12 @@ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("C
|
|
|
15
15
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
16
16
|
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
17
17
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
18
|
+
var __defProp = Object.defineProperty;
|
|
19
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
20
|
+
value,
|
|
21
|
+
configurable: true
|
|
22
|
+
});
|
|
23
|
+
// @__NO_SIDE_EFFECTS__
|
|
18
24
|
function createCollection(name) {
|
|
19
25
|
const PROVIDER_NAME = name + "CollectionProvider";
|
|
20
26
|
const _createContextScope = createContextScope(PROVIDER_NAME),
|
|
@@ -30,27 +36,27 @@ function createCollection(name) {
|
|
|
30
36
|
_createCollectionCont2 = _slicedToArray(_createCollectionCont, 2),
|
|
31
37
|
CollectionProviderImpl = _createCollectionCont2[0],
|
|
32
38
|
useCollectionContext = _createCollectionCont2[1];
|
|
33
|
-
const CollectionProvider = props => {
|
|
39
|
+
const CollectionProvider = /* @__PURE__ */__name(props => {
|
|
34
40
|
const scope = props.scope,
|
|
35
41
|
children = props.children;
|
|
36
|
-
const ref =
|
|
37
|
-
const itemMap =
|
|
38
|
-
return /* @__PURE__ */
|
|
42
|
+
const ref = React.useRef(null);
|
|
43
|
+
const itemMap = React.useRef(/* @__PURE__ */new Map()).current;
|
|
44
|
+
return /* @__PURE__ */React.createElement(CollectionProviderImpl, {
|
|
39
45
|
scope,
|
|
40
46
|
itemMap,
|
|
41
47
|
collectionRef: ref,
|
|
42
48
|
children
|
|
43
49
|
});
|
|
44
|
-
};
|
|
50
|
+
}, "CollectionProvider");
|
|
45
51
|
CollectionProvider.displayName = PROVIDER_NAME;
|
|
46
52
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
47
53
|
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
48
|
-
const CollectionSlot = /*#__PURE__*/
|
|
54
|
+
const CollectionSlot = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
49
55
|
const scope = props.scope,
|
|
50
56
|
children = props.children;
|
|
51
57
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
52
58
|
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
53
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */React.createElement(CollectionSlotImpl, {
|
|
54
60
|
ref: composedRefs,
|
|
55
61
|
children
|
|
56
62
|
});
|
|
@@ -59,21 +65,21 @@ function createCollection(name) {
|
|
|
59
65
|
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
60
66
|
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
61
67
|
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
|
62
|
-
const CollectionItemSlot = /*#__PURE__*/
|
|
68
|
+
const CollectionItemSlot = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
63
69
|
const scope = props.scope,
|
|
64
70
|
children = props.children,
|
|
65
71
|
itemData = _objectWithoutProperties(props, _excluded);
|
|
66
|
-
const ref =
|
|
72
|
+
const ref = React.useRef(null);
|
|
67
73
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
68
74
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
69
|
-
|
|
75
|
+
React.useEffect(() => {
|
|
70
76
|
context.itemMap.set(ref, {
|
|
71
77
|
ref,
|
|
72
78
|
...itemData
|
|
73
79
|
});
|
|
74
80
|
return () => void context.itemMap.delete(ref);
|
|
75
81
|
});
|
|
76
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */React.createElement(CollectionItemSlotImpl, {
|
|
77
83
|
...{
|
|
78
84
|
[ITEM_DATA_ATTR]: ""
|
|
79
85
|
},
|
|
@@ -84,7 +90,7 @@ function createCollection(name) {
|
|
|
84
90
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
85
91
|
function useCollection(scope) {
|
|
86
92
|
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
87
|
-
const getItems =
|
|
93
|
+
const getItems = React.useCallback(() => {
|
|
88
94
|
const collectionNode = context.collectionRef.current;
|
|
89
95
|
if (!collectionNode) return [];
|
|
90
96
|
const orderedNodes = Array.from(collectionNode.querySelectorAll("[".concat(ITEM_DATA_ATTR, "]")));
|
|
@@ -94,16 +100,18 @@ function createCollection(name) {
|
|
|
94
100
|
}, [context.collectionRef, context.itemMap]);
|
|
95
101
|
return getItems;
|
|
96
102
|
}
|
|
103
|
+
__name(useCollection, "useCollection");
|
|
97
104
|
return [{
|
|
98
105
|
Provider: CollectionProvider,
|
|
99
106
|
Slot: CollectionSlot,
|
|
100
107
|
ItemSlot: CollectionItemSlot
|
|
101
108
|
}, useCollection, createCollectionScope];
|
|
102
109
|
}
|
|
110
|
+
__name(createCollection, "createCollection");
|
|
103
111
|
|
|
104
112
|
// src/ordered-dictionary.ts
|
|
105
113
|
var __instanciated = /* @__PURE__ */new WeakMap();
|
|
106
|
-
var OrderedDict = (_keys = /*#__PURE__*/new WeakMap(), class _OrderedDict extends Map {
|
|
114
|
+
var OrderedDict = (_keys = /*#__PURE__*/new WeakMap(), _OrderedDict2 = class _OrderedDict extends Map {
|
|
107
115
|
constructor(entries) {
|
|
108
116
|
super(entries);
|
|
109
117
|
_classPrivateFieldInitSpec(this, _keys, void 0);
|
|
@@ -396,7 +404,7 @@ var OrderedDict = (_keys = /*#__PURE__*/new WeakMap(), class _OrderedDict extend
|
|
|
396
404
|
}
|
|
397
405
|
return false;
|
|
398
406
|
}
|
|
399
|
-
});
|
|
407
|
+
}, __name(_OrderedDict2, "OrderedDict"), _OrderedDict2);
|
|
400
408
|
function at(array, index) {
|
|
401
409
|
if ("at" in Array.prototype) {
|
|
402
410
|
return Array.prototype.at.call(array, index);
|
|
@@ -404,18 +412,22 @@ function at(array, index) {
|
|
|
404
412
|
const actualIndex = toSafeIndex(array, index);
|
|
405
413
|
return actualIndex === -1 ? void 0 : array[actualIndex];
|
|
406
414
|
}
|
|
415
|
+
__name(at, "at");
|
|
407
416
|
function toSafeIndex(array, index) {
|
|
408
417
|
const length = array.length;
|
|
409
418
|
const relativeIndex = toSafeInteger(index);
|
|
410
419
|
const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
|
|
411
420
|
return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;
|
|
412
421
|
}
|
|
422
|
+
__name(toSafeIndex, "toSafeIndex");
|
|
413
423
|
function toSafeInteger(number) {
|
|
414
424
|
return number !== number || number === 0 ? 0 : Math.trunc(number);
|
|
415
425
|
}
|
|
426
|
+
__name(toSafeInteger, "toSafeInteger");
|
|
416
427
|
|
|
417
428
|
// src/collection.tsx
|
|
418
429
|
|
|
430
|
+
// @__NO_SIDE_EFFECTS__
|
|
419
431
|
function createCollection2(name) {
|
|
420
432
|
const PROVIDER_NAME = name + "CollectionProvider";
|
|
421
433
|
const _createContextScope3 = createContextScope(PROVIDER_NAME),
|
|
@@ -431,36 +443,36 @@ function createCollection2(name) {
|
|
|
431
443
|
current: null
|
|
432
444
|
},
|
|
433
445
|
itemMap: new OrderedDict(),
|
|
434
|
-
setItemMap: () => void 0
|
|
446
|
+
setItemMap: /* @__PURE__ */__name(() => void 0, "setItemMap")
|
|
435
447
|
}),
|
|
436
448
|
_createCollectionCont4 = _slicedToArray(_createCollectionCont3, 2),
|
|
437
449
|
CollectionContextProvider = _createCollectionCont4[0],
|
|
438
450
|
useCollectionContext = _createCollectionCont4[1];
|
|
439
|
-
const CollectionProvider = _ref => {
|
|
451
|
+
const CollectionProvider = /* @__PURE__ */__name(_ref => {
|
|
440
452
|
let state = _ref.state,
|
|
441
453
|
props = _objectWithoutProperties(_ref, _excluded2);
|
|
442
|
-
return state ? /* @__PURE__ */
|
|
454
|
+
return state ? /* @__PURE__ */React.createElement(CollectionProviderImpl, {
|
|
443
455
|
...props,
|
|
444
456
|
state
|
|
445
|
-
}) : /* @__PURE__ */
|
|
457
|
+
}) : /* @__PURE__ */React.createElement(CollectionInit, {
|
|
446
458
|
...props
|
|
447
459
|
});
|
|
448
|
-
};
|
|
460
|
+
}, "CollectionProvider");
|
|
449
461
|
CollectionProvider.displayName = PROVIDER_NAME;
|
|
450
|
-
const CollectionInit = props => {
|
|
462
|
+
const CollectionInit = /* @__PURE__ */__name(props => {
|
|
451
463
|
const state = useInitCollection();
|
|
452
|
-
return /* @__PURE__ */
|
|
464
|
+
return /* @__PURE__ */React.createElement(CollectionProviderImpl, {
|
|
453
465
|
...props,
|
|
454
466
|
state
|
|
455
467
|
});
|
|
456
|
-
};
|
|
468
|
+
}, "CollectionInit");
|
|
457
469
|
CollectionInit.displayName = PROVIDER_NAME + "Init";
|
|
458
|
-
const CollectionProviderImpl = props => {
|
|
470
|
+
const CollectionProviderImpl = /* @__PURE__ */__name(props => {
|
|
459
471
|
const scope = props.scope,
|
|
460
472
|
children = props.children,
|
|
461
473
|
state = props.state;
|
|
462
|
-
const ref =
|
|
463
|
-
const _React2$useState =
|
|
474
|
+
const ref = React.useRef(null);
|
|
475
|
+
const _React2$useState = React.useState(null),
|
|
464
476
|
_React2$useState2 = _slicedToArray(_React2$useState, 2),
|
|
465
477
|
collectionElement = _React2$useState2[0],
|
|
466
478
|
setCollectionElement = _React2$useState2[1];
|
|
@@ -468,7 +480,7 @@ function createCollection2(name) {
|
|
|
468
480
|
const _state = _slicedToArray(state, 2),
|
|
469
481
|
itemMap = _state[0],
|
|
470
482
|
setItemMap = _state[1];
|
|
471
|
-
|
|
483
|
+
React.useEffect(() => {
|
|
472
484
|
if (!collectionElement) return;
|
|
473
485
|
const observer = getChildListObserver(() => {});
|
|
474
486
|
observer.observe(collectionElement, {
|
|
@@ -479,7 +491,7 @@ function createCollection2(name) {
|
|
|
479
491
|
observer.disconnect();
|
|
480
492
|
};
|
|
481
493
|
}, [collectionElement]);
|
|
482
|
-
return /* @__PURE__ */
|
|
494
|
+
return /* @__PURE__ */React.createElement(CollectionContextProvider, {
|
|
483
495
|
scope,
|
|
484
496
|
itemMap,
|
|
485
497
|
setItemMap,
|
|
@@ -488,16 +500,16 @@ function createCollection2(name) {
|
|
|
488
500
|
collectionElement,
|
|
489
501
|
children
|
|
490
502
|
});
|
|
491
|
-
};
|
|
503
|
+
}, "CollectionProviderImpl");
|
|
492
504
|
CollectionProviderImpl.displayName = PROVIDER_NAME + "Impl";
|
|
493
505
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
494
506
|
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
495
|
-
const CollectionSlot = /*#__PURE__*/
|
|
507
|
+
const CollectionSlot = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
496
508
|
const scope = props.scope,
|
|
497
509
|
children = props.children;
|
|
498
510
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
499
511
|
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
500
|
-
return /* @__PURE__ */
|
|
512
|
+
return /* @__PURE__ */React.createElement(CollectionSlotImpl, {
|
|
501
513
|
ref: composedRefs,
|
|
502
514
|
children
|
|
503
515
|
});
|
|
@@ -506,24 +518,24 @@ function createCollection2(name) {
|
|
|
506
518
|
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
507
519
|
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
508
520
|
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
|
509
|
-
const CollectionItemSlot = /*#__PURE__*/
|
|
521
|
+
const CollectionItemSlot = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
510
522
|
const scope = props.scope,
|
|
511
523
|
children = props.children,
|
|
512
524
|
itemData = _objectWithoutProperties(props, _excluded3);
|
|
513
|
-
const ref =
|
|
514
|
-
const _React2$useState3 =
|
|
525
|
+
const ref = React.useRef(null);
|
|
526
|
+
const _React2$useState3 = React.useState(null),
|
|
515
527
|
_React2$useState4 = _slicedToArray(_React2$useState3, 2),
|
|
516
528
|
element = _React2$useState4[0],
|
|
517
529
|
setElement = _React2$useState4[1];
|
|
518
530
|
const composedRefs = useComposedRefs(forwardedRef, ref, setElement);
|
|
519
531
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
520
532
|
const setItemMap = context.setItemMap;
|
|
521
|
-
const itemDataRef =
|
|
533
|
+
const itemDataRef = React.useRef(itemData);
|
|
522
534
|
if (!shallowEqual(itemDataRef.current, itemData)) {
|
|
523
535
|
itemDataRef.current = itemData;
|
|
524
536
|
}
|
|
525
537
|
const memoizedItemData = itemDataRef.current;
|
|
526
|
-
|
|
538
|
+
React.useEffect(() => {
|
|
527
539
|
const itemData2 = memoizedItemData;
|
|
528
540
|
setItemMap(map => {
|
|
529
541
|
if (!element) {
|
|
@@ -551,7 +563,7 @@ function createCollection2(name) {
|
|
|
551
563
|
});
|
|
552
564
|
};
|
|
553
565
|
}, [element, memoizedItemData, setItemMap]);
|
|
554
|
-
return /* @__PURE__ */
|
|
566
|
+
return /* @__PURE__ */React.createElement(CollectionItemSlotImpl, {
|
|
555
567
|
...{
|
|
556
568
|
[ITEM_DATA_ATTR]: ""
|
|
557
569
|
},
|
|
@@ -561,13 +573,15 @@ function createCollection2(name) {
|
|
|
561
573
|
});
|
|
562
574
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
563
575
|
function useInitCollection() {
|
|
564
|
-
return
|
|
576
|
+
return React.useState(new OrderedDict());
|
|
565
577
|
}
|
|
578
|
+
__name(useInitCollection, "useInitCollection");
|
|
566
579
|
function useCollection(scope) {
|
|
567
580
|
const _useCollectionContext = useCollectionContext(name + "CollectionConsumer", scope),
|
|
568
581
|
itemMap = _useCollectionContext.itemMap;
|
|
569
582
|
return itemMap;
|
|
570
583
|
}
|
|
584
|
+
__name(useCollection, "useCollection");
|
|
571
585
|
const functions = {
|
|
572
586
|
createCollectionScope,
|
|
573
587
|
useCollection,
|
|
@@ -579,6 +593,7 @@ function createCollection2(name) {
|
|
|
579
593
|
ItemSlot: CollectionItemSlot
|
|
580
594
|
}, functions];
|
|
581
595
|
}
|
|
596
|
+
__name(createCollection2, "createCollection");
|
|
582
597
|
function shallowEqual(a, b) {
|
|
583
598
|
if (a === b) return true;
|
|
584
599
|
if (typeof a !== "object" || typeof b !== "object") return false;
|
|
@@ -592,12 +607,15 @@ function shallowEqual(a, b) {
|
|
|
592
607
|
}
|
|
593
608
|
return true;
|
|
594
609
|
}
|
|
610
|
+
__name(shallowEqual, "shallowEqual");
|
|
595
611
|
function isElementPreceding(a, b) {
|
|
596
612
|
return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);
|
|
597
613
|
}
|
|
614
|
+
__name(isElementPreceding, "isElementPreceding");
|
|
598
615
|
function sortByDocumentPosition(a, b) {
|
|
599
616
|
return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;
|
|
600
617
|
}
|
|
618
|
+
__name(sortByDocumentPosition, "sortByDocumentPosition");
|
|
601
619
|
function getChildListObserver(callback) {
|
|
602
620
|
const observer = new MutationObserver(mutationsList => {
|
|
603
621
|
for (const mutation of mutationsList) {
|
|
@@ -609,5 +627,6 @@ function getChildListObserver(callback) {
|
|
|
609
627
|
});
|
|
610
628
|
return observer;
|
|
611
629
|
}
|
|
630
|
+
__name(getChildListObserver, "getChildListObserver");
|
|
612
631
|
|
|
613
632
|
export { createCollection, createCollection2 as unstable_createCollection };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
+
value,
|
|
6
|
+
configurable: true
|
|
7
|
+
});
|
|
4
8
|
function setRef(ref, value) {
|
|
5
9
|
if (typeof ref === "function") {
|
|
6
10
|
return ref(value);
|
|
@@ -8,6 +12,7 @@ function setRef(ref, value) {
|
|
|
8
12
|
ref.current = value;
|
|
9
13
|
}
|
|
10
14
|
}
|
|
15
|
+
__name(setRef, "setRef");
|
|
11
16
|
function composeRefs() {
|
|
12
17
|
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13
18
|
refs[_key] = arguments[_key];
|
|
@@ -35,11 +40,13 @@ function composeRefs() {
|
|
|
35
40
|
}
|
|
36
41
|
};
|
|
37
42
|
}
|
|
43
|
+
__name(composeRefs, "composeRefs");
|
|
38
44
|
function useComposedRefs() {
|
|
39
45
|
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
40
46
|
refs[_key2] = arguments[_key2];
|
|
41
47
|
}
|
|
42
48
|
return React.useCallback(composeRefs(...refs), refs);
|
|
43
49
|
}
|
|
50
|
+
__name(useComposedRefs, "useComposedRefs");
|
|
44
51
|
|
|
45
52
|
export { composeRefs, useComposedRefs };
|
|
@@ -3,9 +3,16 @@ import * as React from 'react';
|
|
|
3
3
|
|
|
4
4
|
const _excluded = ["children"],
|
|
5
5
|
_excluded2 = ["scope", "children"];
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
8
|
+
value,
|
|
9
|
+
configurable: true
|
|
10
|
+
});
|
|
11
|
+
// @__NO_SIDE_EFFECTS__
|
|
6
12
|
function createContext2(rootComponentName, defaultContext) {
|
|
7
13
|
const Context = /*#__PURE__*/React.createContext(defaultContext);
|
|
8
|
-
|
|
14
|
+
Context.displayName = rootComponentName + "Context";
|
|
15
|
+
const Provider = /* @__PURE__ */__name(props => {
|
|
9
16
|
const children = props.children,
|
|
10
17
|
context = _objectWithoutProperties(props, _excluded);
|
|
11
18
|
const value = React.useMemo(() => context, Object.values(context));
|
|
@@ -13,24 +20,32 @@ function createContext2(rootComponentName, defaultContext) {
|
|
|
13
20
|
value,
|
|
14
21
|
children
|
|
15
22
|
});
|
|
16
|
-
};
|
|
23
|
+
}, "Provider");
|
|
17
24
|
Provider.displayName = rootComponentName + "Provider";
|
|
18
25
|
function useContext2(consumerName) {
|
|
26
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
+
const _options$optional = options.optional,
|
|
28
|
+
optional = _options$optional === void 0 ? false : _options$optional;
|
|
19
29
|
const context = React.useContext(Context);
|
|
20
30
|
if (context) return context;
|
|
21
31
|
if (defaultContext !== void 0) return defaultContext;
|
|
32
|
+
if (optional) return void 0;
|
|
22
33
|
throw new Error("`".concat(consumerName, "` must be used within `").concat(rootComponentName, "`"));
|
|
23
34
|
}
|
|
35
|
+
__name(useContext2, "useContext");
|
|
24
36
|
return [Provider, useContext2];
|
|
25
37
|
}
|
|
38
|
+
__name(createContext2, "createContext");
|
|
39
|
+
// @__NO_SIDE_EFFECTS__
|
|
26
40
|
function createContextScope(scopeName) {
|
|
27
41
|
let createContextScopeDeps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
28
42
|
let defaultContexts = [];
|
|
29
43
|
function createContext3(rootComponentName, defaultContext) {
|
|
30
44
|
const BaseContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
45
|
+
BaseContext.displayName = rootComponentName + "Context";
|
|
31
46
|
const index = defaultContexts.length;
|
|
32
47
|
defaultContexts = [...defaultContexts, defaultContext];
|
|
33
|
-
const Provider = props => {
|
|
48
|
+
const Provider = /* @__PURE__ */__name(props => {
|
|
34
49
|
var _scope$scopeName;
|
|
35
50
|
const scope = props.scope,
|
|
36
51
|
children = props.children,
|
|
@@ -41,23 +56,29 @@ function createContextScope(scopeName) {
|
|
|
41
56
|
value,
|
|
42
57
|
children
|
|
43
58
|
});
|
|
44
|
-
};
|
|
59
|
+
}, "Provider");
|
|
45
60
|
Provider.displayName = rootComponentName + "Provider";
|
|
46
61
|
function useContext2(consumerName, scope) {
|
|
47
62
|
var _scope$scopeName2;
|
|
63
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
64
|
+
const _options$optional2 = options.optional,
|
|
65
|
+
optional = _options$optional2 === void 0 ? false : _options$optional2;
|
|
48
66
|
const Context = (scope === null || scope === void 0 || (_scope$scopeName2 = scope[scopeName]) === null || _scope$scopeName2 === void 0 ? void 0 : _scope$scopeName2[index]) || BaseContext;
|
|
49
67
|
const context = React.useContext(Context);
|
|
50
68
|
if (context) return context;
|
|
51
69
|
if (defaultContext !== void 0) return defaultContext;
|
|
70
|
+
if (optional) return void 0;
|
|
52
71
|
throw new Error("`".concat(consumerName, "` must be used within `").concat(rootComponentName, "`"));
|
|
53
72
|
}
|
|
73
|
+
__name(useContext2, "useContext");
|
|
54
74
|
return [Provider, useContext2];
|
|
55
75
|
}
|
|
56
|
-
|
|
76
|
+
__name(createContext3, "createContext");
|
|
77
|
+
const createScope = /* @__PURE__ */__name(() => {
|
|
57
78
|
const scopeContexts = defaultContexts.map(defaultContext => {
|
|
58
79
|
return /*#__PURE__*/React.createContext(defaultContext);
|
|
59
80
|
});
|
|
60
|
-
return function useScope(scope) {
|
|
81
|
+
return /* @__PURE__ */__name(function useScope(scope) {
|
|
61
82
|
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
|
|
62
83
|
return React.useMemo(() => ({
|
|
63
84
|
["__scope".concat(scopeName)]: {
|
|
@@ -65,23 +86,24 @@ function createContextScope(scopeName) {
|
|
|
65
86
|
[scopeName]: contexts
|
|
66
87
|
}
|
|
67
88
|
}), [scope, contexts]);
|
|
68
|
-
};
|
|
69
|
-
};
|
|
89
|
+
}, "useScope");
|
|
90
|
+
}, "createScope");
|
|
70
91
|
createScope.scopeName = scopeName;
|
|
71
92
|
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
72
93
|
}
|
|
94
|
+
__name(createContextScope, "createContextScope");
|
|
73
95
|
function composeContextScopes() {
|
|
74
96
|
for (var _len = arguments.length, scopes = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
75
97
|
scopes[_key] = arguments[_key];
|
|
76
98
|
}
|
|
77
99
|
const baseScope = scopes[0];
|
|
78
100
|
if (scopes.length === 1) return baseScope;
|
|
79
|
-
const createScope = () => {
|
|
101
|
+
const createScope = /* @__PURE__ */__name(() => {
|
|
80
102
|
const scopeHooks = scopes.map(createScope2 => ({
|
|
81
103
|
useScope: createScope2(),
|
|
82
104
|
scopeName: createScope2.scopeName
|
|
83
105
|
}));
|
|
84
|
-
return function useComposedScopes(overrideScopes) {
|
|
106
|
+
return /* @__PURE__ */__name(function useComposedScopes(overrideScopes) {
|
|
85
107
|
const nextScopes = scopeHooks.reduce((nextScopes2, _ref) => {
|
|
86
108
|
let useScope = _ref.useScope,
|
|
87
109
|
scopeName = _ref.scopeName;
|
|
@@ -95,10 +117,11 @@ function composeContextScopes() {
|
|
|
95
117
|
return React.useMemo(() => ({
|
|
96
118
|
["__scope".concat(baseScope.scopeName)]: nextScopes
|
|
97
119
|
}), [nextScopes]);
|
|
98
|
-
};
|
|
99
|
-
};
|
|
120
|
+
}, "useComposedScopes");
|
|
121
|
+
}, "createScope");
|
|
100
122
|
createScope.scopeName = baseScope.scopeName;
|
|
101
123
|
return createScope;
|
|
102
124
|
}
|
|
125
|
+
__name(composeContextScopes, "composeContextScopes");
|
|
103
126
|
|
|
104
127
|
export { createContext2 as createContext, createContextScope };
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
"use client";
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
7
|
+
value,
|
|
8
|
+
configurable: true
|
|
9
|
+
});
|
|
4
10
|
var DirectionContext = /*#__PURE__*/React.createContext(void 0);
|
|
5
|
-
var DirectionProvider = props => {
|
|
11
|
+
var DirectionProvider = /* @__PURE__ */__name(props => {
|
|
6
12
|
const dir = props.dir,
|
|
7
13
|
children = props.children;
|
|
8
14
|
return /* @__PURE__ */React.createElement(DirectionContext.Provider, {
|
|
9
15
|
value: dir,
|
|
10
16
|
children
|
|
11
17
|
});
|
|
12
|
-
};
|
|
18
|
+
}, "DirectionProvider");
|
|
13
19
|
function useDirection(localDir) {
|
|
14
20
|
const globalDir = React.useContext(DirectionContext);
|
|
15
21
|
return localDir || globalDir || "ltr";
|
|
16
22
|
}
|
|
23
|
+
__name(useDirection, "useDirection");
|
|
17
24
|
var Provider = DirectionProvider;
|
|
18
25
|
|
|
19
26
|
export { DirectionProvider, Provider, useDirection };
|