@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.
package/dist/index.js CHANGED
@@ -339,17 +339,68 @@ var MODES = [
339
339
  { id: "dark", label: "dark", Icon: lucideReact.Moon },
340
340
  { id: "system", label: "system", Icon: lucideReact.Monitor }
341
341
  ];
342
+ function AppearanceControls({ className }) {
343
+ const { skin, setSkin, themes } = useOcSkin();
344
+ const { theme, setTheme } = nextThemes.useTheme();
345
+ const [mounted, setMounted] = React2.useState(false);
346
+ React2.useEffect(() => setMounted(true), []);
347
+ const activeMode = mounted ? theme ?? "system" : null;
348
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
349
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-muted-foreground px-3 pt-3 pb-2", children: "mode" }),
350
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-1 px-2 pb-2", children: MODES.map(({ id, label, Icon: Icon2 }) => {
351
+ const active = activeMode === id;
352
+ return /* @__PURE__ */ jsxRuntime.jsxs(
353
+ "button",
354
+ {
355
+ type: "button",
356
+ role: "menuitemradio",
357
+ "aria-checked": active,
358
+ onClick: () => setTheme(id),
359
+ className: cn(
360
+ "flex flex-col items-center gap-1 rounded-md border py-2 text-[11px] transition-colors",
361
+ active ? "border-primary text-foreground bg-accent" : "border-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground"
362
+ ),
363
+ children: [
364
+ /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4", "aria-hidden": true }),
365
+ label
366
+ ]
367
+ },
368
+ id
369
+ );
370
+ }) }),
371
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-muted-foreground border-t px-3 pt-3 pb-1", children: "theme" }),
372
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "pb-1", children: themes.map((t) => {
373
+ const active = t.id === skin;
374
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
375
+ "button",
376
+ {
377
+ type: "button",
378
+ role: "menuitemradio",
379
+ "aria-checked": active,
380
+ onClick: () => setSkin(t.id),
381
+ className: cn(
382
+ "hover:bg-accent hover:text-accent-foreground flex w-full items-start gap-2 px-3 py-2 text-left transition-colors",
383
+ active && "text-foreground"
384
+ ),
385
+ children: [
386
+ /* @__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 }) }),
387
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0", children: [
388
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-sm font-medium", children: t.label }),
389
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground block text-xs leading-snug", children: t.description })
390
+ ] })
391
+ ]
392
+ }
393
+ ) }, t.id);
394
+ }) })
395
+ ] });
396
+ }
342
397
  function OcAppearanceMenu({
343
398
  className,
344
399
  triggerClassName,
345
400
  popoverClassName
346
401
  }) {
347
- const { skin, setSkin, themes } = useOcSkin();
348
- const { theme, setTheme } = nextThemes.useTheme();
349
402
  const [open, setOpen] = React2.useState(false);
350
- const [mounted, setMounted] = React2.useState(false);
351
403
  const rootRef = React2.useRef(null);
352
- React2.useEffect(() => setMounted(true), []);
353
404
  React2.useEffect(() => {
354
405
  if (!open) return;
355
406
  function onDown(e) {
@@ -365,7 +416,6 @@ function OcAppearanceMenu({
365
416
  document.removeEventListener("keydown", onKey);
366
417
  };
367
418
  }, [open]);
368
- const activeMode = mounted ? theme ?? "system" : null;
369
419
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: cn("relative", className), children: [
370
420
  /* @__PURE__ */ jsxRuntime.jsx(
371
421
  "button",
@@ -383,7 +433,7 @@ function OcAppearanceMenu({
383
433
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Palette, { className: "size-4", "aria-hidden": true })
384
434
  }
385
435
  ),
386
- open && /* @__PURE__ */ jsxRuntime.jsxs(
436
+ open && /* @__PURE__ */ jsxRuntime.jsx(
387
437
  "div",
388
438
  {
389
439
  role: "menu",
@@ -391,54 +441,7 @@ function OcAppearanceMenu({
391
441
  "bg-popover text-popover-foreground absolute right-0 z-50 mt-2 w-64 overflow-hidden rounded-md border shadow-md",
392
442
  popoverClassName
393
443
  ),
394
- children: [
395
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-muted-foreground px-3 pt-3 pb-2", children: "mode" }),
396
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-1 px-2 pb-2", children: MODES.map(({ id, label, Icon: Icon2 }) => {
397
- const active = activeMode === id;
398
- return /* @__PURE__ */ jsxRuntime.jsxs(
399
- "button",
400
- {
401
- type: "button",
402
- role: "menuitemradio",
403
- "aria-checked": active,
404
- onClick: () => setTheme(id),
405
- className: cn(
406
- "flex flex-col items-center gap-1 rounded-md border py-2 text-[11px] transition-colors",
407
- active ? "border-primary text-foreground bg-accent" : "border-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground"
408
- ),
409
- children: [
410
- /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4", "aria-hidden": true }),
411
- label
412
- ]
413
- },
414
- id
415
- );
416
- }) }),
417
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-muted-foreground border-t px-3 pt-3 pb-1", children: "theme" }),
418
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "pb-1", children: themes.map((t) => {
419
- const active = t.id === skin;
420
- return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
421
- "button",
422
- {
423
- type: "button",
424
- role: "menuitemradio",
425
- "aria-checked": active,
426
- onClick: () => setSkin(t.id),
427
- className: cn(
428
- "hover:bg-accent hover:text-accent-foreground flex w-full items-start gap-2 px-3 py-2 text-left transition-colors",
429
- active && "text-foreground"
430
- ),
431
- children: [
432
- /* @__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 }) }),
433
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0", children: [
434
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-sm font-medium", children: t.label }),
435
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground block text-xs leading-snug", children: t.description })
436
- ] })
437
- ]
438
- }
439
- ) }, t.id);
440
- }) })
441
- ]
444
+ children: /* @__PURE__ */ jsxRuntime.jsx(AppearanceControls, {})
442
445
  }
443
446
  )
444
447
  ] });
@@ -2531,13 +2534,6 @@ var ENTRIES = [
2531
2534
  sub: "unified docs",
2532
2535
  docsHref: "https://docs.ochk.io"
2533
2536
  },
2534
- {
2535
- slug: "fleet",
2536
- href: "https://fleet.ochk.io",
2537
- label: "oc\xB7fleet",
2538
- sub: "managed \u2014 agent fleet",
2539
- docsHref: "https://docs.ochk.io/fleet"
2540
- },
2541
2537
  {
2542
2538
  slug: "me",
2543
2539
  href: "https://me.ochk.io",
@@ -2603,6 +2599,13 @@ var ENTRIES = [
2603
2599
  }
2604
2600
  ];
2605
2601
  var OWNER_ENTRIES = [
2602
+ {
2603
+ slug: "fleet",
2604
+ href: "https://fleet.ochk.io",
2605
+ label: "oc\xB7fleet",
2606
+ sub: "managed \u2014 agent fleet",
2607
+ docsHref: "https://fleet.ochk.io"
2608
+ },
2606
2609
  {
2607
2610
  slug: "analytics",
2608
2611
  href: "https://analytics.ochk.io",
@@ -2763,15 +2766,6 @@ var FAMILY_PROPERTIES = [
2763
2766
  docsHref: "https://docs.ochk.io/chat",
2764
2767
  category: "product"
2765
2768
  },
2766
- {
2767
- slug: "fleet",
2768
- origin: "https://fleet.ochk.io",
2769
- hostname: "fleet.ochk.io",
2770
- label: "oc\xB7fleet",
2771
- sub: "managed \u2014 agent fleet",
2772
- docsHref: "https://docs.ochk.io/fleet",
2773
- category: "product"
2774
- },
2775
2769
  {
2776
2770
  slug: "attest",
2777
2771
  origin: "https://attest.ochk.io",
@@ -2826,6 +2820,15 @@ var FAMILY_PROPERTIES = [
2826
2820
  docsHref: "https://docs.ochk.io/pledge",
2827
2821
  category: "protocol"
2828
2822
  },
2823
+ {
2824
+ slug: "fleet",
2825
+ origin: "https://fleet.ochk.io",
2826
+ hostname: "fleet.ochk.io",
2827
+ label: "oc\xB7fleet",
2828
+ sub: "managed \u2014 agent fleet",
2829
+ docsHref: "https://fleet.ochk.io",
2830
+ category: "owner"
2831
+ },
2829
2832
  {
2830
2833
  slug: "analytics",
2831
2834
  origin: "https://analytics.ochk.io",
@@ -3369,6 +3372,92 @@ function OcAccountMenu(props) {
3369
3372
  }
3370
3373
  );
3371
3374
  }
3375
+ function MobileMenu({
3376
+ primary,
3377
+ secondary
3378
+ }) {
3379
+ const [open, setOpen] = React2.useState(false);
3380
+ const ref = React2.useRef(null);
3381
+ React2.useEffect(() => {
3382
+ if (!open) return;
3383
+ const onClick = (e) => {
3384
+ if (ref.current && !ref.current.contains(e.target)) setOpen(false);
3385
+ };
3386
+ const onKey = (e) => {
3387
+ if (e.key === "Escape") setOpen(false);
3388
+ };
3389
+ document.addEventListener("mousedown", onClick);
3390
+ document.addEventListener("keydown", onKey);
3391
+ return () => {
3392
+ document.removeEventListener("mousedown", onClick);
3393
+ document.removeEventListener("keydown", onKey);
3394
+ };
3395
+ }, [open]);
3396
+ const links = [...primary ?? [], ...secondary ?? []];
3397
+ 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";
3398
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: "relative md:hidden", "data-oc-account-mobile-menu": "", children: [
3399
+ /* @__PURE__ */ jsxRuntime.jsx(
3400
+ "button",
3401
+ {
3402
+ type: "button",
3403
+ onClick: () => setOpen((v) => !v),
3404
+ "aria-haspopup": "menu",
3405
+ "aria-expanded": open,
3406
+ "aria-label": "menu",
3407
+ className: "border-input bg-background hover:bg-accent text-muted-foreground inline-flex size-8 items-center justify-center rounded-md border transition-colors",
3408
+ "data-oc-account-mobile-toggle": "",
3409
+ children: open ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-4", "aria-hidden": true }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "size-4", "aria-hidden": true })
3410
+ }
3411
+ ),
3412
+ open && /* @__PURE__ */ jsxRuntime.jsxs(
3413
+ "div",
3414
+ {
3415
+ role: "menu",
3416
+ "aria-label": "menu",
3417
+ 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",
3418
+ "data-oc-account-mobile-popover": "",
3419
+ children: [
3420
+ links.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b p-1", children: [
3421
+ /* @__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" }),
3422
+ links.map(
3423
+ (l) => l.external ? /* @__PURE__ */ jsxRuntime.jsxs(
3424
+ "a",
3425
+ {
3426
+ href: l.href,
3427
+ target: "_blank",
3428
+ rel: "noreferrer",
3429
+ role: "menuitem",
3430
+ onClick: () => setOpen(false),
3431
+ className: rowCls,
3432
+ children: [
3433
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3434
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: l.label }),
3435
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/70 text-[10px]", "aria-hidden": true, children: "\u2197" })
3436
+ ]
3437
+ },
3438
+ l.href
3439
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
3440
+ Link6__default.default,
3441
+ {
3442
+ href: l.href,
3443
+ role: "menuitem",
3444
+ onClick: () => setOpen(false),
3445
+ className: rowCls,
3446
+ children: [
3447
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3448
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: l.label })
3449
+ ]
3450
+ },
3451
+ l.href
3452
+ )
3453
+ )
3454
+ ] }),
3455
+ /* @__PURE__ */ jsxRuntime.jsx(AppearanceControls, {})
3456
+ ]
3457
+ }
3458
+ )
3459
+ ] });
3460
+ }
3372
3461
  function OcAccountMenuView({
3373
3462
  current,
3374
3463
  signInUrl = "/signin",
@@ -3441,220 +3530,220 @@ function OcAccountMenuView({
3441
3530
  children: signInLabel
3442
3531
  }
3443
3532
  );
3533
+ const hasNav = (primaryNavLinks?.length ?? 0) + (secondaryNavLinks?.length ?? 0) > 0;
3534
+ const wrap = (identity) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-1", className), "data-oc-account-menu": "", children: [
3535
+ hasNav ? /* @__PURE__ */ jsxRuntime.jsx(MobileMenu, { primary: primaryNavLinks, secondary: secondaryNavLinks }) : null,
3536
+ identity
3537
+ ] });
3444
3538
  if (!hydrated || status === "loading") {
3445
- return signInTrigger;
3539
+ return wrap(signInTrigger);
3446
3540
  }
