@alexandregme/zljs 3.9.0 → 3.11.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 +40 -1
- package/dist/{chunk-JMEGXQKC.js → chunk-XRJCFNLC.js} +354 -289
- package/dist/index.d.ts +61 -19
- package/dist/index.js +98 -53
- package/dist/next/index.d.ts +9 -2
- package/dist/next/index.js +18 -47
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -241,6 +241,27 @@ interface TextProps {
|
|
|
241
241
|
|
|
242
242
|
declare const Text: ({ children, as: Tag, variant, color, }: TextProps) => react.JSX.Element;
|
|
243
243
|
|
|
244
|
+
interface SignOutButtonProps {
|
|
245
|
+
/** The accessible name of the icon button. */
|
|
246
|
+
label?: string;
|
|
247
|
+
/** The question of the modal a click opens. */
|
|
248
|
+
confirmTitle?: string;
|
|
249
|
+
/** The button of the modal that signs out. */
|
|
250
|
+
confirmLabel?: string;
|
|
251
|
+
/** The button of the modal that keeps the user signed in. */
|
|
252
|
+
cancelLabel?: string;
|
|
253
|
+
/** The toast when signing out fails. */
|
|
254
|
+
errorMessage?: string;
|
|
255
|
+
/**
|
|
256
|
+
* Signs the user out, for an app with no `AuthProvider`. It is called when
|
|
257
|
+
* the user confirms in the modal. Without it, the button signs out through
|
|
258
|
+
* the adapter of `AuthProvider`.
|
|
259
|
+
*/
|
|
260
|
+
onSignOut?: () => void | Promise<void>;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
declare const SignOutButton: ({ label, confirmTitle, confirmLabel, cancelLabel, errorMessage, onSignOut, }: SignOutButtonProps) => react.JSX.Element;
|
|
264
|
+
|
|
244
265
|
interface SidebarItem {
|
|
245
266
|
icon: IconName;
|
|
246
267
|
label: string;
|
|
@@ -259,12 +280,48 @@ interface SidebarProps {
|
|
|
259
280
|
activeHref?: string;
|
|
260
281
|
defaultCollapsed?: boolean;
|
|
261
282
|
collapseLabel: string;
|
|
283
|
+
/** The accessible name of the collapse button while collapsed. */
|
|
284
|
+
expandLabel?: string;
|
|
262
285
|
homeHref?: string | false;
|
|
263
286
|
homeLabel?: string;
|
|
264
|
-
|
|
287
|
+
/** The accessible name of the navigation. */
|
|
288
|
+
navLabel?: string;
|
|
289
|
+
/**
|
|
290
|
+
* The texts of the logout button and of the modal it opens: `label`,
|
|
291
|
+
* `confirmTitle`, `confirmLabel`, `cancelLabel` and `errorMessage`.
|
|
292
|
+
*/
|
|
293
|
+
logout?: Omit<SignOutButtonProps, "onSignOut">;
|
|
294
|
+
/**
|
|
295
|
+
* Logs the user out. It is called when the user confirms in the modal, never
|
|
296
|
+
* on the first click. A rejected promise shows the error toast.
|
|
297
|
+
*/
|
|
298
|
+
onLogout: () => void | Promise<void>;
|
|
265
299
|
}
|
|
266
300
|
|
|
267
|
-
declare const Sidebar: ({ sections, user, activeHref, defaultCollapsed, collapseLabel, homeHref, homeLabel, onLogout, }: SidebarProps) => react.JSX.Element;
|
|
301
|
+
declare const Sidebar: ({ sections, user, activeHref, defaultCollapsed, collapseLabel, expandLabel, homeHref, homeLabel, navLabel, logout, onLogout, }: SidebarProps) => react.JSX.Element;
|
|
302
|
+
|
|
303
|
+
interface TabsItem {
|
|
304
|
+
/** Unique among the tabs. `defaultTab` and `onChange` use it. */
|
|
305
|
+
id: string;
|
|
306
|
+
label: string;
|
|
307
|
+
/** Shows under `label`, in the tab. */
|
|
308
|
+
subtitle?: string;
|
|
309
|
+
/** Shows at the right edge of the tab, such as how many rows the panel has. */
|
|
310
|
+
count?: number;
|
|
311
|
+
/** The panel of the tab. Only the selected one is rendered. */
|
|
312
|
+
children: ReactNode;
|
|
313
|
+
}
|
|
314
|
+
interface TabsProps {
|
|
315
|
+
tabs: TabsItem[];
|
|
316
|
+
/** Names the list of tabs for screen readers. */
|
|
317
|
+
"aria-label": string;
|
|
318
|
+
/** The `id` of the tab selected at first. The first tab when not set. */
|
|
319
|
+
defaultTab?: string;
|
|
320
|
+
/** Called with the `id` of the tab the user selected. */
|
|
321
|
+
onChange?: (id: string) => void;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
declare const Tabs: ({ tabs, "aria-label": ariaLabel, defaultTab, onChange, }: TabsProps) => react.JSX.Element;
|
|
268
325
|
|
|
269
326
|
type TagColor = Exclude<SemanticColor, "none"> | AuxiliaryColor;
|
|
270
327
|
interface TagProps {
|
|
@@ -548,21 +605,6 @@ interface AuthorizedProps<V extends LoginVendor = LoginVendor> {
|
|
|
548
605
|
|
|
549
606
|
declare const Authorized: <V extends LoginVendor>({ children, roles, login, accessPending, }: AuthorizedProps<V>) => react.JSX.Element | null;
|
|
550
607
|
|
|
551
|
-
interface SignOutButtonProps {
|
|
552
|
-
/** The accessible name of the icon button. */
|
|
553
|
-
label?: string;
|
|
554
|
-
/** The question of the modal a click opens. */
|
|
555
|
-
confirmTitle?: string;
|
|
556
|
-
/** The button of the modal that signs out. */
|
|
557
|
-
confirmLabel?: string;
|
|
558
|
-
/** The button of the modal that keeps the user signed in. */
|
|
559
|
-
cancelLabel?: string;
|
|
560
|
-
/** The toast when signing out fails. */
|
|
561
|
-
errorMessage?: string;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
declare const SignOutButton: ({ label, confirmTitle, confirmLabel, cancelLabel, errorMessage, }: SignOutButtonProps) => react.JSX.Element;
|
|
565
|
-
|
|
566
608
|
interface UseAuthResult extends Omit<AuthAdapter, "onSessionChange"> {
|
|
567
609
|
status: AuthStatus;
|
|
568
610
|
user: AuthUser | null;
|
|
@@ -574,5 +616,5 @@ declare const useAuth: () => UseAuthResult;
|
|
|
574
616
|
|
|
575
617
|
declare const ZustandProviders: ({ children, auth }: ZustandProvidersProps) => react.JSX.Element;
|
|
576
618
|
|
|
577
|
-
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, Tag, Text, TextArea, Toaster, WhatsAppButton, ZustandProviders, ZustandProvidersProps, appInitialState, getAuthSession, splitURLasPath, useAppStore, useAuth, usePageStore, useRouterStore, useToastStore };
|
|
578
|
-
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, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, WhatsAppButtonProps };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ConnectedModal,
|
|
9
9
|
Heading,
|
|
10
10
|
Icon,
|
|
11
|
+
Link,
|
|
11
12
|
Loader,
|
|
12
13
|
Login,
|
|
13
14
|
Modal,
|
|
@@ -26,7 +27,7 @@ import {
|
|
|
26
27
|
usePageStore,
|
|
27
28
|
useRouterStore,
|
|
28
29
|
useToastStore
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-XRJCFNLC.js";
|
|
30
31
|
import {
|
|
31
32
|
Error,
|
|
32
33
|
FormInput,
|
|
@@ -638,20 +639,16 @@ var WhatsAppButton = ({
|
|
|
638
639
|
|
|
639
640
|
// core/sidebar/sidebar.tsx
|
|
640
641
|
import { useState as useState2 } from "react";
|
|
641
|
-
import Link from "next/link.js";
|
|
642
642
|
|
|
643
643
|
// core/sidebar/sidebar.styles.ts
|
|
644
644
|
import { tv as tv9 } from "tailwind-variants";
|
|
645
645
|
var sidebar = tv9({
|
|
646
|
-
base: "h-
|
|
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
647
|
variants: {
|
|
648
648
|
collapsed: {
|
|
649
649
|
true: "w-14",
|
|
650
650
|
false: "w-64"
|
|
651
651
|
}
|
|
652
|
-
},
|
|
653
|
-
defaultVariants: {
|
|
654
|
-
collapsed: false
|
|
655
652
|
}
|
|
656
653
|
});
|
|
657
654
|
var nav = tv9({
|
|
@@ -663,24 +660,6 @@ var header = tv9({
|
|
|
663
660
|
var section = tv9({
|
|
664
661
|
base: "grid gap-1 p-2"
|
|
665
662
|
});
|
|
666
|
-
var item = tv9({
|
|
667
|
-
// [&>*+*] is the label: Text takes no className, and the icon comes first, so a link with no label has nothing to hide.
|
|
668
|
-
base: "flex items-center rounded-md transition-colors h-10 px-3 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current [&>*+*]:truncate [&>*+*]:transition-all [&>*+*]:duration-200",
|
|
669
|
-
variants: {
|
|
670
|
-
active: {
|
|
671
|
-
true: "bg-neutral-700 text-white",
|
|
672
|
-
false: "text-neutral-400 hover:bg-neutral-700/50 hover:text-white"
|
|
673
|
-
},
|
|
674
|
-
collapsed: {
|
|
675
|
-
true: "[&>*+*]:w-0 [&>*+*]:opacity-0",
|
|
676
|
-
false: "[&>*+*]:ml-2 [&>*+*]:opacity-100"
|
|
677
|
-
}
|
|
678
|
-
},
|
|
679
|
-
defaultVariants: {
|
|
680
|
-
active: false,
|
|
681
|
-
collapsed: false
|
|
682
|
-
}
|
|
683
|
-
});
|
|
684
663
|
var footer = tv9({
|
|
685
664
|
base: "shrink-0 h-16 p-3 flex items-center gap-3",
|
|
686
665
|
variants: {
|
|
@@ -714,42 +693,50 @@ var Sidebar = ({
|
|
|
714
693
|
activeHref,
|
|
715
694
|
defaultCollapsed = false,
|
|
716
695
|
collapseLabel,
|
|
696
|
+
expandLabel = "Expand sidebar",
|
|
717
697
|
homeHref = "/",
|
|
718
698
|
homeLabel,
|
|
699
|
+
navLabel = "Main navigation",
|
|
700
|
+
logout = {},
|
|
719
701
|
onLogout
|
|
720
702
|
}) => {
|
|
721
703
|
const [collapsed, setCollapsed] = useState2(defaultCollapsed);
|
|
722
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
|
+
};
|
|
723
710
|
return /* @__PURE__ */ jsxs10("aside", { className: sidebar({ collapsed }), children: [
|
|
724
711
|
homeHref && /* @__PURE__ */ jsx12("div", { className: header(), children: /* @__PURE__ */ jsxs10(
|
|
725
712
|
Link,
|
|
726
713
|
{
|
|
727
714
|
href: homeHref,
|
|
728
|
-
|
|
715
|
+
variant: "nav",
|
|
716
|
+
color: "none",
|
|
717
|
+
active: homeHref === activeHref,
|
|
729
718
|
"aria-label": homeLabel || "Home",
|
|
730
|
-
...homeHref === activeHref && { "aria-current": "page" },
|
|
731
719
|
children: [
|
|
732
720
|
/* @__PURE__ */ jsx12(Icon, { name: "Home" }),
|
|
733
|
-
homeLabel && /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: homeLabel })
|
|
721
|
+
homeLabel && !collapsed && /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: homeLabel })
|
|
734
722
|
]
|
|
735
723
|
}
|
|
736
724
|
) }),
|
|
737
|
-
/* @__PURE__ */ jsx12("nav", { "aria-label":
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}) }, i)) }),
|
|
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)) }),
|
|
753
740
|
/* @__PURE__ */ jsxs10("div", { className: footer({ collapsed }), children: [
|
|
754
741
|
!collapsed && /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
755
742
|
/* @__PURE__ */ jsx12("div", { "aria-hidden": "true", className: avatar(), children: initials }),
|
|
@@ -759,29 +746,86 @@ var Sidebar = ({
|
|
|
759
746
|
] })
|
|
760
747
|
] }),
|
|
761
748
|
/* @__PURE__ */ jsx12(
|
|
762
|
-
|
|
749
|
+
SignOutButton,
|
|
763
750
|
{
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
751
|
+
label: logout.label,
|
|
752
|
+
confirmTitle: logout.confirmTitle,
|
|
753
|
+
confirmLabel: logout.confirmLabel,
|
|
754
|
+
cancelLabel: logout.cancelLabel,
|
|
755
|
+
errorMessage: logout.errorMessage,
|
|
756
|
+
onSignOut: onLogout
|
|
768
757
|
}
|
|
769
758
|
)
|
|
770
759
|
] }),
|
|
771
760
|
/* @__PURE__ */ jsx12("div", { className: toggleButton(), children: /* @__PURE__ */ jsx12(
|
|
772
761
|
Button,
|
|
773
762
|
{
|
|
774
|
-
variant: "default",
|
|
775
763
|
color: "ghost",
|
|
776
|
-
icon:
|
|
777
|
-
"aria-label":
|
|
778
|
-
onClick:
|
|
779
|
-
children: collapsed
|
|
764
|
+
icon: toggleIcon,
|
|
765
|
+
"aria-label": toggleLabel,
|
|
766
|
+
onClick: toggle,
|
|
767
|
+
children: !collapsed && collapseLabel
|
|
780
768
|
}
|
|
781
769
|
) })
|
|
782
770
|
] });
|
|
783
771
|
};
|
|
784
772
|
|
|
773
|
+
// core/tabs/tabs.tsx
|
|
774
|
+
import * as RadixTabs from "@radix-ui/react-tabs";
|
|
775
|
+
|
|
776
|
+
// core/tabs/tabs.styles.ts
|
|
777
|
+
import { tv as tv10 } from "tailwind-variants";
|
|
778
|
+
var tabs = tv10({
|
|
779
|
+
slots: {
|
|
780
|
+
// A border around the tabs and the panel, which holds them together. Takes
|
|
781
|
+
// the height of a parent that has one, and the panel gets what the list
|
|
782
|
+
// leaves, so a panel can fill the page. With no height around it, both
|
|
783
|
+
// follow their content.
|
|
784
|
+
base: "flex h-full w-full flex-col overflow-hidden rounded-lg border border-gray-200",
|
|
785
|
+
list: "flex shrink-0 overflow-x-auto border-b border-gray-200",
|
|
786
|
+
// A line between the tabs, and the selected one stands out three ways: a
|
|
787
|
+
// white background next to the gray ones, a line under it and its label in
|
|
788
|
+
// the primary color. A tab grows to share the width of the list and never
|
|
789
|
+
// shrinks under its content, so the list scrolls when they don't fit. The
|
|
790
|
+
// outline sits inside the tab, because the border clips what overflows it.
|
|
791
|
+
// The first and the last tab follow the round corners of the border, so
|
|
792
|
+
// the outline does too.
|
|
793
|
+
tab: "flex min-h-11 min-w-max shrink-0 grow basis-0 cursor-pointer items-center justify-between gap-3 border-r border-b-2 border-r-gray-200 border-b-transparent bg-gray-50 px-4 py-2 text-left text-gray-700 first:rounded-tl-[calc(var(--radius-lg)-1px)] last:rounded-tr-[calc(var(--radius-lg)-1px)] last:border-r-0 hover:text-gray-900 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-zl-primary data-[state=active]:border-b-zl-primary data-[state=active]:bg-white data-[state=active]:text-zl-primary",
|
|
794
|
+
// The label and the subtitle on the left, and the count at the right edge.
|
|
795
|
+
text: "flex flex-col justify-center gap-0.5 [&>:first-child]:font-medium",
|
|
796
|
+
panel: "min-h-0 flex-1 overflow-auto p-4 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-zl-primary"
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
// core/tabs/tabs.tsx
|
|
801
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
802
|
+
var Tabs = ({
|
|
803
|
+
tabs: tabs2,
|
|
804
|
+
"aria-label": ariaLabel,
|
|
805
|
+
defaultTab = tabs2[0]?.id,
|
|
806
|
+
onChange
|
|
807
|
+
}) => {
|
|
808
|
+
const { base, list, tab, text, panel } = tabs();
|
|
809
|
+
return /* @__PURE__ */ jsxs11(
|
|
810
|
+
RadixTabs.Root,
|
|
811
|
+
{
|
|
812
|
+
className: base(),
|
|
813
|
+
defaultValue: defaultTab,
|
|
814
|
+
onValueChange: onChange,
|
|
815
|
+
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 })
|
|
820
|
+
] }),
|
|
821
|
+
count !== void 0 && /* @__PURE__ */ jsx13(Tag, { color: "primary", size: "md", children: count })
|
|
822
|
+
] }, id)) }),
|
|
823
|
+
tabs2.map(({ id, children }) => /* @__PURE__ */ jsx13(RadixTabs.Content, { value: id, className: panel(), children }, id))
|
|
824
|
+
]
|
|
825
|
+
}
|
|
826
|
+
);
|
|
827
|
+
};
|
|
828
|
+
|
|
785
829
|
// core/http/http.client.ts
|
|
786
830
|
import axios from "axios";
|
|
787
831
|
var HTTPClient = class {
|
|
@@ -880,6 +924,7 @@ export {
|
|
|
880
924
|
SignOutButton,
|
|
881
925
|
Spinner,
|
|
882
926
|
StatsCard,
|
|
927
|
+
Tabs,
|
|
883
928
|
Tag,
|
|
884
929
|
Text,
|
|
885
930
|
TextArea,
|
package/dist/next/index.d.ts
CHANGED
|
@@ -25,13 +25,20 @@ interface PageWrapperProps {
|
|
|
25
25
|
|
|
26
26
|
declare const PageWrapper: ({ children }: PageWrapperProps) => react.JSX.Element;
|
|
27
27
|
|
|
28
|
+
type LinkVariant = "inline" | "nav";
|
|
28
29
|
interface LinkProps {
|
|
29
30
|
children: ReactNode;
|
|
30
31
|
href: string;
|
|
32
|
+
/** `inline` is a link in a text. `nav` is a row of a menu, with no underline. */
|
|
33
|
+
variant?: LinkVariant;
|
|
31
34
|
color?: SemanticColor;
|
|
35
|
+
/** The link to the current page: it gets `aria-current="page"`. */
|
|
36
|
+
active?: boolean;
|
|
37
|
+
/** The accessible name, for a link whose children have no text. */
|
|
38
|
+
"aria-label"?: string;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
|
-
declare const Link: ({ children, href, color }: LinkProps) => react.JSX.Element;
|
|
41
|
+
declare const Link: ({ children, href, variant, color, active, "aria-label": ariaLabel, }: LinkProps) => react.JSX.Element;
|
|
35
42
|
|
|
36
43
|
type AppProvidersProps = ReduxProviderProps & Pick<ZustandProvidersProps, "auth">;
|
|
37
44
|
|
|
@@ -48,4 +55,4 @@ interface PageConfigProps {
|
|
|
48
55
|
declare const PageConfig: ({ children, title, reducers, initPage, }: PageConfigProps) => react.JSX.Element;
|
|
49
56
|
|
|
50
57
|
export { AppProviders, Link, NotFound, PageConfig, PageWrapper, RootLayout };
|
|
51
|
-
export type { AppProvidersProps, InitPageFunction, LinkProps, NotFoundProps, PageConfigProps, PageWrapperProps, RootLayoutProps };
|
|
58
|
+
export type { AppProvidersProps, InitPageFunction, LinkProps, LinkVariant, NotFoundProps, PageConfigProps, PageWrapperProps, RootLayoutProps };
|
package/dist/next/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Heading,
|
|
4
|
+
Link,
|
|
4
5
|
ReduxProvider,
|
|
5
6
|
Text,
|
|
6
7
|
ZustandProviders,
|
|
7
8
|
usePageStore,
|
|
8
9
|
useRouterStore
|
|
9
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-XRJCFNLC.js";
|
|
10
11
|
|
|
11
12
|
// core/next/root-layout/root-layout.styles.ts
|
|
12
13
|
import { tv } from "tailwind-variants";
|
|
@@ -20,39 +21,9 @@ var RootLayout = ({ children }) => {
|
|
|
20
21
|
return /* @__PURE__ */ jsx("main", { className: rootLayout(), children });
|
|
21
22
|
};
|
|
22
23
|
|
|
23
|
-
// core/next/link/link.tsx
|
|
24
|
-
import NextLink from "next/link.js";
|
|
25
|
-
|
|
26
|
-
// core/next/link/link.styles.ts
|
|
27
|
-
import { tv as tv2 } from "tailwind-variants";
|
|
28
|
-
var link = tv2({
|
|
29
|
-
// outline-current draws the focus in the text color. The invisible ::after grows the touch target to 44px without changing the layout.
|
|
30
|
-
base: "relative rounded-sm underline underline-offset-2 hover:decoration-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current after:absolute after:top-1/2 after:left-1/2 after:h-11 after:w-full after:min-w-11 after:-translate-x-1/2 after:-translate-y-1/2",
|
|
31
|
-
variants: {
|
|
32
|
-
color: {
|
|
33
|
-
primary: "text-zl-primary hover:text-zl-primary-strong",
|
|
34
|
-
success: "text-zl-success hover:text-zl-success-strong",
|
|
35
|
-
danger: "text-zl-danger hover:text-zl-danger-strong",
|
|
36
|
-
warning: "text-zl-warning hover:text-zl-warning-strong",
|
|
37
|
-
info: "text-zl-info hover:text-zl-info-strong",
|
|
38
|
-
muted: "text-zl-muted hover:text-zl-muted-strong",
|
|
39
|
-
none: ""
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
defaultVariants: {
|
|
43
|
-
color: "primary"
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// core/next/link/link.tsx
|
|
48
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
49
|
-
var Link = ({ children, href, color = "primary" }) => {
|
|
50
|
-
return /* @__PURE__ */ jsx2(NextLink, { href, className: link({ color }), children });
|
|
51
|
-
};
|
|
52
|
-
|
|
53
24
|
// core/next/not-found/not-found.styles.ts
|
|
54
|
-
import { tv as
|
|
55
|
-
var notFound =
|
|
25
|
+
import { tv as tv2 } from "tailwind-variants";
|
|
26
|
+
var notFound = tv2({
|
|
56
27
|
slots: {
|
|
57
28
|
base: "flex flex-col items-center justify-center gap-6 min-h-dvh p-4 text-center",
|
|
58
29
|
code: "text-6xl font-bold text-zl-muted",
|
|
@@ -61,7 +32,7 @@ var notFound = tv3({
|
|
|
61
32
|
});
|
|
62
33
|
|
|
63
34
|
// core/next/not-found/not-found.tsx
|
|
64
|
-
import { jsx as
|
|
35
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
65
36
|
var NotFound = ({
|
|
66
37
|
title = "Page not found",
|
|
67
38
|
message = "The page you are looking for does not exist.",
|
|
@@ -70,18 +41,18 @@ var NotFound = ({
|
|
|
70
41
|
}) => {
|
|
71
42
|
const { base, code, content } = notFound();
|
|
72
43
|
return /* @__PURE__ */ jsxs("div", { className: base(), children: [
|
|
73
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ jsx2("span", { className: code(), children: "404" }),
|
|
74
45
|
/* @__PURE__ */ jsxs("div", { className: content(), children: [
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ jsx2(Heading, { children: title }),
|
|
47
|
+
/* @__PURE__ */ jsx2(Text, { color: "muted", children: message })
|
|
77
48
|
] }),
|
|
78
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ jsx2(Link, { href: backHref, children: backLabel })
|
|
79
50
|
] });
|
|
80
51
|
};
|
|
81
52
|
|
|
82
53
|
// core/next/page-wrapper/page-wrapper.styles.ts
|
|
83
|
-
import { tv as
|
|
84
|
-
var pageWrapper =
|
|
54
|
+
import { tv as tv3 } from "tailwind-variants";
|
|
55
|
+
var pageWrapper = tv3({
|
|
85
56
|
slots: {
|
|
86
57
|
base: "flex items-center justify-center min-h-dvh p-4",
|
|
87
58
|
content: "w-full max-w-sm"
|
|
@@ -89,16 +60,16 @@ var pageWrapper = tv4({
|
|
|
89
60
|
});
|
|
90
61
|
|
|
91
62
|
// core/next/page-wrapper/page-wrapper.tsx
|
|
92
|
-
import { jsx as
|
|
63
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
93
64
|
var PageWrapper = ({ children }) => {
|
|
94
65
|
const { base, content } = pageWrapper();
|
|
95
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ jsx3("div", { className: base(), children: /* @__PURE__ */ jsx3("div", { className: content(), children }) });
|
|
96
67
|
};
|
|
97
68
|
|
|
98
69
|
// core/next/app-providers/app-providers.tsx
|
|
99
70
|
import { useEffect } from "react";
|
|
100
71
|
import { usePathname } from "next/navigation.js";
|
|
101
|
-
import { jsx as
|
|
72
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
102
73
|
var RouteSync = () => {
|
|
103
74
|
const pathname = usePathname();
|
|
104
75
|
const setRoute = useRouterStore((s) => s.setRoute);
|
|
@@ -114,14 +85,14 @@ var AppProviders = ({
|
|
|
114
85
|
auth,
|
|
115
86
|
...store
|
|
116
87
|
}) => /* @__PURE__ */ jsxs2(ReduxProvider, { ...store, children: [
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ jsx4(RouteSync, {}),
|
|
89
|
+
/* @__PURE__ */ jsx4(ZustandProviders, { auth, children })
|
|
119
90
|
] });
|
|
120
91
|
|
|
121
92
|
// core/next/page-config/page-config.tsx
|
|
122
93
|
import { useEffect as useEffect2 } from "react";
|
|
123
94
|
import { useDispatch, useStore } from "react-redux";
|
|
124
|
-
import { Fragment, jsx as
|
|
95
|
+
import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
|
|
125
96
|
var PageConfig = ({
|
|
126
97
|
children,
|
|
127
98
|
title,
|
|
@@ -144,7 +115,7 @@ var PageConfig = ({
|
|
|
144
115
|
initPage(dispatch);
|
|
145
116
|
}
|
|
146
117
|
}, []);
|
|
147
|
-
return /* @__PURE__ */
|
|
118
|
+
return /* @__PURE__ */ jsx5(Fragment, { children });
|
|
148
119
|
};
|
|
149
120
|
export {
|
|
150
121
|
AppProviders,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexandregme/zljs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"@ag-grid-community/locale": "^36.2.0",
|
|
76
76
|
"@hookform/resolvers": "^5.2.2",
|
|
77
77
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
78
|
+
"@radix-ui/react-tabs": "^1.2.1",
|
|
78
79
|
"ag-grid-community": "^36.2.0",
|
|
79
80
|
"ag-grid-react": "^36.2.0",
|
|
80
81
|
"axios": "^1.13.5",
|