@qualtrics/ui-react 2.85.2 → 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 +25 -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 +9 -6
- package/dist/__node_modules/@radix-ui/react-collection/dist/index.js +263 -153
- 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 +16 -6
- package/dist/__node_modules/@radix-ui/react-dismissable-layer/dist/index.js +172 -43
- package/dist/__node_modules/@radix-ui/react-dropdown-menu/dist/index.js +76 -95
- 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 +111 -30
- package/dist/__node_modules/@radix-ui/react-id/dist/index.js +6 -0
- package/dist/__node_modules/@radix-ui/react-menu/dist/index.js +232 -197
- package/dist/__node_modules/@radix-ui/react-popper/dist/index.js +104 -49
- package/dist/__node_modules/@radix-ui/react-portal/dist/index.js +10 -8
- package/dist/__node_modules/@radix-ui/react-presence/dist/index.js +72 -14
- package/dist/__node_modules/@radix-ui/react-primitive/dist/index.js +8 -2
- package/dist/__node_modules/@radix-ui/react-roving-focus/dist/index.js +52 -18
- package/dist/__node_modules/@radix-ui/react-slot/dist/index.js +106 -54
- package/dist/__node_modules/@radix-ui/react-use-callback-ref/dist/index.js +17 -4
- 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 +28 -15
- package/dist/__shared/cjs/{index-e03dac36.js → index-bd03241f.js} +213 -208
- package/dist/__shared/cjs/{index-507024ee.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/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/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/Hooks/useFlyoutNode.js +48 -0
- package/dist/next/Menu/Menu.js +2 -2
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuButton.js +6 -5
- package/dist/next/Menu/MenuItem.js +5 -4
- package/dist/next/Menu/MenuPane.js +20 -19
- package/dist/next/Menu/PaneChildren.js +15 -10
- package/dist/next/Menu/SubMenu.js +22 -21
- 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 +1581 -850
- package/dist/translations-en.js +71 -71
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/icons/package.json +4 -4
- package/next/package.json +5 -5
- package/package.json +16 -16
- package/dist/__node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -23
|
@@ -4,18 +4,18 @@ import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/ins
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { composeEventHandlers } from '../../primitive/dist/index.js';
|
|
6
6
|
import { createCollection } from '../../react-collection/dist/index.js';
|
|
7
|
-
import { useComposedRefs
|
|
7
|
+
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
8
8
|
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';
|
|
@@ -36,7 +36,16 @@ const _excluded = ["__scopeMenu"],
|
|
|
36
36
|
_excluded1 = ["__scopeMenu", "forceMount"],
|
|
37
37
|
_excluded10 = ["__scopeMenu"],
|
|
38
38
|
_excluded11 = ["__scopeMenu"],
|
|
39
|
-
_excluded12 = ["forceMount"];
|
|
39
|
+
_excluded12 = ["forceMount", "align"];
|
|
40
|
+
var __defProp = Object.defineProperty;
|
|
41
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
42
|
+
value,
|
|
43
|
+
configurable: true
|
|
44
|
+
});
|
|
45
|
+
var Direction = {
|
|
46
|
+
LTR: "ltr",
|
|
47
|
+
RTL: "rtl"
|
|
48
|
+
};
|
|
40
49
|
var SELECTION_KEYS = ["Enter", " "];
|
|
41
50
|
var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"];
|
|
42
51
|
var LAST_KEYS = ["ArrowUp", "PageDown", "End"];
|
|
@@ -69,7 +78,7 @@ var _createMenuContext3 = createMenuContext(MENU_NAME),
|
|
|
69
78
|
_createMenuContext4 = _slicedToArray(_createMenuContext3, 2),
|
|
70
79
|
MenuRootProvider = _createMenuContext4[0],
|
|
71
80
|
useMenuRootContext = _createMenuContext4[1];
|
|
72
|
-
var Menu = props => {
|
|
81
|
+
var Menu = /* @__PURE__ */__name(props => {
|
|
73
82
|
const __scopeMenu = props.__scopeMenu,
|
|
74
83
|
_props$open = props.open,
|
|
75
84
|
open = _props$open === void 0 ? false : _props$open,
|
|
@@ -87,7 +96,7 @@ var Menu = props => {
|
|
|
87
96
|
const handleOpenChange = useCallbackRef(onOpenChange);
|
|
88
97
|
const direction = useDirection(dir);
|
|
89
98
|
React.useEffect(() => {
|
|
90
|
-
const handleKeyDown = () => {
|
|
99
|
+
const handleKeyDown = /* @__PURE__ */__name(() => {
|
|
91
100
|
isUsingKeyboardRef.current = true;
|
|
92
101
|
document.addEventListener("pointerdown", handlePointer, {
|
|
93
102
|
capture: true,
|
|
@@ -97,8 +106,8 @@ var Menu = props => {
|
|
|
97
106
|
capture: true,
|
|
98
107
|
once: true
|
|
99
108
|
});
|
|
100
|
-
};
|
|
101
|
-
const handlePointer = () => isUsingKeyboardRef.current = false;
|
|
109
|
+
}, "handleKeyDown");
|
|
110
|
+
const handlePointer = /* @__PURE__ */__name(() => isUsingKeyboardRef.current = false, "handlePointer");
|
|
102
111
|
document.addEventListener("keydown", handleKeyDown, {
|
|
103
112
|
capture: true
|
|
104
113
|
});
|
|
@@ -114,7 +123,15 @@ var Menu = props => {
|
|
|
114
123
|
});
|
|
115
124
|
};
|
|
116
125
|
}, []);
|
|
117
|
-
|
|
126
|
+
React.useEffect(() => {
|
|
127
|
+
if (!open) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const handleBlur = /* @__PURE__ */__name(() => handleOpenChange(false), "handleBlur");
|
|
131
|
+
window.addEventListener("blur", handleBlur);
|
|
132
|
+
return () => window.removeEventListener("blur", handleBlur);
|
|
133
|
+
}, [open, handleOpenChange]);
|
|
134
|
+
return /* @__PURE__ */React.createElement(Popper, {
|
|
118
135
|
...popperScope,
|
|
119
136
|
children: /* @__PURE__ */React.createElement(MenuProvider, {
|
|
120
137
|
scope: __scopeMenu,
|
|
@@ -132,20 +149,17 @@ var Menu = props => {
|
|
|
132
149
|
})
|
|
133
150
|
})
|
|
134
151
|
});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
var ANCHOR_NAME = "MenuAnchor";
|
|
138
|
-
var MenuAnchor = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
152
|
+
}, "Menu");
|
|
153
|
+
var MenuAnchor = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuAnchor2(props, forwardedRef) {
|
|
139
154
|
const __scopeMenu = props.__scopeMenu,
|
|
140
155
|
anchorProps = _objectWithoutProperties(props, _excluded);
|
|
141
156
|
const popperScope = usePopperScope(__scopeMenu);
|
|
142
|
-
return /* @__PURE__ */React.createElement(
|
|
157
|
+
return /* @__PURE__ */React.createElement(PopperAnchor, {
|
|
143
158
|
...popperScope,
|
|
144
159
|
...anchorProps,
|
|
145
160
|
ref: forwardedRef
|
|
146
161
|
});
|
|
147
|
-
});
|
|
148
|
-
MenuAnchor.displayName = ANCHOR_NAME;
|
|
162
|
+
}, "MenuAnchor"));
|
|
149
163
|
var PORTAL_NAME = "MenuPortal";
|
|
150
164
|
var _createMenuContext5 = createMenuContext(PORTAL_NAME, {
|
|
151
165
|
forceMount: void 0
|
|
@@ -153,7 +167,7 @@ var _createMenuContext5 = createMenuContext(PORTAL_NAME, {
|
|
|
153
167
|
_createMenuContext6 = _slicedToArray(_createMenuContext5, 2),
|
|
154
168
|
PortalProvider = _createMenuContext6[0],
|
|
155
169
|
usePortalContext = _createMenuContext6[1];
|
|
156
|
-
var MenuPortal = props => {
|
|
170
|
+
var MenuPortal = /* @__PURE__ */__name(props => {
|
|
157
171
|
const __scopeMenu = props.__scopeMenu,
|
|
158
172
|
forceMount = props.forceMount,
|
|
159
173
|
children = props.children,
|
|
@@ -164,21 +178,20 @@ var MenuPortal = props => {
|
|
|
164
178
|
forceMount,
|
|
165
179
|
children: /* @__PURE__ */React.createElement(Presence, {
|
|
166
180
|
present: forceMount || context.open,
|
|
167
|
-
children: /* @__PURE__ */React.createElement(Portal
|
|
181
|
+
children: /* @__PURE__ */React.createElement(Portal, {
|
|
168
182
|
asChild: true,
|
|
169
183
|
container,
|
|
170
184
|
children
|
|
171
185
|
})
|
|
172
186
|
})
|
|
173
187
|
});
|
|
174
|
-
};
|
|
175
|
-
MenuPortal.displayName = PORTAL_NAME;
|
|
188
|
+
}, "MenuPortal");
|
|
176
189
|
var CONTENT_NAME = "MenuContent";
|
|
177
190
|
var _createMenuContext7 = createMenuContext(CONTENT_NAME),
|
|
178
191
|
_createMenuContext8 = _slicedToArray(_createMenuContext7, 2),
|
|
179
192
|
MenuContentProvider = _createMenuContext8[0],
|
|
180
193
|
useMenuContentContext = _createMenuContext8[1];
|
|
181
|
-
var MenuContent =
|
|
194
|
+
var MenuContent = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuContent2(props, forwardedRef) {
|
|
182
195
|
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);
|
|
183
196
|
const _props$forceMount = props.forceMount,
|
|
184
197
|
forceMount = _props$forceMount === void 0 ? portalContext.forceMount : _props$forceMount,
|
|
@@ -201,8 +214,11 @@ var MenuContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
201
214
|
})
|
|
202
215
|
})
|
|
203
216
|
});
|
|
204
|
-
});
|
|
205
|
-
var MenuRootContentModal =
|
|
217
|
+
}, "MenuContent"));
|
|
218
|
+
var MenuRootContentModal = /* @__PURE__ */React.forwardRef(
|
|
219
|
+
// blank line to reduce diff noise
|
|
220
|
+
/* @__PURE__ */
|
|
221
|
+
__name(function MenuRootContentModal2(props, forwardedRef) {
|
|
206
222
|
const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);
|
|
207
223
|
const ref = React.useRef(null);
|
|
208
224
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
@@ -221,8 +237,8 @@ var MenuRootContentModal = /*#__PURE__*/React.forwardRef((props, forwardedRef) =
|
|
|
221
237
|
}),
|
|
222
238
|
onDismiss: () => context.onOpenChange(false)
|
|
223
239
|
});
|
|
224
|
-
});
|
|
225
|
-
var MenuRootContentNonModal =
|
|
240
|
+
}, "MenuRootContentModal"));
|
|
241
|
+
var MenuRootContentNonModal = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuRootContentNonModal2(props, forwardedRef) {
|
|
226
242
|
const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);
|
|
227
243
|
return /* @__PURE__ */React.createElement(MenuContentImpl, {
|
|
228
244
|
...props,
|
|
@@ -232,9 +248,12 @@ var MenuRootContentNonModal = /*#__PURE__*/React.forwardRef((props, forwardedRef
|
|
|
232
248
|
disableOutsideScroll: false,
|
|
233
249
|
onDismiss: () => context.onOpenChange(false)
|
|
234
250
|
});
|
|
235
|
-
});
|
|
251
|
+
}, "MenuRootContentNonModal"));
|
|
236
252
|
var Slot = createSlot("MenuContent.ScrollLock");
|
|
237
|
-
var MenuContentImpl =
|
|
253
|
+
var MenuContentImpl = /* @__PURE__ */React.forwardRef(
|
|
254
|
+
// blank line to reduce diff noise
|
|
255
|
+
/* @__PURE__ */
|
|
256
|
+
__name(function MenuContentImpl2(props, forwardedRef) {
|
|
238
257
|
const __scopeMenu = props.__scopeMenu,
|
|
239
258
|
_props$loop = props.loop,
|
|
240
259
|
loop = _props$loop === void 0 ? false : _props$loop,
|
|
@@ -260,19 +279,32 @@ var MenuContentImpl = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
260
279
|
currentItemId = _React$useState4[0],
|
|
261
280
|
setCurrentItemId = _React$useState4[1];
|
|
262
281
|
const contentRef = React.useRef(null);
|
|
263
|
-
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);
|
|
264
292
|
const timerRef = React.useRef(0);
|
|
265
293
|
const searchRef = React.useRef("");
|
|
266
294
|
const pointerGraceTimerRef = React.useRef(0);
|
|
267
295
|
const pointerGraceIntentRef = React.useRef(null);
|
|
268
296
|
const pointerDirRef = React.useRef("right");
|
|
269
297
|
const lastPointerXRef = React.useRef(0);
|
|
298
|
+
const shards = React.useMemo(() => disableOutsideScroll ? [contentRef, ...branchNodes.map(node => ({
|
|
299
|
+
current: node
|
|
300
|
+
}))] : [], [contentRef, branchNodes, disableOutsideScroll]);
|
|
270
301
|
const ScrollLockWrapper = disableOutsideScroll ? ReactRemoveScroll : React.Fragment;
|
|
271
302
|
const scrollLockWrapperProps = disableOutsideScroll ? {
|
|
272
303
|
as: Slot,
|
|
273
|
-
allowPinchZoom: true
|
|
304
|
+
allowPinchZoom: true,
|
|
305
|
+
shards
|
|
274
306
|
} : void 0;
|
|
275
|
-
const handleTypeaheadSearch = key => {
|
|
307
|
+
const handleTypeaheadSearch = /* @__PURE__ */__name(key => {
|
|
276
308
|
var _items$find, _items$find2;
|
|
277
309
|
const search = searchRef.current + key;
|
|
278
310
|
const items = getItems().filter(item => !item.disabled);
|
|
@@ -281,15 +313,17 @@ var MenuContentImpl = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
281
313
|
const values = items.map(item => item.textValue);
|
|
282
314
|
const nextMatch = getNextMatch(values, search, currentMatch);
|
|
283
315
|
const newItem = (_items$find2 = items.find(item => item.textValue === nextMatch)) === null || _items$find2 === void 0 ? void 0 : _items$find2.ref.current;
|
|
284
|
-
|
|
316
|
+
function updateSearch(value) {
|
|
285
317
|
searchRef.current = value;
|
|
286
318
|
window.clearTimeout(timerRef.current);
|
|
287
319
|
if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3);
|
|
288
|
-
}
|
|
320
|
+
}
|
|
321
|
+
__name(updateSearch, "updateSearch");
|
|
322
|
+
updateSearch(search);
|
|
289
323
|
if (newItem) {
|
|
290
324
|
setTimeout(() => newItem.focus());
|
|
291
325
|
}
|
|
292
|
-
};
|
|
326
|
+
}, "handleTypeaheadSearch");
|
|
293
327
|
React.useEffect(() => {
|
|
294
328
|
return () => window.clearTimeout(timerRef.current);
|
|
295
329
|
}, []);
|
|
@@ -318,95 +352,97 @@ var MenuContentImpl = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
318
352
|
onPointerGraceIntentChange: React.useCallback(intent => {
|
|
319
353
|
pointerGraceIntentRef.current = intent;
|
|
320
354
|
}, []),
|
|
321
|
-
children: /* @__PURE__ */React.createElement(
|
|
322
|
-
|
|
323
|
-
children: /* @__PURE__ */React.createElement(
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
onMountAutoFocus: composeEventHandlers(onOpenAutoFocus, event => {
|
|
327
|
-
var _contentRef$current2;
|
|
328
|
-
event.preventDefault();
|
|
329
|
-
(_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 || _contentRef$current2.focus({
|
|
330
|
-
preventScroll: true
|
|
331
|
-
});
|
|
332
|
-
}),
|
|
333
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
334
|
-
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, {
|
|
335
360
|
asChild: true,
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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, {
|
|
343
372
|
asChild: true,
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
preventScrollOnEntryFocus: true,
|
|
354
|
-
children: /* @__PURE__ */React.createElement(Content, {
|
|
355
|
-
role: "menu",
|
|
356
|
-
"aria-orientation": "vertical",
|
|
357
|
-
"data-state": getOpenState(context.open),
|
|
358
|
-
"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,
|
|
359
382
|
dir: rootContext.dir,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
},
|
|
367
|
-
onKeyDown: composeEventHandlers(contentProps.onKeyDown, event => {
|
|
368
|
-
const target = event.target;
|
|
369
|
-
const isKeyDownInside = target.closest("[data-radix-menu-content]") === event.currentTarget;
|
|
370
|
-
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
371
|
-
const isCharacterKey = event.key.length === 1;
|
|
372
|
-
if (isKeyDownInside) {
|
|
373
|
-
if (event.key === "Tab") event.preventDefault();
|
|
374
|
-
if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);
|
|
375
|
-
}
|
|
376
|
-
const content = contentRef.current;
|
|
377
|
-
if (event.target !== content) return;
|
|
378
|
-
if (!_includesInstanceProperty(FIRST_LAST_KEYS).call(FIRST_LAST_KEYS, event.key)) return;
|
|
379
|
-
event.preventDefault();
|
|
380
|
-
const items = getItems().filter(item => !item.disabled);
|
|
381
|
-
const candidateNodes = items.map(item => item.ref.current);
|
|
382
|
-
if (_includesInstanceProperty(LAST_KEYS).call(LAST_KEYS, event.key)) candidateNodes.reverse();
|
|
383
|
-
focusFirst(candidateNodes);
|
|
383
|
+
orientation: "vertical",
|
|
384
|
+
loop,
|
|
385
|
+
currentTabStopId: currentItemId,
|
|
386
|
+
onCurrentTabStopIdChange: setCurrentItemId,
|
|
387
|
+
onEntryFocus: composeEventHandlers(onEntryFocus, event => {
|
|
388
|
+
if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
|
|
384
389
|
}),
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}
|
|
399
|
-
|
|
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
|
+
})
|
|
400
438
|
})
|
|
401
439
|
})
|
|
402
440
|
})
|
|
403
441
|
})
|
|
404
442
|
})
|
|
405
443
|
});
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
var GROUP_NAME = "MenuGroup";
|
|
409
|
-
var MenuGroup = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
444
|
+
}, "MenuContentImpl"));
|
|
445
|
+
var MenuGroup = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuGroup2(props, forwardedRef) {
|
|
410
446
|
const __scopeMenu = props.__scopeMenu,
|
|
411
447
|
groupProps = _objectWithoutProperties(props, _excluded4);
|
|
412
448
|
return /* @__PURE__ */React.createElement(Primitive.div, {
|
|
@@ -414,21 +450,21 @@ var MenuGroup = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
414
450
|
...groupProps,
|
|
415
451
|
ref: forwardedRef
|
|
416
452
|
});
|
|
417
|
-
});
|
|
418
|
-
|
|
419
|
-
var LABEL_NAME = "MenuLabel";
|
|
420
|
-
var MenuLabel = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
453
|
+
}, "MenuGroup"));
|
|
454
|
+
var MenuLabel = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuLabel2(props, forwardedRef) {
|
|
421
455
|
const __scopeMenu = props.__scopeMenu,
|
|
422
456
|
labelProps = _objectWithoutProperties(props, _excluded5);
|
|
423
457
|
return /* @__PURE__ */React.createElement(Primitive.div, {
|
|
424
458
|
...labelProps,
|
|
425
459
|
ref: forwardedRef
|
|
426
460
|
});
|
|
427
|
-
});
|
|
428
|
-
MenuLabel.displayName = LABEL_NAME;
|
|
461
|
+
}, "MenuLabel"));
|
|
429
462
|
var ITEM_NAME = "MenuItem";
|
|
430
463
|
var ITEM_SELECT = "menu.itemSelect";
|
|
431
|
-
var MenuItem =
|
|
464
|
+
var MenuItem = /* @__PURE__ */React.forwardRef(
|
|
465
|
+
// blank line to reduce diff noise
|
|
466
|
+
/* @__PURE__ */
|
|
467
|
+
__name(function MenuItem2(props, forwardedRef) {
|
|
432
468
|
const _props$disabled = props.disabled,
|
|
433
469
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
434
470
|
onSelect = props.onSelect,
|
|
@@ -438,7 +474,7 @@ var MenuItem = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
438
474
|
const contentContext = useMenuContentContext(ITEM_NAME, props.__scopeMenu);
|
|
439
475
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
440
476
|
const isPointerDownRef = React.useRef(false);
|
|
441
|
-
const handleSelect = () => {
|
|
477
|
+
const handleSelect = /* @__PURE__ */__name(() => {
|
|
442
478
|
const menuItem = ref.current;
|
|
443
479
|
if (!disabled && menuItem) {
|
|
444
480
|
const itemSelectEvent = new CustomEvent(ITEM_SELECT, {
|
|
@@ -455,7 +491,7 @@ var MenuItem = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
455
491
|
rootContext.onClose();
|
|
456
492
|
}
|
|
457
493
|
}
|
|
458
|
-
};
|
|
494
|
+
}, "handleSelect");
|
|
459
495
|
return /* @__PURE__ */React.createElement(MenuItemImpl, {
|
|
460
496
|
...itemProps,
|
|
461
497
|
ref: composedRefs,
|
|
@@ -471,17 +507,21 @@ var MenuItem = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
471
507
|
if (!isPointerDownRef.current) (_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 || _event$currentTarget.click();
|
|
472
508
|
}),
|
|
473
509
|
onKeyDown: composeEventHandlers(props.onKeyDown, event => {
|
|
510
|
+
if (disabled || event.target !== event.currentTarget) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
474
513
|
const isTypingAhead = contentContext.searchRef.current !== "";
|
|
475
|
-
if (
|
|
514
|
+
if (isTypingAhead && event.key === " ") {
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
476
517
|
if (_includesInstanceProperty(SELECTION_KEYS).call(SELECTION_KEYS, event.key)) {
|
|
477
518
|
event.currentTarget.click();
|
|
478
519
|
event.preventDefault();
|
|
479
520
|
}
|
|
480
521
|
})
|
|
481
522
|
});
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
var MenuItemImpl = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
523
|
+
}, "MenuItem"));
|
|
524
|
+
var MenuItemImpl = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuItemImpl2(props, forwardedRef) {
|
|
485
525
|
const __scopeMenu = props.__scopeMenu,
|
|
486
526
|
_props$disabled2 = props.disabled,
|
|
487
527
|
disabled = _props$disabled2 === void 0 ? false : _props$disabled2,
|
|
@@ -491,14 +531,14 @@ var MenuItemImpl = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
491
531
|
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
|
|
492
532
|
const ref = React.useRef(null);
|
|
493
533
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
494
|
-
const _React$
|
|
495
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
496
|
-
isFocused = _React$useState6[0],
|
|
497
|
-
setIsFocused = _React$useState6[1];
|
|
498
|
-
const _React$useState7 = React.useState(""),
|
|
534
|
+
const _React$useState7 = React.useState(false),
|
|
499
535
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
500
|
-
|
|
501
|
-
|
|
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];
|
|
502
542
|
React.useEffect(() => {
|
|
503
543
|
const menuItem = ref.current;
|
|
504
544
|
if (menuItem) {
|
|
@@ -510,7 +550,7 @@ var MenuItemImpl = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
510
550
|
scope: __scopeMenu,
|
|
511
551
|
disabled,
|
|
512
552
|
textValue: textValue !== null && textValue !== void 0 ? textValue : textContent,
|
|
513
|
-
children: /* @__PURE__ */React.createElement(
|
|
553
|
+
children: /* @__PURE__ */React.createElement(RovingFocusGroupItem, {
|
|
514
554
|
asChild: true,
|
|
515
555
|
...rovingFocusGroupScope,
|
|
516
556
|
focusable: !disabled,
|
|
@@ -540,9 +580,11 @@ var MenuItemImpl = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
540
580
|
})
|
|
541
581
|
})
|
|
542
582
|
});
|
|
543
|
-
});
|
|
544
|
-
var
|
|
545
|
-
|
|
583
|
+
}, "MenuItemImpl"));
|
|
584
|
+
var MenuCheckboxItem = /* @__PURE__ */React.forwardRef(
|
|
585
|
+
// blank line to reduce diff noise
|
|
586
|
+
/* @__PURE__ */
|
|
587
|
+
__name(function MenuCheckboxItem2(props, forwardedRef) {
|
|
546
588
|
const _props$checked = props.checked,
|
|
547
589
|
checked = _props$checked === void 0 ? false : _props$checked,
|
|
548
590
|
onCheckedChange = props.onCheckedChange,
|
|
@@ -561,17 +603,16 @@ var MenuCheckboxItem = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
561
603
|
})
|
|
562
604
|
})
|
|
563
605
|
});
|
|
564
|
-
});
|
|
565
|
-
MenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
606
|
+
}, "MenuCheckboxItem"));
|
|
566
607
|
var RADIO_GROUP_NAME = "MenuRadioGroup";
|
|
567
608
|
var _createMenuContext9 = createMenuContext(RADIO_GROUP_NAME, {
|
|
568
609
|
value: void 0,
|
|
569
|
-
onValueChange: () => {}
|
|
610
|
+
onValueChange: /* @__PURE__ */__name(() => {}, "onValueChange")
|
|
570
611
|
}),
|
|
571
612
|
_createMenuContext0 = _slicedToArray(_createMenuContext9, 2),
|
|
572
613
|
RadioGroupProvider = _createMenuContext0[0],
|
|
573
614
|
useRadioGroupContext = _createMenuContext0[1];
|
|
574
|
-
var MenuRadioGroup =
|
|
615
|
+
var MenuRadioGroup = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuRadioGroup2(props, forwardedRef) {
|
|
575
616
|
const value = props.value,
|
|
576
617
|
onValueChange = props.onValueChange,
|
|
577
618
|
groupProps = _objectWithoutProperties(props, _excluded9);
|
|
@@ -585,10 +626,9 @@ var MenuRadioGroup = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
585
626
|
ref: forwardedRef
|
|
586
627
|
})
|
|
587
628
|
});
|
|
588
|
-
});
|
|
589
|
-
MenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
629
|
+
}, "MenuRadioGroup"));
|
|
590
630
|
var RADIO_ITEM_NAME = "MenuRadioItem";
|
|
591
|
-
var MenuRadioItem =
|
|
631
|
+
var MenuRadioItem = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuRadioItem2(props, forwardedRef) {
|
|
592
632
|
const value = props.value,
|
|
593
633
|
radioItemProps = _objectWithoutProperties(props, _excluded0);
|
|
594
634
|
const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu);
|
|
@@ -610,8 +650,7 @@ var MenuRadioItem = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
610
650
|
})
|
|
611
651
|
})
|
|
612
652
|
});
|
|
613
|
-
});
|
|
614
|
-
MenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
653
|
+
}, "MenuRadioItem"));
|
|
615
654
|
var ITEM_INDICATOR_NAME = "MenuItemIndicator";
|
|
616
655
|
var _createMenuContext1 = createMenuContext(ITEM_INDICATOR_NAME, {
|
|
617
656
|
checked: false
|
|
@@ -619,7 +658,10 @@ var _createMenuContext1 = createMenuContext(ITEM_INDICATOR_NAME, {
|
|
|
619
658
|
_createMenuContext10 = _slicedToArray(_createMenuContext1, 2),
|
|
620
659
|
ItemIndicatorProvider = _createMenuContext10[0],
|
|
621
660
|
useItemIndicatorContext = _createMenuContext10[1];
|
|
622
|
-
var MenuItemIndicator =
|
|
661
|
+
var MenuItemIndicator = /* @__PURE__ */React.forwardRef(
|
|
662
|
+
// blank line to reduce diff noise
|
|
663
|
+
/* @__PURE__ */
|
|
664
|
+
__name(function MenuItemIndicator2(props, forwardedRef) {
|
|
623
665
|
const __scopeMenu = props.__scopeMenu,
|
|
624
666
|
forceMount = props.forceMount,
|
|
625
667
|
itemIndicatorProps = _objectWithoutProperties(props, _excluded1);
|
|
@@ -632,10 +674,8 @@ var MenuItemIndicator = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
632
674
|
"data-state": getCheckedState(indicatorContext.checked)
|
|
633
675
|
})
|
|
634
676
|
});
|
|
635
|
-
});
|
|
636
|
-
|
|
637
|
-
var SEPARATOR_NAME = "MenuSeparator";
|
|
638
|
-
var MenuSeparator = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
677
|
+
}, "MenuItemIndicator"));
|
|
678
|
+
var MenuSeparator = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuSeparator2(props, forwardedRef) {
|
|
639
679
|
const __scopeMenu = props.__scopeMenu,
|
|
640
680
|
separatorProps = _objectWithoutProperties(props, _excluded10);
|
|
641
681
|
return /* @__PURE__ */React.createElement(Primitive.div, {
|
|
@@ -644,26 +684,23 @@ var MenuSeparator = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
644
684
|
...separatorProps,
|
|
645
685
|
ref: forwardedRef
|
|
646
686
|
});
|
|
647
|
-
});
|
|
648
|
-
|
|
649
|
-
var ARROW_NAME = "MenuArrow";
|
|
650
|
-
var MenuArrow = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
687
|
+
}, "MenuSeparator"));
|
|
688
|
+
var MenuArrow = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuArrow2(props, forwardedRef) {
|
|
651
689
|
const __scopeMenu = props.__scopeMenu,
|
|
652
690
|
arrowProps = _objectWithoutProperties(props, _excluded11);
|
|
653
691
|
const popperScope = usePopperScope(__scopeMenu);
|
|
654
|
-
return /* @__PURE__ */React.createElement(
|
|
692
|
+
return /* @__PURE__ */React.createElement(PopperArrow, {
|
|
655
693
|
...popperScope,
|
|
656
694
|
...arrowProps,
|
|
657
695
|
ref: forwardedRef
|
|
658
696
|
});
|
|
659
|
-
});
|
|
660
|
-
MenuArrow.displayName = ARROW_NAME;
|
|
697
|
+
}, "MenuArrow"));
|
|
661
698
|
var SUB_NAME = "MenuSub";
|
|
662
699
|
var _createMenuContext11 = createMenuContext(SUB_NAME),
|
|
663
700
|
_createMenuContext12 = _slicedToArray(_createMenuContext11, 2),
|
|
664
701
|
MenuSubProvider = _createMenuContext12[0],
|
|
665
702
|
useMenuSubContext = _createMenuContext12[1];
|
|
666
|
-
var MenuSub = props => {
|
|
703
|
+
var MenuSub = /* @__PURE__ */__name(props => {
|
|
667
704
|
const __scopeMenu = props.__scopeMenu,
|
|
668
705
|
children = props.children,
|
|
669
706
|
_props$open2 = props.open,
|
|
@@ -671,20 +708,20 @@ var MenuSub = props => {
|
|
|
671
708
|
onOpenChange = props.onOpenChange;
|
|
672
709
|
const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);
|
|
673
710
|
const popperScope = usePopperScope(__scopeMenu);
|
|
674
|
-
const _React$useState9 = React.useState(null),
|
|
675
|
-
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
676
|
-
trigger = _React$useState0[0],
|
|
677
|
-
setTrigger = _React$useState0[1];
|
|
678
711
|
const _React$useState1 = React.useState(null),
|
|
679
712
|
_React$useState10 = _slicedToArray(_React$useState1, 2),
|
|
680
|
-
|
|
681
|
-
|
|
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];
|
|
682
719
|
const handleOpenChange = useCallbackRef(onOpenChange);
|
|
683
720
|
React.useEffect(() => {
|
|
684
721
|
if (parentMenuContext.open === false) handleOpenChange(false);
|
|
685
722
|
return () => handleOpenChange(false);
|
|
686
723
|
}, [parentMenuContext.open, handleOpenChange]);
|
|
687
|
-
return /* @__PURE__ */React.createElement(
|
|
724
|
+
return /* @__PURE__ */React.createElement(Popper, {
|
|
688
725
|
...popperScope,
|
|
689
726
|
children: /* @__PURE__ */React.createElement(MenuProvider, {
|
|
690
727
|
scope: __scopeMenu,
|
|
@@ -702,10 +739,9 @@ var MenuSub = props => {
|
|
|
702
739
|
})
|
|
703
740
|
})
|
|
704
741
|
});
|
|
705
|
-
};
|
|
706
|
-
MenuSub.displayName = SUB_NAME;
|
|
742
|
+
}, "MenuSub");
|
|
707
743
|
var SUB_TRIGGER_NAME = "MenuSubTrigger";
|
|
708
|
-
var MenuSubTrigger =
|
|
744
|
+
var MenuSubTrigger = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuSubTrigger2(props, forwardedRef) {
|
|
709
745
|
const context = useMenuContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
710
746
|
const rootContext = useMenuRootContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
711
747
|
const subContext = useMenuSubContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
@@ -728,6 +764,7 @@ var MenuSubTrigger = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
728
764
|
onPointerGraceIntentChange(null);
|
|
729
765
|
};
|
|
730
766
|
}, [pointerGraceTimerRef, onPointerGraceIntentChange]);
|
|
767
|
+
const composedRefs = useComposedRefs(forwardedRef, subContext.onTriggerChange);
|
|
731
768
|
return /* @__PURE__ */React.createElement(MenuAnchor, {
|
|
732
769
|
asChild: true,
|
|
733
770
|
...scope,
|
|
@@ -735,10 +772,10 @@ var MenuSubTrigger = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
735
772
|
id: subContext.triggerId,
|
|
736
773
|
"aria-haspopup": "menu",
|
|
737
774
|
"aria-expanded": context.open,
|
|
738
|
-
"aria-controls": subContext.contentId,
|
|
775
|
+
"aria-controls": context.open ? subContext.contentId : void 0,
|
|
739
776
|
"data-state": getOpenState(context.open),
|
|
740
777
|
...props,
|
|
741
|
-
ref:
|
|
778
|
+
ref: composedRefs,
|
|
742
779
|
onClick: event => {
|
|
743
780
|
var _props$onClick;
|
|
744
781
|
(_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props, event);
|
|
@@ -800,8 +837,13 @@ var MenuSubTrigger = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
800
837
|
})),
|
|
801
838
|
onKeyDown: composeEventHandlers(props.onKeyDown, event => {
|
|
802
839
|
var _context;
|
|
840
|
+
if (props.disabled || event.target !== event.currentTarget) {
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
803
843
|
const isTypingAhead = contentContext.searchRef.current !== "";
|
|
804
|
-
if (
|
|
844
|
+
if (isTypingAhead && event.key === " ") {
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
805
847
|
if (_includesInstanceProperty(_context = SUB_OPEN_KEYS[rootContext.dir]).call(_context, event.key)) {
|
|
806
848
|
var _context$content3;
|
|
807
849
|
context.onOpenChange(true);
|
|
@@ -811,13 +853,14 @@ var MenuSubTrigger = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
811
853
|
})
|
|
812
854
|
})
|
|
813
855
|
});
|
|
814
|
-
});
|
|
815
|
-
MenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
856
|
+
}, "MenuSubTrigger"));
|
|
816
857
|
var SUB_CONTENT_NAME = "MenuSubContent";
|
|
817
|
-
var MenuSubContent =
|
|
858
|
+
var MenuSubContent = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function MenuSubContent2(props, forwardedRef) {
|
|
818
859
|
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);
|
|
819
860
|
const _props$forceMount2 = props.forceMount,
|
|
820
861
|
forceMount = _props$forceMount2 === void 0 ? portalContext.forceMount : _props$forceMount2,
|
|
862
|
+
_props$align = props.align,
|
|
863
|
+
align = _props$align === void 0 ? "start" : _props$align,
|
|
821
864
|
subContentProps = _objectWithoutProperties(props, _excluded12);
|
|
822
865
|
const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);
|
|
823
866
|
const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu);
|
|
@@ -835,8 +878,8 @@ var MenuSubContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
835
878
|
"aria-labelledby": subContext.triggerId,
|
|
836
879
|
...subContentProps,
|
|
837
880
|
ref: composedRefs,
|
|
838
|
-
align
|
|
839
|
-
side: rootContext.dir ===
|
|
881
|
+
align,
|
|
882
|
+
side: rootContext.dir === Direction.RTL ? "left" : "right",
|
|
840
883
|
disableOutsidePointerEvents: false,
|
|
841
884
|
disableOutsideScroll: false,
|
|
842
885
|
trapFocus: false,
|
|
@@ -868,17 +911,19 @@ var MenuSubContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
868
911
|
})
|
|
869
912
|
})
|
|
870
913
|
});
|
|
871
|
-
});
|
|
872
|
-
MenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
914
|
+
}, "MenuSubContent"));
|
|
873
915
|
function getOpenState(open) {
|
|
874
916
|
return open ? "open" : "closed";
|
|
875
917
|
}
|
|
918
|
+
__name(getOpenState, "getOpenState");
|
|
876
919
|
function isIndeterminate(checked) {
|
|
877
920
|
return checked === "indeterminate";
|
|
878
921
|
}
|
|
922
|
+
__name(isIndeterminate, "isIndeterminate");
|
|
879
923
|
function getCheckedState(checked) {
|
|
880
924
|
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
881
925
|
}
|
|
926
|
+
__name(getCheckedState, "getCheckedState");
|
|
882
927
|
function focusFirst(candidates) {
|
|
883
928
|
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
884
929
|
for (const candidate of candidates) {
|
|
@@ -887,9 +932,11 @@ function focusFirst(candidates) {
|
|
|
887
932
|
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
888
933
|
}
|
|
889
934
|
}
|
|
935
|
+
__name(focusFirst, "focusFirst");
|
|
890
936
|
function wrapArray(array, startIndex) {
|
|
891
937
|
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
892
938
|
}
|
|
939
|
+
__name(wrapArray, "wrapArray");
|
|
893
940
|
function getNextMatch(values, search, currentMatch) {
|
|
894
941
|
const isRepeated = search.length > 1 && Array.from(search).every(char => char === search[0]);
|
|
895
942
|
const normalizedSearch = isRepeated ? search[0] : search;
|
|
@@ -900,6 +947,7 @@ function getNextMatch(values, search, currentMatch) {
|
|
|
900
947
|
const nextMatch = wrappedValues.find(value => value.toLowerCase().startsWith(normalizedSearch.toLowerCase()));
|
|
901
948
|
return nextMatch !== currentMatch ? nextMatch : void 0;
|
|
902
949
|
}
|
|
950
|
+
__name(getNextMatch, "getNextMatch");
|
|
903
951
|
function isPointInPolygon(point, polygon) {
|
|
904
952
|
const x = point.x,
|
|
905
953
|
y = point.y;
|
|
@@ -916,6 +964,7 @@ function isPointInPolygon(point, polygon) {
|
|
|
916
964
|
}
|
|
917
965
|
return inside;
|
|
918
966
|
}
|
|
967
|
+
__name(isPointInPolygon, "isPointInPolygon");
|
|
919
968
|
function isPointerInGraceArea(event, area) {
|
|
920
969
|
if (!area) return false;
|
|
921
970
|
const cursorPos = {
|
|
@@ -924,24 +973,10 @@ function isPointerInGraceArea(event, area) {
|
|
|
924
973
|
};
|
|
925
974
|
return isPointInPolygon(cursorPos, area);
|
|
926
975
|
}
|
|
976
|
+
__name(isPointerInGraceArea, "isPointerInGraceArea");
|
|
927
977
|
function whenMouse(handler) {
|
|
928
978
|
return event => event.pointerType === "mouse" ? handler(event) : void 0;
|
|
929
979
|
}
|
|
930
|
-
|
|
931
|
-
var Anchor2 = MenuAnchor;
|
|
932
|
-
var Portal = MenuPortal;
|
|
933
|
-
var Content2 = MenuContent;
|
|
934
|
-
var Group = MenuGroup;
|
|
935
|
-
var Label = MenuLabel;
|
|
936
|
-
var Item2 = MenuItem;
|
|
937
|
-
var CheckboxItem = MenuCheckboxItem;
|
|
938
|
-
var RadioGroup = MenuRadioGroup;
|
|
939
|
-
var RadioItem = MenuRadioItem;
|
|
940
|
-
var ItemIndicator = MenuItemIndicator;
|
|
941
|
-
var Separator = MenuSeparator;
|
|
942
|
-
var Arrow2 = MenuArrow;
|
|
943
|
-
var Sub = MenuSub;
|
|
944
|
-
var SubTrigger = MenuSubTrigger;
|
|
945
|
-
var SubContent = MenuSubContent;
|
|
980
|
+
__name(whenMouse, "whenMouse");
|
|
946
981
|
|
|
947
|
-
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 };
|