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