@orangecheck/design 0.14.1 → 0.16.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
@@ -3360,7 +3360,11 @@ function OcAccountMenu(props) {
3360
3360
  // context (oc-www) can opt in incrementally.
3361
3361
  roster: session.roster,
3362
3362
  switchAccount: session.switchAccount,
3363
- addAccountUrl: session.addAccountUrl
3363
+ addAccountUrl: session.addAccountUrl,
3364
+ // Structural read keeps the auth-client peer floor at
3365
+ // ^2.17.0 — `tabPinned` ships in 2.18.0 and is simply
3366
+ // undefined (no hint) on older providers.
3367
+ tabPinned: session.tabPinned
3364
3368
  }
3365
3369
  }
3366
3370
  );
@@ -3389,7 +3393,8 @@ function OcAccountMenuView({
3389
3393
  setDisplayIdentity,
3390
3394
  roster,
3391
3395
  switchAccount,
3392
- addAccountUrl
3396
+ addAccountUrl,
3397
+ tabPinned
3393
3398
  } = session;
3394
3399
  const [hydrated, setHydrated] = React2.useState(false);
3395
3400
  const [open, setOpen] = React2.useState(false);
@@ -3459,11 +3464,11 @@ function OcAccountMenuView({
3459
3464
  "aria-haspopup": "menu",
3460
3465
  "aria-expanded": open,
3461
3466
  "aria-label": `Signed in as ${account.didOc}. Open account menu.`,
3462
- className: triggerClassName ?? "border-primary/40 bg-card hover:bg-accent inline-flex h-8 items-center gap-1.5 rounded-md border px-3 font-mono text-[11px] tracking-wide transition-colors",
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",
3463
3468
  "data-oc-account-menu-trigger": "",
3464
3469
  children: [
3465
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block size-1.5 rounded-full", "aria-hidden": true }),
3466
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground", children: label }),
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 }),
3467
3472
  /* @__PURE__ */ jsxRuntime.jsx(
3468
3473
  "svg",
3469
3474
  {
@@ -3498,7 +3503,19 @@ function OcAccountMenuView({
3498
3503
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border border-b p-3", children: [
3499
3504
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-primary mb-1 font-mono text-[10px] tracking-widest uppercase", children: [
3500
3505
  "\xA7 signed in \xB7 ",
3501
- hostname
3506
+ hostname,
3507
+ tabPinned ? /* @__PURE__ */ jsxRuntime.jsxs(
3508
+ "span",
3509
+ {
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
+ ]
3517
+ }
3518
+ ) : null
3502
3519
  ] }),
3503
3520
  /* @__PURE__ */ jsxRuntime.jsx(CopyableDid, { did: account.didOc }),
3504
3521
  displayName ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/80 mt-1 font-mono text-[10px] tracking-wide", children: displayName }) : null
@@ -3853,54 +3870,146 @@ function isActive(pathname, link) {
3853
3870
  if (link.href === "/") return pathname === "/";
3854
3871
  return pathname === link.href || pathname.startsWith(link.href + "/");
3855
3872
  }
3873
+ function ExternalGlyph() {
3874
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-muted-foreground/60 ml-1 text-[9px]", children: "\u2197" });
3875
+ }
3856
3876
  function OcPrimaryNav({
3857
3877
  activePath,
3858
3878
  links,
3859
3879
  className
3860
3880
  }) {
3861
- return /* @__PURE__ */ jsxRuntime.jsx(
3862
- "nav",
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",
3863
3969
  {
3864
- "aria-label": "primary",
3865
- className: "flex min-w-0 items-center justify-start overflow-x-auto gap-0.5 sm:gap-1 whitespace-nowrap [scrollbar-width:none] [&::-webkit-scrollbar]:hidden " + (className ?? ""),
3970
+ ref,
3971
+ className: "relative flex items-center justify-center " + (className ?? ""),
3866
3972
  "data-oc-primary-nav": "",
3867
- children: links.map((link) => {
3868
- const active = isActive(activePath, link);
3869
- const className2 = "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");
3870
- const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3871
- link.label,
3872
- link.external ? /* @__PURE__ */ jsxRuntime.jsx(
3873
- "span",
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",
3874
3985
  {
3875
- "aria-hidden": true,
3876
- className: "text-muted-foreground/60 ml-1 text-[9px]",
3877
- children: "\u2197"
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 })
3878
3995
  }
3879
- ) : null
3880
- ] });
3881
- return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
3882
- "a",
3883
- {
3884
- href: link.href,
3885
- target: "_blank",
3886
- rel: "noreferrer",
3887
- className: className2,
3888
- "data-oc-primary-nav-item": "",
3889
- children: content
3890
- },
3891
- link.href
3892
- ) : /* @__PURE__ */ jsxRuntime.jsx(
3893
- Link6__default.default,
3894
- {
3895
- href: link.href,
3896
- "aria-current": active ? "page" : void 0,
3897
- className: className2,
3898
- "data-oc-primary-nav-item": active ? "active" : "sibling",
3899
- children: content
3900
- },
3901
- link.href
3902
- );
3903
- })
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
+ ]
4009
+ }
4010
+ )
4011
+ ] })
4012
+ ]
3904
4013
  }
3905
4014
  );
3906
4015
  }
@@ -4197,13 +4306,19 @@ function LayoutSubHeader({
4197
4306
  noHeartbeat = false,
4198
4307
  className
4199
4308
  }) {
4200
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("border-b", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "container flex flex-wrap items-center justify-between gap-x-6 gap-y-1 py-2 font-mono text-[11px]", children: [
4201
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
4202
- !noHeartbeat && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block h-1.5 w-1.5 animate-pulse rounded-full" }),
4203
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground tracking-widest uppercase", children: status }),
4204
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground", children: product })
4309
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("oc-substrip border-b", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "container flex items-center justify-between gap-x-6 py-2 font-mono text-[11px]", children: [
4310
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [
4311
+ !noHeartbeat && /* @__PURE__ */ jsxRuntime.jsx(
4312
+ "span",
4313
+ {
4314
+ className: "bg-primary inline-block size-1.5 shrink-0 animate-pulse rounded-full ring-2 ring-[color-mix(in_oklch,var(--primary),transparent_78%)]",
4315
+ "aria-hidden": true
4316
+ }
4317
+ ),
4318
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground hidden tracking-widest whitespace-nowrap uppercase sm:inline", children: status }),
4319
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground truncate", children: product })
4205
4320
  ] }),
4206
- tags.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-1 tracking-widest uppercase", children: tags.map((tag, i) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: tag.hideBelow ? HIDE[tag.hideBelow] : void 0, children: tag.label }, i)) })
4321
+ tags.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/55 hidden shrink-0 items-center gap-x-3 tracking-wider whitespace-nowrap uppercase sm:flex", children: tags.map((tag, i) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: tag.hideBelow ? HIDE[tag.hideBelow] : void 0, children: tag.label }, i)) })
4207
4322
  ] }) });
4208
4323
  }
4209
4324
  function OcAppBar({