@orangecheck/design 0.15.0 → 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
@@ -3464,11 +3464,11 @@ function OcAccountMenuView({
3464
3464
  "aria-haspopup": "menu",
3465
3465
  "aria-expanded": open,
3466
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-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",
3468
3468
  "data-oc-account-menu-trigger": "",
3469
3469
  children: [
3470
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block size-1.5 rounded-full", "aria-hidden": true }),
3471
- /* @__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 }),
3472
3472
  /* @__PURE__ */ jsxRuntime.jsx(
3473
3473
  "svg",
3474
3474
  {
@@ -3870,54 +3870,146 @@ function isActive(pathname, link) {
3870
3870
  if (link.href === "/") return pathname === "/";
3871
3871
  return pathname === link.href || pathname.startsWith(link.href + "/");
3872
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
+ }
3873
3876
  function OcPrimaryNav({
3874
3877
  activePath,
3875
3878
  links,
3876
3879
  className
3877
3880
  }) {
3878
- return /* @__PURE__ */ jsxRuntime.jsx(
3879
- "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",
3880
3969
  {
3881
- "aria-label": "primary",
3882
- 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 ?? ""),
3883
3972
  "data-oc-primary-nav": "",
3884
- children: links.map((link) => {
3885
- const active = isActive(activePath, link);
3886
- 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");
3887
- const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3888
- link.label,
3889
- link.external ? /* @__PURE__ */ jsxRuntime.jsx(
3890
- "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",
3891
3985
  {
3892
- "aria-hidden": true,
3893
- className: "text-muted-foreground/60 ml-1 text-[9px]",
3894
- 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 })
3895
3995
  }
3896
- ) : null
3897
- ] });
3898
- return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
3899
- "a",
3900
- {
3901
- href: link.href,
3902
- target: "_blank",
3903
- rel: "noreferrer",
3904
- className: className2,
3905
- "data-oc-primary-nav-item": "",
3906
- children: content
3907
- },
3908
- link.href
3909
- ) : /* @__PURE__ */ jsxRuntime.jsx(
3910
- Link6__default.default,
3911
- {
3912
- href: link.href,
3913
- "aria-current": active ? "page" : void 0,
3914
- className: className2,
3915
- "data-oc-primary-nav-item": active ? "active" : "sibling",
3916
- children: content
3917
- },
3918
- link.href
3919
- );
3920
- })
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
+ ]
3921
4013
  }
3922
4014
  );
3923
4015
  }
@@ -4214,13 +4306,19 @@ function LayoutSubHeader({
4214
4306
  noHeartbeat = false,
4215
4307
  className
4216
4308
  }) {
4217
- 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: [
4218
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
4219
- !noHeartbeat && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block h-1.5 w-1.5 animate-pulse rounded-full" }),
4220
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground tracking-widest uppercase", children: status }),
4221
- /* @__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 })
4222
4320
  ] }),
4223
- 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)) })
4224
4322
  ] }) });
4225
4323
  }
4226
4324
  function OcAppBar({