@orangecheck/design 0.16.0 → 0.18.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.
@@ -9,6 +9,7 @@ var Link6 = require('next/link');
9
9
  var React = require('react');
10
10
  var router = require('next/router');
11
11
  var authClient = require('@orangecheck/auth-client');
12
+ var nextThemes = require('next-themes');
12
13
 
13
14
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
15
 
@@ -302,13 +303,6 @@ var ENTRIES = [
302
303
  sub: "unified docs",
303
304
  docsHref: "https://docs.ochk.io"
304
305
  },
305
- {
306
- slug: "fleet",
307
- href: "https://fleet.ochk.io",
308
- label: "oc\xB7fleet",
309
- sub: "managed \u2014 agent fleet",
310
- docsHref: "https://docs.ochk.io/fleet"
311
- },
312
306
  {
313
307
  slug: "me",
314
308
  href: "https://me.ochk.io",
@@ -374,6 +368,13 @@ var ENTRIES = [
374
368
  }
375
369
  ];
376
370
  var OWNER_ENTRIES = [
371
+ {
372
+ slug: "fleet",
373
+ href: "https://fleet.ochk.io",
374
+ label: "oc\xB7fleet",
375
+ sub: "managed \u2014 agent fleet",
376
+ docsHref: "https://fleet.ochk.io"
377
+ },
377
378
  {
378
379
  slug: "analytics",
379
380
  href: "https://analytics.ochk.io",
@@ -669,15 +670,6 @@ var FAMILY_PROPERTIES = [
669
670
  docsHref: "https://docs.ochk.io/chat",
670
671
  category: "product"
671
672
  },
672
- {
673
- slug: "fleet",
674
- origin: "https://fleet.ochk.io",
675
- hostname: "fleet.ochk.io",
676
- label: "oc\xB7fleet",
677
- sub: "managed \u2014 agent fleet",
678
- docsHref: "https://docs.ochk.io/fleet",
679
- category: "product"
680
- },
681
673
  {
682
674
  slug: "attest",
683
675
  origin: "https://attest.ochk.io",
@@ -732,6 +724,15 @@ var FAMILY_PROPERTIES = [
732
724
  docsHref: "https://docs.ochk.io/pledge",
733
725
  category: "protocol"
734
726
  },
727
+ {
728
+ slug: "fleet",
729
+ origin: "https://fleet.ochk.io",
730
+ hostname: "fleet.ochk.io",
731
+ label: "oc\xB7fleet",
732
+ sub: "managed \u2014 agent fleet",
733
+ docsHref: "https://fleet.ochk.io",
734
+ category: "owner"
735
+ },
735
736
  {
736
737
  slug: "analytics",
737
738
  origin: "https://analytics.ochk.io",
@@ -1025,6 +1026,74 @@ function OcLogoDropdown({
1025
1026
  }
1026
1027
  );
1027
1028
  }
1029
+ var OcSkinContext = React.createContext(null);
1030
+ function useOcSkin() {
1031
+ const ctx = React.useContext(OcSkinContext);
1032
+ if (!ctx) {
1033
+ throw new Error("useOcSkin must be used within <OcThemeProvider>");
1034
+ }
1035
+ return ctx;
1036
+ }
1037
+ var MODES = [
1038
+ { id: "light", label: "light", Icon: lucideReact.Sun },
1039
+ { id: "dark", label: "dark", Icon: lucideReact.Moon },
1040
+ { id: "system", label: "system", Icon: lucideReact.Monitor }
1041
+ ];
1042
+ function AppearanceControls({ className }) {
1043
+ const { skin, setSkin, themes } = useOcSkin();
1044
+ const { theme, setTheme } = nextThemes.useTheme();
1045
+ const [mounted, setMounted] = React.useState(false);
1046
+ React.useEffect(() => setMounted(true), []);
1047
+ const activeMode = mounted ? theme ?? "system" : null;
1048
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
1049
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-muted-foreground px-3 pt-3 pb-2", children: "mode" }),
1050
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-1 px-2 pb-2", children: MODES.map(({ id, label, Icon }) => {
1051
+ const active = activeMode === id;
1052
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1053
+ "button",
1054
+ {
1055
+ type: "button",
1056
+ role: "menuitemradio",
1057
+ "aria-checked": active,
1058
+ onClick: () => setTheme(id),
1059
+ className: cn(
1060
+ "flex flex-col items-center gap-1 rounded-md border py-2 text-[11px] transition-colors",
1061
+ active ? "border-primary text-foreground bg-accent" : "border-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground"
1062
+ ),
1063
+ children: [
1064
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4", "aria-hidden": true }),
1065
+ label
1066
+ ]
1067
+ },
1068
+ id
1069
+ );
1070
+ }) }),
1071
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-muted-foreground border-t px-3 pt-3 pb-1", children: "theme" }),
1072
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "pb-1", children: themes.map((t) => {
1073
+ const active = t.id === skin;
1074
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
1075
+ "button",
1076
+ {
1077
+ type: "button",
1078
+ role: "menuitemradio",
1079
+ "aria-checked": active,
1080
+ onClick: () => setSkin(t.id),
1081
+ className: cn(
1082
+ "hover:bg-accent hover:text-accent-foreground flex w-full items-start gap-2 px-3 py-2 text-left transition-colors",
1083
+ active && "text-foreground"
1084
+ ),
1085
+ children: [
1086
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 size-4 shrink-0", children: active && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "text-primary size-4", "aria-hidden": true }) }),
1087
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0", children: [
1088
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-sm font-medium", children: t.label }),
1089
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground block text-xs leading-snug", children: t.description })
1090
+ ] })
1091
+ ]
1092
+ }
1093
+ ) }, t.id);
1094
+ }) })
1095
+ ] });
1096
+ }
1028
1097
  function obscureIdentity(value) {
1029
1098
  if (value.length <= 12) {
1030
1099
  return `${value.slice(0, 4)}\u2026${value.slice(-3)}`;
@@ -1275,6 +1344,92 @@ function OcAccountMenu(props) {
1275
1344
  }
1276
1345
  );
1277
1346
  }