3447
3541
  if (status !== "authenticated" || !account) {
3448
- return signInTrigger;
3542
+ return wrap(signInTrigger);
3449
3543
  }
3450
3544
  const displayName = account.displayName ?? null;
3451
3545
  const label = displayName ?? obscureIdentity(account.displayIdentity.value);
3452
- return /* @__PURE__ */ jsxRuntime.jsxs(
3453
- "div",
3454
- {
3455
- ref: wrapRef,
3456
- className: "relative inline-block " + (className ?? ""),
3457
- "data-oc-account-menu": "",
3458
- children: [
3459
- /* @__PURE__ */ jsxRuntime.jsxs(
3460
- "button",
3461
- {
3462
- type: "button",
3463
- onClick: () => setOpen((v) => !v),
3464
- "aria-haspopup": "menu",
3465
- "aria-expanded": open,
3466
- "aria-label": `Signed in as ${account.didOc}. Open account menu.`,
3467
- 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",
3468
- "data-oc-account-menu-trigger": "",
3469
- children: [
3470
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block size-1.5 shrink-0 rounded-full", "aria-hidden": true }),
3471
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground hidden max-w-[16ch] truncate sm:inline", children: label }),
3472
- /* @__PURE__ */ jsxRuntime.jsx(
3473
- "svg",
3474
- {
3475
- width: "9",
3476
- height: "9",
3477
- viewBox: "0 0 10 10",
3478
- "aria-hidden": true,
3479
- className: "opacity-60 transition-transform " + (open ? "rotate-180" : "rotate-0"),
3480
- children: /* @__PURE__ */ jsxRuntime.jsx(
3481
- "path",
3482
- {
3483
- d: "M2 4 L5 7 L8 4",
3484
- stroke: "currentColor",
3485
- strokeWidth: "1.5",
3486
- fill: "none",
3487
- strokeLinecap: "round"
3488
- }
3489
- )
3490
- }
3491
- )
3492
- ]
3493
- }
3494
- ),
3495
- open && /* @__PURE__ */ jsxRuntime.jsxs(
3496
- "div",
3497
- {
3498
- role: "menu",
3499
- "aria-label": "Account menu",
3500
- 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",
3501
- "data-oc-account-menu-popover": "",
3502
- children: [
3503
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border border-b p-3", children: [
3504
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-primary mb-1 font-mono text-[10px] tracking-widest uppercase", children: [
3505
- "\xA7 signed in \xB7 ",
3506
- hostname,
3507
- tabPinned ? /* @__PURE__ */ jsxRuntime.jsxs(
3546
+ return wrap(
3547
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: wrapRef, className: "relative inline-block", children: [
3548
+ /* @__PURE__ */ jsxRuntime.jsxs(
3549
+ "button",
3550
+ {
3551
+ type: "button",
3552
+ onClick: () => setOpen((v) => !v),
3553
+ "aria-haspopup": "menu",
3554
+ "aria-expanded": open,
3555
+ "aria-label": `Signed in as ${account.didOc}. Open account menu.`,
3556
+ 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",
3557
+ "data-oc-account-menu-trigger": "",
3558
+ children: [
3559
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block size-1.5 shrink-0 rounded-full", "aria-hidden": true }),
3560
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground hidden max-w-[16ch] truncate sm:inline", children: label }),
3561
+ /* @__PURE__ */ jsxRuntime.jsx(
3562
+ "svg",
3563
+ {
3564
+ width: "9",
3565
+ height: "9",
3566
+ viewBox: "0 0 10 10",
3567
+ "aria-hidden": true,
3568
+ className: "opacity-60 transition-transform " + (open ? "rotate-180" : "rotate-0"),
3569
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3570
+ "path",
3571
+ {
3572
+ d: "M2 4 L5 7 L8 4",
3573
+ stroke: "currentColor",
3574
+ strokeWidth: "1.5",
3575
+ fill: "none",
3576
+ strokeLinecap: "round"
3577
+ }
3578
+ )
3579
+ }
3580
+ )
3581
+ ]
3582
+ }
3583
+ ),
3584
+ open && /* @__PURE__ */ jsxRuntime.jsxs(
3585
+ "div",
3586
+ {
3587
+ role: "menu",
3588
+ "aria-label": "Account menu",
3589
+ 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",
3590
+ "data-oc-account-menu-popover": "",
3591
+ children: [
3592
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border border-b p-3", children: [
3593
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-primary mb-1 font-mono text-[10px] tracking-widest uppercase", children: [
3594
+ "\xA7 signed in \xB7 ",
3595
+ hostname,
3596
+ tabPinned ? /* @__PURE__ */ jsxRuntime.jsxs(
3597
+ "span",
3598
+ {
3599
+ className: "text-muted-foreground/70 normal-case",
3600
+ "data-oc-account-menu-tab-pin": "",
3601
+ title: "This tab keeps this account even if you switch accounts in another tab",
3602
+ children: [
3603
+ " ",
3604
+ "\xB7 this tab"
3605
+ ]
3606
+ }
3607
+ ) : null
3608
+ ] }),
3609
+ /* @__PURE__ */ jsxRuntime.jsx(CopyableDid, { did: account.didOc }),
3610
+ displayName ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/80 mt-1 font-mono text-[10px] tracking-wide", children: displayName }) : null
3611
+ ] }),
3612
+ /* @__PURE__ */ jsxRuntime.jsx(
3613
+ IdentityPromoteSection,
3614
+ {
3615
+ didOc: account.didOc,
3616
+ nostrNpub: account.nostrNpub ?? null,
3617
+ current: account.displayIdentity,
3618
+ open,
3619
+ setDisplayIdentity
3620
+ }
3621
+ ),
3622
+ /* @__PURE__ */ jsxRuntime.jsx(
3623
+ AccountsSection,
3624
+ {
3625
+ roster: roster ?? [],
3626
+ switchAccount,
3627
+ addAccountUrl,
3628
+ signOut,
3629
+ onActionStart: () => setOpen(false)
3630
+ }
3631
+ ),
3632
+ primaryNavLinks && primaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
3633
+ PopoverSection,
3634
+ {
3635
+ label: "navigate",
3636
+ items: primaryNavLinks,
3637
+ onItemClick: () => setOpen(false),
3638
+ className: "hidden md:block"
3639
+ }
3640
+ ) : null,
3641
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-1", "data-oc-account-menu-section": "account", children: [
3642
+ menuItems?.map((item) => {
3643
+ const onClick = () => setOpen(false);
3644
+ const cls = "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors";
3645
+ const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3646
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3647
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: item.label }),
3648
+ item.external ? /* @__PURE__ */ jsxRuntime.jsx(
3508
3649
  "span",
3509
3650
  {
3510
- className: "text-muted-foreground/70 normal-case",
3511
- "data-oc-account-menu-tab-pin": "",
3512
- title: "This tab keeps this account even if you switch accounts in another tab",
3513
- children: [
3514
- " ",
3515
- "\xB7 this tab"
3516
- ]
3651
+ className: "text-muted-foreground/70 text-[10px]",
3652
+ "aria-hidden": true,
3653
+ children: "\u2197"
3517
3654
  }
3518
3655
  ) : null
3519
- ] }),
3520
- /* @__PURE__ */ jsxRuntime.jsx(CopyableDid, { did: account.didOc }),
3521
- displayName ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/80 mt-1 font-mono text-[10px] tracking-wide", children: displayName }) : null
3522
- ] }),
3523
- /* @__PURE__ */ jsxRuntime.jsx(
3524
- IdentityPromoteSection,
3525
- {
3526
- didOc: account.didOc,
3527
- nostrNpub: account.nostrNpub ?? null,
3528
- current: account.displayIdentity,
3529
- open,
3530
- setDisplayIdentity
3531
- }
3532
- ),
3533
- /* @__PURE__ */ jsxRuntime.jsx(
3534
- AccountsSection,
3535
- {
3536
- roster: roster ?? [],
3537
- switchAccount,
3538
- addAccountUrl,
3539
- signOut,
3540
- onActionStart: () => setOpen(false)
3541
- }
3542
- ),
3543
- primaryNavLinks && primaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
3544
- PopoverSection,
3545
- {
3546
- label: "navigate",
3547
- items: primaryNavLinks,
3548
- onItemClick: () => setOpen(false)
3549
- }
3550
- ) : null,
3551
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-1", "data-oc-account-menu-section": "account", children: [
3552
- 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,
3553
- menuItems?.map((item) => {
3554
- const onClick = () => setOpen(false);
3555
- const cls = "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors";
3556
- const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3557
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3558
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: item.label }),
3559
- item.external ? /* @__PURE__ */ jsxRuntime.jsx(
3560
- "span",
3561
- {
3562
- className: "text-muted-foreground/70 text-[10px]",
3563
- "aria-hidden": true,
3564
- children: "\u2197"
3565
- }
3566
- ) : null
3567
- ] });
3568
- return item.external ? /* @__PURE__ */ jsxRuntime.jsx(
3569
- "a",
3570
- {
3571
- href: item.href,
3572
- target: "_blank",
3573
- rel: "noreferrer",
3574
- onClick,
3575
- role: "menuitem",
3576
- className: cls,
3577
- "data-oc-account-menu-item": "",
3578
- children: inner
3579
- },
3580
- item.href
3581
- ) : /* @__PURE__ */ jsxRuntime.jsx(
3582
- Link6__default.default,
3583
- {
3584
- href: item.href,
3585
- onClick,
3586
- role: "menuitem",
3587
- className: cls,
3588
- "data-oc-account-menu-item": "",
3589
- children: inner
3590
- },
3591
- item.href
3592
- );
3593
- }),
3594
- familyDashboardEnabled ? /* @__PURE__ */ jsxRuntime.jsxs(
3656
+ ] });
3657
+ return item.external ? /* @__PURE__ */ jsxRuntime.jsx(
3595
3658
  "a",
3596
3659
  {
3597
- href: "https://ochk.io/dashboard",
3660
+ href: item.href,
3598
3661
  target: "_blank",
3599
3662
  rel: "noreferrer",
3600
- onClick: () => setOpen(false),
3663
+ onClick,
3601
3664
  role: "menuitem",
3602
- className: "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors",
3665
+ className: cls,
3603
3666
  "data-oc-account-menu-item": "",
3604
- "data-oc-account-menu-family-dashboard": "",
3605
- children: [
3606
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3607
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: "family dashboard" }),
3608
- /* @__PURE__ */ jsxRuntime.jsx(
3609
- "span",
3610
- {
3611
- className: "text-muted-foreground/70 text-[10px]",
3612
- "aria-hidden": true,
3613
- children: "\u2197"
3614
- }
3615
- )
3616
- ]
3617
- }
3618
- ) : null,
3619
- /* @__PURE__ */ jsxRuntime.jsxs(
3620
- "button",
3667
+ children: inner
3668
+ },
3669
+ item.href
3670
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
3671
+ Link6__default.default,
3621
3672
  {
3622
- type: "button",
3673
+ href: item.href,
3674
+ onClick,
3623
3675
  role: "menuitem",
3624
- onClick: () => {
3625
- setOpen(false);
3626
- void (async () => {
3627
- await signOut();
3628
- if (typeof window !== "undefined") {
3629
- window.location.assign(signOutRedirect);
3630
- }
3631
- })();
3632
- },
3633
- 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",
3676
+ className: cls,
3634
3677
  "data-oc-account-menu-item": "",
3635
- "data-oc-account-menu-signout": "",
3636
- children: [
3637
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3638
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: "sign out" })
3639
- ]
3640
- }
3641
- )
3642
- ] }),
3643
- secondaryNavLinks && secondaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
3644
- PopoverSection,
3678
+ children: inner
3679
+ },
3680
+ item.href
3681
+ );
3682
+ }),
3683
+ familyDashboardEnabled ? /* @__PURE__ */ jsxRuntime.jsxs(
3684
+ "a",
3645
3685
  {
3646
- label: "more",
3647
- items: secondaryNavLinks,
3648
- onItemClick: () => setOpen(false),
3649
- bordered: true
3686
+ href: "https://ochk.io/dashboard",
3687
+ target: "_blank",
3688
+ rel: "noreferrer",
3689
+ onClick: () => setOpen(false),
3690
+ role: "menuitem",
3691
+ className: "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors",
3692
+ "data-oc-account-menu-item": "",
3693
+ "data-oc-account-menu-family-dashboard": "",
3694
+ children: [
3695
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3696
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: "family dashboard" }),
3697
+ /* @__PURE__ */ jsxRuntime.jsx(
3698
+ "span",
3699
+ {
3700
+ className: "text-muted-foreground/70 text-[10px]",
3701
+ "aria-hidden": true,
3702
+ children: "\u2197"
3703
+ }
3704
+ )
3705
+ ]
3650
3706
  }
