@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,1854 @@
|
|
|
1
|
+
/* @base-ui/react 1.4.1 — vendored (MIT — MUI Inc).
|
|
2
|
+
* Refresh: scripts/vendor-base-ui.js (see header for instructions).
|
|
3
|
+
* Do not edit by hand. */
|
|
4
|
+
import {
|
|
5
|
+
CompositeRoot
|
|
6
|
+
} from "./_chunk-0h5sskyw.js";
|
|
7
|
+
import"./_chunk-r0vsdknk.js";
|
|
8
|
+
import {
|
|
9
|
+
CompositeItem
|
|
10
|
+
} from "./_chunk-j0eqdjta.js";
|
|
11
|
+
import"./_chunk-b5jsqt97.js";
|
|
12
|
+
import {
|
|
13
|
+
adaptiveOrigin,
|
|
14
|
+
useAnchorPositioning,
|
|
15
|
+
usePositioner
|
|
16
|
+
} from "./_chunk-502wngfc.js";
|
|
17
|
+
import {
|
|
18
|
+
getCssDimensions
|
|
19
|
+
} from "./_chunk-xfagb0fq.js";
|
|
20
|
+
import"./_chunk-ek863ta9.js";
|
|
21
|
+
import"./_chunk-vdc01ss3.js";
|
|
22
|
+
import"./_chunk-p6qynd6r.js";
|
|
23
|
+
import"./_chunk-20rtfsz9.js";
|
|
24
|
+
import {
|
|
25
|
+
useDirection
|
|
26
|
+
} from "./_chunk-wtw745qd.js";
|
|
27
|
+
import {
|
|
28
|
+
useControlled
|
|
29
|
+
} from "./_chunk-01rqe37g.js";
|
|
30
|
+
import {
|
|
31
|
+
getEmptyRootContext
|
|
32
|
+
} from "./_chunk-f9tgee1q.js";
|
|
33
|
+
import {
|
|
34
|
+
popupStateMapping,
|
|
35
|
+
pressableTriggerOpenStateMapping,
|
|
36
|
+
triggerOpenStateMapping
|
|
37
|
+
} from "./_chunk-536jvgeq.js";
|
|
38
|
+
import {
|
|
39
|
+
inertValue
|
|
40
|
+
} from "./_chunk-9nyxkvte.js";
|
|
41
|
+
import {
|
|
42
|
+
DROPDOWN_COLLISION_AVOIDANCE,
|
|
43
|
+
FloatingNode,
|
|
44
|
+
FloatingPortal,
|
|
45
|
+
FloatingTree,
|
|
46
|
+
FocusGuard,
|
|
47
|
+
PATIENT_CLICK_THRESHOLD,
|
|
48
|
+
POPUP_COLLISION_AVOIDANCE,
|
|
49
|
+
applySafePolygonPointerEventsMutation,
|
|
50
|
+
clearSafePolygonPointerEventsMutation,
|
|
51
|
+
disableFocusInside,
|
|
52
|
+
enableFocusInside,
|
|
53
|
+
getNextTabbable,
|
|
54
|
+
getNodeChildren,
|
|
55
|
+
getPreviousTabbable,
|
|
56
|
+
getTabbableAfterElement,
|
|
57
|
+
isOutsideEvent,
|
|
58
|
+
mergeCleanups,
|
|
59
|
+
ownerVisuallyHidden,
|
|
60
|
+
safePolygon,
|
|
61
|
+
useClick,
|
|
62
|
+
useDismiss,
|
|
63
|
+
useFloatingNodeId,
|
|
64
|
+
useFloatingParentNodeId,
|
|
65
|
+
useFloatingRootContext,
|
|
66
|
+
useFloatingTree,
|
|
67
|
+
useHoverFloatingInteraction,
|
|
68
|
+
useHoverInteractionSharedState,
|
|
69
|
+
useHoverReferenceInteraction,
|
|
70
|
+
useInteractions
|
|
71
|
+
} from "./_chunk-2tyt8f8r.js";
|
|
72
|
+
import"./_chunk-aqwsk46c.js";
|
|
73
|
+
import {
|
|
74
|
+
ownerDocument
|
|
75
|
+
} from "./_chunk-xb7ph1ka.js";
|
|
76
|
+
import {
|
|
77
|
+
activeElement,
|
|
78
|
+
contains,
|
|
79
|
+
getTarget
|
|
80
|
+
} from "./_chunk-atnkefgd.js";
|
|
81
|
+
import {
|
|
82
|
+
useValueAsRef
|
|
83
|
+
} from "./_chunk-drfb9kp2.js";
|
|
84
|
+
import"./_chunk-qce0xt57.js";
|
|
85
|
+
import {
|
|
86
|
+
stopEvent
|
|
87
|
+
} from "./_chunk-nya71ccw.js";
|
|
88
|
+
import"./_chunk-t7j3rbpv.js";
|
|
89
|
+
import {
|
|
90
|
+
useTimeout
|
|
91
|
+
} from "./_chunk-7v1t86x1.js";
|
|
92
|
+
import"./_chunk-hzgetm70.js";
|
|
93
|
+
import"./_chunk-f5d01bp9.js";
|
|
94
|
+
import {
|
|
95
|
+
addEventListener
|
|
96
|
+
} from "./_chunk-mvv30fkv.js";
|
|
97
|
+
import {
|
|
98
|
+
createChangeEventDetails,
|
|
99
|
+
exports_reason_parts
|
|
100
|
+
} from "./_chunk-4s0k3h7t.js";
|
|
101
|
+
import {
|
|
102
|
+
useBaseUiId,
|
|
103
|
+
useId
|
|
104
|
+
} from "./_chunk-8kh3xk78.js";
|
|
105
|
+
import {
|
|
106
|
+
TransitionStatusDataAttributes,
|
|
107
|
+
transitionStatusMapping,
|
|
108
|
+
useAnimationsFinished,
|
|
109
|
+
useOpenChangeComplete,
|
|
110
|
+
useTransitionStatus
|
|
111
|
+
} from "./_chunk-mbn76q14.js";
|
|
112
|
+
import"./_chunk-v92ycsfj.js";
|
|
113
|
+
import {
|
|
114
|
+
useAnimationFrame
|
|
115
|
+
} from "./_chunk-3h6zpchb.js";
|
|
116
|
+
import"./_chunk-8jz3hb7q.js";
|
|
117
|
+
import {
|
|
118
|
+
useButton
|
|
119
|
+
} from "./_chunk-85vrgzwr.js";
|
|
120
|
+
import"./_chunk-71zm6zgv.js";
|
|
121
|
+
import"./_chunk-6xevjepc.js";
|
|
122
|
+
import {
|
|
123
|
+
getWindow,
|
|
124
|
+
isHTMLElement
|
|
125
|
+
} from "./_chunk-sx6vkz01.js";
|
|
126
|
+
import"./_chunk-n7dnqnbw.js";
|
|
127
|
+
import {
|
|
128
|
+
useStableCallback
|
|
129
|
+
} from "./_chunk-mznt6ktj.js";
|
|
130
|
+
import {
|
|
131
|
+
useIsoLayoutEffect
|
|
132
|
+
} from "./_chunk-b40erthe.js";
|
|
133
|
+
import {
|
|
134
|
+
EMPTY_ARRAY,
|
|
135
|
+
EMPTY_OBJECT,
|
|
136
|
+
useRenderElement
|
|
137
|
+
} from "./_chunk-1s41sngz.js";
|
|
138
|
+
import {
|
|
139
|
+
__export
|
|
140
|
+
} from "./_chunk-1e6khrvm.js";
|
|
141
|
+
|
|
142
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/index.parts.js
|
|
143
|
+
var exports_index_parts = {};
|
|
144
|
+
__export(exports_index_parts, {
|
|
145
|
+
Viewport: () => NavigationMenuViewport,
|
|
146
|
+
Trigger: () => NavigationMenuTrigger,
|
|
147
|
+
Root: () => NavigationMenuRoot,
|
|
148
|
+
Positioner: () => NavigationMenuPositioner,
|
|
149
|
+
Portal: () => NavigationMenuPortal,
|
|
150
|
+
Popup: () => NavigationMenuPopup,
|
|
151
|
+
List: () => NavigationMenuList,
|
|
152
|
+
Link: () => NavigationMenuLink,
|
|
153
|
+
Item: () => NavigationMenuItem,
|
|
154
|
+
Icon: () => NavigationMenuIcon,
|
|
155
|
+
Content: () => NavigationMenuContent,
|
|
156
|
+
Backdrop: () => NavigationMenuBackdrop,
|
|
157
|
+
Arrow: () => NavigationMenuArrow
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/root/NavigationMenuRoot.js
|
|
161
|
+
import * as React2 from "react";
|
|
162
|
+
|
|
163
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/root/NavigationMenuRootContext.js
|
|
164
|
+
import * as React from "react";
|
|
165
|
+
"use client";
|
|
166
|
+
var NavigationMenuRootContext = /* @__PURE__ */ React.createContext(undefined);
|
|
167
|
+
if (true)
|
|
168
|
+
NavigationMenuRootContext.displayName = "NavigationMenuRootContext";
|
|
169
|
+
if (true) {
|
|
170
|
+
NavigationMenuRootContext.displayName = "NavigationMenuRootContext";
|
|
171
|
+
}
|
|
172
|
+
function useNavigationMenuRootContext(optional) {
|
|
173
|
+
const context = React.useContext(NavigationMenuRootContext);
|
|
174
|
+
if (context === undefined && !optional) {
|
|
175
|
+
throw new Error("Base UI: NavigationMenuRootContext is missing. Navigation Menu parts must be placed within <NavigationMenu.Root>.");
|
|
176
|
+
}
|
|
177
|
+
return context;
|
|
178
|
+
}
|
|
179
|
+
var NavigationMenuTreeContext = /* @__PURE__ */ React.createContext(undefined);
|
|
180
|
+
if (true)
|
|
181
|
+
NavigationMenuTreeContext.displayName = "NavigationMenuTreeContext";
|
|
182
|
+
function useNavigationMenuTreeContext() {
|
|
183
|
+
return React.useContext(NavigationMenuTreeContext);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/popup/NavigationMenuPopupCssVars.js
|
|
187
|
+
var NavigationMenuPopupCssVars = /* @__PURE__ */ function(NavigationMenuPopupCssVars2) {
|
|
188
|
+
NavigationMenuPopupCssVars2["popupWidth"] = "--popup-width";
|
|
189
|
+
NavigationMenuPopupCssVars2["popupHeight"] = "--popup-height";
|
|
190
|
+
return NavigationMenuPopupCssVars2;
|
|
191
|
+
}({});
|
|
192
|
+
|
|
193
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/positioner/NavigationMenuPositionerCssVars.js
|
|
194
|
+
var NavigationMenuPositionerCssVars = /* @__PURE__ */ function(NavigationMenuPositionerCssVars2) {
|
|
195
|
+
NavigationMenuPositionerCssVars2["availableWidth"] = "--available-width";
|
|
196
|
+
NavigationMenuPositionerCssVars2["availableHeight"] = "--available-height";
|
|
197
|
+
NavigationMenuPositionerCssVars2["anchorWidth"] = "--anchor-width";
|
|
198
|
+
NavigationMenuPositionerCssVars2["anchorHeight"] = "--anchor-height";
|
|
199
|
+
NavigationMenuPositionerCssVars2["transformOrigin"] = "--transform-origin";
|
|
200
|
+
NavigationMenuPositionerCssVars2["positionerWidth"] = "--positioner-width";
|
|
201
|
+
NavigationMenuPositionerCssVars2["positionerHeight"] = "--positioner-height";
|
|
202
|
+
return NavigationMenuPositionerCssVars2;
|
|
203
|
+
}({});
|
|
204
|
+
|
|
205
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/root/NavigationMenuRoot.js
|
|
206
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
207
|
+
"use client";
|
|
208
|
+
var blockedReturnFocusReasons = new Set([exports_reason_parts.triggerHover, exports_reason_parts.outsidePress, exports_reason_parts.focusOut]);
|
|
209
|
+
function setSharedFixedSize(popupElement, positionerElement) {
|
|
210
|
+
const {
|
|
211
|
+
width,
|
|
212
|
+
height
|
|
213
|
+
} = getCssDimensions(popupElement);
|
|
214
|
+
if (width === 0 || height === 0) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
popupElement.style.setProperty(NavigationMenuPopupCssVars.popupWidth, `${width}px`);
|
|
218
|
+
popupElement.style.setProperty(NavigationMenuPopupCssVars.popupHeight, `${height}px`);
|
|
219
|
+
positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerWidth, `${width}px`);
|
|
220
|
+
positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerHeight, `${height}px`);
|
|
221
|
+
}
|
|
222
|
+
var NavigationMenuRoot = /* @__PURE__ */ React2.forwardRef(function NavigationMenuRoot2(componentProps, forwardedRef) {
|
|
223
|
+
const {
|
|
224
|
+
defaultValue = null,
|
|
225
|
+
value: valueParam,
|
|
226
|
+
onValueChange,
|
|
227
|
+
actionsRef,
|
|
228
|
+
delay = 50,
|
|
229
|
+
closeDelay = 50,
|
|
230
|
+
orientation = "horizontal",
|
|
231
|
+
onOpenChangeComplete
|
|
232
|
+
} = componentProps;
|
|
233
|
+
const nested = useFloatingParentNodeId() != null;
|
|
234
|
+
const parentRootContext = useNavigationMenuRootContext(true);
|
|
235
|
+
const [value, setValueUnwrapped] = useControlled({
|
|
236
|
+
controlled: valueParam,
|
|
237
|
+
default: defaultValue,
|
|
238
|
+
name: "NavigationMenu",
|
|
239
|
+
state: "value"
|
|
240
|
+
});
|
|
241
|
+
const open = value != null;
|
|
242
|
+
const closeReasonRef = React2.useRef(undefined);
|
|
243
|
+
const rootRef = React2.useRef(null);
|
|
244
|
+
const [positionerElement, setPositionerElement] = React2.useState(null);
|
|
245
|
+
const [popupElement, setPopupElement] = React2.useState(null);
|
|
246
|
+
const [viewportElement, setViewportElement] = React2.useState(null);
|
|
247
|
+
const [viewportTargetElement, setViewportTargetElement] = React2.useState(null);
|
|
248
|
+
const [activationDirection, setActivationDirection] = React2.useState(null);
|
|
249
|
+
const [floatingRootContext, setFloatingRootContext] = React2.useState(undefined);
|
|
250
|
+
const [viewportInert, setViewportInert] = React2.useState(false);
|
|
251
|
+
const prevTriggerElementRef = React2.useRef(null);
|
|
252
|
+
const currentContentRef = React2.useRef(null);
|
|
253
|
+
const beforeInsideRef = React2.useRef(null);
|
|
254
|
+
const afterInsideRef = React2.useRef(null);
|
|
255
|
+
const beforeOutsideRef = React2.useRef(null);
|
|
256
|
+
const afterOutsideRef = React2.useRef(null);
|
|
257
|
+
const popupAutoSizeResetRef = React2.useRef({
|
|
258
|
+
abortController: null,
|
|
259
|
+
owner: null
|
|
260
|
+
});
|
|
261
|
+
const {
|
|
262
|
+
mounted,
|
|
263
|
+
setMounted,
|
|
264
|
+
transitionStatus
|
|
265
|
+
} = useTransitionStatus(open);
|
|
266
|
+
React2.useEffect(() => {
|
|
267
|
+
setViewportInert(false);
|
|
268
|
+
}, [value]);
|
|
269
|
+
const setValue = useStableCallback((nextValue, eventDetails) => {
|
|
270
|
+
if (!nextValue) {
|
|
271
|
+
closeReasonRef.current = eventDetails.reason;
|
|
272
|
+
setActivationDirection(null);
|
|
273
|
+
setFloatingRootContext(undefined);
|
|
274
|
+
if (positionerElement && popupElement) {
|
|
275
|
+
setSharedFixedSize(popupElement, positionerElement);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (nextValue !== value) {
|
|
279
|
+
onValueChange?.(nextValue, eventDetails);
|
|
280
|
+
}
|
|
281
|
+
if (eventDetails.isCanceled) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
setValueUnwrapped(nextValue);
|
|
285
|
+
if (nested && !nextValue && eventDetails.reason === exports_reason_parts.linkPress && parentRootContext) {
|
|
286
|
+
parentRootContext.setValue(null, eventDetails);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
const handleUnmount = useStableCallback(() => {
|
|
290
|
+
const doc = ownerDocument(rootRef.current);
|
|
291
|
+
const activeEl = activeElement(doc);
|
|
292
|
+
const isReturnFocusBlocked = closeReasonRef.current ? blockedReturnFocusReasons.has(closeReasonRef.current) : false;
|
|
293
|
+
if (!isReturnFocusBlocked && isHTMLElement(prevTriggerElementRef.current) && (activeEl === ownerDocument(popupElement).body || contains(popupElement, activeEl)) && popupElement) {
|
|
294
|
+
prevTriggerElementRef.current.focus({
|
|
295
|
+
preventScroll: true
|
|
296
|
+
});
|
|
297
|
+
prevTriggerElementRef.current = undefined;
|
|
298
|
+
}
|
|
299
|
+
setMounted(false);
|
|
300
|
+
onOpenChangeComplete?.(false);
|
|
301
|
+
setActivationDirection(null);
|
|
302
|
+
setFloatingRootContext(undefined);
|
|
303
|
+
currentContentRef.current = null;
|
|
304
|
+
closeReasonRef.current = undefined;
|
|
305
|
+
});
|
|
306
|
+
useOpenChangeComplete({
|
|
307
|
+
enabled: !actionsRef,
|
|
308
|
+
open,
|
|
309
|
+
ref: {
|
|
310
|
+
current: popupElement
|
|
311
|
+
},
|
|
312
|
+
onComplete() {
|
|
313
|
+
if (!open) {
|
|
314
|
+
handleUnmount();
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
useOpenChangeComplete({
|
|
319
|
+
enabled: !actionsRef,
|
|
320
|
+
open,
|
|
321
|
+
ref: {
|
|
322
|
+
current: viewportTargetElement
|
|
323
|
+
},
|
|
324
|
+
onComplete() {
|
|
325
|
+
if (!open) {
|
|
326
|
+
handleUnmount();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
const contextValue = React2.useMemo(() => ({
|
|
331
|
+
open,
|
|
332
|
+
value,
|
|
333
|
+
setValue,
|
|
334
|
+
mounted,
|
|
335
|
+
transitionStatus,
|
|
336
|
+
positionerElement,
|
|
337
|
+
setPositionerElement,
|
|
338
|
+
popupElement,
|
|
339
|
+
setPopupElement,
|
|
340
|
+
viewportElement,
|
|
341
|
+
setViewportElement,
|
|
342
|
+
viewportTargetElement,
|
|
343
|
+
setViewportTargetElement,
|
|
344
|
+
activationDirection,
|
|
345
|
+
setActivationDirection,
|
|
346
|
+
floatingRootContext,
|
|
347
|
+
setFloatingRootContext,
|
|
348
|
+
currentContentRef,
|
|
349
|
+
nested,
|
|
350
|
+
rootRef,
|
|
351
|
+
beforeInsideRef,
|
|
352
|
+
afterInsideRef,
|
|
353
|
+
beforeOutsideRef,
|
|
354
|
+
afterOutsideRef,
|
|
355
|
+
prevTriggerElementRef,
|
|
356
|
+
popupAutoSizeResetRef,
|
|
357
|
+
delay,
|
|
358
|
+
closeDelay,
|
|
359
|
+
orientation,
|
|
360
|
+
viewportInert,
|
|
361
|
+
setViewportInert
|
|
362
|
+
}), [open, value, setValue, mounted, transitionStatus, positionerElement, popupElement, viewportElement, viewportTargetElement, activationDirection, floatingRootContext, nested, delay, closeDelay, orientation, viewportInert]);
|
|
363
|
+
const jsx = /* @__PURE__ */ _jsx(NavigationMenuRootContext.Provider, {
|
|
364
|
+
value: contextValue,
|
|
365
|
+
children: /* @__PURE__ */ _jsx(TreeContext, {
|
|
366
|
+
componentProps,
|
|
367
|
+
forwardedRef,
|
|
368
|
+
children: componentProps.children
|
|
369
|
+
})
|
|
370
|
+
});
|
|
371
|
+
if (!nested) {
|
|
372
|
+
return /* @__PURE__ */ _jsx(FloatingTree, {
|
|
373
|
+
children: jsx
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
return jsx;
|
|
377
|
+
});
|
|
378
|
+
if (true)
|
|
379
|
+
NavigationMenuRoot.displayName = "NavigationMenuRoot";
|
|
380
|
+
function TreeContext(props) {
|
|
381
|
+
const {
|
|
382
|
+
className,
|
|
383
|
+
render,
|
|
384
|
+
defaultValue,
|
|
385
|
+
value: valueParam,
|
|
386
|
+
onValueChange,
|
|
387
|
+
actionsRef,
|
|
388
|
+
delay,
|
|
389
|
+
closeDelay,
|
|
390
|
+
orientation,
|
|
391
|
+
onOpenChangeComplete,
|
|
392
|
+
style,
|
|
393
|
+
...elementProps
|
|
394
|
+
} = props.componentProps;
|
|
395
|
+
const nodeId = useFloatingNodeId();
|
|
396
|
+
const {
|
|
397
|
+
rootRef,
|
|
398
|
+
nested
|
|
399
|
+
} = useNavigationMenuRootContext();
|
|
400
|
+
const {
|
|
401
|
+
open
|
|
402
|
+
} = useNavigationMenuRootContext();
|
|
403
|
+
const state = {
|
|
404
|
+
open,
|
|
405
|
+
nested
|
|
406
|
+
};
|
|
407
|
+
const element = useRenderElement(nested ? "div" : "nav", props.componentProps, {
|
|
408
|
+
state,
|
|
409
|
+
ref: [props.forwardedRef, rootRef],
|
|
410
|
+
props: elementProps
|
|
411
|
+
});
|
|
412
|
+
return /* @__PURE__ */ _jsx(NavigationMenuTreeContext.Provider, {
|
|
413
|
+
value: nodeId,
|
|
414
|
+
children: /* @__PURE__ */ _jsx(FloatingNode, {
|
|
415
|
+
id: nodeId,
|
|
416
|
+
children: element
|
|
417
|
+
})
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/list/NavigationMenuList.js
|
|
421
|
+
import * as React4 from "react";
|
|
422
|
+
|
|
423
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/utils/constants.js
|
|
424
|
+
var NAVIGATION_MENU_TRIGGER_IDENTIFIER = "data-base-ui-navigation-menu-trigger";
|
|
425
|
+
|
|
426
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/list/NavigationMenuDismissContext.js
|
|
427
|
+
import * as React3 from "react";
|
|
428
|
+
"use client";
|
|
429
|
+
var NavigationMenuDismissContext = /* @__PURE__ */ React3.createContext(undefined);
|
|
430
|
+
if (true)
|
|
431
|
+
NavigationMenuDismissContext.displayName = "NavigationMenuDismissContext";
|
|
432
|
+
function useNavigationMenuDismissContext() {
|
|
433
|
+
return React3.useContext(NavigationMenuDismissContext);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/list/NavigationMenuList.js
|
|
437
|
+
import { jsx as _jsx2 } from "react/jsx-runtime";
|
|
438
|
+
"use client";
|
|
439
|
+
var NavigationMenuList = /* @__PURE__ */ React4.forwardRef(function NavigationMenuList2(componentProps, forwardedRef) {
|
|
440
|
+
const {
|
|
441
|
+
className,
|
|
442
|
+
render,
|
|
443
|
+
style,
|
|
444
|
+
...elementProps
|
|
445
|
+
} = componentProps;
|
|
446
|
+
const nodeId = useNavigationMenuTreeContext();
|
|
447
|
+
const {
|
|
448
|
+
orientation,
|
|
449
|
+
open,
|
|
450
|
+
floatingRootContext,
|
|
451
|
+
positionerElement,
|
|
452
|
+
value,
|
|
453
|
+
closeDelay,
|
|
454
|
+
viewportElement,
|
|
455
|
+
nested
|
|
456
|
+
} = useNavigationMenuRootContext();
|
|
457
|
+
const fallbackContext = React4.useMemo(() => getEmptyRootContext(), []);
|
|
458
|
+
const context = floatingRootContext || fallbackContext;
|
|
459
|
+
const interactionsEnabled = positionerElement ? true : !value;
|
|
460
|
+
const hoverInteractionsEnabled = positionerElement || viewportElement ? true : !value;
|
|
461
|
+
useHoverFloatingInteraction(context, {
|
|
462
|
+
enabled: Boolean(floatingRootContext) && hoverInteractionsEnabled,
|
|
463
|
+
closeDelay,
|
|
464
|
+
nodeId
|
|
465
|
+
});
|
|
466
|
+
const dismiss = useDismiss(context, {
|
|
467
|
+
enabled: interactionsEnabled,
|
|
468
|
+
outsidePressEvent: "intentional",
|
|
469
|
+
outsidePress(event) {
|
|
470
|
+
const target = getTarget(event);
|
|
471
|
+
const closestNavigationMenuTrigger = target?.closest(`[${NAVIGATION_MENU_TRIGGER_IDENTIFIER}]`);
|
|
472
|
+
return closestNavigationMenuTrigger === null;
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
const dismissProps = floatingRootContext ? dismiss : undefined;
|
|
476
|
+
const state = {
|
|
477
|
+
open
|
|
478
|
+
};
|
|
479
|
+
const defaultProps = nested ? EMPTY_OBJECT : {
|
|
480
|
+
onKeyDown(event) {
|
|
481
|
+
const shouldStop = orientation === "horizontal" && (event.key === "ArrowLeft" || event.key === "ArrowRight") || orientation === "vertical" && (event.key === "ArrowUp" || event.key === "ArrowDown");
|
|
482
|
+
if (shouldStop) {
|
|
483
|
+
event.stopPropagation();
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
const props = [dismissProps?.floating || EMPTY_OBJECT, defaultProps, {
|
|
488
|
+
"aria-orientation": undefined
|
|
489
|
+
}, elementProps];
|
|
490
|
+
const element = useRenderElement("ul", componentProps, {
|
|
491
|
+
state,
|
|
492
|
+
ref: forwardedRef,
|
|
493
|
+
props,
|
|
494
|
+
enabled: nested
|
|
495
|
+
});
|
|
496
|
+
if (nested) {
|
|
497
|
+
return /* @__PURE__ */ _jsx2(NavigationMenuDismissContext.Provider, {
|
|
498
|
+
value: dismissProps,
|
|
499
|
+
children: element
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
return /* @__PURE__ */ _jsx2(NavigationMenuDismissContext.Provider, {
|
|
503
|
+
value: dismissProps,
|
|
504
|
+
children: /* @__PURE__ */ _jsx2(CompositeRoot, {
|
|
505
|
+
render,
|
|
506
|
+
className,
|
|
507
|
+
style,
|
|
508
|
+
state,
|
|
509
|
+
refs: [forwardedRef],
|
|
510
|
+
props,
|
|
511
|
+
loopFocus: false,
|
|
512
|
+
orientation,
|
|
513
|
+
tag: "ul"
|
|
514
|
+
})
|
|
515
|
+
});
|
|
516
|
+
});
|
|
517
|
+
if (true)
|
|
518
|
+
NavigationMenuList.displayName = "NavigationMenuList";
|
|
519
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/item/NavigationMenuItem.js
|
|
520
|
+
import * as React6 from "react";
|
|
521
|
+
|
|
522
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/item/NavigationMenuItemContext.js
|
|
523
|
+
import * as React5 from "react";
|
|
524
|
+
"use client";
|
|
525
|
+
var NavigationMenuItemContext = /* @__PURE__ */ React5.createContext(undefined);
|
|
526
|
+
if (true)
|
|
527
|
+
NavigationMenuItemContext.displayName = "NavigationMenuItemContext";
|
|
528
|
+
function useNavigationMenuItemContext() {
|
|
529
|
+
const value = React5.useContext(NavigationMenuItemContext);
|
|
530
|
+
if (!value) {
|
|
531
|
+
throw new Error("Base UI: NavigationMenuItem parts must be used within a <NavigationMenu.Item>.");
|
|
532
|
+
}
|
|
533
|
+
return value;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/item/NavigationMenuItem.js
|
|
537
|
+
import { jsx as _jsx3 } from "react/jsx-runtime";
|
|
538
|
+
"use client";
|
|
539
|
+
var NavigationMenuItem = /* @__PURE__ */ React6.forwardRef(function NavigationMenuItem2(componentProps, forwardedRef) {
|
|
540
|
+
const {
|
|
541
|
+
className,
|
|
542
|
+
render,
|
|
543
|
+
value: valueProp,
|
|
544
|
+
style,
|
|
545
|
+
...elementProps
|
|
546
|
+
} = componentProps;
|
|
547
|
+
const fallbackValue = useBaseUiId();
|
|
548
|
+
const value = valueProp ?? fallbackValue;
|
|
549
|
+
const element = useRenderElement("li", componentProps, {
|
|
550
|
+
ref: forwardedRef,
|
|
551
|
+
props: elementProps
|
|
552
|
+
});
|
|
553
|
+
const contextValue = React6.useMemo(() => ({
|
|
554
|
+
value
|
|
555
|
+
}), [value]);
|
|
556
|
+
return /* @__PURE__ */ _jsx3(NavigationMenuItemContext.Provider, {
|
|
557
|
+
value: contextValue,
|
|
558
|
+
children: element
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
if (true)
|
|
562
|
+
NavigationMenuItem.displayName = "NavigationMenuItem";
|
|
563
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/content/NavigationMenuContent.js
|
|
564
|
+
import * as React7 from "react";
|
|
565
|
+
import * as ReactDOM from "react-dom";
|
|
566
|
+
import { jsx as _jsx4 } from "react/jsx-runtime";
|
|
567
|
+
"use client";
|
|
568
|
+
var stateAttributesMapping = {
|
|
569
|
+
...popupStateMapping,
|
|
570
|
+
...transitionStatusMapping,
|
|
571
|
+
activationDirection(value) {
|
|
572
|
+
if (!value) {
|
|
573
|
+
return null;
|
|
574
|
+
}
|
|
575
|
+
return {
|
|
576
|
+
"data-activation-direction": value
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
var NavigationMenuContent = /* @__PURE__ */ React7.forwardRef(function NavigationMenuContent2(componentProps, forwardedRef) {
|
|
581
|
+
const {
|
|
582
|
+
className,
|
|
583
|
+
render,
|
|
584
|
+
keepMounted = false,
|
|
585
|
+
style,
|
|
586
|
+
...elementProps
|
|
587
|
+
} = componentProps;
|
|
588
|
+
const {
|
|
589
|
+
mounted: popupMounted,
|
|
590
|
+
viewportElement,
|
|
591
|
+
value,
|
|
592
|
+
activationDirection,
|
|
593
|
+
currentContentRef,
|
|
594
|
+
viewportTargetElement
|
|
595
|
+
} = useNavigationMenuRootContext();
|
|
596
|
+
const {
|
|
597
|
+
value: itemValue
|
|
598
|
+
} = useNavigationMenuItemContext();
|
|
599
|
+
const nodeId = useNavigationMenuTreeContext();
|
|
600
|
+
const open = popupMounted && value === itemValue;
|
|
601
|
+
const ref = React7.useRef(null);
|
|
602
|
+
const [hasMountedInPortal, setHasMountedInPortal] = React7.useState(false);
|
|
603
|
+
const [focusInside, setFocusInside] = React7.useState(false);
|
|
604
|
+
const {
|
|
605
|
+
mounted,
|
|
606
|
+
setMounted,
|
|
607
|
+
transitionStatus
|
|
608
|
+
} = useTransitionStatus(open);
|
|
609
|
+
if (mounted && !popupMounted) {
|
|
610
|
+
setMounted(false);
|
|
611
|
+
}
|
|
612
|
+
useOpenChangeComplete({
|
|
613
|
+
ref,
|
|
614
|
+
open,
|
|
615
|
+
onComplete() {
|
|
616
|
+
if (!open) {
|
|
617
|
+
setMounted(false);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
useIsoLayoutEffect(() => {
|
|
622
|
+
if (open && ref.current) {
|
|
623
|
+
currentContentRef.current = ref.current;
|
|
624
|
+
}
|
|
625
|
+
}, [open, currentContentRef]);
|
|
626
|
+
const state = {
|
|
627
|
+
open,
|
|
628
|
+
transitionStatus,
|
|
629
|
+
activationDirection
|
|
630
|
+
};
|
|
631
|
+
const handleCurrentContentRef = React7.useCallback((node) => {
|
|
632
|
+
if (node) {
|
|
633
|
+
currentContentRef.current = node;
|
|
634
|
+
}
|
|
635
|
+
}, [currentContentRef]);
|
|
636
|
+
const commonProps = {
|
|
637
|
+
onFocus(event) {
|
|
638
|
+
const target = getTarget(event.nativeEvent);
|
|
639
|
+
if (target?.hasAttribute("data-base-ui-focus-guard")) {
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
setFocusInside(true);
|
|
643
|
+
},
|
|
644
|
+
onBlur(event) {
|
|
645
|
+
if (!contains(event.currentTarget, event.relatedTarget)) {
|
|
646
|
+
setFocusInside(false);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
const defaultProps = !open && mounted ? {
|
|
651
|
+
style: {
|
|
652
|
+
position: "absolute",
|
|
653
|
+
top: 0,
|
|
654
|
+
left: 0
|
|
655
|
+
},
|
|
656
|
+
inert: inertValue(!focusInside),
|
|
657
|
+
...commonProps
|
|
658
|
+
} : commonProps;
|
|
659
|
+
const portalContainer = viewportTargetElement || viewportElement;
|
|
660
|
+
const hidden = keepMounted && !mounted;
|
|
661
|
+
const shouldRenderInline = keepMounted && !portalContainer && !hasMountedInPortal;
|
|
662
|
+
if (keepMounted && portalContainer && !hasMountedInPortal) {
|
|
663
|
+
setHasMountedInPortal(true);
|
|
664
|
+
}
|
|
665
|
+
if (shouldRenderInline) {
|
|
666
|
+
return /* @__PURE__ */ _jsx4(CompositeRoot, {
|
|
667
|
+
render,
|
|
668
|
+
className,
|
|
669
|
+
style,
|
|
670
|
+
state,
|
|
671
|
+
refs: [forwardedRef],
|
|
672
|
+
props: [defaultProps, {
|
|
673
|
+
hidden: true
|
|
674
|
+
}, elementProps],
|
|
675
|
+
stateAttributesMapping
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
if (!portalContainer || !mounted && !keepMounted) {
|
|
679
|
+
return null;
|
|
680
|
+
}
|
|
681
|
+
return /* @__PURE__ */ ReactDOM.createPortal(/* @__PURE__ */ _jsx4(FloatingNode, {
|
|
682
|
+
id: nodeId,
|
|
683
|
+
children: /* @__PURE__ */ _jsx4(CompositeRoot, {
|
|
684
|
+
render,
|
|
685
|
+
className,
|
|
686
|
+
style,
|
|
687
|
+
state,
|
|
688
|
+
refs: [forwardedRef, ref, handleCurrentContentRef],
|
|
689
|
+
props: [defaultProps, hidden ? {
|
|
690
|
+
hidden: true
|
|
691
|
+
} : EMPTY_OBJECT, elementProps],
|
|
692
|
+
stateAttributesMapping
|
|
693
|
+
})
|
|
694
|
+
}), portalContainer);
|
|
695
|
+
});
|
|
696
|
+
if (true)
|
|
697
|
+
NavigationMenuContent.displayName = "NavigationMenuContent";
|
|
698
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/trigger/NavigationMenuTrigger.js
|
|
699
|
+
import * as React8 from "react";
|
|
700
|
+
import * as ReactDOM2 from "react-dom";
|
|
701
|
+
|
|
702
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/utils/isOutsideMenuEvent.js
|
|
703
|
+
function isOutsideMenuEvent({
|
|
704
|
+
currentTarget,
|
|
705
|
+
relatedTarget
|
|
706
|
+
}, params) {
|
|
707
|
+
const {
|
|
708
|
+
popupElement,
|
|
709
|
+
viewportElement,
|
|
710
|
+
rootRef,
|
|
711
|
+
tree,
|
|
712
|
+
nodeId
|
|
713
|
+
} = params;
|
|
714
|
+
const nodeChildrenContains = tree ? getNodeChildren(tree.nodesRef.current, nodeId).some((node) => contains(node.context?.elements.floating, relatedTarget)) : [];
|
|
715
|
+
if (!popupElement) {
|
|
716
|
+
return !contains(rootRef.current, relatedTarget) && !nodeChildrenContains;
|
|
717
|
+
}
|
|
718
|
+
const floatingElement = popupElement || viewportElement;
|
|
719
|
+
return !contains(floatingElement, currentTarget) && !contains(floatingElement, relatedTarget) && !contains(rootRef.current, relatedTarget) && !nodeChildrenContains && !(contains(floatingElement, relatedTarget) && relatedTarget?.hasAttribute("data-base-ui-focus-guard"));
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/trigger/NavigationMenuTrigger.js
|
|
723
|
+
import { jsx as _jsx5, jsxs as _jsxs } from "react/jsx-runtime";
|
|
724
|
+
"use client";
|
|
725
|
+
var DEFAULT_SIZE = {
|
|
726
|
+
width: 0,
|
|
727
|
+
height: 0
|
|
728
|
+
};
|
|
729
|
+
var NavigationMenuTrigger = /* @__PURE__ */ React8.forwardRef(function NavigationMenuTrigger2(componentProps, forwardedRef) {
|
|
730
|
+
const {
|
|
731
|
+
className,
|
|
732
|
+
render,
|
|
733
|
+
nativeButton = true,
|
|
734
|
+
disabled,
|
|
735
|
+
style,
|
|
736
|
+
...elementProps
|
|
737
|
+
} = componentProps;
|
|
738
|
+
const {
|
|
739
|
+
value,
|
|
740
|
+
setValue,
|
|
741
|
+
mounted,
|
|
742
|
+
open,
|
|
743
|
+
positionerElement,
|
|
744
|
+
setActivationDirection,
|
|
745
|
+
setFloatingRootContext,
|
|
746
|
+
popupElement,
|
|
747
|
+
viewportElement,
|
|
748
|
+
transitionStatus,
|
|
749
|
+
rootRef,
|
|
750
|
+
beforeOutsideRef,
|
|
751
|
+
afterOutsideRef,
|
|
752
|
+
afterInsideRef,
|
|
753
|
+
beforeInsideRef,
|
|
754
|
+
prevTriggerElementRef,
|
|
755
|
+
popupAutoSizeResetRef,
|
|
756
|
+
currentContentRef,
|
|
757
|
+
delay,
|
|
758
|
+
closeDelay,
|
|
759
|
+
orientation,
|
|
760
|
+
setViewportInert,
|
|
761
|
+
nested
|
|
762
|
+
} = useNavigationMenuRootContext();
|
|
763
|
+
const {
|
|
764
|
+
value: itemValue
|
|
765
|
+
} = useNavigationMenuItemContext();
|
|
766
|
+
const nodeId = useNavigationMenuTreeContext();
|
|
767
|
+
const tree = useFloatingTree();
|
|
768
|
+
const dismissProps = useNavigationMenuDismissContext();
|
|
769
|
+
const stickIfOpenTimeout = useTimeout();
|
|
770
|
+
const focusFrame = useAnimationFrame();
|
|
771
|
+
const mutationFrame = useAnimationFrame();
|
|
772
|
+
const resizeFrame = useAnimationFrame();
|
|
773
|
+
const sizeFrame = useAnimationFrame();
|
|
774
|
+
const [triggerElement, setTriggerElement] = React8.useState(null);
|
|
775
|
+
const [stickIfOpen, setStickIfOpen] = React8.useState(true);
|
|
776
|
+
const [pointerType, setPointerType] = React8.useState("");
|
|
777
|
+
const triggerElementRef = React8.useRef(null);
|
|
778
|
+
const allowFocusRef = React8.useRef(false);
|
|
779
|
+
const prevSizeRef = React8.useRef(DEFAULT_SIZE);
|
|
780
|
+
const skipAutoSizeSyncRef = React8.useRef(false);
|
|
781
|
+
const isActiveItem = open && value === itemValue;
|
|
782
|
+
const isActiveItemRef = useValueAsRef(isActiveItem);
|
|
783
|
+
const interactionsEnabled = positionerElement ? true : !value;
|
|
784
|
+
const hoverFloatingElement = positionerElement || viewportElement;
|
|
785
|
+
const hoverInteractionsEnabled = hoverFloatingElement ? true : !value;
|
|
786
|
+
const runOnceAnimationsFinish = useAnimationsFinished(popupElement, false, false);
|
|
787
|
+
const handleTriggerElement = React8.useCallback((element) => {
|
|
788
|
+
triggerElementRef.current = element;
|
|
789
|
+
setTriggerElement(element);
|
|
790
|
+
}, []);
|
|
791
|
+
const cancelAutoSizeReset = useStableCallback((force = false) => {
|
|
792
|
+
if (!force && popupAutoSizeResetRef.current.owner !== itemValue) {
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
popupAutoSizeResetRef.current.abortController?.abort();
|
|
796
|
+
popupAutoSizeResetRef.current.abortController = null;
|
|
797
|
+
popupAutoSizeResetRef.current.owner = null;
|
|
798
|
+
});
|
|
799
|
+
useIsoLayoutEffect(() => {
|
|
800
|
+
if (isActiveItem) {
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
mutationFrame.cancel();
|
|
804
|
+
sizeFrame.cancel();
|
|
805
|
+
cancelAutoSizeReset();
|
|
806
|
+
}, [isActiveItem, mutationFrame, sizeFrame, cancelAutoSizeReset]);
|
|
807
|
+
function setAutoSizes() {
|
|
808
|
+
if (!popupElement) {
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
popupElement.style.setProperty(NavigationMenuPopupCssVars.popupWidth, "auto");
|
|
812
|
+
popupElement.style.setProperty(NavigationMenuPopupCssVars.popupHeight, "auto");
|
|
813
|
+
}
|
|
814
|
+
function clearFixedSizes() {
|
|
815
|
+
if (!popupElement || !positionerElement) {
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
popupElement.style.removeProperty(NavigationMenuPopupCssVars.popupWidth);
|
|
819
|
+
popupElement.style.removeProperty(NavigationMenuPopupCssVars.popupHeight);
|
|
820
|
+
positionerElement.style.removeProperty(NavigationMenuPositionerCssVars.positionerWidth);
|
|
821
|
+
positionerElement.style.removeProperty(NavigationMenuPositionerCssVars.positionerHeight);
|
|
822
|
+
}
|
|
823
|
+
function setSharedFixedSizes(width, height) {
|
|
824
|
+
if (!popupElement || !positionerElement) {
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
popupElement.style.setProperty(NavigationMenuPopupCssVars.popupWidth, `${width}px`);
|
|
828
|
+
popupElement.style.setProperty(NavigationMenuPopupCssVars.popupHeight, `${height}px`);
|
|
829
|
+
positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerWidth, `${width}px`);
|
|
830
|
+
positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerHeight, `${height}px`);
|
|
831
|
+
}
|
|
832
|
+
function scheduleAutoSizeReset() {
|
|
833
|
+
cancelAutoSizeReset(true);
|
|
834
|
+
const abortController = new AbortController;
|
|
835
|
+
popupAutoSizeResetRef.current.abortController = abortController;
|
|
836
|
+
popupAutoSizeResetRef.current.owner = itemValue;
|
|
837
|
+
runOnceAnimationsFinish(() => {
|
|
838
|
+
if (popupAutoSizeResetRef.current.abortController !== abortController || popupAutoSizeResetRef.current.owner !== itemValue) {
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
popupAutoSizeResetRef.current.abortController = null;
|
|
842
|
+
popupAutoSizeResetRef.current.owner = null;
|
|
843
|
+
setAutoSizes();
|
|
844
|
+
}, abortController.signal);
|
|
845
|
+
}
|
|
846
|
+
const handleValueChange = useStableCallback((currentWidth, currentHeight, options = {}) => {
|
|
847
|
+
if (!popupElement || !positionerElement) {
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
cancelAutoSizeReset(true);
|
|
851
|
+
const {
|
|
852
|
+
syncPositioner = false
|
|
853
|
+
} = options;
|
|
854
|
+
clearFixedSizes();
|
|
855
|
+
const {
|
|
856
|
+
width,
|
|
857
|
+
height
|
|
858
|
+
} = getCssDimensions(popupElement);
|
|
859
|
+
const measuredWidth = width || prevSizeRef.current.width;
|
|
860
|
+
const measuredHeight = height || prevSizeRef.current.height;
|
|
861
|
+
if (currentHeight === 0 || currentWidth === 0) {
|
|
862
|
+
currentWidth = measuredWidth;
|
|
863
|
+
currentHeight = measuredHeight;
|
|
864
|
+
}
|
|
865
|
+
popupElement.style.setProperty(NavigationMenuPopupCssVars.popupWidth, `${currentWidth}px`);
|
|
866
|
+
popupElement.style.setProperty(NavigationMenuPopupCssVars.popupHeight, `${currentHeight}px`);
|
|
867
|
+
positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerWidth, `${syncPositioner ? currentWidth : measuredWidth}px`);
|
|
868
|
+
positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerHeight, `${syncPositioner ? currentHeight : measuredHeight}px`);
|
|
869
|
+
sizeFrame.request(() => {
|
|
870
|
+
if (!isActiveItemRef.current) {
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
popupElement.style.setProperty(NavigationMenuPopupCssVars.popupWidth, `${measuredWidth}px`);
|
|
874
|
+
popupElement.style.setProperty(NavigationMenuPopupCssVars.popupHeight, `${measuredHeight}px`);
|
|
875
|
+
if (syncPositioner) {
|
|
876
|
+
positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerWidth, `${measuredWidth}px`);
|
|
877
|
+
positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerHeight, `${measuredHeight}px`);
|
|
878
|
+
}
|
|
879
|
+
scheduleAutoSizeReset();
|
|
880
|
+
});
|
|
881
|
+
});
|
|
882
|
+
const handleInterruptedMutationResize = useStableCallback((currentWidth, currentHeight) => {
|
|
883
|
+
if (!popupElement || !positionerElement) {
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
sizeFrame.cancel();
|
|
887
|
+
mutationFrame.cancel();
|
|
888
|
+
cancelAutoSizeReset(true);
|
|
889
|
+
if (currentWidth === 0 || currentHeight === 0) {
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
setSharedFixedSizes(currentWidth, currentHeight);
|
|
893
|
+
mutationFrame.request(() => {
|
|
894
|
+
mutationFrame.request(() => {
|
|
895
|
+
clearFixedSizes();
|
|
896
|
+
const {
|
|
897
|
+
width,
|
|
898
|
+
height
|
|
899
|
+
} = getCssDimensions(popupElement);
|
|
900
|
+
const measuredWidth = width || currentWidth || prevSizeRef.current.width;
|
|
901
|
+
const measuredHeight = height || currentHeight || prevSizeRef.current.height;
|
|
902
|
+
setSharedFixedSizes(currentWidth, currentHeight);
|
|
903
|
+
sizeFrame.request(() => {
|
|
904
|
+
if (!isActiveItemRef.current) {
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
setSharedFixedSizes(measuredWidth, measuredHeight);
|
|
908
|
+
scheduleAutoSizeReset();
|
|
909
|
+
});
|
|
910
|
+
});
|
|
911
|
+
});
|
|
912
|
+
});
|
|
913
|
+
const syncCurrentSize = useStableCallback(() => {
|
|
914
|
+
if (!popupElement || !positionerElement) {
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
sizeFrame.cancel();
|
|
918
|
+
cancelAutoSizeReset(true);
|
|
919
|
+
clearFixedSizes();
|
|
920
|
+
const {
|
|
921
|
+
width,
|
|
922
|
+
height
|
|
923
|
+
} = getCssDimensions(popupElement);
|
|
924
|
+
if (width === 0 || height === 0) {
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
prevSizeRef.current = {
|
|
928
|
+
width,
|
|
929
|
+
height
|
|
930
|
+
};
|
|
931
|
+
setAutoSizes();
|
|
932
|
+
positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerWidth, `${width}px`);
|
|
933
|
+
positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerHeight, `${height}px`);
|
|
934
|
+
});
|
|
935
|
+
const getMutationBaseline = useStableCallback(() => {
|
|
936
|
+
if (!popupElement) {
|
|
937
|
+
return {
|
|
938
|
+
size: prevSizeRef.current,
|
|
939
|
+
syncPositioner: false
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
const popupWidth = popupElement.style.getPropertyValue(NavigationMenuPopupCssVars.popupWidth);
|
|
943
|
+
const popupHeight = popupElement.style.getPropertyValue(NavigationMenuPopupCssVars.popupHeight);
|
|
944
|
+
const isResizing = popupWidth !== "" && popupWidth !== "auto" && popupHeight !== "" && popupHeight !== "auto";
|
|
945
|
+
if (!isResizing) {
|
|
946
|
+
return {
|
|
947
|
+
size: prevSizeRef.current,
|
|
948
|
+
syncPositioner: false
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
return {
|
|
952
|
+
size: {
|
|
953
|
+
width: popupElement.offsetWidth || prevSizeRef.current.width,
|
|
954
|
+
height: popupElement.offsetHeight || prevSizeRef.current.height
|
|
955
|
+
},
|
|
956
|
+
syncPositioner: true
|
|
957
|
+
};
|
|
958
|
+
});
|
|
959
|
+
React8.useEffect(() => {
|
|
960
|
+
if (!open) {
|
|
961
|
+
stickIfOpenTimeout.clear();
|
|
962
|
+
mutationFrame.cancel();
|
|
963
|
+
resizeFrame.cancel();
|
|
964
|
+
sizeFrame.cancel();
|
|
965
|
+
cancelAutoSizeReset(true);
|
|
966
|
+
skipAutoSizeSyncRef.current = false;
|
|
967
|
+
setPointerType("");
|
|
968
|
+
}
|
|
969
|
+
}, [stickIfOpenTimeout, open, mutationFrame, resizeFrame, sizeFrame, cancelAutoSizeReset]);
|
|
970
|
+
React8.useEffect(() => {
|
|
971
|
+
if (!mounted) {
|
|
972
|
+
prevSizeRef.current = DEFAULT_SIZE;
|
|
973
|
+
}
|
|
974
|
+
}, [mounted]);
|
|
975
|
+
React8.useEffect(() => {
|
|
976
|
+
if (!popupElement || typeof ResizeObserver !== "function") {
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
980
|
+
prevSizeRef.current = {
|
|
981
|
+
width: popupElement.offsetWidth,
|
|
982
|
+
height: popupElement.offsetHeight
|
|
983
|
+
};
|
|
984
|
+
});
|
|
985
|
+
resizeObserver.observe(popupElement);
|
|
986
|
+
return () => {
|
|
987
|
+
resizeObserver.disconnect();
|
|
988
|
+
};
|
|
989
|
+
}, [popupElement]);
|
|
990
|
+
React8.useEffect(() => {
|
|
991
|
+
if (!open || !isActiveItem || !popupElement || !positionerElement) {
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
const win = getWindow(positionerElement);
|
|
995
|
+
function handleResize() {
|
|
996
|
+
resizeFrame.cancel();
|
|
997
|
+
resizeFrame.request(syncCurrentSize);
|
|
998
|
+
}
|
|
999
|
+
const unsubscribe = addEventListener(win, "resize", handleResize);
|
|
1000
|
+
return () => {
|
|
1001
|
+
resizeFrame.cancel();
|
|
1002
|
+
unsubscribe();
|
|
1003
|
+
};
|
|
1004
|
+
}, [open, isActiveItem, popupElement, positionerElement, resizeFrame, syncCurrentSize]);
|
|
1005
|
+
React8.useEffect(() => {
|
|
1006
|
+
const observedElement = currentContentRef.current;
|
|
1007
|
+
if (!observedElement || !popupElement || !isActiveItem || typeof MutationObserver !== "function") {
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
const mutationObserver = new MutationObserver(() => {
|
|
1011
|
+
if (transitionStatus === "starting" || popupElement.hasAttribute(TransitionStatusDataAttributes.startingStyle)) {
|
|
1012
|
+
syncCurrentSize();
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
const {
|
|
1016
|
+
size,
|
|
1017
|
+
syncPositioner
|
|
1018
|
+
} = getMutationBaseline();
|
|
1019
|
+
if (syncPositioner) {
|
|
1020
|
+
handleInterruptedMutationResize(size.width, size.height);
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
handleValueChange(size.width, size.height);
|
|
1024
|
+
});
|
|
1025
|
+
mutationObserver.observe(observedElement, {
|
|
1026
|
+
childList: true,
|
|
1027
|
+
subtree: true,
|
|
1028
|
+
characterData: true
|
|
1029
|
+
});
|
|
1030
|
+
return () => {
|
|
1031
|
+
mutationObserver.disconnect();
|
|
1032
|
+
};
|
|
1033
|
+
}, [currentContentRef, popupElement, isActiveItem, transitionStatus, getMutationBaseline, handleInterruptedMutationResize, handleValueChange, syncCurrentSize]);
|
|
1034
|
+
React8.useEffect(() => {
|
|
1035
|
+
if (isActiveItem && open && popupElement && allowFocusRef.current) {
|
|
1036
|
+
allowFocusRef.current = false;
|
|
1037
|
+
focusFrame.request(() => {
|
|
1038
|
+
beforeOutsideRef.current?.focus();
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
return () => {
|
|
1042
|
+
focusFrame.cancel();
|
|
1043
|
+
};
|
|
1044
|
+
}, [beforeOutsideRef, focusFrame, isActiveItem, open, popupElement]);
|
|
1045
|
+
useIsoLayoutEffect(() => {
|
|
1046
|
+
if (isActiveItemRef.current && open && popupElement) {
|
|
1047
|
+
if (transitionStatus === "starting") {
|
|
1048
|
+
const hasNestedMenu = currentContentRef.current?.querySelector("[data-nested]") != null;
|
|
1049
|
+
if (hasNestedMenu) {
|
|
1050
|
+
sizeFrame.request(syncCurrentSize);
|
|
1051
|
+
return () => {
|
|
1052
|
+
sizeFrame.cancel();
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
if (skipAutoSizeSyncRef.current) {
|
|
1057
|
+
skipAutoSizeSyncRef.current = false;
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
const {
|
|
1061
|
+
width,
|
|
1062
|
+
height
|
|
1063
|
+
} = getCssDimensions(popupElement);
|
|
1064
|
+
handleValueChange(width, height);
|
|
1065
|
+
}
|
|
1066
|
+
return;
|
|
1067
|
+
}, [currentContentRef, handleValueChange, isActiveItemRef, open, popupElement, sizeFrame, syncCurrentSize, transitionStatus]);
|
|
1068
|
+
function handleOpenChange(nextOpen, eventDetails) {
|
|
1069
|
+
const isHover = eventDetails.reason === exports_reason_parts.triggerHover;
|
|
1070
|
+
if (!interactionsEnabled) {
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
if (pointerType === "touch" && isHover) {
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
if (!nextOpen && value !== itemValue) {
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
function changeState() {
|
|
1080
|
+
if (isHover) {
|
|
1081
|
+
setStickIfOpen(true);
|
|
1082
|
+
stickIfOpenTimeout.clear();
|
|
1083
|
+
stickIfOpenTimeout.start(PATIENT_CLICK_THRESHOLD, () => {
|
|
1084
|
+
setStickIfOpen(false);
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
if (nextOpen) {
|
|
1088
|
+
setValue(itemValue, eventDetails);
|
|
1089
|
+
} else {
|
|
1090
|
+
setValue(null, eventDetails);
|
|
1091
|
+
setPointerType("");
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
if (isHover) {
|
|
1095
|
+
ReactDOM2.flushSync(changeState);
|
|
1096
|
+
} else {
|
|
1097
|
+
changeState();
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
const context = useFloatingRootContext({
|
|
1101
|
+
open,
|
|
1102
|
+
onOpenChange: handleOpenChange,
|
|
1103
|
+
elements: {
|
|
1104
|
+
reference: triggerElement,
|
|
1105
|
+
floating: hoverFloatingElement
|
|
1106
|
+
}
|
|
1107
|
+
});
|
|
1108
|
+
const hoverInteractionState = useHoverInteractionSharedState(context);
|
|
1109
|
+
const shouldBlockSafePolygonPointerEvents = pointerType !== "touch";
|
|
1110
|
+
React8.useEffect(() => {
|
|
1111
|
+
if (!open) {
|
|
1112
|
+
context.context.dataRef.current.openEvent = undefined;
|
|
1113
|
+
hoverInteractionState.pointerType = undefined;
|
|
1114
|
+
hoverInteractionState.interactedInside = false;
|
|
1115
|
+
hoverInteractionState.restTimeoutPending = false;
|
|
1116
|
+
hoverInteractionState.openChangeTimeout.clear();
|
|
1117
|
+
hoverInteractionState.restTimeout.clear();
|
|
1118
|
+
clearSafePolygonPointerEventsMutation(hoverInteractionState);
|
|
1119
|
+
}
|
|
1120
|
+
}, [context, hoverInteractionState, open]);
|
|
1121
|
+
const getInlineHandleCloseContext = useStableCallback(() => {
|
|
1122
|
+
if (!nested || positionerElement || !triggerElementRef.current || !hoverFloatingElement) {
|
|
1123
|
+
return null;
|
|
1124
|
+
}
|
|
1125
|
+
return getHandleCloseContext(triggerElementRef.current, hoverFloatingElement, nodeId);
|
|
1126
|
+
});
|
|
1127
|
+
function getScope() {
|
|
1128
|
+
if (!nested || !positionerElement) {
|
|
1129
|
+
return triggerElementRef.current?.closest("ul") ?? null;
|
|
1130
|
+
}
|
|
1131
|
+
return null;
|
|
1132
|
+
}
|
|
1133
|
+
const hoverProps = useHoverReferenceInteraction(context, {
|
|
1134
|
+
enabled: hoverInteractionsEnabled,
|
|
1135
|
+
move: false,
|
|
1136
|
+
handleClose: safePolygon({
|
|
1137
|
+
blockPointerEvents: shouldBlockSafePolygonPointerEvents,
|
|
1138
|
+
getScope
|
|
1139
|
+
}),
|
|
1140
|
+
restMs: mounted && positionerElement ? 0 : delay,
|
|
1141
|
+
delay: {
|
|
1142
|
+
close: closeDelay
|
|
1143
|
+
},
|
|
1144
|
+
triggerElementRef,
|
|
1145
|
+
getHandleCloseContext: getInlineHandleCloseContext
|
|
1146
|
+
});
|
|
1147
|
+
const hover = React8.useMemo(() => hoverProps ? {
|
|
1148
|
+
reference: hoverProps
|
|
1149
|
+
} : undefined, [hoverProps]);
|
|
1150
|
+
const click = useClick(context, {
|
|
1151
|
+
enabled: interactionsEnabled,
|
|
1152
|
+
stickIfOpen,
|
|
1153
|
+
toggle: isActiveItem
|
|
1154
|
+
});
|
|
1155
|
+
const {
|
|
1156
|
+
getReferenceProps
|
|
1157
|
+
} = useInteractions([hover, click]);
|
|
1158
|
+
useIsoLayoutEffect(() => {
|
|
1159
|
+
if (isActiveItem) {
|
|
1160
|
+
setFloatingRootContext(context);
|
|
1161
|
+
prevTriggerElementRef.current = triggerElement;
|
|
1162
|
+
}
|
|
1163
|
+
}, [isActiveItem, context, setFloatingRootContext, prevTriggerElementRef, triggerElement]);
|
|
1164
|
+
function handleActivation(event) {
|
|
1165
|
+
ReactDOM2.flushSync(() => {
|
|
1166
|
+
const currentTarget = isHTMLElement(event.currentTarget) ? event.currentTarget : null;
|
|
1167
|
+
const prevTriggerRect = prevTriggerElementRef.current?.getBoundingClientRect();
|
|
1168
|
+
if (mounted && prevTriggerRect && triggerElement) {
|
|
1169
|
+
const nextTriggerRect = triggerElement.getBoundingClientRect();
|
|
1170
|
+
const isMovingRight = nextTriggerRect.left > prevTriggerRect.left;
|
|
1171
|
+
const isMovingDown = nextTriggerRect.top > prevTriggerRect.top;
|
|
1172
|
+
if (orientation === "horizontal" && nextTriggerRect.left !== prevTriggerRect.left) {
|
|
1173
|
+
setActivationDirection(isMovingRight ? "right" : "left");
|
|
1174
|
+
} else if (orientation === "vertical" && nextTriggerRect.top !== prevTriggerRect.top) {
|
|
1175
|
+
setActivationDirection(isMovingDown ? "down" : "up");
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
if (event.type !== "click" && value != null) {
|
|
1179
|
+
context.context.dataRef.current.openEvent = undefined;
|
|
1180
|
+
}
|
|
1181
|
+
if (pointerType === "touch" && event.type !== "click") {
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
if (value != null) {
|
|
1185
|
+
setValue(itemValue, createChangeEventDetails(event.type === "mouseenter" ? exports_reason_parts.triggerHover : exports_reason_parts.triggerPress, event.nativeEvent));
|
|
1186
|
+
}
|
|
1187
|
+
if (event.type === "mouseenter" && shouldBlockSafePolygonPointerEvents && (!nested || !positionerElement) && hoverFloatingElement && currentTarget) {
|
|
1188
|
+
const applyPointerEventsMutation = () => {
|
|
1189
|
+
const scopeElement = getScope() ?? currentTarget.ownerDocument.body;
|
|
1190
|
+
applySafePolygonPointerEventsMutation(hoverInteractionState, {
|
|
1191
|
+
scopeElement,
|
|
1192
|
+
referenceElement: currentTarget,
|
|
1193
|
+
floatingElement: hoverFloatingElement
|
|
1194
|
+
});
|
|
1195
|
+
};
|
|
1196
|
+
if (value != null && value !== itemValue) {
|
|
1197
|
+
queueMicrotask(applyPointerEventsMutation);
|
|
1198
|
+
} else {
|
|
1199
|
+
applyPointerEventsMutation();
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
const handleOpenEvent = useStableCallback((event) => {
|
|
1205
|
+
if (!popupElement || !positionerElement) {
|
|
1206
|
+
handleActivation(event);
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
const {
|
|
1210
|
+
width,
|
|
1211
|
+
height
|
|
1212
|
+
} = getCssDimensions(popupElement);
|
|
1213
|
+
const shouldSkipAutoSizeSync = value != null && value !== itemValue && (event.type === "click" || pointerType !== "touch");
|
|
1214
|
+
handleActivation(event);
|
|
1215
|
+
if (shouldSkipAutoSizeSync) {
|
|
1216
|
+
skipAutoSizeSyncRef.current = true;
|
|
1217
|
+
}
|
|
1218
|
+
handleValueChange(width, height);
|
|
1219
|
+
});
|
|
1220
|
+
const state = {
|
|
1221
|
+
open: isActiveItem
|
|
1222
|
+
};
|
|
1223
|
+
function handleSetPointerType(event) {
|
|
1224
|
+
setPointerType(event.pointerType);
|
|
1225
|
+
}
|
|
1226
|
+
function handleTriggerPointerDown(event) {
|
|
1227
|
+
handleSetPointerType(event);
|
|
1228
|
+
clearSafePolygonPointerEventsMutation(hoverInteractionState);
|
|
1229
|
+
}
|
|
1230
|
+
const defaultProps = {
|
|
1231
|
+
tabIndex: 0,
|
|
1232
|
+
onMouseEnter: handleOpenEvent,
|
|
1233
|
+
onClick: handleOpenEvent,
|
|
1234
|
+
onPointerEnter: handleSetPointerType,
|
|
1235
|
+
onPointerDown: handleTriggerPointerDown,
|
|
1236
|
+
"aria-expanded": isActiveItem,
|
|
1237
|
+
"aria-controls": isActiveItem ? popupElement?.id : undefined,
|
|
1238
|
+
[NAVIGATION_MENU_TRIGGER_IDENTIFIER]: "",
|
|
1239
|
+
onFocus() {
|
|
1240
|
+
if (!isActiveItem) {
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
setViewportInert(false);
|
|
1244
|
+
},
|
|
1245
|
+
onMouseMove() {
|
|
1246
|
+
allowFocusRef.current = false;
|
|
1247
|
+
},
|
|
1248
|
+
onKeyDown(event) {
|
|
1249
|
+
allowFocusRef.current = true;
|
|
1250
|
+
if (nested) {
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
const openHorizontal = orientation === "horizontal" && event.key === "ArrowDown";
|
|
1254
|
+
const openVertical = orientation === "vertical" && event.key === "ArrowRight";
|
|
1255
|
+
if (openHorizontal || openVertical) {
|
|
1256
|
+
setValue(itemValue, createChangeEventDetails(exports_reason_parts.listNavigation, event.nativeEvent));
|
|
1257
|
+
handleOpenEvent(event);
|
|
1258
|
+
stopEvent(event);
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
onBlur(event) {
|
|
1262
|
+
if (positionerElement && popupElement && isOutsideMenuEvent({
|
|
1263
|
+
currentTarget: event.currentTarget,
|
|
1264
|
+
relatedTarget: event.relatedTarget
|
|
1265
|
+
}, {
|
|
1266
|
+
popupElement,
|
|
1267
|
+
rootRef,
|
|
1268
|
+
tree,
|
|
1269
|
+
nodeId
|
|
1270
|
+
})) {
|
|
1271
|
+
setValue(null, createChangeEventDetails(exports_reason_parts.focusOut, event.nativeEvent));
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1275
|
+
const {
|
|
1276
|
+
getButtonProps,
|
|
1277
|
+
buttonRef
|
|
1278
|
+
} = useButton({
|
|
1279
|
+
disabled,
|
|
1280
|
+
focusableWhenDisabled: true,
|
|
1281
|
+
native: nativeButton
|
|
1282
|
+
});
|
|
1283
|
+
const referenceElement = hoverFloatingElement;
|
|
1284
|
+
return /* @__PURE__ */ _jsxs(React8.Fragment, {
|
|
1285
|
+
children: [/* @__PURE__ */ _jsx5(CompositeItem, {
|
|
1286
|
+
tag: "button",
|
|
1287
|
+
render,
|
|
1288
|
+
className,
|
|
1289
|
+
style,
|
|
1290
|
+
state,
|
|
1291
|
+
stateAttributesMapping: pressableTriggerOpenStateMapping,
|
|
1292
|
+
refs: [forwardedRef, handleTriggerElement, buttonRef],
|
|
1293
|
+
props: [getReferenceProps, dismissProps?.reference || EMPTY_ARRAY, defaultProps, elementProps, getButtonProps]
|
|
1294
|
+
}), isActiveItem && /* @__PURE__ */ _jsxs(React8.Fragment, {
|
|
1295
|
+
children: [/* @__PURE__ */ _jsx5(FocusGuard, {
|
|
1296
|
+
ref: beforeOutsideRef,
|
|
1297
|
+
onFocus: (event) => {
|
|
1298
|
+
if (referenceElement && isOutsideEvent(event, referenceElement)) {
|
|
1299
|
+
beforeInsideRef.current?.focus();
|
|
1300
|
+
} else {
|
|
1301
|
+
const prevTabbable = getPreviousTabbable(triggerElement);
|
|
1302
|
+
prevTabbable?.focus();
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
}), /* @__PURE__ */ _jsx5("span", {
|
|
1306
|
+
"aria-owns": viewportElement?.id,
|
|
1307
|
+
style: ownerVisuallyHidden
|
|
1308
|
+
}), /* @__PURE__ */ _jsx5(FocusGuard, {
|
|
1309
|
+
ref: afterOutsideRef,
|
|
1310
|
+
onFocus: (event) => {
|
|
1311
|
+
if (referenceElement && isOutsideEvent(event, referenceElement)) {
|
|
1312
|
+
ReactDOM2.flushSync(() => {
|
|
1313
|
+
setViewportInert(false);
|
|
1314
|
+
});
|
|
1315
|
+
const elementToFocus = afterInsideRef.current || triggerElement;
|
|
1316
|
+
elementToFocus?.focus();
|
|
1317
|
+
} else {
|
|
1318
|
+
let nextTabbable = getNextTabbable(triggerElement);
|
|
1319
|
+
if (nested && !positionerElement && referenceElement && nextTabbable && contains(referenceElement, nextTabbable)) {
|
|
1320
|
+
nextTabbable = getTabbableAfterElement(afterInsideRef.current);
|
|
1321
|
+
}
|
|
1322
|
+
nextTabbable?.focus();
|
|
1323
|
+
if ((!nested || positionerElement) && !contains(rootRef.current, nextTabbable)) {
|
|
1324
|
+
setValue(null, createChangeEventDetails(exports_reason_parts.focusOut, event.nativeEvent));
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
})]
|
|
1329
|
+
})]
|
|
1330
|
+
});
|
|
1331
|
+
});
|
|
1332
|
+
if (true)
|
|
1333
|
+
NavigationMenuTrigger.displayName = "NavigationMenuTrigger";
|
|
1334
|
+
function getPlacementFromElements(domReferenceElement, floatingElement) {
|
|
1335
|
+
const referenceRect = domReferenceElement.getBoundingClientRect();
|
|
1336
|
+
const floatingRect = floatingElement.getBoundingClientRect();
|
|
1337
|
+
const referenceCenterX = referenceRect.left + referenceRect.width / 2;
|
|
1338
|
+
const referenceCenterY = referenceRect.top + referenceRect.height / 2;
|
|
1339
|
+
const floatingCenterX = floatingRect.left + floatingRect.width / 2;
|
|
1340
|
+
const floatingCenterY = floatingRect.top + floatingRect.height / 2;
|
|
1341
|
+
const deltaX = floatingCenterX - referenceCenterX;
|
|
1342
|
+
const deltaY = floatingCenterY - referenceCenterY;
|
|
1343
|
+
if (Math.abs(deltaX) >= Math.abs(deltaY)) {
|
|
1344
|
+
return deltaX >= 0 ? "right" : "left";
|
|
1345
|
+
}
|
|
1346
|
+
return deltaY >= 0 ? "bottom" : "top";
|
|
1347
|
+
}
|
|
1348
|
+
function getHandleCloseContext(domReferenceElement, floatingElement, nodeId) {
|
|
1349
|
+
return {
|
|
1350
|
+
placement: getPlacementFromElements(domReferenceElement, floatingElement),
|
|
1351
|
+
elements: {
|
|
1352
|
+
domReference: domReferenceElement,
|
|
1353
|
+
floating: floatingElement
|
|
1354
|
+
},
|
|
1355
|
+
nodeId
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/portal/NavigationMenuPortal.js
|
|
1359
|
+
import * as React10 from "react";
|
|
1360
|
+
|
|
1361
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/portal/NavigationMenuPortalContext.js
|
|
1362
|
+
import * as React9 from "react";
|
|
1363
|
+
"use client";
|
|
1364
|
+
var NavigationMenuPortalContext = /* @__PURE__ */ React9.createContext(undefined);
|
|
1365
|
+
if (true)
|
|
1366
|
+
NavigationMenuPortalContext.displayName = "NavigationMenuPortalContext";
|
|
1367
|
+
function useNavigationMenuPortalContext() {
|
|
1368
|
+
const value = React9.useContext(NavigationMenuPortalContext);
|
|
1369
|
+
if (value === undefined) {
|
|
1370
|
+
throw new Error("Base UI: <NavigationMenu.Portal> is missing.");
|
|
1371
|
+
}
|
|
1372
|
+
return value;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/portal/NavigationMenuPortal.js
|
|
1376
|
+
import { jsx as _jsx6 } from "react/jsx-runtime";
|
|
1377
|
+
"use client";
|
|
1378
|
+
var NavigationMenuPortal = /* @__PURE__ */ React10.forwardRef(function NavigationMenuPortal2(props, forwardedRef) {
|
|
1379
|
+
const {
|
|
1380
|
+
keepMounted = false,
|
|
1381
|
+
...portalProps
|
|
1382
|
+
} = props;
|
|
1383
|
+
const {
|
|
1384
|
+
mounted
|
|
1385
|
+
} = useNavigationMenuRootContext();
|
|
1386
|
+
const shouldRender = mounted || keepMounted;
|
|
1387
|
+
if (!shouldRender) {
|
|
1388
|
+
return null;
|
|
1389
|
+
}
|
|
1390
|
+
return /* @__PURE__ */ _jsx6(NavigationMenuPortalContext.Provider, {
|
|
1391
|
+
value: keepMounted,
|
|
1392
|
+
children: /* @__PURE__ */ _jsx6(FloatingPortal, {
|
|
1393
|
+
ref: forwardedRef,
|
|
1394
|
+
...portalProps
|
|
1395
|
+
})
|
|
1396
|
+
});
|
|
1397
|
+
});
|
|
1398
|
+
if (true)
|
|
1399
|
+
NavigationMenuPortal.displayName = "NavigationMenuPortal";
|
|
1400
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/positioner/NavigationMenuPositioner.js
|
|
1401
|
+
import * as React12 from "react";
|
|
1402
|
+
import * as ReactDOM3 from "react-dom";
|
|
1403
|
+
|
|
1404
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/positioner/NavigationMenuPositionerContext.js
|
|
1405
|
+
import * as React11 from "react";
|
|
1406
|
+
"use client";
|
|
1407
|
+
var NavigationMenuPositionerContext = /* @__PURE__ */ React11.createContext(undefined);
|
|
1408
|
+
if (true)
|
|
1409
|
+
NavigationMenuPositionerContext.displayName = "NavigationMenuPositionerContext";
|
|
1410
|
+
function useNavigationMenuPositionerContext(optional = false) {
|
|
1411
|
+
const context = React11.useContext(NavigationMenuPositionerContext);
|
|
1412
|
+
if (!context && !optional) {
|
|
1413
|
+
throw new Error("Base UI: NavigationMenuPositionerContext is missing. NavigationMenuPositioner parts must be placed within <NavigationMenu.Positioner>.");
|
|
1414
|
+
}
|
|
1415
|
+
return context;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/positioner/NavigationMenuPositioner.js
|
|
1419
|
+
import { jsx as _jsx7 } from "react/jsx-runtime";
|
|
1420
|
+
"use client";
|
|
1421
|
+
var EMPTY_ROOT_CONTEXT = getEmptyRootContext();
|
|
1422
|
+
var NavigationMenuPositioner = /* @__PURE__ */ React12.forwardRef(function NavigationMenuPositioner2(componentProps, forwardedRef) {
|
|
1423
|
+
const {
|
|
1424
|
+
open,
|
|
1425
|
+
mounted,
|
|
1426
|
+
positionerElement,
|
|
1427
|
+
setPositionerElement,
|
|
1428
|
+
floatingRootContext,
|
|
1429
|
+
nested,
|
|
1430
|
+
transitionStatus
|
|
1431
|
+
} = useNavigationMenuRootContext();
|
|
1432
|
+
const {
|
|
1433
|
+
className,
|
|
1434
|
+
render,
|
|
1435
|
+
anchor,
|
|
1436
|
+
positionMethod = "absolute",
|
|
1437
|
+
side = "bottom",
|
|
1438
|
+
align = "center",
|
|
1439
|
+
sideOffset = 0,
|
|
1440
|
+
alignOffset = 0,
|
|
1441
|
+
collisionBoundary = "clipping-ancestors",
|
|
1442
|
+
collisionPadding = 5,
|
|
1443
|
+
collisionAvoidance = nested ? POPUP_COLLISION_AVOIDANCE : DROPDOWN_COLLISION_AVOIDANCE,
|
|
1444
|
+
arrowPadding = 5,
|
|
1445
|
+
sticky = false,
|
|
1446
|
+
disableAnchorTracking = false,
|
|
1447
|
+
style,
|
|
1448
|
+
...elementProps
|
|
1449
|
+
} = componentProps;
|
|
1450
|
+
const keepMounted = useNavigationMenuPortalContext();
|
|
1451
|
+
const nodeId = useNavigationMenuTreeContext();
|
|
1452
|
+
const resizeTimeout = useTimeout();
|
|
1453
|
+
const [instant, setInstant] = React12.useState(false);
|
|
1454
|
+
const positionerRef = React12.useRef(null);
|
|
1455
|
+
const prevTriggerElementRef = React12.useRef(null);
|
|
1456
|
+
React12.useEffect(() => {
|
|
1457
|
+
if (!positionerElement) {
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
function onFocus(event) {
|
|
1461
|
+
if (positionerElement && isOutsideEvent(event)) {
|
|
1462
|
+
const focusing = event.type === "focusin";
|
|
1463
|
+
const manageFocus = focusing ? enableFocusInside : disableFocusInside;
|
|
1464
|
+
manageFocus(positionerElement);
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
return mergeCleanups(addEventListener(positionerElement, "focusin", onFocus, true), addEventListener(positionerElement, "focusout", onFocus, true));
|
|
1468
|
+
}, [positionerElement]);
|
|
1469
|
+
const domReference = (floatingRootContext || EMPTY_ROOT_CONTEXT).useState("domReferenceElement");
|
|
1470
|
+
const positioning = useAnchorPositioning({
|
|
1471
|
+
anchor: anchor ?? domReference ?? prevTriggerElementRef,
|
|
1472
|
+
positionMethod,
|
|
1473
|
+
mounted,
|
|
1474
|
+
side,
|
|
1475
|
+
sideOffset,
|
|
1476
|
+
align,
|
|
1477
|
+
alignOffset,
|
|
1478
|
+
arrowPadding,
|
|
1479
|
+
collisionBoundary,
|
|
1480
|
+
collisionPadding,
|
|
1481
|
+
sticky,
|
|
1482
|
+
disableAnchorTracking,
|
|
1483
|
+
keepMounted,
|
|
1484
|
+
floatingRootContext,
|
|
1485
|
+
collisionAvoidance,
|
|
1486
|
+
nodeId,
|
|
1487
|
+
adaptiveOrigin
|
|
1488
|
+
});
|
|
1489
|
+
const state = {
|
|
1490
|
+
open,
|
|
1491
|
+
side: positioning.side,
|
|
1492
|
+
align: positioning.align,
|
|
1493
|
+
anchorHidden: positioning.anchorHidden,
|
|
1494
|
+
instant
|
|
1495
|
+
};
|
|
1496
|
+
React12.useEffect(() => {
|
|
1497
|
+
if (!open) {
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
function handleResize() {
|
|
1501
|
+
ReactDOM3.flushSync(() => {
|
|
1502
|
+
setInstant(true);
|
|
1503
|
+
});
|
|
1504
|
+
resizeTimeout.start(100, () => {
|
|
1505
|
+
setInstant(false);
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
const win = getWindow(positionerElement);
|
|
1509
|
+
return addEventListener(win, "resize", handleResize);
|
|
1510
|
+
}, [open, resizeTimeout, positionerElement]);
|
|
1511
|
+
const element = usePositioner(componentProps, state, {
|
|
1512
|
+
styles: positioning.positionerStyles,
|
|
1513
|
+
transitionStatus,
|
|
1514
|
+
props: elementProps,
|
|
1515
|
+
refs: [forwardedRef, setPositionerElement, positionerRef],
|
|
1516
|
+
hidden: !mounted,
|
|
1517
|
+
inert: !open
|
|
1518
|
+
});
|
|
1519
|
+
return /* @__PURE__ */ _jsx7(NavigationMenuPositionerContext.Provider, {
|
|
1520
|
+
value: positioning,
|
|
1521
|
+
children: element
|
|
1522
|
+
});
|
|
1523
|
+
});
|
|
1524
|
+
if (true)
|
|
1525
|
+
NavigationMenuPositioner.displayName = "NavigationMenuPositioner";
|
|
1526
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/viewport/NavigationMenuViewport.js
|
|
1527
|
+
import * as React13 from "react";
|
|
1528
|
+
import { jsx as _jsx8, jsxs as _jsxs2 } from "react/jsx-runtime";
|
|
1529
|
+
"use client";
|
|
1530
|
+
var EMPTY_ROOT_CONTEXT2 = getEmptyRootContext();
|
|
1531
|
+
function Guards({
|
|
1532
|
+
children
|
|
1533
|
+
}) {
|
|
1534
|
+
const {
|
|
1535
|
+
beforeInsideRef,
|
|
1536
|
+
beforeOutsideRef,
|
|
1537
|
+
afterInsideRef,
|
|
1538
|
+
afterOutsideRef,
|
|
1539
|
+
positionerElement,
|
|
1540
|
+
viewportElement,
|
|
1541
|
+
floatingRootContext
|
|
1542
|
+
} = useNavigationMenuRootContext();
|
|
1543
|
+
const hasPositioner = Boolean(useNavigationMenuPositionerContext(true));
|
|
1544
|
+
const referenceElement = positionerElement || viewportElement;
|
|
1545
|
+
if (!floatingRootContext && !hasPositioner) {
|
|
1546
|
+
return children;
|
|
1547
|
+
}
|
|
1548
|
+
return /* @__PURE__ */ _jsxs2(React13.Fragment, {
|
|
1549
|
+
children: [/* @__PURE__ */ _jsx8(FocusGuard, {
|
|
1550
|
+
ref: beforeInsideRef,
|
|
1551
|
+
onFocus: (event) => {
|
|
1552
|
+
if (referenceElement && isOutsideEvent(event, referenceElement)) {
|
|
1553
|
+
getNextTabbable(referenceElement)?.focus();
|
|
1554
|
+
} else {
|
|
1555
|
+
beforeOutsideRef.current?.focus();
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
}), children, /* @__PURE__ */ _jsx8(FocusGuard, {
|
|
1559
|
+
ref: afterInsideRef,
|
|
1560
|
+
onFocus: (event) => {
|
|
1561
|
+
if (referenceElement && isOutsideEvent(event, referenceElement)) {
|
|
1562
|
+
getPreviousTabbable(referenceElement)?.focus();
|
|
1563
|
+
} else {
|
|
1564
|
+
afterOutsideRef.current?.focus();
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
})]
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
var NavigationMenuViewport = /* @__PURE__ */ React13.forwardRef(function NavigationMenuViewport2(componentProps, forwardedRef) {
|
|
1571
|
+
const {
|
|
1572
|
+
className,
|
|
1573
|
+
render,
|
|
1574
|
+
children,
|
|
1575
|
+
id: idProp,
|
|
1576
|
+
style,
|
|
1577
|
+
...elementProps
|
|
1578
|
+
} = componentProps;
|
|
1579
|
+
const id = useId(idProp);
|
|
1580
|
+
const {
|
|
1581
|
+
setViewportElement,
|
|
1582
|
+
setViewportTargetElement,
|
|
1583
|
+
floatingRootContext,
|
|
1584
|
+
prevTriggerElementRef,
|
|
1585
|
+
viewportInert,
|
|
1586
|
+
setViewportInert
|
|
1587
|
+
} = useNavigationMenuRootContext();
|
|
1588
|
+
const positioning = useNavigationMenuPositionerContext(true);
|
|
1589
|
+
const hasPositioner = Boolean(positioning);
|
|
1590
|
+
const domReference = (floatingRootContext || EMPTY_ROOT_CONTEXT2).useState("domReferenceElement");
|
|
1591
|
+
useIsoLayoutEffect(() => {
|
|
1592
|
+
if (domReference) {
|
|
1593
|
+
prevTriggerElementRef.current = domReference;
|
|
1594
|
+
}
|
|
1595
|
+
}, [domReference, prevTriggerElementRef]);
|
|
1596
|
+
const element = useRenderElement("div", componentProps, {
|
|
1597
|
+
ref: [forwardedRef, setViewportElement],
|
|
1598
|
+
props: [{
|
|
1599
|
+
id,
|
|
1600
|
+
onBlur(event) {
|
|
1601
|
+
const relatedTarget = event.relatedTarget;
|
|
1602
|
+
const currentTarget = event.currentTarget;
|
|
1603
|
+
if (relatedTarget && !contains(currentTarget, relatedTarget) && relatedTarget !== domReference) {
|
|
1604
|
+
setViewportInert(true);
|
|
1605
|
+
}
|
|
1606
|
+
},
|
|
1607
|
+
...!hasPositioner && viewportInert && {
|
|
1608
|
+
inert: inertValue(true)
|
|
1609
|
+
},
|
|
1610
|
+
children: hasPositioner ? children : /* @__PURE__ */ _jsx8(Guards, {
|
|
1611
|
+
children: /* @__PURE__ */ _jsx8("div", {
|
|
1612
|
+
ref: setViewportTargetElement,
|
|
1613
|
+
children
|
|
1614
|
+
})
|
|
1615
|
+
})
|
|
1616
|
+
}, elementProps]
|
|
1617
|
+
});
|
|
1618
|
+
return hasPositioner ? /* @__PURE__ */ _jsx8(Guards, {
|
|
1619
|
+
children: element
|
|
1620
|
+
}) : element;
|
|
1621
|
+
});
|
|
1622
|
+
if (true)
|
|
1623
|
+
NavigationMenuViewport.displayName = "NavigationMenuViewport";
|
|
1624
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/backdrop/NavigationMenuBackdrop.js
|
|
1625
|
+
import * as React14 from "react";
|
|
1626
|
+
"use client";
|
|
1627
|
+
var stateAttributesMapping2 = {
|
|
1628
|
+
...popupStateMapping,
|
|
1629
|
+
...transitionStatusMapping
|
|
1630
|
+
};
|
|
1631
|
+
var NavigationMenuBackdrop = /* @__PURE__ */ React14.forwardRef(function NavigationMenuBackdrop2(componentProps, forwardedRef) {
|
|
1632
|
+
const {
|
|
1633
|
+
className,
|
|
1634
|
+
render,
|
|
1635
|
+
style,
|
|
1636
|
+
...elementProps
|
|
1637
|
+
} = componentProps;
|
|
1638
|
+
const {
|
|
1639
|
+
open,
|
|
1640
|
+
mounted,
|
|
1641
|
+
transitionStatus
|
|
1642
|
+
} = useNavigationMenuRootContext();
|
|
1643
|
+
const state = {
|
|
1644
|
+
open,
|
|
1645
|
+
transitionStatus
|
|
1646
|
+
};
|
|
1647
|
+
const element = useRenderElement("div", componentProps, {
|
|
1648
|
+
state,
|
|
1649
|
+
ref: forwardedRef,
|
|
1650
|
+
props: [{
|
|
1651
|
+
role: "presentation",
|
|
1652
|
+
hidden: !mounted,
|
|
1653
|
+
style: {
|
|
1654
|
+
userSelect: "none",
|
|
1655
|
+
WebkitUserSelect: "none"
|
|
1656
|
+
}
|
|
1657
|
+
}, elementProps],
|
|
1658
|
+
stateAttributesMapping: stateAttributesMapping2
|
|
1659
|
+
});
|
|
1660
|
+
return element;
|
|
1661
|
+
});
|
|
1662
|
+
if (true)
|
|
1663
|
+
NavigationMenuBackdrop.displayName = "NavigationMenuBackdrop";
|
|
1664
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/popup/NavigationMenuPopup.js
|
|
1665
|
+
import * as React15 from "react";
|
|
1666
|
+
"use client";
|
|
1667
|
+
var stateAttributesMapping3 = {
|
|
1668
|
+
...popupStateMapping,
|
|
1669
|
+
...transitionStatusMapping
|
|
1670
|
+
};
|
|
1671
|
+
var NavigationMenuPopup = /* @__PURE__ */ React15.forwardRef(function NavigationMenuPopup2(componentProps, forwardedRef) {
|
|
1672
|
+
const {
|
|
1673
|
+
className,
|
|
1674
|
+
render,
|
|
1675
|
+
id: idProp,
|
|
1676
|
+
style,
|
|
1677
|
+
...elementProps
|
|
1678
|
+
} = componentProps;
|
|
1679
|
+
const {
|
|
1680
|
+
open,
|
|
1681
|
+
transitionStatus,
|
|
1682
|
+
setPopupElement
|
|
1683
|
+
} = useNavigationMenuRootContext();
|
|
1684
|
+
const positioning = useNavigationMenuPositionerContext();
|
|
1685
|
+
const direction = useDirection();
|
|
1686
|
+
const id = useBaseUiId(idProp);
|
|
1687
|
+
const state = {
|
|
1688
|
+
open,
|
|
1689
|
+
transitionStatus,
|
|
1690
|
+
side: positioning.side,
|
|
1691
|
+
align: positioning.align,
|
|
1692
|
+
anchorHidden: positioning.anchorHidden
|
|
1693
|
+
};
|
|
1694
|
+
let isOriginSide = positioning.side === "top";
|
|
1695
|
+
let isPhysicalLeft = positioning.side === "left";
|
|
1696
|
+
if (direction === "rtl") {
|
|
1697
|
+
isOriginSide = isOriginSide || positioning.side === "inline-end";
|
|
1698
|
+
isPhysicalLeft = isPhysicalLeft || positioning.side === "inline-end";
|
|
1699
|
+
} else {
|
|
1700
|
+
isOriginSide = isOriginSide || positioning.side === "inline-start";
|
|
1701
|
+
isPhysicalLeft = isPhysicalLeft || positioning.side === "inline-start";
|
|
1702
|
+
}
|
|
1703
|
+
const element = useRenderElement("nav", componentProps, {
|
|
1704
|
+
state,
|
|
1705
|
+
ref: [forwardedRef, setPopupElement],
|
|
1706
|
+
props: [{
|
|
1707
|
+
id,
|
|
1708
|
+
tabIndex: -1,
|
|
1709
|
+
style: isOriginSide ? {
|
|
1710
|
+
position: "absolute",
|
|
1711
|
+
[positioning.side === "top" ? "bottom" : "top"]: "0",
|
|
1712
|
+
[isPhysicalLeft ? "right" : "left"]: "0"
|
|
1713
|
+
} : {}
|
|
1714
|
+
}, elementProps],
|
|
1715
|
+
stateAttributesMapping: stateAttributesMapping3
|
|
1716
|
+
});
|
|
1717
|
+
return element;
|
|
1718
|
+
});
|
|
1719
|
+
if (true)
|
|
1720
|
+
NavigationMenuPopup.displayName = "NavigationMenuPopup";
|
|
1721
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/arrow/NavigationMenuArrow.js
|
|
1722
|
+
import * as React16 from "react";
|
|
1723
|
+
"use client";
|
|
1724
|
+
var NavigationMenuArrow = /* @__PURE__ */ React16.forwardRef(function NavigationMenuArrow2(componentProps, forwardedRef) {
|
|
1725
|
+
const {
|
|
1726
|
+
className,
|
|
1727
|
+
render,
|
|
1728
|
+
style,
|
|
1729
|
+
...elementProps
|
|
1730
|
+
} = componentProps;
|
|
1731
|
+
const {
|
|
1732
|
+
open
|
|
1733
|
+
} = useNavigationMenuRootContext();
|
|
1734
|
+
const {
|
|
1735
|
+
arrowRef,
|
|
1736
|
+
side,
|
|
1737
|
+
align,
|
|
1738
|
+
arrowUncentered,
|
|
1739
|
+
arrowStyles
|
|
1740
|
+
} = useNavigationMenuPositionerContext();
|
|
1741
|
+
const state = {
|
|
1742
|
+
open,
|
|
1743
|
+
side,
|
|
1744
|
+
align,
|
|
1745
|
+
uncentered: arrowUncentered
|
|
1746
|
+
};
|
|
1747
|
+
const element = useRenderElement("div", componentProps, {
|
|
1748
|
+
state,
|
|
1749
|
+
ref: [forwardedRef, arrowRef],
|
|
1750
|
+
props: [{
|
|
1751
|
+
style: arrowStyles,
|
|
1752
|
+
"aria-hidden": true
|
|
1753
|
+
}, elementProps],
|
|
1754
|
+
stateAttributesMapping: popupStateMapping
|
|
1755
|
+
});
|
|
1756
|
+
return element;
|
|
1757
|
+
});
|
|
1758
|
+
if (true)
|
|
1759
|
+
NavigationMenuArrow.displayName = "NavigationMenuArrow";
|
|
1760
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/link/NavigationMenuLink.js
|
|
1761
|
+
import * as React17 from "react";
|
|
1762
|
+
import { jsx as _jsx9 } from "react/jsx-runtime";
|
|
1763
|
+
"use client";
|
|
1764
|
+
var NavigationMenuLink = /* @__PURE__ */ React17.forwardRef(function NavigationMenuLink2(componentProps, forwardedRef) {
|
|
1765
|
+
const {
|
|
1766
|
+
className,
|
|
1767
|
+
render,
|
|
1768
|
+
active = false,
|
|
1769
|
+
closeOnClick = false,
|
|
1770
|
+
style,
|
|
1771
|
+
...elementProps
|
|
1772
|
+
} = componentProps;
|
|
1773
|
+
const {
|
|
1774
|
+
setValue,
|
|
1775
|
+
popupElement,
|
|
1776
|
+
positionerElement,
|
|
1777
|
+
rootRef
|
|
1778
|
+
} = useNavigationMenuRootContext();
|
|
1779
|
+
const nodeId = useNavigationMenuTreeContext();
|
|
1780
|
+
const tree = useFloatingTree();
|
|
1781
|
+
const state = {
|
|
1782
|
+
active
|
|
1783
|
+
};
|
|
1784
|
+
const defaultProps = {
|
|
1785
|
+
"aria-current": active ? "page" : undefined,
|
|
1786
|
+
tabIndex: undefined,
|
|
1787
|
+
onClick(event) {
|
|
1788
|
+
if (closeOnClick) {
|
|
1789
|
+
setValue(null, createChangeEventDetails(exports_reason_parts.linkPress, event.nativeEvent));
|
|
1790
|
+
}
|
|
1791
|
+
},
|
|
1792
|
+
onBlur(event) {
|
|
1793
|
+
if (positionerElement && popupElement && isOutsideMenuEvent({
|
|
1794
|
+
currentTarget: event.currentTarget,
|
|
1795
|
+
relatedTarget: event.relatedTarget
|
|
1796
|
+
}, {
|
|
1797
|
+
popupElement,
|
|
1798
|
+
rootRef,
|
|
1799
|
+
tree,
|
|
1800
|
+
nodeId
|
|
1801
|
+
})) {
|
|
1802
|
+
setValue(null, createChangeEventDetails(exports_reason_parts.focusOut, event.nativeEvent));
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
};
|
|
1806
|
+
return /* @__PURE__ */ _jsx9(CompositeItem, {
|
|
1807
|
+
tag: "a",
|
|
1808
|
+
render,
|
|
1809
|
+
className,
|
|
1810
|
+
style,
|
|
1811
|
+
state,
|
|
1812
|
+
refs: [forwardedRef],
|
|
1813
|
+
props: [defaultProps, elementProps]
|
|
1814
|
+
});
|
|
1815
|
+
});
|
|
1816
|
+
if (true)
|
|
1817
|
+
NavigationMenuLink.displayName = "NavigationMenuLink";
|
|
1818
|
+
// node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/navigation-menu/icon/NavigationMenuIcon.js
|
|
1819
|
+
import * as React18 from "react";
|
|
1820
|
+
"use client";
|
|
1821
|
+
var NavigationMenuIcon = /* @__PURE__ */ React18.forwardRef(function NavigationMenuIcon2(componentProps, forwardedRef) {
|
|
1822
|
+
const {
|
|
1823
|
+
className,
|
|
1824
|
+
render,
|
|
1825
|
+
style,
|
|
1826
|
+
...elementProps
|
|
1827
|
+
} = componentProps;
|
|
1828
|
+
const {
|
|
1829
|
+
value: itemValue
|
|
1830
|
+
} = useNavigationMenuItemContext();
|
|
1831
|
+
const {
|
|
1832
|
+
open,
|
|
1833
|
+
value
|
|
1834
|
+
} = useNavigationMenuRootContext();
|
|
1835
|
+
const isActiveItem = open && value === itemValue;
|
|
1836
|
+
const state = {
|
|
1837
|
+
open: isActiveItem
|
|
1838
|
+
};
|
|
1839
|
+
const element = useRenderElement("span", componentProps, {
|
|
1840
|
+
state,
|
|
1841
|
+
ref: forwardedRef,
|
|
1842
|
+
props: [{
|
|
1843
|
+
"aria-hidden": true,
|
|
1844
|
+
children: "▼"
|
|
1845
|
+
}, elementProps],
|
|
1846
|
+
stateAttributesMapping: triggerOpenStateMapping
|
|
1847
|
+
});
|
|
1848
|
+
return element;
|
|
1849
|
+
});
|
|
1850
|
+
if (true)
|
|
1851
|
+
NavigationMenuIcon.displayName = "NavigationMenuIcon";
|
|
1852
|
+
export {
|
|
1853
|
+
exports_index_parts as NavigationMenu
|
|
1854
|
+
};
|