1347
+ function MobileMenu({
1348
+ primary,
1349
+ secondary
1350
+ }) {
1351
+ const [open, setOpen] = React.useState(false);
1352
+ const ref = React.useRef(null);
1353
+ React.useEffect(() => {
1354
+ if (!open) return;
1355
+ const onClick = (e) => {
1356
+ if (ref.current && !ref.current.contains(e.target)) setOpen(false);
1357
+ };
1358
+ const onKey = (e) => {
1359
+ if (e.key === "Escape") setOpen(false);
1360
+ };
1361
+ document.addEventListener("mousedown", onClick);
1362
+ document.addEventListener("keydown", onKey);
1363
+ return () => {
1364
+ document.removeEventListener("mousedown", onClick);
1365
+ document.removeEventListener("keydown", onKey);
1366
+ };
1367
+ }, [open]);
1368
+ const links = [...primary ?? [], ...secondary ?? []];
1369
+ const rowCls = "font-display flex items-center gap-2 px-3 py-2 text-[12px] font-semibold tracking-wider uppercase text-muted-foreground hover:text-foreground hover:bg-accent transition-colors";
1370
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: "relative md:hidden", "data-oc-account-mobile-menu": "", children: [
1371
+ /* @__PURE__ */ jsxRuntime.jsx(
1372
+ "button",
1373
+ {
1374
+ type: "button",
1375
+ onClick: () => setOpen((v) => !v),
1376
+ "aria-haspopup": "menu",
1377
+ "aria-expanded": open,
1378
+ "aria-label": "menu",
1379
+ className: "border-input bg-background hover:bg-accent text-muted-foreground inline-flex size-8 items-center justify-center rounded-md border transition-colors",
1380
+ "data-oc-account-mobile-toggle": "",
1381
+ children: open ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-4", "aria-hidden": true }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "size-4", "aria-hidden": true })
1382
+ }
1383
+ ),
1384
+ open && /* @__PURE__ */ jsxRuntime.jsxs(
1385
+ "div",
1386
+ {
1387
+ role: "menu",
1388
+ "aria-label": "menu",
1389
+ className: "border-border bg-popover text-popover-foreground absolute top-[calc(100%+6px)] right-0 z-50 w-[min(16rem,calc(100vw-1rem))] overflow-hidden border shadow-xl",
1390
+ "data-oc-account-mobile-popover": "",
1391
+ children: [
1392
+ links.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b p-1", children: [
1393
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/60 px-3 pt-2 pb-1 font-mono text-[10px] tracking-widest uppercase", children: "\xA7 navigate" }),
1394
+ links.map(
1395
+ (l) => l.external ? /* @__PURE__ */ jsxRuntime.jsxs(
1396
+ "a",
1397
+ {
1398
+ href: l.href,
1399
+ target: "_blank",
1400
+ rel: "noreferrer",
1401
+ role: "menuitem",
1402
+ onClick: () => setOpen(false),
1403
+ className: rowCls,
1404
+ children: [
1405
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1406
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: l.label }),
1407
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/70 text-[10px]", "aria-hidden": true, children: "\u2197" })
1408
+ ]
1409
+ },
1410
+ l.href
1411
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
1412
+ Link6__default.default,
1413
+ {
1414
+ href: l.href,
1415
+ role: "menuitem",
1416
+ onClick: () => setOpen(false),
1417
+ className: rowCls,
1418
+ children: [
1419
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1420
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: l.label })
1421
+ ]
1422
+ },
1423
+ l.href
1424
+ )
1425
+ )
1426
+ ] }),
1427
+ /* @__PURE__ */ jsxRuntime.jsx(AppearanceControls, {})
1428
+ ]
1429
+ }
1430
+ )
1431
+ ] });
1432
+ }
1278
1433
  function OcAccountMenuView({
1279
1434
  current,
1280
1435
  signInUrl = "/signin",
@@ -1347,220 +1502,220 @@ function OcAccountMenuView({
1347
1502
  children: signInLabel
1348
1503
  }
1349
1504
  );
1505
+ const hasNav = (primaryNavLinks?.length ?? 0) + (secondaryNavLinks?.length ?? 0) > 0;
1506
+ const wrap = (identity) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-1", className), "data-oc-account-menu": "", children: [
1507
+ hasNav ? /* @__PURE__ */ jsxRuntime.jsx(MobileMenu, { primary: primaryNavLinks, secondary: secondaryNavLinks }) : null,
1508
+ identity
1509
+ ] });
1350
1510
  if (!hydrated || status === "loading") {
1351
- return signInTrigger;
1511
+ return wrap(signInTrigger);
1352
1512
  }
