@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.
@@ -1370,11 +1370,11 @@ function OcAccountMenuView({
1370
1370
  "aria-haspopup": "menu",
1371
1371
  "aria-expanded": open,
1372
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-3 font-mono text-[11px] tracking-wide transition-colors",
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
1374
  "data-oc-account-menu-trigger": "",
1375
1375
  children: [
1376
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block size-1.5 rounded-full", "aria-hidden": true }),
1377
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground", children: label }),
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
1378
  /* @__PURE__ */ jsxRuntime.jsx(
1379
1379
  "svg",
1380
1380
  {
@@ -1776,54 +1776,146 @@ function isActive(pathname, link) {
1776
1776
  if (link.href === "/") return pathname === "/";
1777
1777
  return pathname === link.href || pathname.startsWith(link.href + "/");
1778
1778
  }
1779
+ function ExternalGlyph() {
1780
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-muted-foreground/60 ml-1 text-[9px]", children: "\u2197" });
1781
+ }
1779
1782
  function OcPrimaryNav({
1780
1783
  activePath,
1781
1784
  links,
1782
1785
  className
1783
1786
  }) {
1784
- return /* @__PURE__ */ jsxRuntime.jsx(
1785
- "nav",
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",
1786
1875
  {
1787
- "aria-label": "primary",
1788
- 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 ?? ""),
1876
+ ref,
1877
+ className: "relative flex items-center justify-center " + (className ?? ""),
1789
1878
  "data-oc-primary-nav": "",
1790
- children: links.map((link) => {
1791
- const active = isActive(activePath, link);
1792
- 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");
1793
- const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1794
- link.label,
1795
- link.external ? /* @__PURE__ */ jsxRuntime.jsx(
1796
- "span",
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",
1797
1891
  {
1798
- "aria-hidden": true,
1799
- className: "text-muted-foreground/60 ml-1 text-[9px]",
1800
- children: "\u2197"
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 })
1801
1901
  }
1802
- ) : null
1803
- ] });
1804
- return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
1805
- "a",
1806
- {
1807
- href: link.href,
1808
- target: "_blank",
1809
- rel: "noreferrer",
1810
- className: className2,
1811
- "data-oc-primary-nav-item": "",
1812
- children: content
1813
- },
1814
- link.href
1815
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1816
- Link6__default.default,
1817
- {
1818
- href: link.href,
1819
- "aria-current": active ? "page" : void 0,
1820
- className: className2,
1821
- "data-oc-primary-nav-item": active ? "active" : "sibling",
1822
- children: content
1823
- },
1824
- link.href
1825
- );
1826
- })
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
+ ]
1827
1919
  }
1828
1920
  );
1829
1921
  }
@@ -2120,13 +2212,19 @@ function LayoutSubHeader({
2120
2212
  noHeartbeat = false,
2121
2213
  className
2122
2214
  }) {
2123
- 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: [
2124
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
2125
- !noHeartbeat && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block h-1.5 w-1.5 animate-pulse rounded-full" }),
2126
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground tracking-widest uppercase", children: status }),
2127
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground", children: product })
2215
+ 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: [
2216
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [
2217
+ !noHeartbeat && /* @__PURE__ */ jsxRuntime.jsx(
2218
+ "span",
2219
+ {
2220
+ 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%)]",
2221
+ "aria-hidden": true
2222
+ }
2223
+ ),
2224
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground hidden tracking-widest whitespace-nowrap uppercase sm:inline", children: status }),
2225
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground truncate", children: product })
2128
2226
  ] }),
2129
- 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)) })
2227
+ 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)) })
2130
2228
  ] }) });
2131
2229
  }
2132
2230
  function OcAppBar({