@alexandregme/zljs 3.5.0 → 3.6.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
@@ -8,6 +8,12 @@ A change that needs action in an app has a **Migration** note. When updating, re
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [3.6.0] - 2026-11-11
12
+
13
+ ### Added
14
+
15
+ - `AccessPending`, the screen of a user who signed in and has no access to the app yet. It shows the email of the account and a `SignOutButton`. Every text has an English default: `title`, `message`, `signOutLabel`, and the `confirmTitle`, `confirmLabel`, `cancelLabel` and `errorMessage` of the sign-out
16
+
11
17
  ## [3.5.0] - 2026-11-11
12
18
 
13
19
  ### Added
@@ -447,7 +453,8 @@ Replace the shade with the class of the `color` being tested, for example `/(^|\
447
453
 
448
454
  The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
449
455
 
450
- [Unreleased]: https://github.com/alexandregme/zljs/compare/v3.5.0...HEAD
456
+ [Unreleased]: https://github.com/alexandregme/zljs/compare/v3.6.0...HEAD
457
+ [3.6.0]: https://github.com/alexandregme/zljs/compare/v3.5.0...v3.6.0
451
458
  [3.5.0]: https://github.com/alexandregme/zljs/compare/v3.3.0...v3.5.0
452
459
  [3.3.0]: https://github.com/alexandregme/zljs/compare/v3.2.0...v3.3.0
453
460
  [3.2.0]: https://github.com/alexandregme/zljs/compare/v3.1.0...v3.2.0
@@ -602,64 +602,6 @@ var Loader = ({ label = "Loading" }) => {
602
602
  return /* @__PURE__ */ jsx9("div", { className: loader(), children: /* @__PURE__ */ jsx9(Spinner, { size: "lg", label }) });
603
603
  };
604
604
 
605
- // features/auth/state/auth.store.ts
606
- import { create as create3 } from "zustand";
607
- import { devtools as devtools3 } from "zustand/middleware";
608
-
609
- // features/auth/state/auth.const.ts
610
- var authInitialState = {
611
- status: "loading",
612
- session: null,
613
- adapter: null,
614
- appId: null
615
- };
616
- var authDevtools = { name: "zljs", store: "auth" };
617
-
618
- // features/auth/state/auth.store.ts
619
- var useAuthStore = create3()(
620
- devtools3(
621
- (set) => ({
622
- ...authInitialState,
623
- setSession: (session) => set(
624
- {
625
- session,
626
- status: session ? "authenticated" : "unauthenticated"
627
- },
628
- false,
629
- "setSession"
630
- ),
631
- configure: (adapter, appId) => set({ adapter, appId }, false, "configure"),
632
- reset: () => set(authInitialState, false, "reset")
633
- }),
634
- authDevtools
635
- )
636
- );
637
-
638
- // features/auth/state/get-auth-session/get-auth-session.ts
639
- var getAuthSession = () => useAuthStore.getState().session;
640
-
641
- // features/auth/components/auth-provider/auth-provider.tsx
642
- import { useEffect as useEffect2 } from "react";
643
- import { Fragment as Fragment3, jsx as jsx10 } from "react/jsx-runtime";
644
- var AuthProvider = ({
645
- adapter,
646
- appId,
647
- children
648
- }) => {
649
- const configure = useAuthStore((s) => s.configure);
650
- const setSession = useAuthStore((s) => s.setSession);
651
- const reset = useAuthStore((s) => s.reset);
652
- useEffect2(() => {
653
- configure(adapter, appId);
654
- const unsubscribe = adapter.onSessionChange(setSession);
655
- return () => {
656
- unsubscribe();
657
- reset();
658
- };
659
- }, [adapter, appId, configure, setSession, reset]);
660
- return /* @__PURE__ */ jsx10(Fragment3, { children });
661
- };
662
-
663
605
  // core/card/card.styles.ts
664
606
  import { tv as tv9 } from "tailwind-variants";
665
607
  var card = tv9({
@@ -692,7 +634,7 @@ var card = tv9({
692
634
  });
693
635
 
694
636
  // core/card/card.tsx
695
- import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
637
+ import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
696
638
  var Card = ({
697
639
  children,
698
640
  title: title2,
@@ -704,13 +646,49 @@ var Card = ({
704
646
  const messageColor = color === "none" ? "muted" : "none";
705
647
  return /* @__PURE__ */ jsxs3("div", { "data-testid": "card", className: base(), children: [
706
648
  (title2 || message) && /* @__PURE__ */ jsxs3("div", { className: header2(), children: [
707
- title2 && /* @__PURE__ */ jsx11(Heading, { level: titleLevel, children: title2 }),
708
- message && /* @__PURE__ */ jsx11(Text, { color: messageColor, children: message })
649
+ title2 && /* @__PURE__ */ jsx10(Heading, { level: titleLevel, children: title2 }),
650
+ message && /* @__PURE__ */ jsx10(Text, { color: messageColor, children: message })
709
651
  ] }),
710
652
  children
711
653
  ] });
712
654
  };
713
655
 
656
+ // features/auth/state/auth.store.ts
657
+ import { create as create3 } from "zustand";
658
+ import { devtools as devtools3 } from "zustand/middleware";
659
+
660
+ // features/auth/state/auth.const.ts
661
+ var authInitialState = {
662
+ status: "loading",
663
+ session: null,
664
+ adapter: null,
665
+ appId: null
666
+ };
667
+ var authDevtools = { name: "zljs", store: "auth" };
668
+
669
+ // features/auth/state/auth.store.ts
670
+ var useAuthStore = create3()(
671
+ devtools3(
672
+ (set) => ({
673
+ ...authInitialState,
674
+ setSession: (session) => set(
675
+ {
676
+ session,
677
+ status: session ? "authenticated" : "unauthenticated"
678
+ },
679
+ false,
680
+ "setSession"
681
+ ),
682
+ configure: (adapter, appId) => set({ adapter, appId }, false, "configure"),
683
+ reset: () => set(authInitialState, false, "reset")
684
+ }),
685
+ authDevtools
686
+ )
687
+ );
688
+
689
+ // features/auth/state/get-auth-session/get-auth-session.ts
690
+ var getAuthSession = () => useAuthStore.getState().session;
691
+
714
692
  // features/auth/hooks/use-auth/use-auth.ts
715
693
  var requireAdapter = () => {
716
694
  const { adapter } = useAuthStore.getState();
@@ -735,79 +713,19 @@ var useAuth = () => {
735
713
  };
736
714
  };
737
715
 
738
- // features/auth/components/login/login.const.ts
739
- var loginVendors = {
740
- supabase: {
741
- google: "Google",
742
- apple: "Apple",
743
- github: "GitHub",
744
- facebook: "Facebook"
745
- }
746
- };
747
-
748
- // features/auth/components/login/login.styles.ts
749
- import { tv as tv10 } from "tailwind-variants";
750
- var login = tv10({
751
- slots: {
752
- options: "flex flex-col gap-3"
753
- }
754
- });
755
-
756
- // features/auth/components/login/login.tsx
757
- import { jsx as jsx12 } from "react/jsx-runtime";
758
- var LoginProviderButton = ({
759
- id,
760
- label,
761
- onSignIn
762
- }) => {
763
- const signIn = () => {
764
- onSignIn(id);
765
- };
766
- return /* @__PURE__ */ jsx12(Button, { size: "lg", fullWidth: true, onClick: signIn, children: label });
767
- };
768
- var Login = ({
769
- vendor,
770
- providers,
771
- title: title2 = "Sign in",
772
- message = "Choose how to sign in",
773
- providerLabel = "Continue with",
774
- errorMessage = "Could not sign in. Try again."
775
- }) => {
776
- const { signInWithOAuth } = useAuth();
777
- const { options } = login();
778
- const names = loginVendors[vendor];
779
- const signIn = (id) => {
780
- signInWithOAuth(id).catch(() => {
781
- useToastStore.getState().error(errorMessage);
782
- });
783
- };
784
- return /* @__PURE__ */ jsx12(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsx12("div", { className: options(), children: providers.map((provider) => {
785
- const id = String(provider);
786
- return /* @__PURE__ */ jsx12(
787
- LoginProviderButton,
788
- {
789
- id,
790
- label: `${providerLabel} ${names[id]}`,
791
- onSignIn: signIn
792
- },
793
- id
794
- );
795
- }) }) });
796
- };
797
-
798
716
  // features/auth/components/sign-out/sign-out-modal.const.ts
799
717
  var SIGN_OUT_MODAL_ID = "zljs-sign-out";
800
718
 
801
719
  // features/auth/components/sign-out/sign-out-modal.styles.ts
802
- import { tv as tv11 } from "tailwind-variants";
803
- var signOutModal = tv11({
720
+ import { tv as tv10 } from "tailwind-variants";
721
+ var signOutModal = tv10({
804
722
  slots: {
805
723
  actions: "flex justify-end gap-2"
806
724
  }
807
725
  });
808
726
 
809
727
  // features/auth/components/sign-out/sign-out-modal.tsx
810
- import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
728
+ import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
811
729
  var SignOutModal = ({
812
730
  title: title2 = "Sign out?",
813
731
  confirmLabel = "Sign out",
@@ -826,7 +744,7 @@ var SignOutModal = ({
826
744
  useToastStore.getState().error(errorMessage);
827
745
  });
828
746
  };
829
- return /* @__PURE__ */ jsx13(
747
+ return /* @__PURE__ */ jsx11(
830
748
  ConnectedModal,
831
749
  {
832
750
  modalId: SIGN_OUT_MODAL_ID,
@@ -834,15 +752,15 @@ var SignOutModal = ({
834
752
  size: "xs",
835
753
  color: "danger",
836
754
  children: /* @__PURE__ */ jsxs4("div", { className: actions(), children: [
837
- /* @__PURE__ */ jsx13(Button, { color: "ghost", onClick: stay, children: cancelLabel }),
838
- /* @__PURE__ */ jsx13(Button, { color: "danger", onClick: leave, children: confirmLabel })
755
+ /* @__PURE__ */ jsx11(Button, { color: "ghost", onClick: stay, children: cancelLabel }),
756
+ /* @__PURE__ */ jsx11(Button, { color: "danger", onClick: leave, children: confirmLabel })
839
757
  ] })
840
758
  }
841
759
  );
842
760
  };
843
761
 
844
762
  // features/auth/components/sign-out/sign-out-button.tsx
845
- import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
763
+ import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
846
764
  var SignOutButton = ({
847
765
  label = "Sign out",
848
766
  confirmTitle,
@@ -854,8 +772,8 @@ var SignOutButton = ({
854
772
  const ask = () => {
855
773
  openModal(SIGN_OUT_MODAL_ID);
856
774
  };
857
- return /* @__PURE__ */ jsxs5(Fragment4, { children: [
858
- /* @__PURE__ */ jsx14(
775
+ return /* @__PURE__ */ jsxs5(Fragment3, { children: [
776
+ /* @__PURE__ */ jsx12(
859
777
  Button,
860
778
  {
861
779
  variant: "icon",
@@ -865,7 +783,7 @@ var SignOutButton = ({
865
783
  onClick: ask
866
784
  }
867
785
  ),
868
- /* @__PURE__ */ jsx14(
786
+ /* @__PURE__ */ jsx12(
869
787
  SignOutModal,
870
788
  {
871
789
  title: confirmTitle,
@@ -877,12 +795,133 @@ var SignOutButton = ({
877
795
  ] });
878
796
  };
879
797
 
798
+ // features/auth/components/access-pending/access-pending.styles.ts
799
+ import { tv as tv11 } from "tailwind-variants";
800
+ var accessPending = tv11({
801
+ slots: {
802
+ account: "flex items-center justify-between gap-3"
803
+ }
804
+ });
805
+
806
+ // features/auth/components/access-pending/access-pending.tsx
807
+ import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
808
+ var AccessPending = ({
809
+ title: title2 = "Waiting for approval",
810
+ message = "Your access to this app has not been approved yet.",
811
+ signOutLabel,
812
+ confirmTitle,
813
+ confirmLabel,
814
+ cancelLabel,
815
+ errorMessage
816
+ }) => {
817
+ const { user } = useAuth();
818
+ const { account } = accessPending();
819
+ if (!user) {
820
+ return null;
821
+ }
822
+ return /* @__PURE__ */ jsx13(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsxs6("div", { className: account(), children: [
823
+ /* @__PURE__ */ jsx13(Text, { variant: "caption", color: "muted", children: user.email }),
824
+ /* @__PURE__ */ jsx13(
825
+ SignOutButton,
826
+ {
827
+ label: signOutLabel,
828
+ confirmTitle,
829
+ confirmLabel,
830
+ cancelLabel,
831
+ errorMessage
832
+ }
833
+ )
834
+ ] }) });
835
+ };
836
+
837
+ // features/auth/components/auth-provider/auth-provider.tsx
838
+ import { useEffect as useEffect2 } from "react";
839
+ import { Fragment as Fragment4, jsx as jsx14 } from "react/jsx-runtime";
840
+ var AuthProvider = ({
841
+ adapter,
842
+ appId,
843
+ children
844
+ }) => {
845
+ const configure = useAuthStore((s) => s.configure);
846
+ const setSession = useAuthStore((s) => s.setSession);
847
+ const reset = useAuthStore((s) => s.reset);
848
+ useEffect2(() => {
849
+ configure(adapter, appId);
850
+ const unsubscribe = adapter.onSessionChange(setSession);
851
+ return () => {
852
+ unsubscribe();
853
+ reset();
854
+ };
855
+ }, [adapter, appId, configure, setSession, reset]);
856
+ return /* @__PURE__ */ jsx14(Fragment4, { children });
857
+ };
858
+
859
+ // features/auth/components/login/login.const.ts
860
+ var loginVendors = {
861
+ supabase: {
862
+ google: "Google",
863
+ apple: "Apple",
864
+ github: "GitHub",
865
+ facebook: "Facebook"
866
+ }
867
+ };
868
+
869
+ // features/auth/components/login/login.styles.ts
870
+ import { tv as tv12 } from "tailwind-variants";
871
+ var login = tv12({
872
+ slots: {
873
+ options: "flex flex-col gap-3"
874
+ }
875
+ });
876
+
877
+ // features/auth/components/login/login.tsx
878
+ import { jsx as jsx15 } from "react/jsx-runtime";
879
+ var LoginProviderButton = ({
880
+ id,
881
+ label,
882
+ onSignIn
883
+ }) => {
884
+ const signIn = () => {
885
+ onSignIn(id);
886
+ };
887
+ return /* @__PURE__ */ jsx15(Button, { size: "lg", fullWidth: true, onClick: signIn, children: label });
888
+ };
889
+ var Login = ({
890
+ vendor,
891
+ providers,
892
+ title: title2 = "Sign in",
893
+ message = "Choose how to sign in",
894
+ providerLabel = "Continue with",
895
+ errorMessage = "Could not sign in. Try again."
896
+ }) => {
897
+ const { signInWithOAuth } = useAuth();
898
+ const { options } = login();
899
+ const names = loginVendors[vendor];
900
+ const signIn = (id) => {
901
+ signInWithOAuth(id).catch(() => {
902
+ useToastStore.getState().error(errorMessage);
903
+ });
904
+ };
905
+ return /* @__PURE__ */ jsx15(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsx15("div", { className: options(), children: providers.map((provider) => {
906
+ const id = String(provider);
907
+ return /* @__PURE__ */ jsx15(
908
+ LoginProviderButton,
909
+ {
910
+ id,
911
+ label: `${providerLabel} ${names[id]}`,
912
+ onSignIn: signIn
913
+ },
914
+ id
915
+ );
916
+ }) }) });
917
+ };
918
+
880
919
  // features/providers/components/zustand-providers/zustand-providers.tsx
881
- import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
882
- var ZustandProviders = ({ children, auth }) => /* @__PURE__ */ jsxs6(Fragment5, { children: [
883
- /* @__PURE__ */ jsx15(Loader, {}),
884
- /* @__PURE__ */ jsx15(Toaster, {}),
885
- auth ? /* @__PURE__ */ jsx15(AuthProvider, { adapter: auth.adapter, appId: auth.appId, children }) : children
920
+ import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
921
+ var ZustandProviders = ({ children, auth }) => /* @__PURE__ */ jsxs7(Fragment5, { children: [
922
+ /* @__PURE__ */ jsx16(Loader, {}),
923
+ /* @__PURE__ */ jsx16(Toaster, {}),
924
+ auth ? /* @__PURE__ */ jsx16(AuthProvider, { adapter: auth.adapter, appId: auth.appId, children }) : children
886
925
  ] });
887
926
 
888
927
  // core/state/redux/redux-provider/redux-provider.tsx
@@ -919,7 +958,7 @@ var createReduxStore = ({
919
958
  };
920
959
 
921
960
  // core/state/redux/redux-provider/redux-provider.tsx
922
- import { jsx as jsx16 } from "react/jsx-runtime";
961
+ import { jsx as jsx17 } from "react/jsx-runtime";
923
962
  var ReduxProvider = ({
924
963
  children,
925
964
  reducers = {},
@@ -935,7 +974,7 @@ var ReduxProvider = ({
935
974
  coreReducers
936
975
  })
937
976
  );
938
- return /* @__PURE__ */ jsx16(Provider, { store, children });
977
+ return /* @__PURE__ */ jsx17(Provider, { store, children });
939
978
  };
940
979
 
941
980
  // core/state/zustand/router/router.utils.ts
@@ -1009,12 +1048,13 @@ export {
1009
1048
  ConnectedModal,
1010
1049
  Spinner,
1011
1050
  Loader,
1012
- getAuthSession,
1013
- AuthProvider,
1014
1051
  Card,
1052
+ getAuthSession,
1015
1053
  useAuth,
1016
- Login,
1017
1054
  SignOutButton,
1055
+ AccessPending,
1056
+ AuthProvider,
1057
+ Login,
1018
1058
  ZustandProviders,
1019
1059
  ReduxProvider,
1020
1060
  splitURLasPath,
package/dist/index.d.ts CHANGED
@@ -368,6 +368,23 @@ declare const useAppStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AppState>
368
368
  };
369
369
  }>;
370
370
 
371
+ interface AccessPendingProps {
372
+ title?: string;
373
+ message?: string;
374
+ /** The accessible name of the sign-out button. */
375
+ signOutLabel?: string;
376
+ /** The question of the modal the button opens. */
377
+ confirmTitle?: string;
378
+ /** The button of the modal that signs out. */
379
+ confirmLabel?: string;
380
+ /** The button of the modal that keeps the user signed in. */
381
+ cancelLabel?: string;
382
+ /** The toast when signing out fails. */
383
+ errorMessage?: string;
384
+ }
385
+
386
+ declare const AccessPending: ({ title, message, signOutLabel, confirmTitle, confirmLabel, cancelLabel, errorMessage, }: AccessPendingProps) => react.JSX.Element | null;
387
+
371
388
  /** The current session, for code outside React, such as a thunk. */
372
389
  declare const getAuthSession: () => AuthSession | null;
373
390
 
@@ -539,5 +556,5 @@ declare class HTTPClient {
539
556
  patch<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T | undefined>;
540
557
  }
541
558
 
542
- export { AuthAdapter, AuthProvider, AuthSession, 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, Tag, Text, TextArea, Toaster, WhatsAppButton, ZustandProviders, ZustandProvidersProps, appInitialState, getAuthSession, splitURLasPath, useAppStore, useAuth, usePageStore, useRouterStore, useToastStore };
559
+ export { AccessPending, AuthAdapter, AuthProvider, AuthSession, 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, Tag, Text, TextArea, Toaster, WhatsAppButton, ZustandProviders, ZustandProvidersProps, appInitialState, getAuthSession, splitURLasPath, useAppStore, useAuth, usePageStore, useRouterStore, useToastStore };
543
560
  export type { AppState, 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, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, WhatsAppButtonProps };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import {
3
+ AccessPending,
3
4
  AuthProvider,
4
5
  Button,
5
6
  Card,
@@ -24,7 +25,7 @@ import {
24
25
  usePageStore,
25
26
  useRouterStore,
26
27
  useToastStore
27
- } from "./chunk-Y453WAGC.js";
28
+ } from "./chunk-FAJRJZWI.js";
28
29
  import {
29
30
  Error,
30
31
  FormInput,
@@ -845,6 +846,7 @@ var HTTPClient = class {
845
846
  }
846
847
  };
847
848
  export {
849
+ AccessPending,
848
850
  AuthProvider,
849
851
  Button,
850
852
  Card,
@@ -6,7 +6,7 @@ import {
6
6
  ZustandProviders,
7
7
  usePageStore,
8
8
  useRouterStore
9
- } from "../chunk-Y453WAGC.js";
9
+ } from "../chunk-FAJRJZWI.js";
10
10
 
11
11
  // core/next/root-layout/root-layout.styles.ts
12
12
  import { tv } from "tailwind-variants";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",