1353
1513
  if (status !== "authenticated" || !account) {
1354
- return signInTrigger;
1514
+ return wrap(signInTrigger);
1355
1515
  }
1356
1516
  const displayName = account.displayName ?? null;
1357
1517
  const label = displayName ?? obscureIdentity(account.displayIdentity.value);
1358
- return /* @__PURE__ */ jsxRuntime.jsxs(
1359
- "div",
1360
- {
1361
- ref: wrapRef,
1362
- className: "relative inline-block " + (className ?? ""),
1363
- "data-oc-account-menu": "",
1364
- children: [
1365
- /* @__PURE__ */ jsxRuntime.jsxs(
1366
- "button",
1367
- {
1368
- type: "button",
1369
- onClick: () => setOpen((v) => !v),
1370
- "aria-haspopup": "menu",
1371
- "aria-expanded": open,
1372
- "aria-label": `Signed in as ${account.didOc}. Open account menu.`,
1373
- className: triggerClassName ?? "border-primary/40 bg-card hover:bg-accent inline-flex h-8 items-center gap-1.5 rounded-md border px-2 font-mono text-[11px] tracking-wide transition-colors sm:px-3",
1374
- "data-oc-account-menu-trigger": "",
1375
- children: [
1376
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block size-1.5 shrink-0 rounded-full", "aria-hidden": true }),
1377
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground hidden max-w-[16ch] truncate sm:inline", children: label }),
1378
- /* @__PURE__ */ jsxRuntime.jsx(
1379
- "svg",
1380
- {
1381
- width: "9",
1382
- height: "9",
1383
- viewBox: "0 0 10 10",
1384
- "aria-hidden": true,
1385
- className: "opacity-60 transition-transform " + (open ? "rotate-180" : "rotate-0"),
1386
- children: /* @__PURE__ */ jsxRuntime.jsx(
1387
- "path",
1388
- {
1389
- d: "M2 4 L5 7 L8 4",
1390
- stroke: "currentColor",
1391
- strokeWidth: "1.5",
1392
- fill: "none",
1393
- strokeLinecap: "round"
1394
- }
1395
- )
1396
- }
1397
- )
1398
- ]
1399
- }
1400
- ),
1401
- open && /* @__PURE__ */ jsxRuntime.jsxs(
1402
- "div",
1403
- {
1404
- role: "menu",
1405
- "aria-label": "Account menu",
1406
- className: popoverClassName ?? "border-border bg-popover text-popover-foreground absolute top-[calc(100%+6px)] right-0 z-50 w-[min(20rem,calc(100vw-1rem))] border shadow-xl",
1407
- "data-oc-account-menu-popover": "",
1408
- children: [
1409
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border border-b p-3", children: [
1410
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-primary mb-1 font-mono text-[10px] tracking-widest uppercase", children: [
1411
- "\xA7 signed in \xB7 ",
1412
- hostname,
1413
- tabPinned ? /* @__PURE__ */ jsxRuntime.jsxs(
1518
+ return wrap(
1519
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: wrapRef, className: "relative inline-block", children: [
1520
+ /* @__PURE__ */ jsxRuntime.jsxs(
1521
+ "button",
1522
+ {
1523
+ type: "button",
1524
+ onClick: () => setOpen((v) => !v),
1525
+ "aria-haspopup": "menu",
1526
+ "aria-expanded": open,
1527
+ "aria-label": `Signed in as ${account.didOc}. Open account menu.`,
1528
+ className: triggerClassName ?? "border-primary/40 bg-card hover:bg-accent inline-flex h-8 items-center gap-1.5 rounded-md border px-2 font-mono text-[11px] tracking-wide transition-colors sm:px-3",
1529
+ "data-oc-account-menu-trigger": "",
1530
+ children: [
1531
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block size-1.5 shrink-0 rounded-full", "aria-hidden": true }),
1532
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground hidden max-w-[16ch] truncate sm:inline", children: label }),
1533
+ /* @__PURE__ */ jsxRuntime.jsx(
1534
+ "svg",
1535
+ {
1536
+ width: "9",
1537
+ height: "9",
1538
+ viewBox: "0 0 10 10",
1539
+ "aria-hidden": true,
1540
+ className: "opacity-60 transition-transform " + (open ? "rotate-180" : "rotate-0"),
1541
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1542
+ "path",
1543
+ {
1544
+ d: "M2 4 L5 7 L8 4",
1545
+ stroke: "currentColor",
1546
+ strokeWidth: "1.5",
1547
+ fill: "none",
1548
+ strokeLinecap: "round"
1549
+ }
1550
+ )
1551
+ }
1552
+ )
1553
+ ]
1554
+ }
1555
+ ),
1556
+ open && /* @__PURE__ */ jsxRuntime.jsxs(
1557
+ "div",
1558
+ {
1559
+ role: "menu",
1560
+ "aria-label": "Account menu",
1561
+ className: popoverClassName ?? "border-border bg-popover text-popover-foreground absolute top-[calc(100%+6px)] right-0 z-50 w-[min(20rem,calc(100vw-1rem))] border shadow-xl",
1562
+ "data-oc-account-menu-popover": "",
1563
+ children: [
1564
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border border-b p-3", children: [
1565
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-primary mb-1 font-mono text-[10px] tracking-widest uppercase", children: [
1566
+ "\xA7 signed in \xB7 ",
1567
+ hostname,
1568
+ tabPinned ? /* @__PURE__ */ jsxRuntime.jsxs(
1569
+ "span",
1570
+ {
1571
+ className: "text-muted-foreground/70 normal-case",
1572
+ "data-oc-account-menu-tab-pin": "",
1573
+ title: "This tab keeps this account even if you switch accounts in another tab",
1574
+ children: [
1575
+ " ",
1576
+ "\xB7 this tab"
1577
+ ]
1578
+ }
1579
+ ) : null
1580
+ ] }),
1581
+ /* @__PURE__ */ jsxRuntime.jsx(CopyableDid, { did: account.didOc }),
1582
+ displayName ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/80 mt-1 font-mono text-[10px] tracking-wide", children: displayName }) : null
1583
+ ] }),
1584
+ /* @__PURE__ */ jsxRuntime.jsx(
1585
+ IdentityPromoteSection,
1586
+ {
1587
+ didOc: account.didOc,
1588
+ nostrNpub: account.nostrNpub ?? null,
1589
+ current: account.displayIdentity,
1590
+ open,
1591
+ setDisplayIdentity
1592
+ }
1593
+ ),
1594
+ /* @__PURE__ */ jsxRuntime.jsx(
1595
+ AccountsSection,
1596
+ {
1597
+ roster: roster ?? [],
1598
+ switchAccount,
1599
+ addAccountUrl,
1600
+ signOut,
1601
+ onActionStart: () => setOpen(false)
1602
+ }
1603
+ ),
1604
+ primaryNavLinks && primaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1605
+ PopoverSection,
1606
+ {
1607
+ label: "navigate",
1608
+ items: primaryNavLinks,
1609
+ onItemClick: () => setOpen(false),
1610
+ className: "hidden md:block"
1611
+ }
1612
+ ) : null,
1613
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-1", "data-oc-account-menu-section": "account", children: [
1614
+ menuItems?.map((item) => {
1615
+ const onClick = () => setOpen(false);
1616
+ const cls = "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors";
1617
+ const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1618
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1619
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: item.label }),
1620
+ item.external ? /* @__PURE__ */ jsxRuntime.jsx(
1414
1621
  "span",
1415
1622
  {
1416
- className: "text-muted-foreground/70 normal-case",
1417
- "data-oc-account-menu-tab-pin": "",
1418
- title: "This tab keeps this account even if you switch accounts in another tab",
1419
- children: [
1420
- " ",
1421
- "\xB7 this tab"
1422
- ]
1623
+ className: "text-muted-foreground/70 text-[10px]",
1624
+ "aria-hidden": true,
1625
+ children: "\u2197"
1423
1626
  }
1424
1627
  ) : null
1425
- ] }),
1426
- /* @__PURE__ */ jsxRuntime.jsx(CopyableDid, { did: account.didOc }),
1427
- displayName ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/80 mt-1 font-mono text-[10px] tracking-wide", children: displayName }) : null
1428
- ] }),
1429
- /* @__PURE__ */ jsxRuntime.jsx(
1430
- IdentityPromoteSection,
1431
- {
1432
- didOc: account.didOc,
1433
- nostrNpub: account.nostrNpub ?? null,
1434
- current: account.displayIdentity,
1435
- open,
1436
- setDisplayIdentity
1437
- }
1438
- ),
1439
- /* @__PURE__ */ jsxRuntime.jsx(
1440
- AccountsSection,
1441
- {
1442
- roster: roster ?? [],
1443
- switchAccount,
1444
- addAccountUrl,
1445
- signOut,
1446
- onActionStart: () => setOpen(false)
1447
- }
1448
- ),
1449
- primaryNavLinks && primaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1450
- PopoverSection,
1451
- {
1452
- label: "navigate",
1453
- items: primaryNavLinks,
1454
- onItemClick: () => setOpen(false)
1455
- }
1456
- ) : null,
1457
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-1", "data-oc-account-menu-section": "account", children: [
1458
- primaryNavLinks && primaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/60 px-3 pb-1 pt-2 font-mono text-[10px] tracking-widest uppercase", children: "\xA7 account" }) : null,
1459
- menuItems?.map((item) => {
1460
- const onClick = () => setOpen(false);
1461
- const cls = "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors";
1462
- const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1463
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1464
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: item.label }),
1465
- item.external ? /* @__PURE__ */ jsxRuntime.jsx(
1466
- "span",
1467
- {
1468
- className: "text-muted-foreground/70 text-[10px]",
1469
- "aria-hidden": true,
1470
- children: "\u2197"
1471
- }
1472
- ) : null
1473
- ] });
1474
- return item.external ? /* @__PURE__ */ jsxRuntime.jsx(
1475
- "a",
1476
- {
1477
- href: item.href,
1478
- target: "_blank",
1479
- rel: "noreferrer",
1480
- onClick,
1481
- role: "menuitem",
1482
- className: cls,
1483
- "data-oc-account-menu-item": "",
1484
- children: inner
1485
- },
1486
- item.href
1487
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1488
- Link6__default.default,
1489
- {
1490
- href: item.href,
1491
- onClick,
1492
- role: "menuitem",
1493
- className: cls,
1494
- "data-oc-account-menu-item": "",
1495
- children: inner
1496
- },
1497
- item.href
1498
- );
1499
- }),
1500
- familyDashboardEnabled ? /* @__PURE__ */ jsxRuntime.jsxs(
1628
+ ] });
1629
+ return item.external ? /* @__PURE__ */ jsxRuntime.jsx(
1501
1630
  "a",
1502
1631
  {
1503
- href: "https://ochk.io/dashboard",
1632
+ href: item.href,
1504
1633
  target: "_blank",
1505
1634
  rel: "noreferrer",
1506
- onClick: () => setOpen(false),
1635
+ onClick,
1507
1636
  role: "menuitem",
1508
- className: "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors",
1637
+ className: cls,
1509
1638
  "data-oc-account-menu-item": "",
1510
- "data-oc-account-menu-family-dashboard": "",
1511
- children: [
1512
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1513
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: "family dashboard" }),
1514
- /* @__PURE__ */ jsxRuntime.jsx(
1515
- "span",
1516
- {
1517
- className: "text-muted-foreground/70 text-[10px]",
1518
- "aria-hidden": true,
1519
- children: "\u2197"
1520
- }
1521
- )
1522
- ]
1523
- }
1524
- ) : null,
1525
- /* @__PURE__ */ jsxRuntime.jsxs(
1526
- "button",
1639
+ children: inner
1640
+ },
1641
+ item.href
1642
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1643
+ Link6__default.default,
1527
1644
  {
1528
- type: "button",
1645
+ href: item.href,
1646
+ onClick,
1529
1647
  role: "menuitem",
1530
- onClick: () => {
1531
- setOpen(false);
1532
- void (async () => {
1533
- await signOut();
1534
- if (typeof window !== "undefined") {
1535
- window.location.assign(signOutRedirect);
1536
- }
1537
- })();
1538
- },
1539
- className: "hover:bg-accent flex w-full items-center gap-2 px-3 py-2 text-left font-mono text-[11px] tracking-wide transition-colors",
1648
+ className: cls,
1540
1649
  "data-oc-account-menu-item": "",
1541
- "data-oc-account-menu-signout": "",
1542
- children: [
1543
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1544
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: "sign out" })
1545
- ]
1546
- }
1547
- )
1548
- ] }),
1549
- secondaryNavLinks && secondaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1550
- PopoverSection,
1650
+ children: inner
1651
+ },
1652
+ item.href
1653
+ );
1654
+ }),
1655
+ familyDashboardEnabled ? /* @__PURE__ */ jsxRuntime.jsxs(
1656
+ "a",
1551
1657
  {
1552
- label: "more",
1553
- items: secondaryNavLinks,
1554
- onItemClick: () => setOpen(false),
1555
- bordered: true
1658
+ href: "https://ochk.io/dashboard",
1659
+ target: "_blank",
1660
+ rel: "noreferrer",
1661
+ onClick: () => setOpen(false),
1662
+ role: "menuitem",
1663
+ className: "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors",
1664
+ "data-oc-account-menu-item": "",
1665
+ "data-oc-account-menu-family-dashboard": "",
1666
+ children: [
1667
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1668
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: "family dashboard" }),
1669
+ /* @__PURE__ */ jsxRuntime.jsx(
1670
+ "span",
1671
+ {
1672
+ className: "text-muted-foreground/70 text-[10px]",
1673
+ "aria-hidden": true,
1674
+ children: "\u2197"
1675
+ }
1676
+ )
1677
+ ]
1556
1678
  }
