@bccampus/ui-components 0.4.2 → 0.5.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/dist/_chunks/CompositeDataItem.js +204 -0
- package/dist/_chunks/createLucideIcon.js +103 -0
- package/dist/_chunks/index.js +125 -0
- package/dist/_chunks/index2.js +44 -0
- package/dist/_chunks/index3.js +533 -0
- package/dist/{utils-CRiPKpXj.js → _chunks/utils.js} +754 -526
- package/dist/components/index.d.ts +16 -0
- package/dist/components/index.js +84 -0
- package/dist/components/ui/banner.d.ts +10 -0
- package/dist/components/ui/banner.js +45 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/{button.js → components/ui/button.js} +11 -10
- package/dist/components/ui/card.d.ts +27 -0
- package/dist/components/ui/card.js +109 -0
- package/dist/components/ui/composite/CompositeData.d.ts +20 -0
- package/dist/components/ui/composite/CompositeData.js +89 -0
- package/dist/components/ui/composite/CompositeDataItem.d.ts +28 -0
- package/dist/components/ui/composite/CompositeDataItem.js +5 -0
- package/dist/components/ui/composite/FocusProvider/AbstractFocusProvider.d.ts +41 -0
- package/dist/components/ui/composite/FocusProvider/AbstractFocusProvider.js +35 -0
- package/dist/components/ui/composite/FocusProvider/ListboxFocusProvider.d.ts +16 -0
- package/dist/components/ui/composite/FocusProvider/ListboxFocusProvider.js +67 -0
- package/dist/components/ui/composite/FocusProvider/index.d.ts +2 -0
- package/dist/components/ui/composite/FocusProvider/index.js +6 -0
- package/dist/components/ui/composite/SelectionProvider/AbstractSelectionProvider.d.ts +23 -0
- package/dist/components/ui/composite/SelectionProvider/AbstractSelectionProvider.js +20 -0
- package/dist/components/ui/composite/SelectionProvider/MultipleSelectionProvider.d.ts +9 -0
- package/dist/components/ui/composite/SelectionProvider/MultipleSelectionProvider.js +20 -0
- package/dist/components/ui/composite/SelectionProvider/SingleSelectionProvider.d.ts +9 -0
- package/dist/components/ui/composite/SelectionProvider/SingleSelectionProvider.js +25 -0
- package/dist/components/ui/composite/SelectionProvider/index.d.ts +3 -0
- package/dist/components/ui/composite/SelectionProvider/index.js +8 -0
- package/dist/components/ui/composite/composite-component-item.d.ts +2 -0
- package/dist/components/ui/composite/composite-component-item.js +74 -0
- package/dist/components/ui/composite/composite-component.d.ts +2 -0
- package/dist/components/ui/composite/composite-component.js +66 -0
- package/dist/components/ui/composite/index.d.ts +7 -0
- package/dist/components/ui/composite/index.js +22 -0
- package/dist/components/ui/composite/listbox.d.ts +2 -0
- package/dist/components/ui/composite/listbox.js +58 -0
- package/dist/components/ui/composite/types.d.ts +82 -0
- package/dist/components/ui/composite/types.js +1 -0
- package/dist/components/ui/horizontal-list.d.ts +10 -0
- package/dist/components/ui/horizontal-list.js +82 -0
- package/dist/components/ui/icon-generator/generate-tiles.d.ts +4 -0
- package/dist/components/ui/icon-generator/generate-tiles.js +223 -0
- package/dist/components/ui/icon-generator/icon-generator.d.ts +3 -0
- package/dist/components/ui/icon-generator/icon-generator.js +82 -0
- package/dist/components/ui/icon-generator/index.d.ts +4 -0
- package/dist/components/ui/icon-generator/index.js +11 -0
- package/dist/components/ui/icon-generator/masked-image-generator.d.ts +3 -0
- package/dist/components/ui/icon-generator/masked-image-generator.js +31 -0
- package/dist/{masked-image-generator.d.ts → components/ui/icon-generator/types.d.ts} +48 -58
- package/dist/components/ui/icon-generator/types.js +30 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/{input.js → components/ui/input.js} +8 -8
- package/dist/components/ui/navigation-menu.d.ts +16 -0
- package/dist/components/ui/navigation-menu.js +1041 -0
- package/dist/components/ui/overlay.d.ts +7 -0
- package/dist/{overlay.js → components/ui/overlay.js} +7 -7
- package/dist/components/ui/page-header.d.ts +5 -0
- package/dist/{page-header.js → components/ui/page-header.js} +189 -181
- package/dist/components/ui/page-section.d.ts +8 -0
- package/dist/{page-section.js → components/ui/page-section.js} +7 -7
- package/dist/components/ui/page.d.ts +3 -0
- package/dist/components/ui/page.js +8 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/popover.js +3532 -0
- package/dist/components/ui/search-input.d.ts +3 -0
- package/dist/components/ui/search-input.js +24 -0
- package/dist/components/ui/tag.d.ts +10 -0
- package/dist/{tag.js → components/ui/tag.js} +10 -9
- package/dist/components/ui/typography/caption.d.ts +8 -0
- package/dist/components/ui/typography/caption.js +28 -0
- package/dist/components/ui/typography/index.d.ts +1 -0
- package/dist/components/ui/typography/index.js +5 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/use-effect-after-mount.d.ts +2 -0
- package/dist/hooks/use-effect-after-mount.js +24 -0
- package/dist/hooks/use-id.d.ts +1 -0
- package/dist/hooks/use-id.js +7 -0
- package/dist/hooks/use-keyboard-event.d.ts +59 -0
- package/dist/hooks/use-keyboard-event.js +52 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +16 -0
- package/dist/lib/object.d.ts +5 -0
- package/dist/lib/object.js +38 -0
- package/dist/lib/set-operations.d.ts +5 -0
- package/dist/lib/set-operations.js +51 -0
- package/dist/{utils.d.ts → lib/utils.d.ts} +2 -5
- package/dist/lib/utils.js +4 -0
- package/package.json +9 -76
- package/src/components/index.ts +17 -0
- package/src/components/ui/composite/FocusProvider/index.ts +2 -0
- package/src/components/ui/composite/SelectionProvider/MultipleSelectionProvider.ts +1 -1
- package/src/components/ui/composite/SelectionProvider/index.ts +3 -0
- package/src/components/ui/composite/index.ts +5 -5
- package/src/components/ui/icon-generator/index.ts +2 -0
- package/src/components/ui/typography/index.ts +1 -0
- package/src/hooks/index.ts +3 -0
- package/src/index.ts +3 -0
- package/src/lib/index.ts +3 -0
- package/tsconfig.lib.json +44 -0
- package/vite.config.ts +28 -31
- package/dist/AbstractFocusProvider-CxvlcEki.js +0 -29
- package/dist/AbstractSelectionProvider-BtaROstC.js +0 -30
- package/dist/CompositeDataItem-DuHOHCWy.js +0 -158
- package/dist/ListboxFocusProvider.d.ts +0 -149
- package/dist/ListboxFocusProvider.js +0 -53
- package/dist/MultipleSelectionProvider.d.ts +0 -141
- package/dist/MultipleSelectionProvider.js +0 -19
- package/dist/SingleSelectionProvider.d.ts +0 -141
- package/dist/SingleSelectionProvider.js +0 -23
- package/dist/banner.d.ts +0 -16
- package/dist/banner.js +0 -42
- package/dist/button.d.ts +0 -17
- package/dist/caption.d.ts +0 -13
- package/dist/caption.js +0 -27
- package/dist/card.d.ts +0 -46
- package/dist/card.js +0 -108
- package/dist/composite-component-DSUbd1XS.js +0 -122
- package/dist/composite.d.ts +0 -208
- package/dist/composite.js +0 -82
- package/dist/createLucideIcon-CzehbSja.js +0 -94
- package/dist/generate-tiles-DuagGD1d.js +0 -244
- package/dist/generate-tiles.d.ts +0 -43
- package/dist/generate-tiles.js +0 -7
- package/dist/horizontal-list.d.ts +0 -16
- package/dist/horizontal-list.js +0 -77
- package/dist/icon-generator-tuhuqdpL.js +0 -76
- package/dist/icon-generator.d.ts +0 -58
- package/dist/icon-generator.js +0 -6
- package/dist/index-CQhYMnjT.js +0 -34
- package/dist/index-U7DVCmS_.js +0 -76
- package/dist/input.d.ts +0 -7
- package/dist/listbox.d.ts +0 -171
- package/dist/listbox.js +0 -76
- package/dist/masked-image-generator.js +0 -29
- package/dist/navigation-menu.d.ts +0 -27
- package/dist/navigation-menu.js +0 -1139
- package/dist/overlay.d.ts +0 -13
- package/dist/page-header.d.ts +0 -9
- package/dist/page-section.d.ts +0 -14
- package/dist/page.d.ts +0 -7
- package/dist/page.js +0 -8
- package/dist/search-input.d.ts +0 -7
- package/dist/search-input.js +0 -23
- package/dist/tag.d.ts +0 -16
- package/dist/ui-components.d.ts +0 -215
- package/dist/ui-components.js +0 -54
- package/dist/utils.js +0 -4
- package/src/assets/icons/icon_01.svg +0 -6
- package/src/assets/icons/icon_02.svg +0 -6
- package/src/assets/icons/icon_03.svg +0 -6
- package/src/assets/icons/icon_04.svg +0 -6
- package/src/assets/icons/icon_05.svg +0 -4
- package/src/assets/icons/icon_06.svg +0 -4
- package/src/assets/images/image_01.jpg +0 -0
- package/src/assets/images/image_02.jpg +0 -0
- package/src/assets/images/image_03.webp +0 -0
- package/src/assets/images/image_04.png +0 -0
- package/src/assets/images/image_05.jpg +0 -0
- package/src/assets/images/image_06.jpg +0 -0
- package/src/components/ui/index.ts +0 -15
|
@@ -0,0 +1,1041 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import React__default from "react";
|
|
4
|
+
import ReactDOM__default from "react-dom";
|
|
5
|
+
import { c as createContextScope, P as Primitive, u as useControllableState, a as useId, b as Presence, d as composeEventHandlers, e as useCallbackRef, D as DismissableLayer, f as useLayoutEffect2, g as dispatchDiscreteCustomEvent } from "../../_chunks/index3.js";
|
|
6
|
+
import { u as useComposedRefs, c as createSlot, a as composeRefs } from "../../_chunks/index.js";
|
|
7
|
+
import { c as cn } from "../../_chunks/utils.js";
|
|
8
|
+
import { buttonVariants } from "./button.js";
|
|
9
|
+
import { c as createLucideIcon } from "../../_chunks/createLucideIcon.js";
|
|
10
|
+
/**
|
|
11
|
+
* @license lucide-react v0.544.0 - ISC
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the ISC license.
|
|
14
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
const __iconNode = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
17
|
+
const ChevronDown = createLucideIcon("chevron-down", __iconNode);
|
|
18
|
+
var DirectionContext = React.createContext(void 0);
|
|
19
|
+
function useDirection(localDir) {
|
|
20
|
+
const globalDir = React.useContext(DirectionContext);
|
|
21
|
+
return localDir || globalDir || "ltr";
|
|
22
|
+
}
|
|
23
|
+
function createCollection(name) {
|
|
24
|
+
const PROVIDER_NAME = name + "CollectionProvider";
|
|
25
|
+
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME);
|
|
26
|
+
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
27
|
+
PROVIDER_NAME,
|
|
28
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
29
|
+
);
|
|
30
|
+
const CollectionProvider = (props) => {
|
|
31
|
+
const { scope, children } = props;
|
|
32
|
+
const ref = React__default.useRef(null);
|
|
33
|
+
const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
|
|
34
|
+
return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
35
|
+
};
|
|
36
|
+
CollectionProvider.displayName = PROVIDER_NAME;
|
|
37
|
+
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
38
|
+
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
39
|
+
const CollectionSlot = React__default.forwardRef(
|
|
40
|
+
(props, forwardedRef) => {
|
|
41
|
+
const { scope, children } = props;
|
|
42
|
+
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
43
|
+
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
44
|
+
return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
48
|
+
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
49
|
+
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
50
|
+
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
|
51
|
+
const CollectionItemSlot = React__default.forwardRef(
|
|
52
|
+
(props, forwardedRef) => {
|
|
53
|
+
const { scope, children, ...itemData } = props;
|
|
54
|
+
const ref = React__default.useRef(null);
|
|
55
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
56
|
+
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
57
|
+
React__default.useEffect(() => {
|
|
58
|
+
context.itemMap.set(ref, { ref, ...itemData });
|
|
59
|
+
return () => void context.itemMap.delete(ref);
|
|
60
|
+
});
|
|
61
|
+
return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
65
|
+
function useCollection2(scope) {
|
|
66
|
+
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
67
|
+
const getItems = React__default.useCallback(() => {
|
|
68
|
+
const collectionNode = context.collectionRef.current;
|
|
69
|
+
if (!collectionNode) return [];
|
|
70
|
+
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
71
|
+
const items = Array.from(context.itemMap.values());
|
|
72
|
+
const orderedItems = items.sort(
|
|
73
|
+
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
74
|
+
);
|
|
75
|
+
return orderedItems;
|
|
76
|
+
}, [context.collectionRef, context.itemMap]);
|
|
77
|
+
return getItems;
|
|
78
|
+
}
|
|
79
|
+
return [
|
|
80
|
+
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
81
|
+
useCollection2,
|
|
82
|
+
createCollectionScope2
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
function usePrevious(value) {
|
|
86
|
+
const ref = React.useRef({ value, previous: value });
|
|
87
|
+
return React.useMemo(() => {
|
|
88
|
+
if (ref.current.value !== value) {
|
|
89
|
+
ref.current.previous = ref.current.value;
|
|
90
|
+
ref.current.value = value;
|
|
91
|
+
}
|
|
92
|
+
return ref.current.previous;
|
|
93
|
+
}, [value]);
|
|
94
|
+
}
|
|
95
|
+
var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
96
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
97
|
+
position: "absolute",
|
|
98
|
+
border: 0,
|
|
99
|
+
width: 1,
|
|
100
|
+
height: 1,
|
|
101
|
+
padding: 0,
|
|
102
|
+
margin: -1,
|
|
103
|
+
overflow: "hidden",
|
|
104
|
+
clip: "rect(0, 0, 0, 0)",
|
|
105
|
+
whiteSpace: "nowrap",
|
|
106
|
+
wordWrap: "normal"
|
|
107
|
+
});
|
|
108
|
+
var NAME = "VisuallyHidden";
|
|
109
|
+
var VisuallyHidden = React.forwardRef(
|
|
110
|
+
(props, forwardedRef) => {
|
|
111
|
+
return /* @__PURE__ */ jsx(
|
|
112
|
+
Primitive.span,
|
|
113
|
+
{
|
|
114
|
+
...props,
|
|
115
|
+
ref: forwardedRef,
|
|
116
|
+
style: { ...VISUALLY_HIDDEN_STYLES, ...props.style }
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
VisuallyHidden.displayName = NAME;
|
|
122
|
+
var Root = VisuallyHidden;
|
|
123
|
+
var NAVIGATION_MENU_NAME = "NavigationMenu";
|
|
124
|
+
var [Collection, useCollection, createCollectionScope] = createCollection(NAVIGATION_MENU_NAME);
|
|
125
|
+
var [FocusGroupCollection, useFocusGroupCollection, createFocusGroupCollectionScope] = createCollection(NAVIGATION_MENU_NAME);
|
|
126
|
+
var [createNavigationMenuContext] = createContextScope(
|
|
127
|
+
NAVIGATION_MENU_NAME,
|
|
128
|
+
[createCollectionScope, createFocusGroupCollectionScope]
|
|
129
|
+
);
|
|
130
|
+
var [NavigationMenuProviderImpl, useNavigationMenuContext] = createNavigationMenuContext(NAVIGATION_MENU_NAME);
|
|
131
|
+
var [ViewportContentProvider, useViewportContentContext] = createNavigationMenuContext(NAVIGATION_MENU_NAME);
|
|
132
|
+
var NavigationMenu$1 = React.forwardRef(
|
|
133
|
+
(props, forwardedRef) => {
|
|
134
|
+
const {
|
|
135
|
+
__scopeNavigationMenu,
|
|
136
|
+
value: valueProp,
|
|
137
|
+
onValueChange,
|
|
138
|
+
defaultValue,
|
|
139
|
+
delayDuration = 200,
|
|
140
|
+
skipDelayDuration = 300,
|
|
141
|
+
orientation = "horizontal",
|
|
142
|
+
dir,
|
|
143
|
+
...NavigationMenuProps
|
|
144
|
+
} = props;
|
|
145
|
+
const [navigationMenu, setNavigationMenu] = React.useState(null);
|
|
146
|
+
const composedRef = useComposedRefs(forwardedRef, (node) => setNavigationMenu(node));
|
|
147
|
+
const direction = useDirection(dir);
|
|
148
|
+
const openTimerRef = React.useRef(0);
|
|
149
|
+
const closeTimerRef = React.useRef(0);
|
|
150
|
+
const skipDelayTimerRef = React.useRef(0);
|
|
151
|
+
const [isOpenDelayed, setIsOpenDelayed] = React.useState(true);
|
|
152
|
+
const [value, setValue] = useControllableState({
|
|
153
|
+
prop: valueProp,
|
|
154
|
+
onChange: (value2) => {
|
|
155
|
+
const isOpen = value2 !== "";
|
|
156
|
+
const hasSkipDelayDuration = skipDelayDuration > 0;
|
|
157
|
+
if (isOpen) {
|
|
158
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
159
|
+
if (hasSkipDelayDuration) setIsOpenDelayed(false);
|
|
160
|
+
} else {
|
|
161
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
162
|
+
skipDelayTimerRef.current = window.setTimeout(
|
|
163
|
+
() => setIsOpenDelayed(true),
|
|
164
|
+
skipDelayDuration
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
onValueChange?.(value2);
|
|
168
|
+
},
|
|
169
|
+
defaultProp: defaultValue ?? "",
|
|
170
|
+
caller: NAVIGATION_MENU_NAME
|
|
171
|
+
});
|
|
172
|
+
const startCloseTimer = React.useCallback(() => {
|
|
173
|
+
window.clearTimeout(closeTimerRef.current);
|
|
174
|
+
closeTimerRef.current = window.setTimeout(() => setValue(""), 150);
|
|
175
|
+
}, [setValue]);
|
|
176
|
+
const handleOpen = React.useCallback(
|
|
177
|
+
(itemValue) => {
|
|
178
|
+
window.clearTimeout(closeTimerRef.current);
|
|
179
|
+
setValue(itemValue);
|
|
180
|
+
},
|
|
181
|
+
[setValue]
|
|
182
|
+
);
|
|
183
|
+
const handleDelayedOpen = React.useCallback(
|
|
184
|
+
(itemValue) => {
|
|
185
|
+
const isOpenItem = value === itemValue;
|
|
186
|
+
if (isOpenItem) {
|
|
187
|
+
window.clearTimeout(closeTimerRef.current);
|
|
188
|
+
} else {
|
|
189
|
+
openTimerRef.current = window.setTimeout(() => {
|
|
190
|
+
window.clearTimeout(closeTimerRef.current);
|
|
191
|
+
setValue(itemValue);
|
|
192
|
+
}, delayDuration);
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
[value, setValue, delayDuration]
|
|
196
|
+
);
|
|
197
|
+
React.useEffect(() => {
|
|
198
|
+
return () => {
|
|
199
|
+
window.clearTimeout(openTimerRef.current);
|
|
200
|
+
window.clearTimeout(closeTimerRef.current);
|
|
201
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
202
|
+
};
|
|
203
|
+
}, []);
|
|
204
|
+
return /* @__PURE__ */ jsx(
|
|
205
|
+
NavigationMenuProvider,
|
|
206
|
+
{
|
|
207
|
+
scope: __scopeNavigationMenu,
|
|
208
|
+
isRootMenu: true,
|
|
209
|
+
value,
|
|
210
|
+
dir: direction,
|
|
211
|
+
orientation,
|
|
212
|
+
rootNavigationMenu: navigationMenu,
|
|
213
|
+
onTriggerEnter: (itemValue) => {
|
|
214
|
+
window.clearTimeout(openTimerRef.current);
|
|
215
|
+
if (isOpenDelayed) handleDelayedOpen(itemValue);
|
|
216
|
+
else handleOpen(itemValue);
|
|
217
|
+
},
|
|
218
|
+
onTriggerLeave: () => {
|
|
219
|
+
window.clearTimeout(openTimerRef.current);
|
|
220
|
+
startCloseTimer();
|
|
221
|
+
},
|
|
222
|
+
onContentEnter: () => window.clearTimeout(closeTimerRef.current),
|
|
223
|
+
onContentLeave: startCloseTimer,
|
|
224
|
+
onItemSelect: (itemValue) => {
|
|
225
|
+
setValue((prevValue) => prevValue === itemValue ? "" : itemValue);
|
|
226
|
+
},
|
|
227
|
+
onItemDismiss: () => setValue(""),
|
|
228
|
+
children: /* @__PURE__ */ jsx(
|
|
229
|
+
Primitive.nav,
|
|
230
|
+
{
|
|
231
|
+
"aria-label": "Main",
|
|
232
|
+
"data-orientation": orientation,
|
|
233
|
+
dir: direction,
|
|
234
|
+
...NavigationMenuProps,
|
|
235
|
+
ref: composedRef
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
NavigationMenu$1.displayName = NAVIGATION_MENU_NAME;
|
|
243
|
+
var SUB_NAME = "NavigationMenuSub";
|
|
244
|
+
var NavigationMenuSub = React.forwardRef(
|
|
245
|
+
(props, forwardedRef) => {
|
|
246
|
+
const {
|
|
247
|
+
__scopeNavigationMenu,
|
|
248
|
+
value: valueProp,
|
|
249
|
+
onValueChange,
|
|
250
|
+
defaultValue,
|
|
251
|
+
orientation = "horizontal",
|
|
252
|
+
...subProps
|
|
253
|
+
} = props;
|
|
254
|
+
const context = useNavigationMenuContext(SUB_NAME, __scopeNavigationMenu);
|
|
255
|
+
const [value, setValue] = useControllableState({
|
|
256
|
+
prop: valueProp,
|
|
257
|
+
onChange: onValueChange,
|
|
258
|
+
defaultProp: defaultValue ?? "",
|
|
259
|
+
caller: SUB_NAME
|
|
260
|
+
});
|
|
261
|
+
return /* @__PURE__ */ jsx(
|
|
262
|
+
NavigationMenuProvider,
|
|
263
|
+
{
|
|
264
|
+
scope: __scopeNavigationMenu,
|
|
265
|
+
isRootMenu: false,
|
|
266
|
+
value,
|
|
267
|
+
dir: context.dir,
|
|
268
|
+
orientation,
|
|
269
|
+
rootNavigationMenu: context.rootNavigationMenu,
|
|
270
|
+
onTriggerEnter: (itemValue) => setValue(itemValue),
|
|
271
|
+
onItemSelect: (itemValue) => setValue(itemValue),
|
|
272
|
+
onItemDismiss: () => setValue(""),
|
|
273
|
+
children: /* @__PURE__ */ jsx(Primitive.div, { "data-orientation": orientation, ...subProps, ref: forwardedRef })
|
|
274
|
+
}
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
NavigationMenuSub.displayName = SUB_NAME;
|
|
279
|
+
var NavigationMenuProvider = (props) => {
|
|
280
|
+
const {
|
|
281
|
+
scope,
|
|
282
|
+
isRootMenu,
|
|
283
|
+
rootNavigationMenu,
|
|
284
|
+
dir,
|
|
285
|
+
orientation,
|
|
286
|
+
children,
|
|
287
|
+
value,
|
|
288
|
+
onItemSelect,
|
|
289
|
+
onItemDismiss,
|
|
290
|
+
onTriggerEnter,
|
|
291
|
+
onTriggerLeave,
|
|
292
|
+
onContentEnter,
|
|
293
|
+
onContentLeave
|
|
294
|
+
} = props;
|
|
295
|
+
const [viewport, setViewport] = React.useState(null);
|
|
296
|
+
const [viewportContent, setViewportContent] = React.useState(/* @__PURE__ */ new Map());
|
|
297
|
+
const [indicatorTrack, setIndicatorTrack] = React.useState(null);
|
|
298
|
+
return /* @__PURE__ */ jsx(
|
|
299
|
+
NavigationMenuProviderImpl,
|
|
300
|
+
{
|
|
301
|
+
scope,
|
|
302
|
+
isRootMenu,
|
|
303
|
+
rootNavigationMenu,
|
|
304
|
+
value,
|
|
305
|
+
previousValue: usePrevious(value),
|
|
306
|
+
baseId: useId(),
|
|
307
|
+
dir,
|
|
308
|
+
orientation,
|
|
309
|
+
viewport,
|
|
310
|
+
onViewportChange: setViewport,
|
|
311
|
+
indicatorTrack,
|
|
312
|
+
onIndicatorTrackChange: setIndicatorTrack,
|
|
313
|
+
onTriggerEnter: useCallbackRef(onTriggerEnter),
|
|
314
|
+
onTriggerLeave: useCallbackRef(onTriggerLeave),
|
|
315
|
+
onContentEnter: useCallbackRef(onContentEnter),
|
|
316
|
+
onContentLeave: useCallbackRef(onContentLeave),
|
|
317
|
+
onItemSelect: useCallbackRef(onItemSelect),
|
|
318
|
+
onItemDismiss: useCallbackRef(onItemDismiss),
|
|
319
|
+
onViewportContentChange: React.useCallback((contentValue, contentData) => {
|
|
320
|
+
setViewportContent((prevContent) => {
|
|
321
|
+
prevContent.set(contentValue, contentData);
|
|
322
|
+
return new Map(prevContent);
|
|
323
|
+
});
|
|
324
|
+
}, []),
|
|
325
|
+
onViewportContentRemove: React.useCallback((contentValue) => {
|
|
326
|
+
setViewportContent((prevContent) => {
|
|
327
|
+
if (!prevContent.has(contentValue)) return prevContent;
|
|
328
|
+
prevContent.delete(contentValue);
|
|
329
|
+
return new Map(prevContent);
|
|
330
|
+
});
|
|
331
|
+
}, []),
|
|
332
|
+
children: /* @__PURE__ */ jsx(Collection.Provider, { scope, children: /* @__PURE__ */ jsx(ViewportContentProvider, { scope, items: viewportContent, children }) })
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
};
|
|
336
|
+
var LIST_NAME = "NavigationMenuList";
|
|
337
|
+
var NavigationMenuList$1 = React.forwardRef(
|
|
338
|
+
(props, forwardedRef) => {
|
|
339
|
+
const { __scopeNavigationMenu, ...listProps } = props;
|
|
340
|
+
const context = useNavigationMenuContext(LIST_NAME, __scopeNavigationMenu);
|
|
341
|
+
const list = /* @__PURE__ */ jsx(Primitive.ul, { "data-orientation": context.orientation, ...listProps, ref: forwardedRef });
|
|
342
|
+
return /* @__PURE__ */ jsx(Primitive.div, { style: { position: "relative" }, ref: context.onIndicatorTrackChange, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: __scopeNavigationMenu, children: context.isRootMenu ? /* @__PURE__ */ jsx(FocusGroup, { asChild: true, children: list }) : list }) });
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
NavigationMenuList$1.displayName = LIST_NAME;
|
|
346
|
+
var ITEM_NAME = "NavigationMenuItem";
|
|
347
|
+
var [NavigationMenuItemContextProvider, useNavigationMenuItemContext] = createNavigationMenuContext(ITEM_NAME);
|
|
348
|
+
var NavigationMenuItem$1 = React.forwardRef(
|
|
349
|
+
(props, forwardedRef) => {
|
|
350
|
+
const { __scopeNavigationMenu, value: valueProp, ...itemProps } = props;
|
|
351
|
+
const autoValue = useId();
|
|
352
|
+
const value = valueProp || autoValue || "LEGACY_REACT_AUTO_VALUE";
|
|
353
|
+
const contentRef = React.useRef(null);
|
|
354
|
+
const triggerRef = React.useRef(null);
|
|
355
|
+
const focusProxyRef = React.useRef(null);
|
|
356
|
+
const restoreContentTabOrderRef = React.useRef(() => {
|
|
357
|
+
});
|
|
358
|
+
const wasEscapeCloseRef = React.useRef(false);
|
|
359
|
+
const handleContentEntry = React.useCallback((side = "start") => {
|
|
360
|
+
if (contentRef.current) {
|
|
361
|
+
restoreContentTabOrderRef.current();
|
|
362
|
+
const candidates = getTabbableCandidates(contentRef.current);
|
|
363
|
+
if (candidates.length) focusFirst(side === "start" ? candidates : candidates.reverse());
|
|
364
|
+
}
|
|
365
|
+
}, []);
|
|
366
|
+
const handleContentExit = React.useCallback(() => {
|
|
367
|
+
if (contentRef.current) {
|
|
368
|
+
const candidates = getTabbableCandidates(contentRef.current);
|
|
369
|
+
if (candidates.length) restoreContentTabOrderRef.current = removeFromTabOrder(candidates);
|
|
370
|
+
}
|
|
371
|
+
}, []);
|
|
372
|
+
return /* @__PURE__ */ jsx(
|
|
373
|
+
NavigationMenuItemContextProvider,
|
|
374
|
+
{
|
|
375
|
+
scope: __scopeNavigationMenu,
|
|
376
|
+
value,
|
|
377
|
+
triggerRef,
|
|
378
|
+
contentRef,
|
|
379
|
+
focusProxyRef,
|
|
380
|
+
wasEscapeCloseRef,
|
|
381
|
+
onEntryKeyDown: handleContentEntry,
|
|
382
|
+
onFocusProxyEnter: handleContentEntry,
|
|
383
|
+
onRootContentClose: handleContentExit,
|
|
384
|
+
onContentFocusOutside: handleContentExit,
|
|
385
|
+
children: /* @__PURE__ */ jsx(Primitive.li, { ...itemProps, ref: forwardedRef })
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
);
|
|
390
|
+
NavigationMenuItem$1.displayName = ITEM_NAME;
|
|
391
|
+
var TRIGGER_NAME = "NavigationMenuTrigger";
|
|
392
|
+
var NavigationMenuTrigger$1 = React.forwardRef((props, forwardedRef) => {
|
|
393
|
+
const { __scopeNavigationMenu, disabled, ...triggerProps } = props;
|
|
394
|
+
const context = useNavigationMenuContext(TRIGGER_NAME, props.__scopeNavigationMenu);
|
|
395
|
+
const itemContext = useNavigationMenuItemContext(TRIGGER_NAME, props.__scopeNavigationMenu);
|
|
396
|
+
const ref = React.useRef(null);
|
|
397
|
+
const composedRefs = useComposedRefs(ref, itemContext.triggerRef, forwardedRef);
|
|
398
|
+
const triggerId = makeTriggerId(context.baseId, itemContext.value);
|
|
399
|
+
const contentId = makeContentId(context.baseId, itemContext.value);
|
|
400
|
+
const hasPointerMoveOpenedRef = React.useRef(false);
|
|
401
|
+
const wasClickCloseRef = React.useRef(false);
|
|
402
|
+
const open = itemContext.value === context.value;
|
|
403
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
404
|
+
/* @__PURE__ */ jsx(Collection.ItemSlot, { scope: __scopeNavigationMenu, value: itemContext.value, children: /* @__PURE__ */ jsx(FocusGroupItem, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
405
|
+
Primitive.button,
|
|
406
|
+
{
|
|
407
|
+
id: triggerId,
|
|
408
|
+
disabled,
|
|
409
|
+
"data-disabled": disabled ? "" : void 0,
|
|
410
|
+
"data-state": getOpenState(open),
|
|
411
|
+
"aria-expanded": open,
|
|
412
|
+
"aria-controls": contentId,
|
|
413
|
+
...triggerProps,
|
|
414
|
+
ref: composedRefs,
|
|
415
|
+
onPointerEnter: composeEventHandlers(props.onPointerEnter, () => {
|
|
416
|
+
wasClickCloseRef.current = false;
|
|
417
|
+
itemContext.wasEscapeCloseRef.current = false;
|
|
418
|
+
}),
|
|
419
|
+
onPointerMove: composeEventHandlers(
|
|
420
|
+
props.onPointerMove,
|
|
421
|
+
whenMouse(() => {
|
|
422
|
+
if (disabled || wasClickCloseRef.current || itemContext.wasEscapeCloseRef.current || hasPointerMoveOpenedRef.current)
|
|
423
|
+
return;
|
|
424
|
+
context.onTriggerEnter(itemContext.value);
|
|
425
|
+
hasPointerMoveOpenedRef.current = true;
|
|
426
|
+
})
|
|
427
|
+
),
|
|
428
|
+
onPointerLeave: composeEventHandlers(
|
|
429
|
+
props.onPointerLeave,
|
|
430
|
+
whenMouse(() => {
|
|
431
|
+
if (disabled) return;
|
|
432
|
+
context.onTriggerLeave();
|
|
433
|
+
hasPointerMoveOpenedRef.current = false;
|
|
434
|
+
})
|
|
435
|
+
),
|
|
436
|
+
onClick: composeEventHandlers(props.onClick, () => {
|
|
437
|
+
context.onItemSelect(itemContext.value);
|
|
438
|
+
wasClickCloseRef.current = open;
|
|
439
|
+
}),
|
|
440
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
441
|
+
const verticalEntryKey = context.dir === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
442
|
+
const entryKey = { horizontal: "ArrowDown", vertical: verticalEntryKey }[context.orientation];
|
|
443
|
+
if (open && event.key === entryKey) {
|
|
444
|
+
itemContext.onEntryKeyDown();
|
|
445
|
+
event.preventDefault();
|
|
446
|
+
}
|
|
447
|
+
})
|
|
448
|
+
}
|
|
449
|
+
) }) }),
|
|
450
|
+
open && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
451
|
+
/* @__PURE__ */ jsx(
|
|
452
|
+
Root,
|
|
453
|
+
{
|
|
454
|
+
"aria-hidden": true,
|
|
455
|
+
tabIndex: 0,
|
|
456
|
+
ref: itemContext.focusProxyRef,
|
|
457
|
+
onFocus: (event) => {
|
|
458
|
+
const content = itemContext.contentRef.current;
|
|
459
|
+
const prevFocusedElement = event.relatedTarget;
|
|
460
|
+
const wasTriggerFocused = prevFocusedElement === ref.current;
|
|
461
|
+
const wasFocusFromContent = content?.contains(prevFocusedElement);
|
|
462
|
+
if (wasTriggerFocused || !wasFocusFromContent) {
|
|
463
|
+
itemContext.onFocusProxyEnter(wasTriggerFocused ? "start" : "end");
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
),
|
|
468
|
+
context.viewport && /* @__PURE__ */ jsx("span", { "aria-owns": contentId })
|
|
469
|
+
] })
|
|
470
|
+
] });
|
|
471
|
+
});
|
|
472
|
+
NavigationMenuTrigger$1.displayName = TRIGGER_NAME;
|
|
473
|
+
var LINK_NAME = "NavigationMenuLink";
|
|
474
|
+
var LINK_SELECT = "navigationMenu.linkSelect";
|
|
475
|
+
var NavigationMenuLink$1 = React.forwardRef(
|
|
476
|
+
(props, forwardedRef) => {
|
|
477
|
+
const { __scopeNavigationMenu, active, onSelect, ...linkProps } = props;
|
|
478
|
+
return /* @__PURE__ */ jsx(FocusGroupItem, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
479
|
+
Primitive.a,
|
|
480
|
+
{
|
|
481
|
+
"data-active": active ? "" : void 0,
|
|
482
|
+
"aria-current": active ? "page" : void 0,
|
|
483
|
+
...linkProps,
|
|
484
|
+
ref: forwardedRef,
|
|
485
|
+
onClick: composeEventHandlers(
|
|
486
|
+
props.onClick,
|
|
487
|
+
(event) => {
|
|
488
|
+
const target = event.target;
|
|
489
|
+
const linkSelectEvent = new CustomEvent(LINK_SELECT, {
|
|
490
|
+
bubbles: true,
|
|
491
|
+
cancelable: true
|
|
492
|
+
});
|
|
493
|
+
target.addEventListener(LINK_SELECT, (event2) => onSelect?.(event2), { once: true });
|
|
494
|
+
dispatchDiscreteCustomEvent(target, linkSelectEvent);
|
|
495
|
+
if (!linkSelectEvent.defaultPrevented && !event.metaKey) {
|
|
496
|
+
const rootContentDismissEvent = new CustomEvent(ROOT_CONTENT_DISMISS, {
|
|
497
|
+
bubbles: true,
|
|
498
|
+
cancelable: true
|
|
499
|
+
});
|
|
500
|
+
dispatchDiscreteCustomEvent(target, rootContentDismissEvent);
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
{ checkForDefaultPrevented: false }
|
|
504
|
+
)
|
|
505
|
+
}
|
|
506
|
+
) });
|
|
507
|
+
}
|
|
508
|
+
);
|
|
509
|
+
NavigationMenuLink$1.displayName = LINK_NAME;
|
|
510
|
+
var INDICATOR_NAME = "NavigationMenuIndicator";
|
|
511
|
+
var NavigationMenuIndicator$1 = React.forwardRef((props, forwardedRef) => {
|
|
512
|
+
const { forceMount, ...indicatorProps } = props;
|
|
513
|
+
const context = useNavigationMenuContext(INDICATOR_NAME, props.__scopeNavigationMenu);
|
|
514
|
+
const isVisible = Boolean(context.value);
|
|
515
|
+
return context.indicatorTrack ? ReactDOM__default.createPortal(
|
|
516
|
+
/* @__PURE__ */ jsx(Presence, { present: forceMount || isVisible, children: /* @__PURE__ */ jsx(NavigationMenuIndicatorImpl, { ...indicatorProps, ref: forwardedRef }) }),
|
|
517
|
+
context.indicatorTrack
|
|
518
|
+
) : null;
|
|
519
|
+
});
|
|
520
|
+
NavigationMenuIndicator$1.displayName = INDICATOR_NAME;
|
|
521
|
+
var NavigationMenuIndicatorImpl = React.forwardRef((props, forwardedRef) => {
|
|
522
|
+
const { __scopeNavigationMenu, ...indicatorProps } = props;
|
|
523
|
+
const context = useNavigationMenuContext(INDICATOR_NAME, __scopeNavigationMenu);
|
|
524
|
+
const getItems = useCollection(__scopeNavigationMenu);
|
|
525
|
+
const [activeTrigger, setActiveTrigger] = React.useState(
|
|
526
|
+
null
|
|
527
|
+
);
|
|
528
|
+
const [position, setPosition] = React.useState(null);
|
|
529
|
+
const isHorizontal = context.orientation === "horizontal";
|
|
530
|
+
const isVisible = Boolean(context.value);
|
|
531
|
+
React.useEffect(() => {
|
|
532
|
+
const items = getItems();
|
|
533
|
+
const triggerNode = items.find((item) => item.value === context.value)?.ref.current;
|
|
534
|
+
if (triggerNode) setActiveTrigger(triggerNode);
|
|
535
|
+
}, [getItems, context.value]);
|
|
536
|
+
const handlePositionChange = () => {
|
|
537
|
+
if (activeTrigger) {
|
|
538
|
+
setPosition({
|
|
539
|
+
size: isHorizontal ? activeTrigger.offsetWidth : activeTrigger.offsetHeight,
|
|
540
|
+
offset: isHorizontal ? activeTrigger.offsetLeft : activeTrigger.offsetTop
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
useResizeObserver(activeTrigger, handlePositionChange);
|
|
545
|
+
useResizeObserver(context.indicatorTrack, handlePositionChange);
|
|
546
|
+
return position ? /* @__PURE__ */ jsx(
|
|
547
|
+
Primitive.div,
|
|
548
|
+
{
|
|
549
|
+
"aria-hidden": true,
|
|
550
|
+
"data-state": isVisible ? "visible" : "hidden",
|
|
551
|
+
"data-orientation": context.orientation,
|
|
552
|
+
...indicatorProps,
|
|
553
|
+
ref: forwardedRef,
|
|
554
|
+
style: {
|
|
555
|
+
position: "absolute",
|
|
556
|
+
...isHorizontal ? {
|
|
557
|
+
left: 0,
|
|
558
|
+
width: position.size + "px",
|
|
559
|
+
transform: `translateX(${position.offset}px)`
|
|
560
|
+
} : {
|
|
561
|
+
top: 0,
|
|
562
|
+
height: position.size + "px",
|
|
563
|
+
transform: `translateY(${position.offset}px)`
|
|
564
|
+
},
|
|
565
|
+
...indicatorProps.style
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
) : null;
|
|
569
|
+
});
|
|
570
|
+
var CONTENT_NAME = "NavigationMenuContent";
|
|
571
|
+
var NavigationMenuContent$1 = React.forwardRef((props, forwardedRef) => {
|
|
572
|
+
const { forceMount, ...contentProps } = props;
|
|
573
|
+
const context = useNavigationMenuContext(CONTENT_NAME, props.__scopeNavigationMenu);
|
|
574
|
+
const itemContext = useNavigationMenuItemContext(CONTENT_NAME, props.__scopeNavigationMenu);
|
|
575
|
+
const composedRefs = useComposedRefs(itemContext.contentRef, forwardedRef);
|
|
576
|
+
const open = itemContext.value === context.value;
|
|
577
|
+
const commonProps = {
|
|
578
|
+
value: itemContext.value,
|
|
579
|
+
triggerRef: itemContext.triggerRef,
|
|
580
|
+
focusProxyRef: itemContext.focusProxyRef,
|
|
581
|
+
wasEscapeCloseRef: itemContext.wasEscapeCloseRef,
|
|
582
|
+
onContentFocusOutside: itemContext.onContentFocusOutside,
|
|
583
|
+
onRootContentClose: itemContext.onRootContentClose,
|
|
584
|
+
...contentProps
|
|
585
|
+
};
|
|
586
|
+
return !context.viewport ? /* @__PURE__ */ jsx(Presence, { present: forceMount || open, children: /* @__PURE__ */ jsx(
|
|
587
|
+
NavigationMenuContentImpl,
|
|
588
|
+
{
|
|
589
|
+
"data-state": getOpenState(open),
|
|
590
|
+
...commonProps,
|
|
591
|
+
ref: composedRefs,
|
|
592
|
+
onPointerEnter: composeEventHandlers(props.onPointerEnter, context.onContentEnter),
|
|
593
|
+
onPointerLeave: composeEventHandlers(
|
|
594
|
+
props.onPointerLeave,
|
|
595
|
+
whenMouse(context.onContentLeave)
|
|
596
|
+
),
|
|
597
|
+
style: {
|
|
598
|
+
// Prevent interaction when animating out
|
|
599
|
+
pointerEvents: !open && context.isRootMenu ? "none" : void 0,
|
|
600
|
+
...commonProps.style
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
) }) : /* @__PURE__ */ jsx(ViewportContentMounter, { forceMount, ...commonProps, ref: composedRefs });
|
|
604
|
+
});
|
|
605
|
+
NavigationMenuContent$1.displayName = CONTENT_NAME;
|
|
606
|
+
var ViewportContentMounter = React.forwardRef((props, forwardedRef) => {
|
|
607
|
+
const context = useNavigationMenuContext(CONTENT_NAME, props.__scopeNavigationMenu);
|
|
608
|
+
const { onViewportContentChange, onViewportContentRemove } = context;
|
|
609
|
+
useLayoutEffect2(() => {
|
|
610
|
+
onViewportContentChange(props.value, {
|
|
611
|
+
ref: forwardedRef,
|
|
612
|
+
...props
|
|
613
|
+
});
|
|
614
|
+
}, [props, forwardedRef, onViewportContentChange]);
|
|
615
|
+
useLayoutEffect2(() => {
|
|
616
|
+
return () => onViewportContentRemove(props.value);
|
|
617
|
+
}, [props.value, onViewportContentRemove]);
|
|
618
|
+
return null;
|
|
619
|
+
});
|
|
620
|
+
var ROOT_CONTENT_DISMISS = "navigationMenu.rootContentDismiss";
|
|
621
|
+
var NavigationMenuContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
622
|
+
const {
|
|
623
|
+
__scopeNavigationMenu,
|
|
624
|
+
value,
|
|
625
|
+
triggerRef,
|
|
626
|
+
focusProxyRef,
|
|
627
|
+
wasEscapeCloseRef,
|
|
628
|
+
onRootContentClose,
|
|
629
|
+
onContentFocusOutside,
|
|
630
|
+
...contentProps
|
|
631
|
+
} = props;
|
|
632
|
+
const context = useNavigationMenuContext(CONTENT_NAME, __scopeNavigationMenu);
|
|
633
|
+
const ref = React.useRef(null);
|
|
634
|
+
const composedRefs = useComposedRefs(ref, forwardedRef);
|
|
635
|
+
const triggerId = makeTriggerId(context.baseId, value);
|
|
636
|
+
const contentId = makeContentId(context.baseId, value);
|
|
637
|
+
const getItems = useCollection(__scopeNavigationMenu);
|
|
638
|
+
const prevMotionAttributeRef = React.useRef(null);
|
|
639
|
+
const { onItemDismiss } = context;
|
|
640
|
+
React.useEffect(() => {
|
|
641
|
+
const content = ref.current;
|
|
642
|
+
if (context.isRootMenu && content) {
|
|
643
|
+
const handleClose = () => {
|
|
644
|
+
onItemDismiss();
|
|
645
|
+
onRootContentClose();
|
|
646
|
+
if (content.contains(document.activeElement)) triggerRef.current?.focus();
|
|
647
|
+
};
|
|
648
|
+
content.addEventListener(ROOT_CONTENT_DISMISS, handleClose);
|
|
649
|
+
return () => content.removeEventListener(ROOT_CONTENT_DISMISS, handleClose);
|
|
650
|
+
}
|
|
651
|
+
}, [context.isRootMenu, props.value, triggerRef, onItemDismiss, onRootContentClose]);
|
|
652
|
+
const motionAttribute = React.useMemo(() => {
|
|
653
|
+
const items = getItems();
|
|
654
|
+
const values = items.map((item) => item.value);
|
|
655
|
+
if (context.dir === "rtl") values.reverse();
|
|
656
|
+
const index = values.indexOf(context.value);
|
|
657
|
+
const prevIndex = values.indexOf(context.previousValue);
|
|
658
|
+
const isSelected = value === context.value;
|
|
659
|
+
const wasSelected = prevIndex === values.indexOf(value);
|
|
660
|
+
if (!isSelected && !wasSelected) return prevMotionAttributeRef.current;
|
|
661
|
+
const attribute = (() => {
|
|
662
|
+
if (index !== prevIndex) {
|
|
663
|
+
if (isSelected && prevIndex !== -1) return index > prevIndex ? "from-end" : "from-start";
|
|
664
|
+
if (wasSelected && index !== -1) return index > prevIndex ? "to-start" : "to-end";
|
|
665
|
+
}
|
|
666
|
+
return null;
|
|
667
|
+
})();
|
|
668
|
+
prevMotionAttributeRef.current = attribute;
|
|
669
|
+
return attribute;
|
|
670
|
+
}, [context.previousValue, context.value, context.dir, getItems, value]);
|
|
671
|
+
return /* @__PURE__ */ jsx(FocusGroup, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
672
|
+
DismissableLayer,
|
|
673
|
+
{
|
|
674
|
+
id: contentId,
|
|
675
|
+
"aria-labelledby": triggerId,
|
|
676
|
+
"data-motion": motionAttribute,
|
|
677
|
+
"data-orientation": context.orientation,
|
|
678
|
+
...contentProps,
|
|
679
|
+
ref: composedRefs,
|
|
680
|
+
disableOutsidePointerEvents: false,
|
|
681
|
+
onDismiss: () => {
|
|
682
|
+
const rootContentDismissEvent = new Event(ROOT_CONTENT_DISMISS, {
|
|
683
|
+
bubbles: true,
|
|
684
|
+
cancelable: true
|
|
685
|
+
});
|
|
686
|
+
ref.current?.dispatchEvent(rootContentDismissEvent);
|
|
687
|
+
},
|
|
688
|
+
onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => {
|
|
689
|
+
onContentFocusOutside();
|
|
690
|
+
const target = event.target;
|
|
691
|
+
if (context.rootNavigationMenu?.contains(target)) event.preventDefault();
|
|
692
|
+
}),
|
|
693
|
+
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
694
|
+
const target = event.target;
|
|
695
|
+
const isTrigger = getItems().some((item) => item.ref.current?.contains(target));
|
|
696
|
+
const isRootViewport = context.isRootMenu && context.viewport?.contains(target);
|
|
697
|
+
if (isTrigger || isRootViewport || !context.isRootMenu) event.preventDefault();
|
|
698
|
+
}),
|
|
699
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
700
|
+
const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;
|
|
701
|
+
const isTabKey = event.key === "Tab" && !isMetaKey;
|
|
702
|
+
if (isTabKey) {
|
|
703
|
+
const candidates = getTabbableCandidates(event.currentTarget);
|
|
704
|
+
const focusedElement = document.activeElement;
|
|
705
|
+
const index = candidates.findIndex((candidate) => candidate === focusedElement);
|
|
706
|
+
const isMovingBackwards = event.shiftKey;
|
|
707
|
+
const nextCandidates = isMovingBackwards ? candidates.slice(0, index).reverse() : candidates.slice(index + 1, candidates.length);
|
|
708
|
+
if (focusFirst(nextCandidates)) {
|
|
709
|
+
event.preventDefault();
|
|
710
|
+
} else {
|
|
711
|
+
focusProxyRef.current?.focus();
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}),
|
|
715
|
+
onEscapeKeyDown: composeEventHandlers(props.onEscapeKeyDown, (_event) => {
|
|
716
|
+
wasEscapeCloseRef.current = true;
|
|
717
|
+
})
|
|
718
|
+
}
|
|
719
|
+
) });
|
|
720
|
+
});
|
|
721
|
+
var VIEWPORT_NAME = "NavigationMenuViewport";
|
|
722
|
+
var NavigationMenuViewport$1 = React.forwardRef((props, forwardedRef) => {
|
|
723
|
+
const { forceMount, ...viewportProps } = props;
|
|
724
|
+
const context = useNavigationMenuContext(VIEWPORT_NAME, props.__scopeNavigationMenu);
|
|
725
|
+
const open = Boolean(context.value);
|
|
726
|
+
return /* @__PURE__ */ jsx(Presence, { present: forceMount || open, children: /* @__PURE__ */ jsx(NavigationMenuViewportImpl, { ...viewportProps, ref: forwardedRef }) });
|
|
727
|
+
});
|
|
728
|
+
NavigationMenuViewport$1.displayName = VIEWPORT_NAME;
|
|
729
|
+
var NavigationMenuViewportImpl = React.forwardRef((props, forwardedRef) => {
|
|
730
|
+
const { __scopeNavigationMenu, children, ...viewportImplProps } = props;
|
|
731
|
+
const context = useNavigationMenuContext(VIEWPORT_NAME, __scopeNavigationMenu);
|
|
732
|
+
const composedRefs = useComposedRefs(forwardedRef, context.onViewportChange);
|
|
733
|
+
const viewportContentContext = useViewportContentContext(
|
|
734
|
+
CONTENT_NAME,
|
|
735
|
+
props.__scopeNavigationMenu
|
|
736
|
+
);
|
|
737
|
+
const [size, setSize] = React.useState(null);
|
|
738
|
+
const [content, setContent] = React.useState(null);
|
|
739
|
+
const viewportWidth = size ? size?.width + "px" : void 0;
|
|
740
|
+
const viewportHeight = size ? size?.height + "px" : void 0;
|
|
741
|
+
const open = Boolean(context.value);
|
|
742
|
+
const activeContentValue = open ? context.value : context.previousValue;
|
|
743
|
+
const handleSizeChange = () => {
|
|
744
|
+
if (content) setSize({ width: content.offsetWidth, height: content.offsetHeight });
|
|
745
|
+
};
|
|
746
|
+
useResizeObserver(content, handleSizeChange);
|
|
747
|
+
return /* @__PURE__ */ jsx(
|
|
748
|
+
Primitive.div,
|
|
749
|
+
{
|
|
750
|
+
"data-state": getOpenState(open),
|
|
751
|
+
"data-orientation": context.orientation,
|
|
752
|
+
...viewportImplProps,
|
|
753
|
+
ref: composedRefs,
|
|
754
|
+
style: {
|
|
755
|
+
// Prevent interaction when animating out
|
|
756
|
+
pointerEvents: !open && context.isRootMenu ? "none" : void 0,
|
|
757
|
+
["--radix-navigation-menu-viewport-width"]: viewportWidth,
|
|
758
|
+
["--radix-navigation-menu-viewport-height"]: viewportHeight,
|
|
759
|
+
...viewportImplProps.style
|
|
760
|
+
},
|
|
761
|
+
onPointerEnter: composeEventHandlers(props.onPointerEnter, context.onContentEnter),
|
|
762
|
+
onPointerLeave: composeEventHandlers(props.onPointerLeave, whenMouse(context.onContentLeave)),
|
|
763
|
+
children: Array.from(viewportContentContext.items).map(([value, { ref, forceMount, ...props2 }]) => {
|
|
764
|
+
const isActive = activeContentValue === value;
|
|
765
|
+
return /* @__PURE__ */ jsx(Presence, { present: forceMount || isActive, children: /* @__PURE__ */ jsx(
|
|
766
|
+
NavigationMenuContentImpl,
|
|
767
|
+
{
|
|
768
|
+
...props2,
|
|
769
|
+
ref: composeRefs(ref, (node) => {
|
|
770
|
+
if (isActive && node) setContent(node);
|
|
771
|
+
})
|
|
772
|
+
}
|
|
773
|
+
) }, value);
|
|
774
|
+
})
|
|
775
|
+
}
|
|
776
|
+
);
|
|
777
|
+
});
|
|
778
|
+
var FOCUS_GROUP_NAME = "FocusGroup";
|
|
779
|
+
var FocusGroup = React.forwardRef(
|
|
780
|
+
(props, forwardedRef) => {
|
|
781
|
+
const { __scopeNavigationMenu, ...groupProps } = props;
|
|
782
|
+
const context = useNavigationMenuContext(FOCUS_GROUP_NAME, __scopeNavigationMenu);
|
|
783
|
+
return /* @__PURE__ */ jsx(FocusGroupCollection.Provider, { scope: __scopeNavigationMenu, children: /* @__PURE__ */ jsx(FocusGroupCollection.Slot, { scope: __scopeNavigationMenu, children: /* @__PURE__ */ jsx(Primitive.div, { dir: context.dir, ...groupProps, ref: forwardedRef }) }) });
|
|
784
|
+
}
|
|
785
|
+
);
|
|
786
|
+
var ARROW_KEYS = ["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"];
|
|
787
|
+
var FOCUS_GROUP_ITEM_NAME = "FocusGroupItem";
|
|
788
|
+
var FocusGroupItem = React.forwardRef(
|
|
789
|
+
(props, forwardedRef) => {
|
|
790
|
+
const { __scopeNavigationMenu, ...groupProps } = props;
|
|
791
|
+
const getItems = useFocusGroupCollection(__scopeNavigationMenu);
|
|
792
|
+
const context = useNavigationMenuContext(FOCUS_GROUP_ITEM_NAME, __scopeNavigationMenu);
|
|
793
|
+
return /* @__PURE__ */ jsx(FocusGroupCollection.ItemSlot, { scope: __scopeNavigationMenu, children: /* @__PURE__ */ jsx(
|
|
794
|
+
Primitive.button,
|
|
795
|
+
{
|
|
796
|
+
...groupProps,
|
|
797
|
+
ref: forwardedRef,
|
|
798
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
799
|
+
const isFocusNavigationKey = ["Home", "End", ...ARROW_KEYS].includes(event.key);
|
|
800
|
+
if (isFocusNavigationKey) {
|
|
801
|
+
let candidateNodes = getItems().map((item) => item.ref.current);
|
|
802
|
+
const prevItemKey = context.dir === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
803
|
+
const prevKeys = [prevItemKey, "ArrowUp", "End"];
|
|
804
|
+
if (prevKeys.includes(event.key)) candidateNodes.reverse();
|
|
805
|
+
if (ARROW_KEYS.includes(event.key)) {
|
|
806
|
+
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
807
|
+
candidateNodes = candidateNodes.slice(currentIndex + 1);
|
|
808
|
+
}
|
|
809
|
+
setTimeout(() => focusFirst(candidateNodes));
|
|
810
|
+
event.preventDefault();
|
|
811
|
+
}
|
|
812
|
+
})
|
|
813
|
+
}
|
|
814
|
+
) });
|
|
815
|
+
}
|
|
816
|
+
);
|
|
817
|
+
function getTabbableCandidates(container) {
|
|
818
|
+
const nodes = [];
|
|
819
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
820
|
+
acceptNode: (node) => {
|
|
821
|
+
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
822
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
823
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
827
|
+
return nodes;
|
|
828
|
+
}
|
|
829
|
+
function focusFirst(candidates) {
|
|
830
|
+
const previouslyFocusedElement = document.activeElement;
|
|
831
|
+
return candidates.some((candidate) => {
|
|
832
|
+
if (candidate === previouslyFocusedElement) return true;
|
|
833
|
+
candidate.focus();
|
|
834
|
+
return document.activeElement !== previouslyFocusedElement;
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
function removeFromTabOrder(candidates) {
|
|
838
|
+
candidates.forEach((candidate) => {
|
|
839
|
+
candidate.dataset.tabindex = candidate.getAttribute("tabindex") || "";
|
|
840
|
+
candidate.setAttribute("tabindex", "-1");
|
|
841
|
+
});
|
|
842
|
+
return () => {
|
|
843
|
+
candidates.forEach((candidate) => {
|
|
844
|
+
const prevTabIndex = candidate.dataset.tabindex;
|
|
845
|
+
candidate.setAttribute("tabindex", prevTabIndex);
|
|
846
|
+
});
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
function useResizeObserver(element, onResize) {
|
|
850
|
+
const handleResize = useCallbackRef(onResize);
|
|
851
|
+
useLayoutEffect2(() => {
|
|
852
|
+
let rAF = 0;
|
|
853
|
+
if (element) {
|
|
854
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
855
|
+
cancelAnimationFrame(rAF);
|
|
856
|
+
rAF = window.requestAnimationFrame(handleResize);
|
|
857
|
+
});
|
|
858
|
+
resizeObserver.observe(element);
|
|
859
|
+
return () => {
|
|
860
|
+
window.cancelAnimationFrame(rAF);
|
|
861
|
+
resizeObserver.unobserve(element);
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
}, [element, handleResize]);
|
|
865
|
+
}
|
|
866
|
+
function getOpenState(open) {
|
|
867
|
+
return open ? "open" : "closed";
|
|
868
|
+
}
|
|
869
|
+
function makeTriggerId(baseId, value) {
|
|
870
|
+
return `${baseId}-trigger-${value}`;
|
|
871
|
+
}
|
|
872
|
+
function makeContentId(baseId, value) {
|
|
873
|
+
return `${baseId}-content-${value}`;
|
|
874
|
+
}
|
|
875
|
+
function whenMouse(handler) {
|
|
876
|
+
return (event) => event.pointerType === "mouse" ? handler(event) : void 0;
|
|
877
|
+
}
|
|
878
|
+
var Root2 = NavigationMenu$1;
|
|
879
|
+
var List = NavigationMenuList$1;
|
|
880
|
+
var Item = NavigationMenuItem$1;
|
|
881
|
+
var Trigger = NavigationMenuTrigger$1;
|
|
882
|
+
var Link = NavigationMenuLink$1;
|
|
883
|
+
var Indicator = NavigationMenuIndicator$1;
|
|
884
|
+
var Content = NavigationMenuContent$1;
|
|
885
|
+
var Viewport = NavigationMenuViewport$1;
|
|
886
|
+
function NavigationMenu({
|
|
887
|
+
className,
|
|
888
|
+
children,
|
|
889
|
+
noViewport = false,
|
|
890
|
+
mega = false,
|
|
891
|
+
...props
|
|
892
|
+
}) {
|
|
893
|
+
return /* @__PURE__ */ jsxs(
|
|
894
|
+
Root2,
|
|
895
|
+
{
|
|
896
|
+
"data-slot": "navigation-menu",
|
|
897
|
+
"data-mega": mega,
|
|
898
|
+
"data-viewport": !noViewport || mega,
|
|
899
|
+
className: cn(
|
|
900
|
+
"group/navigation-menu flex max-w-max flex-1 items-center justify-center",
|
|
901
|
+
{ relative: !mega },
|
|
902
|
+
className
|
|
903
|
+
),
|
|
904
|
+
...props,
|
|
905
|
+
children: [
|
|
906
|
+
children,
|
|
907
|
+
(!noViewport || mega) && /* @__PURE__ */ jsx(NavigationMenuViewport, { mega })
|
|
908
|
+
]
|
|
909
|
+
}
|
|
910
|
+
);
|
|
911
|
+
}
|
|
912
|
+
function NavigationMenuList({ className, ...props }) {
|
|
913
|
+
return /* @__PURE__ */ jsx(
|
|
914
|
+
List,
|
|
915
|
+
{
|
|
916
|
+
"data-slot": "navigation-menu-list",
|
|
917
|
+
className: cn("group flex flex-1 list-none items-center justify-center gap-1", className),
|
|
918
|
+
...props
|
|
919
|
+
}
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
function NavigationMenuItem({ className, ...props }) {
|
|
923
|
+
return /* @__PURE__ */ jsx(Item, { "data-slot": "navigation-menu-item", className: cn("relative", className), ...props });
|
|
924
|
+
}
|
|
925
|
+
const navigationMenuTriggerStyle = buttonVariants({
|
|
926
|
+
variant: "ghost",
|
|
927
|
+
className: "data-[state=open]:hover:text-secondary data-[state=open]:focus:text-secondary data-[state=open]:text-secondary"
|
|
928
|
+
});
|
|
929
|
+
function NavigationMenuTrigger({
|
|
930
|
+
className,
|
|
931
|
+
children,
|
|
932
|
+
...props
|
|
933
|
+
}) {
|
|
934
|
+
return /* @__PURE__ */ jsxs(
|
|
935
|
+
Trigger,
|
|
936
|
+
{
|
|
937
|
+
"data-slot": "navigation-menu-trigger",
|
|
938
|
+
className: cn(navigationMenuTriggerStyle, "group", className),
|
|
939
|
+
...props,
|
|
940
|
+
children: [
|
|
941
|
+
children,
|
|
942
|
+
" ",
|
|
943
|
+
/* @__PURE__ */ jsx(
|
|
944
|
+
ChevronDown,
|
|
945
|
+
{
|
|
946
|
+
className: "relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180",
|
|
947
|
+
"aria-hidden": "true"
|
|
948
|
+
}
|
|
949
|
+
)
|
|
950
|
+
]
|
|
951
|
+
}
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
function NavigationMenuContent({ className, ...props }) {
|
|
955
|
+
return /* @__PURE__ */ jsx(
|
|
956
|
+
Content,
|
|
957
|
+
{
|
|
958
|
+
"data-slot": "navigation-menu-content",
|
|
959
|
+
className: cn(
|
|
960
|
+
"max-md:h-[calc(100vh-var(--spacing-page-nav))] top-0 left-0 min-w-xs w-auto absolute group-data-[mega=true]/navigation-menu:w-full",
|
|
961
|
+
"data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52",
|
|
962
|
+
"group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0",
|
|
963
|
+
"group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none",
|
|
964
|
+
className
|
|
965
|
+
),
|
|
966
|
+
...props
|
|
967
|
+
}
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
function NavigationMenuViewport({
|
|
971
|
+
className,
|
|
972
|
+
mega = false,
|
|
973
|
+
...props
|
|
974
|
+
}) {
|
|
975
|
+
return /* @__PURE__ */ jsx(
|
|
976
|
+
"div",
|
|
977
|
+
{
|
|
978
|
+
className: cn("absolute top-full left-0 isolate z-50 flex justify-center bg-popover", {
|
|
979
|
+
"min-w-xs": !mega,
|
|
980
|
+
"w-full px-(--spacing-section)": mega
|
|
981
|
+
}),
|
|
982
|
+
children: /* @__PURE__ */ jsx(
|
|
983
|
+
Viewport,
|
|
984
|
+
{
|
|
985
|
+
"data-slot": "navigation-menu-viewport",
|
|
986
|
+
className: cn(
|
|
987
|
+
"origin-top-center duration-150 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in",
|
|
988
|
+
"bg-popover text-popover-foreground relative overflow-hidden w-full h-[var(--radix-navigation-menu-viewport-height)] overscroll-contain",
|
|
989
|
+
{
|
|
990
|
+
"mt-1.5 rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]": !mega,
|
|
991
|
+
"border-b-1 border-complement-1-50": mega
|
|
992
|
+
},
|
|
993
|
+
className
|
|
994
|
+
),
|
|
995
|
+
...props
|
|
996
|
+
}
|
|
997
|
+
)
|
|
998
|
+
}
|
|
999
|
+
);
|
|
1000
|
+
}
|
|
1001
|
+
function NavigationMenuLink({ className, ...props }) {
|
|
1002
|
+
return /* @__PURE__ */ jsx(
|
|
1003
|
+
Link,
|
|
1004
|
+
{
|
|
1005
|
+
"data-slot": "navigation-menu-link",
|
|
1006
|
+
className: cn(
|
|
1007
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",
|
|
1008
|
+
className
|
|
1009
|
+
),
|
|
1010
|
+
...props
|
|
1011
|
+
}
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
function NavigationMenuIndicator({
|
|
1015
|
+
className,
|
|
1016
|
+
...props
|
|
1017
|
+
}) {
|
|
1018
|
+
return /* @__PURE__ */ jsx(
|
|
1019
|
+
Indicator,
|
|
1020
|
+
{
|
|
1021
|
+
"data-slot": "navigation-menu-indicator",
|
|
1022
|
+
className: cn(
|
|
1023
|
+
"data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden",
|
|
1024
|
+
className
|
|
1025
|
+
),
|
|
1026
|
+
...props,
|
|
1027
|
+
children: /* @__PURE__ */ jsx("div", { className: "bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" })
|
|
1028
|
+
}
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
export {
|
|
1032
|
+
NavigationMenu,
|
|
1033
|
+
NavigationMenuContent,
|
|
1034
|
+
NavigationMenuIndicator,
|
|
1035
|
+
NavigationMenuItem,
|
|
1036
|
+
NavigationMenuLink,
|
|
1037
|
+
NavigationMenuList,
|
|
1038
|
+
NavigationMenuTrigger,
|
|
1039
|
+
NavigationMenuViewport,
|
|
1040
|
+
navigationMenuTriggerStyle
|
|
1041
|
+
};
|