@orangecheck/ui 0.6.1 → 0.7.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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Boxes, ChevronDown, Check } from 'lucide-react';
2
- import Link from 'next/link';
2
+ import Link5 from 'next/link';
3
3
  import { useState, useRef, useEffect, useId } from 'react';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
  import { useOcSession } from '@orangecheck/auth-client';
@@ -137,30 +137,30 @@ function EcosystemSwitcher({
137
137
  children: [
138
138
  /* @__PURE__ */ jsx("div", { className: "label-mono text-primary border-b px-4 py-2", children: "\xA7 the family" }),
139
139
  /* @__PURE__ */ jsx("ul", { className: "py-1", children: ENTRIES.map((e) => {
140
- const isActive = e.slug === current;
140
+ const isActive2 = e.slug === current;
141
141
  return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
142
- Link,
142
+ Link5,
143
143
  {
144
144
  href: e.href,
145
145
  onClick: () => setOpen(false),
146
- "aria-current": isActive ? "page" : void 0,
147
- className: "group flex items-baseline gap-3 px-4 py-2 transition-colors " + (isActive ? "bg-primary/5" : "hover:bg-muted"),
146
+ "aria-current": isActive2 ? "page" : void 0,
147
+ className: "group flex items-baseline gap-3 px-4 py-2 transition-colors " + (isActive2 ? "bg-primary/5" : "hover:bg-muted"),
148
148
  children: [
149
149
  /* @__PURE__ */ jsx(
150
150
  "span",
151
151
  {
152
- className: "font-display flex-1 text-[12px] font-semibold tracking-tight " + (isActive ? "text-primary" : "text-foreground group-hover:text-primary transition-colors"),
152
+ className: "font-display flex-1 text-[12px] font-semibold tracking-tight " + (isActive2 ? "text-primary" : "text-foreground group-hover:text-primary transition-colors"),
153
153
  children: e.label
154
154
  }
155
155
  ),
156
156
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-mono text-[10px] tracking-wider uppercase", children: e.sub }),
157
- isActive && /* @__PURE__ */ jsx(Check, { className: "text-primary h-3 w-3" })
157
+ isActive2 && /* @__PURE__ */ jsx(Check, { className: "text-primary h-3 w-3" })
158
158
  ]
159
159
  }
160
160
  ) }, e.slug);
161
161
  }) }),