1557
1679
  ) : null,
1558
- build ? /* @__PURE__ */ jsxRuntime.jsx(BuildFooter, { hostname, build, state: siteState }) : null
1559
- ]
1560
- }
1561
- )
1562
- ]
1563
- }
1680
+ /* @__PURE__ */ jsxRuntime.jsxs(
1681
+ "button",
1682
+ {
1683
+ type: "button",
1684
+ role: "menuitem",
1685
+ onClick: () => {
1686
+ setOpen(false);
1687
+ void (async () => {
1688
+ await signOut();
1689
+ if (typeof window !== "undefined") {
1690
+ window.location.assign(signOutRedirect);
1691
+ }
1692
+ })();
1693
+ },
1694
+ className: "hover:bg-accent flex w-full items-center gap-2 px-3 py-2 text-left font-mono text-[11px] tracking-wide transition-colors",
1695
+ "data-oc-account-menu-item": "",
1696
+ "data-oc-account-menu-signout": "",
1697
+ children: [
1698
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1699
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: "sign out" })
1700
+ ]
1701
+ }
1702
+ )
1703
+ ] }),
1704
+ secondaryNavLinks && secondaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1705
+ PopoverSection,
1706
+ {
1707
+ label: "more",
1708
+ items: secondaryNavLinks,
1709
+ onItemClick: () => setOpen(false),
1710
+ bordered: true,
1711
+ className: "hidden md:block"
1712
+ }
1713
+ ) : null,
1714
+ build ? /* @__PURE__ */ jsxRuntime.jsx(BuildFooter, { hostname, build, state: siteState }) : null
1715
+ ]
1716
+ }
1717
+ )
1718
+ ] })
1564
1719
  );