3651
3707
  ) : null,
3652
- build ? /* @__PURE__ */ jsxRuntime.jsx(BuildFooter, { hostname, build, state: siteState }) : null
3653
- ]
3654
- }
3655
- )
3656
- ]
3657
- }
3708
+ /* @__PURE__ */ jsxRuntime.jsxs(
3709
+ "button",
3710
+ {
3711
+ type: "button",
3712
+ role: "menuitem",
3713
+ onClick: () => {
3714
+ setOpen(false);
3715
+ void (async () => {
3716
+ await signOut();
3717
+ if (typeof window !== "undefined") {
3718
+ window.location.assign(signOutRedirect);
3719
+ }
3720
+ })();
3721
+ },
3722
+ 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",
3723
+ "data-oc-account-menu-item": "",
3724
+ "data-oc-account-menu-signout": "",
3725
+ children: [
3726
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3727
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: "sign out" })
3728
+ ]
3729
+ }
3730
+ )
3731
+ ] }),
3732
+ secondaryNavLinks && secondaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
3733
+ PopoverSection,
3734
+ {
3735
+ label: "more",
3736
+ items: secondaryNavLinks,
3737
+ onItemClick: () => setOpen(false),
3738
+ bordered: true,
3739
+ className: "hidden md:block"
3740
+ }
3741
+ ) : null,
3742
+ build ? /* @__PURE__ */ jsxRuntime.jsx(BuildFooter, { hostname, build, state: siteState }) : null
3743
+ ]
3744
+ }
3745
+ )
3746
+ ] })
3658
3747
  );
