@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/chrome.js CHANGED
@@ -1121,11 +1121,11 @@ function OcAccountMenuView({
1121
1121
  "aria-haspopup": "menu",
1122
1122
  "aria-expanded": open,
1123
1123
  "aria-label": `Signed in as ${account.didOc}. Open account menu.`,
1124
- 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",
1124
+ 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",
1125
1125
  "data-oc-account-menu-trigger": "",
1126
1126
  children: [
1127
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block size-1.5 rounded-full", "aria-hidden": true }),
1128
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground", children: label }),
1127
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block size-1.5 shrink-0 rounded-full", "aria-hidden": true }),
1128
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground hidden max-w-[16ch] truncate sm:inline", children: label }),
1129
1129
  /* @__PURE__ */ jsxRuntime.jsx(
1130
1130
  "svg",
1131
1131
  {
@@ -1527,54 +1527,146 @@ function isActive(pathname, link) {
1527
1527
  if (link.href === "/") return pathname === "/";
1528
1528
  return pathname === link.href || pathname.startsWith(link.href + "/");
1529
1529
  }
1530
+ function ExternalGlyph() {
1531
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-muted-foreground/60 ml-1 text-[9px]", children: "\u2197" });
1532
+ }
1530
1533
  function OcPrimaryNav({
1531
1534
  activePath,
1532
1535
  links,
1533
1536
  className
1534
1537
  }) {
1535
- return /* @__PURE__ */ jsxRuntime.jsx(
1536
- "nav",
1538
+ const [open, setOpen] = React.useState(false);
1539
+ const ref = React.useRef(null);
1540
+ const menuId = React.useId();
1541
+ React.useEffect(() => {
1542
+ setOpen(false);
1543
+ }, [activePath]);
1544
+ React.useEffect(() => {
1545
+ if (!open) return;
1546
+ const onClick = (e) => {
1547
+ if (ref.current && !ref.current.contains(e.target)) setOpen(false);
1548
+ };
1549
+ const onKey = (e) => {
1550
+ if (e.key === "Escape") setOpen(false);
1551
+ };
1552
+ document.addEventListener("mousedown", onClick);
1553
+ document.addEventListener("keydown", onKey);
1554
+ return () => {
1555
+ document.removeEventListener("mousedown", onClick);
1556
+ document.removeEventListener("keydown", onKey);
1557
+ };
1558
+ }, [open]);
1559
+ 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");
1560
+ 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");
1561
+ function renderInline(link) {
1562
+ const active = isActive(activePath, link);
1563
+ const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1564
+ link.label,
1565
+ link.external ? /* @__PURE__ */ jsxRuntime.jsx(ExternalGlyph, {}) : null
1566
+ ] });
1567
+ return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
1568
+ "a",
1569
+ {
1570
+ href: link.href,
1571
+ target: "_blank",
1572
+ rel: "noreferrer",
1573
+ className: inlineClass(false),
1574
+ "data-oc-primary-nav-item": "",
1575
+ children: inner
1576
+ },
1577
+ link.href
1578
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1579
+ Link5__default.default,
1580
+ {
1581
+ href: link.href,
1582
+ "aria-current": active ? "page" : void 0,
1583
+ className: inlineClass(active),
1584
+ "data-oc-primary-nav-item": active ? "active" : "sibling",
1585
+ children: inner
1586
+ },
1587
+ link.href
1588
+ );
1589
+ }
1590
+ function renderRow(link) {
1591
+ const active = isActive(activePath, link);
1592
+ const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1593
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
1594
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: link.label }),
1595
+ link.external ? /* @__PURE__ */ jsxRuntime.jsx(ExternalGlyph, {}) : null
1596
+ ] });
1597
+ return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
1598
+ "a",
1599
+ {
1600
+ href: link.href,
1601
+ target: "_blank",
1602
+ rel: "noreferrer",
1603
+ role: "menuitem",
1604
+ onClick: () => setOpen(false),
1605
+ className: rowClass(false),
1606
+ "data-oc-primary-nav-item": "",
1607
+ children: inner
1608
+ },
1609
+ link.href
1610
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1611
+ Link5__default.default,
1612
+ {
1613
+ href: link.href,
1614
+ role: "menuitem",
1615
+ "aria-current": active ? "page" : void 0,
1616
+ onClick: () => setOpen(false),
1617
+ className: rowClass(active),
1618
+ "data-oc-primary-nav-item": active ? "active" : "sibling",
1619
+ children: inner
1620
+ },
1621
+ link.href
1622
+ );
1623
+ }
1624
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1625
+ "div",
1537
1626
  {
1538
- "aria-label": "primary",
1539
- 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 ?? ""),
1627
+ ref,
1628
+ className: "relative flex items-center justify-center " + (className ?? ""),
1540
1629
  "data-oc-primary-nav": "",