1565
1720
  }
1566
1721
  function AccountsSection({
@@ -1673,33 +1828,22 @@ function PopoverSection({
1673
1828
  label,
1674
1829
  items,
1675
1830
  onItemClick,
1676
- bordered
1831
+ bordered,
1832
+ className
1677
1833
  }) {
1678
1834
  const cls = "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors";
1679
1835
  return /* @__PURE__ */ jsxRuntime.jsxs(
1680
1836
  "div",
1681
1837
  {
1682
- className: "p-1 " + (bordered ? "border-border border-t" : ""),
1838
+ className: cn("p-1", bordered && "border-border border-t", className),
1683
1839
  "data-oc-account-menu-section": label,
1684
1840
  children: [
1685
1841
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground/60 px-3 pt-2 pb-1 font-mono text-[10px] tracking-widest uppercase", children: [
1686
1842
  "\xA7 ",
1687
1843
  label
1688
1844
  ] }),
1689
- items.map((item) => {
1690
- const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1691
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1692
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: item.label }),
1693
- item.external ? /* @__PURE__ */ jsxRuntime.jsx(
1694
- "span",
1695
- {
1696
- className: "text-muted-foreground/70 text-[10px]",
1697
- "aria-hidden": true,
1698
- children: "\u2197"
1699
- }
1700
- ) : null
1701
- ] });
1702
- return item.external ? /* @__PURE__ */ jsxRuntime.jsx(
1845
+ items.map(
1846
+ (item) => item.external ? /* @__PURE__ */ jsxRuntime.jsxs(
1703
1847
  "a",
1704
1848
  {
1705
1849
  href: item.href,
@@ -1709,10 +1853,14 @@ function PopoverSection({
1709
1853
  role: "menuitem",
1710
1854
  className: cls,
1711
1855
  "data-oc-account-menu-item": "",
1712
- children: inner
1856
+ children: [
1857
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1858
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: item.label }),
1859
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/70 text-[10px]", "aria-hidden": true, children: "\u2197" })
1860
+ ]
1713
1861
  },
1714
1862
  item.href
1715
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1863
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
1716
1864
  Link6__default.default,
1717
1865
  {
1718
1866
  href: item.href,
@@ -1720,11 +1868,14 @@ function PopoverSection({
1720
1868
  role: "menuitem",
1721
1869
  className: cls,
1722
1870
  "data-oc-account-menu-item": "",
1723
- children: inner
1871
+ children: [
1872
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1873
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: item.label })
1874
+ ]
1724
1875
  },
1725
1876
  item.href
1726
- );
1727
- })
1877
+ )
1878
+ )
1728
1879
  ]
