@arc-ui/components 12.0.0-beta.22 → 12.0.0-beta.23
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/lib/Alert/Alert.cjs +22 -21
- package/lib/Alert/Alert.mjs +22 -21
- package/lib/Alert/styles.css +1 -1
- package/lib/Align/styles.css +1 -1
- package/lib/AppButton/styles.css +1 -1
- package/lib/Avatar/styles.css +1 -1
- package/lib/AvatarGroup/styles.css +1 -1
- package/lib/Badge/styles.css +1 -1
- package/lib/Banner/Banner.cjs +1 -1
- package/lib/Banner/Banner.mjs +1 -1
- package/lib/Box/styles.css +1 -1
- package/lib/BrandLogo/styles.css +1 -1
- package/lib/Breadcrumbs/Breadcrumbs.cjs +12 -3
- package/lib/Breadcrumbs/Breadcrumbs.mjs +12 -3
- package/lib/Breadcrumbs/styles.css +1 -1
- package/lib/Button/styles.css +1 -1
- package/lib/ButtonGroup/styles.css +1 -1
- package/lib/ButtonV2/styles.css +1 -1
- package/lib/Calendar/Calendar.cjs +2 -2
- package/lib/Calendar/Calendar.mjs +2 -2
- package/lib/Calendar/styles.css +1 -1
- package/lib/CardFooter/styles.css +1 -1
- package/lib/CardHeading/styles.css +1 -1
- package/lib/Carousel/Carousel.cjs +11 -5
- package/lib/Carousel/Carousel.mjs +8 -2
- package/lib/Carousel/styles.css +1 -1
- package/lib/Checkbox/Checkbox.cjs +85 -11
- package/lib/Checkbox/Checkbox.mjs +87 -9
- package/lib/Checkbox/styles.css +1 -1
- package/lib/Columns/styles.css +1 -1
- package/lib/ComboBox/ComboBox.cjs +276 -11
- package/lib/ComboBox/ComboBox.mjs +279 -10
- package/lib/ComboBox/styles.css +1 -1
- package/lib/ContentSwitcher/ContentSwitcher.cjs +5 -6
- package/lib/ContentSwitcher/ContentSwitcher.mjs +5 -6
- package/lib/ContentSwitcher/styles.css +1 -1
- package/lib/ContentSwitcherDropdown/styles.css +1 -1
- package/lib/DatePicker/DatePicker.cjs +351 -38
- package/lib/DatePicker/DatePicker.mjs +329 -17
- package/lib/DatePicker/styles.css +1 -1
- package/lib/Disclosure/styles.css +1 -1
- package/lib/DisclosureMini/styles.css +1 -1
- package/lib/Download/styles.css +1 -1
- package/lib/Drawer/styles.css +1 -1
- package/lib/Elevation/styles.css +1 -1
- package/lib/Filter/styles.css +1 -1
- package/lib/FormControl/styles.css +1 -1
- package/lib/GhostedHeroBanner/styles.css +1 -1
- package/lib/GradientPageBackground/GradientPageBackground.cjs +55 -43
- package/lib/GradientPageBackground/GradientPageBackground.mjs +55 -43
- package/lib/GradientPageBackground/styles.css +1 -1
- package/lib/Grid/styles.css +1 -1
- package/lib/Group/styles.css +1 -1
- package/lib/Heading/styles.css +1 -1
- package/lib/HeroBanner/HeroBanner.cjs +1 -1
- package/lib/HeroBanner/HeroBanner.mjs +1 -1
- package/lib/HeroBanner/styles.css +1 -1
- package/lib/HeroButton/HeroButton.cjs +77 -9
- package/lib/HeroButton/HeroButton.mjs +80 -8
- package/lib/HeroButton/styles.css +1 -1
- package/lib/Hidden/styles.css +1 -1
- package/lib/HorizontalCard/styles.css +1 -1
- package/lib/Icon/styles.css +1 -1
- package/lib/Image/styles.css +1 -1
- package/lib/ImpactCard/ImpactCard.cjs +3 -3
- package/lib/ImpactCard/ImpactCard.mjs +3 -3
- package/lib/ImpactCard/styles.css +1 -1
- package/lib/InformationCard/InformationCard.cjs +6 -6
- package/lib/InformationCard/InformationCard.mjs +6 -6
- package/lib/InformationCard/styles.css +1 -1
- package/lib/Link/Link.cjs +1 -1
- package/lib/Link/Link.mjs +1 -1
- package/lib/Link/styles.css +1 -1
- package/lib/Markup/styles.css +1 -1
- package/lib/MediaCard/MediaCard.cjs +53 -14
- package/lib/MediaCard/MediaCard.mjs +55 -12
- package/lib/MediaCard/styles.css +1 -1
- package/lib/Menu/Menu.cjs +1327 -25
- package/lib/Menu/Menu.mjs +1292 -9
- package/lib/Menu/styles.css +1 -1
- package/lib/Modal/styles.css +1 -1
- package/lib/NavigationHeader/NavigationHeader.cjs +743 -16
- package/lib/NavigationHeader/NavigationHeader.mjs +734 -7
- package/lib/NavigationHeader/styles.css +1 -1
- package/lib/Pagination/styles.css +1 -1
- package/lib/PaginationSimple/styles.css +1 -1
- package/lib/Popover/styles.css +1 -1
- package/lib/Poster/styles.css +1 -1
- package/lib/ProgressBar/styles.css +1 -1
- package/lib/ProgressStepper/styles.css +1 -1
- package/lib/ProgressStepperOverflow/ProgressStepperOverflow.cjs +138 -7
- package/lib/ProgressStepperOverflow/ProgressStepperOverflow.mjs +140 -5
- package/lib/ProgressStepperOverflow/styles.css +1 -1
- package/lib/RadioCardGroup/RadioCardGroup.cjs +48 -7
- package/lib/RadioCardGroup/RadioCardGroup.mjs +48 -8
- package/lib/RadioCardGroup/styles.css +1 -1
- package/lib/RadioGroup/RadioGroup.cjs +50 -8
- package/lib/RadioGroup/RadioGroup.mjs +49 -8
- package/lib/RadioGroup/styles.css +1 -1
- package/lib/Rule/styles.css +1 -1
- package/lib/ScrollToTop/styles.css +1 -1
- package/lib/Section/Section.cjs +1 -1
- package/lib/Section/Section.mjs +1 -1
- package/lib/Section/styles.css +1 -1
- package/lib/Select/styles.css +1 -1
- package/lib/SiteFooter/SiteFooter.cjs +1 -1
- package/lib/SiteFooter/SiteFooter.mjs +1 -1
- package/lib/SiteFooter/styles.css +1 -1
- package/lib/SiteFooterV2/SiteFooterV2.cjs +6 -5
- package/lib/SiteFooterV2/SiteFooterV2.mjs +6 -5
- package/lib/SiteFooterV2/styles.css +1 -1
- package/lib/SiteHeaderV2/SiteHeaderV2.cjs +440 -15
- package/lib/SiteHeaderV2/SiteHeaderV2.mjs +435 -11
- package/lib/SiteHeaderV2/styles.css +1 -1
- package/lib/Skeleton/styles.css +1 -1
- package/lib/SkipLink/styles.css +1 -1
- package/lib/Spinner/styles.css +1 -1
- package/lib/Surface/styles.css +1 -1
- package/lib/Switch/styles.css +1 -1
- package/lib/TabbedBanner/TabbedBanner.cjs +4 -5
- package/lib/TabbedBanner/TabbedBanner.mjs +4 -5
- package/lib/TabbedBanner/styles.css +1 -1
- package/lib/Tabs/Tabs.mjs +1 -1
- package/lib/Tabs/styles.css +1 -1
- package/lib/Tag/Tag.cjs +9 -9
- package/lib/Tag/Tag.mjs +9 -9
- package/lib/Tag/styles.css +1 -1
- package/lib/TemplateBanner/TemplateBanner.cjs +1 -1
- package/lib/TemplateBanner/TemplateBanner.mjs +1 -1
- package/lib/TemplateBanner/styles.css +1 -1
- package/lib/Text/styles.css +1 -1
- package/lib/TextArea/TextArea.cjs +2 -53
- package/lib/TextArea/TextArea.mjs +2 -53
- package/lib/TextArea/styles.css +1 -1
- package/lib/TextInput/styles.css +1 -1
- package/lib/Theme/Theme.cjs +1 -1
- package/lib/Theme/Theme.mjs +1 -1
- package/lib/Theme/styles.css +1 -1
- package/lib/ThemeIcon/styles.css +1 -1
- package/lib/ThumbnailSignpost/styles.css +1 -1
- package/lib/Toast/styles.css +1 -1
- package/lib/Tooltip/styles.css +1 -1
- package/lib/Truncate/styles.css +1 -1
- package/lib/TypographyCard/TypographyCard.cjs +3 -3
- package/lib/TypographyCard/TypographyCard.mjs +3 -3
- package/lib/TypographyCard/styles.css +1 -1
- package/lib/UniversalHeader/styles.css +1 -1
- package/lib/VerticalSpace/styles.css +1 -1
- package/lib/VideoPlayer/styles.css +1 -1
- package/lib/Visible/styles.css +1 -1
- package/lib/VisuallyHidden/styles.css +1 -1
- package/lib/_shared/cjs/{Calendar-B-va25n2.cjs → Calendar-Bfdgf5q1.cjs} +1 -1
- package/lib/_shared/cjs/{ContentSwitcherList-bCEzIPN2.cjs → ContentSwitcherList-pcYtuT6L.cjs} +8 -0
- package/lib/_shared/cjs/{Link-7xUgVf1I.cjs → Link-C3OSQIIk.cjs} +3 -1
- package/lib/_shared/cjs/{Section-wUVdzmGA.cjs → Section-Bz2fwj8Z.cjs} +2 -2
- package/lib/_shared/cjs/{TemplateBanner-CImrJ9ON.cjs → TemplateBanner-COymAI91.cjs} +2 -2
- package/lib/_shared/cjs/{arc-breakpoints-DWUgmeLA.cjs → arc-breakpoints-CS8JVk5T.cjs} +1 -1
- package/lib/_shared/cjs/{index.es-DlNskPlN.cjs → index.es-fkulh7qu.cjs} +1 -1
- package/lib/_shared/esm/{Calendar-Bd2_eT1Y.mjs → Calendar-Drh_NJ9I.mjs} +1 -1
- package/lib/_shared/esm/{ContentSwitcherList-bCQz0qkU.mjs → ContentSwitcherList-DwHfU3no.mjs} +10 -3
- package/lib/_shared/esm/{Link-Biyg9qBH.mjs → Link-DxjGH_7f.mjs} +3 -1
- package/lib/_shared/esm/{Section-DDygQ5Az.mjs → Section-7InCvzfh.mjs} +2 -2
- package/lib/_shared/esm/{TemplateBanner-DeHjliNP.mjs → TemplateBanner-Dkgzu3A5.mjs} +2 -2
- package/lib/_shared/esm/{arc-breakpoints-D5hR5m3t.mjs → arc-breakpoints-D7Ie4kBt.mjs} +1 -1
- package/lib/_shared/esm/{index-BDWwJ5x2.mjs → index-BWkI4Dwz.mjs} +1 -1
- package/lib/_shared/esm/{index.es-C3WqfFKH.mjs → index.es-CtRkzfKP.mjs} +2 -2
- package/lib/index.cjs +300 -283
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +28 -3
- package/lib/index.d.mts +28 -3
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +301 -284
- package/lib/index.mjs.map +1 -1
- package/lib/styles.css +10 -10
- package/package.json +8 -8
- package/lib/_shared/cjs/BreadcrumbsLink-CDmk3Y3m.cjs +0 -18
- package/lib/_shared/cjs/Checkbox-DfZMjO1Y.cjs +0 -88
- package/lib/_shared/cjs/ComboBox-BGUhlqx1.cjs +0 -281
- package/lib/_shared/cjs/ContentSwitcherTab-B387Qs3I.cjs +0 -14
- package/lib/_shared/cjs/DatePicker-Dt4faA_N.cjs +0 -334
- package/lib/_shared/cjs/HeroButton-CrzkTUwP.cjs +0 -82
- package/lib/_shared/cjs/MediaCard-BEZFbiYO.cjs +0 -57
- package/lib/_shared/cjs/MenuItemMultiLevelContent-vLr6hSBm.cjs +0 -1328
- package/lib/_shared/cjs/ProgressStepperOverflow-BAGZNC26.cjs +0 -142
- package/lib/_shared/cjs/RadioCardGroupInput-CeUM3yPS.cjs +0 -53
- package/lib/_shared/cjs/RadioGroupInput-w2qkfsnG.cjs +0 -54
- package/lib/_shared/cjs/SiteHeaderV2NavItemWithSubNav-CagFKPEa.cjs +0 -445
- package/lib/_shared/cjs/kebabCase-D5yA6u-V.cjs +0 -743
- package/lib/_shared/cjs/keynames-Cx13-hWr.cjs +0 -8
- package/lib/_shared/esm/BreadcrumbsLink-BxTurGNa.mjs +0 -16
- package/lib/_shared/esm/Checkbox-CwOHzlQF.mjs +0 -86
- package/lib/_shared/esm/ComboBox-CRlJjeev.mjs +0 -279
- package/lib/_shared/esm/ContentSwitcherTab-CfC3PGeZ.mjs +0 -12
- package/lib/_shared/esm/DatePicker-DT4OEzxP.mjs +0 -324
- package/lib/_shared/esm/HeroButton-jdjjV_Gf.mjs +0 -80
- package/lib/_shared/esm/MediaCard-DqMaNWsE.mjs +0 -55
- package/lib/_shared/esm/MenuItemMultiLevelContent-JTOHqpzg.mjs +0 -1296
- package/lib/_shared/esm/ProgressStepperOverflow-fPkLltVO.mjs +0 -140
- package/lib/_shared/esm/RadioCardGroupInput-D7W28geB.mjs +0 -50
- package/lib/_shared/esm/RadioGroupInput-zAWSV29m.mjs +0 -50
- package/lib/_shared/esm/SiteHeaderV2NavItemWithSubNav-CxGwdV6u.mjs +0 -439
- package/lib/_shared/esm/kebabCase-CCEMRBfd.mjs +0 -737
- package/lib/_shared/esm/keynames-B5whqsjh.mjs +0 -8
|
@@ -1,1328 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var filterAttrs = require('./filter-attrs-eK6E_34o.cjs');
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var Combination = require('./Combination-B-rSVLfT.cjs');
|
|
7
|
-
var index$1 = require('./index-DXNM3D1d.cjs');
|
|
8
|
-
var index = require('./index-EFXw1jWg.cjs');
|
|
9
|
-
var index$2 = require('./index-Bt7hfZBc.cjs');
|
|
10
|
-
var index$3 = require('./index-Dv1xvB_E.cjs');
|
|
11
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
-
|
|
13
|
-
function _interopNamespaceDefault(e) {
|
|
14
|
-
var n = Object.create(null);
|
|
15
|
-
if (e) {
|
|
16
|
-
Object.keys(e).forEach(function (k) {
|
|
17
|
-
if (k !== 'default') {
|
|
18
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () { return e[k]; }
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
n.default = e;
|
|
27
|
-
return Object.freeze(n);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
31
|
-
|
|
32
|
-
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
33
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
34
|
-
var GROUP_NAME$2 = "RovingFocusGroup";
|
|
35
|
-
var [Collection$1, useCollection$1, createCollectionScope$1] = index.createCollection(GROUP_NAME$2);
|
|
36
|
-
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = index$1.createContextScope(
|
|
37
|
-
GROUP_NAME$2,
|
|
38
|
-
[createCollectionScope$1]
|
|
39
|
-
);
|
|
40
|
-
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME$2);
|
|
41
|
-
var RovingFocusGroup = React__namespace.forwardRef(
|
|
42
|
-
(props, forwardedRef) => {
|
|
43
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Collection$1.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsxRuntime.jsx(Collection$1.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsxRuntime.jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
RovingFocusGroup.displayName = GROUP_NAME$2;
|
|
47
|
-
var RovingFocusGroupImpl = React__namespace.forwardRef((props, forwardedRef) => {
|
|
48
|
-
const {
|
|
49
|
-
__scopeRovingFocusGroup,
|
|
50
|
-
orientation,
|
|
51
|
-
loop = false,
|
|
52
|
-
dir,
|
|
53
|
-
currentTabStopId: currentTabStopIdProp,
|
|
54
|
-
defaultCurrentTabStopId,
|
|
55
|
-
onCurrentTabStopIdChange,
|
|
56
|
-
onEntryFocus,
|
|
57
|
-
preventScrollOnEntryFocus = false,
|
|
58
|
-
...groupProps
|
|
59
|
-
} = props;
|
|
60
|
-
const ref = React__namespace.useRef(null);
|
|
61
|
-
const composedRefs = Combination.useComposedRefs(forwardedRef, ref);
|
|
62
|
-
const direction = index.useDirection(dir);
|
|
63
|
-
const [currentTabStopId = null, setCurrentTabStopId] = index$1.useControllableState({
|
|
64
|
-
prop: currentTabStopIdProp,
|
|
65
|
-
defaultProp: defaultCurrentTabStopId,
|
|
66
|
-
onChange: onCurrentTabStopIdChange
|
|
67
|
-
});
|
|
68
|
-
const [isTabbingBackOut, setIsTabbingBackOut] = React__namespace.useState(false);
|
|
69
|
-
const handleEntryFocus = index$1.useCallbackRef(onEntryFocus);
|
|
70
|
-
const getItems = useCollection$1(__scopeRovingFocusGroup);
|
|
71
|
-
const isClickFocusRef = React__namespace.useRef(false);
|
|
72
|
-
const [focusableItemsCount, setFocusableItemsCount] = React__namespace.useState(0);
|
|
73
|
-
React__namespace.useEffect(() => {
|
|
74
|
-
const node = ref.current;
|
|
75
|
-
if (node) {
|
|
76
|
-
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
77
|
-
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
78
|
-
}
|
|
79
|
-
}, [handleEntryFocus]);
|
|
80
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
81
|
-
RovingFocusProvider,
|
|
82
|
-
{
|
|
83
|
-
scope: __scopeRovingFocusGroup,
|
|
84
|
-
orientation,
|
|
85
|
-
dir: direction,
|
|
86
|
-
loop,
|
|
87
|
-
currentTabStopId,
|
|
88
|
-
onItemFocus: React__namespace.useCallback(
|
|
89
|
-
(tabStopId) => setCurrentTabStopId(tabStopId),
|
|
90
|
-
[setCurrentTabStopId]
|
|
91
|
-
),
|
|
92
|
-
onItemShiftTab: React__namespace.useCallback(() => setIsTabbingBackOut(true), []),
|
|
93
|
-
onFocusableItemAdd: React__namespace.useCallback(
|
|
94
|
-
() => setFocusableItemsCount((prevCount) => prevCount + 1),
|
|
95
|
-
[]
|
|
96
|
-
),
|
|
97
|
-
onFocusableItemRemove: React__namespace.useCallback(
|
|
98
|
-
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
99
|
-
[]
|
|
100
|
-
),
|
|
101
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
102
|
-
Combination.Primitive.div,
|
|
103
|
-
{
|
|
104
|
-
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
105
|
-
"data-orientation": orientation,
|
|
106
|
-
...groupProps,
|
|
107
|
-
ref: composedRefs,
|
|
108
|
-
style: { outline: "none", ...props.style },
|
|
109
|
-
onMouseDown: Combination.composeEventHandlers(props.onMouseDown, () => {
|
|
110
|
-
isClickFocusRef.current = true;
|
|
111
|
-
}),
|
|
112
|
-
onFocus: Combination.composeEventHandlers(props.onFocus, (event) => {
|
|
113
|
-
const isKeyboardFocus = !isClickFocusRef.current;
|
|
114
|
-
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
115
|
-
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
116
|
-
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
117
|
-
if (!entryFocusEvent.defaultPrevented) {
|
|
118
|
-
const items = getItems().filter((item) => item.focusable);
|
|
119
|
-
const activeItem = items.find((item) => item.active);
|
|
120
|
-
const currentItem = items.find((item) => item.id === currentTabStopId);
|
|
121
|
-
const candidateItems = [activeItem, currentItem, ...items].filter(
|
|
122
|
-
Boolean
|
|
123
|
-
);
|
|
124
|
-
const candidateNodes = candidateItems.map((item) => item.ref.current);
|
|
125
|
-
focusFirst$1(candidateNodes, preventScrollOnEntryFocus);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
isClickFocusRef.current = false;
|
|
129
|
-
}),
|
|
130
|
-
onBlur: Combination.composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
|
|
131
|
-
}
|
|
132
|
-
)
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
});
|
|
136
|
-
var ITEM_NAME$2 = "RovingFocusGroupItem";
|
|
137
|
-
var RovingFocusGroupItem = React__namespace.forwardRef(
|
|
138
|
-
(props, forwardedRef) => {
|
|
139
|
-
const {
|
|
140
|
-
__scopeRovingFocusGroup,
|
|
141
|
-
focusable = true,
|
|
142
|
-
active = false,
|
|
143
|
-
tabStopId,
|
|
144
|
-
...itemProps
|
|
145
|
-
} = props;
|
|
146
|
-
const autoId = index$1.useId();
|
|
147
|
-
const id = tabStopId || autoId;
|
|
148
|
-
const context = useRovingFocusContext(ITEM_NAME$2, __scopeRovingFocusGroup);
|
|
149
|
-
const isCurrentTabStop = context.currentTabStopId === id;
|
|
150
|
-
const getItems = useCollection$1(__scopeRovingFocusGroup);
|
|
151
|
-
const { onFocusableItemAdd, onFocusableItemRemove } = context;
|
|
152
|
-
React__namespace.useEffect(() => {
|
|
153
|
-
if (focusable) {
|
|
154
|
-
onFocusableItemAdd();
|
|
155
|
-
return () => onFocusableItemRemove();
|
|
156
|
-
}
|
|
157
|
-
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
158
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
159
|
-
Collection$1.ItemSlot,
|
|
160
|
-
{
|
|
161
|
-
scope: __scopeRovingFocusGroup,
|
|
162
|
-
id,
|
|
163
|
-
focusable,
|
|
164
|
-
active,
|
|
165
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
166
|
-
Combination.Primitive.span,
|
|
167
|
-
{
|
|
168
|
-
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
169
|
-
"data-orientation": context.orientation,
|
|
170
|
-
...itemProps,
|
|
171
|
-
ref: forwardedRef,
|
|
172
|
-
onMouseDown: Combination.composeEventHandlers(props.onMouseDown, (event) => {
|
|
173
|
-
if (!focusable) event.preventDefault();
|
|
174
|
-
else context.onItemFocus(id);
|
|
175
|
-
}),
|
|
176
|
-
onFocus: Combination.composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
|
|
177
|
-
onKeyDown: Combination.composeEventHandlers(props.onKeyDown, (event) => {
|
|
178
|
-
if (event.key === "Tab" && event.shiftKey) {
|
|
179
|
-
context.onItemShiftTab();
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
if (event.target !== event.currentTarget) return;
|
|
183
|
-
const focusIntent = getFocusIntent(event, context.orientation, context.dir);
|
|
184
|
-
if (focusIntent !== void 0) {
|
|
185
|
-
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
186
|
-
event.preventDefault();
|
|
187
|
-
const items = getItems().filter((item) => item.focusable);
|
|
188
|
-
let candidateNodes = items.map((item) => item.ref.current);
|
|
189
|
-
if (focusIntent === "last") candidateNodes.reverse();
|
|
190
|
-
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
191
|
-
if (focusIntent === "prev") candidateNodes.reverse();
|
|
192
|
-
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
193
|
-
candidateNodes = context.loop ? wrapArray$1(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
194
|
-
}
|
|
195
|
-
setTimeout(() => focusFirst$1(candidateNodes));
|
|
196
|
-
}
|
|
197
|
-
})
|
|
198
|
-
}
|
|
199
|
-
)
|
|
200
|
-
}
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
);
|
|
204
|
-
RovingFocusGroupItem.displayName = ITEM_NAME$2;
|
|
205
|
-
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
206
|
-
ArrowLeft: "prev",
|
|
207
|
-
ArrowUp: "prev",
|
|
208
|
-
ArrowRight: "next",
|
|
209
|
-
ArrowDown: "next",
|
|
210
|
-
PageUp: "first",
|
|
211
|
-
Home: "first",
|
|
212
|
-
PageDown: "last",
|
|
213
|
-
End: "last"
|
|
214
|
-
};
|
|
215
|
-
function getDirectionAwareKey(key, dir) {
|
|
216
|
-
if (dir !== "rtl") return key;
|
|
217
|
-
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
218
|
-
}
|
|
219
|
-
function getFocusIntent(event, orientation, dir) {
|
|
220
|
-
const key = getDirectionAwareKey(event.key, dir);
|
|
221
|
-
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
222
|
-
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
223
|
-
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
224
|
-
}
|
|
225
|
-
function focusFirst$1(candidates, preventScroll = false) {
|
|
226
|
-
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
227
|
-
for (const candidate of candidates) {
|
|
228
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
229
|
-
candidate.focus({ preventScroll });
|
|
230
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
function wrapArray$1(array, startIndex) {
|
|
234
|
-
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
235
|
-
}
|
|
236
|
-
var Root = RovingFocusGroup;
|
|
237
|
-
var Item = RovingFocusGroupItem;
|
|
238
|
-
|
|
239
|
-
var SELECTION_KEYS = ["Enter", " "];
|
|
240
|
-
var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"];
|
|
241
|
-
var LAST_KEYS = ["ArrowUp", "PageDown", "End"];
|
|
242
|
-
var FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
|
|
243
|
-
var SUB_OPEN_KEYS = {
|
|
244
|
-
ltr: [...SELECTION_KEYS, "ArrowRight"],
|
|
245
|
-
rtl: [...SELECTION_KEYS, "ArrowLeft"]
|
|
246
|
-
};
|
|
247
|
-
var SUB_CLOSE_KEYS = {
|
|
248
|
-
ltr: ["ArrowLeft"],
|
|
249
|
-
rtl: ["ArrowRight"]
|
|
250
|
-
};
|
|
251
|
-
var MENU_NAME = "Menu";
|
|
252
|
-
var [Collection, useCollection, createCollectionScope] = index.createCollection(MENU_NAME);
|
|
253
|
-
var [createMenuContext, createMenuScope] = index$1.createContextScope(MENU_NAME, [
|
|
254
|
-
createCollectionScope,
|
|
255
|
-
index$2.createPopperScope,
|
|
256
|
-
createRovingFocusGroupScope
|
|
257
|
-
]);
|
|
258
|
-
var usePopperScope = index$2.createPopperScope();
|
|
259
|
-
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
260
|
-
var [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME);
|
|
261
|
-
var [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);
|
|
262
|
-
var Menu = (props) => {
|
|
263
|
-
const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props;
|
|
264
|
-
const popperScope = usePopperScope(__scopeMenu);
|
|
265
|
-
const [content, setContent] = React__namespace.useState(null);
|
|
266
|
-
const isUsingKeyboardRef = React__namespace.useRef(false);
|
|
267
|
-
const handleOpenChange = index$1.useCallbackRef(onOpenChange);
|
|
268
|
-
const direction = index.useDirection(dir);
|
|
269
|
-
React__namespace.useEffect(() => {
|
|
270
|
-
const handleKeyDown = () => {
|
|
271
|
-
isUsingKeyboardRef.current = true;
|
|
272
|
-
document.addEventListener("pointerdown", handlePointer, { capture: true, once: true });
|
|
273
|
-
document.addEventListener("pointermove", handlePointer, { capture: true, once: true });
|
|
274
|
-
};
|
|
275
|
-
const handlePointer = () => isUsingKeyboardRef.current = false;
|
|
276
|
-
document.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
277
|
-
return () => {
|
|
278
|
-
document.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
279
|
-
document.removeEventListener("pointerdown", handlePointer, { capture: true });
|
|
280
|
-
document.removeEventListener("pointermove", handlePointer, { capture: true });
|
|
281
|
-
};
|
|
282
|
-
}, []);
|
|
283
|
-
return /* @__PURE__ */ jsxRuntime.jsx(index$2.Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
284
|
-
MenuProvider,
|
|
285
|
-
{
|
|
286
|
-
scope: __scopeMenu,
|
|
287
|
-
open,
|
|
288
|
-
onOpenChange: handleOpenChange,
|
|
289
|
-
content,
|
|
290
|
-
onContentChange: setContent,
|
|
291
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
292
|
-
MenuRootProvider,
|
|
293
|
-
{
|
|
294
|
-
scope: __scopeMenu,
|
|
295
|
-
onClose: React__namespace.useCallback(() => handleOpenChange(false), [handleOpenChange]),
|
|
296
|
-
isUsingKeyboardRef,
|
|
297
|
-
dir: direction,
|
|
298
|
-
modal,
|
|
299
|
-
children
|
|
300
|
-
}
|
|
301
|
-
)
|
|
302
|
-
}
|
|
303
|
-
) });
|
|
304
|
-
};
|
|
305
|
-
Menu.displayName = MENU_NAME;
|
|
306
|
-
var ANCHOR_NAME = "MenuAnchor";
|
|
307
|
-
var MenuAnchor = React__namespace.forwardRef(
|
|
308
|
-
(props, forwardedRef) => {
|
|
309
|
-
const { __scopeMenu, ...anchorProps } = props;
|
|
310
|
-
const popperScope = usePopperScope(__scopeMenu);
|
|
311
|
-
return /* @__PURE__ */ jsxRuntime.jsx(index$2.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
312
|
-
}
|
|
313
|
-
);
|
|
314
|
-
MenuAnchor.displayName = ANCHOR_NAME;
|
|
315
|
-
var PORTAL_NAME$1 = "MenuPortal";
|
|
316
|
-
var [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME$1, {
|
|
317
|
-
forceMount: void 0
|
|
318
|
-
});
|
|
319
|
-
var MenuPortal = (props) => {
|
|
320
|
-
const { __scopeMenu, forceMount, children, container } = props;
|
|
321
|
-
const context = useMenuContext(PORTAL_NAME$1, __scopeMenu);
|
|
322
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ jsxRuntime.jsx(index$3.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Combination.Portal, { asChild: true, container, children }) }) });
|
|
323
|
-
};
|
|
324
|
-
MenuPortal.displayName = PORTAL_NAME$1;
|
|
325
|
-
var CONTENT_NAME$1 = "MenuContent";
|
|
326
|
-
var [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME$1);
|
|
327
|
-
var MenuContent$1 = React__namespace.forwardRef(
|
|
328
|
-
(props, forwardedRef) => {
|
|
329
|
-
const portalContext = usePortalContext(CONTENT_NAME$1, props.__scopeMenu);
|
|
330
|
-
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
331
|
-
const context = useMenuContext(CONTENT_NAME$1, props.__scopeMenu);
|
|
332
|
-
const rootContext = useMenuRootContext(CONTENT_NAME$1, props.__scopeMenu);
|
|
333
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsxRuntime.jsx(index$3.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Collection.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsxRuntime.jsx(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntime.jsx(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });
|
|
334
|
-
}
|
|
335
|
-
);
|
|
336
|
-
var MenuRootContentModal = React__namespace.forwardRef(
|
|
337
|
-
(props, forwardedRef) => {
|
|
338
|
-
const context = useMenuContext(CONTENT_NAME$1, props.__scopeMenu);
|
|
339
|
-
const ref = React__namespace.useRef(null);
|
|
340
|
-
const composedRefs = Combination.useComposedRefs(forwardedRef, ref);
|
|
341
|
-
React__namespace.useEffect(() => {
|
|
342
|
-
const content = ref.current;
|
|
343
|
-
if (content) return Combination.hideOthers(content);
|
|
344
|
-
}, []);
|
|
345
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
346
|
-
MenuContentImpl,
|
|
347
|
-
{
|
|
348
|
-
...props,
|
|
349
|
-
ref: composedRefs,
|
|
350
|
-
trapFocus: context.open,
|
|
351
|
-
disableOutsidePointerEvents: context.open,
|
|
352
|
-
disableOutsideScroll: true,
|
|
353
|
-
onFocusOutside: Combination.composeEventHandlers(
|
|
354
|
-
props.onFocusOutside,
|
|
355
|
-
(event) => event.preventDefault(),
|
|
356
|
-
{ checkForDefaultPrevented: false }
|
|
357
|
-
),
|
|
358
|
-
onDismiss: () => context.onOpenChange(false)
|
|
359
|
-
}
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
);
|
|
363
|
-
var MenuRootContentNonModal = React__namespace.forwardRef((props, forwardedRef) => {
|
|
364
|
-
const context = useMenuContext(CONTENT_NAME$1, props.__scopeMenu);
|
|
365
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
366
|
-
MenuContentImpl,
|
|
367
|
-
{
|
|
368
|
-
...props,
|
|
369
|
-
ref: forwardedRef,
|
|
370
|
-
trapFocus: false,
|
|
371
|
-
disableOutsidePointerEvents: false,
|
|
372
|
-
disableOutsideScroll: false,
|
|
373
|
-
onDismiss: () => context.onOpenChange(false)
|
|
374
|
-
}
|
|
375
|
-
);
|
|
376
|
-
});
|
|
377
|
-
var MenuContentImpl = React__namespace.forwardRef(
|
|
378
|
-
(props, forwardedRef) => {
|
|
379
|
-
const {
|
|
380
|
-
__scopeMenu,
|
|
381
|
-
loop = false,
|
|
382
|
-
trapFocus,
|
|
383
|
-
onOpenAutoFocus,
|
|
384
|
-
onCloseAutoFocus,
|
|
385
|
-
disableOutsidePointerEvents,
|
|
386
|
-
onEntryFocus,
|
|
387
|
-
onEscapeKeyDown,
|
|
388
|
-
onPointerDownOutside,
|
|
389
|
-
onFocusOutside,
|
|
390
|
-
onInteractOutside,
|
|
391
|
-
onDismiss,
|
|
392
|
-
disableOutsideScroll,
|
|
393
|
-
...contentProps
|
|
394
|
-
} = props;
|
|
395
|
-
const context = useMenuContext(CONTENT_NAME$1, __scopeMenu);
|
|
396
|
-
const rootContext = useMenuRootContext(CONTENT_NAME$1, __scopeMenu);
|
|
397
|
-
const popperScope = usePopperScope(__scopeMenu);
|
|
398
|
-
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
|
|
399
|
-
const getItems = useCollection(__scopeMenu);
|
|
400
|
-
const [currentItemId, setCurrentItemId] = React__namespace.useState(null);
|
|
401
|
-
const contentRef = React__namespace.useRef(null);
|
|
402
|
-
const composedRefs = Combination.useComposedRefs(forwardedRef, contentRef, context.onContentChange);
|
|
403
|
-
const timerRef = React__namespace.useRef(0);
|
|
404
|
-
const searchRef = React__namespace.useRef("");
|
|
405
|
-
const pointerGraceTimerRef = React__namespace.useRef(0);
|
|
406
|
-
const pointerGraceIntentRef = React__namespace.useRef(null);
|
|
407
|
-
const pointerDirRef = React__namespace.useRef("right");
|
|
408
|
-
const lastPointerXRef = React__namespace.useRef(0);
|
|
409
|
-
const ScrollLockWrapper = disableOutsideScroll ? Combination.ReactRemoveScroll : React__namespace.Fragment;
|
|
410
|
-
const scrollLockWrapperProps = disableOutsideScroll ? { as: Combination.Slot, allowPinchZoom: true } : void 0;
|
|
411
|
-
const handleTypeaheadSearch = (key) => {
|
|
412
|
-
const search = searchRef.current + key;
|
|
413
|
-
const items = getItems().filter((item) => !item.disabled);
|
|
414
|
-
const currentItem = document.activeElement;
|
|
415
|
-
const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;
|
|
416
|
-
const values = items.map((item) => item.textValue);
|
|
417
|
-
const nextMatch = getNextMatch(values, search, currentMatch);
|
|
418
|
-
const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;
|
|
419
|
-
(function updateSearch(value) {
|
|
420
|
-
searchRef.current = value;
|
|
421
|
-
window.clearTimeout(timerRef.current);
|
|
422
|
-
if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3);
|
|
423
|
-
})(search);
|
|
424
|
-
if (newItem) {
|
|
425
|
-
setTimeout(() => newItem.focus());
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
React__namespace.useEffect(() => {
|
|
429
|
-
return () => window.clearTimeout(timerRef.current);
|
|
430
|
-
}, []);
|
|
431
|
-
Combination.useFocusGuards();
|
|
432
|
-
const isPointerMovingToSubmenu = React__namespace.useCallback((event) => {
|
|
433
|
-
const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
|
|
434
|
-
return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
|
|
435
|
-
}, []);
|
|
436
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
437
|
-
MenuContentProvider,
|
|
438
|
-
{
|
|
439
|
-
scope: __scopeMenu,
|
|
440
|
-
searchRef,
|
|
441
|
-
onItemEnter: React__namespace.useCallback(
|
|
442
|
-
(event) => {
|
|
443
|
-
if (isPointerMovingToSubmenu(event)) event.preventDefault();
|
|
444
|
-
},
|
|
445
|
-
[isPointerMovingToSubmenu]
|
|
446
|
-
),
|
|
447
|
-
onItemLeave: React__namespace.useCallback(
|
|
448
|
-
(event) => {
|
|
449
|
-
if (isPointerMovingToSubmenu(event)) return;
|
|
450
|
-
contentRef.current?.focus();
|
|
451
|
-
setCurrentItemId(null);
|
|
452
|
-
},
|
|
453
|
-
[isPointerMovingToSubmenu]
|
|
454
|
-
),
|
|
455
|
-
onTriggerLeave: React__namespace.useCallback(
|
|
456
|
-
(event) => {
|
|
457
|
-
if (isPointerMovingToSubmenu(event)) event.preventDefault();
|
|
458
|
-
},
|
|
459
|
-
[isPointerMovingToSubmenu]
|
|
460
|
-
),
|
|
461
|
-
pointerGraceTimerRef,
|
|
462
|
-
onPointerGraceIntentChange: React__namespace.useCallback((intent) => {
|
|
463
|
-
pointerGraceIntentRef.current = intent;
|
|
464
|
-
}, []),
|
|
465
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
466
|
-
Combination.FocusScope,
|
|
467
|
-
{
|
|
468
|
-
asChild: true,
|
|
469
|
-
trapped: trapFocus,
|
|
470
|
-
onMountAutoFocus: Combination.composeEventHandlers(onOpenAutoFocus, (event) => {
|
|
471
|
-
event.preventDefault();
|
|
472
|
-
contentRef.current?.focus({ preventScroll: true });
|
|
473
|
-
}),
|
|
474
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
475
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
476
|
-
Combination.DismissableLayer,
|
|
477
|
-
{
|
|
478
|
-
asChild: true,
|
|
479
|
-
disableOutsidePointerEvents,
|
|
480
|
-
onEscapeKeyDown,
|
|
481
|
-
onPointerDownOutside,
|
|
482
|
-
onFocusOutside,
|
|
483
|
-
onInteractOutside,
|
|
484
|
-
onDismiss,
|
|
485
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
486
|
-
Root,
|
|
487
|
-
{
|
|
488
|
-
asChild: true,
|
|
489
|
-
...rovingFocusGroupScope,
|
|
490
|
-
dir: rootContext.dir,
|
|
491
|
-
orientation: "vertical",
|
|
492
|
-
loop,
|
|
493
|
-
currentTabStopId: currentItemId,
|
|
494
|
-
onCurrentTabStopIdChange: setCurrentItemId,
|
|
495
|
-
onEntryFocus: Combination.composeEventHandlers(onEntryFocus, (event) => {
|
|
496
|
-
if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
|
|
497
|
-
}),
|
|
498
|
-
preventScrollOnEntryFocus: true,
|
|
499
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
500
|
-
index$2.Content,
|
|
501
|
-
{
|
|
502
|
-
role: "menu",
|
|
503
|
-
"aria-orientation": "vertical",
|
|
504
|
-
"data-state": getOpenState(context.open),
|
|
505
|
-
"data-radix-menu-content": "",
|
|
506
|
-
dir: rootContext.dir,
|
|
507
|
-
...popperScope,
|
|
508
|
-
...contentProps,
|
|
509
|
-
ref: composedRefs,
|
|
510
|
-
style: { outline: "none", ...contentProps.style },
|
|
511
|
-
onKeyDown: Combination.composeEventHandlers(contentProps.onKeyDown, (event) => {
|
|
512
|
-
const target = event.target;
|
|
513
|
-
const isKeyDownInside = target.closest("[data-radix-menu-content]") === event.currentTarget;
|
|
514
|
-
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
515
|
-
const isCharacterKey = event.key.length === 1;
|
|
516
|
-
if (isKeyDownInside) {
|
|
517
|
-
if (event.key === "Tab") event.preventDefault();
|
|
518
|
-
if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);
|
|
519
|
-
}
|
|
520
|
-
const content = contentRef.current;
|
|
521
|
-
if (event.target !== content) return;
|
|
522
|
-
if (!FIRST_LAST_KEYS.includes(event.key)) return;
|
|
523
|
-
event.preventDefault();
|
|
524
|
-
const items = getItems().filter((item) => !item.disabled);
|
|
525
|
-
const candidateNodes = items.map((item) => item.ref.current);
|
|
526
|
-
if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();
|
|
527
|
-
focusFirst(candidateNodes);
|
|
528
|
-
}),
|
|
529
|
-
onBlur: Combination.composeEventHandlers(props.onBlur, (event) => {
|
|
530
|
-
if (!event.currentTarget.contains(event.target)) {
|
|
531
|
-
window.clearTimeout(timerRef.current);
|
|
532
|
-
searchRef.current = "";
|
|
533
|
-
}
|
|
534
|
-
}),
|
|
535
|
-
onPointerMove: Combination.composeEventHandlers(
|
|
536
|
-
props.onPointerMove,
|
|
537
|
-
whenMouse((event) => {
|
|
538
|
-
const target = event.target;
|
|
539
|
-
const pointerXHasChanged = lastPointerXRef.current !== event.clientX;
|
|
540
|
-
if (event.currentTarget.contains(target) && pointerXHasChanged) {
|
|
541
|
-
const newDir = event.clientX > lastPointerXRef.current ? "right" : "left";
|
|
542
|
-
pointerDirRef.current = newDir;
|
|
543
|
-
lastPointerXRef.current = event.clientX;
|
|
544
|
-
}
|
|
545
|
-
})
|
|
546
|
-
)
|
|
547
|
-
}
|
|
548
|
-
)
|
|
549
|
-
}
|
|
550
|
-
)
|
|
551
|
-
}
|
|
552
|
-
)
|
|
553
|
-
}
|
|
554
|
-
) })
|
|
555
|
-
}
|
|
556
|
-
);
|
|
557
|
-
}
|
|
558
|
-
);
|
|
559
|
-
MenuContent$1.displayName = CONTENT_NAME$1;
|
|
560
|
-
var GROUP_NAME$1 = "MenuGroup";
|
|
561
|
-
var MenuGroup = React__namespace.forwardRef(
|
|
562
|
-
(props, forwardedRef) => {
|
|
563
|
-
const { __scopeMenu, ...groupProps } = props;
|
|
564
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Combination.Primitive.div, { role: "group", ...groupProps, ref: forwardedRef });
|
|
565
|
-
}
|
|
566
|
-
);
|
|
567
|
-
MenuGroup.displayName = GROUP_NAME$1;
|
|
568
|
-
var LABEL_NAME$1 = "MenuLabel";
|
|
569
|
-
var MenuLabel = React__namespace.forwardRef(
|
|
570
|
-
(props, forwardedRef) => {
|
|
571
|
-
const { __scopeMenu, ...labelProps } = props;
|
|
572
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Combination.Primitive.div, { ...labelProps, ref: forwardedRef });
|
|
573
|
-
}
|
|
574
|
-
);
|
|
575
|
-
MenuLabel.displayName = LABEL_NAME$1;
|
|
576
|
-
var ITEM_NAME$1 = "MenuItem";
|
|
577
|
-
var ITEM_SELECT = "menu.itemSelect";
|
|
578
|
-
var MenuItem = React__namespace.forwardRef(
|
|
579
|
-
(props, forwardedRef) => {
|
|
580
|
-
const { disabled = false, onSelect, ...itemProps } = props;
|
|
581
|
-
const ref = React__namespace.useRef(null);
|
|
582
|
-
const rootContext = useMenuRootContext(ITEM_NAME$1, props.__scopeMenu);
|
|
583
|
-
const contentContext = useMenuContentContext(ITEM_NAME$1, props.__scopeMenu);
|
|
584
|
-
const composedRefs = Combination.useComposedRefs(forwardedRef, ref);
|
|
585
|
-
const isPointerDownRef = React__namespace.useRef(false);
|
|
586
|
-
const handleSelect = () => {
|
|
587
|
-
const menuItem = ref.current;
|
|
588
|
-
if (!disabled && menuItem) {
|
|
589
|
-
const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true });
|
|
590
|
-
menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });
|
|
591
|
-
Combination.dispatchDiscreteCustomEvent(menuItem, itemSelectEvent);
|
|
592
|
-
if (itemSelectEvent.defaultPrevented) {
|
|
593
|
-
isPointerDownRef.current = false;
|
|
594
|
-
} else {
|
|
595
|
-
rootContext.onClose();
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
600
|
-
MenuItemImpl,
|
|
601
|
-
{
|
|
602
|
-
...itemProps,
|
|
603
|
-
ref: composedRefs,
|
|
604
|
-
disabled,
|
|
605
|
-
onClick: Combination.composeEventHandlers(props.onClick, handleSelect),
|
|
606
|
-
onPointerDown: (event) => {
|
|
607
|
-
props.onPointerDown?.(event);
|
|
608
|
-
isPointerDownRef.current = true;
|
|
609
|
-
},
|
|
610
|
-
onPointerUp: Combination.composeEventHandlers(props.onPointerUp, (event) => {
|
|
611
|
-
if (!isPointerDownRef.current) event.currentTarget?.click();
|
|
612
|
-
}),
|
|
613
|
-
onKeyDown: Combination.composeEventHandlers(props.onKeyDown, (event) => {
|
|
614
|
-
const isTypingAhead = contentContext.searchRef.current !== "";
|
|
615
|
-
if (disabled || isTypingAhead && event.key === " ") return;
|
|
616
|
-
if (SELECTION_KEYS.includes(event.key)) {
|
|
617
|
-
event.currentTarget.click();
|
|
618
|
-
event.preventDefault();
|
|
619
|
-
}
|
|
620
|
-
})
|
|
621
|
-
}
|
|
622
|
-
);
|
|
623
|
-
}
|
|
624
|
-
);
|
|
625
|
-
MenuItem.displayName = ITEM_NAME$1;
|
|
626
|
-
var MenuItemImpl = React__namespace.forwardRef(
|
|
627
|
-
(props, forwardedRef) => {
|
|
628
|
-
const { __scopeMenu, disabled = false, textValue, ...itemProps } = props;
|
|
629
|
-
const contentContext = useMenuContentContext(ITEM_NAME$1, __scopeMenu);
|
|
630
|
-
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
|
|
631
|
-
const ref = React__namespace.useRef(null);
|
|
632
|
-
const composedRefs = Combination.useComposedRefs(forwardedRef, ref);
|
|
633
|
-
const [isFocused, setIsFocused] = React__namespace.useState(false);
|
|
634
|
-
const [textContent, setTextContent] = React__namespace.useState("");
|
|
635
|
-
React__namespace.useEffect(() => {
|
|
636
|
-
const menuItem = ref.current;
|
|
637
|
-
if (menuItem) {
|
|
638
|
-
setTextContent((menuItem.textContent ?? "").trim());
|
|
639
|
-
}
|
|
640
|
-
}, [itemProps.children]);
|
|
641
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
642
|
-
Collection.ItemSlot,
|
|
643
|
-
{
|
|
644
|
-
scope: __scopeMenu,
|
|
645
|
-
disabled,
|
|
646
|
-
textValue: textValue ?? textContent,
|
|
647
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Item, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
648
|
-
Combination.Primitive.div,
|
|
649
|
-
{
|
|
650
|
-
role: "menuitem",
|
|
651
|
-
"data-highlighted": isFocused ? "" : void 0,
|
|
652
|
-
"aria-disabled": disabled || void 0,
|
|
653
|
-
"data-disabled": disabled ? "" : void 0,
|
|
654
|
-
...itemProps,
|
|
655
|
-
ref: composedRefs,
|
|
656
|
-
onPointerMove: Combination.composeEventHandlers(
|
|
657
|
-
props.onPointerMove,
|
|
658
|
-
whenMouse((event) => {
|
|
659
|
-
if (disabled) {
|
|
660
|
-
contentContext.onItemLeave(event);
|
|
661
|
-
} else {
|
|
662
|
-
contentContext.onItemEnter(event);
|
|
663
|
-
if (!event.defaultPrevented) {
|
|
664
|
-
const item = event.currentTarget;
|
|
665
|
-
item.focus({ preventScroll: true });
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
})
|
|
669
|
-
),
|
|
670
|
-
onPointerLeave: Combination.composeEventHandlers(
|
|
671
|
-
props.onPointerLeave,
|
|
672
|
-
whenMouse((event) => contentContext.onItemLeave(event))
|
|
673
|
-
),
|
|
674
|
-
onFocus: Combination.composeEventHandlers(props.onFocus, () => setIsFocused(true)),
|
|
675
|
-
onBlur: Combination.composeEventHandlers(props.onBlur, () => setIsFocused(false))
|
|
676
|
-
}
|
|
677
|
-
) })
|
|
678
|
-
}
|
|
679
|
-
);
|
|
680
|
-
}
|
|
681
|
-
);
|
|
682
|
-
var CHECKBOX_ITEM_NAME$1 = "MenuCheckboxItem";
|
|
683
|
-
var MenuCheckboxItem = React__namespace.forwardRef(
|
|
684
|
-
(props, forwardedRef) => {
|
|
685
|
-
const { checked = false, onCheckedChange, ...checkboxItemProps } = props;
|
|
686
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
687
|
-
MenuItem,
|
|
688
|
-
{
|
|
689
|
-
role: "menuitemcheckbox",
|
|
690
|
-
"aria-checked": isIndeterminate(checked) ? "mixed" : checked,
|
|
691
|
-
...checkboxItemProps,
|
|
692
|
-
ref: forwardedRef,
|
|
693
|
-
"data-state": getCheckedState(checked),
|
|
694
|
-
onSelect: Combination.composeEventHandlers(
|
|
695
|
-
checkboxItemProps.onSelect,
|
|
696
|
-
() => onCheckedChange?.(isIndeterminate(checked) ? true : !checked),
|
|
697
|
-
{ checkForDefaultPrevented: false }
|
|
698
|
-
)
|
|
699
|
-
}
|
|
700
|
-
) });
|
|
701
|
-
}
|
|
702
|
-
);
|
|
703
|
-
MenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME$1;
|
|
704
|
-
var RADIO_GROUP_NAME$1 = "MenuRadioGroup";
|
|
705
|
-
var [RadioGroupProvider, useRadioGroupContext] = createMenuContext(
|
|
706
|
-
RADIO_GROUP_NAME$1,
|
|
707
|
-
{ value: void 0, onValueChange: () => {
|
|
708
|
-
} }
|
|
709
|
-
);
|
|
710
|
-
var MenuRadioGroup = React__namespace.forwardRef(
|
|
711
|
-
(props, forwardedRef) => {
|
|
712
|
-
const { value, onValueChange, ...groupProps } = props;
|
|
713
|
-
const handleValueChange = index$1.useCallbackRef(onValueChange);
|
|
714
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange, children: /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ...groupProps, ref: forwardedRef }) });
|
|
715
|
-
}
|
|
716
|
-
);
|
|
717
|
-
MenuRadioGroup.displayName = RADIO_GROUP_NAME$1;
|
|
718
|
-
var RADIO_ITEM_NAME$1 = "MenuRadioItem";
|
|
719
|
-
var MenuRadioItem = React__namespace.forwardRef(
|
|
720
|
-
(props, forwardedRef) => {
|
|
721
|
-
const { value, ...radioItemProps } = props;
|
|
722
|
-
const context = useRadioGroupContext(RADIO_ITEM_NAME$1, props.__scopeMenu);
|
|
723
|
-
const checked = value === context.value;
|
|
724
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
725
|
-
MenuItem,
|
|
726
|
-
{
|
|
727
|
-
role: "menuitemradio",
|
|
728
|
-
"aria-checked": checked,
|
|
729
|
-
...radioItemProps,
|
|
730
|
-
ref: forwardedRef,
|
|
731
|
-
"data-state": getCheckedState(checked),
|
|
732
|
-
onSelect: Combination.composeEventHandlers(
|
|
733
|
-
radioItemProps.onSelect,
|
|
734
|
-
() => context.onValueChange?.(value),
|
|
735
|
-
{ checkForDefaultPrevented: false }
|
|
736
|
-
)
|
|
737
|
-
}
|
|
738
|
-
) });
|
|
739
|
-
}
|
|
740
|
-
);
|
|
741
|
-
MenuRadioItem.displayName = RADIO_ITEM_NAME$1;
|
|
742
|
-
var ITEM_INDICATOR_NAME = "MenuItemIndicator";
|
|
743
|
-
var [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(
|
|
744
|
-
ITEM_INDICATOR_NAME,
|
|
745
|
-
{ checked: false }
|
|
746
|
-
);
|
|
747
|
-
var MenuItemIndicator = React__namespace.forwardRef(
|
|
748
|
-
(props, forwardedRef) => {
|
|
749
|
-
const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;
|
|
750
|
-
const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);
|
|
751
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
752
|
-
index$3.Presence,
|
|
753
|
-
{
|
|
754
|
-
present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true,
|
|
755
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
756
|
-
Combination.Primitive.span,
|
|
757
|
-
{
|
|
758
|
-
...itemIndicatorProps,
|
|
759
|
-
ref: forwardedRef,
|
|
760
|
-
"data-state": getCheckedState(indicatorContext.checked)
|
|
761
|
-
}
|
|
762
|
-
)
|
|
763
|
-
}
|
|
764
|
-
);
|
|
765
|
-
}
|
|
766
|
-
);
|
|
767
|
-
MenuItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
768
|
-
var SEPARATOR_NAME$1 = "MenuSeparator";
|
|
769
|
-
var MenuSeparator = React__namespace.forwardRef(
|
|
770
|
-
(props, forwardedRef) => {
|
|
771
|
-
const { __scopeMenu, ...separatorProps } = props;
|
|
772
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
773
|
-
Combination.Primitive.div,
|
|
774
|
-
{
|
|
775
|
-
role: "separator",
|
|
776
|
-
"aria-orientation": "horizontal",
|
|
777
|
-
...separatorProps,
|
|
778
|
-
ref: forwardedRef
|
|
779
|
-
}
|
|
780
|
-
);
|
|
781
|
-
}
|
|
782
|
-
);
|
|
783
|
-
MenuSeparator.displayName = SEPARATOR_NAME$1;
|
|
784
|
-
var ARROW_NAME$1 = "MenuArrow";
|
|
785
|
-
var MenuArrow = React__namespace.forwardRef(
|
|
786
|
-
(props, forwardedRef) => {
|
|
787
|
-
const { __scopeMenu, ...arrowProps } = props;
|
|
788
|
-
const popperScope = usePopperScope(__scopeMenu);
|
|
789
|
-
return /* @__PURE__ */ jsxRuntime.jsx(index$2.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
790
|
-
}
|
|
791
|
-
);
|
|
792
|
-
MenuArrow.displayName = ARROW_NAME$1;
|
|
793
|
-
var SUB_NAME = "MenuSub";
|
|
794
|
-
var [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME);
|
|
795
|
-
var MenuSub = (props) => {
|
|
796
|
-
const { __scopeMenu, children, open = false, onOpenChange } = props;
|
|
797
|
-
const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);
|
|
798
|
-
const popperScope = usePopperScope(__scopeMenu);
|
|
799
|
-
const [trigger, setTrigger] = React__namespace.useState(null);
|
|
800
|
-
const [content, setContent] = React__namespace.useState(null);
|
|
801
|
-
const handleOpenChange = index$1.useCallbackRef(onOpenChange);
|
|
802
|
-
React__namespace.useEffect(() => {
|
|
803
|
-
if (parentMenuContext.open === false) handleOpenChange(false);
|
|
804
|
-
return () => handleOpenChange(false);
|
|
805
|
-
}, [parentMenuContext.open, handleOpenChange]);
|
|
806
|
-
return /* @__PURE__ */ jsxRuntime.jsx(index$2.Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
807
|
-
MenuProvider,
|
|
808
|
-
{
|
|
809
|
-
scope: __scopeMenu,
|
|
810
|
-
open,
|
|
811
|
-
onOpenChange: handleOpenChange,
|
|
812
|
-
content,
|
|
813
|
-
onContentChange: setContent,
|
|
814
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
815
|
-
MenuSubProvider,
|
|
816
|
-
{
|
|
817
|
-
scope: __scopeMenu,
|
|
818
|
-
contentId: index$1.useId(),
|
|
819
|
-
triggerId: index$1.useId(),
|
|
820
|
-
trigger,
|
|
821
|
-
onTriggerChange: setTrigger,
|
|
822
|
-
children
|
|
823
|
-
}
|
|
824
|
-
)
|
|
825
|
-
}
|
|
826
|
-
) });
|
|
827
|
-
};
|
|
828
|
-
MenuSub.displayName = SUB_NAME;
|
|
829
|
-
var SUB_TRIGGER_NAME$1 = "MenuSubTrigger";
|
|
830
|
-
var MenuSubTrigger = React__namespace.forwardRef(
|
|
831
|
-
(props, forwardedRef) => {
|
|
832
|
-
const context = useMenuContext(SUB_TRIGGER_NAME$1, props.__scopeMenu);
|
|
833
|
-
const rootContext = useMenuRootContext(SUB_TRIGGER_NAME$1, props.__scopeMenu);
|
|
834
|
-
const subContext = useMenuSubContext(SUB_TRIGGER_NAME$1, props.__scopeMenu);
|
|
835
|
-
const contentContext = useMenuContentContext(SUB_TRIGGER_NAME$1, props.__scopeMenu);
|
|
836
|
-
const openTimerRef = React__namespace.useRef(null);
|
|
837
|
-
const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;
|
|
838
|
-
const scope = { __scopeMenu: props.__scopeMenu };
|
|
839
|
-
const clearOpenTimer = React__namespace.useCallback(() => {
|
|
840
|
-
if (openTimerRef.current) window.clearTimeout(openTimerRef.current);
|
|
841
|
-
openTimerRef.current = null;
|
|
842
|
-
}, []);
|
|
843
|
-
React__namespace.useEffect(() => clearOpenTimer, [clearOpenTimer]);
|
|
844
|
-
React__namespace.useEffect(() => {
|
|
845
|
-
const pointerGraceTimer = pointerGraceTimerRef.current;
|
|
846
|
-
return () => {
|
|
847
|
-
window.clearTimeout(pointerGraceTimer);
|
|
848
|
-
onPointerGraceIntentChange(null);
|
|
849
|
-
};
|
|
850
|
-
}, [pointerGraceTimerRef, onPointerGraceIntentChange]);
|
|
851
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
852
|
-
MenuItemImpl,
|
|
853
|
-
{
|
|
854
|
-
id: subContext.triggerId,
|
|
855
|
-
"aria-haspopup": "menu",
|
|
856
|
-
"aria-expanded": context.open,
|
|
857
|
-
"aria-controls": subContext.contentId,
|
|
858
|
-
"data-state": getOpenState(context.open),
|
|
859
|
-
...props,
|
|
860
|
-
ref: Combination.composeRefs(forwardedRef, subContext.onTriggerChange),
|
|
861
|
-
onClick: (event) => {
|
|
862
|
-
props.onClick?.(event);
|
|
863
|
-
if (props.disabled || event.defaultPrevented) return;
|
|
864
|
-
event.currentTarget.focus();
|
|
865
|
-
if (!context.open) context.onOpenChange(true);
|
|
866
|
-
},
|
|
867
|
-
onPointerMove: Combination.composeEventHandlers(
|
|
868
|
-
props.onPointerMove,
|
|
869
|
-
whenMouse((event) => {
|
|
870
|
-
contentContext.onItemEnter(event);
|
|
871
|
-
if (event.defaultPrevented) return;
|
|
872
|
-
if (!props.disabled && !context.open && !openTimerRef.current) {
|
|
873
|
-
contentContext.onPointerGraceIntentChange(null);
|
|
874
|
-
openTimerRef.current = window.setTimeout(() => {
|
|
875
|
-
context.onOpenChange(true);
|
|
876
|
-
clearOpenTimer();
|
|
877
|
-
}, 100);
|
|
878
|
-
}
|
|
879
|
-
})
|
|
880
|
-
),
|
|
881
|
-
onPointerLeave: Combination.composeEventHandlers(
|
|
882
|
-
props.onPointerLeave,
|
|
883
|
-
whenMouse((event) => {
|
|
884
|
-
clearOpenTimer();
|
|
885
|
-
const contentRect = context.content?.getBoundingClientRect();
|
|
886
|
-
if (contentRect) {
|
|
887
|
-
const side = context.content?.dataset.side;
|
|
888
|
-
const rightSide = side === "right";
|
|
889
|
-
const bleed = rightSide ? -5 : 5;
|
|
890
|
-
const contentNearEdge = contentRect[rightSide ? "left" : "right"];
|
|
891
|
-
const contentFarEdge = contentRect[rightSide ? "right" : "left"];
|
|
892
|
-
contentContext.onPointerGraceIntentChange({
|
|
893
|
-
area: [
|
|
894
|
-
// Apply a bleed on clientX to ensure that our exit point is
|
|
895
|
-
// consistently within polygon bounds
|
|
896
|
-
{ x: event.clientX + bleed, y: event.clientY },
|
|
897
|
-
{ x: contentNearEdge, y: contentRect.top },
|
|
898
|
-
{ x: contentFarEdge, y: contentRect.top },
|
|
899
|
-
{ x: contentFarEdge, y: contentRect.bottom },
|
|
900
|
-
{ x: contentNearEdge, y: contentRect.bottom }
|
|
901
|
-
],
|
|
902
|
-
side
|
|
903
|
-
});
|
|
904
|
-
window.clearTimeout(pointerGraceTimerRef.current);
|
|
905
|
-
pointerGraceTimerRef.current = window.setTimeout(
|
|
906
|
-
() => contentContext.onPointerGraceIntentChange(null),
|
|
907
|
-
300
|
|
908
|
-
);
|
|
909
|
-
} else {
|
|
910
|
-
contentContext.onTriggerLeave(event);
|
|
911
|
-
if (event.defaultPrevented) return;
|
|
912
|
-
contentContext.onPointerGraceIntentChange(null);
|
|
913
|
-
}
|
|
914
|
-
})
|
|
915
|
-
),
|
|
916
|
-
onKeyDown: Combination.composeEventHandlers(props.onKeyDown, (event) => {
|
|
917
|
-
const isTypingAhead = contentContext.searchRef.current !== "";
|
|
918
|
-
if (props.disabled || isTypingAhead && event.key === " ") return;
|
|
919
|
-
if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) {
|
|
920
|
-
context.onOpenChange(true);
|
|
921
|
-
context.content?.focus();
|
|
922
|
-
event.preventDefault();
|
|
923
|
-
}
|
|
924
|
-
})
|
|
925
|
-
}
|
|
926
|
-
) });
|
|
927
|
-
}
|
|
928
|
-
);
|
|
929
|
-
MenuSubTrigger.displayName = SUB_TRIGGER_NAME$1;
|
|
930
|
-
var SUB_CONTENT_NAME$1 = "MenuSubContent";
|
|
931
|
-
var MenuSubContent = React__namespace.forwardRef(
|
|
932
|
-
(props, forwardedRef) => {
|
|
933
|
-
const portalContext = usePortalContext(CONTENT_NAME$1, props.__scopeMenu);
|
|
934
|
-
const { forceMount = portalContext.forceMount, ...subContentProps } = props;
|
|
935
|
-
const context = useMenuContext(CONTENT_NAME$1, props.__scopeMenu);
|
|
936
|
-
const rootContext = useMenuRootContext(CONTENT_NAME$1, props.__scopeMenu);
|
|
937
|
-
const subContext = useMenuSubContext(SUB_CONTENT_NAME$1, props.__scopeMenu);
|
|
938
|
-
const ref = React__namespace.useRef(null);
|
|
939
|
-
const composedRefs = Combination.useComposedRefs(forwardedRef, ref);
|
|
940
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsxRuntime.jsx(index$3.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Collection.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
941
|
-
MenuContentImpl,
|
|
942
|
-
{
|
|
943
|
-
id: subContext.contentId,
|
|
944
|
-
"aria-labelledby": subContext.triggerId,
|
|
945
|
-
...subContentProps,
|
|
946
|
-
ref: composedRefs,
|
|
947
|
-
align: "start",
|
|
948
|
-
side: rootContext.dir === "rtl" ? "left" : "right",
|
|
949
|
-
disableOutsidePointerEvents: false,
|
|
950
|
-
disableOutsideScroll: false,
|
|
951
|
-
trapFocus: false,
|
|
952
|
-
onOpenAutoFocus: (event) => {
|
|
953
|
-
if (rootContext.isUsingKeyboardRef.current) ref.current?.focus();
|
|
954
|
-
event.preventDefault();
|
|
955
|
-
},
|
|
956
|
-
onCloseAutoFocus: (event) => event.preventDefault(),
|
|
957
|
-
onFocusOutside: Combination.composeEventHandlers(props.onFocusOutside, (event) => {
|
|
958
|
-
if (event.target !== subContext.trigger) context.onOpenChange(false);
|
|
959
|
-
}),
|
|
960
|
-
onEscapeKeyDown: Combination.composeEventHandlers(props.onEscapeKeyDown, (event) => {
|
|
961
|
-
rootContext.onClose();
|
|
962
|
-
event.preventDefault();
|
|
963
|
-
}),
|
|
964
|
-
onKeyDown: Combination.composeEventHandlers(props.onKeyDown, (event) => {
|
|
965
|
-
const isKeyDownInside = event.currentTarget.contains(event.target);
|
|
966
|
-
const isCloseKey = SUB_CLOSE_KEYS[rootContext.dir].includes(event.key);
|
|
967
|
-
if (isKeyDownInside && isCloseKey) {
|
|
968
|
-
context.onOpenChange(false);
|
|
969
|
-
subContext.trigger?.focus();
|
|
970
|
-
event.preventDefault();
|
|
971
|
-
}
|
|
972
|
-
})
|
|
973
|
-
}
|
|
974
|
-
) }) }) });
|
|
975
|
-
}
|
|
976
|
-
);
|
|
977
|
-
MenuSubContent.displayName = SUB_CONTENT_NAME$1;
|
|
978
|
-
function getOpenState(open) {
|
|
979
|
-
return open ? "open" : "closed";
|
|
980
|
-
}
|
|
981
|
-
function isIndeterminate(checked) {
|
|
982
|
-
return checked === "indeterminate";
|
|
983
|
-
}
|
|
984
|
-
function getCheckedState(checked) {
|
|
985
|
-
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
986
|
-
}
|
|
987
|
-
function focusFirst(candidates) {
|
|
988
|
-
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
989
|
-
for (const candidate of candidates) {
|
|
990
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
991
|
-
candidate.focus();
|
|
992
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
function wrapArray(array, startIndex) {
|
|
996
|
-
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
997
|
-
}
|
|
998
|
-
function getNextMatch(values, search, currentMatch) {
|
|
999
|
-
const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
|
|
1000
|
-
const normalizedSearch = isRepeated ? search[0] : search;
|
|
1001
|
-
const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;
|
|
1002
|
-
let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));
|
|
1003
|
-
const excludeCurrentMatch = normalizedSearch.length === 1;
|
|
1004
|
-
if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);
|
|
1005
|
-
const nextMatch = wrappedValues.find(
|
|
1006
|
-
(value) => value.toLowerCase().startsWith(normalizedSearch.toLowerCase())
|
|
1007
|
-
);
|
|
1008
|
-
return nextMatch !== currentMatch ? nextMatch : void 0;
|
|
1009
|
-
}
|
|
1010
|
-
function isPointInPolygon(point, polygon) {
|
|
1011
|
-
const { x, y } = point;
|
|
1012
|
-
let inside = false;
|
|
1013
|
-
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
1014
|
-
const xi = polygon[i].x;
|
|
1015
|
-
const yi = polygon[i].y;
|
|
1016
|
-
const xj = polygon[j].x;
|
|
1017
|
-
const yj = polygon[j].y;
|
|
1018
|
-
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
1019
|
-
if (intersect) inside = !inside;
|
|
1020
|
-
}
|
|
1021
|
-
return inside;
|
|
1022
|
-
}
|
|
1023
|
-
function isPointerInGraceArea(event, area) {
|
|
1024
|
-
if (!area) return false;
|
|
1025
|
-
const cursorPos = { x: event.clientX, y: event.clientY };
|
|
1026
|
-
return isPointInPolygon(cursorPos, area);
|
|
1027
|
-
}
|
|
1028
|
-
function whenMouse(handler) {
|
|
1029
|
-
return (event) => event.pointerType === "mouse" ? handler(event) : void 0;
|
|
1030
|
-
}
|
|
1031
|
-
var Root3 = Menu;
|
|
1032
|
-
var Anchor2 = MenuAnchor;
|
|
1033
|
-
var Portal = MenuPortal;
|
|
1034
|
-
var Content2$1 = MenuContent$1;
|
|
1035
|
-
var Group = MenuGroup;
|
|
1036
|
-
var Label = MenuLabel;
|
|
1037
|
-
var Item2$1 = MenuItem;
|
|
1038
|
-
var CheckboxItem = MenuCheckboxItem;
|
|
1039
|
-
var RadioGroup = MenuRadioGroup;
|
|
1040
|
-
var RadioItem = MenuRadioItem;
|
|
1041
|
-
var ItemIndicator = MenuItemIndicator;
|
|
1042
|
-
var Separator = MenuSeparator;
|
|
1043
|
-
var Arrow2 = MenuArrow;
|
|
1044
|
-
var Sub = MenuSub;
|
|
1045
|
-
var SubTrigger = MenuSubTrigger;
|
|
1046
|
-
var SubContent = MenuSubContent;
|
|
1047
|
-
|
|
1048
|
-
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
1049
|
-
var [createDropdownMenuContext, createDropdownMenuScope] = index$1.createContextScope(
|
|
1050
|
-
DROPDOWN_MENU_NAME,
|
|
1051
|
-
[createMenuScope]
|
|
1052
|
-
);
|
|
1053
|
-
var useMenuScope = createMenuScope();
|
|
1054
|
-
var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
|
|
1055
|
-
var DropdownMenu = (props) => {
|
|
1056
|
-
const {
|
|
1057
|
-
__scopeDropdownMenu,
|
|
1058
|
-
children,
|
|
1059
|
-
dir,
|
|
1060
|
-
open: openProp,
|
|
1061
|
-
defaultOpen,
|
|
1062
|
-
onOpenChange,
|
|
1063
|
-
modal = true
|
|
1064
|
-
} = props;
|
|
1065
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1066
|
-
const triggerRef = React__namespace.useRef(null);
|
|
1067
|
-
const [open = false, setOpen] = index$1.useControllableState({
|
|
1068
|
-
prop: openProp,
|
|
1069
|
-
defaultProp: defaultOpen,
|
|
1070
|
-
onChange: onOpenChange
|
|
1071
|
-
});
|
|
1072
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1073
|
-
DropdownMenuProvider,
|
|
1074
|
-
{
|
|
1075
|
-
scope: __scopeDropdownMenu,
|
|
1076
|
-
triggerId: index$1.useId(),
|
|
1077
|
-
triggerRef,
|
|
1078
|
-
contentId: index$1.useId(),
|
|
1079
|
-
open,
|
|
1080
|
-
onOpenChange: setOpen,
|
|
1081
|
-
onOpenToggle: React__namespace.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
1082
|
-
modal,
|
|
1083
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Root3, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })
|
|
1084
|
-
}
|
|
1085
|
-
);
|
|
1086
|
-
};
|
|
1087
|
-
DropdownMenu.displayName = DROPDOWN_MENU_NAME;
|
|
1088
|
-
var TRIGGER_NAME = "DropdownMenuTrigger";
|
|
1089
|
-
var DropdownMenuTrigger = React__namespace.forwardRef(
|
|
1090
|
-
(props, forwardedRef) => {
|
|
1091
|
-
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
1092
|
-
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
1093
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1094
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Anchor2, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1095
|
-
Combination.Primitive.button,
|
|
1096
|
-
{
|
|
1097
|
-
type: "button",
|
|
1098
|
-
id: context.triggerId,
|
|
1099
|
-
"aria-haspopup": "menu",
|
|
1100
|
-
"aria-expanded": context.open,
|
|
1101
|
-
"aria-controls": context.open ? context.contentId : void 0,
|
|
1102
|
-
"data-state": context.open ? "open" : "closed",
|
|
1103
|
-
"data-disabled": disabled ? "" : void 0,
|
|
1104
|
-
disabled,
|
|
1105
|
-
...triggerProps,
|
|
1106
|
-
ref: Combination.composeRefs(forwardedRef, context.triggerRef),
|
|
1107
|
-
onPointerDown: Combination.composeEventHandlers(props.onPointerDown, (event) => {
|
|
1108
|
-
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
1109
|
-
context.onOpenToggle();
|
|
1110
|
-
if (!context.open) event.preventDefault();
|
|
1111
|
-
}
|
|
1112
|
-
}),
|
|
1113
|
-
onKeyDown: Combination.composeEventHandlers(props.onKeyDown, (event) => {
|
|
1114
|
-
if (disabled) return;
|
|
1115
|
-
if (["Enter", " "].includes(event.key)) context.onOpenToggle();
|
|
1116
|
-
if (event.key === "ArrowDown") context.onOpenChange(true);
|
|
1117
|
-
if (["Enter", " ", "ArrowDown"].includes(event.key)) event.preventDefault();
|
|
1118
|
-
})
|
|
1119
|
-
}
|
|
1120
|
-
) });
|
|
1121
|
-
}
|
|
1122
|
-
);
|
|
1123
|
-
DropdownMenuTrigger.displayName = TRIGGER_NAME;
|
|
1124
|
-
var PORTAL_NAME = "DropdownMenuPortal";
|
|
1125
|
-
var DropdownMenuPortal = (props) => {
|
|
1126
|
-
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
1127
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1128
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Portal, { ...menuScope, ...portalProps });
|
|
1129
|
-
};
|
|
1130
|
-
DropdownMenuPortal.displayName = PORTAL_NAME;
|
|
1131
|
-
var CONTENT_NAME = "DropdownMenuContent";
|
|
1132
|
-
var DropdownMenuContent = React__namespace.forwardRef(
|
|
1133
|
-
(props, forwardedRef) => {
|
|
1134
|
-
const { __scopeDropdownMenu, ...contentProps } = props;
|
|
1135
|
-
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
1136
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1137
|
-
const hasInteractedOutsideRef = React__namespace.useRef(false);
|
|
1138
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1139
|
-
Content2$1,
|
|
1140
|
-
{
|
|
1141
|
-
id: context.contentId,
|
|
1142
|
-
"aria-labelledby": context.triggerId,
|
|
1143
|
-
...menuScope,
|
|
1144
|
-
...contentProps,
|
|
1145
|
-
ref: forwardedRef,
|
|
1146
|
-
onCloseAutoFocus: Combination.composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
1147
|
-
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
1148
|
-
hasInteractedOutsideRef.current = false;
|
|
1149
|
-
event.preventDefault();
|
|
1150
|
-
}),
|
|
1151
|
-
onInteractOutside: Combination.composeEventHandlers(props.onInteractOutside, (event) => {
|
|
1152
|
-
const originalEvent = event.detail.originalEvent;
|
|
1153
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
1154
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
1155
|
-
if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;
|
|
1156
|
-
}),
|
|
1157
|
-
style: {
|
|
1158
|
-
...props.style,
|
|
1159
|
-
// re-namespace exposed content custom properties
|
|
1160
|
-
...{
|
|
1161
|
-
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1162
|
-
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
1163
|
-
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
1164
|
-
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1165
|
-
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
);
|
|
1170
|
-
}
|
|
1171
|
-
);
|
|
1172
|
-
DropdownMenuContent.displayName = CONTENT_NAME;
|
|
1173
|
-
var GROUP_NAME = "DropdownMenuGroup";
|
|
1174
|
-
var DropdownMenuGroup = React__namespace.forwardRef(
|
|
1175
|
-
(props, forwardedRef) => {
|
|
1176
|
-
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
1177
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1178
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Group, { ...menuScope, ...groupProps, ref: forwardedRef });
|
|
1179
|
-
}
|
|
1180
|
-
);
|
|
1181
|
-
DropdownMenuGroup.displayName = GROUP_NAME;
|
|
1182
|
-
var LABEL_NAME = "DropdownMenuLabel";
|
|
1183
|
-
var DropdownMenuLabel = React__namespace.forwardRef(
|
|
1184
|
-
(props, forwardedRef) => {
|
|
1185
|
-
const { __scopeDropdownMenu, ...labelProps } = props;
|
|
1186
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1187
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
|
1188
|
-
}
|
|
1189
|
-
);
|
|
1190
|
-
DropdownMenuLabel.displayName = LABEL_NAME;
|
|
1191
|
-
var ITEM_NAME = "DropdownMenuItem";
|
|
1192
|
-
var DropdownMenuItem = React__namespace.forwardRef(
|
|
1193
|
-
(props, forwardedRef) => {
|
|
1194
|
-
const { __scopeDropdownMenu, ...itemProps } = props;
|
|
1195
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1196
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Item2$1, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
1197
|
-
}
|
|
1198
|
-
);
|
|
1199
|
-
DropdownMenuItem.displayName = ITEM_NAME;
|
|
1200
|
-
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
|
1201
|
-
var DropdownMenuCheckboxItem = React__namespace.forwardRef((props, forwardedRef) => {
|
|
1202
|
-
const { __scopeDropdownMenu, ...checkboxItemProps } = props;
|
|
1203
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1204
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
|
|
1205
|
-
});
|
|
1206
|
-
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
1207
|
-
var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
|
|
1208
|
-
var DropdownMenuRadioGroup = React__namespace.forwardRef((props, forwardedRef) => {
|
|
1209
|
-
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
1210
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1211
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
|
|
1212
|
-
});
|
|
1213
|
-
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
1214
|
-
var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
|
|
1215
|
-
var DropdownMenuRadioItem = React__namespace.forwardRef((props, forwardedRef) => {
|
|
1216
|
-
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
|
1217
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1218
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
|
|
1219
|
-
});
|
|
1220
|
-
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
1221
|
-
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
1222
|
-
var DropdownMenuItemIndicator = React__namespace.forwardRef((props, forwardedRef) => {
|
|
1223
|
-
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
1224
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1225
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
|
|
1226
|
-
});
|
|
1227
|
-
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
1228
|
-
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
|
1229
|
-
var DropdownMenuSeparator = React__namespace.forwardRef((props, forwardedRef) => {
|
|
1230
|
-
const { __scopeDropdownMenu, ...separatorProps } = props;
|
|
1231
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1232
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
1233
|
-
});
|
|
1234
|
-
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
1235
|
-
var ARROW_NAME = "DropdownMenuArrow";
|
|
1236
|
-
var DropdownMenuArrow = React__namespace.forwardRef(
|
|
1237
|
-
(props, forwardedRef) => {
|
|
1238
|
-
const { __scopeDropdownMenu, ...arrowProps } = props;
|
|
1239
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1240
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Arrow2, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
|
1241
|
-
}
|
|
1242
|
-
);
|
|
1243
|
-
DropdownMenuArrow.displayName = ARROW_NAME;
|
|
1244
|
-
var DropdownMenuSub = (props) => {
|
|
1245
|
-
const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
|
|
1246
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1247
|
-
const [open = false, setOpen] = index$1.useControllableState({
|
|
1248
|
-
prop: openProp,
|
|
1249
|
-
defaultProp: defaultOpen,
|
|
1250
|
-
onChange: onOpenChange
|
|
1251
|
-
});
|
|
1252
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
|
1253
|
-
};
|
|
1254
|
-
var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
|
|
1255
|
-
var DropdownMenuSubTrigger = React__namespace.forwardRef((props, forwardedRef) => {
|
|
1256
|
-
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
1257
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1258
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
|
|
1259
|
-
});
|
|
1260
|
-
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
1261
|
-
var SUB_CONTENT_NAME = "DropdownMenuSubContent";
|
|
1262
|
-
var DropdownMenuSubContent = React__namespace.forwardRef((props, forwardedRef) => {
|
|
1263
|
-
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
1264
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1265
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1266
|
-
SubContent,
|
|
1267
|
-
{
|
|
1268
|
-
...menuScope,
|
|
1269
|
-
...subContentProps,
|
|
1270
|
-
ref: forwardedRef,
|
|
1271
|
-
style: {
|
|
1272
|
-
...props.style,
|
|
1273
|
-
// re-namespace exposed content custom properties
|
|
1274
|
-
...{
|
|
1275
|
-
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1276
|
-
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
1277
|
-
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
1278
|
-
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1279
|
-
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
);
|
|
1284
|
-
});
|
|
1285
|
-
DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
1286
|
-
var Root2 = DropdownMenu;
|
|
1287
|
-
var Trigger = DropdownMenuTrigger;
|
|
1288
|
-
var Portal2 = DropdownMenuPortal;
|
|
1289
|
-
var Content2 = DropdownMenuContent;
|
|
1290
|
-
var Group2 = DropdownMenuGroup;
|
|
1291
|
-
var Item2 = DropdownMenuItem;
|
|
1292
|
-
var CheckboxItem2 = DropdownMenuCheckboxItem;
|
|
1293
|
-
var RadioGroup2 = DropdownMenuRadioGroup;
|
|
1294
|
-
var RadioItem2 = DropdownMenuRadioItem;
|
|
1295
|
-
var Separator2 = DropdownMenuSeparator;
|
|
1296
|
-
var Sub2 = DropdownMenuSub;
|
|
1297
|
-
var SubTrigger2 = DropdownMenuSubTrigger;
|
|
1298
|
-
var SubContent2 = DropdownMenuSubContent;
|
|
1299
|
-
|
|
1300
|
-
/**
|
|
1301
|
-
* The component that pops out when the dropdown menu is open.
|
|
1302
|
-
*/
|
|
1303
|
-
var MenuContent = React.forwardRef(function (_a, ref) {
|
|
1304
|
-
var children = _a.children, width = _a.width, minWidth = _a.minWidth, maxWidth = _a.maxWidth, _b = _a.align, align = _b === void 0 ? "start" : _b, alignOffset = _a.alignOffset, side = _a.side, props = filterAttrs.__rest(_a, ["children", "width", "minWidth", "maxWidth", "align", "alignOffset", "side"]);
|
|
1305
|
-
return (React.createElement(Content2, filterAttrs.__assign({ ref: ref, style: { width: width, minWidth: minWidth, maxWidth: maxWidth }, className: "arc-MenuContent", sideOffset: 12, loop: true, collisionPadding: 12, forceMount: true, align: align, alignOffset: alignOffset, side: side }, filterAttrs.filterAttrs(props)), children));
|
|
1306
|
-
});
|
|
1307
|
-
|
|
1308
|
-
/**
|
|
1309
|
-
* The multi-level menu content that pops out when a menu item with children is hovered or clicked.
|
|
1310
|
-
*/
|
|
1311
|
-
var MenuItemMultiLevelContent = React.forwardRef(function (_a, ref) {
|
|
1312
|
-
var children = _a.children, width = _a.width, minWidth = _a.minWidth, maxWidth = _a.maxWidth, alignOffset = _a.alignOffset, props = filterAttrs.__rest(_a, ["children", "width", "minWidth", "maxWidth", "alignOffset"]);
|
|
1313
|
-
return (React.createElement(SubContent2, filterAttrs.__assign({ ref: ref, style: { width: width, minWidth: minWidth, maxWidth: maxWidth }, className: "arc-MenuContent", sideOffset: 24, collisionPadding: 12, avoidCollisions: true, alignOffset: alignOffset }, filterAttrs.filterAttrs(props)), children));
|
|
1314
|
-
});
|
|
1315
|
-
|
|
1316
|
-
exports.CheckboxItem2 = CheckboxItem2;
|
|
1317
|
-
exports.Group2 = Group2;
|
|
1318
|
-
exports.Item2 = Item2;
|
|
1319
|
-
exports.MenuContent = MenuContent;
|
|
1320
|
-
exports.MenuItemMultiLevelContent = MenuItemMultiLevelContent;
|
|
1321
|
-
exports.Portal2 = Portal2;
|
|
1322
|
-
exports.RadioGroup2 = RadioGroup2;
|
|
1323
|
-
exports.RadioItem2 = RadioItem2;
|
|
1324
|
-
exports.Root2 = Root2;
|
|
1325
|
-
exports.Separator2 = Separator2;
|
|
1326
|
-
exports.Sub2 = Sub2;
|
|
1327
|
-
exports.SubTrigger2 = SubTrigger2;
|
|
1328
|
-
exports.Trigger = Trigger;
|