@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
|
@@ -9,13 +9,13 @@ import { createContextScope } from '../../react-context/dist/index.js';
|
|
|
9
9
|
import { useDirection } from '../../react-direction/dist/index.js';
|
|
10
10
|
import { DismissableLayer } from '../../react-dismissable-layer/dist/index.js';
|
|
11
11
|
import { useFocusGuards } from '../../react-focus-guards/dist/index.js';
|
|
12
|
-
import { FocusScope } from '../../react-focus-scope/dist/index.js';
|
|
12
|
+
import { useFocusScopeBranch, useFocusScopeBranchRegistry, FocusScopeBranchProvider, FocusScope } from '../../react-focus-scope/dist/index.js';
|
|
13
13
|
import { useId } from '../../react-id/dist/index.js';
|
|
14
|
-
import { createPopperScope,
|
|
15
|
-
import { Portal
|
|
14
|
+
import { createPopperScope, Popper, Anchor as PopperAnchor, Content as PopperContent, Arrow as PopperArrow } from '../../react-popper/dist/index.js';
|
|
15
|
+
import { Portal } from '../../react-portal/dist/index.js';
|
|
16
16
|
import { Presence } from '../../react-presence/dist/index.js';
|
|
17
17
|
import { Primitive, dispatchDiscreteCustomEvent } from '../../react-primitive/dist/index.js';
|
|
18
|
-
import { createRovingFocusGroupScope, Root, Item } from '../../react-roving-focus/dist/index.js';
|
|
18
|
+
import { createRovingFocusGroupScope, Root as RovingFocusGroup, Item as RovingFocusGroupItem } from '../../react-roving-focus/dist/index.js';
|
|
19
19
|
import { createSlot } from '../../react-slot/dist/index.js';
|
|
20
20
|
import { useCallbackRef } from '../../react-use-callback-ref/dist/index.js';
|
|
21
21
|
import { hideOthers } from '../../../aria-hidden/dist/es2015/index.js';
|
|
@@ -42,6 +42,10 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
42
42
|
value,
|
|
43
43
|
configurable: true
|
|
44
44
|
});
|
|
45
|
+
var Direction = {
|
|
46
|
+
LTR: "ltr",
|
|
47
|
+
RTL: "rtl"
|
|
48
|
+
};
|
|
45
49
|
var SELECTION_KEYS = ["Enter", " "];
|
|
46
50
|
var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"];
|
|
47
51
|
var LAST_KEYS = ["ArrowUp", "PageDown", "End"];
|
|
@@ -127,7 +131,7 @@ var Menu = /* @__PURE__ */__name(props => {
|
|
|
127
131
|
window.addEventListener("blur", handleBlur);
|
|
128
132
|
return () => window.removeEventListener("blur", handleBlur);
|
|
129
133
|
}, [open, handleOpenChange]);
|
|
130
|
-
return /* @__PURE__ */React.createElement(
|
|
134
|
+
return /* @__PURE__ */React.createElement(Popper, {
|
|
131
135
|
...popperScope,
|
|
132
136
|
children: /* @__PURE__ */React.createElement(MenuProvider, {
|
|
133
137
|
scope: __scopeMenu,
|
|
@@ -150,7 +154,7 @@ var MenuAnchor = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function
|
|
|
150
154
|
const __scopeMenu = props.__scopeMenu,
|
|
151
155
|
anchorProps = _objectWithoutProperties(props, _excluded);
|
|
152
156
|
const popperScope = usePopperScope(__scopeMenu);
|
|
153
|
-
return /* @__PURE__ */React.createElement(
|
|
157
|
+
return /* @__PURE__ */React.createElement(PopperAnchor, {
|
|
154
158
|
...popperScope,
|
|
155
159
|
...anchorProps,
|
|
156
160
|
ref: forwardedRef
|
|
@@ -174,7 +178,7 @@ var MenuPortal = /* @__PURE__ */__name(props => {
|
|
|
174
178
|
forceMount,
|
|
175
179
|
children: /* @__PURE__ */React.createElement(Presence, {
|
|
176
180
|
present: forceMount || context.open,
|
|
177
|
-
children: /* @__PURE__ */React.createElement(Portal
|
|
181
|
+
children: /* @__PURE__ */React.createElement(Portal, {
|
|
178
182
|
asChild: true,
|
|
179
183
|
container,
|
|
180
184
|
children
|
|
@@ -275,17 +279,30 @@ __name(function MenuContentImpl2(props, forwardedRef) {
|
|
|
275
279
|
currentItemId = _React$useState4[0],
|
|
276
280
|
setCurrentItemId = _React$useState4[1];
|
|
277
281
|
const contentRef = React.useRef(null);
|
|
278
|
-
const
|
|
282
|
+
const _React$useState5 = React.useState(null),
|
|
283
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
284
|
+
branchNode = _React$useState6[0],
|
|
285
|
+
setBranchNode = _React$useState6[1];
|
|
286
|
+
useFocusScopeBranch(branchNode);
|
|
287
|
+
const _useFocusScopeBranchR = useFocusScopeBranchRegistry(),
|
|
288
|
+
branchNodes = _useFocusScopeBranchR.nodes,
|
|
289
|
+
branchRegistry = _useFocusScopeBranchR.registry;
|
|
290
|
+
const isModal = Boolean(trapFocus || disableOutsideScroll);
|
|
291
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef, context.onContentChange, setBranchNode);
|
|
279
292
|
const timerRef = React.useRef(0);
|
|
280
293
|
const searchRef = React.useRef("");
|
|
281
294
|
const pointerGraceTimerRef = React.useRef(0);
|
|
282
295
|
const pointerGraceIntentRef = React.useRef(null);
|
|
283
296
|
const pointerDirRef = React.useRef("right");
|
|
284
297
|
const lastPointerXRef = React.useRef(0);
|
|
298
|
+
const shards = React.useMemo(() => disableOutsideScroll ? [contentRef, ...branchNodes.map(node => ({
|
|
299
|
+
current: node
|
|
300
|
+
}))] : [], [contentRef, branchNodes, disableOutsideScroll]);
|
|
285
301
|
const ScrollLockWrapper = disableOutsideScroll ? ReactRemoveScroll : React.Fragment;
|
|
286
302
|
const scrollLockWrapperProps = disableOutsideScroll ? {
|
|
287
303
|
as: Slot,
|
|
288
|
-
allowPinchZoom: true
|
|
304
|
+
allowPinchZoom: true,
|
|
305
|
+
shards
|
|
289
306
|
} : void 0;
|
|
290
307
|
const handleTypeaheadSearch = /* @__PURE__ */__name(key => {
|
|
291
308
|
var _items$find, _items$find2;
|
|
@@ -296,11 +313,13 @@ __name(function MenuContentImpl2(props, forwardedRef) {
|
|
|
296
313
|
const values = items.map(item => item.textValue);
|
|
297
314
|
const nextMatch = getNextMatch(values, search, currentMatch);
|
|
298
315
|
const newItem = (_items$find2 = items.find(item => item.textValue === nextMatch)) === null || _items$find2 === void 0 ? void 0 : _items$find2.ref.current;
|
|
299
|
-
|
|
316
|
+
function updateSearch(value) {
|
|
300
317
|
searchRef.current = value;
|
|
301
318
|
window.clearTimeout(timerRef.current);
|
|
302
319
|
if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3);
|
|
303
|
-
}
|
|
320
|
+
}
|
|
321
|
+
__name(updateSearch, "updateSearch");
|
|
322
|
+
updateSearch(search);
|
|
304
323
|
if (newItem) {
|
|
305
324
|
setTimeout(() => newItem.focus());
|
|
306
325
|
}
|
|
@@ -333,85 +352,89 @@ __name(function MenuContentImpl2(props, forwardedRef) {
|
|
|
333
352
|
onPointerGraceIntentChange: React.useCallback(intent => {
|
|
334
353
|
pointerGraceIntentRef.current = intent;
|
|
335
354
|
}, []),
|
|
336
|
-
children: /* @__PURE__ */React.createElement(
|
|
337
|
-
|
|
338
|
-
children: /* @__PURE__ */React.createElement(
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
onMountAutoFocus: composeEventHandlers(onOpenAutoFocus, event => {
|
|
342
|
-
var _contentRef$current2;
|
|
343
|
-
event.preventDefault();
|
|
344
|
-
(_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 || _contentRef$current2.focus({
|
|
345
|
-
preventScroll: true
|
|
346
|
-
});
|
|
347
|
-
}),
|
|
348
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
349
|
-
children: /* @__PURE__ */React.createElement(DismissableLayer, {
|
|
355
|
+
children: /* @__PURE__ */React.createElement(FocusScopeBranchProvider, {
|
|
356
|
+
registry: isModal ? branchRegistry : null,
|
|
357
|
+
children: /* @__PURE__ */React.createElement(ScrollLockWrapper, {
|
|
358
|
+
...scrollLockWrapperProps,
|
|
359
|
+
children: /* @__PURE__ */React.createElement(FocusScope, {
|
|
350
360
|
asChild: true,
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
361
|
+
trapped: trapFocus,
|
|
362
|
+
branches: branchNodes,
|
|
363
|
+
onMountAutoFocus: composeEventHandlers(onOpenAutoFocus, event => {
|
|
364
|
+
var _contentRef$current2;
|
|
365
|
+
event.preventDefault();
|
|
366
|
+
(_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 || _contentRef$current2.focus({
|
|
367
|
+
preventScroll: true
|
|
368
|
+
});
|
|
369
|
+
}),
|
|
370
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
371
|
+
children: /* @__PURE__ */React.createElement(DismissableLayer, {
|
|
358
372
|
asChild: true,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
preventScrollOnEntryFocus: true,
|
|
369
|
-
children: /* @__PURE__ */React.createElement(Content, {
|
|
370
|
-
role: "menu",
|
|
371
|
-
"aria-orientation": "vertical",
|
|
372
|
-
"data-state": getOpenState(context.open),
|
|
373
|
-
"data-radix-menu-content": "",
|
|
373
|
+
disableOutsidePointerEvents,
|
|
374
|
+
onEscapeKeyDown,
|
|
375
|
+
onPointerDownOutside,
|
|
376
|
+
onFocusOutside,
|
|
377
|
+
onInteractOutside,
|
|
378
|
+
onDismiss,
|
|
379
|
+
children: /* @__PURE__ */React.createElement(RovingFocusGroup, {
|
|
380
|
+
asChild: true,
|
|
381
|
+
...rovingFocusGroupScope,
|
|
374
382
|
dir: rootContext.dir,
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
},
|
|
382
|
-
onKeyDown: composeEventHandlers(contentProps.onKeyDown, event => {
|
|
383
|
-
const target = event.target;
|
|
384
|
-
const isKeyDownInside = target.closest("[data-radix-menu-content]") === event.currentTarget;
|
|
385
|
-
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
386
|
-
const isCharacterKey = event.key.length === 1;
|
|
387
|
-
if (isKeyDownInside) {
|
|
388
|
-
if (event.key === "Tab") event.preventDefault();
|
|
389
|
-
if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);
|
|
390
|
-
}
|
|
391
|
-
const content = contentRef.current;
|
|
392
|
-
if (event.target !== content) return;
|
|
393
|
-
if (!_includesInstanceProperty(FIRST_LAST_KEYS).call(FIRST_LAST_KEYS, event.key)) return;
|
|
394
|
-
event.preventDefault();
|
|
395
|
-
const items = getItems().filter(item => !item.disabled);
|
|
396
|
-
const candidateNodes = items.map(item => item.ref.current);
|
|
397
|
-
if (_includesInstanceProperty(LAST_KEYS).call(LAST_KEYS, event.key)) candidateNodes.reverse();
|
|
398
|
-
focusFirst(candidateNodes);
|
|
399
|
-
}),
|
|
400
|
-
onBlur: composeEventHandlers(props.onBlur, event => {
|
|
401
|
-
if (!event.currentTarget.contains(event.target)) {
|
|
402
|
-
window.clearTimeout(timerRef.current);
|
|
403
|
-
searchRef.current = "";
|
|
404
|
-
}
|
|
383
|
+
orientation: "vertical",
|
|
384
|
+
loop,
|
|
385
|
+
currentTabStopId: currentItemId,
|
|
386
|
+
onCurrentTabStopIdChange: setCurrentItemId,
|
|
387
|
+
onEntryFocus: composeEventHandlers(onEntryFocus, event => {
|
|
388
|
+
if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
|
|
405
389
|
}),
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
390
|
+
preventScrollOnEntryFocus: true,
|
|
391
|
+
children: /* @__PURE__ */React.createElement(PopperContent, {
|
|
392
|
+
role: "menu",
|
|
393
|
+
"aria-orientation": "vertical",
|
|
394
|
+
"data-state": getOpenState(context.open),
|
|
395
|
+
"data-radix-menu-content": "",
|
|
396
|
+
dir: rootContext.dir,
|
|
397
|
+
...popperScope,
|
|
398
|
+
...contentProps,
|
|
399
|
+
ref: composedRefs,
|
|
400
|
+
style: {
|
|
401
|
+
outline: "none",
|
|
402
|
+
...contentProps.style
|
|
403
|
+
},
|
|
404
|
+
onKeyDown: composeEventHandlers(contentProps.onKeyDown, event => {
|
|
405
|
+
const target = event.target;
|
|
406
|
+
const isKeyDownInside = target.closest("[data-radix-menu-content]") === event.currentTarget;
|
|
407
|
+
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
408
|
+
const isCharacterKey = event.key.length === 1;
|
|
409
|
+
if (isKeyDownInside) {
|
|
410
|
+
if (event.key === "Tab") event.preventDefault();
|
|
411
|
+
if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);
|
|
412
|
+
}
|
|
413
|
+
const content = contentRef.current;
|
|
414
|
+
if (event.target !== content) return;
|
|
415
|
+
if (!_includesInstanceProperty(FIRST_LAST_KEYS).call(FIRST_LAST_KEYS, event.key)) return;
|
|
416
|
+
event.preventDefault();
|
|
417
|
+
const items = getItems().filter(item => !item.disabled);
|
|
418
|
+
const candidateNodes = items.map(item => item.ref.current);
|
|
419
|
+
if (_includesInstanceProperty(LAST_KEYS).call(LAST_KEYS, event.key)) candidateNodes.reverse();
|
|
420
|
+
focusFirst(candidateNodes);
|
|
421
|
+
}),
|
|
422
|
+
onBlur: composeEventHandlers(props.onBlur, event => {
|
|
423
|
+
if (!event.currentTarget.contains(event.target)) {
|
|
424
|
+
window.clearTimeout(timerRef.current);
|
|
425
|
+
searchRef.current = "";
|
|
426
|
+
}
|
|
427
|
+
}),
|
|
428
|
+
onPointerMove: composeEventHandlers(props.onPointerMove, whenMouse(event => {
|
|
429
|
+
const target = event.target;
|
|
430
|
+
const pointerXHasChanged = lastPointerXRef.current !== event.clientX;
|
|
431
|
+
if (event.currentTarget.contains(target) && pointerXHasChanged) {
|
|
432
|
+
const newDir = event.clientX > lastPointerXRef.current ? "right" : "left";
|
|
433
|
+
pointerDirRef.current = newDir;
|
|
434
|
+
lastPointerXRef.current = event.clientX;
|
|
435
|
+
}
|
|
436
|
+
}))
|
|
437
|
+
})
|
|
415
438
|
})
|
|
416
439
|
})
|
|
417
440
|
})
|
|
@@ -508,14 +531,14 @@ var MenuItemImpl = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(functio
|
|
|
508
531
|
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
|
|
509
532
|
const ref = React.useRef(null);
|
|
510
533
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
511
|
-
const _React$
|
|
512
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
513
|
-
isFocused = _React$useState6[0],
|
|
514
|
-
setIsFocused = _React$useState6[1];
|
|
515
|
-
const _React$useState7 = React.useState(""),
|
|
534
|
+
const _React$useState7 = React.useState(false),
|
|
516
535
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
517
|
-
|
|
518
|
-
|
|
536
|
+
isFocused = _React$useState8[0],
|
|
537
|
+
setIsFocused = _React$useState8[1];
|
|
538
|
+
const _React$useState9 = React.useState(""),
|
|
539
|
+
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
540
|
+
textContent = _React$useState0[0],
|
|
541
|
+
setTextContent = _React$useState0[1];
|
|
519
542
|
React.useEffect(() => {
|
|
520
543
|
const menuItem = ref.current;
|
|
521
544
|
if (menuItem) {
|
|
@@ -527,7 +550,7 @@ var MenuItemImpl = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(functio
|
|
|
527
550
|
scope: __scopeMenu,
|
|
528
551
|
disabled,
|
|
529
552
|
textValue: textValue !== null && textValue !== void 0 ? textValue : textContent,
|
|
530
|
-
children: /* @__PURE__ */React.createElement(
|
|
553
|
+
children: /* @__PURE__ */React.createElement(RovingFocusGroupItem, {
|
|
531
554
|
asChild: true,
|
|
532
555
|
...rovingFocusGroupScope,
|
|
533
556
|
focusable: !disabled,
|
|
@@ -666,7 +689,7 @@ var MenuArrow = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function M
|
|
|
666
689
|
const __scopeMenu = props.__scopeMenu,
|
|
667
690
|
arrowProps = _objectWithoutProperties(props, _excluded11);
|
|
668
691
|
const popperScope = usePopperScope(__scopeMenu);
|
|
669
|
-
return /* @__PURE__ */React.createElement(
|
|
692
|
+
return /* @__PURE__ */React.createElement(PopperArrow, {
|
|
670
693
|
...popperScope,
|
|
671
694
|
...arrowProps,
|
|
672
695
|
ref: forwardedRef
|
|
@@ -685,20 +708,20 @@ var MenuSub = /* @__PURE__ */__name(props => {
|
|
|
685
708
|
onOpenChange = props.onOpenChange;
|
|
686
709
|
const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);
|
|
687
710
|
const popperScope = usePopperScope(__scopeMenu);
|
|
688
|
-
const _React$useState9 = React.useState(null),
|
|
689
|
-
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
690
|
-
trigger = _React$useState0[0],
|
|
691
|
-
setTrigger = _React$useState0[1];
|
|
692
711
|
const _React$useState1 = React.useState(null),
|
|
693
712
|
_React$useState10 = _slicedToArray(_React$useState1, 2),
|
|
694
|
-
|
|
695
|
-
|
|
713
|
+
trigger = _React$useState10[0],
|
|
714
|
+
setTrigger = _React$useState10[1];
|
|
715
|
+
const _React$useState11 = React.useState(null),
|
|
716
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
717
|
+
content = _React$useState12[0],
|
|
718
|
+
setContent = _React$useState12[1];
|
|
696
719
|
const handleOpenChange = useCallbackRef(onOpenChange);
|
|
697
720
|
React.useEffect(() => {
|
|
698
721
|
if (parentMenuContext.open === false) handleOpenChange(false);
|
|
699
722
|
return () => handleOpenChange(false);
|
|
700
723
|
}, [parentMenuContext.open, handleOpenChange]);
|
|
701
|
-
return /* @__PURE__ */React.createElement(
|
|
724
|
+
return /* @__PURE__ */React.createElement(Popper, {
|
|
702
725
|
...popperScope,
|
|
703
726
|
children: /* @__PURE__ */React.createElement(MenuProvider, {
|
|
704
727
|
scope: __scopeMenu,
|
|
@@ -856,7 +879,7 @@ var MenuSubContent = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(funct
|
|
|
856
879
|
...subContentProps,
|
|
857
880
|
ref: composedRefs,
|
|
858
881
|
align,
|
|
859
|
-
side: rootContext.dir ===
|
|
882
|
+
side: rootContext.dir === Direction.RTL ? "left" : "right",
|
|
860
883
|
disableOutsidePointerEvents: false,
|
|
861
884
|
disableOutsideScroll: false,
|
|
862
885
|
trapFocus: false,
|
|
@@ -955,21 +978,5 @@ function whenMouse(handler) {
|
|
|
955
978
|
return event => event.pointerType === "mouse" ? handler(event) : void 0;
|
|
956
979
|
}
|
|
957
980
|
__name(whenMouse, "whenMouse");
|
|
958
|
-
var Root3 = Menu;
|
|
959
|
-
var Anchor2 = MenuAnchor;
|
|
960
|
-
var Portal = MenuPortal;
|
|
961
|
-
var Content2 = MenuContent;
|
|
962
|
-
var Group = MenuGroup;
|
|
963
|
-
var Label = MenuLabel;
|
|
964
|
-
var Item2 = MenuItem;
|
|
965
|
-
var CheckboxItem = MenuCheckboxItem;
|
|
966
|
-
var RadioGroup = MenuRadioGroup;
|
|
967
|
-
var RadioItem = MenuRadioItem;
|
|
968
|
-
var ItemIndicator = MenuItemIndicator;
|
|
969
|
-
var Separator = MenuSeparator;
|
|
970
|
-
var Arrow2 = MenuArrow;
|
|
971
|
-
var Sub = MenuSub;
|
|
972
|
-
var SubTrigger = MenuSubTrigger;
|
|
973
|
-
var SubContent = MenuSubContent;
|
|
974
981
|
|
|
975
|
-
export {
|
|
982
|
+
export { MenuAnchor as Anchor, MenuArrow as Arrow, MenuCheckboxItem as CheckboxItem, MenuContent as Content, MenuGroup as Group, MenuItem as Item, MenuItemIndicator as ItemIndicator, MenuLabel as Label, Menu, MenuAnchor, MenuArrow, MenuCheckboxItem, MenuContent, MenuGroup, MenuItem, MenuItemIndicator, MenuLabel, MenuPortal, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuPortal as Portal, MenuRadioGroup as RadioGroup, MenuRadioItem as RadioItem, Menu as Root, MenuSeparator as Separator, MenuSub as Sub, MenuSubContent as SubContent, MenuSubTrigger as SubTrigger, createMenuScope };
|
|
@@ -2,7 +2,7 @@ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWitho
|
|
|
2
2
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useFloating, autoUpdate, offset, shift, limitShift, flip, size, arrow, hide } from '@floating-ui/react-dom';
|
|
5
|
-
import {
|
|
5
|
+
import { Arrow } from '../../react-arrow/dist/index.js';
|
|
6
6
|
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
7
7
|
import { createContextScope } from '../../react-context/dist/index.js';
|
|
8
8
|
import { Primitive } from '../../react-primitive/dist/index.js';
|
|
@@ -21,6 +21,14 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
21
21
|
});
|
|
22
22
|
var SIDE_OPTIONS = ["top", "right", "bottom", "left"];
|
|
23
23
|
var ALIGN_OPTIONS = ["start", "center", "end"];
|
|
24
|
+
var Sticky = {
|
|
25
|
+
Partial: "partial",
|
|
26
|
+
Always: "always"
|
|
27
|
+
};
|
|
28
|
+
var UpdatePositionStrategy = {
|
|
29
|
+
Optimized: "optimized",
|
|
30
|
+
Always: "always"
|
|
31
|
+
};
|
|
24
32
|
var POPPER_NAME = "Popper";
|
|
25
33
|
var _createContextScope = createContextScope(POPPER_NAME),
|
|
26
34
|
_createContextScope2 = _slicedToArray(_createContextScope, 2),
|
|
@@ -111,11 +119,11 @@ var PopperContent = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(functi
|
|
|
111
119
|
_props$collisionPaddi = props.collisionPadding,
|
|
112
120
|
collisionPaddingProp = _props$collisionPaddi === void 0 ? 0 : _props$collisionPaddi,
|
|
113
121
|
_props$sticky = props.sticky,
|
|
114
|
-
sticky = _props$sticky === void 0 ?
|
|
122
|
+
sticky = _props$sticky === void 0 ? Sticky.Partial : _props$sticky,
|
|
115
123
|
_props$hideWhenDetach = props.hideWhenDetached,
|
|
116
124
|
hideWhenDetached = _props$hideWhenDetach === void 0 ? false : _props$hideWhenDetach,
|
|
117
125
|
_props$updatePosition = props.updatePositionStrategy,
|
|
118
|
-
updatePositionStrategy = _props$updatePosition === void 0 ?
|
|
126
|
+
updatePositionStrategy = _props$updatePosition === void 0 ? UpdatePositionStrategy.Optimized : _props$updatePosition,
|
|
119
127
|
onPlaced = props.onPlaced,
|
|
120
128
|
contentProps = _objectWithoutProperties(props, _excluded2);
|
|
121
129
|
const context = usePopperContext(CONTENT_NAME, __scopePopper);
|
|
@@ -156,7 +164,7 @@ var PopperContent = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(functi
|
|
|
156
164
|
args[_key] = arguments[_key];
|
|
157
165
|
}
|
|
158
166
|
const cleanup = autoUpdate(...args, {
|
|
159
|
-
animationFrame: updatePositionStrategy ===
|
|
167
|
+
animationFrame: updatePositionStrategy === UpdatePositionStrategy.Always
|
|
160
168
|
});
|
|
161
169
|
return cleanup;
|
|
162
170
|
}, "whileElementsMounted"),
|
|
@@ -169,7 +177,11 @@ var PopperContent = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(functi
|
|
|
169
177
|
}), avoidCollisions && shift({
|
|
170
178
|
mainAxis: true,
|
|
171
179
|
crossAxis: false,
|
|
172
|
-
|
|
180
|
+
// Spread rather than passing `limiter: undefined`, which
|
|
181
|
+
// `exactOptionalPropertyTypes` rejects for Floating UI's optional option.
|
|
182
|
+
...(sticky === Sticky.Partial ? {
|
|
183
|
+
limiter: limitShift()
|
|
184
|
+
} : {}),
|
|
173
185
|
...detectOverflowOptions
|
|
174
186
|
}), avoidCollisions && flip({
|
|
175
187
|
...detectOverflowOptions
|
|
@@ -195,17 +207,23 @@ var PopperContent = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(functi
|
|
|
195
207
|
}), transformOrigin({
|
|
196
208
|
arrowWidth,
|
|
197
209
|
arrowHeight
|
|
198
|
-
}), hideWhenDetached &&
|
|
210
|
+
}), hideWhenDetached &&
|
|
211
|
+
// `hide` detects whether the anchor (reference) is clipped, so when
|
|
212
|
+
// no explicit `collisionBoundary` is set we omit `boundary` entirely
|
|
213
|
+
// and fall back to Floating UI's default clipping ancestors (e.g. a
|
|
214
|
+
// scrollable menu). This lets an occluded submenu hide once its anchor
|
|
215
|
+
// scrolls out of view (#3237). The collision/size middlewares
|
|
216
|
+
// deliberately keep the viewport-based default to avoid clamping
|
|
217
|
+
// content rendered inside transformed or overflow-clipping portal
|
|
218
|
+
// containers. The key is omitted rather than set to `undefined`
|
|
219
|
+
// because `exactOptionalPropertyTypes` rejects the explicit value.
|
|
220
|
+
hide(hasExplicitBoundaries ? {
|
|
199
221
|
strategy: "referenceHidden",
|
|
200
|
-
...detectOverflowOptions
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
// (#3237). The collision/size middlewares deliberately keep the
|
|
206
|
-
// viewport-based default to avoid clamping content rendered inside
|
|
207
|
-
// transformed or overflow-clipping portal containers.
|
|
208
|
-
boundary: hasExplicitBoundaries ? detectOverflowOptions.boundary : void 0
|
|
222
|
+
...detectOverflowOptions
|
|
223
|
+
} : {
|
|
224
|
+
strategy: "referenceHidden",
|
|
225
|
+
padding: detectOverflowOptions.padding,
|
|
226
|
+
altBoundary: detectOverflowOptions.altBoundary
|
|
209
227
|
})]
|
|
210
228
|
}),
|
|
211
229
|
refs = _useFloating.refs,
|
|
@@ -320,7 +338,7 @@ var PopperArrow = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function
|
|
|
320
338
|
}[contentContext.placedSide],
|
|
321
339
|
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
322
340
|
},
|
|
323
|
-
children: /* @__PURE__ */React.createElement(
|
|
341
|
+
children: /* @__PURE__ */React.createElement(Arrow, {
|
|
324
342
|
...arrowProps,
|
|
325
343
|
ref: forwardedRef,
|
|
326
344
|
style: {
|
|
@@ -391,9 +409,5 @@ function getSideAndAlignFromPlacement(placement) {
|
|
|
391
409
|
return [side, align];
|
|
392
410
|
}
|
|
393
411
|
__name(getSideAndAlignFromPlacement, "getSideAndAlignFromPlacement");
|
|
394
|
-
var Root2 = Popper;
|
|
395
|
-
var Anchor = PopperAnchor;
|
|
396
|
-
var Content = PopperContent;
|
|
397
|
-
var Arrow = PopperArrow;
|
|
398
412
|
|
|
399
|
-
export { ALIGN_OPTIONS, Anchor, Arrow, Content, Popper, PopperAnchor, PopperArrow, PopperContent,
|
|
413
|
+
export { ALIGN_OPTIONS, PopperAnchor as Anchor, PopperArrow as Arrow, PopperContent as Content, Popper, PopperAnchor, PopperArrow, PopperContent, Popper as Root, SIDE_OPTIONS, createPopperScope };
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import * as ReactDOM from 'react-dom';
|
|
4
4
|
import { createSlot } from '../../react-slot/dist/index.js';
|
|
5
5
|
|
|
6
|
+
"use client";
|
|
6
7
|
const _excluded = ["asChild"];
|
|
7
8
|
var __defProp = Object.defineProperty;
|
|
8
9
|
var __name = (target, value) => __defProp(target, "name", {
|
|
@@ -34,6 +35,5 @@ function dispatchDiscreteCustomEvent(target, event) {
|
|
|
34
35
|
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
35
36
|
}
|
|
36
37
|
__name(dispatchDiscreteCustomEvent, "dispatchDiscreteCustomEvent");
|
|
37
|
-
var Root = Primitive;
|
|
38
38
|
|
|
39
|
-
export { Primitive, Root, dispatchDiscreteCustomEvent };
|
|
39
|
+
export { Primitive, Primitive as Root, dispatchDiscreteCustomEvent };
|
|
@@ -37,6 +37,14 @@ var _createContextScope = createContextScope(GROUP_NAME, [createCollectionScope]
|
|
|
37
37
|
_createContextScope2 = _slicedToArray(_createContextScope, 2),
|
|
38
38
|
createRovingFocusGroupContext = _createContextScope2[0],
|
|
39
39
|
createRovingFocusGroupScope = _createContextScope2[1];
|
|
40
|
+
var Orientation = {
|
|
41
|
+
Vertical: "vertical",
|
|
42
|
+
Horizontal: "horizontal"
|
|
43
|
+
};
|
|
44
|
+
var Direction = {
|
|
45
|
+
LTR: "ltr",
|
|
46
|
+
RTL: "rtl"
|
|
47
|
+
};
|
|
40
48
|
var _createRovingFocusGro = createRovingFocusGroupContext(GROUP_NAME),
|
|
41
49
|
_createRovingFocusGro2 = _slicedToArray(_createRovingFocusGro, 2),
|
|
42
50
|
RovingFocusProvider = _createRovingFocusGro2[0],
|
|
@@ -229,15 +237,19 @@ var MAP_KEY_TO_FOCUS_INTENT = {
|
|
|
229
237
|
End: "last"
|
|
230
238
|
};
|
|
231
239
|
function getDirectionAwareKey(key, dir) {
|
|
232
|
-
if (dir !==
|
|
240
|
+
if (dir !== Direction.RTL) return key;
|
|
233
241
|
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
234
242
|
}
|
|
235
243
|
__name(getDirectionAwareKey, "getDirectionAwareKey");
|
|
236
244
|
function getFocusIntent(event, orientation, dir) {
|
|
237
245
|
var _context, _context2;
|
|
238
246
|
const key = getDirectionAwareKey(event.key, dir);
|
|
239
|
-
if (orientation ===
|
|
240
|
-
|
|
247
|
+
if (orientation === Orientation.Vertical && _includesInstanceProperty(_context = ["ArrowLeft", "ArrowRight"]).call(_context, key)) {
|
|
248
|
+
return void 0;
|
|
249
|
+
}
|
|
250
|
+
if (orientation === Orientation.Horizontal && _includesInstanceProperty(_context2 = ["ArrowUp", "ArrowDown"]).call(_context2, key)) {
|
|
251
|
+
return void 0;
|
|
252
|
+
}
|
|
241
253
|
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
242
254
|
}
|
|
243
255
|
__name(getFocusIntent, "getFocusIntent");
|
|
@@ -257,7 +269,5 @@ function wrapArray(array, startIndex) {
|
|
|
257
269
|
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
258
270
|
}
|
|
259
271
|
__name(wrapArray, "wrapArray");
|
|
260
|
-
var Root = RovingFocusGroup;
|
|
261
|
-
var Item = RovingFocusGroupItem;
|
|
262
272
|
|
|
263
|
-
export { Item, Root, RovingFocusGroup, RovingFocusGroupItem, createRovingFocusGroupScope };
|
|
273
|
+
export { RovingFocusGroupItem as Item, RovingFocusGroup as Root, RovingFocusGroup, RovingFocusGroupItem, createRovingFocusGroupScope };
|
|
@@ -17,16 +17,14 @@ function createSlot(ownerName) {
|
|
|
17
17
|
let slottableElement = null;
|
|
18
18
|
let hasSlottable = false;
|
|
19
19
|
const newChildren = [];
|
|
20
|
-
|
|
21
|
-
children = use(children._payload);
|
|
22
|
-
}
|
|
20
|
+
children = useUnwrappedLazy(children);
|
|
23
21
|
React.Children.forEach(children, maybeSlottable => {
|
|
24
22
|
if (isSlottable(maybeSlottable)) {
|
|
25
23
|
var _slottableElement;
|
|
26
24
|
hasSlottable = true;
|
|
27
25
|
const slottable = maybeSlottable;
|
|
28
26
|
let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
|
|
29
|
-
|
|
27
|
+
while (isLazyComponent(child) && typeof use === "function") {
|
|
30
28
|
child = use(child._payload);
|
|
31
29
|
}
|
|
32
30
|
slottableElement = getSlottableElementFromSlottable(slottable, child);
|
|
@@ -76,9 +74,8 @@ __name(createSlottable, "createSlottable");
|
|
|
76
74
|
var Slottable = /* @__PURE__ */createSlottable("Slottable");
|
|
77
75
|
var getSlottableElementFromSlottable = /* @__PURE__ */__name((slottable, child) => {
|
|
78
76
|
if ("child" in slottable.props) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return /*#__PURE__*/React.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
|
|
77
|
+
if (! /*#__PURE__*/React.isValidElement(child)) return null;
|
|
78
|
+
return /*#__PURE__*/React.cloneElement(child, void 0, slottable.props.children(child.props.children));
|
|
82
79
|
}
|
|
83
80
|
return /*#__PURE__*/React.isValidElement(child) ? child : null;
|
|
84
81
|
}, "getSlottableElementFromSlottable");
|
|
@@ -107,6 +104,8 @@ function mergeProps(slotProps, childProps) {
|
|
|
107
104
|
};
|
|
108
105
|
} else if (propName === "className") {
|
|
109
106
|
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
107
|
+
} else if (propName === "aria-describedby") {
|
|
108
|
+
overrideProps[propName] = concatAriaDescribedby(childPropValue, slotPropValue);
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
return {
|
|
@@ -143,6 +142,28 @@ function isPromiseLike(value) {
|
|
|
143
142
|
return typeof value === "object" && value !== null && "then" in value;
|
|
144
143
|
}
|
|
145
144
|
__name(isPromiseLike, "isPromiseLike");
|
|
145
|
+
function useUnwrappedLazy(value) {
|
|
146
|
+
let unwrapped = value;
|
|
147
|
+
while (isLazyComponent(unwrapped) && typeof use === "function") {
|
|
148
|
+
unwrapped = use(unwrapped._payload);
|
|
149
|
+
}
|
|
150
|
+
return unwrapped;
|
|
151
|
+
}
|
|
152
|
+
__name(useUnwrappedLazy, "useUnwrappedLazy");
|
|
153
|
+
function concatAriaDescribedby() {
|
|
154
|
+
const ids = /* @__PURE__ */new Set();
|
|
155
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
156
|
+
values[_key] = arguments[_key];
|
|
157
|
+
}
|
|
158
|
+
for (const value of values) {
|
|
159
|
+
if (typeof value !== "string") continue;
|
|
160
|
+
for (const id of String(value).trim().split(/\s+/)) {
|
|
161
|
+
if (id) ids.add(id);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return ids.size > 0 ? Array.from(ids).join(" ") : void 0;
|
|
165
|
+
}
|
|
166
|
+
__name(concatAriaDescribedby, "concatAriaDescribedby");
|
|
146
167
|
var createSlotError = /* @__PURE__ */__name(ownerName => {
|
|
147
168
|
return "".concat(ownerName, " failed to slot onto its children. Expected a single React element child or `Slottable`.");
|
|
148
169
|
}, "createSlotError");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -5,11 +6,18 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
5
6
|
value,
|
|
6
7
|
configurable: true
|
|
7
8
|
});
|
|
9
|
+
var useReactInsertionEffect = React[" useInsertionEffect ".trim().toString()];
|
|
8
10
|
function useCallbackRef(callback) {
|
|
9
11
|
const callbackRef = React.useRef(callback);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
if (typeof useReactInsertionEffect === "function") {
|
|
13
|
+
useReactInsertionEffect(() => {
|
|
14
|
+
callbackRef.current = callback;
|
|
15
|
+
});
|
|
16
|
+
} else {
|
|
17
|
+
useLayoutEffect2(() => {
|
|
18
|
+
callbackRef.current = callback;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
13
21
|
return React.useMemo(() => function () {
|
|
14
22
|
var _callbackRef$current;
|
|
15
23
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|