1729
1880
  }
1730
1881
  );
@@ -1776,146 +1927,54 @@ function isActive(pathname, link) {
1776
1927
  if (link.href === "/") return pathname === "/";
1777
1928
  return pathname === link.href || pathname.startsWith(link.href + "/");
1778
1929
  }
1779
- function ExternalGlyph() {
1780
- return /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-muted-foreground/60 ml-1 text-[9px]", children: "\u2197" });
1781
- }
1782
1930
  function OcPrimaryNav({
1783
1931
  activePath,
1784
1932
  links,
1785
1933
  className
1786
1934
  }) {
1787
- const [open, setOpen] = React.useState(false);
1788
- const ref = React.useRef(null);
1789
- const menuId = React.useId();
1790
- React.useEffect(() => {
1791
- setOpen(false);
1792
- }, [activePath]);
1793
- React.useEffect(() => {
1794
- if (!open) return;
1795
- const onClick = (e) => {
1796
- if (ref.current && !ref.current.contains(e.target)) setOpen(false);
1797
- };
1798
- const onKey = (e) => {
1799
- if (e.key === "Escape") setOpen(false);
1800
- };
1801
- document.addEventListener("mousedown", onClick);
1802
- document.addEventListener("keydown", onKey);
1803
- return () => {
1804
- document.removeEventListener("mousedown", onClick);
1805
- document.removeEventListener("keydown", onKey);
1806
- };
1807
- }, [open]);
1808
- const inlineClass = (active) => "font-display shrink-0 px-2 py-1 sm:px-3 text-[11px] sm:text-[12px] font-semibold tracking-wider uppercase transition-colors " + (active ? "text-primary" : "text-muted-foreground hover:text-foreground");
1809
- const rowClass = (active) => "font-display flex items-center gap-2 px-3 py-2 text-[12px] font-semibold tracking-wider uppercase transition-colors " + (active ? "text-primary" : "text-muted-foreground hover:text-foreground hover:bg-accent");
1810
- function renderInline(link) {
1811
- const active = isActive(activePath, link);
1812
- const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1813
- link.label,
1814
- link.external ? /* @__PURE__ */ jsxRuntime.jsx(ExternalGlyph, {}) : null
1815
- ] });
1816
- return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
1817
- "a",
1818
- {
1819
- href: link.href,
1820
- target: "_blank",
1821
- rel: "noreferrer",
1822
- className: inlineClass(false),
1823
- "data-oc-primary-nav-item": "",
1824
- children: inner
1825
- },
1826
- link.href
1827
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1828
- Link6__default.default,
1829
- {
1830
- href: link.href,
1831
- "aria-current": active ? "page" : void 0,
1832
- className: inlineClass(active),
1833
- "data-oc-primary-nav-item": active ? "active" : "sibling",
1834
- children: inner
1835
- },
1836
- link.href
1837
- );
1838
- }
1839
- function renderRow(link) {
1840
- const active = isActive(activePath, link);
1841
- const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1842
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1843
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: link.label }),
1844
- link.external ? /* @__PURE__ */ jsxRuntime.jsx(ExternalGlyph, {}) : null
1845
- ] });
1846
- return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
1847
- "a",
1848
- {
1849
- href: link.href,
1850
- target: "_blank",
1851
- rel: "noreferrer",
1852
- role: "menuitem",
1853
- onClick: () => setOpen(false),
1854
- className: rowClass(false),
1855
- "data-oc-primary-nav-item": "",
1856
- children: inner
1857
- },
1858
- link.href
1859
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1860
- Link6__default.default,
1861
- {
1862
- href: link.href,
1863
- role: "menuitem",
1864
- "aria-current": active ? "page" : void 0,
1865
- onClick: () => setOpen(false),
1866
- className: rowClass(active),
1867
- "data-oc-primary-nav-item": active ? "active" : "sibling",
1868
- children: inner
1869
- },
1870
- link.href
1871
- );
1872
- }
1873
- return /* @__PURE__ */ jsxRuntime.jsxs(
1874
- "div",
1935
+ return /* @__PURE__ */ jsxRuntime.jsx(
1936
+ "nav",
1875
1937
  {
1876
- ref,
1877
- className: "relative flex items-center justify-center " + (className ?? ""),
1938
+ "aria-label": "primary",
1939
+ className: "hidden items-center gap-0.5 sm:gap-1 md:flex " + (className ?? ""),
1878
1940
  "data-oc-primary-nav": "",
1879
- children: [
1880
- /* @__PURE__ */ jsxRuntime.jsx(
1881
- "nav",
1882
- {
1883
- "aria-label": "primary",
1884
- className: "hidden items-center gap-0.5 sm:gap-1 md:flex",
1885
- children: links.map(renderInline)
1886
- }
1887
- ),
1888
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden", children: [
1889
- /* @__PURE__ */ jsxRuntime.jsx(
1890
- "button",
1941
+ children: links.map((link) => {
1942
+ const active = isActive(activePath, link);
1943
+ const cls = "font-display shrink-0 px-2 py-1 sm:px-3 text-[11px] sm:text-[12px] font-semibold tracking-wider uppercase transition-colors " + (active ? "text-primary" : "text-muted-foreground hover:text-foreground");
1944
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1945
+ link.label,
1946
+ link.external ? /* @__PURE__ */ jsxRuntime.jsx(
1947
+ "span",
1891
1948
  {
1892
- type: "button",
1893
- onClick: () => setOpen((v) => !v),
1894
- "aria-haspopup": "menu",
1895
- "aria-expanded": open,
1896
- "aria-controls": menuId,
1897
- "aria-label": "site navigation",
1898
- className: "border-input bg-background hover:bg-accent text-muted-foreground inline-flex size-8 items-center justify-center rounded-md border transition-colors",
1899
- "data-oc-primary-nav-toggle": "",
1900
- children: open ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-4", "aria-hidden": true }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "size-4", "aria-hidden": true })
1949
+ "aria-hidden": true,
1950
+ className: "text-muted-foreground/60 ml-1 text-[9px]",
1951
+ children: "\u2197"
1901
1952
  }
1902
- ),
1903
- open && /* @__PURE__ */ jsxRuntime.jsxs(
1904
- "div",
1905
- {
1906
- id: menuId,
1907
- role: "menu",
1908
- "aria-label": "primary",
1909
- className: "border-border bg-popover text-popover-foreground absolute top-[calc(100%+8px)] left-1/2 z-50 w-[min(15rem,calc(100vw-1rem))] -translate-x-1/2 border p-1 shadow-xl",
1910
- "data-oc-primary-nav-popover": "",
1911
- children: [
1912
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/60 px-3 pt-2 pb-1 font-mono text-[10px] tracking-widest uppercase", children: "\xA7 navigate" }),
1913
- links.map(renderRow)
1914
- ]
1915
- }
1916
- )
1917
- ] })
1918
- ]
1953
+ ) : null
1954
+ ] });
1955
+ return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
1956
+ "a",
1957
+ {
1958
+ href: link.href,
1959
+ target: "_blank",
1960
+ rel: "noreferrer",
1961
+ className: cls,
1962
+ "data-oc-primary-nav-item": "",
1963
+ children: content
1964
+ },
1965
+ link.href
1966
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1967
+ Link6__default.default,
1968
+ {
1969
+ href: link.href,
1970
+ "aria-current": active ? "page" : void 0,
1971
+ className: cls,
1972
+ "data-oc-primary-nav-item": active ? "active" : "sibling",
1973
+ children: content
1974
+ },
1975
+ link.href
1976
+ );
1977
+ })
1919
1978
  }
1920
1979
  );
1921
1980
  }