162
162
  /* @__PURE__ */ jsx("div", { className: "border-t px-4 py-2 font-mono text-[10px] tracking-widest uppercase", children: /* @__PURE__ */ jsx(
163
- Link,
163
+ Link5,
164
164
  {
165
165
  href: "https://docs.ochk.io",
166
166
  onClick: () => setOpen(false),
@@ -415,31 +415,31 @@ function OcLogoDropdown({
415
415
  }
416
416
  ),
417
417
  /* @__PURE__ */ jsx("ul", { role: "none", className: "pb-1", children: sectionEntries.map((e) => {
418
- const isActive = e.slug === current;
419
- const href = isActive ? homeHref : e.origin;
418
+ const isActive2 = e.slug === current;
419
+ const href = isActive2 ? homeHref : e.origin;
420
420
  return /* @__PURE__ */ jsx("li", { role: "none", children: /* @__PURE__ */ jsxs(
421
- Link,
421
+ Link5,
422
422
  {
423
423
  href,
424
424
  role: "menuitem",
425
425
  onClick: () => setOpen(false),
426
- "aria-current": isActive ? "page" : void 0,
427
- className: "group flex items-center gap-2 px-4 py-2 transition-colors " + (isActive ? "bg-primary/8 border-primary -ml-px border-l-2" : "hover:bg-muted -ml-px border-l-2 border-transparent"),
428
- "data-oc-logo-dropdown-item": isActive ? "current" : "sibling",
426
+ "aria-current": isActive2 ? "page" : void 0,
427
+ className: "group flex items-center gap-2 px-4 py-2 transition-colors " + (isActive2 ? "bg-primary/8 border-primary -ml-px border-l-2" : "hover:bg-muted -ml-px border-l-2 border-transparent"),
428
+ "data-oc-logo-dropdown-item": isActive2 ? "current" : "sibling",
429
429
  "data-oc-entry-category": e.category,
430
430
  children: [
431
431
  /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col leading-tight", children: [
432
432
  /* @__PURE__ */ jsx(
433
433
  "span",
434
434
  {
435
- className: "font-display text-[12px] font-semibold tracking-tight " + (isActive ? "text-primary" : "text-foreground group-hover:text-primary transition-colors"),
435
+ className: "font-display text-[12px] font-semibold tracking-tight " + (isActive2 ? "text-primary" : "text-foreground group-hover:text-primary transition-colors"),
436
436
  children: e.label
437
437
  }
438
438
  ),
439
439
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground mt-0.5 font-mono text-[10px] tracking-wide", children: e.sub })
440
440
  ] }),
441
441
  /* @__PURE__ */ jsx(MenuCategoryChip, { category: e.category }),
442
- isActive ? /* @__PURE__ */ jsxs("span", { className: "text-primary inline-flex shrink-0 items-center gap-1 font-mono text-[10px] tracking-widest uppercase", children: [
442
+ isActive2 ? /* @__PURE__ */ jsxs("span", { className: "text-primary inline-flex shrink-0 items-center gap-1 font-mono text-[10px] tracking-widest uppercase", children: [
443
443
  "home",
444
444
  /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" })
445
445
  ] }) : null
@@ -450,7 +450,7 @@ function OcLogoDropdown({
450
450
  ] }, category);
451
451
  }) }),
452
452
  /* @__PURE__ */ jsx("div", { className: "border-t px-4 py-2 font-mono text-[10px] tracking-widest uppercase", children: /* @__PURE__ */ jsx(
453
- Link,
453
+ Link5,
454
454
  {
455
455
  href: "https://docs.ochk.io",
456
456
  onClick: () => setOpen(false),
@@ -643,7 +643,7 @@ function OcAccountMenuView({
643
643
  },
644
644
  item.href
645
645
  ) : /* @__PURE__ */ jsx(
646
- Link,
646
+ Link5,
647
647
  {
648
648
  href: item.href,
649
649
  onClick,
@@ -748,6 +748,319 @@ function BuildFooter({
748
748
  }
749
749
  );
750
750
  }
751
+ function isActive(pathname, link) {
752
+ if (link.external) return false;
753
+ if (link.matchExact) return pathname === link.href;
754
+ if (link.href === "/") return pathname === "/";
755
+ return pathname === link.href || pathname.startsWith(link.href + "/");
756
+ }
757
+ function OcPrimaryNav({ activePath, links, className }) {
758
+ return /* @__PURE__ */ jsx(
759
+ "nav",
760
+ {
761
+ "aria-label": "primary",
762
+ 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 ?? ""),
763
+ "data-oc-primary-nav": "",
764
+ children: links.map((link) => {
765
+ const active = isActive(activePath, link);
766
+ const className2 = "font-display relative shrink-0 px-2 py-1 sm:px-3 text-[11px] sm:text-[12px] font-semibold tracking-wider uppercase transition-colors " + (active ? 'text-primary after:bg-primary after:absolute after:inset-x-2 after:-bottom-[13px] after:h-px after:content-[""]' : "text-muted-foreground hover:text-foreground");
767
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
768
+ link.label,
769
+ link.external ? /* @__PURE__ */ jsx(
770
+ "span",
771
+ {
772
+ "aria-hidden": true,
773
+ className: "text-muted-foreground/60 ml-1 text-[9px]",
774
+ children: "\u2197"
775
+ }
776
+ ) : null
777
+ ] });
778
+ return link.external ? /* @__PURE__ */ jsx(
779
+ "a",
780
+ {
781
+ href: link.href,
782
+ target: "_blank",
783
+ rel: "noreferrer",
784
+ className: className2,
785
+ "data-oc-primary-nav-item": "",
786
+ children: content
787
+ },
788
+ link.href
789
+ ) : /* @__PURE__ */ jsx(
790
+ Link5,
791
+ {
792
+ href: link.href,
793
+ "aria-current": active ? "page" : void 0,
794
+ className: className2,
795
+ "data-oc-primary-nav-item": active ? "active" : "sibling",
796
+ children: content
797
+ },
798
+ link.href
799
+ );
800
+ })
801
+ }
802
+ );
803
+ }
804
+ function OcDashboardShell({
805
+ rootHref = "/dashboard",
806
+ siteLabel,
807
+ tools,
808
+ active,
809
+ eyebrow,
810
+ title,
811
+ description,
812
+ children,
813
+ className
814
+ }) {
815
+ const [drawerOpen, setDrawerOpen] = useState(false);
816
+ useEffect(() => {
817
+ if (!drawerOpen) return;
818
+ function onKey(e) {
819
+ if (e.key === "Escape") setDrawerOpen(false);
820
+ }
821
+ document.addEventListener("keydown", onKey);
822
+ const prevOverflow = document.body.style.overflow;
823
+ document.body.style.overflow = "hidden";
824
+ return () => {
825
+ document.removeEventListener("keydown", onKey);
826
+ document.body.style.overflow = prevOverflow;
827
+ };
828
+ }, [drawerOpen]);
829
+ const hasHeader = Boolean(title) || Boolean(eyebrow);
830
+ return /* @__PURE__ */ jsxs(
831
+ "div",
832
+ {
833
+ className: "container " + (className ?? ""),
834
+ "data-oc-dashboard-shell": "",
835
+ children: [
836
+ /* @__PURE__ */ jsxs("div", { className: "flex min-h-[calc(100vh-3rem)] flex-col md:flex-row md:gap-8", children: [
837
+ /* @__PURE__ */ jsx(
838
+ Sidebar,
839
+ {
840
+ rootHref,
841
+ siteLabel,
842
+ tools,
843
+ active,
844
+ variant: "desktop"
845
+ }
846
+ ),
847
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
848
+ /* @__PURE__ */ jsxs("div", { className: "border-border flex items-center justify-between border-b py-3 md:hidden", children: [
849
+ /* @__PURE__ */ jsxs(
850
+ "button",
851
+ {
852
+ type: "button",
853
+ onClick: () => setDrawerOpen(true),
854
+ className: "text-muted-foreground hover:text-foreground inline-flex h-9 items-center gap-2 px-1 font-mono text-[11px] tracking-widest uppercase transition-colors",
855
+ "aria-label": "open dashboard tools",
856
+ "aria-expanded": drawerOpen,
857
+ "data-oc-dashboard-mobile-trigger": "",
858
+ children: [
859
+ /* @__PURE__ */ jsx("span", { className: "text-[14px] leading-none", children: "\u2261" }),
860
+ /* @__PURE__ */ jsx("span", { children: "tools" })
861
+ ]
862
+ }
863
+ ),
864
+ /* @__PURE__ */ jsx(
865
+ Link5,
866
+ {
867
+ href: rootHref,
868
+ className: "text-primary font-mono text-[11px] tracking-widest uppercase",
869
+ children: "\xA7 dashboard"
870
+ }
871
+ )
872
+ ] }),
873
+ /* @__PURE__ */ jsxs("div", { className: "pt-6 md:pt-3", children: [
874
+ hasHeader && /* @__PURE__ */ jsxs("div", { className: "max-w-3xl", children: [
875
+ eyebrow ? /* @__PURE__ */ jsx("div", { className: "label-mono text-primary mb-3 font-mono text-[10px] tracking-widest uppercase", children: eyebrow }) : null,
876
+ title ? /* @__PURE__ */ jsx("h1", { className: "font-display text-2xl font-bold tracking-tight sm:text-3xl", children: title }) : null,
877
+ description ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-3 max-w-[64ch] text-sm leading-relaxed", children: description }) : null
878
+ ] }),
879
+ /* @__PURE__ */ jsx("div", { className: hasHeader ? "mt-8 pb-12" : "pb-12", children })
880
+ ] })
881
+ ] })
882
+ ] }),
883
+ drawerOpen ? /* @__PURE__ */ jsxs(
884
+ "div",
885
+ {
886
+ className: "fixed inset-0 z-50 md:hidden",
887
+ role: "dialog",
888
+ "aria-modal": "true",
889
+ "aria-label": "dashboard tools",
890
+ "data-oc-dashboard-drawer": "",
891
+ children: [
892
+ /* @__PURE__ */ jsx(
893
+ "div",
894
+ {
895
+ className: "absolute inset-0 bg-background/80 backdrop-blur-sm",
896
+ onClick: () => setDrawerOpen(false),
897
+ "aria-hidden": true
898
+ }
899
+ ),
900
+ /* @__PURE__ */ jsx("div", { className: "bg-background absolute top-0 left-0 h-full w-[85vw] max-w-sm border-r shadow-xl", children: /* @__PURE__ */ jsx(
901
+ Sidebar,
902
+ {
903
+ rootHref,
904
+ siteLabel,
905
+ tools,
906
+ active,
907
+ variant: "drawer",
908
+ onClose: () => setDrawerOpen(false)
909
+ }
910
+ ) })
911
+ ]
912
+ }
913
+ ) : null
914
+ ]
915
+ }
916
+ );
917
+ }
918
+ function Sidebar({
919
+ rootHref,
920
+ siteLabel,
921
+ tools,
922
+ active,
923
+ variant,
924
+ onClose
925
+ }) {
926
+ const isDrawer = variant === "drawer";
927
+ return /* @__PURE__ */ jsxs(
928
+ "aside",
929
+ {
930
+ className: isDrawer ? "flex h-full w-full flex-col bg-card" : "hidden md:sticky md:top-4 md:flex md:h-[calc(100vh-2rem)] md:w-56 md:shrink-0 md:flex-col md:self-start md:overflow-y-auto md:rounded md:border md:bg-card/40 lg:w-60",
931
+ "aria-label": "dashboard tools",
932
+ "data-oc-dashboard-sidebar": variant,
933
+ children: [
934
+ /* @__PURE__ */ jsxs("div", { className: "border-b px-4 py-3", children: [
935
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
936
+ /* @__PURE__ */ jsx(
937
+ Link5,
938
+ {
939
+ href: rootHref,
940
+ onClick: onClose,
941
+ className: "hover:text-foreground font-display text-sm font-bold tracking-tight",
942
+ children: "\xA7 dashboard"
943
+ }
944
+ ),
945
+ isDrawer ? /* @__PURE__ */ jsx(
946
+ "button",
947
+ {
948
+ type: "button",
949
+ onClick: onClose,
950
+ className: "text-muted-foreground hover:text-foreground -mr-2 inline-flex h-8 w-8 items-center justify-center rounded font-mono text-lg",
951
+ "aria-label": "close navigation",
952
+ children: "\xD7"
953
+ }
954
+ ) : null
955
+ ] }),
956
+ siteLabel ? /* @__PURE__ */ jsx("div", { className: "text-muted-foreground/70 mt-1 font-mono text-[10px] tracking-widest uppercase", children: siteLabel }) : null
957
+ ] }),
958
+ /* @__PURE__ */ jsxs("nav", { className: "flex-1 overflow-y-auto px-2 py-3", children: [
959
+ /* @__PURE__ */ jsx("div", { className: "text-muted-foreground/60 mb-1 px-3 font-mono text-[10px] tracking-widest uppercase", children: "\xA7 tools" }),
960
+ /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: tools.map((tool) => {
961
+ const isActive2 = tool.id === active;
962
+ const innerCls = "flex items-baseline gap-2 rounded px-3 py-1.5 text-[12.5px] transition-colors " + (isActive2 ? "bg-primary/10 text-primary font-semibold" : "text-muted-foreground hover:text-foreground hover:bg-muted/30");
963
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
964
+ tool.icon ? /* @__PURE__ */ jsx(
965
+ "span",
966
+ {
967
+ className: "shrink-0 font-mono text-[11px] " + (isActive2 ? "text-primary" : "text-muted-foreground/70"),
968
+ "aria-hidden": true,
969
+ children: tool.icon
970
+ }
971
+ ) : null,
972
+ /* @__PURE__ */ jsxs("span", { className: "flex-1 leading-tight", children: [
973
+ /* @__PURE__ */ jsx("span", { children: tool.label }),
974
+ tool.tagline ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60 mt-0.5 block font-mono text-[10px] tracking-wide normal-case", children: tool.tagline }) : null
975
+ ] }),
976
+ tool.external ? /* @__PURE__ */ jsx(
977
+ "span",
978
+ {
979
+ className: "text-muted-foreground/60 text-[10px]",
980
+ "aria-hidden": true,
981
+ children: "\u2197"
982
+ }
983
+ ) : null
984
+ ] });
985
+ return /* @__PURE__ */ jsx("li", { children: tool.external ? /* @__PURE__ */ jsx(
986
+ "a",
987
+ {
988
+ href: tool.href,
989
+ target: "_blank",
990
+ rel: "noreferrer",
991
+ onClick: onClose,
992
+ className: innerCls,
993
+ "data-oc-dashboard-tool": isActive2 ? "active" : "sibling",
994
+ children: content
995
+ }
996
+ ) : /* @__PURE__ */ jsx(
997
+ Link5,
998
+ {
999
+ href: tool.href,
1000
+ onClick: onClose,
1001
+ "aria-current": isActive2 ? "page" : void 0,
1002
+ className: innerCls,
1003
+ "data-oc-dashboard-tool": isActive2 ? "active" : "sibling",
1004
+ children: content
1005
+ }
1006
+ ) }, tool.id);
1007
+ }) })
1008
+ ] })
1009
+ ]
1010
+ }
1011
+ );
1012
+ }
1013
+ function OcDashboardHub({ tools, className }) {
1014
+ return /* @__PURE__ */ jsx(
1015
+ "ul",
1016
+ {
1017
+ className: "grid gap-px border-t border-l sm:grid-cols-2 " + (className ?? ""),
1018
+ "data-oc-dashboard-hub": "",
1019
+ children: tools.map((tool) => {
1020
+ const content = /* @__PURE__ */ jsxs("span", { className: "flex h-full flex-col gap-3 p-5 transition-colors", children: [
1021
+ /* @__PURE__ */ jsxs("span", { className: "flex items-baseline gap-3", children: [
1022
+ tool.icon ? /* @__PURE__ */ jsx(
1023
+ "span",
1024
+ {
1025
+ className: "text-primary font-mono text-[13px]",
1026
+ "aria-hidden": true,
1027
+ children: tool.icon
1028
+ }
1029
+ ) : null,
1030
+ /* @__PURE__ */ jsx("span", { className: "font-display text-foreground text-base font-bold tracking-tight", children: tool.label }),
1031
+ tool.external ? /* @__PURE__ */ jsx(
1032
+ "span",
1033
+ {
1034
+ className: "text-muted-foreground/60 ml-auto text-xs",
1035
+ "aria-hidden": true,
1036
+ children: "\u2197"
1037
+ }
1038
+ ) : /* @__PURE__ */ jsx(
1039
+ "span",
1040
+ {
1041
+ className: "text-muted-foreground/60 ml-auto text-xs",
1042
+ "aria-hidden": true,
1043
+ children: "\u2192"
1044
+ }
1045
+ )
1046
+ ] }),
1047
+ tool.tagline ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm leading-relaxed", children: tool.tagline }) : null
1048
+ ] });
1049
+ const cls = "hover:bg-muted/30 group block border-r border-b transition-colors";
1050
+ return /* @__PURE__ */ jsx("li", { children: tool.external ? /* @__PURE__ */ jsx(
1051
+ "a",
1052
+ {
1053
+ href: tool.href,
1054
+ target: "_blank",
1055
+ rel: "noreferrer",
1056
+ className: cls,
1057
+ children: content
1058
+ }
1059
+ ) : /* @__PURE__ */ jsx(Link5, { href: tool.href, className: cls, children: content }) }, tool.id);
1060
+ })
1061
+ }
1062
+ );
1063
+ }
751
1064
  function AppShell({
752
1065
  eyebrow,
753
1066
  title,
@@ -831,7 +1144,7 @@ function CtaLink({
831
1144
  if (external) {
832
1145
  return /* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noreferrer", className: cls, children: text });
833
1146
  }
834
- return /* @__PURE__ */ jsx(Link, { href, className: cls, children: text });
1147
+ return /* @__PURE__ */ jsx(Link5, { href, className: cls, children: text });
835
1148
  }
836
1149
  var TONE_CLASS3 = {
837
1150
  default: "",
@@ -871,6 +1184,6 @@ function StatTile({ children, ...item }) {
871
1184
  ] });
872
1185
  }
873
1186
 
874
- export { AppShell, EcosystemSwitcher, EmptyState, FAMILY_PROPERTIES, OcAccountMenu, OcAccountMenuView, OcLogoDropdown, SITE_STATE_LABEL, SectionHeader, StatGrid, StatTile, findFamilyProperty };
1187
+ export { AppShell, EcosystemSwitcher, EmptyState, FAMILY_PROPERTIES, OcAccountMenu, OcAccountMenuView, OcDashboardHub, OcDashboardShell, OcLogoDropdown, OcPrimaryNav, SITE_STATE_LABEL, SectionHeader, StatGrid, StatTile, findFamilyProperty };
875
1188
  //# sourceMappingURL=index.mjs.map
876
1189
  //# sourceMappingURL=index.mjs.map