@bccampus/ui-components 0.2.0 → 0.3.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/banner.js +14 -14
- package/dist/button.d.ts +1 -1
- package/dist/button.js +17 -17
- package/dist/caption.js +7 -8
- package/dist/card.js +34 -34
- package/dist/horizontal-list.js +32 -32
- package/dist/icon-generator.js +38 -38
- package/dist/index-U7DVCmS_.js +76 -0
- package/dist/input.js +4 -4
- package/dist/masked-image-generator.js +18 -18
- package/dist/navigation-menu.d.ts +27 -0
- package/dist/navigation-menu.js +1139 -0
- package/dist/overlay.js +2 -2
- package/dist/page-header.d.ts +5 -1
- package/dist/page-header.js +10 -9
- package/dist/page-section.js +14 -14
- package/dist/page.js +4 -4
- package/dist/search-input.js +11 -11
- package/dist/tag.js +8 -9
- package/dist/ui-components.d.ts +30 -2
- package/dist/ui-components.js +47 -37
- package/package.json +6 -1
- package/src/components/ui/banner.tsx +2 -2
- package/src/components/ui/button.tsx +8 -7
- package/src/components/ui/card.tsx +5 -5
- package/src/components/ui/horizontal-list.tsx +2 -2
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/navigation-menu.tsx +165 -0
- package/src/components/ui/page-header.tsx +13 -5
- package/src/components/ui/page-section.tsx +8 -8
- package/src/components/ui/page.tsx +3 -1
- package/src/styles/theme.css +7 -7
- package/src/styles/typography.css +334 -341
- package/vite.config.ts +5 -3
- package/vite.ladle.config.ts +17 -0
- package/dist/index-DlfV3JTY.js +0 -70
- package/dist/jsx-runtime-BzflLqGi.js +0 -282
|
@@ -0,0 +1,1139 @@
|
|
|
1
|
+
import { jsx as f, jsxs as $, Fragment as ie } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import L from "react";
|
|
4
|
+
import * as ke from "react-dom";
|
|
5
|
+
import Fe from "react-dom";
|
|
6
|
+
import { c as H, u as D, a as Ke } from "./index-U7DVCmS_.js";
|
|
7
|
+
import { c as A } from "./utils-CRiPKpXj.js";
|
|
8
|
+
import { buttonVariants as Ve } from "./button.js";
|
|
9
|
+
import { c as Ue } from "./createLucideIcon-CzehbSja.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 ze = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], $e = Ue("chevron-down", ze);
|
|
17
|
+
function le(e, t = []) {
|
|
18
|
+
let n = [];
|
|
19
|
+
function o(a, s) {
|
|
20
|
+
const u = i.createContext(s), l = n.length;
|
|
21
|
+
n = [...n, s];
|
|
22
|
+
const d = (v) => {
|
|
23
|
+
const { scope: p, children: h, ...E } = v, g = p?.[e]?.[l] || u, C = i.useMemo(() => E, Object.values(E));
|
|
24
|
+
return /* @__PURE__ */ f(g.Provider, { value: C, children: h });
|
|
25
|
+
};
|
|
26
|
+
d.displayName = a + "Provider";
|
|
27
|
+
function c(v, p) {
|
|
28
|
+
const h = p?.[e]?.[l] || u, E = i.useContext(h);
|
|
29
|
+
if (E) return E;
|
|
30
|
+
if (s !== void 0) return s;
|
|
31
|
+
throw new Error(`\`${v}\` must be used within \`${a}\``);
|
|
32
|
+
}
|
|
33
|
+
return [d, c];
|
|
34
|
+
}
|
|
35
|
+
const r = () => {
|
|
36
|
+
const a = n.map((s) => i.createContext(s));
|
|
37
|
+
return function(u) {
|
|
38
|
+
const l = u?.[e] || a;
|
|
39
|
+
return i.useMemo(
|
|
40
|
+
() => ({ [`__scope${e}`]: { ...u, [e]: l } }),
|
|
41
|
+
[u, l]
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
return r.scopeName = e, [o, We(r, ...t)];
|
|
46
|
+
}
|
|
47
|
+
function We(...e) {
|
|
48
|
+
const t = e[0];
|
|
49
|
+
if (e.length === 1) return t;
|
|
50
|
+
const n = () => {
|
|
51
|
+
const o = e.map((r) => ({
|
|
52
|
+
useScope: r(),
|
|
53
|
+
scopeName: r.scopeName
|
|
54
|
+
}));
|
|
55
|
+
return function(a) {
|
|
56
|
+
const s = o.reduce((u, { useScope: l, scopeName: d }) => {
|
|
57
|
+
const v = l(a)[`__scope${d}`];
|
|
58
|
+
return { ...u, ...v };
|
|
59
|
+
}, {});
|
|
60
|
+
return i.useMemo(() => ({ [`__scope${t.scopeName}`]: s }), [s]);
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
return n.scopeName = t.scopeName, n;
|
|
64
|
+
}
|
|
65
|
+
function P(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
66
|
+
return function(r) {
|
|
67
|
+
if (e?.(r), n === !1 || !r.defaultPrevented)
|
|
68
|
+
return t?.(r);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
var Be = [
|
|
72
|
+
"a",
|
|
73
|
+
"button",
|
|
74
|
+
"div",
|
|
75
|
+
"form",
|
|
76
|
+
"h2",
|
|
77
|
+
"h3",
|
|
78
|
+
"img",
|
|
79
|
+
"input",
|
|
80
|
+
"label",
|
|
81
|
+
"li",
|
|
82
|
+
"nav",
|
|
83
|
+
"ol",
|
|
84
|
+
"p",
|
|
85
|
+
"select",
|
|
86
|
+
"span",
|
|
87
|
+
"svg",
|
|
88
|
+
"ul"
|
|
89
|
+
], x = Be.reduce((e, t) => {
|
|
90
|
+
const n = H(`Primitive.${t}`), o = i.forwardRef((r, a) => {
|
|
91
|
+
const { asChild: s, ...u } = r, l = s ? n : t;
|
|
92
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(l, { ...u, ref: a });
|
|
93
|
+
});
|
|
94
|
+
return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
|
|
95
|
+
}, {});
|
|
96
|
+
function G(e, t) {
|
|
97
|
+
e && ke.flushSync(() => e.dispatchEvent(t));
|
|
98
|
+
}
|
|
99
|
+
var k = globalThis?.document ? i.useLayoutEffect : () => {
|
|
100
|
+
}, He = i[" useInsertionEffect ".trim().toString()] || k;
|
|
101
|
+
function de({
|
|
102
|
+
prop: e,
|
|
103
|
+
defaultProp: t,
|
|
104
|
+
onChange: n = () => {
|
|
105
|
+
},
|
|
106
|
+
caller: o
|
|
107
|
+
}) {
|
|
108
|
+
const [r, a, s] = Ge({
|
|
109
|
+
defaultProp: t,
|
|
110
|
+
onChange: n
|
|
111
|
+
}), u = e !== void 0, l = u ? e : r;
|
|
112
|
+
{
|
|
113
|
+
const c = i.useRef(e !== void 0);
|
|
114
|
+
i.useEffect(() => {
|
|
115
|
+
const v = c.current;
|
|
116
|
+
v !== u && console.warn(
|
|
117
|
+
`${o} is changing from ${v ? "controlled" : "uncontrolled"} to ${u ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
118
|
+
), c.current = u;
|
|
119
|
+
}, [u, o]);
|
|
120
|
+
}
|
|
121
|
+
const d = i.useCallback(
|
|
122
|
+
(c) => {
|
|
123
|
+
if (u) {
|
|
124
|
+
const v = je(c) ? c(e) : c;
|
|
125
|
+
v !== e && s.current?.(v);
|
|
126
|
+
} else
|
|
127
|
+
a(c);
|
|
128
|
+
},
|
|
129
|
+
[u, e, a, s]
|
|
130
|
+
);
|
|
131
|
+
return [l, d];
|
|
132
|
+
}
|
|
133
|
+
function Ge({
|
|
134
|
+
defaultProp: e,
|
|
135
|
+
onChange: t
|
|
136
|
+
}) {
|
|
137
|
+
const [n, o] = i.useState(e), r = i.useRef(n), a = i.useRef(t);
|
|
138
|
+
return He(() => {
|
|
139
|
+
a.current = t;
|
|
140
|
+
}, [t]), i.useEffect(() => {
|
|
141
|
+
r.current !== n && (a.current?.(n), r.current = n);
|
|
142
|
+
}, [n, r]), [n, o, a];
|
|
143
|
+
}
|
|
144
|
+
function je(e) {
|
|
145
|
+
return typeof e == "function";
|
|
146
|
+
}
|
|
147
|
+
var Ye = i.createContext(void 0);
|
|
148
|
+
function qe(e) {
|
|
149
|
+
const t = i.useContext(Ye);
|
|
150
|
+
return e || t || "ltr";
|
|
151
|
+
}
|
|
152
|
+
function Xe(e, t) {
|
|
153
|
+
return i.useReducer((n, o) => t[n][o] ?? n, e);
|
|
154
|
+
}
|
|
155
|
+
var V = (e) => {
|
|
156
|
+
const { present: t, children: n } = e, o = Je(t), r = typeof n == "function" ? n({ present: o.isPresent }) : i.Children.only(n), a = D(o.ref, Qe(r));
|
|
157
|
+
return typeof n == "function" || o.isPresent ? i.cloneElement(r, { ref: a }) : null;
|
|
158
|
+
};
|
|
159
|
+
V.displayName = "Presence";
|
|
160
|
+
function Je(e) {
|
|
161
|
+
const [t, n] = i.useState(), o = i.useRef(null), r = i.useRef(e), a = i.useRef("none"), s = e ? "mounted" : "unmounted", [u, l] = Xe(s, {
|
|
162
|
+
mounted: {
|
|
163
|
+
UNMOUNT: "unmounted",
|
|
164
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
165
|
+
},
|
|
166
|
+
unmountSuspended: {
|
|
167
|
+
MOUNT: "mounted",
|
|
168
|
+
ANIMATION_END: "unmounted"
|
|
169
|
+
},
|
|
170
|
+
unmounted: {
|
|
171
|
+
MOUNT: "mounted"
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
return i.useEffect(() => {
|
|
175
|
+
const d = U(o.current);
|
|
176
|
+
a.current = u === "mounted" ? d : "none";
|
|
177
|
+
}, [u]), k(() => {
|
|
178
|
+
const d = o.current, c = r.current;
|
|
179
|
+
if (c !== e) {
|
|
180
|
+
const p = a.current, h = U(d);
|
|
181
|
+
e ? l("MOUNT") : h === "none" || d?.display === "none" ? l("UNMOUNT") : l(c && p !== h ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
|
|
182
|
+
}
|
|
183
|
+
}, [e, l]), k(() => {
|
|
184
|
+
if (t) {
|
|
185
|
+
let d;
|
|
186
|
+
const c = t.ownerDocument.defaultView ?? window, v = (h) => {
|
|
187
|
+
const g = U(o.current).includes(CSS.escape(h.animationName));
|
|
188
|
+
if (h.target === t && g && (l("ANIMATION_END"), !r.current)) {
|
|
189
|
+
const C = t.style.animationFillMode;
|
|
190
|
+
t.style.animationFillMode = "forwards", d = c.setTimeout(() => {
|
|
191
|
+
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = C);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}, p = (h) => {
|
|
195
|
+
h.target === t && (a.current = U(o.current));
|
|
196
|
+
};
|
|
197
|
+
return t.addEventListener("animationstart", p), t.addEventListener("animationcancel", v), t.addEventListener("animationend", v), () => {
|
|
198
|
+
c.clearTimeout(d), t.removeEventListener("animationstart", p), t.removeEventListener("animationcancel", v), t.removeEventListener("animationend", v);
|
|
199
|
+
};
|
|
200
|
+
} else
|
|
201
|
+
l("ANIMATION_END");
|
|
202
|
+
}, [t, l]), {
|
|
203
|
+
isPresent: ["mounted", "unmountSuspended"].includes(u),
|
|
204
|
+
ref: i.useCallback((d) => {
|
|
205
|
+
o.current = d ? getComputedStyle(d) : null, n(d);
|
|
206
|
+
}, [])
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function U(e) {
|
|
210
|
+
return e?.animationName || "none";
|
|
211
|
+
}
|
|
212
|
+
function Qe(e) {
|
|
213
|
+
let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
214
|
+
return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
215
|
+
}
|
|
216
|
+
var Ze = i[" useId ".trim().toString()] || (() => {
|
|
217
|
+
}), et = 0;
|
|
218
|
+
function fe(e) {
|
|
219
|
+
const [t, n] = i.useState(Ze());
|
|
220
|
+
return k(() => {
|
|
221
|
+
n((o) => o ?? String(et++));
|
|
222
|
+
}, [e]), t ? `radix-${t}` : "";
|
|
223
|
+
}
|
|
224
|
+
function ve(e) {
|
|
225
|
+
const t = e + "CollectionProvider", [n, o] = le(t), [r, a] = n(
|
|
226
|
+
t,
|
|
227
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
228
|
+
), s = (g) => {
|
|
229
|
+
const { scope: C, children: M } = g, I = L.useRef(null), m = L.useRef(/* @__PURE__ */ new Map()).current;
|
|
230
|
+
return /* @__PURE__ */ f(r, { scope: C, itemMap: m, collectionRef: I, children: M });
|
|
231
|
+
};
|
|
232
|
+
s.displayName = t;
|
|
233
|
+
const u = e + "CollectionSlot", l = H(u), d = L.forwardRef(
|
|
234
|
+
(g, C) => {
|
|
235
|
+
const { scope: M, children: I } = g, m = a(u, M), w = D(C, m.collectionRef);
|
|
236
|
+
return /* @__PURE__ */ f(l, { ref: w, children: I });
|
|
237
|
+
}
|
|
238
|
+
);
|
|
239
|
+
d.displayName = u;
|
|
240
|
+
const c = e + "CollectionItemSlot", v = "data-radix-collection-item", p = H(c), h = L.forwardRef(
|
|
241
|
+
(g, C) => {
|
|
242
|
+
const { scope: M, children: I, ...m } = g, w = L.useRef(null), N = D(C, w), y = a(c, M);
|
|
243
|
+
return L.useEffect(() => (y.itemMap.set(w, { ref: w, ...m }), () => void y.itemMap.delete(w))), /* @__PURE__ */ f(p, { [v]: "", ref: N, children: I });
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
h.displayName = c;
|
|
247
|
+
function E(g) {
|
|
248
|
+
const C = a(e + "CollectionConsumer", g);
|
|
249
|
+
return L.useCallback(() => {
|
|
250
|
+
const I = C.collectionRef.current;
|
|
251
|
+
if (!I) return [];
|
|
252
|
+
const m = Array.from(I.querySelectorAll(`[${v}]`));
|
|
253
|
+
return Array.from(C.itemMap.values()).sort(
|
|
254
|
+
(y, R) => m.indexOf(y.ref.current) - m.indexOf(R.ref.current)
|
|
255
|
+
);
|
|
256
|
+
}, [C.collectionRef, C.itemMap]);
|
|
257
|
+
}
|
|
258
|
+
return [
|
|
259
|
+
{ Provider: s, Slot: d, ItemSlot: h },
|
|
260
|
+
E,
|
|
261
|
+
o
|
|
262
|
+
];
|
|
263
|
+
}
|
|
264
|
+
function _(e) {
|
|
265
|
+
const t = i.useRef(e);
|
|
266
|
+
return i.useEffect(() => {
|
|
267
|
+
t.current = e;
|
|
268
|
+
}), i.useMemo(() => (...n) => t.current?.(...n), []);
|
|
269
|
+
}
|
|
270
|
+
function tt(e, t = globalThis?.document) {
|
|
271
|
+
const n = _(e);
|
|
272
|
+
i.useEffect(() => {
|
|
273
|
+
const o = (r) => {
|
|
274
|
+
r.key === "Escape" && n(r);
|
|
275
|
+
};
|
|
276
|
+
return t.addEventListener("keydown", o, { capture: !0 }), () => t.removeEventListener("keydown", o, { capture: !0 });
|
|
277
|
+
}, [n, t]);
|
|
278
|
+
}
|
|
279
|
+
var nt = "DismissableLayer", j = "dismissableLayer.update", ot = "dismissableLayer.pointerDownOutside", rt = "dismissableLayer.focusOutside", ae, me = i.createContext({
|
|
280
|
+
layers: /* @__PURE__ */ new Set(),
|
|
281
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
282
|
+
branches: /* @__PURE__ */ new Set()
|
|
283
|
+
}), pe = i.forwardRef(
|
|
284
|
+
(e, t) => {
|
|
285
|
+
const {
|
|
286
|
+
disableOutsidePointerEvents: n = !1,
|
|
287
|
+
onEscapeKeyDown: o,
|
|
288
|
+
onPointerDownOutside: r,
|
|
289
|
+
onFocusOutside: a,
|
|
290
|
+
onInteractOutside: s,
|
|
291
|
+
onDismiss: u,
|
|
292
|
+
...l
|
|
293
|
+
} = e, d = i.useContext(me), [c, v] = i.useState(null), p = c?.ownerDocument ?? globalThis?.document, [, h] = i.useState({}), E = D(t, (R) => v(R)), g = Array.from(d.layers), [C] = [...d.layersWithOutsidePointerEventsDisabled].slice(-1), M = g.indexOf(C), I = c ? g.indexOf(c) : -1, m = d.layersWithOutsidePointerEventsDisabled.size > 0, w = I >= M, N = st((R) => {
|
|
294
|
+
const T = R.target, b = [...d.branches].some((S) => S.contains(T));
|
|
295
|
+
!w || b || (r?.(R), s?.(R), R.defaultPrevented || u?.());
|
|
296
|
+
}, p), y = ct((R) => {
|
|
297
|
+
const T = R.target;
|
|
298
|
+
[...d.branches].some((S) => S.contains(T)) || (a?.(R), s?.(R), R.defaultPrevented || u?.());
|
|
299
|
+
}, p);
|
|
300
|
+
return tt((R) => {
|
|
301
|
+
I === d.layers.size - 1 && (o?.(R), !R.defaultPrevented && u && (R.preventDefault(), u()));
|
|
302
|
+
}, p), i.useEffect(() => {
|
|
303
|
+
if (c)
|
|
304
|
+
return n && (d.layersWithOutsidePointerEventsDisabled.size === 0 && (ae = p.body.style.pointerEvents, p.body.style.pointerEvents = "none"), d.layersWithOutsidePointerEventsDisabled.add(c)), d.layers.add(c), se(), () => {
|
|
305
|
+
n && d.layersWithOutsidePointerEventsDisabled.size === 1 && (p.body.style.pointerEvents = ae);
|
|
306
|
+
};
|
|
307
|
+
}, [c, p, n, d]), i.useEffect(() => () => {
|
|
308
|
+
c && (d.layers.delete(c), d.layersWithOutsidePointerEventsDisabled.delete(c), se());
|
|
309
|
+
}, [c, d]), i.useEffect(() => {
|
|
310
|
+
const R = () => h({});
|
|
311
|
+
return document.addEventListener(j, R), () => document.removeEventListener(j, R);
|
|
312
|
+
}, []), /* @__PURE__ */ f(
|
|
313
|
+
x.div,
|
|
314
|
+
{
|
|
315
|
+
...l,
|
|
316
|
+
ref: E,
|
|
317
|
+
style: {
|
|
318
|
+
pointerEvents: m ? w ? "auto" : "none" : void 0,
|
|
319
|
+
...e.style
|
|
320
|
+
},
|
|
321
|
+
onFocusCapture: P(e.onFocusCapture, y.onFocusCapture),
|
|
322
|
+
onBlurCapture: P(e.onBlurCapture, y.onBlurCapture),
|
|
323
|
+
onPointerDownCapture: P(
|
|
324
|
+
e.onPointerDownCapture,
|
|
325
|
+
N.onPointerDownCapture
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
pe.displayName = nt;
|
|
332
|
+
var it = "DismissableLayerBranch", at = i.forwardRef((e, t) => {
|
|
333
|
+
const n = i.useContext(me), o = i.useRef(null), r = D(t, o);
|
|
334
|
+
return i.useEffect(() => {
|
|
335
|
+
const a = o.current;
|
|
336
|
+
if (a)
|
|
337
|
+
return n.branches.add(a), () => {
|
|
338
|
+
n.branches.delete(a);
|
|
339
|
+
};
|
|
340
|
+
}, [n.branches]), /* @__PURE__ */ f(x.div, { ...e, ref: r });
|
|
341
|
+
});
|
|
342
|
+
at.displayName = it;
|
|
343
|
+
function st(e, t = globalThis?.document) {
|
|
344
|
+
const n = _(e), o = i.useRef(!1), r = i.useRef(() => {
|
|
345
|
+
});
|
|
346
|
+
return i.useEffect(() => {
|
|
347
|
+
const a = (u) => {
|
|
348
|
+
if (u.target && !o.current) {
|
|
349
|
+
let l = function() {
|
|
350
|
+
ge(
|
|
351
|
+
ot,
|
|
352
|
+
n,
|
|
353
|
+
d,
|
|
354
|
+
{ discrete: !0 }
|
|
355
|
+
);
|
|
356
|
+
};
|
|
357
|
+
const d = { originalEvent: u };
|
|
358
|
+
u.pointerType === "touch" ? (t.removeEventListener("click", r.current), r.current = l, t.addEventListener("click", r.current, { once: !0 })) : l();
|
|
359
|
+
} else
|
|
360
|
+
t.removeEventListener("click", r.current);
|
|
361
|
+
o.current = !1;
|
|
362
|
+
}, s = window.setTimeout(() => {
|
|
363
|
+
t.addEventListener("pointerdown", a);
|
|
364
|
+
}, 0);
|
|
365
|
+
return () => {
|
|
366
|
+
window.clearTimeout(s), t.removeEventListener("pointerdown", a), t.removeEventListener("click", r.current);
|
|
367
|
+
};
|
|
368
|
+
}, [t, n]), {
|
|
369
|
+
// ensures we check React component tree (not just DOM tree)
|
|
370
|
+
onPointerDownCapture: () => o.current = !0
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function ct(e, t = globalThis?.document) {
|
|
374
|
+
const n = _(e), o = i.useRef(!1);
|
|
375
|
+
return i.useEffect(() => {
|
|
376
|
+
const r = (a) => {
|
|
377
|
+
a.target && !o.current && ge(rt, n, { originalEvent: a }, {
|
|
378
|
+
discrete: !1
|
|
379
|
+
});
|
|
380
|
+
};
|
|
381
|
+
return t.addEventListener("focusin", r), () => t.removeEventListener("focusin", r);
|
|
382
|
+
}, [t, n]), {
|
|
383
|
+
onFocusCapture: () => o.current = !0,
|
|
384
|
+
onBlurCapture: () => o.current = !1
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
function se() {
|
|
388
|
+
const e = new CustomEvent(j);
|
|
389
|
+
document.dispatchEvent(e);
|
|
390
|
+
}
|
|
391
|
+
function ge(e, t, n, { discrete: o }) {
|
|
392
|
+
const r = n.originalEvent.target, a = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
|
|
393
|
+
t && r.addEventListener(e, t, { once: !0 }), o ? G(r, a) : r.dispatchEvent(a);
|
|
394
|
+
}
|
|
395
|
+
function ut(e) {
|
|
396
|
+
const t = i.useRef({ value: e, previous: e });
|
|
397
|
+
return i.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
|
|
398
|
+
}
|
|
399
|
+
var lt = Object.freeze({
|
|
400
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
401
|
+
position: "absolute",
|
|
402
|
+
border: 0,
|
|
403
|
+
width: 1,
|
|
404
|
+
height: 1,
|
|
405
|
+
padding: 0,
|
|
406
|
+
margin: -1,
|
|
407
|
+
overflow: "hidden",
|
|
408
|
+
clip: "rect(0, 0, 0, 0)",
|
|
409
|
+
whiteSpace: "nowrap",
|
|
410
|
+
wordWrap: "normal"
|
|
411
|
+
}), dt = "VisuallyHidden", we = i.forwardRef(
|
|
412
|
+
(e, t) => /* @__PURE__ */ f(
|
|
413
|
+
x.span,
|
|
414
|
+
{
|
|
415
|
+
...e,
|
|
416
|
+
ref: t,
|
|
417
|
+
style: { ...lt, ...e.style }
|
|
418
|
+
}
|
|
419
|
+
)
|
|
420
|
+
);
|
|
421
|
+
we.displayName = dt;
|
|
422
|
+
var ft = we, F = "NavigationMenu", [Z, he, vt] = ve(F), [Y, mt, pt] = ve(F), [ee] = le(
|
|
423
|
+
F,
|
|
424
|
+
[vt, pt]
|
|
425
|
+
), [gt, O] = ee(F), [wt, ht] = ee(F), Ee = i.forwardRef(
|
|
426
|
+
(e, t) => {
|
|
427
|
+
const {
|
|
428
|
+
__scopeNavigationMenu: n,
|
|
429
|
+
value: o,
|
|
430
|
+
onValueChange: r,
|
|
431
|
+
defaultValue: a,
|
|
432
|
+
delayDuration: s = 200,
|
|
433
|
+
skipDelayDuration: u = 300,
|
|
434
|
+
orientation: l = "horizontal",
|
|
435
|
+
dir: d,
|
|
436
|
+
...c
|
|
437
|
+
} = e, [v, p] = i.useState(null), h = D(t, (b) => p(b)), E = qe(d), g = i.useRef(0), C = i.useRef(0), M = i.useRef(0), [I, m] = i.useState(!0), [w, N] = de({
|
|
438
|
+
prop: o,
|
|
439
|
+
onChange: (b) => {
|
|
440
|
+
const S = b !== "", B = u > 0;
|
|
441
|
+
S ? (window.clearTimeout(M.current), B && m(!1)) : (window.clearTimeout(M.current), M.current = window.setTimeout(
|
|
442
|
+
() => m(!0),
|
|
443
|
+
u
|
|
444
|
+
)), r?.(b);
|
|
445
|
+
},
|
|
446
|
+
defaultProp: a ?? "",
|
|
447
|
+
caller: F
|
|
448
|
+
}), y = i.useCallback(() => {
|
|
449
|
+
window.clearTimeout(C.current), C.current = window.setTimeout(() => N(""), 150);
|
|
450
|
+
}, [N]), R = i.useCallback(
|
|
451
|
+
(b) => {
|
|
452
|
+
window.clearTimeout(C.current), N(b);
|
|
453
|
+
},
|
|
454
|
+
[N]
|
|
455
|
+
), T = i.useCallback(
|
|
456
|
+
(b) => {
|
|
457
|
+
w === b ? window.clearTimeout(C.current) : g.current = window.setTimeout(() => {
|
|
458
|
+
window.clearTimeout(C.current), N(b);
|
|
459
|
+
}, s);
|
|
460
|
+
},
|
|
461
|
+
[w, N, s]
|
|
462
|
+
);
|
|
463
|
+
return i.useEffect(() => () => {
|
|
464
|
+
window.clearTimeout(g.current), window.clearTimeout(C.current), window.clearTimeout(M.current);
|
|
465
|
+
}, []), /* @__PURE__ */ f(
|
|
466
|
+
Ce,
|
|
467
|
+
{
|
|
468
|
+
scope: n,
|
|
469
|
+
isRootMenu: !0,
|
|
470
|
+
value: w,
|
|
471
|
+
dir: E,
|
|
472
|
+
orientation: l,
|
|
473
|
+
rootNavigationMenu: v,
|
|
474
|
+
onTriggerEnter: (b) => {
|
|
475
|
+
window.clearTimeout(g.current), I ? T(b) : R(b);
|
|
476
|
+
},
|
|
477
|
+
onTriggerLeave: () => {
|
|
478
|
+
window.clearTimeout(g.current), y();
|
|
479
|
+
},
|
|
480
|
+
onContentEnter: () => window.clearTimeout(C.current),
|
|
481
|
+
onContentLeave: y,
|
|
482
|
+
onItemSelect: (b) => {
|
|
483
|
+
N((S) => S === b ? "" : b);
|
|
484
|
+
},
|
|
485
|
+
onItemDismiss: () => N(""),
|
|
486
|
+
children: /* @__PURE__ */ f(
|
|
487
|
+
x.nav,
|
|
488
|
+
{
|
|
489
|
+
"aria-label": "Main",
|
|
490
|
+
"data-orientation": l,
|
|
491
|
+
dir: E,
|
|
492
|
+
...c,
|
|
493
|
+
ref: h
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
}
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
);
|
|
500
|
+
Ee.displayName = F;
|
|
501
|
+
var q = "NavigationMenuSub", Et = i.forwardRef(
|
|
502
|
+
(e, t) => {
|
|
503
|
+
const {
|
|
504
|
+
__scopeNavigationMenu: n,
|
|
505
|
+
value: o,
|
|
506
|
+
onValueChange: r,
|
|
507
|
+
defaultValue: a,
|
|
508
|
+
orientation: s = "horizontal",
|
|
509
|
+
...u
|
|
510
|
+
} = e, l = O(q, n), [d, c] = de({
|
|
511
|
+
prop: o,
|
|
512
|
+
onChange: r,
|
|
513
|
+
defaultProp: a ?? "",
|
|
514
|
+
caller: q
|
|
515
|
+
});
|
|
516
|
+
return /* @__PURE__ */ f(
|
|
517
|
+
Ce,
|
|
518
|
+
{
|
|
519
|
+
scope: n,
|
|
520
|
+
isRootMenu: !1,
|
|
521
|
+
value: d,
|
|
522
|
+
dir: l.dir,
|
|
523
|
+
orientation: s,
|
|
524
|
+
rootNavigationMenu: l.rootNavigationMenu,
|
|
525
|
+
onTriggerEnter: (v) => c(v),
|
|
526
|
+
onItemSelect: (v) => c(v),
|
|
527
|
+
onItemDismiss: () => c(""),
|
|
528
|
+
children: /* @__PURE__ */ f(x.div, { "data-orientation": s, ...u, ref: t })
|
|
529
|
+
}
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
);
|
|
533
|
+
Et.displayName = q;
|
|
534
|
+
var Ce = (e) => {
|
|
535
|
+
const {
|
|
536
|
+
scope: t,
|
|
537
|
+
isRootMenu: n,
|
|
538
|
+
rootNavigationMenu: o,
|
|
539
|
+
dir: r,
|
|
540
|
+
orientation: a,
|
|
541
|
+
children: s,
|
|
542
|
+
value: u,
|
|
543
|
+
onItemSelect: l,
|
|
544
|
+
onItemDismiss: d,
|
|
545
|
+
onTriggerEnter: c,
|
|
546
|
+
onTriggerLeave: v,
|
|
547
|
+
onContentEnter: p,
|
|
548
|
+
onContentLeave: h
|
|
549
|
+
} = e, [E, g] = i.useState(null), [C, M] = i.useState(/* @__PURE__ */ new Map()), [I, m] = i.useState(null);
|
|
550
|
+
return /* @__PURE__ */ f(
|
|
551
|
+
gt,
|
|
552
|
+
{
|
|
553
|
+
scope: t,
|
|
554
|
+
isRootMenu: n,
|
|
555
|
+
rootNavigationMenu: o,
|
|
556
|
+
value: u,
|
|
557
|
+
previousValue: ut(u),
|
|
558
|
+
baseId: fe(),
|
|
559
|
+
dir: r,
|
|
560
|
+
orientation: a,
|
|
561
|
+
viewport: E,
|
|
562
|
+
onViewportChange: g,
|
|
563
|
+
indicatorTrack: I,
|
|
564
|
+
onIndicatorTrackChange: m,
|
|
565
|
+
onTriggerEnter: _(c),
|
|
566
|
+
onTriggerLeave: _(v),
|
|
567
|
+
onContentEnter: _(p),
|
|
568
|
+
onContentLeave: _(h),
|
|
569
|
+
onItemSelect: _(l),
|
|
570
|
+
onItemDismiss: _(d),
|
|
571
|
+
onViewportContentChange: i.useCallback((w, N) => {
|
|
572
|
+
M((y) => (y.set(w, N), new Map(y)));
|
|
573
|
+
}, []),
|
|
574
|
+
onViewportContentRemove: i.useCallback((w) => {
|
|
575
|
+
M((N) => N.has(w) ? (N.delete(w), new Map(N)) : N);
|
|
576
|
+
}, []),
|
|
577
|
+
children: /* @__PURE__ */ f(Z.Provider, { scope: t, children: /* @__PURE__ */ f(wt, { scope: t, items: C, children: s }) })
|
|
578
|
+
}
|
|
579
|
+
);
|
|
580
|
+
}, Ne = "NavigationMenuList", ye = i.forwardRef(
|
|
581
|
+
(e, t) => {
|
|
582
|
+
const { __scopeNavigationMenu: n, ...o } = e, r = O(Ne, n), a = /* @__PURE__ */ f(x.ul, { "data-orientation": r.orientation, ...o, ref: t });
|
|
583
|
+
return /* @__PURE__ */ f(x.div, { style: { position: "relative" }, ref: r.onIndicatorTrackChange, children: /* @__PURE__ */ f(Z.Slot, { scope: n, children: r.isRootMenu ? /* @__PURE__ */ f(_e, { asChild: !0, children: a }) : a }) });
|
|
584
|
+
}
|
|
585
|
+
);
|
|
586
|
+
ye.displayName = Ne;
|
|
587
|
+
var Re = "NavigationMenuItem", [Ct, Me] = ee(Re), be = i.forwardRef(
|
|
588
|
+
(e, t) => {
|
|
589
|
+
const { __scopeNavigationMenu: n, value: o, ...r } = e, a = fe(), s = o || a || "LEGACY_REACT_AUTO_VALUE", u = i.useRef(null), l = i.useRef(null), d = i.useRef(null), c = i.useRef(() => {
|
|
590
|
+
}), v = i.useRef(!1), p = i.useCallback((E = "start") => {
|
|
591
|
+
if (u.current) {
|
|
592
|
+
c.current();
|
|
593
|
+
const g = J(u.current);
|
|
594
|
+
g.length && oe(E === "start" ? g : g.reverse());
|
|
595
|
+
}
|
|
596
|
+
}, []), h = i.useCallback(() => {
|
|
597
|
+
if (u.current) {
|
|
598
|
+
const E = J(u.current);
|
|
599
|
+
E.length && (c.current = Pt(E));
|
|
600
|
+
}
|
|
601
|
+
}, []);
|
|
602
|
+
return /* @__PURE__ */ f(
|
|
603
|
+
Ct,
|
|
604
|
+
{
|
|
605
|
+
scope: n,
|
|
606
|
+
value: s,
|
|
607
|
+
triggerRef: l,
|
|
608
|
+
contentRef: u,
|
|
609
|
+
focusProxyRef: d,
|
|
610
|
+
wasEscapeCloseRef: v,
|
|
611
|
+
onEntryKeyDown: p,
|
|
612
|
+
onFocusProxyEnter: p,
|
|
613
|
+
onRootContentClose: h,
|
|
614
|
+
onContentFocusOutside: h,
|
|
615
|
+
children: /* @__PURE__ */ f(x.li, { ...r, ref: t })
|
|
616
|
+
}
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
);
|
|
620
|
+
be.displayName = Re;
|
|
621
|
+
var X = "NavigationMenuTrigger", Ie = i.forwardRef((e, t) => {
|
|
622
|
+
const { __scopeNavigationMenu: n, disabled: o, ...r } = e, a = O(X, e.__scopeNavigationMenu), s = Me(X, e.__scopeNavigationMenu), u = i.useRef(null), l = D(u, s.triggerRef, t), d = Ae(a.baseId, s.value), c = Le(a.baseId, s.value), v = i.useRef(!1), p = i.useRef(!1), h = s.value === a.value;
|
|
623
|
+
return /* @__PURE__ */ $(ie, { children: [
|
|
624
|
+
/* @__PURE__ */ f(Z.ItemSlot, { scope: n, value: s.value, children: /* @__PURE__ */ f(De, { asChild: !0, children: /* @__PURE__ */ f(
|
|
625
|
+
x.button,
|
|
626
|
+
{
|
|
627
|
+
id: d,
|
|
628
|
+
disabled: o,
|
|
629
|
+
"data-disabled": o ? "" : void 0,
|
|
630
|
+
"data-state": re(h),
|
|
631
|
+
"aria-expanded": h,
|
|
632
|
+
"aria-controls": c,
|
|
633
|
+
...r,
|
|
634
|
+
ref: l,
|
|
635
|
+
onPointerEnter: P(e.onPointerEnter, () => {
|
|
636
|
+
p.current = !1, s.wasEscapeCloseRef.current = !1;
|
|
637
|
+
}),
|
|
638
|
+
onPointerMove: P(
|
|
639
|
+
e.onPointerMove,
|
|
640
|
+
W(() => {
|
|
641
|
+
o || p.current || s.wasEscapeCloseRef.current || v.current || (a.onTriggerEnter(s.value), v.current = !0);
|
|
642
|
+
})
|
|
643
|
+
),
|
|
644
|
+
onPointerLeave: P(
|
|
645
|
+
e.onPointerLeave,
|
|
646
|
+
W(() => {
|
|
647
|
+
o || (a.onTriggerLeave(), v.current = !1);
|
|
648
|
+
})
|
|
649
|
+
),
|
|
650
|
+
onClick: P(e.onClick, () => {
|
|
651
|
+
a.onItemSelect(s.value), p.current = h;
|
|
652
|
+
}),
|
|
653
|
+
onKeyDown: P(e.onKeyDown, (E) => {
|
|
654
|
+
const C = { horizontal: "ArrowDown", vertical: a.dir === "rtl" ? "ArrowLeft" : "ArrowRight" }[a.orientation];
|
|
655
|
+
h && E.key === C && (s.onEntryKeyDown(), E.preventDefault());
|
|
656
|
+
})
|
|
657
|
+
}
|
|
658
|
+
) }) }),
|
|
659
|
+
h && /* @__PURE__ */ $(ie, { children: [
|
|
660
|
+
/* @__PURE__ */ f(
|
|
661
|
+
ft,
|
|
662
|
+
{
|
|
663
|
+
"aria-hidden": !0,
|
|
664
|
+
tabIndex: 0,
|
|
665
|
+
ref: s.focusProxyRef,
|
|
666
|
+
onFocus: (E) => {
|
|
667
|
+
const g = s.contentRef.current, C = E.relatedTarget, M = C === u.current, I = g?.contains(C);
|
|
668
|
+
(M || !I) && s.onFocusProxyEnter(M ? "start" : "end");
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
),
|
|
672
|
+
a.viewport && /* @__PURE__ */ f("span", { "aria-owns": c })
|
|
673
|
+
] })
|
|
674
|
+
] });
|
|
675
|
+
});
|
|
676
|
+
Ie.displayName = X;
|
|
677
|
+
var Nt = "NavigationMenuLink", ce = "navigationMenu.linkSelect", Pe = i.forwardRef(
|
|
678
|
+
(e, t) => {
|
|
679
|
+
const { __scopeNavigationMenu: n, active: o, onSelect: r, ...a } = e;
|
|
680
|
+
return /* @__PURE__ */ f(De, { asChild: !0, children: /* @__PURE__ */ f(
|
|
681
|
+
x.a,
|
|
682
|
+
{
|
|
683
|
+
"data-active": o ? "" : void 0,
|
|
684
|
+
"aria-current": o ? "page" : void 0,
|
|
685
|
+
...a,
|
|
686
|
+
ref: t,
|
|
687
|
+
onClick: P(
|
|
688
|
+
e.onClick,
|
|
689
|
+
(s) => {
|
|
690
|
+
const u = s.target, l = new CustomEvent(ce, {
|
|
691
|
+
bubbles: !0,
|
|
692
|
+
cancelable: !0
|
|
693
|
+
});
|
|
694
|
+
if (u.addEventListener(ce, (d) => r?.(d), { once: !0 }), G(u, l), !l.defaultPrevented && !s.metaKey) {
|
|
695
|
+
const d = new CustomEvent(z, {
|
|
696
|
+
bubbles: !0,
|
|
697
|
+
cancelable: !0
|
|
698
|
+
});
|
|
699
|
+
G(u, d);
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
{ checkForDefaultPrevented: !1 }
|
|
703
|
+
)
|
|
704
|
+
}
|
|
705
|
+
) });
|
|
706
|
+
}
|
|
707
|
+
);
|
|
708
|
+
Pe.displayName = Nt;
|
|
709
|
+
var te = "NavigationMenuIndicator", xe = i.forwardRef((e, t) => {
|
|
710
|
+
const { forceMount: n, ...o } = e, r = O(te, e.__scopeNavigationMenu), a = !!r.value;
|
|
711
|
+
return r.indicatorTrack ? Fe.createPortal(
|
|
712
|
+
/* @__PURE__ */ f(V, { present: n || a, children: /* @__PURE__ */ f(yt, { ...o, ref: t }) }),
|
|
713
|
+
r.indicatorTrack
|
|
714
|
+
) : null;
|
|
715
|
+
});
|
|
716
|
+
xe.displayName = te;
|
|
717
|
+
var yt = i.forwardRef((e, t) => {
|
|
718
|
+
const { __scopeNavigationMenu: n, ...o } = e, r = O(te, n), a = he(n), [s, u] = i.useState(
|
|
719
|
+
null
|
|
720
|
+
), [l, d] = i.useState(null), c = r.orientation === "horizontal", v = !!r.value;
|
|
721
|
+
i.useEffect(() => {
|
|
722
|
+
const E = a().find((g) => g.value === r.value)?.ref.current;
|
|
723
|
+
E && u(E);
|
|
724
|
+
}, [a, r.value]);
|
|
725
|
+
const p = () => {
|
|
726
|
+
s && d({
|
|
727
|
+
size: c ? s.offsetWidth : s.offsetHeight,
|
|
728
|
+
offset: c ? s.offsetLeft : s.offsetTop
|
|
729
|
+
});
|
|
730
|
+
};
|
|
731
|
+
return Q(s, p), Q(r.indicatorTrack, p), l ? /* @__PURE__ */ f(
|
|
732
|
+
x.div,
|
|
733
|
+
{
|
|
734
|
+
"aria-hidden": !0,
|
|
735
|
+
"data-state": v ? "visible" : "hidden",
|
|
736
|
+
"data-orientation": r.orientation,
|
|
737
|
+
...o,
|
|
738
|
+
ref: t,
|
|
739
|
+
style: {
|
|
740
|
+
position: "absolute",
|
|
741
|
+
...c ? {
|
|
742
|
+
left: 0,
|
|
743
|
+
width: l.size + "px",
|
|
744
|
+
transform: `translateX(${l.offset}px)`
|
|
745
|
+
} : {
|
|
746
|
+
top: 0,
|
|
747
|
+
height: l.size + "px",
|
|
748
|
+
transform: `translateY(${l.offset}px)`
|
|
749
|
+
},
|
|
750
|
+
...o.style
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
) : null;
|
|
754
|
+
}), K = "NavigationMenuContent", Te = i.forwardRef((e, t) => {
|
|
755
|
+
const { forceMount: n, ...o } = e, r = O(K, e.__scopeNavigationMenu), a = Me(K, e.__scopeNavigationMenu), s = D(a.contentRef, t), u = a.value === r.value, l = {
|
|
756
|
+
value: a.value,
|
|
757
|
+
triggerRef: a.triggerRef,
|
|
758
|
+
focusProxyRef: a.focusProxyRef,
|
|
759
|
+
wasEscapeCloseRef: a.wasEscapeCloseRef,
|
|
760
|
+
onContentFocusOutside: a.onContentFocusOutside,
|
|
761
|
+
onRootContentClose: a.onRootContentClose,
|
|
762
|
+
...o
|
|
763
|
+
};
|
|
764
|
+
return r.viewport ? /* @__PURE__ */ f(Rt, { forceMount: n, ...l, ref: s }) : /* @__PURE__ */ f(V, { present: n || u, children: /* @__PURE__ */ f(
|
|
765
|
+
Se,
|
|
766
|
+
{
|
|
767
|
+
"data-state": re(u),
|
|
768
|
+
...l,
|
|
769
|
+
ref: s,
|
|
770
|
+
onPointerEnter: P(e.onPointerEnter, r.onContentEnter),
|
|
771
|
+
onPointerLeave: P(
|
|
772
|
+
e.onPointerLeave,
|
|
773
|
+
W(r.onContentLeave)
|
|
774
|
+
),
|
|
775
|
+
style: {
|
|
776
|
+
// Prevent interaction when animating out
|
|
777
|
+
pointerEvents: !u && r.isRootMenu ? "none" : void 0,
|
|
778
|
+
...l.style
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
) });
|
|
782
|
+
});
|
|
783
|
+
Te.displayName = K;
|
|
784
|
+
var Rt = i.forwardRef((e, t) => {
|
|
785
|
+
const n = O(K, e.__scopeNavigationMenu), { onViewportContentChange: o, onViewportContentRemove: r } = n;
|
|
786
|
+
return k(() => {
|
|
787
|
+
o(e.value, {
|
|
788
|
+
ref: t,
|
|
789
|
+
...e
|
|
790
|
+
});
|
|
791
|
+
}, [e, t, o]), k(() => () => r(e.value), [e.value, r]), null;
|
|
792
|
+
}), z = "navigationMenu.rootContentDismiss", Se = i.forwardRef((e, t) => {
|
|
793
|
+
const {
|
|
794
|
+
__scopeNavigationMenu: n,
|
|
795
|
+
value: o,
|
|
796
|
+
triggerRef: r,
|
|
797
|
+
focusProxyRef: a,
|
|
798
|
+
wasEscapeCloseRef: s,
|
|
799
|
+
onRootContentClose: u,
|
|
800
|
+
onContentFocusOutside: l,
|
|
801
|
+
...d
|
|
802
|
+
} = e, c = O(K, n), v = i.useRef(null), p = D(v, t), h = Ae(c.baseId, o), E = Le(c.baseId, o), g = he(n), C = i.useRef(null), { onItemDismiss: M } = c;
|
|
803
|
+
i.useEffect(() => {
|
|
804
|
+
const m = v.current;
|
|
805
|
+
if (c.isRootMenu && m) {
|
|
806
|
+
const w = () => {
|
|
807
|
+
M(), u(), m.contains(document.activeElement) && r.current?.focus();
|
|
808
|
+
};
|
|
809
|
+
return m.addEventListener(z, w), () => m.removeEventListener(z, w);
|
|
810
|
+
}
|
|
811
|
+
}, [c.isRootMenu, e.value, r, M, u]);
|
|
812
|
+
const I = i.useMemo(() => {
|
|
813
|
+
const w = g().map((S) => S.value);
|
|
814
|
+
c.dir === "rtl" && w.reverse();
|
|
815
|
+
const N = w.indexOf(c.value), y = w.indexOf(c.previousValue), R = o === c.value, T = y === w.indexOf(o);
|
|
816
|
+
if (!R && !T) return C.current;
|
|
817
|
+
const b = (() => {
|
|
818
|
+
if (N !== y) {
|
|
819
|
+
if (R && y !== -1) return N > y ? "from-end" : "from-start";
|
|
820
|
+
if (T && N !== -1) return N > y ? "to-start" : "to-end";
|
|
821
|
+
}
|
|
822
|
+
return null;
|
|
823
|
+
})();
|
|
824
|
+
return C.current = b, b;
|
|
825
|
+
}, [c.previousValue, c.value, c.dir, g, o]);
|
|
826
|
+
return /* @__PURE__ */ f(_e, { asChild: !0, children: /* @__PURE__ */ f(
|
|
827
|
+
pe,
|
|
828
|
+
{
|
|
829
|
+
id: E,
|
|
830
|
+
"aria-labelledby": h,
|
|
831
|
+
"data-motion": I,
|
|
832
|
+
"data-orientation": c.orientation,
|
|
833
|
+
...d,
|
|
834
|
+
ref: p,
|
|
835
|
+
disableOutsidePointerEvents: !1,
|
|
836
|
+
onDismiss: () => {
|
|
837
|
+
const m = new Event(z, {
|
|
838
|
+
bubbles: !0,
|
|
839
|
+
cancelable: !0
|
|
840
|
+
});
|
|
841
|
+
v.current?.dispatchEvent(m);
|
|
842
|
+
},
|
|
843
|
+
onFocusOutside: P(e.onFocusOutside, (m) => {
|
|
844
|
+
l();
|
|
845
|
+
const w = m.target;
|
|
846
|
+
c.rootNavigationMenu?.contains(w) && m.preventDefault();
|
|
847
|
+
}),
|
|
848
|
+
onPointerDownOutside: P(e.onPointerDownOutside, (m) => {
|
|
849
|
+
const w = m.target, N = g().some((R) => R.ref.current?.contains(w)), y = c.isRootMenu && c.viewport?.contains(w);
|
|
850
|
+
(N || y || !c.isRootMenu) && m.preventDefault();
|
|
851
|
+
}),
|
|
852
|
+
onKeyDown: P(e.onKeyDown, (m) => {
|
|
853
|
+
const w = m.altKey || m.ctrlKey || m.metaKey;
|
|
854
|
+
if (m.key === "Tab" && !w) {
|
|
855
|
+
const y = J(m.currentTarget), R = document.activeElement, T = y.findIndex((B) => B === R), S = m.shiftKey ? y.slice(0, T).reverse() : y.slice(T + 1, y.length);
|
|
856
|
+
oe(S) ? m.preventDefault() : a.current?.focus();
|
|
857
|
+
}
|
|
858
|
+
}),
|
|
859
|
+
onEscapeKeyDown: P(e.onEscapeKeyDown, (m) => {
|
|
860
|
+
s.current = !0;
|
|
861
|
+
})
|
|
862
|
+
}
|
|
863
|
+
) });
|
|
864
|
+
}), ne = "NavigationMenuViewport", Oe = i.forwardRef((e, t) => {
|
|
865
|
+
const { forceMount: n, ...o } = e, a = !!O(ne, e.__scopeNavigationMenu).value;
|
|
866
|
+
return /* @__PURE__ */ f(V, { present: n || a, children: /* @__PURE__ */ f(Mt, { ...o, ref: t }) });
|
|
867
|
+
});
|
|
868
|
+
Oe.displayName = ne;
|
|
869
|
+
var Mt = i.forwardRef((e, t) => {
|
|
870
|
+
const { __scopeNavigationMenu: n, children: o, ...r } = e, a = O(ne, n), s = D(t, a.onViewportChange), u = ht(
|
|
871
|
+
K,
|
|
872
|
+
e.__scopeNavigationMenu
|
|
873
|
+
), [l, d] = i.useState(null), [c, v] = i.useState(null), p = l ? l?.width + "px" : void 0, h = l ? l?.height + "px" : void 0, E = !!a.value, g = E ? a.value : a.previousValue;
|
|
874
|
+
return Q(c, () => {
|
|
875
|
+
c && d({ width: c.offsetWidth, height: c.offsetHeight });
|
|
876
|
+
}), /* @__PURE__ */ f(
|
|
877
|
+
x.div,
|
|
878
|
+
{
|
|
879
|
+
"data-state": re(E),
|
|
880
|
+
"data-orientation": a.orientation,
|
|
881
|
+
...r,
|
|
882
|
+
ref: s,
|
|
883
|
+
style: {
|
|
884
|
+
// Prevent interaction when animating out
|
|
885
|
+
pointerEvents: !E && a.isRootMenu ? "none" : void 0,
|
|
886
|
+
"--radix-navigation-menu-viewport-width": p,
|
|
887
|
+
"--radix-navigation-menu-viewport-height": h,
|
|
888
|
+
...r.style
|
|
889
|
+
},
|
|
890
|
+
onPointerEnter: P(e.onPointerEnter, a.onContentEnter),
|
|
891
|
+
onPointerLeave: P(e.onPointerLeave, W(a.onContentLeave)),
|
|
892
|
+
children: Array.from(u.items).map(([M, { ref: I, forceMount: m, ...w }]) => {
|
|
893
|
+
const N = g === M;
|
|
894
|
+
return /* @__PURE__ */ f(V, { present: m || N, children: /* @__PURE__ */ f(
|
|
895
|
+
Se,
|
|
896
|
+
{
|
|
897
|
+
...w,
|
|
898
|
+
ref: Ke(I, (y) => {
|
|
899
|
+
N && y && v(y);
|
|
900
|
+
})
|
|
901
|
+
}
|
|
902
|
+
) }, M);
|
|
903
|
+
})
|
|
904
|
+
}
|
|
905
|
+
);
|
|
906
|
+
}), bt = "FocusGroup", _e = i.forwardRef(
|
|
907
|
+
(e, t) => {
|
|
908
|
+
const { __scopeNavigationMenu: n, ...o } = e, r = O(bt, n);
|
|
909
|
+
return /* @__PURE__ */ f(Y.Provider, { scope: n, children: /* @__PURE__ */ f(Y.Slot, { scope: n, children: /* @__PURE__ */ f(x.div, { dir: r.dir, ...o, ref: t }) }) });
|
|
910
|
+
}
|
|
911
|
+
), ue = ["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"], It = "FocusGroupItem", De = i.forwardRef(
|
|
912
|
+
(e, t) => {
|
|
913
|
+
const { __scopeNavigationMenu: n, ...o } = e, r = mt(n), a = O(It, n);
|
|
914
|
+
return /* @__PURE__ */ f(Y.ItemSlot, { scope: n, children: /* @__PURE__ */ f(
|
|
915
|
+
x.button,
|
|
916
|
+
{
|
|
917
|
+
...o,
|
|
918
|
+
ref: t,
|
|
919
|
+
onKeyDown: P(e.onKeyDown, (s) => {
|
|
920
|
+
if (["Home", "End", ...ue].includes(s.key)) {
|
|
921
|
+
let l = r().map((v) => v.ref.current);
|
|
922
|
+
if ([a.dir === "rtl" ? "ArrowRight" : "ArrowLeft", "ArrowUp", "End"].includes(s.key) && l.reverse(), ue.includes(s.key)) {
|
|
923
|
+
const v = l.indexOf(s.currentTarget);
|
|
924
|
+
l = l.slice(v + 1);
|
|
925
|
+
}
|
|
926
|
+
setTimeout(() => oe(l)), s.preventDefault();
|
|
927
|
+
}
|
|
928
|
+
})
|
|
929
|
+
}
|
|
930
|
+
) });
|
|
931
|
+
}
|
|
932
|
+
);
|
|
933
|
+
function J(e) {
|
|
934
|
+
const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
935
|
+
acceptNode: (o) => {
|
|
936
|
+
const r = o.tagName === "INPUT" && o.type === "hidden";
|
|
937
|
+
return o.disabled || o.hidden || r ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
for (; n.nextNode(); ) t.push(n.currentNode);
|
|
941
|
+
return t;
|
|
942
|
+
}
|
|
943
|
+
function oe(e) {
|
|
944
|
+
const t = document.activeElement;
|
|
945
|
+
return e.some((n) => n === t ? !0 : (n.focus(), document.activeElement !== t));
|
|
946
|
+
}
|
|
947
|
+
function Pt(e) {
|
|
948
|
+
return e.forEach((t) => {
|
|
949
|
+
t.dataset.tabindex = t.getAttribute("tabindex") || "", t.setAttribute("tabindex", "-1");
|
|
950
|
+
}), () => {
|
|
951
|
+
e.forEach((t) => {
|
|
952
|
+
const n = t.dataset.tabindex;
|
|
953
|
+
t.setAttribute("tabindex", n);
|
|
954
|
+
});
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
function Q(e, t) {
|
|
958
|
+
const n = _(t);
|
|
959
|
+
k(() => {
|
|
960
|
+
let o = 0;
|
|
961
|
+
if (e) {
|
|
962
|
+
const r = new ResizeObserver(() => {
|
|
963
|
+
cancelAnimationFrame(o), o = window.requestAnimationFrame(n);
|
|
964
|
+
});
|
|
965
|
+
return r.observe(e), () => {
|
|
966
|
+
window.cancelAnimationFrame(o), r.unobserve(e);
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
}, [e, n]);
|
|
970
|
+
}
|
|
971
|
+
function re(e) {
|
|
972
|
+
return e ? "open" : "closed";
|
|
973
|
+
}
|
|
974
|
+
function Ae(e, t) {
|
|
975
|
+
return `${e}-trigger-${t}`;
|
|
976
|
+
}
|
|
977
|
+
function Le(e, t) {
|
|
978
|
+
return `${e}-content-${t}`;
|
|
979
|
+
}
|
|
980
|
+
function W(e) {
|
|
981
|
+
return (t) => t.pointerType === "mouse" ? e(t) : void 0;
|
|
982
|
+
}
|
|
983
|
+
var xt = Ee, Tt = ye, St = be, Ot = Ie, _t = Pe, Dt = xe, At = Te, Lt = Oe;
|
|
984
|
+
function Ht({
|
|
985
|
+
className: e,
|
|
986
|
+
children: t,
|
|
987
|
+
noViewport: n = !1,
|
|
988
|
+
mega: o = !1,
|
|
989
|
+
...r
|
|
990
|
+
}) {
|
|
991
|
+
return /* @__PURE__ */ $(
|
|
992
|
+
xt,
|
|
993
|
+
{
|
|
994
|
+
"data-slot": "navigation-menu",
|
|
995
|
+
"data-mega": o,
|
|
996
|
+
"data-viewport": !n || o,
|
|
997
|
+
className: A(
|
|
998
|
+
"group/navigation-menu flex max-w-max flex-1 items-center justify-center",
|
|
999
|
+
{ relative: !o },
|
|
1000
|
+
e
|
|
1001
|
+
),
|
|
1002
|
+
...r,
|
|
1003
|
+
children: [
|
|
1004
|
+
t,
|
|
1005
|
+
(!n || o) && /* @__PURE__ */ f(Ft, { mega: o })
|
|
1006
|
+
]
|
|
1007
|
+
}
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
function Gt({ className: e, ...t }) {
|
|
1011
|
+
return /* @__PURE__ */ f(
|
|
1012
|
+
Tt,
|
|
1013
|
+
{
|
|
1014
|
+
"data-slot": "navigation-menu-list",
|
|
1015
|
+
className: A("group flex flex-1 list-none items-center justify-center gap-1", e),
|
|
1016
|
+
...t
|
|
1017
|
+
}
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
function jt({ className: e, ...t }) {
|
|
1021
|
+
return /* @__PURE__ */ f(St, { "data-slot": "navigation-menu-item", className: A("relative", e), ...t });
|
|
1022
|
+
}
|
|
1023
|
+
const kt = Ve({
|
|
1024
|
+
variant: "ghost",
|
|
1025
|
+
className: "data-[state=open]:hover:text-secondary data-[state=open]:focus:text-secondary data-[state=open]:text-secondary"
|
|
1026
|
+
});
|
|
1027
|
+
function Yt({
|
|
1028
|
+
className: e,
|
|
1029
|
+
children: t,
|
|
1030
|
+
...n
|
|
1031
|
+
}) {
|
|
1032
|
+
return /* @__PURE__ */ $(
|
|
1033
|
+
Ot,
|
|
1034
|
+
{
|
|
1035
|
+
"data-slot": "navigation-menu-trigger",
|
|
1036
|
+
className: A(kt, "group", e),
|
|
1037
|
+
...n,
|
|
1038
|
+
children: [
|
|
1039
|
+
t,
|
|
1040
|
+
" ",
|
|
1041
|
+
/* @__PURE__ */ f(
|
|
1042
|
+
$e,
|
|
1043
|
+
{
|
|
1044
|
+
className: "relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180",
|
|
1045
|
+
"aria-hidden": "true"
|
|
1046
|
+
}
|
|
1047
|
+
)
|
|
1048
|
+
]
|
|
1049
|
+
}
|
|
1050
|
+
);
|
|
1051
|
+
}
|
|
1052
|
+
function qt({ className: e, ...t }) {
|
|
1053
|
+
return /* @__PURE__ */ f(
|
|
1054
|
+
At,
|
|
1055
|
+
{
|
|
1056
|
+
"data-slot": "navigation-menu-content",
|
|
1057
|
+
className: A(
|
|
1058
|
+
"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",
|
|
1059
|
+
"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",
|
|
1060
|
+
"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",
|
|
1061
|
+
"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",
|
|
1062
|
+
e
|
|
1063
|
+
),
|
|
1064
|
+
...t
|
|
1065
|
+
}
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
function Ft({
|
|
1069
|
+
className: e,
|
|
1070
|
+
mega: t = !1,
|
|
1071
|
+
...n
|
|
1072
|
+
}) {
|
|
1073
|
+
return /* @__PURE__ */ f(
|
|
1074
|
+
"div",
|
|
1075
|
+
{
|
|
1076
|
+
className: A("absolute top-full left-0 isolate z-50 flex justify-center bg-popover", {
|
|
1077
|
+
"min-w-xs": !t,
|
|
1078
|
+
"w-full px-(--spacing-section)": t
|
|
1079
|
+
}),
|
|
1080
|
+
children: /* @__PURE__ */ f(
|
|
1081
|
+
Lt,
|
|
1082
|
+
{
|
|
1083
|
+
"data-slot": "navigation-menu-viewport",
|
|
1084
|
+
className: A(
|
|
1085
|
+
"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",
|
|
1086
|
+
"bg-popover text-popover-foreground relative overflow-hidden w-full h-[var(--radix-navigation-menu-viewport-height)] overscroll-contain",
|
|
1087
|
+
{
|
|
1088
|
+
"mt-1.5 rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]": !t,
|
|
1089
|
+
"border-b-1 border-complement-1-50": t
|
|
1090
|
+
},
|
|
1091
|
+
e
|
|
1092
|
+
),
|
|
1093
|
+
...n
|
|
1094
|
+
}
|
|
1095
|
+
)
|
|
1096
|
+
}
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
1099
|
+
function Xt({ className: e, ...t }) {
|
|
1100
|
+
return /* @__PURE__ */ f(
|
|
1101
|
+
_t,
|
|
1102
|
+
{
|
|
1103
|
+
"data-slot": "navigation-menu-link",
|
|
1104
|
+
className: A(
|
|
1105
|
+
"[&_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",
|
|
1106
|
+
e
|
|
1107
|
+
),
|
|
1108
|
+
...t
|
|
1109
|
+
}
|
|
1110
|
+
);
|
|
1111
|
+
}
|
|
1112
|
+
function Jt({
|
|
1113
|
+
className: e,
|
|
1114
|
+
...t
|
|
1115
|
+
}) {
|
|
1116
|
+
return /* @__PURE__ */ f(
|
|
1117
|
+
Dt,
|
|
1118
|
+
{
|
|
1119
|
+
"data-slot": "navigation-menu-indicator",
|
|
1120
|
+
className: A(
|
|
1121
|
+
"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",
|
|
1122
|
+
e
|
|
1123
|
+
),
|
|
1124
|
+
...t,
|
|
1125
|
+
children: /* @__PURE__ */ f("div", { className: "bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" })
|
|
1126
|
+
}
|
|
1127
|
+
);
|
|
1128
|
+
}
|
|
1129
|
+
export {
|
|
1130
|
+
Ht as NavigationMenu,
|
|
1131
|
+
qt as NavigationMenuContent,
|
|
1132
|
+
Jt as NavigationMenuIndicator,
|
|
1133
|
+
jt as NavigationMenuItem,
|
|
1134
|
+
Xt as NavigationMenuLink,
|
|
1135
|
+
Gt as NavigationMenuList,
|
|
1136
|
+
Yt as NavigationMenuTrigger,
|
|
1137
|
+
Ft as NavigationMenuViewport,
|
|
1138
|
+
kt as navigationMenuTriggerStyle
|
|
1139
|
+
};
|