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