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