@alexandregme/zljs 3.11.0 → 3.12.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/CHANGELOG.md CHANGED
@@ -12,6 +12,14 @@ A change that needs action in an app has a **Migration** note. When updating, re
12
12
 
13
13
  ### Added
14
14
 
15
+ - `TopNav`, the navigation of a small screen, where `Sidebar` doesn't fit: a bar at the top of the page with a menu button on the left, the home link in the middle and an account button on the right. The menu button opens the links, and the account button opens the name and the email of the user with the logout button. It takes the same `sections`, `user`, `activeHref`, `homeHref`, `homeLabel`, `navLabel`, `logout` and `onLogout` as `Sidebar`, and `menuLabel` and `accountLabel` name its two buttons
16
+ - The type `TopNavProps`
17
+ - `Navigation`, the navigation of an app from one set of values: it shows `Sidebar` on a screen from 768px wide and `TopNav` under that, follows the screen as it is resized, and renders only one of the two. It takes the props of both. `mode` is for an app made for one kind of screen: `desktop` always shows `Sidebar` and `mobile` always shows `TopNav`. The app places it: its wrapper is a row from 768px and a column under it
18
+ - The types `NavigationProps` and `NavigationMode`
19
+ - `useIsDesktop`, the hook `Navigation` decides with: `true` on a screen from 768px wide, the `md` breakpoint of Tailwind, and `false` under that. It follows the screen as it is resized or turned, and is `null` on the server, where there is no screen
20
+ - `aria-expanded` on `Button`, for a button that opens and closes something, such as a menu
21
+ - `onClick` on `Link`, called on a click, before the navigation, such as to close the menu the link is in
22
+ - `size` on `SignOutButton`, the size of the button: `lg` is for a touch screen
15
23
  - `variant` on `Link`: `inline`, the default, is the link as it was, and `nav` is a row of a menu, 40px tall, with no underline and a translucent background on hover that works on a light or a dark surface
16
24
  - `active` on `Link`, which marks the link to the current page with `aria-current="page"`, and gives a `nav` link a background
17
25
  - `aria-label` on `Link`, the name of a link whose children have no text, such as only an icon