3659
3748
  }
3660
3749
  function AccountsSection({
@@ -3767,33 +3856,22 @@ function PopoverSection({
3767
3856
  label,
3768
3857
  items,
3769
3858
  onItemClick,
3770
- bordered
3859
+ bordered,
3860
+ className
3771
3861
  }) {
3772
3862
  const cls = "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors";
3773
3863
  return /* @__PURE__ */ jsxRuntime.jsxs(
3774
3864
  "div",
3775
3865
  {
3776
- className: "p-1 " + (bordered ? "border-border border-t" : ""),
3866
+ className: cn("p-1", bordered && "border-border border-t", className),
3777
3867
  "data-oc-account-menu-section": label,
3778
3868
  children: [
3779
3869
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground/60 px-3 pt-2 pb-1 font-mono text-[10px] tracking-widest uppercase", children: [
3780
3870
  "\xA7 ",
3781
3871
  label
3782
3872
  ] }),
3783
- items.map((item) => {
3784
- const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3785
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3786
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: item.label }),
3787
- item.external ? /* @__PURE__ */ jsxRuntime.jsx(
3788
- "span",
3789
- {
3790
- className: "text-muted-foreground/70 text-[10px]",
3791
- "aria-hidden": true,
3792
- children: "\u2197"
3793
- }
3794
- ) : null
3795
- ] });
3796
- return item.external ? /* @__PURE__ */ jsxRuntime.jsx(
3873
+ items.map(
3874
+ (item) => item.external ? /* @__PURE__ */ jsxRuntime.jsxs(
3797
3875
  "a",
3798
3876
  {
3799
3877
  href: item.href,
@@ -3803,10 +3881,14 @@ function PopoverSection({
3803
3881
  role: "menuitem",
3804
3882
  className: cls,
3805
3883
  "data-oc-account-menu-item": "",
3806
- children: inner
3884
+ children: [
3885
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3886
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: item.label }),
3887
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/70 text-[10px]", "aria-hidden": true, children: "\u2197" })
3888
+ ]
3807
3889
  },
3808
3890
  item.href
3809
- ) : /* @__PURE__ */ jsxRuntime.jsx(
3891
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
3810
3892
  Link6__default.default,
3811
3893
  {
3812
3894
  href: item.href,
@@ -3814,11 +3896,14 @@ function PopoverSection({
3814
3896
  role: "menuitem",
3815
3897
  className: cls,
3816
3898
  "data-oc-account-menu-item": "",
3817
- children: inner
3899
+ children: [
3900
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3901
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: item.label })
3902
+ ]
3818
3903
  },
3819
3904
  item.href
3820
- );
3821
- })
3905
+ )
3906
+ )
3822
3907
  ]
