notchbar 0.0.0-stage → 0.2.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/index.js ADDED
@@ -0,0 +1,563 @@
1
+ "use client";
2
+
3
+ // src/Notchbar.tsx
4
+ import {
5
+ AnimatePresence,
6
+ animate,
7
+ motion,
8
+ useMotionValue,
9
+ useMotionValueEvent,
10
+ useReducedMotion,
11
+ useScroll
12
+ } from "motion/react";
13
+ import {
14
+ createContext,
15
+ useContext,
16
+ useEffect,
17
+ useId,
18
+ useRef,
19
+ useState
20
+ } from "react";
21
+ import { jsx, jsxs } from "react/jsx-runtime";
22
+ var isMenu = (i) => "panel" in i;
23
+ var springIn = { type: "spring", duration: 0.5, bounce: 0.1 };
24
+ var springOut = { type: "spring", duration: 0.68, bounce: 0.24 };
25
+ var ease = [0.22, 1, 0.36, 1];
26
+ var STROKES = [
27
+ "M2 5.2 C18 3.6 40 3.4 58 4.2 S74 5.6 78 3.2",
28
+ "M2 4.2 C20 5.6 42 3.2 60 3.9 S73 4.9 78 2.8",
29
+ "M2 5 C16 4 36 4.8 54 3.7 S72 3.3 78 4.7",
30
+ "M2 3.9 C22 4.9 44 4.5 62 3.4 S75 3.6 78 5.1"
31
+ ];
32
+ var SHOULDER = 18;
33
+ var LinkContext = createContext("a");
34
+ var PanelCtx = createContext({ close: () => {
35
+ }, reduced: false });
36
+ var usePanel = () => useContext(PanelCtx);
37
+ function NavLink(props) {
38
+ const Comp = useContext(LinkContext);
39
+ return /* @__PURE__ */ jsx(Comp, { ...props });
40
+ }
41
+ function Notchbar({
42
+ brand,
43
+ items,
44
+ cta,
45
+ linkComponent = "a",
46
+ accent = "#e5484d",
47
+ maxWidth = 1024,
48
+ compactAt = 56,
49
+ expandAt = 24,
50
+ state = "auto",
51
+ className
52
+ }) {
53
+ const reduced = useReducedMotion() ?? false;
54
+ const { scrollY } = useScroll();
55
+ const [scrolled, setScrolled] = useState(false);
56
+ const compact = state === "auto" ? scrolled : state === "glass";
57
+ const [hover, setHover] = useState(null);
58
+ const [section, setSection] = useState(null);
59
+ const [open, setOpen] = useState(null);
60
+ const [mobile, setMobile] = useState(false);
61
+ const [size, setSize] = useState(null);
62
+ const closeTimer = useRef(void 0);
63
+ const navRef = useRef(null);
64
+ const logoRef = useRef(null);
65
+ const listRef = useRef(null);
66
+ const rightRef = useRef(null);
67
+ const panelId = useId();
68
+ useMotionValueEvent(scrollY, "change", (v) => {
69
+ if (!scrolled && v > compactAt) setScrolled(true);
70
+ else if (scrolled && v < expandAt) setScrolled(false);
71
+ });
72
+ const height = useMotionValue(60);
73
+ const settled = useRef(false);
74
+ useEffect(() => {
75
+ if (!settled.current || reduced) {
76
+ settled.current = true;
77
+ height.set(compact ? 52 : 60);
78
+ return;
79
+ }
80
+ const d = compact ? 1 : -1;
81
+ const timing = (dur) => ({ duration: dur, times: [0, 0.3, 0.68, 1], ease: ["easeOut", "easeInOut", "easeInOut"] });
82
+ const run = [
83
+ animate(height, compact ? [height.get(), 48.5, 52.8, 52] : [height.get(), 63.5, 59.6, 60], {
84
+ duration: compact ? 0.6 : 0.78,
85
+ times: [0, 0.34, 0.7, 1],
86
+ ease: ["easeOut", "easeInOut", "easeInOut"]
87
+ }),
88
+ logoRef.current && animate(logoRef.current, { x: [null, -6 * d, 1.6 * d, 0] }, timing(compact ? 0.58 : 0.74)),
89
+ rightRef.current && animate(rightRef.current, { x: [null, 6 * d, -1.6 * d, 0] }, timing(compact ? 0.58 : 0.74)),
90
+ listRef.current && animate(listRef.current, { scale: compact ? [null, 0.97, 1.006, 1] : [null, 1.02, 0.996, 1] }, timing(compact ? 0.56 : 0.72))
91
+ ];
92
+ return () => run.forEach((c) => c && c.stop());
93
+ }, [compact, reduced, height]);
94
+ useEffect(() => {
95
+ const measure = () => {
96
+ const md = window.matchMedia("(min-width: 768px)").matches;
97
+ const parts = [logoRef, listRef, rightRef].map((r) => r.current?.offsetWidth ?? 0).filter((w) => w > 0);
98
+ const gap = md ? 28 : 10;
99
+ const wide = Math.min(maxWidth, window.innerWidth - 52);
100
+ const tight = parts.reduce((a, b) => a + b, 0) + gap * (parts.length - 1) + 16 + 6;
101
+ setSize({ wide, tight: Math.min(tight, wide) });
102
+ };
103
+ measure();
104
+ document.fonts?.ready.then(measure);
105
+ window.addEventListener("resize", measure);
106
+ return () => window.removeEventListener("resize", measure);
107
+ }, [maxWidth, items]);
108
+ useEffect(() => {
109
+ const ua = navigator.userAgent;
110
+ const ok = /Chrome\/|Edg\//.test(ua) && !/Firefox\//.test(ua) && CSS.supports?.("backdrop-filter", "url(#a)") === true;
111
+ if (ok) navRef.current?.setAttribute("data-refract", "");
112
+ }, []);
113
+ useEffect(() => {
114
+ const ids = items.filter((i) => !isMenu(i) && i.href.startsWith("#")).map((i) => i.href.slice(1));
115
+ const els = ids.map((id) => document.getElementById(id)).filter((e) => !!e);
116
+ if (!els.length) return;
117
+ const io = new IntersectionObserver(
118
+ (entries) => {
119
+ for (const e of entries) {
120
+ if (e.isIntersecting) setSection(e.target.id);
121
+ else setSection((s) => s === e.target.id ? null : s);
122
+ }
123
+ },
124
+ { rootMargin: "-45% 0px -45% 0px" }
125
+ );
126
+ els.forEach((el) => io.observe(el));
127
+ return () => io.disconnect();
128
+ }, [items]);
129
+ useEffect(() => {
130
+ const onKey = (e) => {
131
+ if (e.key === "Escape") {
132
+ setOpen(null);
133
+ setMobile(false);
134
+ }
135
+ };
136
+ window.addEventListener("keydown", onKey);
137
+ return () => window.removeEventListener("keydown", onKey);
138
+ }, []);
139
+ const keepMenu = () => window.clearTimeout(closeTimer.current);
140
+ const showMenu = (index) => {
141
+ keepMenu();
142
+ setOpen((o) => o?.index === index ? o : { index, dir: o ? Math.sign(index - o.index) : 0 });
143
+ };
144
+ const toggleMenu = (index) => {
145
+ keepMenu();
146
+ setOpen((o) => o?.index === index ? null : { index, dir: 0 });
147
+ };
148
+ const closeMenuSoon = () => {
149
+ keepMenu();
150
+ closeTimer.current = window.setTimeout(() => setOpen(null), 160);
151
+ };
152
+ const onGlassMove = (e) => {
153
+ if (e.pointerType !== "mouse" || !navRef.current) return;
154
+ const r = navRef.current.getBoundingClientRect();
155
+ navRef.current.style.setProperty("--nb-mx", `${e.clientX - r.left + SHOULDER}px`);
156
+ navRef.current.style.setProperty("--nb-my", `${e.clientY - r.top}px`);
157
+ };
158
+ const sectionIndex = section === null ? null : items.findIndex((i) => !isMenu(i) && i.href === `#${section}`);
159
+ const strokeAt = hover ?? open?.index ?? sectionIndex;
160
+ const t = reduced ? { duration: 0 } : compact ? springIn : springOut;
161
+ const box = compact ? { width: size?.tight, paddingLeft: 16, paddingRight: 6 } : { width: size?.wide, paddingLeft: 20, paddingRight: 8 };
162
+ const openItem = open ? items[open.index] : null;
163
+ return /* @__PURE__ */ jsx(LinkContext.Provider, { value: linkComponent, children: /* @__PURE__ */ jsxs("header", { className: `nb${className ? ` ${className}` : ""}`, style: { "--nb-accent": accent, "--nb-max": `${maxWidth}px` }, children: [
164
+ /* @__PURE__ */ jsx(RefractFilter, {}),
165
+ /* @__PURE__ */ jsxs("div", { className: "nb-wrap", onPointerLeave: (e) => e.pointerType === "mouse" && closeMenuSoon(), children: [
166
+ /* @__PURE__ */ jsxs(
167
+ motion.nav,
168
+ {
169
+ ref: navRef,
170
+ "aria-label": "Main",
171
+ "data-compact": compact || void 0,
172
+ className: "nb-tab",
173
+ initial: false,
174
+ animate: size ? box : void 0,
175
+ style: { height },
176
+ transition: t,
177
+ onPointerMove: onGlassMove,
178
+ children: [
179
+ /* @__PURE__ */ jsx(TabShape, { navRef }),
180
+ /* @__PURE__ */ jsx("div", { ref: logoRef, className: "nb-brand", children: /* @__PURE__ */ jsxs(NavLink, { href: brand.href ?? "/", "aria-label": brand.label ?? `${brand.name}, home`, className: "nb-brand-link", children: [
181
+ brand.mark ?? /* @__PURE__ */ jsx(Mark, {}),
182
+ /* @__PURE__ */ jsx("span", { className: "nb-brand-name", children: brand.name })
183
+ ] }) }),
184
+ /* @__PURE__ */ jsx("ul", { ref: listRef, className: "nb-list nb-spot", onPointerLeave: () => setHover(null), children: items.map((item, i) => /* @__PURE__ */ jsx("li", { className: "nb-spot-item", children: isMenu(item) ? /* @__PURE__ */ jsxs(
185
+ "button",
186
+ {
187
+ type: "button",
188
+ "aria-expanded": open?.index === i,
189
+ "aria-controls": panelId,
190
+ "data-active": open?.index === i || void 0,
191
+ className: "nb-item",
192
+ onClick: () => toggleMenu(i),
193
+ onPointerEnter: (e) => {
194
+ if (e.pointerType !== "mouse") return;
195
+ setHover(i);
196
+ showMenu(i);
197
+ },
198
+ onFocus: () => setHover(i),
199
+ onBlur: () => setHover(null),
200
+ children: [
201
+ item.label,
202
+ /* @__PURE__ */ jsx(
203
+ motion.svg,
204
+ {
205
+ width: "10",
206
+ height: "10",
207
+ viewBox: "0 0 10 10",
208
+ "aria-hidden": true,
209
+ animate: { rotate: open?.index === i ? 180 : 0 },
210
+ transition: reduced ? { duration: 0 } : { type: "spring", duration: 0.35, bounce: 0.3 },
211
+ children: /* @__PURE__ */ jsx("path", { d: "M2 3.75 5 6.75l3-3", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" })
212
+ }
213
+ ),
214
+ /* @__PURE__ */ jsx(Stroke, { show: strokeAt === i, d: STROKES[i % STROKES.length], tilt: i % 2 ? -1.2 : 0.8, reduced })
215
+ ]
216
+ }
217
+ ) : /* @__PURE__ */ jsxs(
218
+ NavLink,
219
+ {
220
+ href: item.href,
221
+ className: "nb-item",
222
+ "data-active": sectionIndex === i || void 0,
223
+ onPointerEnter: () => {
224
+ setHover(i);
225
+ closeMenuSoon();
226
+ },
227
+ onFocus: () => setHover(i),
228
+ onBlur: () => setHover(null),
229
+ children: [
230
+ item.label,
231
+ /* @__PURE__ */ jsx(Stroke, { show: strokeAt === i, d: STROKES[i % STROKES.length], tilt: i % 2 ? -0.6 : 0.8, reduced })
232
+ ]
233
+ }
234
+ ) }, item.label)) }),
235
+ /* @__PURE__ */ jsxs("div", { ref: rightRef, className: "nb-right", children: [
236
+ cta && /* @__PURE__ */ jsx(Cta, { ...cta }),
237
+ /* @__PURE__ */ jsx(
238
+ "button",
239
+ {
240
+ type: "button",
241
+ "aria-label": mobile ? "Close menu" : "Open menu",
242
+ "aria-expanded": mobile,
243
+ onClick: () => setMobile((m) => !m),
244
+ className: "nb-burger",
245
+ children: /* @__PURE__ */ jsx(Burger, { open: mobile, reduced })
246
+ }
247
+ )
248
+ ] })
249
+ ]
250
+ }
251
+ ),
252
+ /* @__PURE__ */ jsx(AnimatePresence, { children: open && openItem && isMenu(openItem) && /* @__PURE__ */ jsx(
253
+ motion.div,
254
+ {
255
+ id: panelId,
256
+ onPointerEnter: (e) => e.pointerType === "mouse" && keepMenu(),
257
+ className: "nb-drop",
258
+ initial: reduced ? { opacity: 0 } : { opacity: 0, y: -8, scale: 0.96, filter: "blur(6px)" },
259
+ animate: { opacity: 1, y: 0, scale: 1, filter: "blur(0px)" },
260
+ exit: reduced ? { opacity: 0 } : { opacity: 0, y: -4, scale: 0.98, filter: "blur(3px)", transition: { duration: 0.16, ease } },
261
+ transition: reduced ? { duration: 0.12 } : { type: "spring", duration: 0.45, bounce: 0.22, opacity: { duration: 0.2, ease }, filter: { duration: 0.22, ease } },
262
+ style: { transformOrigin: "50% 0%" },
263
+ children: /* @__PURE__ */ jsx(MenuPanel, { items, open, reduced, close: () => setOpen(null) })
264
+ },
265
+ "menu"
266
+ ) }),
267
+ /* @__PURE__ */ jsx(AnimatePresence, { children: mobile && /* @__PURE__ */ jsx(
268
+ motion.div,
269
+ {
270
+ className: "nb-mobile",
271
+ initial: reduced ? { opacity: 0 } : { opacity: 0, y: -8, scale: 0.98 },
272
+ animate: { opacity: 1, y: 0, scale: 1 },
273
+ exit: { opacity: 0, y: -4, transition: { duration: 0.14, ease } },
274
+ transition: reduced ? { duration: 0.12 } : { type: "spring", duration: 0.4, bounce: 0.12, opacity: { duration: 0.18 } },
275
+ style: { transformOrigin: "50% 0%" },
276
+ children: /* @__PURE__ */ jsx(MobilePanel, { items, close: () => setMobile(false) })
277
+ },
278
+ "mobile"
279
+ ) })
280
+ ] })
281
+ ] }) });
282
+ }
283
+ function tabPath(w, h, open = false) {
284
+ const S = SHOULDER;
285
+ const T = w + 2 * S;
286
+ const r = Math.max(10, Math.min(22 + (60 - h) * 0.5, h - S, w / 2));
287
+ const d = `M0 0A${S} ${S} 0 0 1 ${S} ${S}V${h - r}A${r} ${r} 0 0 0 ${S + r} ${h}H${S + w - r}A${r} ${r} 0 0 0 ${S + w} ${h - r}V${S}A${S} ${S} 0 0 1 ${T} 0`;
288
+ return open ? d : `${d}Z`;
289
+ }
290
+ function TabShape({ navRef }) {
291
+ const root = useRef(null);
292
+ const uid = useId().replace(/[^a-zA-Z0-9_-]/g, "");
293
+ useEffect(() => {
294
+ const nav = navRef.current;
295
+ const el = root.current;
296
+ if (!nav || !el) return;
297
+ const shapes = el.querySelectorAll("[data-shape]");
298
+ const edges = el.querySelectorAll("[data-edge]");
299
+ const fills = el.querySelectorAll("[data-fill]");
300
+ let last = "";
301
+ const trace = () => {
302
+ const w = nav.offsetWidth;
303
+ const h = nav.offsetHeight;
304
+ const key = `${w}x${h}`;
305
+ if (key === last || !w || !h) return;
306
+ last = key;
307
+ const closed = tabPath(w, h);
308
+ const open = tabPath(w, h, true);
309
+ shapes.forEach((p) => p.setAttribute("d", closed));
310
+ edges.forEach((p) => p.setAttribute("d", open));
311
+ fills.forEach((f) => f.style.clipPath = `path("${closed}")`);
312
+ };
313
+ trace();
314
+ const ro = new ResizeObserver(trace);
315
+ ro.observe(nav);
316
+ return () => ro.disconnect();
317
+ }, [navRef]);
318
+ return /* @__PURE__ */ jsxs("span", { ref: root, "aria-hidden": true, className: "nb-shape", children: [
319
+ /* @__PURE__ */ jsx("span", { "data-fill": true, className: "nb-glass" }),
320
+ /* @__PURE__ */ jsx("span", { "data-fill": true, className: "nb-paper" }),
321
+ /* @__PURE__ */ jsx("span", { "data-fill": true, className: "nb-sheen" }),
322
+ /* @__PURE__ */ jsx("span", { "data-fill": true, className: "nb-glint" }),
323
+ /* @__PURE__ */ jsxs("svg", { className: "nb-outline", width: "100%", height: "100%", children: [
324
+ /* @__PURE__ */ jsxs("defs", { children: [
325
+ /* @__PURE__ */ jsxs("mask", { id: `${uid}-out`, maskUnits: "userSpaceOnUse", x: "-200", y: "-200", width: "4000", height: "600", children: [
326
+ /* @__PURE__ */ jsx("rect", { x: "-200", y: "-200", width: "4000", height: "600", fill: "#fff" }),
327
+ /* @__PURE__ */ jsx("path", { "data-shape": true, fill: "#000" })
328
+ ] }),
329
+ /* @__PURE__ */ jsx("clipPath", { id: `${uid}-in`, children: /* @__PURE__ */ jsx("path", { "data-shape": true }) }),
330
+ /* @__PURE__ */ jsx("filter", { id: `${uid}-contact`, x: "-5%", y: "-20%", width: "110%", height: "160%", children: /* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: "1.2" }) }),
331
+ /* @__PURE__ */ jsx("filter", { id: `${uid}-ambient`, x: "-10%", y: "-60%", width: "120%", height: "320%", children: /* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: "9" }) })
332
+ ] }),
333
+ /* @__PURE__ */ jsxs("g", { mask: `url(#${uid}-out)`, children: [
334
+ /* @__PURE__ */ jsx("path", { "data-shape": true, className: "nb-drop-shadow nb-drop-contact", filter: `url(#${uid}-contact)`, transform: "translate(0 1)" }),
335
+ /* @__PURE__ */ jsx("path", { "data-shape": true, className: "nb-drop-shadow nb-drop-ambient", filter: `url(#${uid}-ambient)`, transform: "translate(0 6)" }),
336
+ /* @__PURE__ */ jsx("path", { "data-edge": true, className: "nb-hairline", fill: "none", strokeWidth: "2" })
337
+ ] }),
338
+ /* @__PURE__ */ jsx("path", { "data-edge": true, className: "nb-rim", fill: "none", strokeWidth: "2", clipPath: `url(#${uid}-in)` })
339
+ ] })
340
+ ] });
341
+ }
342
+ function RefractFilter() {
343
+ return /* @__PURE__ */ jsx("svg", { width: "0", height: "0", style: { position: "absolute" }, "aria-hidden": true, children: /* @__PURE__ */ jsxs("filter", { id: "nb-refract", x: "0", y: "0", width: "100%", height: "100%", colorInterpolationFilters: "sRGB", children: [
344
+ /* @__PURE__ */ jsx("feTurbulence", { type: "fractalNoise", baseFrequency: "0.008 0.03", numOctaves: "2", seed: "7", result: "noise" }),
345
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "noise", stdDeviation: "2", result: "soft" }),
346
+ /* @__PURE__ */ jsx("feDisplacementMap", { in: "SourceGraphic", in2: "soft", scale: "28", xChannelSelector: "R", yChannelSelector: "G" })
347
+ ] }) });
348
+ }
349
+ function Stroke({ show, d, tilt, reduced }) {
350
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: show && /* @__PURE__ */ jsx(
351
+ motion.svg,
352
+ {
353
+ "aria-hidden": true,
354
+ viewBox: "0 0 80 8",
355
+ preserveAspectRatio: "none",
356
+ className: "nb-stroke",
357
+ style: { rotate: tilt },
358
+ initial: { opacity: 1 },
359
+ animate: { opacity: 1, y: 0 },
360
+ exit: reduced ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, y: -1.5, transition: { duration: 0.22, ease } },
361
+ children: /* @__PURE__ */ jsx(
362
+ motion.path,
363
+ {
364
+ d,
365
+ fill: "none",
366
+ style: { stroke: "var(--nb-accent)" },
367
+ strokeWidth: 1.9,
368
+ strokeLinecap: "round",
369
+ initial: { pathLength: reduced ? 1 : 0 },
370
+ animate: { pathLength: 1 },
371
+ transition: reduced ? { duration: 0 } : { duration: 0.32, ease: [0.25, 0.9, 0.3, 1] }
372
+ }
373
+ )
374
+ }
375
+ ) });
376
+ }
377
+ function MenuPanel({ items, open, reduced, close }) {
378
+ const inner = useRef(null);
379
+ const [h, setH] = useState(null);
380
+ useEffect(() => {
381
+ const el = inner.current;
382
+ if (!el) return;
383
+ const ro = new ResizeObserver(() => setH(el.offsetHeight));
384
+ ro.observe(el);
385
+ return () => ro.disconnect();
386
+ }, []);
387
+ const item = items[open.index];
388
+ const width = item.width ?? "36rem";
389
+ const shift = 28 * open.dir;
390
+ return /* @__PURE__ */ jsx(
391
+ motion.div,
392
+ {
393
+ className: "nb-panel",
394
+ initial: false,
395
+ animate: { width, height: h ?? "auto" },
396
+ transition: reduced ? { duration: 0 } : { type: "spring", duration: 0.42, bounce: 0.16 },
397
+ children: /* @__PURE__ */ jsx("div", { ref: inner, className: "nb-panel-inner", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: shift, children: /* @__PURE__ */ jsx(
398
+ motion.div,
399
+ {
400
+ custom: shift,
401
+ variants: {
402
+ enter: (x) => reduced ? { opacity: 0 } : { opacity: 0, x, filter: "blur(4px)" },
403
+ center: { opacity: 1, x: 0, filter: "blur(0px)" },
404
+ exit: (x) => reduced ? { opacity: 0 } : { opacity: 0, x: -x, filter: "blur(4px)" }
405
+ },
406
+ initial: "enter",
407
+ animate: "center",
408
+ exit: "exit",
409
+ transition: reduced ? { duration: 0.1 } : { type: "spring", duration: 0.38, bounce: 0.1, opacity: { duration: 0.18 } },
410
+ style: { width },
411
+ children: /* @__PURE__ */ jsx(PanelCtx.Provider, { value: { close, reduced }, children: item.panel({ close, reduced }) })
412
+ },
413
+ open.index
414
+ ) }) })
415
+ }
416
+ );
417
+ }
418
+ var rowIn = (i, reduced) => reduced ? {} : {
419
+ initial: { opacity: 0, y: 5 },
420
+ animate: { opacity: 1, y: 0 },
421
+ transition: { duration: 0.32, ease, delay: 0.03 + i * 0.03 }
422
+ };
423
+ function Arrow() {
424
+ return /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": true, className: "nb-row-arrow", children: /* @__PURE__ */ jsx("path", { d: "M2.5 6h7M6.5 3 9.5 6l-3 3", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }) });
425
+ }
426
+ function PanelHeader({ title, aside }) {
427
+ return /* @__PURE__ */ jsxs("div", { className: "nb-ph", children: [
428
+ /* @__PURE__ */ jsx("p", { className: "nb-mono", children: title }),
429
+ aside && /* @__PURE__ */ jsx("p", { className: "nb-mono nb-ph-aside", children: aside })
430
+ ] });
431
+ }
432
+ function PanelRows({ rows }) {
433
+ const { close, reduced } = usePanel();
434
+ return /* @__PURE__ */ jsx("ul", { className: "nb-spot nb-rows", children: rows.map((r, i) => /* @__PURE__ */ jsx(motion.li, { className: "nb-spot-item", ...rowIn(i, reduced), children: /* @__PURE__ */ jsxs(NavLink, { href: r.href, onClick: close, className: "nb-row nb-row--wide", children: [
435
+ /* @__PURE__ */ jsxs("span", { className: "nb-row-title", children: [
436
+ /* @__PURE__ */ jsx("span", { className: "nb-truncate", children: r.title }),
437
+ r.badge
438
+ ] }),
439
+ r.meta && /* @__PURE__ */ jsx("span", { className: "nb-row-meta", children: r.meta }),
440
+ /* @__PURE__ */ jsx(Arrow, {})
441
+ ] }) }, r.href)) });
442
+ }
443
+ function PanelCards({ items }) {
444
+ const { close, reduced } = usePanel();
445
+ return /* @__PURE__ */ jsx("ul", { className: "nb-spot nb-cards", children: items.map((c, i) => /* @__PURE__ */ jsx(motion.li, { className: "nb-spot-item", ...rowIn(i, reduced), children: /* @__PURE__ */ jsxs(NavLink, { href: c.href, onClick: close, className: "nb-row nb-card", children: [
446
+ c.icon && /* @__PURE__ */ jsx("span", { className: "nb-glyph", children: c.icon }),
447
+ /* @__PURE__ */ jsxs("span", { className: "nb-card-copy", children: [
448
+ /* @__PURE__ */ jsx("span", { className: "nb-card-title", children: c.title }),
449
+ c.text && /* @__PURE__ */ jsx("span", { className: "nb-card-text", children: c.text })
450
+ ] }),
451
+ /* @__PURE__ */ jsx(Arrow, {})
452
+ ] }) }, c.href)) });
453
+ }
454
+ function PanelGrid({ title, links }) {
455
+ const { close, reduced } = usePanel();
456
+ return /* @__PURE__ */ jsxs("div", { className: "nb-grid-wrap", children: [
457
+ title && /* @__PURE__ */ jsx("p", { className: "nb-mono nb-grid-title", children: title }),
458
+ /* @__PURE__ */ jsx("ul", { className: "nb-spot nb-grid", children: links.map((l, i) => /* @__PURE__ */ jsx(motion.li, { className: "nb-spot-item", ...rowIn(i * 0.5 + 1, reduced), children: /* @__PURE__ */ jsxs(NavLink, { href: l.href, onClick: close, className: "nb-row nb-grid-link", children: [
459
+ /* @__PURE__ */ jsx("span", { className: "nb-truncate", children: l.label }),
460
+ /* @__PURE__ */ jsx(Arrow, {})
461
+ ] }) }, l.href)) })
462
+ ] });
463
+ }
464
+ function PanelSplit({ left, right, leftWidth = "17rem" }) {
465
+ return /* @__PURE__ */ jsxs("div", { className: "nb-split", style: { gridTemplateColumns: `${leftWidth} 1fr` }, children: [
466
+ /* @__PURE__ */ jsx("div", { children: left }),
467
+ /* @__PURE__ */ jsx("div", { className: "nb-split-right", children: right })
468
+ ] });
469
+ }
470
+ function PanelFooter({ children }) {
471
+ return /* @__PURE__ */ jsx("div", { className: "nb-pf", children });
472
+ }
473
+ function PanelLink({ href, children }) {
474
+ const { close } = usePanel();
475
+ return /* @__PURE__ */ jsx(NavLink, { href, onClick: close, className: "nb-link", children });
476
+ }
477
+ function NewMark({ label = "New" }) {
478
+ const { reduced } = usePanel();
479
+ return /* @__PURE__ */ jsxs("span", { className: "nb-new", children: [
480
+ /* @__PURE__ */ jsx("span", { className: "nb-marker", children: label }),
481
+ /* @__PURE__ */ jsx("svg", { "aria-hidden": true, viewBox: "0 0 60 28", preserveAspectRatio: "none", className: "nb-new-ring", children: /* @__PURE__ */ jsx(
482
+ motion.path,
483
+ {
484
+ d: "M44 4.5 C30 1.5 8 3.5 4 13 C0.5 22 22 26.5 38 25 C54 23.5 60 14 53 7.5 C47 2.5 31 2 21 5",
485
+ fill: "none",
486
+ style: { stroke: "var(--nb-accent)" },
487
+ strokeWidth: 1.7,
488
+ strokeLinecap: "round",
489
+ initial: { pathLength: reduced ? 1 : 0 },
490
+ animate: { pathLength: 1 },
491
+ transition: reduced ? { duration: 0 } : { duration: 0.6, ease: [0.55, 0, 0.3, 1], delay: 0.28 }
492
+ }
493
+ ) })
494
+ ] });
495
+ }
496
+ function MobilePanel({ items, close }) {
497
+ const groups = items.filter(isMenu).filter((m) => m.mobile?.length);
498
+ const links = items.filter((i) => !isMenu(i));
499
+ const bare = items.filter(isMenu).filter((m) => !m.mobile?.length);
500
+ return /* @__PURE__ */ jsxs("div", { className: "nb-mpanel", children: [
501
+ groups.map((g, gi) => /* @__PURE__ */ jsxs("div", { children: [
502
+ gi > 0 && /* @__PURE__ */ jsx("div", { className: "nb-mdivider" }),
503
+ /* @__PURE__ */ jsx("p", { className: "nb-mono nb-mhead", children: g.label }),
504
+ g.mobile.map((l) => /* @__PURE__ */ jsxs(NavLink, { href: l.href, onClick: close, className: "nb-mrow", children: [
505
+ /* @__PURE__ */ jsxs("span", { className: "nb-mrow-title", children: [
506
+ /* @__PURE__ */ jsx("span", { className: "nb-truncate", children: l.label }),
507
+ l.badge && /* @__PURE__ */ jsx("span", { className: "nb-marker nb-mbadge", children: l.badge })
508
+ ] }),
509
+ l.meta && /* @__PURE__ */ jsx("span", { className: "nb-mrow-meta", children: l.meta })
510
+ ] }, l.href))
511
+ ] }, g.label)),
512
+ (links.length > 0 || bare.length > 0) && groups.length > 0 && /* @__PURE__ */ jsx("div", { className: "nb-mdivider" }),
513
+ bare.map((m) => /* @__PURE__ */ jsx("p", { className: "nb-mono nb-mhead", children: m.label }, m.label)),
514
+ links.map((l) => /* @__PURE__ */ jsx(NavLink, { href: l.href, onClick: close, className: "nb-mrow nb-mrow--strong", children: l.label }, l.href))
515
+ ] });
516
+ }
517
+ function Burger({ open, reduced }) {
518
+ const tr = reduced ? { duration: 0 } : { type: "spring", duration: 0.35, bounce: 0.2 };
519
+ return /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", "aria-hidden": true, children: [
520
+ /* @__PURE__ */ jsx(motion.line, { x1: "3", x2: "15", y1: "6.5", y2: "6.5", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", style: { originX: "50%", originY: "50%" }, animate: open ? { y: 2.5, rotate: 45 } : { y: 0, rotate: 0 }, transition: tr }),
521
+ /* @__PURE__ */ jsx(motion.line, { x1: "3", x2: "15", y1: "11.5", y2: "11.5", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", style: { originX: "50%", originY: "50%" }, animate: open ? { y: -2.5, rotate: -45 } : { y: 0, rotate: 0 }, transition: tr })
522
+ ] });
523
+ }
524
+ function Cta({ label, href }) {
525
+ return /* @__PURE__ */ jsxs(NavLink, { href, className: "nb-cta", "aria-label": label, children: [
526
+ /* @__PURE__ */ jsx("span", { className: "nb-cta-label", "aria-hidden": true, children: [...label].map((ch, i) => /* @__PURE__ */ jsxs("span", { className: "nb-cta-char", style: { "--i": i }, children: [
527
+ /* @__PURE__ */ jsx("span", { children: ch === " " ? "\xA0" : ch }),
528
+ /* @__PURE__ */ jsx("span", { children: ch === " " ? "\xA0" : ch })
529
+ ] }, i)) }),
530
+ /* @__PURE__ */ jsx("span", { className: "nb-cta-chip", "aria-hidden": true, children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", width: "16", height: "16", children: [
531
+ /* @__PURE__ */ jsx("circle", { className: "nb-cta-dot", cx: "8", cy: "8", r: "3.2" }),
532
+ /* @__PURE__ */ jsx("path", { className: "nb-cta-arrow", d: "M3.5 8h8.6M8.6 4.4 12.2 8l-3.6 3.6", pathLength: 1 })
533
+ ] }) })
534
+ ] });
535
+ }
536
+ function Mark() {
537
+ const id = useId().replace(/:/g, "");
538
+ return /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "nb-mark", children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", width: "24", height: "24", children: [
539
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: `${id}-o`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
540
+ /* @__PURE__ */ jsx("stop", { offset: "0", stopColor: "#fff" }),
541
+ /* @__PURE__ */ jsx("stop", { offset: "0.52", stopColor: "#fff" }),
542
+ /* @__PURE__ */ jsx("stop", { offset: "0.86", stopColor: "#fff", stopOpacity: "0.08" }),
543
+ /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#fff", stopOpacity: "0.3" })
544
+ ] }) }),
545
+ /* @__PURE__ */ jsx("ellipse", { cx: "12", cy: "12", rx: "8.9", ry: "5", transform: "rotate(-40 12 12)", fill: "none", stroke: `url(#${id}-o)`, strokeWidth: "1.7" }),
546
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "8.9", fill: "none", stroke: "#fff", strokeWidth: "1.8" })
547
+ ] }) });
548
+ }
549
+ export {
550
+ Mark,
551
+ NavLink,
552
+ NewMark,
553
+ Notchbar,
554
+ PanelCards,
555
+ PanelFooter,
556
+ PanelGrid,
557
+ PanelHeader,
558
+ PanelLink,
559
+ PanelRows,
560
+ PanelSplit,
561
+ usePanel
562
+ };
563
+ //# sourceMappingURL=index.js.map