@@ -178,6 +178,7 @@ var Button = ({
178
178
  iconPosition = "left",
179
179
  disabled = false,
180
180
  "aria-label": ariaLabel,
181
+ "aria-expanded": ariaExpanded,
181
182
  onClick
182
183
  }) => {
183
184
  const isIconOnly = icon2 && !children;
@@ -205,6 +206,7 @@ var Button = ({
205
206
  disabled,
206
207
  onClick,
207
208
  "aria-label": ariaLabel,
209
+ "aria-expanded": ariaExpanded,
208
210
  className: button({
209
211
  variant,
210
212
  color: variant === "icon" && color !== "ghost" ? "none" : color,
@@ -617,6 +619,7 @@ var SignOutModal = ({
617
619
  import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
618
620
  var SignOutButton = ({
619
621
  label = "Sign out",
622
+ size = "md",
620
623
  confirmTitle,
621
624
  confirmLabel,
622
625
  cancelLabel,
@@ -628,7 +631,16 @@ var SignOutButton = ({
628
631
  openModal(SIGN_OUT_MODAL_ID);
629
632
  };
630
633
  return /* @__PURE__ */ jsxs4(Fragment3, { children: [
631
- /* @__PURE__ */ jsx8(Button, { color: "ghost", icon: "LogOut", "aria-label": label, onClick: ask }),
634
+ /* @__PURE__ */ jsx8(
635
+ Button,
636
+ {
637
+ color: "ghost",
638
+ size,
639
+ icon: "LogOut",
640
+ "aria-label": label,
641
+ onClick: ask
642
+ }
643
+ ),
632
644
  /* @__PURE__ */ jsx8(
633
645
  SignOutModal,
634
646
  {
@@ -690,13 +702,15 @@ var Link = ({
690
702
  variant = "inline",
691
703
  color = "primary",
692
704
  active = false,
693
- "aria-label": ariaLabel
705
+ "aria-label": ariaLabel,
706
+ onClick
694
707
  }) => {
695
708
  return /* @__PURE__ */ jsx9(
696
709
  NextLink,
697
710
  {
698
711
  href,
699
712
  "aria-label": ariaLabel,
713
+ onClick,
700
714
  className: link({ variant, color, active }),
701
715
  ...active && { "aria-current": "page" },
702
716
  children
@@ -704,14 +718,275 @@ var Link = ({
704
718
  );
705
719
  };
706
720
 
721
+ // core/sidebar/sidebar.tsx
722
+ import { useState } from "react";
723
+
724
+ // core/sidebar/sidebar.styles.ts
725
+ import { tv as tv8 } from "tailwind-variants";
726
+ var sidebar = tv8({
727
+ base: "h-dvh bg-neutral-800 text-neutral-300 flex flex-col overflow-hidden transition-[width] duration-200 divide-y divide-neutral-600/50",
728
+ variants: {
729
+ collapsed: {
730
+ true: "w-14",
731
+ false: "w-64"
732
+ }
733
+ }
734
+ });
735
+ var nav = tv8({
736
+ base: "flex-1 min-h-0 overflow-y-auto overflow-x-hidden divide-y divide-neutral-600/50"
737
+ });
738
+ var header2 = tv8({
739
+ base: "shrink-0 p-2"
740
+ });
741
+ var section = tv8({
742
+ base: "grid gap-1 p-2"
743
+ });
744
+ var footer = tv8({
745
+ base: "shrink-0 h-16 p-3 flex items-center gap-3",
746
+ variants: {
747
+ collapsed: {
748
+ true: "justify-center"
749
+ }
750
+ }
751
+ });
752
+ var avatar = tv8({
753
+ base: "shrink-0 size-8 rounded-full bg-neutral-600 text-white text-xs font-medium flex items-center justify-center"
754
+ });
755
+ var userInfo = tv8({
756
+ base: "flex flex-col min-w-0 text-white [&>*]:truncate [&>*:last-child]:text-xs [&>*:last-child]:text-neutral-400"
757
+ });
758
+ var toggleButton = tv8({
759
+ base: "shrink-0 h-14 grid p-2 [&>button]:justify-start [&>button]:px-3 [&>button]:overflow-hidden [&>button]:whitespace-nowrap"
760
+ });
761
+
762
+ // core/sidebar/sidebar.tsx
763
+ import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
764
+ var getInitials = (name) => {
765
+ const parts = name.trim().split(/\s+/);
766
+ if (parts.length >= 2) {
767
+ return `${parts[0][0]}${parts[parts.length - 1][0]}`.toUpperCase();
768
+ }
769
+ return (parts[0]?.[0] ?? "").toUpperCase();
770
+ };
771
+ var Sidebar = ({
772
+ sections,
773
+ user,
774
+ activeHref,
775
+ defaultCollapsed = false,
776
+ collapseLabel,
777
+ expandLabel = "Expand sidebar",
778
+ homeHref = "/",
779
+ homeLabel,
780
+ navLabel = "Main navigation",
781
+ logout = {},
782
+ onLogout
783
+ }) => {
784
+ const [collapsed, setCollapsed] = useState(defaultCollapsed);
785
+ const initials = getInitials(user.name);
786
+ const toggleLabel = collapsed ? expandLabel : collapseLabel;
787
+ const toggleIcon = collapsed ? "ChevronRight" : "ChevronLeft";
788
+ const toggle = () => {
789
+ setCollapsed(!collapsed);
790
+ };
791
+ return /* @__PURE__ */ jsxs5("aside", { className: sidebar({ collapsed }), children: [
792
+ homeHref && /* @__PURE__ */ jsx10("div", { className: header2(), children: /* @__PURE__ */ jsxs5(
793
+ Link,
794
+ {
795
+ href: homeHref,
796
+ variant: "nav",
797
+ color: "none",
798
+ active: homeHref === activeHref,
799
+ "aria-label": homeLabel || "Home",
800
+ children: [
801
+ /* @__PURE__ */ jsx10(Icon, { name: "Home" }),
802
+ homeLabel && !collapsed && /* @__PURE__ */ jsx10(Text, { as: "span", variant: "caption", children: homeLabel })
803
+ ]
804
+ }
805
+ ) }),
806
+ /* @__PURE__ */ jsx10("nav", { "aria-label": navLabel, className: nav(), children: sections.map((sectionData, i) => /* @__PURE__ */ jsx10("div", { className: section(), children: sectionData.items.map((sidebarItem) => /* @__PURE__ */ jsxs5(
807
+ Link,
808
+ {
809
+ href: sidebarItem.href,
810
+ variant: "nav",
811
+ color: "none",
812
+ active: sidebarItem.href === activeHref,
813
+ "aria-label": sidebarItem.label,
814
+ children: [
815
+ /* @__PURE__ */ jsx10(Icon, { name: sidebarItem.icon }),
816
+ !collapsed && /* @__PURE__ */ jsx10(Text, { as: "span", variant: "caption", children: sidebarItem.label })
817
+ ]
818
+ },
819
+ sidebarItem.href
820
+ )) }, i)) }),
821
+ /* @__PURE__ */ jsxs5("div", { className: footer({ collapsed }), children: [
822
+ !collapsed && /* @__PURE__ */ jsxs5(Fragment4, { children: [
823
+ /* @__PURE__ */ jsx10("div", { "aria-hidden": "true", className: avatar(), children: initials }),
824
+ /* @__PURE__ */ jsxs5("div", { className: userInfo(), children: [
825
+ /* @__PURE__ */ jsx10(Text, { as: "span", variant: "caption", children: user.name }),
826
+ /* @__PURE__ */ jsx10(Text, { as: "span", variant: "caption", children: user.email })
827
+ ] })
828
+ ] }),
829
+ /* @__PURE__ */ jsx10(
830
+ SignOutButton,
831
+ {
832
+ label: logout.label,
833
+ confirmTitle: logout.confirmTitle,
834
+ confirmLabel: logout.confirmLabel,
835
+ cancelLabel: logout.cancelLabel,
836
+ errorMessage: logout.errorMessage,
837
+ onSignOut: onLogout
838
+ }
839
+ )
840
+ ] }),
841
+ /* @__PURE__ */ jsx10("div", { className: toggleButton(), children: /* @__PURE__ */ jsx10(
842
+ Button,
843
+ {
844
+ color: "ghost",
845
+ icon: toggleIcon,
846
+ "aria-label": toggleLabel,
847
+ onClick: toggle,
848
+ children: !collapsed && collapseLabel
849
+ }
850
+ ) })
851
+ ] });
852
+ };
853
+
854
+ // core/top-nav/top-nav.tsx
855
+ import { useState as useState2 } from "react";
856
+
857
+ // core/top-nav/top-nav.styles.ts
858
+ import { tv as tv9 } from "tailwind-variants";
859
+ var topNav = tv9({
860
+ slots: {
861
+ // The panels hang from it, so it is their anchor. The safe area keeps the
862
+ // bar under the notch of a phone.
863
+ base: "relative shrink-0 bg-neutral-800 pt-[env(safe-area-inset-top)] text-neutral-300",
864
+ bar: "flex h-14 items-center gap-1 px-2",
865
+ // Takes what the two buttons leave, with the home link in the middle of it.
866
+ home: "flex min-w-0 flex-1 justify-center",
867
+ // Over the page, under the bar, as wide as the screen. It scrolls when the
868
+ // links don't fit in what is left of the screen.
869
+ menu: "absolute inset-x-0 top-full z-10 max-h-[calc(100dvh-3.5rem)] divide-y divide-neutral-600/50 overflow-y-auto border-t border-neutral-600/50 bg-neutral-800 shadow-lg",
870
+ section: "grid gap-1 p-2",
871
+ account: "absolute inset-x-0 top-full z-10 flex items-center gap-3 border-t border-neutral-600/50 bg-neutral-800 p-3 shadow-lg",
872
+ // Text takes no className, so the cut of a long name or email is set from here.
873
+ user: "flex min-w-0 flex-1 flex-col text-white [&>*]:truncate"
874
+ }
875
+ });
876
+
877
+ // core/top-nav/top-nav.tsx
878
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
879
+ var TopNav = ({
880
+ sections,
881
+ user,
882
+ activeHref,
883
+ homeHref = "/",
884
+ homeLabel,
885
+ navLabel = "Main navigation",
886
+ menuLabel = "Menu",
887
+ accountLabel = "Account",
888
+ logout = {},
889
+ onLogout
890
+ }) => {
891
+ const [open, setOpen] = useState2(null);
892
+ const styles = topNav();
893
+ const menuOpen = open === "menu";
894
+ const accountOpen = open === "account";
895
+ const menuIcon = menuOpen ? "X" : "Menu";
896
+ const toggleMenu = () => {
897
+ setOpen(menuOpen ? null : "menu");
898
+ };
899
+ const toggleAccount = () => {
900
+ setOpen(accountOpen ? null : "account");
901
+ };
902
+ const close = () => {
903
+ setOpen(null);
904
+ };
905
+ return /* @__PURE__ */ jsxs6("header", { className: styles.base(), children: [
906
+ /* @__PURE__ */ jsxs6("div", { className: styles.bar(), children: [
907
+ /* @__PURE__ */ jsx11(
908
+ Button,
909
+ {
910
+ color: "ghost",
911
+ size: "lg",
912
+ icon: menuIcon,
913
+ "aria-label": menuLabel,
914
+ "aria-expanded": menuOpen,
915
+ onClick: toggleMenu
916
+ }
917
+ ),
918
+ /* @__PURE__ */ jsx11("div", { className: styles.home(), children: homeHref && /* @__PURE__ */ jsxs6(
919
+ Link,
920
+ {
921
+ href: homeHref,
922
+ variant: "nav",
923
+ color: "none",
924
+ active: homeHref === activeHref,
925
+ "aria-label": homeLabel || "Home",
926
+ onClick: close,
927
+ children: [
928
+ /* @__PURE__ */ jsx11(Icon, { name: "Home" }),
929
+ homeLabel && /* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: homeLabel })
930
+ ]
931
+ }
932
+ ) }),
933
+ /* @__PURE__ */ jsx11(
934
+ Button,
935
+ {
936
+ color: "ghost",
937
+ size: "lg",
938
+ icon: "User",
939
+ "aria-label": accountLabel,
940
+ "aria-expanded": accountOpen,
941
+ onClick: toggleAccount
942
+ }
943
+ )
944
+ ] }),
945
+ accountOpen && /* @__PURE__ */ jsxs6("div", { className: styles.account(), children: [
946
+ /* @__PURE__ */ jsxs6("div", { className: styles.user(), children: [
947
+ /* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: user.name }),
948
+ /* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: user.email })
949
+ ] }),
950
+ /* @__PURE__ */ jsx11(
951
+ SignOutButton,
952
+ {
953
+ size: "lg",
954
+ label: logout.label,
955
+ confirmTitle: logout.confirmTitle,
956
+ confirmLabel: logout.confirmLabel,
957
+ cancelLabel: logout.cancelLabel,
958
+ errorMessage: logout.errorMessage,
959
+ onSignOut: onLogout
960
+ }
961
+ )
962
+ ] }),
963
+ menuOpen && /* @__PURE__ */ jsx11("nav", { "aria-label": navLabel, className: styles.menu(), children: sections.map((section2, i) => /* @__PURE__ */ jsx11("div", { className: styles.section(), children: section2.items.map((item) => /* @__PURE__ */ jsxs6(
964
+ Link,
965
+ {
966
+ href: item.href,
967
+ variant: "nav",
968
+ color: "none",
969
+ active: item.href === activeHref,
970
+ "aria-label": item.label,
971
+ onClick: close,
972
+ children: [
973
+ /* @__PURE__ */ jsx11(Icon, { name: item.icon }),
974
+ /* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: item.label })
975
+ ]
976
+ },
977
+ item.href
978
+ )) }, i)) })
979
+ ] });
980
+ };
981
+
707
982
  // features/toaster/components/toaster/toaster.tsx
708
983
  import { useEffect } from "react";
709
984
  import { Toaster as SonnerToaster, toast } from "sonner";
710
985
 
711
986
  // features/toaster/components/toaster/toaster.styles.ts
712
- import { tv as tv8 } from "tailwind-variants";
987
+ import { tv as tv10 } from "tailwind-variants";
713
988
  var focusOutline = "focus-visible:outline-2! focus-visible:outline-offset-2! focus-visible:outline-current!";
714
- var toaster = tv8({
989
+ var toaster = tv10({
715
990
  slots: {
716
991
  toast: focusOutline,
717
992
  closeButton: focusOutline
@@ -733,7 +1008,7 @@ var toasterColors = {
733
1008
  };
734
1009
 
735
1010
  // features/toaster/components/toaster/toaster.tsx
736
- import { jsx as jsx10 } from "react/jsx-runtime";
1011
+ import { jsx as jsx12 } from "react/jsx-runtime";
737
1012
  var Toaster = () => {
738
1013
  const toasts = useToastStore((s) => s.toasts);
739
1014
  const removeToast = useToastStore((s) => s.removeToast);
@@ -744,7 +1019,7 @@ var Toaster = () => {
744
1019
  removeToast(t.id);
745
1020
  });
746
1021
  }, [toasts, removeToast]);
747
- return /* @__PURE__ */ jsx10(
1022
+ return /* @__PURE__ */ jsx12(
748
1023
  SonnerToaster,
749
1024
  {
750
1025
  position: "bottom-right",
@@ -772,44 +1047,120 @@ var spinnerIcons = {
772
1047
  };
773
1048
 
774
1049
  // core/spinner/spinner.styles.ts
775
- import { tv as tv9 } from "tailwind-variants";
776
- var spinner = tv9({
1050
+ import { tv as tv11 } from "tailwind-variants";
1051
+ var spinner = tv11({
777
1052
  base: "inline-flex animate-spin"
778
1053
  });
779
1054
 
780
1055
  // core/spinner/spinner.tsx
781
- import { jsx as jsx11 } from "react/jsx-runtime";
1056
+ import { jsx as jsx13 } from "react/jsx-runtime";
782
1057
  var Spinner = ({
783
1058
  variant = "circle",
784
1059
  size = "md",
785
1060
  label = "Loading"
786
- }) => /* @__PURE__ */ jsx11(
1061
+ }) => /* @__PURE__ */ jsx13(
787
1062
  "span",
788
1063
  {
789
1064
  "data-testid": "spinner",
790
1065
  role: "status",
791
1066
  "aria-label": label,
792
1067
  className: spinner(),
793
- children: /* @__PURE__ */ jsx11(Icon, { name: spinnerIcons[variant], size })
1068
+ children: /* @__PURE__ */ jsx13(Icon, { name: spinnerIcons[variant], size })
794
1069
  }
795
1070
  );
796
1071
 
797
1072
  // features/app/components/loader/loader.styles.ts
798
- import { tv as tv10 } from "tailwind-variants";
799
- var loader = tv10({
1073
+ import { tv as tv12 } from "tailwind-variants";
1074
+ var loader = tv12({
800
1075
  base: "flex fixed inset-0 justify-center items-center bg-black/20 text-zl-primary z-50"
801
1076
  });
802
1077
 
803
1078
  // features/app/components/loader/loader.tsx
804
- import { jsx as jsx12 } from "react/jsx-runtime";
1079
+ import { jsx as jsx14 } from "react/jsx-runtime";
805
1080
  var Loader = ({ label = "Loading" }) => {
806
1081
  const fetching = useAppStore((s) => s.fetching);
807
1082
  if (!fetching) return null;
808
- return /* @__PURE__ */ jsx12("div", { className: loader(), children: /* @__PURE__ */ jsx12(Spinner, { size: "lg", label }) });
1083
+ return /* @__PURE__ */ jsx14("div", { className: loader(), children: /* @__PURE__ */ jsx14(Spinner, { size: "lg", label }) });
1084
+ };
1085
+
1086
+ // features/app/hooks/use-is-desktop/use-is-desktop.ts
1087
+ import { useSyncExternalStore } from "react";
1088
+
1089
+ // features/app/hooks/use-is-desktop/use-is-desktop.const.ts
1090
+ var DESKTOP_QUERY = "(min-width: 768px)";
1091
+
1092
+ // features/app/hooks/use-is-desktop/use-is-desktop.ts
1093
+ var subscribe = (onChange) => {
1094
+ const media = window.matchMedia(DESKTOP_QUERY);
1095
+ media.addEventListener("change", onChange);
1096
+ return () => {
1097
+ media.removeEventListener("change", onChange);
1098
+ };
1099
+ };
1100
+ var isDesktop = () => window.matchMedia(DESKTOP_QUERY).matches;
1101
+ var unknown = () => null;
1102
+ var useIsDesktop = () => useSyncExternalStore(subscribe, isDesktop, unknown);
1103
+
1104
+ // features/app/components/navigation/navigation.tsx
1105
+ import { jsx as jsx15 } from "react/jsx-runtime";
1106
+ var Navigation = ({
1107
+ mode = "auto",
1108
+ sections,
1109
+ user,
1110
+ activeHref,
1111
+ defaultCollapsed,
1112
+ collapseLabel,
1113
+ expandLabel,
1114
+ homeHref,
1115
+ homeLabel,
1116
+ navLabel,
1117
+ menuLabel,
1118
+ accountLabel,
1119
+ logout,
1120
+ onLogout
1121
+ }) => {
1122
+ const fitsSidebar = useIsDesktop();
1123
+ const desktop = mode === "auto" ? fitsSidebar : mode === "desktop";
1124
+ if (desktop === null) {
1125
+ return null;
1126
+ }
1127
+ if (desktop) {
1128
+ return /* @__PURE__ */ jsx15(
1129
+ Sidebar,
1130
+ {
1131
+ sections,
1132
+ user,
1133
+ activeHref,
1134
+ defaultCollapsed,
1135
+ collapseLabel,
1136
+ expandLabel,
1137
+ homeHref,
1138
+ homeLabel,
1139
+ navLabel,
1140
+ logout,
1141
+ onLogout
1142
+ }
1143
+ );
1144
+ }
1145
+ return /* @__PURE__ */ jsx15(
1146
+ TopNav,
1147
+ {
1148
+ sections,
1149
+ user,
1150
+ activeHref,
1151
+ homeHref,
1152
+ homeLabel,
1153
+ navLabel,
1154
+ menuLabel,
1155
+ accountLabel,
1156
+ logout,
1157
+ onLogout
1158
+ }
1159
+ );
809
1160
  };
810
1161
 
811
1162
  // core/state/redux/redux-provider/redux-provider.tsx
812
- import { useState } from "react";
1163
+ import { useState as useState3 } from "react";
813
1164
  import { Provider } from "react-redux";
814
1165
 
815
1166
  // core/state/redux/store/store.ts
@@ -842,7 +1193,7 @@ var createReduxStore = ({
842
1193
  };
843
1194
 
844
1195
  // core/state/redux/redux-provider/redux-provider.tsx
845
- import { jsx as jsx13 } from "react/jsx-runtime";
1196
+ import { jsx as jsx16 } from "react/jsx-runtime";
846
1197
  var ReduxProvider = ({
847
1198
  children,
848
1199
  reducers = {},
@@ -850,7 +1201,7 @@ var ReduxProvider = ({
850
1201
  preloadedState = {},
851
1202
  coreReducers = {}
852
1203
  }) => {
853
- const [store] = useState(
1204
+ const [store] = useState3(
854
1205
  () => createReduxStore({
855
1206
  reducers,
856
1207
  middlewares,
@@ -858,7 +1209,7 @@ var ReduxProvider = ({
858
1209
  coreReducers
859
1210
  })
860
1211
  );
861
- return /* @__PURE__ */ jsx13(Provider, { store, children });
1212
+ return /* @__PURE__ */ jsx16(Provider, { store, children });
862
1213
  };
863
1214
 
864
1215
  // core/state/zustand/router/router.utils.ts
@@ -919,8 +1270,8 @@ var usePageStore = create5()(
919
1270
  );
920
1271
 
921
1272
  // core/card/card.styles.ts
922
- import { tv as tv11 } from "tailwind-variants";
923
- var card = tv11({
1273
+ import { tv as tv13 } from "tailwind-variants";
1274
+ var card = tv13({
924
1275
  slots: {
925
1276
  // A soft, wide shadow in the color of the card. shadow-sm only spreads 1 to
926
1277
  // 3px and reads as part of the border on a white page.
@@ -950,7 +1301,7 @@ var card = tv11({
950
1301
  });
951
1302
 
952
1303
  // core/card/card.tsx
953
- import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
1304
+ import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
954
1305
  var Card = ({
955
1306
  children,
956
1307
  title: title2,
@@ -958,27 +1309,27 @@ var Card = ({
958
1309
  message,
959
1310
  color = "none"
960
1311
  }) => {
961
- const { base, header: header2 } = card({ color });
1312
+ const { base, header: header3 } = card({ color });
962
1313
  const messageColor = color === "none" ? "muted" : "none";
963
- return /* @__PURE__ */ jsxs5("div", { "data-testid": "card", className: base(), children: [
964
- (title2 || message) && /* @__PURE__ */ jsxs5("div", { className: header2(), children: [
965
- title2 && /* @__PURE__ */ jsx14(Heading, { level: titleLevel, children: title2 }),
966
- message && /* @__PURE__ */ jsx14(Text, { color: messageColor, children: message })
1314
+ return /* @__PURE__ */ jsxs7("div", { "data-testid": "card", className: base(), children: [
1315
+ (title2 || message) && /* @__PURE__ */ jsxs7("div", { className: header3(), children: [
1316
+ title2 && /* @__PURE__ */ jsx17(Heading, { level: titleLevel, children: title2 }),
1317
+ message && /* @__PURE__ */ jsx17(Text, { color: messageColor, children: message })
967
1318
  ] }),
968
1319
  children
969
1320
  ] });
970
1321
  };
971
1322
 
972
1323
  // features/auth/components/access-pending/access-pending.styles.ts
973
- import { tv as tv12 } from "tailwind-variants";
974
- var accessPending = tv12({
1324
+ import { tv as tv14 } from "tailwind-variants";
1325
+ var accessPending = tv14({
975
1326
  slots: {
976
1327
  account: "flex items-center justify-between gap-3"
977
1328
  }
978
1329
  });
979
1330
 
980
1331
  // features/auth/components/access-pending/access-pending.tsx
981
- import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
1332
+ import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
982
1333
  var AccessPending = ({
983
1334
  title: title2 = "Waiting for approval",
984
1335
  message = "Your access to this app has not been approved yet.",
@@ -993,9 +1344,9 @@ var AccessPending = ({
993
1344
  if (!user) {
994
1345
  return null;
995
1346
  }
996
- return /* @__PURE__ */ jsx15(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsxs6("div", { className: account(), children: [
997
- /* @__PURE__ */ jsx15(Text, { variant: "caption", color: "muted", children: user.email }),
998
- /* @__PURE__ */ jsx15(
1347
+ return /* @__PURE__ */ jsx18(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsxs8("div", { className: account(), children: [
1348
+ /* @__PURE__ */ jsx18(Text, { variant: "caption", color: "muted", children: user.email }),
1349
+ /* @__PURE__ */ jsx18(
999
1350
  SignOutButton,
1000
1351
  {
1001
1352
  label: signOutLabel,
@@ -1010,7 +1361,7 @@ var AccessPending = ({
1010
1361
 
1011
1362
  // features/auth/components/auth-provider/auth-provider.tsx
1012
1363
  import { useEffect as useEffect2 } from "react";
1013
- import { Fragment as Fragment4, jsx as jsx16 } from "react/jsx-runtime";
1364
+ import { Fragment as Fragment5, jsx as jsx19 } from "react/jsx-runtime";
1014
1365
  var AuthProvider = ({
1015
1366
  adapter,
1016
1367
  appId,
@@ -1027,7 +1378,7 @@ var AuthProvider = ({
1027
1378
  reset();
1028
1379
  };
1029
1380
  }, [adapter, appId, configure, setSession, reset]);
1030
- return /* @__PURE__ */ jsx16(Fragment4, { children });
1381
+ return /* @__PURE__ */ jsx19(Fragment5, { children });
1031
1382
  };
1032
1383
 
1033
1384
  // features/auth/components/login/login.const.ts
@@ -1041,15 +1392,15 @@ var loginVendors = {
1041
1392
  };
1042
1393
 
1043
1394
  // features/auth/components/login/login.styles.ts
1044
- import { tv as tv13 } from "tailwind-variants";
1045
- var login = tv13({
1395
+ import { tv as tv15 } from "tailwind-variants";
1396
+ var login = tv15({
1046
1397
  slots: {
1047
1398
  options: "flex flex-col gap-3"
1048
1399
  }
1049
1400
  });
1050
1401
 
1051
1402
  // features/auth/components/login/login.tsx
1052
- import { jsx as jsx17 } from "react/jsx-runtime";
1403
+ import { jsx as jsx20 } from "react/jsx-runtime";
1053
1404
  var LoginProviderButton = ({
1054
1405
  id,
1055
1406
  label,
@@ -1058,7 +1409,7 @@ var LoginProviderButton = ({
1058
1409
  const signIn = () => {
1059
1410
  onSignIn(id);
1060
1411
  };
1061
- return /* @__PURE__ */ jsx17(Button, { size: "lg", fullWidth: true, onClick: signIn, children: label });
1412
+ return /* @__PURE__ */ jsx20(Button, { size: "lg", fullWidth: true, onClick: signIn, children: label });
1062
1413
  };
1063
1414
  var Login = ({
1064
1415
  vendor,
@@ -1076,9 +1427,9 @@ var Login = ({
1076
1427
  useToastStore.getState().error(errorMessage);
1077
1428
  });
1078
1429
  };
1079
- return /* @__PURE__ */ jsx17(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsx17("div", { className: options(), children: providers.map((provider) => {
1430
+ return /* @__PURE__ */ jsx20(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsx20("div", { className: options(), children: providers.map((provider) => {
1080
1431
  const id = String(provider);
1081
- return /* @__PURE__ */ jsx17(
1432
+ return /* @__PURE__ */ jsx20(
1082
1433
  LoginProviderButton,
1083
1434
  {
1084
1435
  id,
@@ -1091,7 +1442,7 @@ var Login = ({
1091
1442
  };
1092
1443
 
1093
1444
  // features/auth/components/authorized/authorized.tsx
1094
- import { Fragment as Fragment5, jsx as jsx18 } from "react/jsx-runtime";
1445
+ import { Fragment as Fragment6, jsx as jsx21 } from "react/jsx-runtime";
1095
1446
  var Authorized = ({
1096
1447
  children,
1097
1448
  roles,
@@ -1100,18 +1451,18 @@ var Authorized = ({
1100
1451
  }) => {
1101
1452
  const { status, user, role } = useAuth();
1102
1453
  if (status === "loading") return null;
1103
- if (!user) return /* @__PURE__ */ jsx18(Login, { ...login2 });
1454
+ if (!user) return /* @__PURE__ */ jsx21(Login, { ...login2 });
1104
1455
  const hasRole = !roles || role !== null && roles.includes(role);
1105
- if (!user.hasAccess || !hasRole) return /* @__PURE__ */ jsx18(AccessPending, { ...accessPending2 });
1106
- return /* @__PURE__ */ jsx18(Fragment5, { children });
1456
+ if (!user.hasAccess || !hasRole) return /* @__PURE__ */ jsx21(AccessPending, { ...accessPending2 });
1457
+ return /* @__PURE__ */ jsx21(Fragment6, { children });
1107
1458
  };
1108
1459
 
1109
1460
  // features/providers/components/zustand-providers/zustand-providers.tsx
1110
- import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
1111
- var ZustandProviders = ({ children, auth }) => /* @__PURE__ */ jsxs7(Fragment6, { children: [
1112
- /* @__PURE__ */ jsx19(Loader, {}),
1113
- /* @__PURE__ */ jsx19(Toaster, {}),
1114
- auth ? /* @__PURE__ */ jsx19(AuthProvider, { adapter: auth.adapter, appId: auth.appId, children }) : children
1461
+ import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
1462
+ var ZustandProviders = ({ children, auth }) => /* @__PURE__ */ jsxs9(Fragment7, { children: [
1463
+ /* @__PURE__ */ jsx22(Loader, {}),
1464
+ /* @__PURE__ */ jsx22(Toaster, {}),
1465
+ auth ? /* @__PURE__ */ jsx22(AuthProvider, { adapter: auth.adapter, appId: auth.appId, children }) : children
1115
1466
  ] });
1116
1467
 
1117
1468
  export {
@@ -1128,10 +1479,14 @@ export {
1128
1479
  useAuth,
1129
1480
  SignOutButton,
1130
1481
  Link,
1482
+ Sidebar,
1483
+ TopNav,
1131
1484
  Toaster,
1132
1485
  toast2 as toast,
1133
1486
  Spinner,
1134
1487
  Loader,
1488
+ useIsDesktop,
1489
+ Navigation,
1135
1490
  ReduxProvider,
1136
1491
  splitURLasPath,
1137
1492
  useRouterStore,
package/dist/index.d.ts CHANGED
@@ -35,10 +35,12 @@ interface ButtonProps {
35
35
  iconPosition?: "left" | "right";
36
36
  disabled?: boolean;
37
37
  "aria-label"?: string;
38
+ /** For a button that opens and closes something, such as a menu. */
39
+ "aria-expanded"?: boolean;
38
40
  onClick?: () => void;
39
41
  }
40
42
 
41
- declare const Button: ({ children, type, variant: variantProp, color, size, fullWidth, icon, iconPosition, disabled, "aria-label": ariaLabel, onClick, }: ButtonProps) => react.JSX.Element;
43
+ declare const Button: ({ children, type, variant: variantProp, color, size, fullWidth, icon, iconPosition, disabled, "aria-label": ariaLabel, "aria-expanded": ariaExpanded, onClick, }: ButtonProps) => react.JSX.Element;
42
44
 
43
45
  interface DataGridCellParams<T extends Record<string, unknown> = Record<string, unknown>> {
44
46
  value?: any;
@@ -244,6 +246,8 @@ declare const Text: ({ children, as: Tag, variant, color, }: TextProps) => react
244
246
  interface SignOutButtonProps {
245
247
  /** The accessible name of the icon button. */
246
248
  label?: string;
249
+ /** The size of the icon button. `lg` is for a touch screen. */
250
+ size?: Size;
247
251
  /** The question of the modal a click opens. */
248
252
  confirmTitle?: string;
249
253
  /** The button of the modal that signs out. */
@@ -260,7 +264,7 @@ interface SignOutButtonProps {
260
264
  onSignOut?: () => void | Promise<void>;
261
265
  }
262
266
 
263
- declare const SignOutButton: ({ label, confirmTitle, confirmLabel, cancelLabel, errorMessage, onSignOut, }: SignOutButtonProps) => react.JSX.Element;
267
+ declare const SignOutButton: ({ label, size, confirmTitle, confirmLabel, cancelLabel, errorMessage, onSignOut, }: SignOutButtonProps) => react.JSX.Element;
264
268
 
265
269
  interface SidebarItem {
266
270
  icon: IconName;
@@ -323,6 +327,34 @@ interface TabsProps {
323
327
 
324
328
  declare const Tabs: ({ tabs, "aria-label": ariaLabel, defaultTab, onChange, }: TabsProps) => react.JSX.Element;
325
329
 
330
+ interface TopNavProps {
331
+ /** The same sections `Sidebar` takes. The menu button opens them. */
332
+ sections: SidebarSection[];
333
+ /** The same user `Sidebar` takes. The account button shows it. */
334
+ user: SidebarUser;
335
+ activeHref?: string;
336
+ homeHref?: string | false;
337
+ homeLabel?: string;
338
+ /** The accessible name of the navigation the menu button opens. */
339
+ navLabel?: string;
340
+ /** The accessible name of the menu button. */
341
+ menuLabel?: string;
342
+ /** The accessible name of the account button. */
343
+ accountLabel?: string;
344
+ /**
345
+ * The texts of the logout button and of the modal it opens: `label`,
346
+ * `confirmTitle`, `confirmLabel`, `cancelLabel` and `errorMessage`.
347
+ */
348
+ logout?: Omit<SignOutButtonProps, "onSignOut" | "size">;
349
+ /**
350
+ * Logs the user out. It is called when the user confirms in the modal, never
351
+ * on the first tap. A rejected promise shows the error toast.
352
+ */
353
+ onLogout: () => void | Promise<void>;
354
+ }
355
+
356
+ declare const TopNav: ({ sections, user, activeHref, homeHref, homeLabel, navLabel, menuLabel, accountLabel, logout, onLogout, }: TopNavProps) => react.JSX.Element;
357
+
326
358
  type TagColor = Exclude<SemanticColor, "none"> | AuxiliaryColor;
327
359
  interface TagProps {
328
360
  children: ReactNode;
@@ -389,6 +421,27 @@ interface LoaderProps {
389
421
 
390
422
  declare const Loader: ({ label }: LoaderProps) => react.JSX.Element | null;
391
423
 
424
+ /**
425
+ * `auto` follows the width of the screen. `desktop` and `mobile` are for an
426
+ * app made for one kind of screen only.
427
+ */
428
+ type NavigationMode = "auto" | "desktop" | "mobile";
429
+ /**
430
+ * The props of `Sidebar` and of `TopNav` together: what both take is passed to
431
+ * the one that shows, and the rest only to its owner.
432
+ */
433
+ interface NavigationProps extends SidebarProps, Pick<TopNavProps, "menuLabel" | "accountLabel"> {
434
+ mode?: NavigationMode;
435
+ }
436
+
437
+ declare const Navigation: ({ mode, sections, user, activeHref, defaultCollapsed, collapseLabel, expandLabel, homeHref, homeLabel, navLabel, menuLabel, accountLabel, logout, onLogout, }: NavigationProps) => react.JSX.Element | null;
438
+
439
+ /**
440
+ * Whether the screen fits `Sidebar`, and it follows the screen as it is
441
+ * resized or turned. `null` on the server, where there is no screen.
442
+ */
443
+ declare const useIsDesktop: () => boolean | null;
444
+
392
445
  interface AppState {
393
446
  fetchingCalls: number;
394
447
  fetching: boolean;
@@ -616,5 +669,5 @@ declare const useAuth: () => UseAuthResult;
616
669
 
617
670
  declare const ZustandProviders: ({ children, auth }: ZustandProvidersProps) => react.JSX.Element;
618
671
 
619
- export { AccessPending, AuthAdapter, AuthProvider, AuthSession, Authorized, AuxiliaryColor, Button, Card, Checkbox, ConnectedModal, DataColor, DataGrid, Error, Form, HTTPClient, Heading, Icon, Input, Loader, Login, Modal, Radio, ReduxProvider, ReduxProviderProps, Select, SemanticColor, Sidebar, SignOutButton, Spinner, StatsCard, Tabs, Tag, Text, TextArea, Toaster, WhatsAppButton, ZustandProviders, ZustandProvidersProps, appInitialState, getAuthSession, splitURLasPath, useAppStore, useAuth, usePageStore, useRouterStore, useToastStore };
620
- export type { AppState, AuthorizedProps, ButtonColor, ButtonProps, ButtonVariant, CardProps, CheckboxProps, CheckboxVariant, ConnectedModalProps, DataGridColumn, DataGridProps, ErrorProps, FormProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, InputProps, LoaderProps, LoginProvider, LoginVendor, ModalProps, PageState, RadioProps, ReduxStore, RouterState, SelectOption, SelectProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TabsItem, TabsProps, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, WhatsAppButtonProps };
672
+ export { AccessPending, AuthAdapter, AuthProvider, AuthSession, Authorized, AuxiliaryColor, Button, Card, Checkbox, ConnectedModal, DataColor, DataGrid, Error, Form, HTTPClient, Heading, Icon, Input, Loader, Login, Modal, Navigation, Radio, ReduxProvider, ReduxProviderProps, Select, SemanticColor, Sidebar, SignOutButton, Spinner, StatsCard, Tabs, Tag, Text, TextArea, Toaster, TopNav, WhatsAppButton, ZustandProviders, ZustandProvidersProps, appInitialState, getAuthSession, splitURLasPath, useAppStore, useAuth, useIsDesktop, usePageStore, useRouterStore, useToastStore };
673
+ export type { AppState, AuthorizedProps, ButtonColor, ButtonProps, ButtonVariant, CardProps, CheckboxProps, CheckboxVariant, ConnectedModalProps, DataGridColumn, DataGridProps, ErrorProps, FormProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, InputProps, LoaderProps, LoginProvider, LoginVendor, ModalProps, NavigationMode, NavigationProps, PageState, RadioProps, ReduxStore, RouterState, SelectOption, SelectProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TabsItem, TabsProps, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, TopNavProps, WhatsAppButtonProps };
package/dist/index.js CHANGED
@@ -8,15 +8,17 @@ import {
8
8
  ConnectedModal,
9
9
  Heading,
10
10
  Icon,
11
- Link,
12
11
  Loader,
13
12
  Login,
14
13
  Modal,
14
+ Navigation,
15
15
  ReduxProvider,
16
+ Sidebar,
16
17
  SignOutButton,
17
18
  Spinner,
18
19
  Text,
19
20
  Toaster,
21
+ TopNav,
20
22
  ZustandProviders,
21
23
  appInitialState,
22
24
  getAuthSession,
@@ -24,10 +26,11 @@ import {
24
26
  toast,
25
27
  useAppStore,
26
28
  useAuth,
29
+ useIsDesktop,
27
30
  usePageStore,
28
31
  useRouterStore,
29
32
  useToastStore
30
- } from "./chunk-XRJCFNLC.js";
33
+ } from "./chunk-TMUYZTIH.js";
31
34
  import {
32
35
  Error,
33
36
  FormInput,
@@ -637,145 +640,12 @@ var WhatsAppButton = ({
637
640
  return /* @__PURE__ */ jsx11(Button, { color: "success", icon: "SiWhatsapp", onClick: handleClick, children });
638
641
  };
639
642
 
640
- // core/sidebar/sidebar.tsx
641
- import { useState as useState2 } from "react";
642
-
643
- // core/sidebar/sidebar.styles.ts
644
- import { tv as tv9 } from "tailwind-variants";
645
- var sidebar = tv9({
646
- base: "h-dvh bg-neutral-800 text-neutral-300 flex flex-col overflow-hidden transition-[width] duration-200 divide-y divide-neutral-600/50",
647
- variants: {
648
- collapsed: {
649
- true: "w-14",
650
- false: "w-64"
651
- }
652
- }
653
- });
654
- var nav = tv9({
655
- base: "flex-1 min-h-0 overflow-y-auto overflow-x-hidden divide-y divide-neutral-600/50"
656
- });
657
- var header = tv9({
658
- base: "shrink-0 p-2"
659
- });
660
- var section = tv9({
661
- base: "grid gap-1 p-2"
662
- });
663
- var footer = tv9({
664
- base: "shrink-0 h-16 p-3 flex items-center gap-3",
665
- variants: {
666
- collapsed: {
667
- true: "justify-center"
668
- }
669
- }
670
- });
671
- var avatar = tv9({
672
- base: "shrink-0 size-8 rounded-full bg-neutral-600 text-white text-xs font-medium flex items-center justify-center"
673
- });
674
- var userInfo = tv9({
675
- base: "flex flex-col min-w-0 text-white [&>*]:truncate [&>*:last-child]:text-xs [&>*:last-child]:text-neutral-400"
676
- });
677
- var toggleButton = tv9({
678
- base: "shrink-0 h-14 grid p-2 [&>button]:justify-start [&>button]:px-3 [&>button]:overflow-hidden [&>button]:whitespace-nowrap"
679
- });
680
-
681
- // core/sidebar/sidebar.tsx
682
- import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
683
- var getInitials = (name) => {
684
- const parts = name.trim().split(/\s+/);
685
- if (parts.length >= 2) {
686
- return `${parts[0][0]}${parts[parts.length - 1][0]}`.toUpperCase();
687
- }
688
- return (parts[0]?.[0] ?? "").toUpperCase();
689
- };
690
- var Sidebar = ({
691
- sections,
692
- user,
693
- activeHref,
694
- defaultCollapsed = false,
695
- collapseLabel,
696
- expandLabel = "Expand sidebar",
697
- homeHref = "/",
698
- homeLabel,
699
- navLabel = "Main navigation",
700
- logout = {},
701
- onLogout
702
- }) => {
703
- const [collapsed, setCollapsed] = useState2(defaultCollapsed);
704
- const initials = getInitials(user.name);
705
- const toggleLabel = collapsed ? expandLabel : collapseLabel;
706
- const toggleIcon = collapsed ? "ChevronRight" : "ChevronLeft";
707
- const toggle = () => {
708
- setCollapsed(!collapsed);
709
- };
710
- return /* @__PURE__ */ jsxs10("aside", { className: sidebar({ collapsed }), children: [
711
- homeHref && /* @__PURE__ */ jsx12("div", { className: header(), children: /* @__PURE__ */ jsxs10(
712
- Link,
713
- {
714
- href: homeHref,
715
- variant: "nav",
716
- color: "none",
717
- active: homeHref === activeHref,
718
- "aria-label": homeLabel || "Home",
719
- children: [
720
- /* @__PURE__ */ jsx12(Icon, { name: "Home" }),
721
- homeLabel && !collapsed && /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: homeLabel })
722
- ]
723
- }
724
- ) }),
725
- /* @__PURE__ */ jsx12("nav", { "aria-label": navLabel, className: nav(), children: sections.map((sectionData, i) => /* @__PURE__ */ jsx12("div", { className: section(), children: sectionData.items.map((sidebarItem) => /* @__PURE__ */ jsxs10(
726
- Link,
727
- {
728
- href: sidebarItem.href,
729
- variant: "nav",
730
- color: "none",
731
- active: sidebarItem.href === activeHref,
732
- "aria-label": sidebarItem.label,
733
- children: [
734
- /* @__PURE__ */ jsx12(Icon, { name: sidebarItem.icon }),
735
- !collapsed && /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: sidebarItem.label })
736
- ]
737
- },
738
- sidebarItem.href
739
- )) }, i)) }),
740
- /* @__PURE__ */ jsxs10("div", { className: footer({ collapsed }), children: [
741
- !collapsed && /* @__PURE__ */ jsxs10(Fragment2, { children: [
742
- /* @__PURE__ */ jsx12("div", { "aria-hidden": "true", className: avatar(), children: initials }),
743
- /* @__PURE__ */ jsxs10("div", { className: userInfo(), children: [
744
- /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: user.name }),
745
- /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: user.email })
746
- ] })
747
- ] }),
748
- /* @__PURE__ */ jsx12(
749
- SignOutButton,
750
- {
751
- label: logout.label,
752
- confirmTitle: logout.confirmTitle,
753
- confirmLabel: logout.confirmLabel,
754
- cancelLabel: logout.cancelLabel,
755
- errorMessage: logout.errorMessage,
756
- onSignOut: onLogout
757
- }
758
- )
759
- ] }),
760
- /* @__PURE__ */ jsx12("div", { className: toggleButton(), children: /* @__PURE__ */ jsx12(
761
- Button,
762
- {
763
- color: "ghost",
764
- icon: toggleIcon,
765
- "aria-label": toggleLabel,
766
- onClick: toggle,
767
- children: !collapsed && collapseLabel
768
- }
769
- ) })
770
- ] });
771
- };
772
-
773
643
  // core/tabs/tabs.tsx
774
644
  import * as RadixTabs from "@radix-ui/react-tabs";
775
645
 
776
646
  // core/tabs/tabs.styles.ts
777
- import { tv as tv10 } from "tailwind-variants";
778
- var tabs = tv10({
647
+ import { tv as tv9 } from "tailwind-variants";
648
+ var tabs = tv9({
779
649
  slots: {
780
650
  // A border around the tabs and the panel, which holds them together. Takes
781
651
  // the height of a parent that has one, and the panel gets what the list
@@ -798,7 +668,7 @@ var tabs = tv10({
798
668
  });
799
669
 
800
670
  // core/tabs/tabs.tsx
801
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
671
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
802
672
  var Tabs = ({
803
673
  tabs: tabs2,
804
674
  "aria-label": ariaLabel,
@@ -806,21 +676,21 @@ var Tabs = ({
806
676
  onChange
807
677
  }) => {
808
678
  const { base, list, tab, text, panel } = tabs();
809
- return /* @__PURE__ */ jsxs11(
679
+ return /* @__PURE__ */ jsxs10(
810
680
  RadixTabs.Root,
811
681
  {
812
682
  className: base(),
813
683
  defaultValue: defaultTab,
814
684
  onValueChange: onChange,
815
685
  children: [
816
- /* @__PURE__ */ jsx13(RadixTabs.List, { className: list(), "aria-label": ariaLabel, children: tabs2.map(({ id, label: label5, subtitle, count }) => /* @__PURE__ */ jsxs11(RadixTabs.Trigger, { value: id, className: tab(), children: [
817
- /* @__PURE__ */ jsxs11("span", { className: text(), children: [
818
- /* @__PURE__ */ jsx13(Text, { as: "span", children: label5 }),
819
- subtitle && /* @__PURE__ */ jsx13(Text, { as: "span", variant: "caption", color: "muted", children: subtitle })
686
+ /* @__PURE__ */ jsx12(RadixTabs.List, { className: list(), "aria-label": ariaLabel, children: tabs2.map(({ id, label: label5, subtitle, count }) => /* @__PURE__ */ jsxs10(RadixTabs.Trigger, { value: id, className: tab(), children: [
687
+ /* @__PURE__ */ jsxs10("span", { className: text(), children: [
688
+ /* @__PURE__ */ jsx12(Text, { as: "span", children: label5 }),
689
+ subtitle && /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", color: "muted", children: subtitle })
820
690
  ] }),
821
- count !== void 0 && /* @__PURE__ */ jsx13(Tag, { color: "primary", size: "md", children: count })
691
+ count !== void 0 && /* @__PURE__ */ jsx12(Tag, { color: "primary", size: "md", children: count })
822
692
  ] }, id)) }),
823
- tabs2.map(({ id, children }) => /* @__PURE__ */ jsx13(RadixTabs.Content, { value: id, className: panel(), children }, id))
693
+ tabs2.map(({ id, children }) => /* @__PURE__ */ jsx12(RadixTabs.Content, { value: id, className: panel(), children }, id))
824
694
  ]
825
695
  }
826
696
  );
@@ -917,6 +787,7 @@ export {
917
787
  Loader,
918
788
  Login,
919
789
  Modal,
790
+ Navigation,
920
791
  Radio,
921
792
  ReduxProvider,
922
793
  Select,
@@ -929,6 +800,7 @@ export {
929
800
  Text,
930
801
  TextArea,
931
802
  Toaster,
803
+ TopNav,
932
804
  WhatsAppButton,
933
805
  ZustandProviders,
934
806
  appInitialState,
@@ -937,6 +809,7 @@ export {
937
809
  toast,
938
810
  useAppStore,
939
811
  useAuth,
812
+ useIsDesktop,
940
813
  usePageStore,
941
814
  useRouterStore,
942
815
  useToastStore
@@ -36,9 +36,11 @@ interface LinkProps {
36
36
  active?: boolean;
37
37
  /** The accessible name, for a link whose children have no text. */
38
38
  "aria-label"?: string;
39
+ /** Called on a click, before the navigation, such as to close a menu. */
40
+ onClick?: () => void;
39
41
  }
40
42
 
41
- declare const Link: ({ children, href, variant, color, active, "aria-label": ariaLabel, }: LinkProps) => react.JSX.Element;
43
+ declare const Link: ({ children, href, variant, color, active, "aria-label": ariaLabel, onClick, }: LinkProps) => react.JSX.Element;
42
44
 
43
45
  type AppProvidersProps = ReduxProviderProps & Pick<ZustandProvidersProps, "auth">;
44
46
 
@@ -7,7 +7,7 @@ import {
7
7
  ZustandProviders,
8
8
  usePageStore,
9
9
  useRouterStore
10
- } from "../chunk-XRJCFNLC.js";
10
+ } from "../chunk-TMUYZTIH.js";
11
11
 
12
12
  // core/next/root-layout/root-layout.styles.ts
13
13
  import { tv } from "tailwind-variants";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "3.11.0",
3
+ "version": "3.12.0",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",