3823
3908
  }
3824
3909
  );
@@ -3870,146 +3955,54 @@ function isActive(pathname, link) {
3870
3955
  if (link.href === "/") return pathname === "/";
3871
3956
  return pathname === link.href || pathname.startsWith(link.href + "/");
3872
3957
  }
3873
- function ExternalGlyph() {
3874
- return /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-muted-foreground/60 ml-1 text-[9px]", children: "\u2197" });
3875
- }
3876
3958
  function OcPrimaryNav({
3877
3959
  activePath,
3878
3960
  links,
3879
3961
  className
3880
3962
  }) {
3881
- const [open, setOpen] = React2.useState(false);
3882
- const ref = React2.useRef(null);
3883
- const menuId = React2.useId();
3884
- React2.useEffect(() => {
3885
- setOpen(false);
3886
- }, [activePath]);
3887
- React2.useEffect(() => {
3888
- if (!open) return;
3889
- const onClick = (e) => {
3890
- if (ref.current && !ref.current.contains(e.target)) setOpen(false);
3891
- };
3892
- const onKey = (e) => {
3893
- if (e.key === "Escape") setOpen(false);
3894
- };
3895
- document.addEventListener("mousedown", onClick);
3896
- document.addEventListener("keydown", onKey);
3897
- return () => {
3898
- document.removeEventListener("mousedown", onClick);
3899
- document.removeEventListener("keydown", onKey);
3900
- };
3901
- }, [open]);
3902
- 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");
3903
- 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");
3904
- function renderInline(link) {
3905
- const active = isActive(activePath, link);
3906
- const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3907
- link.label,
3908
- link.external ? /* @__PURE__ */ jsxRuntime.jsx(ExternalGlyph, {}) : null
3909
- ] });
3910
- return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
3911
- "a",
3912
- {
3913
- href: link.href,
3914
- target: "_blank",
3915
- rel: "noreferrer",
3916
- className: inlineClass(false),
3917
- "data-oc-primary-nav-item": "",
3918
- children: inner
3919
- },
3920
- link.href
3921
- ) : /* @__PURE__ */ jsxRuntime.jsx(
3922
- Link6__default.default,
3923
- {
3924
- href: link.href,
3925
- "aria-current": active ? "page" : void 0,
3926
- className: inlineClass(active),
3927
- "data-oc-primary-nav-item": active ? "active" : "sibling",
3928
- children: inner
3929
- },
3930
- link.href
3931
- );
3932
- }
3933
- function renderRow(link) {
3934
- const active = isActive(activePath, link);
3935
- const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3936
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
3937
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: link.label }),
3938
- link.external ? /* @__PURE__ */ jsxRuntime.jsx(ExternalGlyph, {}) : null
3939
- ] });
3940
- return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
3941
- "a",
3942
- {
3943
- href: link.href,
3944
- target: "_blank",
3945
- rel: "noreferrer",
3946
- role: "menuitem",
3947
- onClick: () => setOpen(false),
3948
- className: rowClass(false),
3949
- "data-oc-primary-nav-item": "",
3950
- children: inner
3951
- },
3952
- link.href
3953
- ) : /* @__PURE__ */ jsxRuntime.jsx(
3954
- Link6__default.default,
3955
- {
3956
- href: link.href,
3957
- role: "menuitem",
3958
- "aria-current": active ? "page" : void 0,
3959
- onClick: () => setOpen(false),
3960
- className: rowClass(active),
3961
- "data-oc-primary-nav-item": active ? "active" : "sibling",
3962
- children: inner
3963
- },
3964
- link.href
3965
- );
3966
- }
3967
- return /* @__PURE__ */ jsxRuntime.jsxs(
3968
- "div",
3963
+ return /* @__PURE__ */ jsxRuntime.jsx(
3964
+ "nav",
3969
3965
  {
3970
- ref,
3971
- className: "relative flex items-center justify-center " + (className ?? ""),
3966
+ "aria-label": "primary",
3967
+ className: "hidden items-center gap-0.5 sm:gap-1 md:flex " + (className ?? ""),
3972
3968
  "data-oc-primary-nav": "",
3973
- children: [
3974
- /* @__PURE__ */ jsxRuntime.jsx(
3975
- "nav",
3976
- {
3977
- "aria-label": "primary",
3978
- className: "hidden items-center gap-0.5 sm:gap-1 md:flex",
3979
- children: links.map(renderInline)
3980
- }
3981
- ),
3982
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden", children: [
3983
- /* @__PURE__ */ jsxRuntime.jsx(
3984
- "button",
3969
+ children: links.map((link) => {
3970
+ const active = isActive(activePath, link);
3971
+ 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");
3972
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3973
+ link.label,
3974
+ link.external ? /* @__PURE__ */ jsxRuntime.jsx(
3975
+ "span",
3985
3976
  {
3986
- type: "button",
3987
- onClick: () => setOpen((v) => !v),
3988
- "aria-haspopup": "menu",
3989
- "aria-expanded": open,
3990
- "aria-controls": menuId,
3991
- "aria-label": "site navigation",
3992
- className: "border-input bg-background hover:bg-accent text-muted-foreground inline-flex size-8 items-center justify-center rounded-md border transition-colors",
3993
- "data-oc-primary-nav-toggle": "",
3994
- children: open ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-4", "aria-hidden": true }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "size-4", "aria-hidden": true })
3995
- }
3996
- ),
3997
- open && /* @__PURE__ */ jsxRuntime.jsxs(
3998
- "div",
3999
- {
4000
- id: menuId,
4001
- role: "menu",
4002
- "aria-label": "primary",
4003
- 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",
4004
- "data-oc-primary-nav-popover": "",
4005
- children: [
4006
- /* @__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" }),
4007
- links.map(renderRow)
4008
- ]
3977
+ "aria-hidden": true,
3978
+ className: "text-muted-foreground/60 ml-1 text-[9px]",
3979
+ children: "\u2197"
4009
3980
  }
4010
- )
4011
- ] })
4012
- ]
3981
+ ) : null
3982
+ ] });
3983
+ return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
3984
+ "a",
3985
+ {
3986
+ href: link.href,
3987
+ target: "_blank",
3988
+ rel: "noreferrer",
3989
+ className: cls,
3990
+ "data-oc-primary-nav-item": "",
3991
+ children: content
3992
+ },
3993
+ link.href
3994
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
3995
+ Link6__default.default,
3996
+ {
3997
+ href: link.href,
3998
+ "aria-current": active ? "page" : void 0,
3999
+ className: cls,
4000
+ "data-oc-primary-nav-item": active ? "active" : "sibling",
4001
+ children: content
4002
+ },
4003
+ link.href
4004
+ );
4005
+ })
4013
4006
  }
4014
4007
  );
4015
4008
  }
@@ -4365,6 +4358,7 @@ exports.AlertTitle = AlertTitle;
4365
4358
  exports.AlertWithAction = AlertWithAction;
4366
4359
  exports.AlertWithCountdown = AlertWithCountdown;
4367
4360
  exports.AppShell = AppShell;
4361
+ exports.AppearanceControls = AppearanceControls;
4368
4362
  exports.Badge = Badge;
4369
4363
  exports.Bar = Bar;
4370
4364
  exports.BitcoinAddress = BitcoinAddress;