1541
- children: links.map((link) => {
1542
- const active = isActive(activePath, link);
1543
- 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");
1544
- const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1545
- link.label,
1546
- link.external ? /* @__PURE__ */ jsxRuntime.jsx(
1547
- "span",
1630
+ children: [
1631
+ /* @__PURE__ */ jsxRuntime.jsx(
1632
+ "nav",
1633
+ {
1634
+ "aria-label": "primary",
1635
+ className: "hidden items-center gap-0.5 sm:gap-1 md:flex",
1636
+ children: links.map(renderInline)
1637
+ }
1638
+ ),
1639
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:hidden", children: [
1640
+ /* @__PURE__ */ jsxRuntime.jsx(
1641
+ "button",
1548
1642
  {
1549
- "aria-hidden": true,
1550
- className: "text-muted-foreground/60 ml-1 text-[9px]",
1551
- children: "\u2197"
1643
+ type: "button",
1644
+ onClick: () => setOpen((v) => !v),
1645
+ "aria-haspopup": "menu",
1646
+ "aria-expanded": open,
1647
+ "aria-controls": menuId,
1648
+ "aria-label": "site navigation",
1649
+ className: "border-input bg-background hover:bg-accent text-muted-foreground inline-flex size-8 items-center justify-center rounded-md border transition-colors",
1650
+ "data-oc-primary-nav-toggle": "",
1651
+ children: open ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-4", "aria-hidden": true }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "size-4", "aria-hidden": true })
1552
1652
  }
1553
- ) : null
1554
- ] });
1555
- return link.external ? /* @__PURE__ */ jsxRuntime.jsx(
1556
- "a",
1557
- {
1558
- href: link.href,
1559
- target: "_blank",
1560
- rel: "noreferrer",
1561
- className: className2,
1562
- "data-oc-primary-nav-item": "",
1563
- children: content
1564
- },
1565
- link.href
1566
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1567
- Link5__default.default,
1568
- {
1569
- href: link.href,
1570
- "aria-current": active ? "page" : void 0,
1571
- className: className2,
1572
- "data-oc-primary-nav-item": active ? "active" : "sibling",
1573
- children: content
1574
- },
1575
- link.href
1576
- );
1577
- })
1653
+ ),
1654
+ open && /* @__PURE__ */ jsxRuntime.jsxs(
1655
+ "div",
1656
+ {
1657
+ id: menuId,
1658
+ role: "menu",
1659
+ "aria-label": "primary",
1660
+ 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",
1661
+ "data-oc-primary-nav-popover": "",
1662
+ children: [
1663
+ /* @__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" }),
1664
+ links.map(renderRow)
1665
+ ]
1666
+ }
1667
+ )
1668
+ ] })
1669
+ ]
1578
1670
  }
1579
1671
  );
1580
1672
  }
@@ -1871,13 +1963,19 @@ function LayoutSubHeader({
1871
1963
  noHeartbeat = false,
1872
1964
  className
1873
1965
  }) {
1874
- 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: [
1875
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
1876
- !noHeartbeat && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-primary inline-block h-1.5 w-1.5 animate-pulse rounded-full" }),
1877
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground tracking-widest uppercase", children: status }),
1878
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground", children: product })
1966
+ 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: [
1967
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [
1968
+ !noHeartbeat && /* @__PURE__ */ jsxRuntime.jsx(
1969
+ "span",
1970
+ {
1971
+ 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%)]",
1972
+ "aria-hidden": true
1973
+ }
1974
+ ),
1975
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground hidden tracking-widest whitespace-nowrap uppercase sm:inline", children: status }),
1976
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground truncate", children: product })
1879
1977
  ] }),
1880
- 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)) })
1978
+ 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)) })
1881
1979
  ] }) });
1882
1980
  }
1883
1981
  function OcAppBar({