@stevederico/skateboard-ui 3.0.2 → 3.6.0
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/App.jsx +13 -13
- package/CHANGELOG.md +64 -0
- package/README.md +59 -65
- package/components/AuthOverlay.jsx +4 -4
- package/components/ProtectedRoute.jsx +1 -1
- package/components/ThemeToggle.jsx +1 -1
- package/components/UpgradeSheet.jsx +2 -2
- package/{core → components/core}/DynamicIcon.jsx +1 -1
- package/{layout → components/layout}/Header.jsx +4 -4
- package/{layout → components/layout}/Layout.jsx +1 -1
- package/{layout → components/layout}/Sidebar.jsx +2 -2
- package/{layout → components/layout}/TabBar.jsx +1 -1
- package/{views → components/views}/LandingView.jsx +5 -5
- package/{views → components/views}/NotFound.jsx +2 -2
- package/{views → components/views}/PaymentView.jsx +1 -1
- package/{views → components/views}/SettingsView.jsx +6 -6
- package/{views → components/views}/SignInView.jsx +6 -6
- package/{views → components/views}/SignOutView.jsx +1 -1
- package/{views → components/views}/SignUpView.jsx +6 -6
- package/{views → components/views}/TextView.jsx +3 -3
- package/hooks/useAuthGate.js +1 -1
- package/index.js +1 -1
- package/package.json +32 -50
- package/shadcn/lib/base-ui/LICENSE +21 -0
- package/shadcn/lib/base-ui/_chunk-01rqe37g.js +70 -0
- package/shadcn/lib/base-ui/_chunk-0h5sskyw.js +347 -0
- package/shadcn/lib/base-ui/_chunk-0xhx4g7r.js +57 -0
- package/shadcn/lib/base-ui/_chunk-1e6khrvm.js +218 -0
- package/shadcn/lib/base-ui/_chunk-1s41sngz.js +302 -0
- package/shadcn/lib/base-ui/_chunk-20rtfsz9.js +23 -0
- package/shadcn/lib/base-ui/_chunk-2tyt8f8r.js +6034 -0
- package/shadcn/lib/base-ui/_chunk-3f31ka8n.js +11 -0
- package/shadcn/lib/base-ui/_chunk-3h6zpchb.js +89 -0
- package/shadcn/lib/base-ui/_chunk-4s0k3h7t.js +114 -0
- package/shadcn/lib/base-ui/_chunk-502wngfc.js +598 -0
- package/shadcn/lib/base-ui/_chunk-536jvgeq.js +68 -0
- package/shadcn/lib/base-ui/_chunk-611pz5sm.js +10 -0
- package/shadcn/lib/base-ui/_chunk-65zw5gs2.js +15 -0
- package/shadcn/lib/base-ui/_chunk-6b17g8t7.js +34 -0
- package/shadcn/lib/base-ui/_chunk-6xevjepc.js +15 -0
- package/shadcn/lib/base-ui/_chunk-71zm6zgv.js +16 -0
- package/shadcn/lib/base-ui/_chunk-7fmjymvh.js +32 -0
- package/shadcn/lib/base-ui/_chunk-7jjzay8b.js +176 -0
- package/shadcn/lib/base-ui/_chunk-7v1t86x1.js +43 -0
- package/shadcn/lib/base-ui/_chunk-85vrgzwr.js +227 -0
- package/shadcn/lib/base-ui/_chunk-8jz3hb7q.js +9 -0
- package/shadcn/lib/base-ui/_chunk-8kh3xk78.js +35 -0
- package/shadcn/lib/base-ui/_chunk-97tas84n.js +67 -0
- package/shadcn/lib/base-ui/_chunk-9nyxkvte.js +13 -0
- package/shadcn/lib/base-ui/_chunk-a8fwg9d0.js +52 -0
- package/shadcn/lib/base-ui/_chunk-agc6ew3g.js +29 -0
- package/shadcn/lib/base-ui/_chunk-aqwsk46c.js +64 -0
- package/shadcn/lib/base-ui/_chunk-atd5kq5q.js +803 -0
- package/shadcn/lib/base-ui/_chunk-atnkefgd.js +104 -0
- package/shadcn/lib/base-ui/_chunk-b40erthe.js +7 -0
- package/shadcn/lib/base-ui/_chunk-b5jsqt97.js +50 -0
- package/shadcn/lib/base-ui/_chunk-bk7n9s9e.js +15 -0
- package/shadcn/lib/base-ui/_chunk-c3572b5x.js +19 -0
- package/shadcn/lib/base-ui/_chunk-cwr896nf.js +25 -0
- package/shadcn/lib/base-ui/_chunk-drfb9kp2.js +27 -0
- package/shadcn/lib/base-ui/_chunk-ds8fnpjj.js +0 -0
- package/shadcn/lib/base-ui/_chunk-ek863ta9.js +82 -0
- package/shadcn/lib/base-ui/_chunk-f09cp81f.js +12 -0
- package/shadcn/lib/base-ui/_chunk-f5d01bp9.js +0 -0
- package/shadcn/lib/base-ui/_chunk-f9tgee1q.js +21 -0
- package/shadcn/lib/base-ui/_chunk-fch5cba8.js +84 -0
- package/shadcn/lib/base-ui/_chunk-gfce3j3z.js +18 -0
- package/shadcn/lib/base-ui/_chunk-ha06w2pp.js +2391 -0
- package/shadcn/lib/base-ui/_chunk-hzgetm70.js +23 -0
- package/shadcn/lib/base-ui/_chunk-j0eqdjta.js +39 -0
- package/shadcn/lib/base-ui/_chunk-k1e5fvcj.js +48 -0
- package/shadcn/lib/base-ui/_chunk-k4mc2kan.js +81 -0
- package/shadcn/lib/base-ui/_chunk-kfz96xv1.js +128 -0
- package/shadcn/lib/base-ui/_chunk-m45547cc.js +15 -0
- package/shadcn/lib/base-ui/_chunk-mbn76q14.js +184 -0
- package/shadcn/lib/base-ui/_chunk-mvv30fkv.js +9 -0
- package/shadcn/lib/base-ui/_chunk-mznt6ktj.js +33 -0
- package/shadcn/lib/base-ui/_chunk-n7dnqnbw.js +7 -0
- package/shadcn/lib/base-ui/_chunk-nya71ccw.js +546 -0
- package/shadcn/lib/base-ui/_chunk-p6qynd6r.js +146 -0
- package/shadcn/lib/base-ui/_chunk-q3nee19r.js +323 -0
- package/shadcn/lib/base-ui/_chunk-q7yw9mz4.js +385 -0
- package/shadcn/lib/base-ui/_chunk-qce0xt57.js +107 -0
- package/shadcn/lib/base-ui/_chunk-qgzhcjsj.js +14 -0
- package/shadcn/lib/base-ui/_chunk-qt6r015s.js +38 -0
- package/shadcn/lib/base-ui/_chunk-r0vsdknk.js +4 -0
- package/shadcn/lib/base-ui/_chunk-sx6vkz01.js +150 -0
- package/shadcn/lib/base-ui/_chunk-szcr6mhk.js +6 -0
- package/shadcn/lib/base-ui/_chunk-t7j3rbpv.js +67 -0
- package/shadcn/lib/base-ui/_chunk-tmfmrzwe.js +39 -0
- package/shadcn/lib/base-ui/_chunk-v92ycsfj.js +9 -0
- package/shadcn/lib/base-ui/_chunk-vdc01ss3.js +6 -0
- package/shadcn/lib/base-ui/_chunk-vjbnhhg1.js +26 -0
- package/shadcn/lib/base-ui/_chunk-w68yxg9d.js +21 -0
- package/shadcn/lib/base-ui/_chunk-wana68v3.js +477 -0
- package/shadcn/lib/base-ui/_chunk-wtw745qd.js +12 -0
- package/shadcn/lib/base-ui/_chunk-xb7ph1ka.js +6 -0
- package/shadcn/lib/base-ui/_chunk-xfagb0fq.js +28 -0
- package/shadcn/lib/base-ui/_chunk-xxhqanfd.js +16 -0
- package/shadcn/lib/base-ui/_chunk-y887e46p.js +15 -0
- package/shadcn/lib/base-ui/_chunk-ymj1dpqg.js +14 -0
- package/shadcn/lib/base-ui/accordion.js +650 -0
- package/shadcn/lib/base-ui/alert-dialog.js +138 -0
- package/shadcn/lib/base-ui/avatar.js +235 -0
- package/shadcn/lib/base-ui/button.js +52 -0
- package/shadcn/lib/base-ui/checkbox.js +454 -0
- package/shadcn/lib/base-ui/collapsible.js +283 -0
- package/shadcn/lib/base-ui/context-menu.js +324 -0
- package/shadcn/lib/base-ui/dialog.js +71 -0
- package/shadcn/lib/base-ui/input.js +1028 -0
- package/shadcn/lib/base-ui/menu.js +61 -0
- package/shadcn/lib/base-ui/menubar.js +157 -0
- package/shadcn/lib/base-ui/merge-props.js +15 -0
- package/shadcn/lib/base-ui/navigation-menu.js +1854 -0
- package/shadcn/lib/base-ui/popover.js +1090 -0
- package/shadcn/lib/base-ui/preview-card.js +709 -0
- package/shadcn/lib/base-ui/progress.js +278 -0
- package/shadcn/lib/base-ui/radio-group.js +247 -0
- package/shadcn/lib/base-ui/radio.js +382 -0
- package/shadcn/lib/base-ui/scroll-area.js +1061 -0
- package/shadcn/lib/base-ui/select.js +2438 -0
- package/shadcn/lib/base-ui/separator.js +11 -0
- package/shadcn/lib/base-ui/slider.js +1595 -0
- package/shadcn/lib/base-ui/switch.js +333 -0
- package/shadcn/lib/base-ui/tabs.js +892 -0
- package/shadcn/lib/base-ui/toggle-group.js +152 -0
- package/shadcn/lib/base-ui/toggle.js +133 -0
- package/shadcn/lib/base-ui/tooltip.js +791 -0
- package/shadcn/lib/base-ui/use-render.js +15 -0
- package/shadcn/lib/tailwind-merge.js +3312 -0
- package/shadcn/lib/utils.js +1 -1
- package/shadcn/ui/accordion.jsx +1 -1
- package/shadcn/ui/alert-dialog.jsx +1 -1
- package/shadcn/ui/avatar.jsx +1 -1
- package/shadcn/ui/badge.jsx +2 -2
- package/shadcn/ui/breadcrumb.jsx +2 -2
- package/shadcn/ui/button-group.jsx +2 -2
- package/shadcn/ui/button.jsx +1 -1
- package/shadcn/ui/calendar.jsx +1 -1
- package/shadcn/ui/checkbox.jsx +1 -1
- package/shadcn/ui/collapsible.jsx +1 -1
- package/shadcn/ui/command.jsx +1 -1
- package/shadcn/ui/context-menu.jsx +1 -1
- package/shadcn/ui/dialog.jsx +1 -1
- package/shadcn/ui/drawer.jsx +176 -74
- package/shadcn/ui/dropdown-menu.jsx +1 -1
- package/shadcn/ui/hover-card.jsx +1 -1
- package/shadcn/ui/input.jsx +1 -1
- package/shadcn/ui/item.jsx +2 -2
- package/shadcn/ui/menubar.jsx +2 -2
- package/shadcn/ui/navigation-menu.jsx +1 -1
- package/shadcn/ui/popover.jsx +1 -1
- package/shadcn/ui/progress.jsx +1 -1
- package/shadcn/ui/radio-group.jsx +2 -2
- package/shadcn/ui/scroll-area.jsx +1 -1
- package/shadcn/ui/select.jsx +1 -1
- package/shadcn/ui/separator.jsx +1 -1
- package/shadcn/ui/sheet.jsx +1 -1
- package/shadcn/ui/sidebar.jsx +3 -3
- package/shadcn/ui/slider.jsx +1 -1
- package/shadcn/ui/switch.jsx +1 -1
- package/shadcn/ui/tabs.jsx +1 -1
- package/shadcn/ui/toggle-group.jsx +2 -2
- package/shadcn/ui/toggle.jsx +1 -1
- package/shadcn/ui/tooltip.jsx +1 -1
- package/styles.css +31 -0
- package/MIGRATION.md +0 -230
- package/shadcn/ui/carousel.jsx +0 -195
- package/shadcn/ui/chart.jsx +0 -312
- package/shadcn/ui/resizable.jsx +0 -47
- /package/{core → components/core}/Calendar.jsx +0 -0
- /package/{core → components/core}/Command.jsx +0 -0
- /package/{core → components/core}/Context.jsx +0 -0
- /package/{core → components/core}/ThemeProvider.jsx +0 -0
- /package/{core → components/core}/Utilities.js +0 -0
|
@@ -0,0 +1,2391 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getPseudoElementBounds
|
|
3
|
+
} from "./_chunk-6b17g8t7.js";
|
|
4
|
+
import {
|
|
5
|
+
Separator
|
|
6
|
+
} from "./_chunk-7fmjymvh.js";
|
|
7
|
+
import {
|
|
8
|
+
useMenubarContext
|
|
9
|
+
} from "./_chunk-65zw5gs2.js";
|
|
10
|
+
import {
|
|
11
|
+
CompositeItem
|
|
12
|
+
} from "./_chunk-j0eqdjta.js";
|
|
13
|
+
import {
|
|
14
|
+
useTriggerFocusGuards
|
|
15
|
+
} from "./_chunk-0xhx4g7r.js";
|
|
16
|
+
import {
|
|
17
|
+
useAnchoredPopupScrollLock
|
|
18
|
+
} from "./_chunk-agc6ew3g.js";
|
|
19
|
+
import {
|
|
20
|
+
useToolbarRootContext
|
|
21
|
+
} from "./_chunk-y887e46p.js";
|
|
22
|
+
import {
|
|
23
|
+
usePopupViewport
|
|
24
|
+
} from "./_chunk-q7yw9mz4.js";
|
|
25
|
+
import {
|
|
26
|
+
adaptiveOrigin,
|
|
27
|
+
getDisabledMountTransitionStyles,
|
|
28
|
+
useAnchorPositioning,
|
|
29
|
+
usePositioner
|
|
30
|
+
} from "./_chunk-502wngfc.js";
|
|
31
|
+
import {
|
|
32
|
+
useCompositeListItem
|
|
33
|
+
} from "./_chunk-ek863ta9.js";
|
|
34
|
+
import {
|
|
35
|
+
isElementDisabled
|
|
36
|
+
} from "./_chunk-vdc01ss3.js";
|
|
37
|
+
import {
|
|
38
|
+
CompositeList
|
|
39
|
+
} from "./_chunk-p6qynd6r.js";
|
|
40
|
+
import {
|
|
41
|
+
useDirection
|
|
42
|
+
} from "./_chunk-wtw745qd.js";
|
|
43
|
+
import {
|
|
44
|
+
useControlled
|
|
45
|
+
} from "./_chunk-01rqe37g.js";
|
|
46
|
+
import {
|
|
47
|
+
InternalBackdrop,
|
|
48
|
+
useOpenInteractionType
|
|
49
|
+
} from "./_chunk-q3nee19r.js";
|
|
50
|
+
import {
|
|
51
|
+
createInitialPopupStoreState,
|
|
52
|
+
popupStoreSelectors,
|
|
53
|
+
useImplicitActiveTrigger,
|
|
54
|
+
useOpenStateTransitions,
|
|
55
|
+
useTriggerDataForwarding,
|
|
56
|
+
useTriggerRegistration
|
|
57
|
+
} from "./_chunk-7jjzay8b.js";
|
|
58
|
+
import {
|
|
59
|
+
useOnFirstRender
|
|
60
|
+
} from "./_chunk-f09cp81f.js";
|
|
61
|
+
import {
|
|
62
|
+
popupStateMapping,
|
|
63
|
+
pressableTriggerOpenStateMapping,
|
|
64
|
+
triggerOpenStateMapping
|
|
65
|
+
} from "./_chunk-536jvgeq.js";
|
|
66
|
+
import {
|
|
67
|
+
inertValue
|
|
68
|
+
} from "./_chunk-9nyxkvte.js";
|
|
69
|
+
import {
|
|
70
|
+
DROPDOWN_COLLISION_AVOIDANCE,
|
|
71
|
+
FloatingFocusManager,
|
|
72
|
+
FloatingNode,
|
|
73
|
+
FloatingPortal,
|
|
74
|
+
FloatingTree,
|
|
75
|
+
FloatingTreeStore,
|
|
76
|
+
FocusGuard,
|
|
77
|
+
PATIENT_CLICK_THRESHOLD,
|
|
78
|
+
POPUP_COLLISION_AVOIDANCE,
|
|
79
|
+
PopupTriggerMap,
|
|
80
|
+
ReactStore,
|
|
81
|
+
TYPEAHEAD_RESET_MS,
|
|
82
|
+
createSelector,
|
|
83
|
+
fastComponent,
|
|
84
|
+
fastComponentRef,
|
|
85
|
+
safePolygon,
|
|
86
|
+
useClick,
|
|
87
|
+
useDismiss,
|
|
88
|
+
useFloatingNodeId,
|
|
89
|
+
useFloatingParentNodeId,
|
|
90
|
+
useFloatingTree,
|
|
91
|
+
useFocus,
|
|
92
|
+
useHoverFloatingInteraction,
|
|
93
|
+
useHoverReferenceInteraction,
|
|
94
|
+
useInteractions,
|
|
95
|
+
useListNavigation,
|
|
96
|
+
useRole,
|
|
97
|
+
useSyncedFloatingRootContext,
|
|
98
|
+
useTypeahead
|
|
99
|
+
} from "./_chunk-2tyt8f8r.js";
|
|
100
|
+
import {
|
|
101
|
+
ownerDocument
|
|
102
|
+
} from "./_chunk-xb7ph1ka.js";
|
|
103
|
+
import {
|
|
104
|
+
contains
|
|
105
|
+
} from "./_chunk-atnkefgd.js";
|
|
106
|
+
import {
|
|
107
|
+
COMPOSITE_KEYS
|
|
108
|
+
} from "./_chunk-qce0xt57.js";
|
|
109
|
+
import {
|
|
110
|
+
isMac
|
|
111
|
+
} from "./_chunk-t7j3rbpv.js";
|
|
112
|
+
import {
|
|
113
|
+
useTimeout
|
|
114
|
+
} from "./_chunk-7v1t86x1.js";
|
|
115
|
+
import {
|
|
116
|
+
createChangeEventDetails,
|
|
117
|
+
exports_reason_parts
|
|
118
|
+
} from "./_chunk-4s0k3h7t.js";
|
|
119
|
+
import {
|
|
120
|
+
useBaseUiId,
|
|
121
|
+
useId
|
|
122
|
+
} from "./_chunk-8kh3xk78.js";
|
|
123
|
+
import {
|
|
124
|
+
transitionStatusMapping,
|
|
125
|
+
useAnimationsFinished,
|
|
126
|
+
useOpenChangeComplete,
|
|
127
|
+
useTransitionStatus
|
|
128
|
+
} from "./_chunk-mbn76q14.js";
|
|
129
|
+
import {
|
|
130
|
+
useButton
|
|
131
|
+
} from "./_chunk-85vrgzwr.js";
|
|
132
|
+
import {
|
|
133
|
+
useCompositeRootContext
|
|
134
|
+
} from "./_chunk-6xevjepc.js";
|
|
135
|
+
import {
|
|
136
|
+
getParentNode,
|
|
137
|
+
isHTMLElement,
|
|
138
|
+
isLastTraversableNode
|
|
139
|
+
} from "./_chunk-sx6vkz01.js";
|
|
140
|
+
import {
|
|
141
|
+
SafeReact
|
|
142
|
+
} from "./_chunk-n7dnqnbw.js";
|
|
143
|
+
import {
|
|
144
|
+
useStableCallback
|
|
145
|
+
} from "./_chunk-mznt6ktj.js";
|
|
146
|
+
import {
|
|
147
|
+
useIsoLayoutEffect
|
|
148
|
+
} from "./_chunk-b40erthe.js";
|
|
149
|
+
import {
|
|
150
|
+
EMPTY_ARRAY,
|
|
151
|
+
EMPTY_OBJECT,
|
|
152
|
+
useMergedRefs,
|
|
153
|
+
useRefWithInit,
|
|
154
|
+
useRenderElement,
|
|
155
|
+
warn
|
|
156
|
+
} from "./_chunk-1s41sngz.js";
|
|
157
|
+
import {
|
|
158
|
+
__export,
|
|
159
|
+
mergeProps
|
|
160
|
+
} from "./_chunk-1e6khrvm.js";
|
|
161
|
+
|
|
162
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/index.parts.js
|
|
163
|
+
var exports_index_parts = {};
|
|
164
|
+
__export(exports_index_parts, {
|
|
165
|
+
createHandle: () => createMenuHandle,
|
|
166
|
+
Viewport: () => MenuViewport,
|
|
167
|
+
Trigger: () => MenuTrigger,
|
|
168
|
+
SubmenuTrigger: () => MenuSubmenuTrigger,
|
|
169
|
+
SubmenuRoot: () => MenuSubmenuRoot,
|
|
170
|
+
Separator: () => Separator,
|
|
171
|
+
Root: () => MenuRoot,
|
|
172
|
+
RadioItemIndicator: () => MenuRadioItemIndicator,
|
|
173
|
+
RadioItem: () => MenuRadioItem,
|
|
174
|
+
RadioGroup: () => MenuRadioGroup,
|
|
175
|
+
Positioner: () => MenuPositioner,
|
|
176
|
+
Portal: () => MenuPortal,
|
|
177
|
+
Popup: () => MenuPopup,
|
|
178
|
+
LinkItem: () => MenuLinkItem,
|
|
179
|
+
Item: () => MenuItem,
|
|
180
|
+
Handle: () => MenuHandle,
|
|
181
|
+
GroupLabel: () => MenuGroupLabel,
|
|
182
|
+
Group: () => MenuGroup,
|
|
183
|
+
CheckboxItemIndicator: () => MenuCheckboxItemIndicator,
|
|
184
|
+
CheckboxItem: () => MenuCheckboxItem,
|
|
185
|
+
Backdrop: () => MenuBackdrop,
|
|
186
|
+
Arrow: () => MenuArrow
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/arrow/MenuArrow.js
|
|
190
|
+
import * as React3 from "react";
|
|
191
|
+
|
|
192
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/positioner/MenuPositionerContext.js
|
|
193
|
+
import * as React from "react";
|
|
194
|
+
"use client";
|
|
195
|
+
var MenuPositionerContext = /* @__PURE__ */ React.createContext(undefined);
|
|
196
|
+
if (true)
|
|
197
|
+
MenuPositionerContext.displayName = "MenuPositionerContext";
|
|
198
|
+
function useMenuPositionerContext(optional) {
|
|
199
|
+
const context = React.useContext(MenuPositionerContext);
|
|
200
|
+
if (context === undefined && !optional) {
|
|
201
|
+
throw new Error("Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>.");
|
|
202
|
+
}
|
|
203
|
+
return context;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/root/MenuRootContext.js
|
|
207
|
+
import * as React2 from "react";
|
|
208
|
+
"use client";
|
|
209
|
+
var MenuRootContext = /* @__PURE__ */ React2.createContext(undefined);
|
|
210
|
+
if (true)
|
|
211
|
+
MenuRootContext.displayName = "MenuRootContext";
|
|
212
|
+
function useMenuRootContext(optional) {
|
|
213
|
+
const context = React2.useContext(MenuRootContext);
|
|
214
|
+
if (context === undefined && !optional) {
|
|
215
|
+
throw new Error("Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.");
|
|
216
|
+
}
|
|
217
|
+
return context;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/arrow/MenuArrow.js
|
|
221
|
+
"use client";
|
|
222
|
+
var MenuArrow = /* @__PURE__ */ React3.forwardRef(function MenuArrow2(componentProps, forwardedRef) {
|
|
223
|
+
const {
|
|
224
|
+
className,
|
|
225
|
+
render,
|
|
226
|
+
style,
|
|
227
|
+
...elementProps
|
|
228
|
+
} = componentProps;
|
|
229
|
+
const {
|
|
230
|
+
store
|
|
231
|
+
} = useMenuRootContext();
|
|
232
|
+
const {
|
|
233
|
+
arrowRef,
|
|
234
|
+
side,
|
|
235
|
+
align,
|
|
236
|
+
arrowUncentered,
|
|
237
|
+
arrowStyles
|
|
238
|
+
} = useMenuPositionerContext();
|
|
239
|
+
const open = store.useState("open");
|
|
240
|
+
const state = {
|
|
241
|
+
open,
|
|
242
|
+
side,
|
|
243
|
+
align,
|
|
244
|
+
uncentered: arrowUncentered
|
|
245
|
+
};
|
|
246
|
+
return useRenderElement("div", componentProps, {
|
|
247
|
+
ref: [arrowRef, forwardedRef],
|
|
248
|
+
stateAttributesMapping: popupStateMapping,
|
|
249
|
+
state,
|
|
250
|
+
props: {
|
|
251
|
+
style: arrowStyles,
|
|
252
|
+
"aria-hidden": true,
|
|
253
|
+
...elementProps
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
if (true)
|
|
258
|
+
MenuArrow.displayName = "MenuArrow";
|
|
259
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/backdrop/MenuBackdrop.js
|
|
260
|
+
import * as React5 from "react";
|
|
261
|
+
|
|
262
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/context-menu/root/ContextMenuRootContext.js
|
|
263
|
+
import * as React4 from "react";
|
|
264
|
+
"use client";
|
|
265
|
+
var ContextMenuRootContext = /* @__PURE__ */ React4.createContext(undefined);
|
|
266
|
+
if (true)
|
|
267
|
+
ContextMenuRootContext.displayName = "ContextMenuRootContext";
|
|
268
|
+
function useContextMenuRootContext(optional = true) {
|
|
269
|
+
const context = React4.useContext(ContextMenuRootContext);
|
|
270
|
+
if (context === undefined && !optional) {
|
|
271
|
+
throw new Error("Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>.");
|
|
272
|
+
}
|
|
273
|
+
return context;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/backdrop/MenuBackdrop.js
|
|
277
|
+
"use client";
|
|
278
|
+
var stateAttributesMapping = {
|
|
279
|
+
...popupStateMapping,
|
|
280
|
+
...transitionStatusMapping
|
|
281
|
+
};
|
|
282
|
+
var MenuBackdrop = /* @__PURE__ */ React5.forwardRef(function MenuBackdrop2(componentProps, forwardedRef) {
|
|
283
|
+
const {
|
|
284
|
+
className,
|
|
285
|
+
render,
|
|
286
|
+
style,
|
|
287
|
+
...elementProps
|
|
288
|
+
} = componentProps;
|
|
289
|
+
const {
|
|
290
|
+
store
|
|
291
|
+
} = useMenuRootContext();
|
|
292
|
+
const open = store.useState("open");
|
|
293
|
+
const mounted = store.useState("mounted");
|
|
294
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
295
|
+
const lastOpenChangeReason = store.useState("lastOpenChangeReason");
|
|
296
|
+
const contextMenuContext = useContextMenuRootContext();
|
|
297
|
+
const state = {
|
|
298
|
+
open,
|
|
299
|
+
transitionStatus
|
|
300
|
+
};
|
|
301
|
+
return useRenderElement("div", componentProps, {
|
|
302
|
+
ref: contextMenuContext?.backdropRef ? [forwardedRef, contextMenuContext.backdropRef] : forwardedRef,
|
|
303
|
+
state,
|
|
304
|
+
stateAttributesMapping,
|
|
305
|
+
props: [{
|
|
306
|
+
role: "presentation",
|
|
307
|
+
hidden: !mounted,
|
|
308
|
+
style: {
|
|
309
|
+
pointerEvents: lastOpenChangeReason === exports_reason_parts.triggerHover ? "none" : undefined,
|
|
310
|
+
userSelect: "none",
|
|
311
|
+
WebkitUserSelect: "none"
|
|
312
|
+
}
|
|
313
|
+
}, elementProps]
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
if (true)
|
|
317
|
+
MenuBackdrop.displayName = "MenuBackdrop";
|
|
318
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItem.js
|
|
319
|
+
import * as React9 from "react";
|
|
320
|
+
|
|
321
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItemContext.js
|
|
322
|
+
import * as React6 from "react";
|
|
323
|
+
"use client";
|
|
324
|
+
var MenuCheckboxItemContext = /* @__PURE__ */ React6.createContext(undefined);
|
|
325
|
+
if (true)
|
|
326
|
+
MenuCheckboxItemContext.displayName = "MenuCheckboxItemContext";
|
|
327
|
+
function useMenuCheckboxItemContext() {
|
|
328
|
+
const context = React6.useContext(MenuCheckboxItemContext);
|
|
329
|
+
if (context === undefined) {
|
|
330
|
+
throw new Error("Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>.");
|
|
331
|
+
}
|
|
332
|
+
return context;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/item/useMenuItem.js
|
|
336
|
+
import * as React8 from "react";
|
|
337
|
+
|
|
338
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/item/useMenuItemCommonProps.js
|
|
339
|
+
import * as React7 from "react";
|
|
340
|
+
"use client";
|
|
341
|
+
function useMenuItemCommonProps(params) {
|
|
342
|
+
const {
|
|
343
|
+
closeOnClick,
|
|
344
|
+
highlighted,
|
|
345
|
+
id,
|
|
346
|
+
nodeId,
|
|
347
|
+
store,
|
|
348
|
+
typingRef,
|
|
349
|
+
itemRef,
|
|
350
|
+
itemMetadata
|
|
351
|
+
} = params;
|
|
352
|
+
const {
|
|
353
|
+
events: menuEvents
|
|
354
|
+
} = store.useState("floatingTreeRoot");
|
|
355
|
+
const contextMenuContext = useContextMenuRootContext(true);
|
|
356
|
+
const isContextMenu = contextMenuContext !== undefined;
|
|
357
|
+
return React7.useMemo(() => ({
|
|
358
|
+
id,
|
|
359
|
+
role: "menuitem",
|
|
360
|
+
tabIndex: highlighted ? 0 : -1,
|
|
361
|
+
onKeyDown(event) {
|
|
362
|
+
if (event.key === " " && typingRef?.current) {
|
|
363
|
+
event.preventDefault();
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
onMouseMove(event) {
|
|
367
|
+
if (!nodeId) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
menuEvents.emit("itemhover", {
|
|
371
|
+
nodeId,
|
|
372
|
+
target: event.currentTarget
|
|
373
|
+
});
|
|
374
|
+
},
|
|
375
|
+
onClick(event) {
|
|
376
|
+
if (closeOnClick) {
|
|
377
|
+
menuEvents.emit("close", {
|
|
378
|
+
domEvent: event,
|
|
379
|
+
reason: exports_reason_parts.itemPress
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
onMouseUp(event) {
|
|
384
|
+
if (contextMenuContext) {
|
|
385
|
+
const initialCursorPoint = contextMenuContext.initialCursorPointRef.current;
|
|
386
|
+
contextMenuContext.initialCursorPointRef.current = null;
|
|
387
|
+
if (isContextMenu && initialCursorPoint && Math.abs(event.clientX - initialCursorPoint.x) <= 1 && Math.abs(event.clientY - initialCursorPoint.y) <= 1) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
if (isContextMenu && !isMac && event.button === 2) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (itemRef.current && store.context.allowMouseUpTriggerRef.current && (!isContextMenu || event.button === 2)) {
|
|
395
|
+
if (!itemMetadata || itemMetadata.type === "regular-item") {
|
|
396
|
+
itemRef.current.click();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}), [closeOnClick, highlighted, id, menuEvents, nodeId, store, typingRef, itemRef, contextMenuContext, isContextMenu, itemMetadata]);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/item/useMenuItem.js
|
|
404
|
+
"use client";
|
|
405
|
+
var REGULAR_ITEM = {
|
|
406
|
+
type: "regular-item"
|
|
407
|
+
};
|
|
408
|
+
function useMenuItem(params) {
|
|
409
|
+
const {
|
|
410
|
+
closeOnClick,
|
|
411
|
+
disabled = false,
|
|
412
|
+
highlighted,
|
|
413
|
+
id,
|
|
414
|
+
store,
|
|
415
|
+
typingRef = store.context.typingRef,
|
|
416
|
+
nativeButton,
|
|
417
|
+
itemMetadata,
|
|
418
|
+
nodeId
|
|
419
|
+
} = params;
|
|
420
|
+
const itemRef = React8.useRef(null);
|
|
421
|
+
const {
|
|
422
|
+
getButtonProps,
|
|
423
|
+
buttonRef
|
|
424
|
+
} = useButton({
|
|
425
|
+
disabled,
|
|
426
|
+
focusableWhenDisabled: true,
|
|
427
|
+
native: nativeButton,
|
|
428
|
+
composite: true
|
|
429
|
+
});
|
|
430
|
+
const commonProps = useMenuItemCommonProps({
|
|
431
|
+
closeOnClick,
|
|
432
|
+
highlighted,
|
|
433
|
+
id,
|
|
434
|
+
nodeId,
|
|
435
|
+
store,
|
|
436
|
+
typingRef,
|
|
437
|
+
itemRef,
|
|
438
|
+
itemMetadata
|
|
439
|
+
});
|
|
440
|
+
const getItemProps = React8.useCallback((externalProps) => {
|
|
441
|
+
return mergeProps(commonProps, {
|
|
442
|
+
onMouseEnter() {
|
|
443
|
+
if (itemMetadata.type !== "submenu-trigger") {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
itemMetadata.setActive();
|
|
447
|
+
}
|
|
448
|
+
}, externalProps, getButtonProps);
|
|
449
|
+
}, [commonProps, getButtonProps, itemMetadata]);
|
|
450
|
+
const mergedRef = useMergedRefs(itemRef, buttonRef);
|
|
451
|
+
return React8.useMemo(() => ({
|
|
452
|
+
getItemProps,
|
|
453
|
+
itemRef: mergedRef
|
|
454
|
+
}), [getItemProps, mergedRef]);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItemDataAttributes.js
|
|
458
|
+
var MenuCheckboxItemDataAttributes = /* @__PURE__ */ function(MenuCheckboxItemDataAttributes2) {
|
|
459
|
+
MenuCheckboxItemDataAttributes2["checked"] = "data-checked";
|
|
460
|
+
MenuCheckboxItemDataAttributes2["unchecked"] = "data-unchecked";
|
|
461
|
+
MenuCheckboxItemDataAttributes2["disabled"] = "data-disabled";
|
|
462
|
+
MenuCheckboxItemDataAttributes2["highlighted"] = "data-highlighted";
|
|
463
|
+
return MenuCheckboxItemDataAttributes2;
|
|
464
|
+
}({});
|
|
465
|
+
|
|
466
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/utils/stateAttributesMapping.js
|
|
467
|
+
var itemMapping = {
|
|
468
|
+
checked(value) {
|
|
469
|
+
if (value) {
|
|
470
|
+
return {
|
|
471
|
+
[MenuCheckboxItemDataAttributes.checked]: ""
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
return {
|
|
475
|
+
[MenuCheckboxItemDataAttributes.unchecked]: ""
|
|
476
|
+
};
|
|
477
|
+
},
|
|
478
|
+
...transitionStatusMapping
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItem.js
|
|
482
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
483
|
+
"use client";
|
|
484
|
+
var MenuCheckboxItem = /* @__PURE__ */ React9.forwardRef(function MenuCheckboxItem2(componentProps, forwardedRef) {
|
|
485
|
+
const {
|
|
486
|
+
render,
|
|
487
|
+
className,
|
|
488
|
+
id: idProp,
|
|
489
|
+
label,
|
|
490
|
+
nativeButton = false,
|
|
491
|
+
disabled = false,
|
|
492
|
+
closeOnClick = false,
|
|
493
|
+
checked: checkedProp,
|
|
494
|
+
defaultChecked,
|
|
495
|
+
onCheckedChange,
|
|
496
|
+
style,
|
|
497
|
+
...elementProps
|
|
498
|
+
} = componentProps;
|
|
499
|
+
const listItem = useCompositeListItem({
|
|
500
|
+
label
|
|
501
|
+
});
|
|
502
|
+
const menuPositionerContext = useMenuPositionerContext(true);
|
|
503
|
+
const id = useBaseUiId(idProp);
|
|
504
|
+
const {
|
|
505
|
+
store
|
|
506
|
+
} = useMenuRootContext();
|
|
507
|
+
const highlighted = store.useState("isActive", listItem.index);
|
|
508
|
+
const itemProps = store.useState("itemProps");
|
|
509
|
+
const [checked, setChecked] = useControlled({
|
|
510
|
+
controlled: checkedProp,
|
|
511
|
+
default: defaultChecked ?? false,
|
|
512
|
+
name: "MenuCheckboxItem",
|
|
513
|
+
state: "checked"
|
|
514
|
+
});
|
|
515
|
+
const {
|
|
516
|
+
getItemProps,
|
|
517
|
+
itemRef
|
|
518
|
+
} = useMenuItem({
|
|
519
|
+
closeOnClick,
|
|
520
|
+
disabled,
|
|
521
|
+
highlighted,
|
|
522
|
+
id,
|
|
523
|
+
store,
|
|
524
|
+
nativeButton,
|
|
525
|
+
nodeId: menuPositionerContext?.context.nodeId,
|
|
526
|
+
itemMetadata: REGULAR_ITEM
|
|
527
|
+
});
|
|
528
|
+
const state = React9.useMemo(() => ({
|
|
529
|
+
disabled,
|
|
530
|
+
highlighted,
|
|
531
|
+
checked
|
|
532
|
+
}), [disabled, highlighted, checked]);
|
|
533
|
+
const handleClick = useStableCallback((event) => {
|
|
534
|
+
const details = {
|
|
535
|
+
...createChangeEventDetails(exports_reason_parts.itemPress, event.nativeEvent),
|
|
536
|
+
preventUnmountOnClose: () => {}
|
|
537
|
+
};
|
|
538
|
+
onCheckedChange?.(!checked, details);
|
|
539
|
+
if (details.isCanceled) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
setChecked((currentlyChecked) => !currentlyChecked);
|
|
543
|
+
});
|
|
544
|
+
const element = useRenderElement("div", componentProps, {
|
|
545
|
+
state,
|
|
546
|
+
stateAttributesMapping: itemMapping,
|
|
547
|
+
props: [itemProps, {
|
|
548
|
+
role: "menuitemcheckbox",
|
|
549
|
+
"aria-checked": checked,
|
|
550
|
+
onClick: handleClick
|
|
551
|
+
}, elementProps, getItemProps],
|
|
552
|
+
ref: [itemRef, forwardedRef, listItem.ref]
|
|
553
|
+
});
|
|
554
|
+
return /* @__PURE__ */ _jsx(MenuCheckboxItemContext.Provider, {
|
|
555
|
+
value: state,
|
|
556
|
+
children: element
|
|
557
|
+
});
|
|
558
|
+
});
|
|
559
|
+
if (true)
|
|
560
|
+
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
561
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.js
|
|
562
|
+
import * as React10 from "react";
|
|
563
|
+
"use client";
|
|
564
|
+
var MenuCheckboxItemIndicator = /* @__PURE__ */ React10.forwardRef(function MenuCheckboxItemIndicator2(componentProps, forwardedRef) {
|
|
565
|
+
const {
|
|
566
|
+
render,
|
|
567
|
+
className,
|
|
568
|
+
style,
|
|
569
|
+
keepMounted = false,
|
|
570
|
+
...elementProps
|
|
571
|
+
} = componentProps;
|
|
572
|
+
const item = useMenuCheckboxItemContext();
|
|
573
|
+
const indicatorRef = React10.useRef(null);
|
|
574
|
+
const {
|
|
575
|
+
transitionStatus,
|
|
576
|
+
setMounted
|
|
577
|
+
} = useTransitionStatus(item.checked);
|
|
578
|
+
useOpenChangeComplete({
|
|
579
|
+
open: item.checked,
|
|
580
|
+
ref: indicatorRef,
|
|
581
|
+
onComplete() {
|
|
582
|
+
if (!item.checked) {
|
|
583
|
+
setMounted(false);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
const state = {
|
|
588
|
+
checked: item.checked,
|
|
589
|
+
disabled: item.disabled,
|
|
590
|
+
highlighted: item.highlighted,
|
|
591
|
+
transitionStatus
|
|
592
|
+
};
|
|
593
|
+
const element = useRenderElement("span", componentProps, {
|
|
594
|
+
state,
|
|
595
|
+
ref: [forwardedRef, indicatorRef],
|
|
596
|
+
stateAttributesMapping: itemMapping,
|
|
597
|
+
props: {
|
|
598
|
+
"aria-hidden": true,
|
|
599
|
+
...elementProps
|
|
600
|
+
},
|
|
601
|
+
enabled: keepMounted || item.checked
|
|
602
|
+
});
|
|
603
|
+
return element;
|
|
604
|
+
});
|
|
605
|
+
if (true)
|
|
606
|
+
MenuCheckboxItemIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
607
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/group/MenuGroup.js
|
|
608
|
+
import * as React12 from "react";
|
|
609
|
+
|
|
610
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/group/MenuGroupContext.js
|
|
611
|
+
import * as React11 from "react";
|
|
612
|
+
"use client";
|
|
613
|
+
var MenuGroupContext = /* @__PURE__ */ React11.createContext(undefined);
|
|
614
|
+
if (true)
|
|
615
|
+
MenuGroupContext.displayName = "MenuGroupContext";
|
|
616
|
+
function useMenuGroupRootContext() {
|
|
617
|
+
const context = React11.useContext(MenuGroupContext);
|
|
618
|
+
if (context === undefined) {
|
|
619
|
+
throw new Error("Base UI: MenuGroupRootContext is missing. Menu group parts must be used within <Menu.Group>.");
|
|
620
|
+
}
|
|
621
|
+
return context;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/group/MenuGroup.js
|
|
625
|
+
import { jsx as _jsx2 } from "react/jsx-runtime";
|
|
626
|
+
"use client";
|
|
627
|
+
var MenuGroup = /* @__PURE__ */ React12.forwardRef(function MenuGroup2(componentProps, forwardedRef) {
|
|
628
|
+
const {
|
|
629
|
+
render,
|
|
630
|
+
className,
|
|
631
|
+
style,
|
|
632
|
+
...elementProps
|
|
633
|
+
} = componentProps;
|
|
634
|
+
const [labelId, setLabelId] = React12.useState(undefined);
|
|
635
|
+
const context = React12.useMemo(() => ({
|
|
636
|
+
setLabelId
|
|
637
|
+
}), [setLabelId]);
|
|
638
|
+
const element = useRenderElement("div", componentProps, {
|
|
639
|
+
ref: forwardedRef,
|
|
640
|
+
props: {
|
|
641
|
+
role: "group",
|
|
642
|
+
"aria-labelledby": labelId,
|
|
643
|
+
...elementProps
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
return /* @__PURE__ */ _jsx2(MenuGroupContext.Provider, {
|
|
647
|
+
value: context,
|
|
648
|
+
children: element
|
|
649
|
+
});
|
|
650
|
+
});
|
|
651
|
+
if (true)
|
|
652
|
+
MenuGroup.displayName = "MenuGroup";
|
|
653
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/group-label/MenuGroupLabel.js
|
|
654
|
+
import * as React13 from "react";
|
|
655
|
+
"use client";
|
|
656
|
+
var MenuGroupLabel = /* @__PURE__ */ React13.forwardRef(function MenuGroupLabelComponent(componentProps, forwardedRef) {
|
|
657
|
+
const {
|
|
658
|
+
className,
|
|
659
|
+
render,
|
|
660
|
+
id: idProp,
|
|
661
|
+
style,
|
|
662
|
+
...elementProps
|
|
663
|
+
} = componentProps;
|
|
664
|
+
const id = useBaseUiId(idProp);
|
|
665
|
+
const {
|
|
666
|
+
setLabelId
|
|
667
|
+
} = useMenuGroupRootContext();
|
|
668
|
+
useIsoLayoutEffect(() => {
|
|
669
|
+
setLabelId(id);
|
|
670
|
+
return () => {
|
|
671
|
+
setLabelId(undefined);
|
|
672
|
+
};
|
|
673
|
+
}, [setLabelId, id]);
|
|
674
|
+
return useRenderElement("div", componentProps, {
|
|
675
|
+
ref: forwardedRef,
|
|
676
|
+
props: {
|
|
677
|
+
id,
|
|
678
|
+
role: "presentation",
|
|
679
|
+
...elementProps
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
});
|
|
683
|
+
if (true)
|
|
684
|
+
MenuGroupLabel.displayName = "MenuGroupLabel";
|
|
685
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/item/MenuItem.js
|
|
686
|
+
import * as React14 from "react";
|
|
687
|
+
"use client";
|
|
688
|
+
var MenuItem = /* @__PURE__ */ React14.forwardRef(function MenuItem2(componentProps, forwardedRef) {
|
|
689
|
+
const {
|
|
690
|
+
render,
|
|
691
|
+
className,
|
|
692
|
+
id: idProp,
|
|
693
|
+
label,
|
|
694
|
+
nativeButton = false,
|
|
695
|
+
disabled = false,
|
|
696
|
+
closeOnClick = true,
|
|
697
|
+
style,
|
|
698
|
+
...elementProps
|
|
699
|
+
} = componentProps;
|
|
700
|
+
const listItem = useCompositeListItem({
|
|
701
|
+
label
|
|
702
|
+
});
|
|
703
|
+
const menuPositionerContext = useMenuPositionerContext(true);
|
|
704
|
+
const id = useBaseUiId(idProp);
|
|
705
|
+
const {
|
|
706
|
+
store
|
|
707
|
+
} = useMenuRootContext();
|
|
708
|
+
const highlighted = store.useState("isActive", listItem.index);
|
|
709
|
+
const itemProps = store.useState("itemProps");
|
|
710
|
+
const {
|
|
711
|
+
getItemProps,
|
|
712
|
+
itemRef
|
|
713
|
+
} = useMenuItem({
|
|
714
|
+
closeOnClick,
|
|
715
|
+
disabled,
|
|
716
|
+
highlighted,
|
|
717
|
+
id,
|
|
718
|
+
store,
|
|
719
|
+
nativeButton,
|
|
720
|
+
nodeId: menuPositionerContext?.context.nodeId,
|
|
721
|
+
itemMetadata: REGULAR_ITEM
|
|
722
|
+
});
|
|
723
|
+
const state = {
|
|
724
|
+
disabled,
|
|
725
|
+
highlighted
|
|
726
|
+
};
|
|
727
|
+
return useRenderElement("div", componentProps, {
|
|
728
|
+
state,
|
|
729
|
+
props: [itemProps, elementProps, getItemProps],
|
|
730
|
+
ref: [itemRef, forwardedRef, listItem.ref]
|
|
731
|
+
});
|
|
732
|
+
});
|
|
733
|
+
if (true)
|
|
734
|
+
MenuItem.displayName = "MenuItem";
|
|
735
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/link-item/MenuLinkItem.js
|
|
736
|
+
import * as React15 from "react";
|
|
737
|
+
"use client";
|
|
738
|
+
var MenuLinkItem = /* @__PURE__ */ React15.forwardRef(function MenuLinkItem2(componentProps, forwardedRef) {
|
|
739
|
+
const {
|
|
740
|
+
render,
|
|
741
|
+
className,
|
|
742
|
+
id: idProp,
|
|
743
|
+
label,
|
|
744
|
+
closeOnClick = false,
|
|
745
|
+
style,
|
|
746
|
+
...elementProps
|
|
747
|
+
} = componentProps;
|
|
748
|
+
const linkRef = React15.useRef(null);
|
|
749
|
+
const listItem = useCompositeListItem({
|
|
750
|
+
label
|
|
751
|
+
});
|
|
752
|
+
const menuPositionerContext = useMenuPositionerContext(true);
|
|
753
|
+
const nodeId = menuPositionerContext?.context.nodeId;
|
|
754
|
+
const id = useBaseUiId(idProp);
|
|
755
|
+
const {
|
|
756
|
+
store
|
|
757
|
+
} = useMenuRootContext();
|
|
758
|
+
const highlighted = store.useState("isActive", listItem.index);
|
|
759
|
+
const itemProps = store.useState("itemProps");
|
|
760
|
+
const typingRef = store.context.typingRef;
|
|
761
|
+
const {
|
|
762
|
+
getButtonProps,
|
|
763
|
+
buttonRef
|
|
764
|
+
} = useButton({
|
|
765
|
+
native: false,
|
|
766
|
+
composite: true
|
|
767
|
+
});
|
|
768
|
+
const commonProps = useMenuItemCommonProps({
|
|
769
|
+
closeOnClick,
|
|
770
|
+
highlighted,
|
|
771
|
+
id,
|
|
772
|
+
nodeId,
|
|
773
|
+
store,
|
|
774
|
+
typingRef,
|
|
775
|
+
itemRef: linkRef
|
|
776
|
+
});
|
|
777
|
+
function getItemProps(externalProps) {
|
|
778
|
+
return mergeProps(commonProps, externalProps, getButtonProps);
|
|
779
|
+
}
|
|
780
|
+
const state = React15.useMemo(() => ({
|
|
781
|
+
highlighted
|
|
782
|
+
}), [highlighted]);
|
|
783
|
+
return useRenderElement("a", componentProps, {
|
|
784
|
+
state,
|
|
785
|
+
props: [itemProps, elementProps, getItemProps],
|
|
786
|
+
ref: [linkRef, buttonRef, forwardedRef, listItem.ref]
|
|
787
|
+
});
|
|
788
|
+
});
|
|
789
|
+
if (true)
|
|
790
|
+
MenuLinkItem.displayName = "MenuLinkItem";
|
|
791
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/popup/MenuPopup.js
|
|
792
|
+
import * as React16 from "react";
|
|
793
|
+
import { jsx as _jsx3 } from "react/jsx-runtime";
|
|
794
|
+
"use client";
|
|
795
|
+
var stateAttributesMapping2 = {
|
|
796
|
+
...popupStateMapping,
|
|
797
|
+
...transitionStatusMapping
|
|
798
|
+
};
|
|
799
|
+
var MenuPopup = /* @__PURE__ */ React16.forwardRef(function MenuPopup2(componentProps, forwardedRef) {
|
|
800
|
+
const {
|
|
801
|
+
render,
|
|
802
|
+
className,
|
|
803
|
+
style,
|
|
804
|
+
finalFocus,
|
|
805
|
+
...elementProps
|
|
806
|
+
} = componentProps;
|
|
807
|
+
const {
|
|
808
|
+
store
|
|
809
|
+
} = useMenuRootContext();
|
|
810
|
+
const {
|
|
811
|
+
side,
|
|
812
|
+
align
|
|
813
|
+
} = useMenuPositionerContext();
|
|
814
|
+
const insideToolbar = useToolbarRootContext(true) != null;
|
|
815
|
+
const open = store.useState("open");
|
|
816
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
817
|
+
const popupProps = store.useState("popupProps");
|
|
818
|
+
const mounted = store.useState("mounted");
|
|
819
|
+
const instantType = store.useState("instantType");
|
|
820
|
+
const triggerElement = store.useState("activeTriggerElement");
|
|
821
|
+
const parent = store.useState("parent");
|
|
822
|
+
const lastOpenChangeReason = store.useState("lastOpenChangeReason");
|
|
823
|
+
const rootId = store.useState("rootId");
|
|
824
|
+
const floatingContext = store.useState("floatingRootContext");
|
|
825
|
+
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
826
|
+
const closeDelay = store.useState("closeDelay");
|
|
827
|
+
const activeTriggerElement = store.useState("activeTriggerElement");
|
|
828
|
+
const isContextMenu = parent.type === "context-menu";
|
|
829
|
+
useOpenChangeComplete({
|
|
830
|
+
open,
|
|
831
|
+
ref: store.context.popupRef,
|
|
832
|
+
onComplete() {
|
|
833
|
+
if (open) {
|
|
834
|
+
store.context.onOpenChangeComplete?.(true);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
});
|
|
838
|
+
React16.useEffect(() => {
|
|
839
|
+
function handleClose(event) {
|
|
840
|
+
store.setOpen(false, createChangeEventDetails(event.reason, event.domEvent));
|
|
841
|
+
}
|
|
842
|
+
floatingTreeRoot.events.on("close", handleClose);
|
|
843
|
+
return () => {
|
|
844
|
+
floatingTreeRoot.events.off("close", handleClose);
|
|
845
|
+
};
|
|
846
|
+
}, [floatingTreeRoot.events, store]);
|
|
847
|
+
const hoverEnabled = store.useState("hoverEnabled");
|
|
848
|
+
const disabled = store.useState("disabled");
|
|
849
|
+
useHoverFloatingInteraction(floatingContext, {
|
|
850
|
+
enabled: hoverEnabled && !disabled && !isContextMenu && parent.type !== "menubar",
|
|
851
|
+
closeDelay
|
|
852
|
+
});
|
|
853
|
+
const state = {
|
|
854
|
+
transitionStatus,
|
|
855
|
+
side,
|
|
856
|
+
align,
|
|
857
|
+
open,
|
|
858
|
+
nested: parent.type === "menu",
|
|
859
|
+
instant: instantType
|
|
860
|
+
};
|
|
861
|
+
const setPopupElement = React16.useCallback((element2) => {
|
|
862
|
+
store.set("popupElement", element2);
|
|
863
|
+
}, [store]);
|
|
864
|
+
const element = useRenderElement("div", componentProps, {
|
|
865
|
+
state,
|
|
866
|
+
ref: [forwardedRef, store.context.popupRef, setPopupElement],
|
|
867
|
+
stateAttributesMapping: stateAttributesMapping2,
|
|
868
|
+
props: [popupProps, {
|
|
869
|
+
onKeyDown(event) {
|
|
870
|
+
if (insideToolbar && COMPOSITE_KEYS.has(event.key)) {
|
|
871
|
+
event.stopPropagation();
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}, getDisabledMountTransitionStyles(transitionStatus), elementProps, {
|
|
875
|
+
"data-rootownerid": rootId
|
|
876
|
+
}]
|
|
877
|
+
});
|
|
878
|
+
let returnFocus = parent.type === undefined || isContextMenu;
|
|
879
|
+
if (triggerElement || parent.type === "menubar" && lastOpenChangeReason !== exports_reason_parts.outsidePress) {
|
|
880
|
+
returnFocus = true;
|
|
881
|
+
}
|
|
882
|
+
return /* @__PURE__ */ _jsx3(FloatingFocusManager, {
|
|
883
|
+
context: floatingContext,
|
|
884
|
+
modal: isContextMenu,
|
|
885
|
+
disabled: !mounted,
|
|
886
|
+
returnFocus: finalFocus === undefined ? returnFocus : finalFocus,
|
|
887
|
+
initialFocus: parent.type !== "menu",
|
|
888
|
+
restoreFocus: true,
|
|
889
|
+
externalTree: parent.type !== "menubar" ? floatingTreeRoot : undefined,
|
|
890
|
+
previousFocusableElement: activeTriggerElement,
|
|
891
|
+
nextFocusableElement: parent.type === undefined ? store.context.triggerFocusTargetRef : undefined,
|
|
892
|
+
beforeContentFocusGuardRef: parent.type === undefined ? store.context.beforeContentFocusGuardRef : undefined,
|
|
893
|
+
children: element
|
|
894
|
+
});
|
|
895
|
+
});
|
|
896
|
+
if (true)
|
|
897
|
+
MenuPopup.displayName = "MenuPopup";
|
|
898
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/portal/MenuPortal.js
|
|
899
|
+
import * as React18 from "react";
|
|
900
|
+
|
|
901
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/portal/MenuPortalContext.js
|
|
902
|
+
import * as React17 from "react";
|
|
903
|
+
"use client";
|
|
904
|
+
var MenuPortalContext = /* @__PURE__ */ React17.createContext(undefined);
|
|
905
|
+
if (true)
|
|
906
|
+
MenuPortalContext.displayName = "MenuPortalContext";
|
|
907
|
+
function useMenuPortalContext() {
|
|
908
|
+
const value = React17.useContext(MenuPortalContext);
|
|
909
|
+
if (value === undefined) {
|
|
910
|
+
throw new Error("Base UI: <Menu.Portal> is missing.");
|
|
911
|
+
}
|
|
912
|
+
return value;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/portal/MenuPortal.js
|
|
916
|
+
import { jsx as _jsx4 } from "react/jsx-runtime";
|
|
917
|
+
"use client";
|
|
918
|
+
var MenuPortal = /* @__PURE__ */ React18.forwardRef(function MenuPortal2(props, forwardedRef) {
|
|
919
|
+
const {
|
|
920
|
+
keepMounted = false,
|
|
921
|
+
...portalProps
|
|
922
|
+
} = props;
|
|
923
|
+
const {
|
|
924
|
+
store
|
|
925
|
+
} = useMenuRootContext();
|
|
926
|
+
const mounted = store.useState("mounted");
|
|
927
|
+
const shouldRender = mounted || keepMounted;
|
|
928
|
+
if (!shouldRender) {
|
|
929
|
+
return null;
|
|
930
|
+
}
|
|
931
|
+
return /* @__PURE__ */ _jsx4(MenuPortalContext.Provider, {
|
|
932
|
+
value: keepMounted,
|
|
933
|
+
children: /* @__PURE__ */ _jsx4(FloatingPortal, {
|
|
934
|
+
ref: forwardedRef,
|
|
935
|
+
...portalProps
|
|
936
|
+
})
|
|
937
|
+
});
|
|
938
|
+
});
|
|
939
|
+
if (true)
|
|
940
|
+
MenuPortal.displayName = "MenuPortal";
|
|
941
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/positioner/MenuPositioner.js
|
|
942
|
+
import * as React19 from "react";
|
|
943
|
+
import { jsx as _jsx5, jsxs as _jsxs } from "react/jsx-runtime";
|
|
944
|
+
"use client";
|
|
945
|
+
var MenuPositioner = /* @__PURE__ */ React19.forwardRef(function MenuPositioner2(componentProps, forwardedRef) {
|
|
946
|
+
const {
|
|
947
|
+
anchor: anchorProp,
|
|
948
|
+
positionMethod: positionMethodProp = "absolute",
|
|
949
|
+
className,
|
|
950
|
+
render,
|
|
951
|
+
side,
|
|
952
|
+
align: alignProp,
|
|
953
|
+
sideOffset: sideOffsetProp = 0,
|
|
954
|
+
alignOffset: alignOffsetProp = 0,
|
|
955
|
+
collisionBoundary = "clipping-ancestors",
|
|
956
|
+
collisionPadding = 5,
|
|
957
|
+
arrowPadding = 5,
|
|
958
|
+
sticky = false,
|
|
959
|
+
disableAnchorTracking = false,
|
|
960
|
+
collisionAvoidance: collisionAvoidanceProp = DROPDOWN_COLLISION_AVOIDANCE,
|
|
961
|
+
style,
|
|
962
|
+
...elementProps
|
|
963
|
+
} = componentProps;
|
|
964
|
+
const {
|
|
965
|
+
store
|
|
966
|
+
} = useMenuRootContext();
|
|
967
|
+
const keepMounted = useMenuPortalContext();
|
|
968
|
+
const contextMenuContext = useContextMenuRootContext(true);
|
|
969
|
+
const parent = store.useState("parent");
|
|
970
|
+
const floatingRootContext = store.useState("floatingRootContext");
|
|
971
|
+
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
972
|
+
const mounted = store.useState("mounted");
|
|
973
|
+
const open = store.useState("open");
|
|
974
|
+
const modal = store.useState("modal");
|
|
975
|
+
const openMethod = store.useState("openMethod");
|
|
976
|
+
const triggerElement = store.useState("activeTriggerElement");
|
|
977
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
978
|
+
const positionerElement = store.useState("positionerElement");
|
|
979
|
+
const instantType = store.useState("instantType");
|
|
980
|
+
const hasViewport = store.useState("hasViewport");
|
|
981
|
+
const lastOpenChangeReason = store.useState("lastOpenChangeReason");
|
|
982
|
+
const floatingNodeId = store.useState("floatingNodeId");
|
|
983
|
+
const floatingParentNodeId = store.useState("floatingParentNodeId");
|
|
984
|
+
const domReference = floatingRootContext.useState("domReferenceElement");
|
|
985
|
+
const previousTriggerRef = React19.useRef(null);
|
|
986
|
+
const runOnceAnimationsFinish = useAnimationsFinished(positionerElement, false, false);
|
|
987
|
+
let anchor = anchorProp;
|
|
988
|
+
let sideOffset = sideOffsetProp;
|
|
989
|
+
let alignOffset = alignOffsetProp;
|
|
990
|
+
let align = alignProp;
|
|
991
|
+
let collisionAvoidance = collisionAvoidanceProp;
|
|
992
|
+
if (parent.type === "context-menu") {
|
|
993
|
+
anchor = anchorProp ?? parent.context?.anchor;
|
|
994
|
+
align = align ?? "start";
|
|
995
|
+
if (!side && align !== "center") {
|
|
996
|
+
alignOffset = componentProps.alignOffset ?? 2;
|
|
997
|
+
sideOffset = componentProps.sideOffset ?? -5;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
let computedSide = side;
|
|
1001
|
+
let computedAlign = align;
|
|
1002
|
+
if (parent.type === "menu") {
|
|
1003
|
+
computedSide = computedSide ?? "inline-end";
|
|
1004
|
+
computedAlign = computedAlign ?? "start";
|
|
1005
|
+
collisionAvoidance = componentProps.collisionAvoidance ?? POPUP_COLLISION_AVOIDANCE;
|
|
1006
|
+
} else if (parent.type === "menubar") {
|
|
1007
|
+
computedSide = computedSide ?? "bottom";
|
|
1008
|
+
computedAlign = computedAlign ?? "start";
|
|
1009
|
+
}
|
|
1010
|
+
const contextMenu = parent.type === "context-menu";
|
|
1011
|
+
const positioner = useAnchorPositioning({
|
|
1012
|
+
anchor,
|
|
1013
|
+
floatingRootContext,
|
|
1014
|
+
positionMethod: contextMenuContext ? "fixed" : positionMethodProp,
|
|
1015
|
+
mounted,
|
|
1016
|
+
side: computedSide,
|
|
1017
|
+
sideOffset,
|
|
1018
|
+
align: computedAlign,
|
|
1019
|
+
alignOffset,
|
|
1020
|
+
arrowPadding: contextMenu ? 0 : arrowPadding,
|
|
1021
|
+
collisionBoundary,
|
|
1022
|
+
collisionPadding,
|
|
1023
|
+
sticky,
|
|
1024
|
+
nodeId: floatingNodeId,
|
|
1025
|
+
keepMounted,
|
|
1026
|
+
disableAnchorTracking,
|
|
1027
|
+
collisionAvoidance,
|
|
1028
|
+
shiftCrossAxis: contextMenu && !(("side" in collisionAvoidance) && collisionAvoidance.side === "flip"),
|
|
1029
|
+
externalTree: floatingTreeRoot,
|
|
1030
|
+
adaptiveOrigin: hasViewport ? adaptiveOrigin : undefined
|
|
1031
|
+
});
|
|
1032
|
+
React19.useEffect(() => {
|
|
1033
|
+
function onMenuOpenChange(details) {
|
|
1034
|
+
if (details.open) {
|
|
1035
|
+
if (details.parentNodeId === floatingNodeId) {
|
|
1036
|
+
store.set("hoverEnabled", false);
|
|
1037
|
+
}
|
|
1038
|
+
if (details.nodeId !== floatingNodeId && details.parentNodeId === store.select("floatingParentNodeId")) {
|
|
1039
|
+
store.setOpen(false, createChangeEventDetails(exports_reason_parts.siblingOpen));
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
floatingTreeRoot.events.on("menuopenchange", onMenuOpenChange);
|
|
1044
|
+
return () => {
|
|
1045
|
+
floatingTreeRoot.events.off("menuopenchange", onMenuOpenChange);
|
|
1046
|
+
};
|
|
1047
|
+
}, [store, floatingTreeRoot.events, floatingNodeId]);
|
|
1048
|
+
React19.useEffect(() => {
|
|
1049
|
+
if (store.select("floatingParentNodeId") == null) {
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
function onParentClose(details) {
|
|
1053
|
+
if (details.open || details.nodeId !== store.select("floatingParentNodeId")) {
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
const reason = details.reason ?? exports_reason_parts.siblingOpen;
|
|
1057
|
+
store.setOpen(false, createChangeEventDetails(reason));
|
|
1058
|
+
}
|
|
1059
|
+
floatingTreeRoot.events.on("menuopenchange", onParentClose);
|
|
1060
|
+
return () => {
|
|
1061
|
+
floatingTreeRoot.events.off("menuopenchange", onParentClose);
|
|
1062
|
+
};
|
|
1063
|
+
}, [floatingTreeRoot.events, store]);
|
|
1064
|
+
const closeTimeout = useTimeout();
|
|
1065
|
+
React19.useEffect(() => {
|
|
1066
|
+
if (!open) {
|
|
1067
|
+
closeTimeout.clear();
|
|
1068
|
+
}
|
|
1069
|
+
}, [open, closeTimeout]);
|
|
1070
|
+
React19.useEffect(() => {
|
|
1071
|
+
function onItemHover(event) {
|
|
1072
|
+
if (!open || event.nodeId !== store.select("floatingParentNodeId")) {
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
if (event.target && triggerElement && triggerElement !== event.target) {
|
|
1076
|
+
const delay = store.select("closeDelay");
|
|
1077
|
+
if (delay > 0) {
|
|
1078
|
+
if (!closeTimeout.isStarted()) {
|
|
1079
|
+
closeTimeout.start(delay, () => {
|
|
1080
|
+
store.setOpen(false, createChangeEventDetails(exports_reason_parts.siblingOpen));
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
} else {
|
|
1084
|
+
store.setOpen(false, createChangeEventDetails(exports_reason_parts.siblingOpen));
|
|
1085
|
+
}
|
|
1086
|
+
} else {
|
|
1087
|
+
closeTimeout.clear();
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
floatingTreeRoot.events.on("itemhover", onItemHover);
|
|
1091
|
+
return () => {
|
|
1092
|
+
floatingTreeRoot.events.off("itemhover", onItemHover);
|
|
1093
|
+
};
|
|
1094
|
+
}, [floatingTreeRoot.events, open, triggerElement, store, closeTimeout]);
|
|
1095
|
+
React19.useEffect(() => {
|
|
1096
|
+
const eventDetails = {
|
|
1097
|
+
open,
|
|
1098
|
+
nodeId: floatingNodeId,
|
|
1099
|
+
parentNodeId: floatingParentNodeId,
|
|
1100
|
+
reason: store.select("lastOpenChangeReason")
|
|
1101
|
+
};
|
|
1102
|
+
floatingTreeRoot.events.emit("menuopenchange", eventDetails);
|
|
1103
|
+
}, [floatingTreeRoot.events, open, store, floatingNodeId, floatingParentNodeId]);
|
|
1104
|
+
useIsoLayoutEffect(() => {
|
|
1105
|
+
const currentTrigger = domReference;
|
|
1106
|
+
const previousTrigger = previousTriggerRef.current;
|
|
1107
|
+
if (currentTrigger) {
|
|
1108
|
+
previousTriggerRef.current = currentTrigger;
|
|
1109
|
+
}
|
|
1110
|
+
if (previousTrigger && currentTrigger && currentTrigger !== previousTrigger) {
|
|
1111
|
+
store.set("instantType", undefined);
|
|
1112
|
+
const abortController = new AbortController;
|
|
1113
|
+
runOnceAnimationsFinish(() => {
|
|
1114
|
+
store.set("instantType", "trigger-change");
|
|
1115
|
+
}, abortController.signal);
|
|
1116
|
+
return () => {
|
|
1117
|
+
abortController.abort();
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
return;
|
|
1121
|
+
}, [domReference, runOnceAnimationsFinish, store]);
|
|
1122
|
+
const state = {
|
|
1123
|
+
open,
|
|
1124
|
+
side: positioner.side,
|
|
1125
|
+
align: positioner.align,
|
|
1126
|
+
anchorHidden: positioner.anchorHidden,
|
|
1127
|
+
nested: parent.type === "menu",
|
|
1128
|
+
instant: instantType
|
|
1129
|
+
};
|
|
1130
|
+
const menubarModal = parent.type === "menubar" && parent.context.modal;
|
|
1131
|
+
const popupModal = modal && lastOpenChangeReason !== exports_reason_parts.triggerHover;
|
|
1132
|
+
useAnchoredPopupScrollLock(open && (menubarModal || popupModal), openMethod === "touch", positionerElement, triggerElement);
|
|
1133
|
+
const element = usePositioner(componentProps, state, {
|
|
1134
|
+
styles: positioner.positionerStyles,
|
|
1135
|
+
transitionStatus,
|
|
1136
|
+
props: elementProps,
|
|
1137
|
+
refs: [forwardedRef, store.useStateSetter("positionerElement")],
|
|
1138
|
+
hidden: !mounted,
|
|
1139
|
+
inert: !open
|
|
1140
|
+
});
|
|
1141
|
+
const shouldRenderBackdrop = mounted && parent.type !== "menu" && (parent.type !== "menubar" && modal && lastOpenChangeReason !== exports_reason_parts.triggerHover || parent.type === "menubar" && parent.context.modal);
|
|
1142
|
+
let backdropCutout = null;
|
|
1143
|
+
if (parent.type === "menubar") {
|
|
1144
|
+
backdropCutout = parent.context.contentElement;
|
|
1145
|
+
} else if (parent.type === undefined) {
|
|
1146
|
+
backdropCutout = triggerElement;
|
|
1147
|
+
}
|
|
1148
|
+
return /* @__PURE__ */ _jsxs(MenuPositionerContext.Provider, {
|
|
1149
|
+
value: positioner,
|
|
1150
|
+
children: [shouldRenderBackdrop && /* @__PURE__ */ _jsx5(InternalBackdrop, {
|
|
1151
|
+
ref: parent.type === "context-menu" || parent.type === "nested-context-menu" ? parent.context.internalBackdropRef : null,
|
|
1152
|
+
inert: inertValue(!open),
|
|
1153
|
+
cutout: backdropCutout
|
|
1154
|
+
}), /* @__PURE__ */ _jsx5(FloatingNode, {
|
|
1155
|
+
id: floatingNodeId,
|
|
1156
|
+
children: /* @__PURE__ */ _jsx5(CompositeList, {
|
|
1157
|
+
elementsRef: store.context.itemDomElements,
|
|
1158
|
+
labelsRef: store.context.itemLabels,
|
|
1159
|
+
children: element
|
|
1160
|
+
})
|
|
1161
|
+
})]
|
|
1162
|
+
});
|
|
1163
|
+
});
|
|
1164
|
+
if (true)
|
|
1165
|
+
MenuPositioner.displayName = "MenuPositioner";
|
|
1166
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/radio-group/MenuRadioGroup.js
|
|
1167
|
+
import * as React21 from "react";
|
|
1168
|
+
|
|
1169
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/radio-group/MenuRadioGroupContext.js
|
|
1170
|
+
import * as React20 from "react";
|
|
1171
|
+
"use client";
|
|
1172
|
+
var MenuRadioGroupContext = /* @__PURE__ */ React20.createContext(undefined);
|
|
1173
|
+
if (true)
|
|
1174
|
+
MenuRadioGroupContext.displayName = "MenuRadioGroupContext";
|
|
1175
|
+
function useMenuRadioGroupContext() {
|
|
1176
|
+
const context = React20.useContext(MenuRadioGroupContext);
|
|
1177
|
+
if (context === undefined) {
|
|
1178
|
+
throw new Error("Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>.");
|
|
1179
|
+
}
|
|
1180
|
+
return context;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/radio-group/MenuRadioGroup.js
|
|
1184
|
+
import { jsx as _jsx6 } from "react/jsx-runtime";
|
|
1185
|
+
"use client";
|
|
1186
|
+
var MenuRadioGroup = /* @__PURE__ */ React21.memo(/* @__PURE__ */ React21.forwardRef(function MenuRadioGroup2(componentProps, forwardedRef) {
|
|
1187
|
+
const {
|
|
1188
|
+
render,
|
|
1189
|
+
className,
|
|
1190
|
+
value: valueProp,
|
|
1191
|
+
defaultValue,
|
|
1192
|
+
onValueChange: onValueChangeProp,
|
|
1193
|
+
disabled = false,
|
|
1194
|
+
style,
|
|
1195
|
+
...elementProps
|
|
1196
|
+
} = componentProps;
|
|
1197
|
+
const [value, setValueUnwrapped] = useControlled({
|
|
1198
|
+
controlled: valueProp,
|
|
1199
|
+
default: defaultValue,
|
|
1200
|
+
name: "MenuRadioGroup"
|
|
1201
|
+
});
|
|
1202
|
+
const onValueChange = useStableCallback(onValueChangeProp);
|
|
1203
|
+
const setValue = useStableCallback((newValue, eventDetails) => {
|
|
1204
|
+
onValueChange?.(newValue, eventDetails);
|
|
1205
|
+
if (eventDetails.isCanceled) {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
setValueUnwrapped(newValue);
|
|
1209
|
+
});
|
|
1210
|
+
const state = {
|
|
1211
|
+
disabled
|
|
1212
|
+
};
|
|
1213
|
+
const element = useRenderElement("div", componentProps, {
|
|
1214
|
+
state,
|
|
1215
|
+
ref: forwardedRef,
|
|
1216
|
+
props: {
|
|
1217
|
+
role: "group",
|
|
1218
|
+
"aria-disabled": disabled || undefined,
|
|
1219
|
+
...elementProps
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
const context = React21.useMemo(() => ({
|
|
1223
|
+
value,
|
|
1224
|
+
setValue,
|
|
1225
|
+
disabled
|
|
1226
|
+
}), [value, setValue, disabled]);
|
|
1227
|
+
return /* @__PURE__ */ _jsx6(MenuRadioGroupContext.Provider, {
|
|
1228
|
+
value: context,
|
|
1229
|
+
children: element
|
|
1230
|
+
});
|
|
1231
|
+
}));
|
|
1232
|
+
if (true)
|
|
1233
|
+
MenuRadioGroup.displayName = "MenuRadioGroup";
|
|
1234
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/radio-item/MenuRadioItem.js
|
|
1235
|
+
import * as React23 from "react";
|
|
1236
|
+
|
|
1237
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/radio-item/MenuRadioItemContext.js
|
|
1238
|
+
import * as React22 from "react";
|
|
1239
|
+
"use client";
|
|
1240
|
+
var MenuRadioItemContext = /* @__PURE__ */ React22.createContext(undefined);
|
|
1241
|
+
if (true)
|
|
1242
|
+
MenuRadioItemContext.displayName = "MenuRadioItemContext";
|
|
1243
|
+
function useMenuRadioItemContext() {
|
|
1244
|
+
const context = React22.useContext(MenuRadioItemContext);
|
|
1245
|
+
if (context === undefined) {
|
|
1246
|
+
throw new Error("Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>.");
|
|
1247
|
+
}
|
|
1248
|
+
return context;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/radio-item/MenuRadioItem.js
|
|
1252
|
+
import { jsx as _jsx7 } from "react/jsx-runtime";
|
|
1253
|
+
"use client";
|
|
1254
|
+
var MenuRadioItem = /* @__PURE__ */ React23.forwardRef(function MenuRadioItem2(componentProps, forwardedRef) {
|
|
1255
|
+
const {
|
|
1256
|
+
render,
|
|
1257
|
+
className,
|
|
1258
|
+
id: idProp,
|
|
1259
|
+
label,
|
|
1260
|
+
nativeButton = false,
|
|
1261
|
+
disabled: disabledProp = false,
|
|
1262
|
+
closeOnClick = false,
|
|
1263
|
+
value,
|
|
1264
|
+
style,
|
|
1265
|
+
...elementProps
|
|
1266
|
+
} = componentProps;
|
|
1267
|
+
const listItem = useCompositeListItem({
|
|
1268
|
+
label
|
|
1269
|
+
});
|
|
1270
|
+
const menuPositionerContext = useMenuPositionerContext(true);
|
|
1271
|
+
const id = useBaseUiId(idProp);
|
|
1272
|
+
const {
|
|
1273
|
+
store
|
|
1274
|
+
} = useMenuRootContext();
|
|
1275
|
+
const highlighted = store.useState("isActive", listItem.index);
|
|
1276
|
+
const itemProps = store.useState("itemProps");
|
|
1277
|
+
const {
|
|
1278
|
+
value: selectedValue,
|
|
1279
|
+
setValue: setSelectedValue,
|
|
1280
|
+
disabled: groupDisabled
|
|
1281
|
+
} = useMenuRadioGroupContext();
|
|
1282
|
+
const disabled = groupDisabled || disabledProp;
|
|
1283
|
+
const checked = selectedValue === value;
|
|
1284
|
+
const {
|
|
1285
|
+
getItemProps,
|
|
1286
|
+
itemRef
|
|
1287
|
+
} = useMenuItem({
|
|
1288
|
+
closeOnClick,
|
|
1289
|
+
disabled,
|
|
1290
|
+
highlighted,
|
|
1291
|
+
id,
|
|
1292
|
+
store,
|
|
1293
|
+
nativeButton,
|
|
1294
|
+
nodeId: menuPositionerContext?.context.nodeId,
|
|
1295
|
+
itemMetadata: REGULAR_ITEM
|
|
1296
|
+
});
|
|
1297
|
+
const state = React23.useMemo(() => ({
|
|
1298
|
+
disabled,
|
|
1299
|
+
highlighted,
|
|
1300
|
+
checked
|
|
1301
|
+
}), [disabled, highlighted, checked]);
|
|
1302
|
+
const handleClick = useStableCallback((event) => {
|
|
1303
|
+
const details = {
|
|
1304
|
+
...createChangeEventDetails(exports_reason_parts.itemPress, event.nativeEvent),
|
|
1305
|
+
preventUnmountOnClose: () => {}
|
|
1306
|
+
};
|
|
1307
|
+
setSelectedValue(value, details);
|
|
1308
|
+
});
|
|
1309
|
+
const element = useRenderElement("div", componentProps, {
|
|
1310
|
+
state,
|
|
1311
|
+
stateAttributesMapping: itemMapping,
|
|
1312
|
+
props: [itemProps, {
|
|
1313
|
+
role: "menuitemradio",
|
|
1314
|
+
"aria-checked": checked,
|
|
1315
|
+
onClick: handleClick
|
|
1316
|
+
}, elementProps, getItemProps],
|
|
1317
|
+
ref: [itemRef, forwardedRef, listItem.ref]
|
|
1318
|
+
});
|
|
1319
|
+
return /* @__PURE__ */ _jsx7(MenuRadioItemContext.Provider, {
|
|
1320
|
+
value: state,
|
|
1321
|
+
children: element
|
|
1322
|
+
});
|
|
1323
|
+
});
|
|
1324
|
+
if (true)
|
|
1325
|
+
MenuRadioItem.displayName = "MenuRadioItem";
|
|
1326
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/radio-item-indicator/MenuRadioItemIndicator.js
|
|
1327
|
+
import * as React24 from "react";
|
|
1328
|
+
"use client";
|
|
1329
|
+
var MenuRadioItemIndicator = /* @__PURE__ */ React24.forwardRef(function MenuRadioItemIndicator2(componentProps, forwardedRef) {
|
|
1330
|
+
const {
|
|
1331
|
+
render,
|
|
1332
|
+
className,
|
|
1333
|
+
style,
|
|
1334
|
+
keepMounted = false,
|
|
1335
|
+
...elementProps
|
|
1336
|
+
} = componentProps;
|
|
1337
|
+
const item = useMenuRadioItemContext();
|
|
1338
|
+
const indicatorRef = React24.useRef(null);
|
|
1339
|
+
const {
|
|
1340
|
+
transitionStatus,
|
|
1341
|
+
setMounted
|
|
1342
|
+
} = useTransitionStatus(item.checked);
|
|
1343
|
+
useOpenChangeComplete({
|
|
1344
|
+
open: item.checked,
|
|
1345
|
+
ref: indicatorRef,
|
|
1346
|
+
onComplete() {
|
|
1347
|
+
if (!item.checked) {
|
|
1348
|
+
setMounted(false);
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
});
|
|
1352
|
+
const state = {
|
|
1353
|
+
checked: item.checked,
|
|
1354
|
+
disabled: item.disabled,
|
|
1355
|
+
highlighted: item.highlighted,
|
|
1356
|
+
transitionStatus
|
|
1357
|
+
};
|
|
1358
|
+
const element = useRenderElement("span", componentProps, {
|
|
1359
|
+
state,
|
|
1360
|
+
stateAttributesMapping: itemMapping,
|
|
1361
|
+
ref: [forwardedRef, indicatorRef],
|
|
1362
|
+
props: {
|
|
1363
|
+
"aria-hidden": true,
|
|
1364
|
+
...elementProps
|
|
1365
|
+
},
|
|
1366
|
+
enabled: keepMounted || item.checked
|
|
1367
|
+
});
|
|
1368
|
+
return element;
|
|
1369
|
+
});
|
|
1370
|
+
if (true)
|
|
1371
|
+
MenuRadioItemIndicator.displayName = "MenuRadioItemIndicator";
|
|
1372
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/root/MenuRoot.js
|
|
1373
|
+
import * as React27 from "react";
|
|
1374
|
+
|
|
1375
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/store/MenuStore.js
|
|
1376
|
+
import * as React25 from "react";
|
|
1377
|
+
var selectors = {
|
|
1378
|
+
...popupStoreSelectors,
|
|
1379
|
+
disabled: createSelector((state) => state.parent.type === "menubar" ? state.parent.context.disabled || state.disabled : state.disabled),
|
|
1380
|
+
modal: createSelector((state) => (state.parent.type === undefined || state.parent.type === "context-menu") && (state.modal ?? true)),
|
|
1381
|
+
openMethod: createSelector((state) => state.openMethod),
|
|
1382
|
+
allowMouseEnter: createSelector((state) => state.allowMouseEnter),
|
|
1383
|
+
stickIfOpen: createSelector((state) => state.stickIfOpen),
|
|
1384
|
+
parent: createSelector((state) => state.parent),
|
|
1385
|
+
rootId: createSelector((state) => {
|
|
1386
|
+
if (state.parent.type === "menu") {
|
|
1387
|
+
return state.parent.store.select("rootId");
|
|
1388
|
+
}
|
|
1389
|
+
return state.parent.type !== undefined ? state.parent.context.rootId : state.rootId;
|
|
1390
|
+
}),
|
|
1391
|
+
activeIndex: createSelector((state) => state.activeIndex),
|
|
1392
|
+
isActive: createSelector((state, itemIndex) => state.activeIndex === itemIndex),
|
|
1393
|
+
hoverEnabled: createSelector((state) => state.hoverEnabled),
|
|
1394
|
+
instantType: createSelector((state) => state.instantType),
|
|
1395
|
+
lastOpenChangeReason: createSelector((state) => state.openChangeReason),
|
|
1396
|
+
floatingTreeRoot: createSelector((state) => {
|
|
1397
|
+
if (state.parent.type === "menu") {
|
|
1398
|
+
return state.parent.store.select("floatingTreeRoot");
|
|
1399
|
+
}
|
|
1400
|
+
return state.floatingTreeRoot;
|
|
1401
|
+
}),
|
|
1402
|
+
floatingNodeId: createSelector((state) => state.floatingNodeId),
|
|
1403
|
+
floatingParentNodeId: createSelector((state) => state.floatingParentNodeId),
|
|
1404
|
+
itemProps: createSelector((state) => state.itemProps),
|
|
1405
|
+
closeDelay: createSelector((state) => state.closeDelay),
|
|
1406
|
+
hasViewport: createSelector((state) => state.hasViewport),
|
|
1407
|
+
keyboardEventRelay: createSelector((state) => {
|
|
1408
|
+
if (state.keyboardEventRelay) {
|
|
1409
|
+
return state.keyboardEventRelay;
|
|
1410
|
+
}
|
|
1411
|
+
if (state.parent.type === "menu") {
|
|
1412
|
+
return state.parent.store.select("keyboardEventRelay");
|
|
1413
|
+
}
|
|
1414
|
+
return;
|
|
1415
|
+
})
|
|
1416
|
+
};
|
|
1417
|
+
|
|
1418
|
+
class MenuStore extends ReactStore {
|
|
1419
|
+
constructor(initialState) {
|
|
1420
|
+
super({
|
|
1421
|
+
...createInitialState(),
|
|
1422
|
+
...initialState
|
|
1423
|
+
}, {
|
|
1424
|
+
positionerRef: /* @__PURE__ */ React25.createRef(),
|
|
1425
|
+
popupRef: /* @__PURE__ */ React25.createRef(),
|
|
1426
|
+
typingRef: {
|
|
1427
|
+
current: false
|
|
1428
|
+
},
|
|
1429
|
+
itemDomElements: {
|
|
1430
|
+
current: []
|
|
1431
|
+
},
|
|
1432
|
+
itemLabels: {
|
|
1433
|
+
current: []
|
|
1434
|
+
},
|
|
1435
|
+
allowMouseUpTriggerRef: {
|
|
1436
|
+
current: false
|
|
1437
|
+
},
|
|
1438
|
+
triggerFocusTargetRef: /* @__PURE__ */ React25.createRef(),
|
|
1439
|
+
beforeContentFocusGuardRef: /* @__PURE__ */ React25.createRef(),
|
|
1440
|
+
onOpenChangeComplete: undefined,
|
|
1441
|
+
triggerElements: new PopupTriggerMap
|
|
1442
|
+
}, selectors);
|
|
1443
|
+
this.unsubscribeParentListener = this.observe("parent", (parent) => {
|
|
1444
|
+
this.unsubscribeParentListener?.();
|
|
1445
|
+
if (parent.type === "menu") {
|
|
1446
|
+
let rootId = parent.store.select("rootId");
|
|
1447
|
+
let floatingTreeRoot = parent.store.select("floatingTreeRoot");
|
|
1448
|
+
let keyboardEventRelay = parent.store.select("keyboardEventRelay");
|
|
1449
|
+
this.unsubscribeParentListener = parent.store.subscribe(() => {
|
|
1450
|
+
const nextRootId = parent.store.select("rootId");
|
|
1451
|
+
const nextFloatingTreeRoot = parent.store.select("floatingTreeRoot");
|
|
1452
|
+
const nextKeyboardEventRelay = parent.store.select("keyboardEventRelay");
|
|
1453
|
+
if (rootId === nextRootId && floatingTreeRoot === nextFloatingTreeRoot && keyboardEventRelay === nextKeyboardEventRelay) {
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
rootId = nextRootId;
|
|
1457
|
+
floatingTreeRoot = nextFloatingTreeRoot;
|
|
1458
|
+
keyboardEventRelay = nextKeyboardEventRelay;
|
|
1459
|
+
this.notifyAll();
|
|
1460
|
+
});
|
|
1461
|
+
this.context.allowMouseUpTriggerRef = parent.store.context.allowMouseUpTriggerRef;
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
if (parent.type !== undefined) {
|
|
1465
|
+
this.context.allowMouseUpTriggerRef = parent.context.allowMouseUpTriggerRef;
|
|
1466
|
+
}
|
|
1467
|
+
this.unsubscribeParentListener = null;
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
setOpen(open, eventDetails) {
|
|
1471
|
+
this.state.floatingRootContext.context.events.emit("setOpen", {
|
|
1472
|
+
open,
|
|
1473
|
+
eventDetails
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
static useStore(externalStore, initialState) {
|
|
1477
|
+
const internalStore = useRefWithInit(() => {
|
|
1478
|
+
return new MenuStore(initialState);
|
|
1479
|
+
}).current;
|
|
1480
|
+
return externalStore ?? internalStore;
|
|
1481
|
+
}
|
|
1482
|
+
unsubscribeParentListener = null;
|
|
1483
|
+
}
|
|
1484
|
+
function createInitialState() {
|
|
1485
|
+
return {
|
|
1486
|
+
...createInitialPopupStoreState(),
|
|
1487
|
+
disabled: false,
|
|
1488
|
+
modal: true,
|
|
1489
|
+
openMethod: null,
|
|
1490
|
+
allowMouseEnter: false,
|
|
1491
|
+
stickIfOpen: true,
|
|
1492
|
+
parent: {
|
|
1493
|
+
type: undefined
|
|
1494
|
+
},
|
|
1495
|
+
rootId: undefined,
|
|
1496
|
+
activeIndex: null,
|
|
1497
|
+
hoverEnabled: true,
|
|
1498
|
+
instantType: undefined,
|
|
1499
|
+
openChangeReason: null,
|
|
1500
|
+
floatingTreeRoot: new FloatingTreeStore,
|
|
1501
|
+
floatingNodeId: undefined,
|
|
1502
|
+
floatingParentNodeId: null,
|
|
1503
|
+
itemProps: EMPTY_OBJECT,
|
|
1504
|
+
keyboardEventRelay: undefined,
|
|
1505
|
+
closeDelay: 0,
|
|
1506
|
+
hasViewport: false
|
|
1507
|
+
};
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/submenu-root/MenuSubmenuRootContext.js
|
|
1511
|
+
import * as React26 from "react";
|
|
1512
|
+
"use client";
|
|
1513
|
+
var MenuSubmenuRootContext = /* @__PURE__ */ React26.createContext(undefined);
|
|
1514
|
+
if (true)
|
|
1515
|
+
MenuSubmenuRootContext.displayName = "MenuSubmenuRootContext";
|
|
1516
|
+
function useMenuSubmenuRootContext() {
|
|
1517
|
+
return React26.useContext(MenuSubmenuRootContext);
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/root/MenuRoot.js
|
|
1521
|
+
import { jsx as _jsx8 } from "react/jsx-runtime";
|
|
1522
|
+
"use client";
|
|
1523
|
+
var MenuRoot = fastComponent(function MenuRoot2(props) {
|
|
1524
|
+
const {
|
|
1525
|
+
children,
|
|
1526
|
+
open: openProp,
|
|
1527
|
+
onOpenChange,
|
|
1528
|
+
onOpenChangeComplete,
|
|
1529
|
+
defaultOpen = false,
|
|
1530
|
+
disabled: disabledProp = false,
|
|
1531
|
+
modal: modalProp,
|
|
1532
|
+
loopFocus = true,
|
|
1533
|
+
orientation = "vertical",
|
|
1534
|
+
actionsRef,
|
|
1535
|
+
closeParentOnEsc = false,
|
|
1536
|
+
handle,
|
|
1537
|
+
triggerId: triggerIdProp,
|
|
1538
|
+
defaultTriggerId: defaultTriggerIdProp = null,
|
|
1539
|
+
highlightItemOnHover = true
|
|
1540
|
+
} = props;
|
|
1541
|
+
const contextMenuContext = useContextMenuRootContext(true);
|
|
1542
|
+
const parentMenuRootContext = useMenuRootContext(true);
|
|
1543
|
+
const menubarContext = useMenubarContext(true);
|
|
1544
|
+
const isSubmenu = useMenuSubmenuRootContext();
|
|
1545
|
+
const parentFromContext = React27.useMemo(() => {
|
|
1546
|
+
if (isSubmenu && parentMenuRootContext) {
|
|
1547
|
+
return {
|
|
1548
|
+
type: "menu",
|
|
1549
|
+
store: parentMenuRootContext.store
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
if (menubarContext) {
|
|
1553
|
+
return {
|
|
1554
|
+
type: "menubar",
|
|
1555
|
+
context: menubarContext
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
if (contextMenuContext && !parentMenuRootContext) {
|
|
1559
|
+
return {
|
|
1560
|
+
type: "context-menu",
|
|
1561
|
+
context: contextMenuContext
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
return {
|
|
1565
|
+
type: undefined
|
|
1566
|
+
};
|
|
1567
|
+
}, [contextMenuContext, parentMenuRootContext, menubarContext, isSubmenu]);
|
|
1568
|
+
const store = MenuStore.useStore(handle?.store, {
|
|
1569
|
+
open: defaultOpen,
|
|
1570
|
+
openProp,
|
|
1571
|
+
activeTriggerId: defaultTriggerIdProp,
|
|
1572
|
+
triggerIdProp,
|
|
1573
|
+
parent: parentFromContext
|
|
1574
|
+
});
|
|
1575
|
+
useOnFirstRender(() => {
|
|
1576
|
+
if (openProp === undefined && store.state.open === false && defaultOpen === true) {
|
|
1577
|
+
store.update({
|
|
1578
|
+
open: true,
|
|
1579
|
+
activeTriggerId: defaultTriggerIdProp
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
store.useControlledProp("openProp", openProp);
|
|
1584
|
+
store.useControlledProp("triggerIdProp", triggerIdProp);
|
|
1585
|
+
store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
|
|
1586
|
+
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
1587
|
+
const floatingNodeIdFromContext = useFloatingNodeId(floatingTreeRoot);
|
|
1588
|
+
const floatingParentNodeIdFromContext = useFloatingParentNodeId();
|
|
1589
|
+
useIsoLayoutEffect(() => {
|
|
1590
|
+
if (contextMenuContext && !parentMenuRootContext) {
|
|
1591
|
+
store.update({
|
|
1592
|
+
parent: {
|
|
1593
|
+
type: "context-menu",
|
|
1594
|
+
context: contextMenuContext
|
|
1595
|
+
},
|
|
1596
|
+
floatingNodeId: floatingNodeIdFromContext,
|
|
1597
|
+
floatingParentNodeId: floatingParentNodeIdFromContext
|
|
1598
|
+
});
|
|
1599
|
+
} else if (parentMenuRootContext) {
|
|
1600
|
+
store.update({
|
|
1601
|
+
floatingNodeId: floatingNodeIdFromContext,
|
|
1602
|
+
floatingParentNodeId: floatingParentNodeIdFromContext
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
}, [contextMenuContext, parentMenuRootContext, floatingNodeIdFromContext, floatingParentNodeIdFromContext, store]);
|
|
1606
|
+
const open = store.useState("open");
|
|
1607
|
+
const activeTriggerElement = store.useState("activeTriggerElement");
|
|
1608
|
+
const positionerElement = store.useState("positionerElement");
|
|
1609
|
+
const hoverEnabled = store.useState("hoverEnabled");
|
|
1610
|
+
const disabled = store.useState("disabled");
|
|
1611
|
+
const lastOpenChangeReason = store.useState("lastOpenChangeReason");
|
|
1612
|
+
const parent = store.useState("parent");
|
|
1613
|
+
const activeIndex = store.useState("activeIndex");
|
|
1614
|
+
const payload = store.useState("payload");
|
|
1615
|
+
const floatingParentNodeId = store.useState("floatingParentNodeId");
|
|
1616
|
+
const openEventRef = React27.useRef(null);
|
|
1617
|
+
const nested = floatingParentNodeId != null;
|
|
1618
|
+
if (true) {
|
|
1619
|
+
if (parent.type !== undefined && modalProp !== undefined) {
|
|
1620
|
+
console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored.");
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
const {
|
|
1624
|
+
openMethod,
|
|
1625
|
+
triggerProps: interactionTypeProps
|
|
1626
|
+
} = useOpenInteractionType(open);
|
|
1627
|
+
store.useSyncedValues({
|
|
1628
|
+
disabled: disabledProp,
|
|
1629
|
+
modal: parent.type === undefined ? modalProp : undefined,
|
|
1630
|
+
openMethod,
|
|
1631
|
+
rootId: useId()
|
|
1632
|
+
});
|
|
1633
|
+
useImplicitActiveTrigger(store);
|
|
1634
|
+
const {
|
|
1635
|
+
forceUnmount
|
|
1636
|
+
} = useOpenStateTransitions(open, store, () => {
|
|
1637
|
+
store.update({
|
|
1638
|
+
allowMouseEnter: false,
|
|
1639
|
+
stickIfOpen: true
|
|
1640
|
+
});
|
|
1641
|
+
});
|
|
1642
|
+
const allowOutsidePressDismissalRef = React27.useRef(parent.type !== "context-menu");
|
|
1643
|
+
const allowOutsidePressDismissalTimeout = useTimeout();
|
|
1644
|
+
React27.useEffect(() => {
|
|
1645
|
+
if (!open) {
|
|
1646
|
+
openEventRef.current = null;
|
|
1647
|
+
}
|
|
1648
|
+
if (parent.type !== "context-menu") {
|
|
1649
|
+
return;
|
|
1650
|
+
}
|
|
1651
|
+
if (!open) {
|
|
1652
|
+
allowOutsidePressDismissalTimeout.clear();
|
|
1653
|
+
allowOutsidePressDismissalRef.current = false;
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1656
|
+
allowOutsidePressDismissalTimeout.start(500, () => {
|
|
1657
|
+
allowOutsidePressDismissalRef.current = true;
|
|
1658
|
+
});
|
|
1659
|
+
}, [allowOutsidePressDismissalTimeout, open, parent.type]);
|
|
1660
|
+
useIsoLayoutEffect(() => {
|
|
1661
|
+
if (!open && !hoverEnabled) {
|
|
1662
|
+
store.set("hoverEnabled", true);
|
|
1663
|
+
}
|
|
1664
|
+
}, [open, hoverEnabled, store]);
|
|
1665
|
+
const allowTouchToCloseRef = React27.useRef(true);
|
|
1666
|
+
const allowTouchToCloseTimeout = useTimeout();
|
|
1667
|
+
const setOpen = useStableCallback((nextOpen, eventDetails) => {
|
|
1668
|
+
const reason = eventDetails.reason;
|
|
1669
|
+
if (open === nextOpen && eventDetails.trigger === activeTriggerElement && lastOpenChangeReason === reason) {
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
eventDetails.preventUnmountOnClose = () => {
|
|
1673
|
+
store.set("preventUnmountingOnClose", true);
|
|
1674
|
+
};
|
|
1675
|
+
if (!nextOpen && eventDetails.trigger == null) {
|
|
1676
|
+
eventDetails.trigger = activeTriggerElement ?? undefined;
|
|
1677
|
+
}
|
|
1678
|
+
onOpenChange?.(nextOpen, eventDetails);
|
|
1679
|
+
if (eventDetails.isCanceled) {
|
|
1680
|
+
return;
|
|
1681
|
+
}
|
|
1682
|
+
store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
|
|
1683
|
+
const nativeEvent = eventDetails.event;
|
|
1684
|
+
if (nextOpen === false && nativeEvent?.type === "click" && nativeEvent.pointerType === "touch" && !allowTouchToCloseRef.current) {
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
if (!nextOpen && activeIndex !== null) {
|
|
1688
|
+
const activeOption = store.context.itemDomElements.current[activeIndex];
|
|
1689
|
+
queueMicrotask(() => {
|
|
1690
|
+
activeOption?.setAttribute("tabindex", "-1");
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
if (nextOpen && reason === exports_reason_parts.triggerFocus) {
|
|
1694
|
+
allowTouchToCloseRef.current = false;
|
|
1695
|
+
allowTouchToCloseTimeout.start(300, () => {
|
|
1696
|
+
allowTouchToCloseRef.current = true;
|
|
1697
|
+
});
|
|
1698
|
+
} else {
|
|
1699
|
+
allowTouchToCloseRef.current = true;
|
|
1700
|
+
allowTouchToCloseTimeout.clear();
|
|
1701
|
+
}
|
|
1702
|
+
const isKeyboardClick = (reason === exports_reason_parts.triggerPress || reason === exports_reason_parts.itemPress) && nativeEvent.detail === 0 && nativeEvent?.isTrusted;
|
|
1703
|
+
const isDismissClose = !nextOpen && (reason === exports_reason_parts.escapeKey || reason == null);
|
|
1704
|
+
const updatedState = {
|
|
1705
|
+
open: nextOpen,
|
|
1706
|
+
openChangeReason: reason
|
|
1707
|
+
};
|
|
1708
|
+
openEventRef.current = eventDetails.event ?? null;
|
|
1709
|
+
const newTriggerId = eventDetails.trigger?.id ?? null;
|
|
1710
|
+
if (newTriggerId || nextOpen) {
|
|
1711
|
+
updatedState.activeTriggerId = newTriggerId;
|
|
1712
|
+
updatedState.activeTriggerElement = eventDetails.trigger ?? null;
|
|
1713
|
+
}
|
|
1714
|
+
store.update(updatedState);
|
|
1715
|
+
if (parent.type === "menubar" && (reason === exports_reason_parts.triggerFocus || reason === exports_reason_parts.focusOut || reason === exports_reason_parts.triggerHover || reason === exports_reason_parts.listNavigation || reason === exports_reason_parts.siblingOpen)) {
|
|
1716
|
+
store.set("instantType", "group");
|
|
1717
|
+
} else if (isKeyboardClick || isDismissClose) {
|
|
1718
|
+
store.set("instantType", isKeyboardClick ? "click" : "dismiss");
|
|
1719
|
+
} else {
|
|
1720
|
+
store.set("instantType", undefined);
|
|
1721
|
+
}
|
|
1722
|
+
});
|
|
1723
|
+
const handleImperativeClose = React27.useCallback(() => {
|
|
1724
|
+
store.setOpen(false, createChangeEventDetails(exports_reason_parts.imperativeAction));
|
|
1725
|
+
}, [store]);
|
|
1726
|
+
React27.useImperativeHandle(actionsRef, () => ({
|
|
1727
|
+
unmount: forceUnmount,
|
|
1728
|
+
close: handleImperativeClose
|
|
1729
|
+
}), [forceUnmount, handleImperativeClose]);
|
|
1730
|
+
let ctx;
|
|
1731
|
+
if (parent.type === "context-menu") {
|
|
1732
|
+
ctx = parent.context;
|
|
1733
|
+
}
|
|
1734
|
+
React27.useImperativeHandle(ctx?.positionerRef, () => positionerElement, [positionerElement]);
|
|
1735
|
+
React27.useImperativeHandle(ctx?.actionsRef, () => ({
|
|
1736
|
+
setOpen
|
|
1737
|
+
}), [setOpen]);
|
|
1738
|
+
const floatingRootContext = useSyncedFloatingRootContext({
|
|
1739
|
+
popupStore: store,
|
|
1740
|
+
onOpenChange: setOpen
|
|
1741
|
+
});
|
|
1742
|
+
const floatingEvents = floatingRootContext.context.events;
|
|
1743
|
+
React27.useEffect(() => {
|
|
1744
|
+
const handleSetOpenEvent = ({
|
|
1745
|
+
open: nextOpen,
|
|
1746
|
+
eventDetails
|
|
1747
|
+
}) => setOpen(nextOpen, eventDetails);
|
|
1748
|
+
floatingEvents.on("setOpen", handleSetOpenEvent);
|
|
1749
|
+
return () => {
|
|
1750
|
+
floatingEvents?.off("setOpen", handleSetOpenEvent);
|
|
1751
|
+
};
|
|
1752
|
+
}, [floatingEvents, setOpen]);
|
|
1753
|
+
const dismiss = useDismiss(floatingRootContext, {
|
|
1754
|
+
enabled: !disabled,
|
|
1755
|
+
bubbles: {
|
|
1756
|
+
escapeKey: closeParentOnEsc && parent.type === "menu"
|
|
1757
|
+
},
|
|
1758
|
+
outsidePress() {
|
|
1759
|
+
if (parent.type !== "context-menu" || openEventRef.current?.type === "contextmenu") {
|
|
1760
|
+
return true;
|
|
1761
|
+
}
|
|
1762
|
+
return allowOutsidePressDismissalRef.current;
|
|
1763
|
+
},
|
|
1764
|
+
externalTree: nested ? floatingTreeRoot : undefined
|
|
1765
|
+
});
|
|
1766
|
+
const role = useRole(floatingRootContext, {
|
|
1767
|
+
role: "menu"
|
|
1768
|
+
});
|
|
1769
|
+
const direction = useDirection();
|
|
1770
|
+
const setActiveIndex = React27.useCallback((index) => {
|
|
1771
|
+
if (store.select("activeIndex") === index) {
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
store.set("activeIndex", index);
|
|
1775
|
+
}, [store]);
|
|
1776
|
+
const listNavigation = useListNavigation(floatingRootContext, {
|
|
1777
|
+
enabled: !disabled,
|
|
1778
|
+
listRef: store.context.itemDomElements,
|
|
1779
|
+
activeIndex,
|
|
1780
|
+
nested: parent.type !== undefined,
|
|
1781
|
+
loopFocus,
|
|
1782
|
+
orientation,
|
|
1783
|
+
parentOrientation: parent.type === "menubar" ? parent.context.orientation : undefined,
|
|
1784
|
+
rtl: direction === "rtl",
|
|
1785
|
+
disabledIndices: EMPTY_ARRAY,
|
|
1786
|
+
onNavigate: setActiveIndex,
|
|
1787
|
+
openOnArrowKeyDown: parent.type !== "context-menu",
|
|
1788
|
+
externalTree: nested ? floatingTreeRoot : undefined,
|
|
1789
|
+
focusItemOnHover: highlightItemOnHover
|
|
1790
|
+
});
|
|
1791
|
+
const onTypingChange = React27.useCallback((nextTyping) => {
|
|
1792
|
+
store.context.typingRef.current = nextTyping;
|
|
1793
|
+
}, [store]);
|
|
1794
|
+
const typeahead = useTypeahead(floatingRootContext, {
|
|
1795
|
+
listRef: store.context.itemLabels,
|
|
1796
|
+
elementsRef: store.context.itemDomElements,
|
|
1797
|
+
activeIndex,
|
|
1798
|
+
resetMs: TYPEAHEAD_RESET_MS,
|
|
1799
|
+
onMatch: (index) => {
|
|
1800
|
+
if (open && index !== activeIndex) {
|
|
1801
|
+
store.set("activeIndex", index);
|
|
1802
|
+
}
|
|
1803
|
+
},
|
|
1804
|
+
onTypingChange
|
|
1805
|
+
});
|
|
1806
|
+
const {
|
|
1807
|
+
getReferenceProps,
|
|
1808
|
+
getFloatingProps,
|
|
1809
|
+
getItemProps,
|
|
1810
|
+
getTriggerProps
|
|
1811
|
+
} = useInteractions([dismiss, role, listNavigation, typeahead]);
|
|
1812
|
+
const activeTriggerProps = React27.useMemo(() => {
|
|
1813
|
+
const mergedProps = mergeProps(getReferenceProps(), {
|
|
1814
|
+
onMouseMove() {
|
|
1815
|
+
store.set("allowMouseEnter", true);
|
|
1816
|
+
}
|
|
1817
|
+
}, interactionTypeProps);
|
|
1818
|
+
delete mergedProps.role;
|
|
1819
|
+
return mergedProps;
|
|
1820
|
+
}, [getReferenceProps, store, interactionTypeProps]);
|
|
1821
|
+
const inactiveTriggerProps = React27.useMemo(() => {
|
|
1822
|
+
const triggerProps = getTriggerProps();
|
|
1823
|
+
if (!triggerProps) {
|
|
1824
|
+
return triggerProps;
|
|
1825
|
+
}
|
|
1826
|
+
const mergedProps = mergeProps(triggerProps, interactionTypeProps);
|
|
1827
|
+
delete mergedProps.role;
|
|
1828
|
+
delete mergedProps["aria-controls"];
|
|
1829
|
+
return mergedProps;
|
|
1830
|
+
}, [getTriggerProps, interactionTypeProps]);
|
|
1831
|
+
const popupProps = React27.useMemo(() => getFloatingProps({
|
|
1832
|
+
onMouseMove() {
|
|
1833
|
+
store.set("allowMouseEnter", true);
|
|
1834
|
+
if (parent.type === "menu") {
|
|
1835
|
+
store.set("hoverEnabled", false);
|
|
1836
|
+
}
|
|
1837
|
+
},
|
|
1838
|
+
onClick() {
|
|
1839
|
+
if (store.select("hoverEnabled")) {
|
|
1840
|
+
store.set("hoverEnabled", false);
|
|
1841
|
+
}
|
|
1842
|
+
},
|
|
1843
|
+
onKeyDown(event) {
|
|
1844
|
+
const relay = store.select("keyboardEventRelay");
|
|
1845
|
+
if (relay && !event.isPropagationStopped()) {
|
|
1846
|
+
relay(event);
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
}), [getFloatingProps, parent.type, store]);
|
|
1850
|
+
const itemProps = React27.useMemo(() => getItemProps(), [getItemProps]);
|
|
1851
|
+
store.useSyncedValues({
|
|
1852
|
+
floatingRootContext,
|
|
1853
|
+
activeTriggerProps,
|
|
1854
|
+
inactiveTriggerProps,
|
|
1855
|
+
popupProps,
|
|
1856
|
+
itemProps
|
|
1857
|
+
});
|
|
1858
|
+
const context = React27.useMemo(() => ({
|
|
1859
|
+
store,
|
|
1860
|
+
parent: parentFromContext
|
|
1861
|
+
}), [store, parentFromContext]);
|
|
1862
|
+
const content = /* @__PURE__ */ _jsx8(MenuRootContext.Provider, {
|
|
1863
|
+
value: context,
|
|
1864
|
+
children: typeof children === "function" ? children({
|
|
1865
|
+
payload
|
|
1866
|
+
}) : children
|
|
1867
|
+
});
|
|
1868
|
+
if (parent.type === undefined || parent.type === "context-menu") {
|
|
1869
|
+
return /* @__PURE__ */ _jsx8(FloatingTree, {
|
|
1870
|
+
externalTree: floatingTreeRoot,
|
|
1871
|
+
children: content
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
return content;
|
|
1875
|
+
});
|
|
1876
|
+
if (true)
|
|
1877
|
+
MenuRoot.displayName = "MenuRoot";
|
|
1878
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/submenu-root/MenuSubmenuRoot.js
|
|
1879
|
+
import * as React28 from "react";
|
|
1880
|
+
import { jsx as _jsx9 } from "react/jsx-runtime";
|
|
1881
|
+
"use client";
|
|
1882
|
+
function MenuSubmenuRoot(props) {
|
|
1883
|
+
const parentMenu = useMenuRootContext().store;
|
|
1884
|
+
const contextValue = React28.useMemo(() => ({
|
|
1885
|
+
parentMenu
|
|
1886
|
+
}), [parentMenu]);
|
|
1887
|
+
return /* @__PURE__ */ _jsx9(MenuSubmenuRootContext.Provider, {
|
|
1888
|
+
value: contextValue,
|
|
1889
|
+
children: /* @__PURE__ */ _jsx9(MenuRoot, {
|
|
1890
|
+
...props
|
|
1891
|
+
})
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/trigger/MenuTrigger.js
|
|
1895
|
+
import * as React30 from "react";
|
|
1896
|
+
|
|
1897
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/utils/findRootOwnerId.js
|
|
1898
|
+
function findRootOwnerId(node) {
|
|
1899
|
+
if (isHTMLElement(node) && node.hasAttribute("data-rootownerid")) {
|
|
1900
|
+
return node.getAttribute("data-rootownerid") ?? undefined;
|
|
1901
|
+
}
|
|
1902
|
+
if (isLastTraversableNode(node)) {
|
|
1903
|
+
return;
|
|
1904
|
+
}
|
|
1905
|
+
return findRootOwnerId(getParentNode(node));
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/utils/useMixedToggleClickHandler.js
|
|
1909
|
+
import * as React29 from "react";
|
|
1910
|
+
"use client";
|
|
1911
|
+
function useMixedToggleClickHandler(params) {
|
|
1912
|
+
const {
|
|
1913
|
+
enabled = true,
|
|
1914
|
+
mouseDownAction,
|
|
1915
|
+
open
|
|
1916
|
+
} = params;
|
|
1917
|
+
const ignoreClickRef = React29.useRef(false);
|
|
1918
|
+
return React29.useMemo(() => {
|
|
1919
|
+
if (!enabled) {
|
|
1920
|
+
return EMPTY_OBJECT;
|
|
1921
|
+
}
|
|
1922
|
+
return {
|
|
1923
|
+
onMouseDown: (event) => {
|
|
1924
|
+
if (mouseDownAction === "open" && !open || mouseDownAction === "close" && open) {
|
|
1925
|
+
ignoreClickRef.current = true;
|
|
1926
|
+
ownerDocument(event.currentTarget).addEventListener("click", () => {
|
|
1927
|
+
ignoreClickRef.current = false;
|
|
1928
|
+
}, {
|
|
1929
|
+
once: true
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
},
|
|
1933
|
+
onClick: (event) => {
|
|
1934
|
+
if (ignoreClickRef.current) {
|
|
1935
|
+
ignoreClickRef.current = false;
|
|
1936
|
+
event.preventBaseUIHandler();
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
};
|
|
1940
|
+
}, [enabled, mouseDownAction, open]);
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/trigger/MenuTrigger.js
|
|
1944
|
+
import { jsx as _jsx10, jsxs as _jsxs2 } from "react/jsx-runtime";
|
|
1945
|
+
"use client";
|
|
1946
|
+
var BOUNDARY_OFFSET = 2;
|
|
1947
|
+
var MenuTrigger = fastComponentRef(function MenuTrigger2(componentProps, forwardedRef) {
|
|
1948
|
+
const {
|
|
1949
|
+
render,
|
|
1950
|
+
className,
|
|
1951
|
+
disabled: disabledProp = false,
|
|
1952
|
+
nativeButton = true,
|
|
1953
|
+
id: idProp,
|
|
1954
|
+
openOnHover: openOnHoverProp,
|
|
1955
|
+
delay = 100,
|
|
1956
|
+
closeDelay = 0,
|
|
1957
|
+
handle,
|
|
1958
|
+
payload,
|
|
1959
|
+
style,
|
|
1960
|
+
...elementProps
|
|
1961
|
+
} = componentProps;
|
|
1962
|
+
const rootContext = useMenuRootContext(true);
|
|
1963
|
+
const store = handle?.store ?? rootContext?.store;
|
|
1964
|
+
if (!store) {
|
|
1965
|
+
throw new Error("Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle.");
|
|
1966
|
+
}
|
|
1967
|
+
const thisTriggerId = useBaseUiId(idProp);
|
|
1968
|
+
const isTriggerActive = store.useState("isTriggerActive", thisTriggerId);
|
|
1969
|
+
const floatingRootContext = store.useState("floatingRootContext");
|
|
1970
|
+
const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId);
|
|
1971
|
+
const triggerElementRef = React30.useRef(null);
|
|
1972
|
+
const parent = useMenuParent();
|
|
1973
|
+
const compositeRootContext = useCompositeRootContext(true);
|
|
1974
|
+
const floatingTreeRootFromContext = useFloatingTree();
|
|
1975
|
+
const floatingTreeRoot = React30.useMemo(() => {
|
|
1976
|
+
return floatingTreeRootFromContext ?? new FloatingTreeStore;
|
|
1977
|
+
}, [floatingTreeRootFromContext]);
|
|
1978
|
+
const floatingNodeId = useFloatingNodeId(floatingTreeRoot);
|
|
1979
|
+
const floatingParentNodeId = useFloatingParentNodeId();
|
|
1980
|
+
const {
|
|
1981
|
+
registerTrigger,
|
|
1982
|
+
isMountedByThisTrigger
|
|
1983
|
+
} = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
|
|
1984
|
+
payload,
|
|
1985
|
+
closeDelay,
|
|
1986
|
+
parent,
|
|
1987
|
+
floatingTreeRoot,
|
|
1988
|
+
floatingNodeId,
|
|
1989
|
+
floatingParentNodeId,
|
|
1990
|
+
keyboardEventRelay: compositeRootContext?.relayKeyboardEvent
|
|
1991
|
+
});
|
|
1992
|
+
const isInMenubar = parent.type === "menubar";
|
|
1993
|
+
const rootDisabled = store.useState("disabled");
|
|
1994
|
+
const disabled = disabledProp || rootDisabled || isInMenubar && parent.context.disabled;
|
|
1995
|
+
const {
|
|
1996
|
+
getButtonProps,
|
|
1997
|
+
buttonRef
|
|
1998
|
+
} = useButton({
|
|
1999
|
+
disabled,
|
|
2000
|
+
native: nativeButton
|
|
2001
|
+
});
|
|
2002
|
+
React30.useEffect(() => {
|
|
2003
|
+
if (!isOpenedByThisTrigger && parent.type === undefined) {
|
|
2004
|
+
store.context.allowMouseUpTriggerRef.current = false;
|
|
2005
|
+
}
|
|
2006
|
+
}, [store, isOpenedByThisTrigger, parent.type]);
|
|
2007
|
+
const triggerRef = React30.useRef(null);
|
|
2008
|
+
const allowMouseUpTriggerTimeout = useTimeout();
|
|
2009
|
+
const handleDocumentMouseUp = useStableCallback((mouseEvent) => {
|
|
2010
|
+
if (!triggerRef.current) {
|
|
2011
|
+
return;
|
|
2012
|
+
}
|
|
2013
|
+
allowMouseUpTriggerTimeout.clear();
|
|
2014
|
+
store.context.allowMouseUpTriggerRef.current = false;
|
|
2015
|
+
const mouseUpTarget = mouseEvent.target;
|
|
2016
|
+
if (contains(triggerRef.current, mouseUpTarget) || contains(store.select("positionerElement"), mouseUpTarget) || mouseUpTarget === triggerRef.current) {
|
|
2017
|
+
return;
|
|
2018
|
+
}
|
|
2019
|
+
if (mouseUpTarget != null && findRootOwnerId(mouseUpTarget) === store.select("rootId")) {
|
|
2020
|
+
return;
|
|
2021
|
+
}
|
|
2022
|
+
const bounds = getPseudoElementBounds(triggerRef.current);
|
|
2023
|
+
if (mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET && mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET) {
|
|
2024
|
+
return;
|
|
2025
|
+
}
|
|
2026
|
+
floatingTreeRoot.events.emit("close", {
|
|
2027
|
+
domEvent: mouseEvent,
|
|
2028
|
+
reason: exports_reason_parts.cancelOpen
|
|
2029
|
+
});
|
|
2030
|
+
});
|
|
2031
|
+
React30.useEffect(() => {
|
|
2032
|
+
if (isOpenedByThisTrigger && store.select("lastOpenChangeReason") === exports_reason_parts.triggerHover) {
|
|
2033
|
+
const doc = ownerDocument(triggerRef.current);
|
|
2034
|
+
doc.addEventListener("mouseup", handleDocumentMouseUp, {
|
|
2035
|
+
once: true
|
|
2036
|
+
});
|
|
2037
|
+
}
|
|
2038
|
+
}, [isOpenedByThisTrigger, handleDocumentMouseUp, store]);
|
|
2039
|
+
const parentMenubarHasSubmenuOpen = isInMenubar && parent.context.hasSubmenuOpen;
|
|
2040
|
+
const openOnHover = openOnHoverProp ?? parentMenubarHasSubmenuOpen;
|
|
2041
|
+
const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
|
|
2042
|
+
enabled: openOnHover && !disabled && parent.type !== "context-menu" && (!isInMenubar || parentMenubarHasSubmenuOpen && !isMountedByThisTrigger),
|
|
2043
|
+
handleClose: safePolygon({
|
|
2044
|
+
blockPointerEvents: !isInMenubar
|
|
2045
|
+
}),
|
|
2046
|
+
mouseOnly: true,
|
|
2047
|
+
move: false,
|
|
2048
|
+
restMs: parent.type === undefined ? delay : undefined,
|
|
2049
|
+
delay: {
|
|
2050
|
+
close: closeDelay
|
|
2051
|
+
},
|
|
2052
|
+
triggerElementRef,
|
|
2053
|
+
externalTree: floatingTreeRoot,
|
|
2054
|
+
isActiveTrigger: isTriggerActive,
|
|
2055
|
+
isClosing: () => store.select("transitionStatus") === "ending"
|
|
2056
|
+
});
|
|
2057
|
+
const stickIfOpen = useStickIfOpen(isOpenedByThisTrigger, store.select("lastOpenChangeReason"));
|
|
2058
|
+
const click = useClick(floatingRootContext, {
|
|
2059
|
+
enabled: !disabled && parent.type !== "context-menu",
|
|
2060
|
+
event: isOpenedByThisTrigger && isInMenubar ? "click" : "mousedown",
|
|
2061
|
+
toggle: true,
|
|
2062
|
+
ignoreMouse: false,
|
|
2063
|
+
stickIfOpen: parent.type === undefined ? stickIfOpen : false
|
|
2064
|
+
});
|
|
2065
|
+
const focus = useFocus(floatingRootContext, {
|
|
2066
|
+
enabled: !disabled && parentMenubarHasSubmenuOpen
|
|
2067
|
+
});
|
|
2068
|
+
const mixedToggleHandlers = useMixedToggleClickHandler({
|
|
2069
|
+
open: isOpenedByThisTrigger,
|
|
2070
|
+
enabled: isInMenubar,
|
|
2071
|
+
mouseDownAction: "open"
|
|
2072
|
+
});
|
|
2073
|
+
const localInteractionProps = useInteractions([click, focus]);
|
|
2074
|
+
const state = {
|
|
2075
|
+
disabled,
|
|
2076
|
+
open: isOpenedByThisTrigger
|
|
2077
|
+
};
|
|
2078
|
+
const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger);
|
|
2079
|
+
const ref = [triggerRef, forwardedRef, buttonRef, registerTrigger, triggerElementRef];
|
|
2080
|
+
const props = [localInteractionProps.getReferenceProps(), hoverProps ?? EMPTY_OBJECT, rootTriggerProps, {
|
|
2081
|
+
"aria-haspopup": "menu",
|
|
2082
|
+
id: thisTriggerId,
|
|
2083
|
+
onMouseDown: (event) => {
|
|
2084
|
+
if (store.select("open")) {
|
|
2085
|
+
return;
|
|
2086
|
+
}
|
|
2087
|
+
allowMouseUpTriggerTimeout.start(200, () => {
|
|
2088
|
+
store.context.allowMouseUpTriggerRef.current = true;
|
|
2089
|
+
});
|
|
2090
|
+
const doc = ownerDocument(event.currentTarget);
|
|
2091
|
+
doc.addEventListener("mouseup", handleDocumentMouseUp, {
|
|
2092
|
+
once: true
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
2095
|
+
}, isInMenubar ? {
|
|
2096
|
+
role: "menuitem"
|
|
2097
|
+
} : {}, mixedToggleHandlers, elementProps, getButtonProps];
|
|
2098
|
+
const {
|
|
2099
|
+
preFocusGuardRef,
|
|
2100
|
+
handlePreFocusGuardFocus,
|
|
2101
|
+
handleFocusTargetFocus
|
|
2102
|
+
} = useTriggerFocusGuards(store, triggerElementRef);
|
|
2103
|
+
const element = useRenderElement("button", componentProps, {
|
|
2104
|
+
enabled: !isInMenubar,
|
|
2105
|
+
stateAttributesMapping: pressableTriggerOpenStateMapping,
|
|
2106
|
+
state,
|
|
2107
|
+
ref,
|
|
2108
|
+
props
|
|
2109
|
+
});
|
|
2110
|
+
if (isInMenubar) {
|
|
2111
|
+
return /* @__PURE__ */ _jsx10(CompositeItem, {
|
|
2112
|
+
tag: "button",
|
|
2113
|
+
render,
|
|
2114
|
+
className,
|
|
2115
|
+
style,
|
|
2116
|
+
state,
|
|
2117
|
+
refs: ref,
|
|
2118
|
+
props,
|
|
2119
|
+
stateAttributesMapping: pressableTriggerOpenStateMapping
|
|
2120
|
+
});
|
|
2121
|
+
}
|
|
2122
|
+
if (isOpenedByThisTrigger) {
|
|
2123
|
+
return /* @__PURE__ */ _jsxs2(React30.Fragment, {
|
|
2124
|
+
children: [/* @__PURE__ */ _jsx10(FocusGuard, {
|
|
2125
|
+
ref: preFocusGuardRef,
|
|
2126
|
+
onFocus: handlePreFocusGuardFocus
|
|
2127
|
+
}, `${thisTriggerId}-pre-focus-guard`), /* @__PURE__ */ _jsx10(React30.Fragment, {
|
|
2128
|
+
children: element
|
|
2129
|
+
}, thisTriggerId), /* @__PURE__ */ _jsx10(FocusGuard, {
|
|
2130
|
+
ref: store.context.triggerFocusTargetRef,
|
|
2131
|
+
onFocus: handleFocusTargetFocus
|
|
2132
|
+
}, `${thisTriggerId}-post-focus-guard`)]
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
return /* @__PURE__ */ _jsx10(React30.Fragment, {
|
|
2136
|
+
children: element
|
|
2137
|
+
}, thisTriggerId);
|
|
2138
|
+
});
|
|
2139
|
+
if (true)
|
|
2140
|
+
MenuTrigger.displayName = "MenuTrigger";
|
|
2141
|
+
function useStickIfOpen(open, openReason) {
|
|
2142
|
+
const stickIfOpenTimeout = useTimeout();
|
|
2143
|
+
const [stickIfOpen, setStickIfOpen] = React30.useState(false);
|
|
2144
|
+
useIsoLayoutEffect(() => {
|
|
2145
|
+
if (open && openReason === "trigger-hover") {
|
|
2146
|
+
setStickIfOpen(true);
|
|
2147
|
+
stickIfOpenTimeout.start(PATIENT_CLICK_THRESHOLD, () => {
|
|
2148
|
+
setStickIfOpen(false);
|
|
2149
|
+
});
|
|
2150
|
+
} else if (!open) {
|
|
2151
|
+
stickIfOpenTimeout.clear();
|
|
2152
|
+
setStickIfOpen(false);
|
|
2153
|
+
}
|
|
2154
|
+
}, [open, openReason, stickIfOpenTimeout]);
|
|
2155
|
+
return stickIfOpen;
|
|
2156
|
+
}
|
|
2157
|
+
function useMenuParent() {
|
|
2158
|
+
const contextMenuContext = useContextMenuRootContext(true);
|
|
2159
|
+
const parentContext = useMenuRootContext(true);
|
|
2160
|
+
const menubarContext = useMenubarContext(true);
|
|
2161
|
+
const parent = React30.useMemo(() => {
|
|
2162
|
+
if (menubarContext) {
|
|
2163
|
+
return {
|
|
2164
|
+
type: "menubar",
|
|
2165
|
+
context: menubarContext
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
if (contextMenuContext && !parentContext) {
|
|
2169
|
+
return {
|
|
2170
|
+
type: "context-menu",
|
|
2171
|
+
context: contextMenuContext
|
|
2172
|
+
};
|
|
2173
|
+
}
|
|
2174
|
+
return {
|
|
2175
|
+
type: undefined
|
|
2176
|
+
};
|
|
2177
|
+
}, [contextMenuContext, parentContext, menubarContext]);
|
|
2178
|
+
return parent;
|
|
2179
|
+
}
|
|
2180
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/viewport/MenuViewport.js
|
|
2181
|
+
import * as React31 from "react";
|
|
2182
|
+
|
|
2183
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/viewport/MenuViewportCssVars.js
|
|
2184
|
+
var MenuViewportCssVars = /* @__PURE__ */ function(MenuViewportCssVars2) {
|
|
2185
|
+
MenuViewportCssVars2["popupWidth"] = "--popup-width";
|
|
2186
|
+
MenuViewportCssVars2["popupHeight"] = "--popup-height";
|
|
2187
|
+
return MenuViewportCssVars2;
|
|
2188
|
+
}({});
|
|
2189
|
+
|
|
2190
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/viewport/MenuViewport.js
|
|
2191
|
+
"use client";
|
|
2192
|
+
var stateAttributesMapping3 = {
|
|
2193
|
+
activationDirection: (value) => value ? {
|
|
2194
|
+
"data-activation-direction": value
|
|
2195
|
+
} : null
|
|
2196
|
+
};
|
|
2197
|
+
var MenuViewport = /* @__PURE__ */ React31.forwardRef(function MenuViewport2(componentProps, forwardedRef) {
|
|
2198
|
+
const {
|
|
2199
|
+
render,
|
|
2200
|
+
className,
|
|
2201
|
+
style,
|
|
2202
|
+
children,
|
|
2203
|
+
...elementProps
|
|
2204
|
+
} = componentProps;
|
|
2205
|
+
const {
|
|
2206
|
+
store
|
|
2207
|
+
} = useMenuRootContext();
|
|
2208
|
+
const {
|
|
2209
|
+
side
|
|
2210
|
+
} = useMenuPositionerContext();
|
|
2211
|
+
const instantType = store.useState("instantType");
|
|
2212
|
+
const {
|
|
2213
|
+
children: childrenToRender,
|
|
2214
|
+
state: viewportState
|
|
2215
|
+
} = usePopupViewport({
|
|
2216
|
+
store,
|
|
2217
|
+
side,
|
|
2218
|
+
cssVars: MenuViewportCssVars,
|
|
2219
|
+
children
|
|
2220
|
+
});
|
|
2221
|
+
const state = {
|
|
2222
|
+
activationDirection: viewportState.activationDirection,
|
|
2223
|
+
transitioning: viewportState.transitioning,
|
|
2224
|
+
instant: instantType
|
|
2225
|
+
};
|
|
2226
|
+
return useRenderElement("div", componentProps, {
|
|
2227
|
+
state,
|
|
2228
|
+
ref: forwardedRef,
|
|
2229
|
+
props: [elementProps, {
|
|
2230
|
+
children: childrenToRender
|
|
2231
|
+
}],
|
|
2232
|
+
stateAttributesMapping: stateAttributesMapping3
|
|
2233
|
+
});
|
|
2234
|
+
});
|
|
2235
|
+
if (true)
|
|
2236
|
+
MenuViewport.displayName = "MenuViewport";
|
|
2237
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/submenu-trigger/MenuSubmenuTrigger.js
|
|
2238
|
+
import * as React32 from "react";
|
|
2239
|
+
"use client";
|
|
2240
|
+
var MenuSubmenuTrigger = /* @__PURE__ */ React32.forwardRef(function SubmenuTriggerComponent(componentProps, forwardedRef) {
|
|
2241
|
+
const {
|
|
2242
|
+
render,
|
|
2243
|
+
className,
|
|
2244
|
+
label,
|
|
2245
|
+
id: idProp,
|
|
2246
|
+
nativeButton = false,
|
|
2247
|
+
openOnHover = true,
|
|
2248
|
+
delay = 100,
|
|
2249
|
+
closeDelay = 0,
|
|
2250
|
+
disabled: disabledProp = false,
|
|
2251
|
+
style,
|
|
2252
|
+
...elementProps
|
|
2253
|
+
} = componentProps;
|
|
2254
|
+
const listItem = useCompositeListItem();
|
|
2255
|
+
const menuPositionerContext = useMenuPositionerContext();
|
|
2256
|
+
const {
|
|
2257
|
+
store
|
|
2258
|
+
} = useMenuRootContext();
|
|
2259
|
+
const thisTriggerId = useBaseUiId(idProp);
|
|
2260
|
+
const open = store.useState("open");
|
|
2261
|
+
const floatingRootContext = store.useState("floatingRootContext");
|
|
2262
|
+
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
2263
|
+
const baseRegisterTrigger = useTriggerRegistration(thisTriggerId, store);
|
|
2264
|
+
const registerTrigger = React32.useCallback((element2) => {
|
|
2265
|
+
const cleanup = baseRegisterTrigger(element2);
|
|
2266
|
+
if (element2 !== null && store.select("open") && store.select("activeTriggerId") == null) {
|
|
2267
|
+
store.update({
|
|
2268
|
+
activeTriggerId: thisTriggerId,
|
|
2269
|
+
activeTriggerElement: element2,
|
|
2270
|
+
closeDelay
|
|
2271
|
+
});
|
|
2272
|
+
}
|
|
2273
|
+
return cleanup;
|
|
2274
|
+
}, [baseRegisterTrigger, closeDelay, store, thisTriggerId]);
|
|
2275
|
+
const triggerElementRef = React32.useRef(null);
|
|
2276
|
+
const handleTriggerElementRef = React32.useCallback((el) => {
|
|
2277
|
+
triggerElementRef.current = el;
|
|
2278
|
+
store.set("activeTriggerElement", el);
|
|
2279
|
+
}, [store]);
|
|
2280
|
+
if (true) {
|
|
2281
|
+
useIsoLayoutEffect(() => {
|
|
2282
|
+
const element2 = triggerElementRef.current;
|
|
2283
|
+
if (element2 && isElementDisabled(element2) && !disabledProp) {
|
|
2284
|
+
const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
|
|
2285
|
+
warn(`A disabled element was detected on <Menu.SubmenuTrigger>. To properly disable the trigger, use the \`disabled\` prop on the component instead of setting it on the rendered element.${ownerStackMessage}`);
|
|
2286
|
+
}
|
|
2287
|
+
});
|
|
2288
|
+
}
|
|
2289
|
+
const submenuRootContext = useMenuSubmenuRootContext();
|
|
2290
|
+
if (!submenuRootContext?.parentMenu) {
|
|
2291
|
+
throw new Error("Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>.");
|
|
2292
|
+
}
|
|
2293
|
+
store.useSyncedValue("closeDelay", closeDelay);
|
|
2294
|
+
const parentMenuStore = submenuRootContext.parentMenu;
|
|
2295
|
+
const itemProps = parentMenuStore.useState("itemProps");
|
|
2296
|
+
const highlighted = parentMenuStore.useState("isActive", listItem.index);
|
|
2297
|
+
const itemMetadata = React32.useMemo(() => ({
|
|
2298
|
+
type: "submenu-trigger",
|
|
2299
|
+
setActive() {
|
|
2300
|
+
parentMenuStore.set("activeIndex", listItem.index);
|
|
2301
|
+
}
|
|
2302
|
+
}), [parentMenuStore, listItem.index]);
|
|
2303
|
+
const rootDisabled = store.useState("disabled");
|
|
2304
|
+
const disabled = disabledProp || rootDisabled;
|
|
2305
|
+
const {
|
|
2306
|
+
getItemProps,
|
|
2307
|
+
itemRef
|
|
2308
|
+
} = useMenuItem({
|
|
2309
|
+
closeOnClick: false,
|
|
2310
|
+
disabled,
|
|
2311
|
+
highlighted,
|
|
2312
|
+
id: thisTriggerId,
|
|
2313
|
+
store,
|
|
2314
|
+
typingRef: parentMenuStore.context.typingRef,
|
|
2315
|
+
nativeButton,
|
|
2316
|
+
itemMetadata,
|
|
2317
|
+
nodeId: menuPositionerContext?.context.nodeId
|
|
2318
|
+
});
|
|
2319
|
+
const hoverEnabled = store.useState("hoverEnabled");
|
|
2320
|
+
const allowMouseEnter = parentMenuStore.useState("allowMouseEnter");
|
|
2321
|
+
const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
|
|
2322
|
+
enabled: hoverEnabled && openOnHover && !disabled,
|
|
2323
|
+
handleClose: safePolygon({
|
|
2324
|
+
blockPointerEvents: true
|
|
2325
|
+
}),
|
|
2326
|
+
mouseOnly: true,
|
|
2327
|
+
move: true,
|
|
2328
|
+
restMs: delay,
|
|
2329
|
+
delay: allowMouseEnter ? {
|
|
2330
|
+
open: delay,
|
|
2331
|
+
close: closeDelay
|
|
2332
|
+
} : 0,
|
|
2333
|
+
triggerElementRef,
|
|
2334
|
+
externalTree: floatingTreeRoot,
|
|
2335
|
+
isClosing: () => store.select("transitionStatus") === "ending"
|
|
2336
|
+
});
|
|
2337
|
+
const click = useClick(floatingRootContext, {
|
|
2338
|
+
enabled: !disabled,
|
|
2339
|
+
event: "mousedown",
|
|
2340
|
+
toggle: !openOnHover,
|
|
2341
|
+
ignoreMouse: openOnHover,
|
|
2342
|
+
stickIfOpen: false
|
|
2343
|
+
});
|
|
2344
|
+
const localInteractionProps = useInteractions([click]);
|
|
2345
|
+
const rootTriggerProps = store.useState("triggerProps", true);
|
|
2346
|
+
delete rootTriggerProps.id;
|
|
2347
|
+
const state = {
|
|
2348
|
+
disabled,
|
|
2349
|
+
highlighted,
|
|
2350
|
+
open
|
|
2351
|
+
};
|
|
2352
|
+
const element = useRenderElement("div", componentProps, {
|
|
2353
|
+
state,
|
|
2354
|
+
stateAttributesMapping: triggerOpenStateMapping,
|
|
2355
|
+
props: [localInteractionProps.getReferenceProps(), hoverProps, rootTriggerProps, itemProps, {
|
|
2356
|
+
tabIndex: open || highlighted ? 0 : -1,
|
|
2357
|
+
onBlur() {
|
|
2358
|
+
if (highlighted) {
|
|
2359
|
+
parentMenuStore.set("activeIndex", null);
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
}, elementProps, getItemProps],
|
|
2363
|
+
ref: [forwardedRef, listItem.ref, itemRef, registerTrigger, handleTriggerElementRef]
|
|
2364
|
+
});
|
|
2365
|
+
return element;
|
|
2366
|
+
});
|
|
2367
|
+
if (true)
|
|
2368
|
+
MenuSubmenuTrigger.displayName = "MenuSubmenuTrigger";
|
|
2369
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/menu/store/MenuHandle.js
|
|
2370
|
+
class MenuHandle {
|
|
2371
|
+
constructor() {
|
|
2372
|
+
this.store = new MenuStore;
|
|
2373
|
+
}
|
|
2374
|
+
open(triggerId) {
|
|
2375
|
+
const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : undefined;
|
|
2376
|
+
if (triggerId && !triggerElement) {
|
|
2377
|
+
throw new Error(`Base UI: MenuHandle.open: No trigger found with id "${triggerId}".`);
|
|
2378
|
+
}
|
|
2379
|
+
this.store.setOpen(true, createChangeEventDetails("imperative-action", undefined, triggerElement));
|
|
2380
|
+
}
|
|
2381
|
+
close() {
|
|
2382
|
+
this.store.setOpen(false, createChangeEventDetails("imperative-action", undefined, undefined));
|
|
2383
|
+
}
|
|
2384
|
+
get isOpen() {
|
|
2385
|
+
return this.store.state.open;
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
function createMenuHandle() {
|
|
2389
|
+
return new MenuHandle;
|
|
2390
|
+
}
|
|
2391
|
+
export { ContextMenuRootContext, useContextMenuRootContext, MenuRootContext, useMenuRootContext, MenuArrow, MenuBackdrop, MenuCheckboxItem, MenuCheckboxItemIndicator, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuPopup, MenuPortal, MenuPositioner, MenuRadioGroup, MenuRadioItem, MenuRadioItemIndicator, MenuSubmenuRoot, findRootOwnerId, MenuSubmenuTrigger, exports_index_parts };
|