@qualtrics/ui-react 2.85.4 → 2.85.5
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 +8 -0
- package/dist/__node_modules/@radix-ui/react-arrow/dist/index.js +2 -2
- package/dist/__node_modules/@radix-ui/react-collection/dist/index.js +209 -118
- package/dist/__node_modules/@radix-ui/react-direction/dist/index.js +6 -3
- package/dist/__node_modules/@radix-ui/react-dismissable-layer/dist/index.js +1 -3
- package/dist/__node_modules/@radix-ui/react-dropdown-menu/dist/index.js +18 -34
- package/dist/__node_modules/@radix-ui/react-focus-scope/dist/index.js +78 -21
- package/dist/__node_modules/@radix-ui/react-menu/dist/index.js +127 -120
- package/dist/__node_modules/@radix-ui/react-popper/dist/index.js +35 -21
- package/dist/__node_modules/@radix-ui/react-portal/dist/index.js +1 -2
- package/dist/__node_modules/@radix-ui/react-presence/dist/index.js +1 -2
- package/dist/__node_modules/@radix-ui/react-primitive/dist/index.js +2 -2
- package/dist/__node_modules/@radix-ui/react-roving-focus/dist/index.js +16 -6
- package/dist/__node_modules/@radix-ui/react-slot/dist/index.js +28 -7
- package/dist/__node_modules/@radix-ui/react-use-callback-ref/dist/index.js +11 -3
- package/dist/__node_modules/@radix-ui/react-use-size/dist/index.js +22 -15
- package/dist/__shared/cjs/{index-08198ff4.js → index-bd03241f.js} +206 -205
- package/dist/__shared/cjs/{index-e51bbd75.js → index-ccb5282a.js} +12 -3
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Button/Button.js +52 -6
- package/dist/components/Button/Button2.js +6 -52
- package/dist/components/Button/index.js +1 -1
- 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/ColorPicker/ColorPickerFlyout.js +1 -1
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/FilePicker/FilePicker.js +1 -1
- 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/Icon/IconTypes.js +1 -0
- 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/Pagination/PaginationNextButton.js +1 -1
- package/dist/components/Pagination/PaginationPreviousButton.js +1 -1
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch.js +1 -1
- 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/ColorPicker.js +1 -1
- 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/components/PulseIcon.js +11 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.es.js +1 -0
- package/dist/icons/index.js +2 -1
- package/dist/index.d.ts +72 -71
- package/dist/index.es.js +2 -2
- package/dist/index.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/Chat/Loader.js +1 -1
- 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/Menu.js +2 -2
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuButton.js +2 -2
- package/dist/next/Menu/MenuItem.js +2 -2
- package/dist/next/Menu/MenuPane.js +3 -3
- package/dist/next/Menu/SubMenu.js +5 -5
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/Select/Select2.js +3 -3
- package/dist/next/SplitButton/SplitButton.js +1 -1
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/ToggleButton/ToggleButton.js +1 -1
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.js +598 -403
- package/dist/translations-en.js +71 -71
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/icons/package.json +2 -2
- package/next/package.json +3 -3
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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.5 - November 16, 2026
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- **QuickSearch**: Fix the `isFlyoutFullWidth` flyout being narrower than the input. The flyout now matches the input's full width (`offsetWidth`) instead of its inner `clientWidth`.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
3
11
|
## 2.85.4 - October 13, 2026
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -2,6 +2,7 @@ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWitho
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Primitive } from '../../react-primitive/dist/index.js';
|
|
4
4
|
|
|
5
|
+
"use client";
|
|
5
6
|
const _excluded = ["children", "width", "height"];
|
|
6
7
|
var __defProp = Object.defineProperty;
|
|
7
8
|
var __name = (target, value) => __defProp(target, "name", {
|
|
@@ -27,6 +28,5 @@ var Arrow = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function Arrow
|
|
|
27
28
|
})
|
|
28
29
|
});
|
|
29
30
|
}, "Arrow"));
|
|
30
|
-
var Root = Arrow;
|
|
31
31
|
|
|
32
|
-
export { Arrow, Root };
|
|
32
|
+
export { Arrow, Arrow as Root };
|
|
@@ -4,6 +4,7 @@ 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
|
+
import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
|
|
7
8
|
|
|
8
9
|
"use client";
|
|
9
10
|
var _OrderedDict2, _keys;
|
|
@@ -119,54 +120,37 @@ var OrderedDict = (_keys = /*#__PURE__*/new WeakMap(), _OrderedDict2 = class _Or
|
|
|
119
120
|
__instanciated.set(this, true);
|
|
120
121
|
}
|
|
121
122
|
set(key, value) {
|
|
122
|
-
if (__instanciated.get(this)) {
|
|
123
|
-
|
|
124
|
-
_classPrivateFieldGet(_keys, this)[_classPrivateFieldGet(_keys, this).indexOf(key)] = key;
|
|
125
|
-
} else {
|
|
126
|
-
_classPrivateFieldGet(_keys, this).push(key);
|
|
127
|
-
}
|
|
123
|
+
if (__instanciated.get(this) && !this.has(key)) {
|
|
124
|
+
_classPrivateFieldGet(_keys, this).push(key);
|
|
128
125
|
}
|
|
129
126
|
super.set(key, value);
|
|
130
127
|
return this;
|
|
131
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Sets a key-value pair so that it ends up at the given index.
|
|
131
|
+
* - Existing keys are moved
|
|
132
|
+
* - Negative indices count from the end of the resulting dictionary, so
|
|
133
|
+
* inserting at -1 makes the item the last one, -2 the second to last, etc.
|
|
134
|
+
* - Out-of-range indices are clamped
|
|
135
|
+
*/
|
|
132
136
|
insert(index, key, value) {
|
|
133
137
|
const has = this.has(key);
|
|
134
|
-
const
|
|
138
|
+
const finalSize = has ? this.size : this.size + 1;
|
|
135
139
|
const relativeIndex = toSafeInteger(index);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {
|
|
140
|
+
const targetIndex = relativeIndex >= 0 ? Math.min(relativeIndex, finalSize - 1) : Math.max(finalSize + relativeIndex, 0);
|
|
141
|
+
if (has ? _classPrivateFieldGet(_keys, this).indexOf(key) === targetIndex : targetIndex === this.size) {
|
|
139
142
|
this.set(key, value);
|
|
140
143
|
return this;
|
|
141
144
|
}
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
let nextKey = keys[i];
|
|
152
|
-
if (keys[i] === key) {
|
|
153
|
-
nextKey = keys[i + 1];
|
|
154
|
-
}
|
|
155
|
-
if (has) {
|
|
156
|
-
this.delete(key);
|
|
157
|
-
}
|
|
158
|
-
nextValue = this.get(nextKey);
|
|
159
|
-
this.set(key, value);
|
|
160
|
-
} else {
|
|
161
|
-
if (!shouldSkip && keys[i - 1] === key) {
|
|
162
|
-
shouldSkip = true;
|
|
163
|
-
}
|
|
164
|
-
const currentKey = keys[shouldSkip ? i : i - 1];
|
|
165
|
-
const currentValue = nextValue;
|
|
166
|
-
nextValue = this.get(currentKey);
|
|
167
|
-
this.delete(currentKey);
|
|
168
|
-
this.set(currentKey, currentValue);
|
|
169
|
-
}
|
|
145
|
+
const keys = _classPrivateFieldGet(_keys, this).filter(existingKey => existingKey !== key);
|
|
146
|
+
keys.splice(targetIndex, 0, key);
|
|
147
|
+
const entries = keys.map(entryKey => [entryKey, entryKey === key ? value : this.get(entryKey)]);
|
|
148
|
+
this.clear();
|
|
149
|
+
for (const _ref of entries) {
|
|
150
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
151
|
+
const entryKey = _ref2[0];
|
|
152
|
+
const entryValue = _ref2[1];
|
|
153
|
+
this.set(entryKey, entryValue);
|
|
170
154
|
}
|
|
171
155
|
return this;
|
|
172
156
|
}
|
|
@@ -190,7 +174,9 @@ var OrderedDict = (_keys = /*#__PURE__*/new WeakMap(), _OrderedDict2 = class _Or
|
|
|
190
174
|
if (index === -1) {
|
|
191
175
|
return this;
|
|
192
176
|
}
|
|
193
|
-
|
|
177
|
+
const currentIndex = _classPrivateFieldGet(_keys, this).indexOf(newKey);
|
|
178
|
+
const targetIndex = currentIndex !== -1 && currentIndex < index ? index - 1 : index;
|
|
179
|
+
return this.insert(targetIndex, newKey, value);
|
|
194
180
|
}
|
|
195
181
|
after(key) {
|
|
196
182
|
let index = _classPrivateFieldGet(_keys, this).indexOf(key);
|
|
@@ -208,7 +194,9 @@ var OrderedDict = (_keys = /*#__PURE__*/new WeakMap(), _OrderedDict2 = class _Or
|
|
|
208
194
|
if (index === -1) {
|
|
209
195
|
return this;
|
|
210
196
|
}
|
|
211
|
-
|
|
197
|
+
const currentIndex = _classPrivateFieldGet(_keys, this).indexOf(newKey);
|
|
198
|
+
const targetIndex = currentIndex !== -1 && currentIndex <= index ? index : index + 1;
|
|
199
|
+
return this.insert(targetIndex, newKey, value);
|
|
212
200
|
}
|
|
213
201
|
first() {
|
|
214
202
|
return this.entryAt(0);
|
|
@@ -318,10 +306,14 @@ var OrderedDict = (_keys = /*#__PURE__*/new WeakMap(), _OrderedDict2 = class _Or
|
|
|
318
306
|
}
|
|
319
307
|
const callbackfn = args[0],
|
|
320
308
|
initialValue = args[1];
|
|
309
|
+
const hasInitialValue = args.length > 1;
|
|
310
|
+
if (!hasInitialValue && this.size === 0) {
|
|
311
|
+
throw new TypeError("Reduce of empty OrderedDict with no initial value");
|
|
312
|
+
}
|
|
321
313
|
let index = 0;
|
|
322
|
-
let accumulator = initialValue
|
|
314
|
+
let accumulator = initialValue;
|
|
323
315
|
for (const entry of this) {
|
|
324
|
-
if (index === 0 &&
|
|
316
|
+
if (index === 0 && !hasInitialValue) {
|
|
325
317
|
accumulator = entry;
|
|
326
318
|
} else {
|
|
327
319
|
accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);
|
|
@@ -336,10 +328,14 @@ var OrderedDict = (_keys = /*#__PURE__*/new WeakMap(), _OrderedDict2 = class _Or
|
|
|
336
328
|
}
|
|
337
329
|
const callbackfn = args[0],
|
|
338
330
|
initialValue = args[1];
|
|
339
|
-
|
|
331
|
+
const hasInitialValue = args.length > 1;
|
|
332
|
+
if (!hasInitialValue && this.size === 0) {
|
|
333
|
+
throw new TypeError("Reduce of empty OrderedDict with no initial value");
|
|
334
|
+
}
|
|
335
|
+
let accumulator = initialValue;
|
|
340
336
|
for (let index = this.size - 1; index >= 0; index--) {
|
|
341
|
-
const entry = this.
|
|
342
|
-
if (index === this.size - 1 &&
|
|
337
|
+
const entry = this.entryAt(index);
|
|
338
|
+
if (index === this.size - 1 && !hasInitialValue) {
|
|
343
339
|
accumulator = entry;
|
|
344
340
|
} else {
|
|
345
341
|
accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);
|
|
@@ -347,7 +343,39 @@ var OrderedDict = (_keys = /*#__PURE__*/new WeakMap(), _OrderedDict2 = class _Or
|
|
|
347
343
|
}
|
|
348
344
|
return accumulator;
|
|
349
345
|
}
|
|
346
|
+
/**
|
|
347
|
+
* Sorts the dictionary in place. This method mutates the dictionary and
|
|
348
|
+
* returns a reference to the same object
|
|
349
|
+
*
|
|
350
|
+
* @param compareFn Function used to determine the order of the elements. It
|
|
351
|
+
* is expected to return a negative value if the first argument is less than
|
|
352
|
+
* the second argument, zero if they're equal, and a positive value otherwise.
|
|
353
|
+
*/
|
|
354
|
+
sort(compareFn) {
|
|
355
|
+
if (typeof compareFn !== "function") {
|
|
356
|
+
throw new TypeError("OrderedDict.sort requires a compare function");
|
|
357
|
+
}
|
|
358
|
+
const entries = [...this.entries()].sort(compareFn);
|
|
359
|
+
this.clear();
|
|
360
|
+
for (const _ref3 of entries) {
|
|
361
|
+
var _ref4 = _slicedToArray(_ref3, 2);
|
|
362
|
+
const key = _ref4[0];
|
|
363
|
+
const value = _ref4[1];
|
|
364
|
+
this.set(key, value);
|
|
365
|
+
}
|
|
366
|
+
return this;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Returns a copy of the dictionary with its elements sorted.
|
|
370
|
+
*
|
|
371
|
+
* @param compareFn Function used to determine the order of the elements. It
|
|
372
|
+
* is expected to return a negative value if the first argument is less than
|
|
373
|
+
* the second argument, zero if they're equal, and a positive value otherwise.
|
|
374
|
+
*/
|
|
350
375
|
toSorted(compareFn) {
|
|
376
|
+
if (typeof compareFn !== "function") {
|
|
377
|
+
throw new TypeError("OrderedDict.toSorted requires a compare function");
|
|
378
|
+
}
|
|
351
379
|
const entries = [...this.entries()].sort(compareFn);
|
|
352
380
|
return new _OrderedDict(entries);
|
|
353
381
|
}
|
|
@@ -367,20 +395,8 @@ var OrderedDict = (_keys = /*#__PURE__*/new WeakMap(), _OrderedDict2 = class _Or
|
|
|
367
395
|
}
|
|
368
396
|
slice(start, end) {
|
|
369
397
|
const result = new _OrderedDict();
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
return result;
|
|
373
|
-
}
|
|
374
|
-
if (start < 0) {
|
|
375
|
-
start = start + this.size;
|
|
376
|
-
}
|
|
377
|
-
if (end !== void 0 && end > 0) {
|
|
378
|
-
stop = end - 1;
|
|
379
|
-
}
|
|
380
|
-
for (let index = start; index <= stop; index++) {
|
|
381
|
-
const key = this.keyAt(index);
|
|
382
|
-
const element = this.get(key);
|
|
383
|
-
result.set(key, element);
|
|
398
|
+
for (const key of _classPrivateFieldGet(_keys, this).slice(start, end)) {
|
|
399
|
+
result.set(key, this.get(key));
|
|
384
400
|
}
|
|
385
401
|
return result;
|
|
386
402
|
}
|
|
@@ -434,23 +450,19 @@ function createCollection2(name) {
|
|
|
434
450
|
_createContextScope4 = _slicedToArray(_createContextScope3, 2),
|
|
435
451
|
createCollectionContext = _createContextScope4[0],
|
|
436
452
|
createCollectionScope = _createContextScope4[1];
|
|
437
|
-
const _createCollectionCont3 = createCollectionContext(PROVIDER_NAME,
|
|
438
|
-
collectionElement: null,
|
|
439
|
-
collectionRef: {
|
|
440
|
-
current: null
|
|
441
|
-
},
|
|
442
|
-
collectionRefObject: {
|
|
443
|
-
current: null
|
|
444
|
-
},
|
|
445
|
-
itemMap: new OrderedDict(),
|
|
446
|
-
setItemMap: /* @__PURE__ */__name(() => void 0, "setItemMap")
|
|
447
|
-
}),
|
|
453
|
+
const _createCollectionCont3 = createCollectionContext(PROVIDER_NAME),
|
|
448
454
|
_createCollectionCont4 = _slicedToArray(_createCollectionCont3, 2),
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
455
|
+
CollectionStableContextProvider = _createCollectionCont4[0],
|
|
456
|
+
useStableCollectionContext = _createCollectionCont4[1];
|
|
457
|
+
CollectionStableContextProvider.displayName = name + "CollectionStableContextProvider";
|
|
458
|
+
const _createCollectionCont5 = createCollectionContext(PROVIDER_NAME),
|
|
459
|
+
_createCollectionCont6 = _slicedToArray(_createCollectionCont5, 2),
|
|
460
|
+
CollectionStatefulContextProvider = _createCollectionCont6[0],
|
|
461
|
+
useStatefulCollectionContext = _createCollectionCont6[1];
|
|
462
|
+
CollectionStatefulContextProvider.displayName = name + "CollectionStatefulContextProvider";
|
|
463
|
+
const CollectionProvider = /* @__PURE__ */__name(_ref5 => {
|
|
464
|
+
let state = _ref5.state,
|
|
465
|
+
props = _objectWithoutProperties(_ref5, _excluded2);
|
|
454
466
|
return state ? /* @__PURE__ */React.createElement(CollectionProviderImpl, {
|
|
455
467
|
...props,
|
|
456
468
|
state
|
|
@@ -466,7 +478,7 @@ function createCollection2(name) {
|
|
|
466
478
|
state
|
|
467
479
|
});
|
|
468
480
|
}, "CollectionInit");
|
|
469
|
-
CollectionInit.displayName =
|
|
481
|
+
CollectionInit.displayName = name + "CollectionInit";
|
|
470
482
|
const CollectionProviderImpl = /* @__PURE__ */__name(props => {
|
|
471
483
|
const scope = props.scope,
|
|
472
484
|
children = props.children,
|
|
@@ -478,11 +490,31 @@ function createCollection2(name) {
|
|
|
478
490
|
setCollectionElement = _React2$useState2[1];
|
|
479
491
|
const composeRefs = useComposedRefs(ref, setCollectionElement);
|
|
480
492
|
const _state = _slicedToArray(state, 2),
|
|
481
|
-
|
|
482
|
-
|
|
493
|
+
collection = _state[0],
|
|
494
|
+
setCollection = _state[1];
|
|
495
|
+
const registryRef = React.useRef(new OrderedDict());
|
|
496
|
+
const getCollection = React.useCallback(() => {
|
|
497
|
+
const registry = registryRef.current;
|
|
498
|
+
if (!isInDocumentOrder(registry)) {
|
|
499
|
+
registry.sort(sortByDocumentPosition);
|
|
500
|
+
}
|
|
501
|
+
return registry;
|
|
502
|
+
}, []);
|
|
483
503
|
React.useEffect(() => {
|
|
484
|
-
if (!collectionElement)
|
|
485
|
-
|
|
504
|
+
if (!collectionElement) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
const observer = getChildListObserver(() => {
|
|
508
|
+
setCollection(map => {
|
|
509
|
+
const sorted = map.toSorted(sortByDocumentPosition);
|
|
510
|
+
const orderChanged = sorted.some((_ref6, index) => {
|
|
511
|
+
let _ref7 = _slicedToArray(_ref6, 1),
|
|
512
|
+
key = _ref7[0];
|
|
513
|
+
return map.keyAt(index) !== key;
|
|
514
|
+
});
|
|
515
|
+
return orderChanged ? sorted : map;
|
|
516
|
+
});
|
|
517
|
+
});
|
|
486
518
|
observer.observe(collectionElement, {
|
|
487
519
|
childList: true,
|
|
488
520
|
subtree: true
|
|
@@ -490,25 +522,30 @@ function createCollection2(name) {
|
|
|
490
522
|
return () => {
|
|
491
523
|
observer.disconnect();
|
|
492
524
|
};
|
|
493
|
-
}, [collectionElement]);
|
|
494
|
-
return /* @__PURE__ */React.createElement(
|
|
525
|
+
}, [collectionElement, setCollection]);
|
|
526
|
+
return /* @__PURE__ */React.createElement(CollectionStableContextProvider, {
|
|
495
527
|
scope,
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
children
|
|
528
|
+
collectionElementRef: composeRefs,
|
|
529
|
+
collectionElementRefObject: ref,
|
|
530
|
+
getCollection,
|
|
531
|
+
setCollection,
|
|
532
|
+
registryRef,
|
|
533
|
+
children: /* @__PURE__ */React.createElement(CollectionStatefulContextProvider, {
|
|
534
|
+
scope,
|
|
535
|
+
collectionElement,
|
|
536
|
+
collection,
|
|
537
|
+
children
|
|
538
|
+
})
|
|
502
539
|
});
|
|
503
540
|
}, "CollectionProviderImpl");
|
|
504
|
-
CollectionProviderImpl.displayName =
|
|
541
|
+
CollectionProviderImpl.displayName = name + "CollectionProviderImpl";
|
|
505
542
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
506
543
|
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
507
544
|
const CollectionSlot = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
508
545
|
const scope = props.scope,
|
|
509
546
|
children = props.children;
|
|
510
|
-
const context =
|
|
511
|
-
const composedRefs = useComposedRefs(forwardedRef, context.
|
|
547
|
+
const context = useStableCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
548
|
+
const composedRefs = useComposedRefs(forwardedRef, context.collectionElementRef);
|
|
512
549
|
return /* @__PURE__ */React.createElement(CollectionSlotImpl, {
|
|
513
550
|
ref: composedRefs,
|
|
514
551
|
children
|
|
@@ -523,46 +560,79 @@ function createCollection2(name) {
|
|
|
523
560
|
children = props.children,
|
|
524
561
|
itemData = _objectWithoutProperties(props, _excluded3);
|
|
525
562
|
const ref = React.useRef(null);
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
setElement = _React2$useState4[1];
|
|
530
|
-
const composedRefs = useComposedRefs(forwardedRef, ref, setElement);
|
|
531
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
532
|
-
const setItemMap = context.setItemMap;
|
|
563
|
+
const context = useStableCollectionContext(ITEM_SLOT_NAME, scope);
|
|
564
|
+
const setCollection = context.setCollection,
|
|
565
|
+
registryRef = context.registryRef;
|
|
533
566
|
const itemDataRef = React.useRef(itemData);
|
|
534
567
|
if (!shallowEqual(itemDataRef.current, itemData)) {
|
|
535
568
|
itemDataRef.current = itemData;
|
|
536
569
|
}
|
|
537
570
|
const memoizedItemData = itemDataRef.current;
|
|
571
|
+
const registerElement = React.useCallback(node => {
|
|
572
|
+
const registry = registryRef.current;
|
|
573
|
+
if (node) {
|
|
574
|
+
registry.set(node, {
|
|
575
|
+
...itemDataRef.current,
|
|
576
|
+
element: node
|
|
577
|
+
});
|
|
578
|
+
} else if (ref.current) {
|
|
579
|
+
registry.delete(ref.current);
|
|
580
|
+
}
|
|
581
|
+
}, [registryRef]);
|
|
582
|
+
const composedRefs = useComposedRefs(forwardedRef, registerElement, ref);
|
|
583
|
+
useLayoutEffect2(() => {
|
|
584
|
+
const node = ref.current;
|
|
585
|
+
const registry = registryRef.current;
|
|
586
|
+
if (node && registry.has(node)) {
|
|
587
|
+
registry.set(node, {
|
|
588
|
+
...memoizedItemData,
|
|
589
|
+
element: node
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
}, [memoizedItemData, registryRef]);
|
|
593
|
+
const registeredRef = React.useRef(null);
|
|
538
594
|
React.useEffect(() => {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
595
|
+
var _registered$element;
|
|
596
|
+
const element = ref.current;
|
|
597
|
+
const registered = registeredRef.current;
|
|
598
|
+
if (((_registered$element = registered === null || registered === void 0 ? void 0 : registered.element) !== null && _registered$element !== void 0 ? _registered$element : null) === element && (!element || (registered === null || registered === void 0 ? void 0 : registered.itemData) === memoizedItemData)) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
registeredRef.current = element ? {
|
|
602
|
+
element,
|
|
603
|
+
itemData: memoizedItemData
|
|
604
|
+
} : null;
|
|
605
|
+
setCollection(map => {
|
|
606
|
+
const next = new OrderedDict(map);
|
|
607
|
+
if (registered && registered.element !== element) {
|
|
608
|
+
next.delete(registered.element);
|
|
543
609
|
}
|
|
544
|
-
if (
|
|
545
|
-
|
|
546
|
-
...
|
|
610
|
+
if (element) {
|
|
611
|
+
next.set(element, {
|
|
612
|
+
...memoizedItemData,
|
|
547
613
|
element
|
|
548
614
|
});
|
|
549
|
-
return map.toSorted(sortByDocumentPosition);
|
|
550
615
|
}
|
|
551
|
-
return
|
|
552
|
-
...itemData2,
|
|
553
|
-
element
|
|
554
|
-
}).toSorted(sortByDocumentPosition);
|
|
616
|
+
return next.sort(sortByDocumentPosition);
|
|
555
617
|
});
|
|
618
|
+
});
|
|
619
|
+
React.useEffect(() => {
|
|
556
620
|
return () => {
|
|
557
|
-
|
|
558
|
-
|
|
621
|
+
const registered = registeredRef.current;
|
|
622
|
+
registeredRef.current = null;
|
|
623
|
+
if (!registered) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
setCollection(map => {
|
|
627
|
+
if (!map.has(registered.element)) {
|
|
559
628
|
return map;
|
|
560
629
|
}
|
|
561
|
-
map
|
|
562
|
-
|
|
630
|
+
const next = new OrderedDict(map);
|
|
631
|
+
next.delete(registered.element);
|
|
632
|
+
return next;
|
|
563
633
|
});
|
|
564
634
|
};
|
|
565
|
-
}, [
|
|
635
|
+
}, [setCollection]);
|
|
566
636
|
return /* @__PURE__ */React.createElement(CollectionItemSlotImpl, {
|
|
567
637
|
...{
|
|
568
638
|
[ITEM_DATA_ATTR]: ""
|
|
@@ -577,14 +647,21 @@ function createCollection2(name) {
|
|
|
577
647
|
}
|
|
578
648
|
__name(useInitCollection, "useInitCollection");
|
|
579
649
|
function useCollection(scope) {
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
return
|
|
650
|
+
const _useStatefulCollectio = useStatefulCollectionContext(name + "CollectionConsumer", scope),
|
|
651
|
+
collection = _useStatefulCollectio.collection;
|
|
652
|
+
return collection;
|
|
583
653
|
}
|
|
584
654
|
__name(useCollection, "useCollection");
|
|
655
|
+
function useGetCollection(scope) {
|
|
656
|
+
const _useStableCollectionC = useStableCollectionContext(name + "CollectionConsumer", scope),
|
|
657
|
+
getCollection = _useStableCollectionC.getCollection;
|
|
658
|
+
return getCollection;
|
|
659
|
+
}
|
|
660
|
+
__name(useGetCollection, "useGetCollection");
|
|
585
661
|
const functions = {
|
|
586
662
|
createCollectionScope,
|
|
587
663
|
useCollection,
|
|
664
|
+
useGetCollection,
|
|
588
665
|
useInitCollection
|
|
589
666
|
};
|
|
590
667
|
return [{
|
|
@@ -612,6 +689,20 @@ function isElementPreceding(a, b) {
|
|
|
612
689
|
return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);
|
|
613
690
|
}
|
|
614
691
|
__name(isElementPreceding, "isElementPreceding");
|
|
692
|
+
function isInDocumentOrder(dict) {
|
|
693
|
+
let previous;
|
|
694
|
+
for (const element of dict.keys()) {
|
|
695
|
+
if (previous) {
|
|
696
|
+
const position = previous.compareDocumentPosition(element);
|
|
697
|
+
if (!(position & Node.DOCUMENT_POSITION_DISCONNECTED) && position & Node.DOCUMENT_POSITION_PRECEDING) {
|
|
698
|
+
return false;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
previous = element;
|
|
702
|
+
}
|
|
703
|
+
return true;
|
|
704
|
+
}
|
|
705
|
+
__name(isInDocumentOrder, "isInDocumentOrder");
|
|
615
706
|
function sortByDocumentPosition(a, b) {
|
|
616
707
|
return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;
|
|
617
708
|
}
|
|
@@ -7,6 +7,10 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
7
7
|
value,
|
|
8
8
|
configurable: true
|
|
9
9
|
});
|
|
10
|
+
var Direction = {
|
|
11
|
+
LTR: "ltr",
|
|
12
|
+
RTL: "rtl"
|
|
13
|
+
};
|
|
10
14
|
var DirectionContext = /*#__PURE__*/React.createContext(void 0);
|
|
11
15
|
var DirectionProvider = /* @__PURE__ */__name(props => {
|
|
12
16
|
const dir = props.dir,
|
|
@@ -18,9 +22,8 @@ var DirectionProvider = /* @__PURE__ */__name(props => {
|
|
|
18
22
|
}, "DirectionProvider");
|
|
19
23
|
function useDirection(localDir) {
|
|
20
24
|
const globalDir = React.useContext(DirectionContext);
|
|
21
|
-
return localDir || globalDir ||
|
|
25
|
+
return localDir || globalDir || Direction.LTR;
|
|
22
26
|
}
|
|
23
27
|
__name(useDirection, "useDirection");
|
|
24
|
-
var Provider = DirectionProvider;
|
|
25
28
|
|
|
26
|
-
export { DirectionProvider, Provider, useDirection };
|
|
29
|
+
export { DirectionProvider, DirectionProvider as Provider, useDirection };
|
|
@@ -355,7 +355,5 @@ function handleAndDispatchCustomEvent(name, handler, detail, _ref) {
|
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
__name(handleAndDispatchCustomEvent, "handleAndDispatchCustomEvent");
|
|
358
|
-
var Root = DismissableLayer;
|
|
359
|
-
var Branch = DismissableLayerBranch;
|
|
360
358
|
|
|
361
|
-
export { Branch, DismissableLayer, DismissableLayerBranch, Root, useDismissableLayerSurface };
|
|
359
|
+
export { DismissableLayerBranch as Branch, DismissableLayer, DismissableLayerBranch, DismissableLayer as Root, useDismissableLayerSurface };
|