@alexandregme/zljs 3.10.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 +39 -1
- package/dist/{chunk-JMEGXQKC.js → chunk-TMUYZTIH.js} +747 -327
- package/dist/index.d.ts +92 -20
- package/dist/index.js +18 -157
- package/dist/next/index.d.ts +11 -2
- package/dist/next/index.js +18 -47
- package/package.json +1 -1
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;
|
|
@@ -241,6 +243,29 @@ interface TextProps {
|
|
|
241
243
|
|
|
242
244
|
declare const Text: ({ children, as: Tag, variant, color, }: TextProps) => react.JSX.Element;
|
|
243
245
|
|
|
246
|
+
interface SignOutButtonProps {
|
|
247
|
+
/** The accessible name of the icon button. */
|
|
248
|
+
label?: string;
|
|
249
|
+
/** The size of the icon button. `lg` is for a touch screen. */
|
|
250
|
+
size?: Size;
|
|
251
|
+
/** The question of the modal a click opens. */
|
|
252
|
+
confirmTitle?: string;
|
|
253
|
+
/** The button of the modal that signs out. */
|
|
254
|
+
confirmLabel?: string;
|
|
255
|
+
/** The button of the modal that keeps the user signed in. */
|
|
256
|
+
cancelLabel?: string;
|
|
257
|
+
/** The toast when signing out fails. */
|
|
258
|
+
errorMessage?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Signs the user out, for an app with no `AuthProvider`. It is called when
|
|
261
|
+
* the user confirms in the modal. Without it, the button signs out through
|
|
262
|
+
* the adapter of `AuthProvider`.
|
|
263
|
+
*/
|
|
264
|
+
onSignOut?: () => void | Promise<void>;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
declare const SignOutButton: ({ label, size, confirmTitle, confirmLabel, cancelLabel, errorMessage, onSignOut, }: SignOutButtonProps) => react.JSX.Element;
|
|
268
|
+
|
|
244
269
|
interface SidebarItem {
|
|
245
270
|
icon: IconName;
|
|
246
271
|
label: string;
|
|
@@ -259,12 +284,25 @@ interface SidebarProps {
|
|
|
259
284
|
activeHref?: string;
|
|
260
285
|
defaultCollapsed?: boolean;
|
|
261
286
|
collapseLabel: string;
|
|
287
|
+
/** The accessible name of the collapse button while collapsed. */
|
|
288
|
+
expandLabel?: string;
|
|
262
289
|
homeHref?: string | false;
|
|
263
290
|
homeLabel?: string;
|
|
264
|
-
|
|
291
|
+
/** The accessible name of the navigation. */
|
|
292
|
+
navLabel?: string;
|
|
293
|
+
/**
|
|
294
|
+
* The texts of the logout button and of the modal it opens: `label`,
|
|
295
|
+
* `confirmTitle`, `confirmLabel`, `cancelLabel` and `errorMessage`.
|
|
296
|
+
*/
|
|
297
|
+
logout?: Omit<SignOutButtonProps, "onSignOut">;
|
|
298
|
+
/**
|
|
299
|
+
* Logs the user out. It is called when the user confirms in the modal, never
|
|
300
|
+
* on the first click. A rejected promise shows the error toast.
|
|
301
|
+
*/
|
|
302
|
+
onLogout: () => void | Promise<void>;
|
|
265
303
|
}
|
|
266
304
|
|
|
267
|
-
declare const Sidebar: ({ sections, user, activeHref, defaultCollapsed, collapseLabel, homeHref, homeLabel, onLogout, }: SidebarProps) => react.JSX.Element;
|
|
305
|
+
declare const Sidebar: ({ sections, user, activeHref, defaultCollapsed, collapseLabel, expandLabel, homeHref, homeLabel, navLabel, logout, onLogout, }: SidebarProps) => react.JSX.Element;
|
|
268
306
|
|
|
269
307
|
interface TabsItem {
|
|
270
308
|
/** Unique among the tabs. `defaultTab` and `onChange` use it. */
|
|
@@ -289,6 +327,34 @@ interface TabsProps {
|
|
|
289
327
|
|
|
290
328
|
declare const Tabs: ({ tabs, "aria-label": ariaLabel, defaultTab, onChange, }: TabsProps) => react.JSX.Element;
|
|
291
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
|
+
|
|
292
358
|
type TagColor = Exclude<SemanticColor, "none"> | AuxiliaryColor;
|
|
293
359
|
interface TagProps {
|
|
294
360
|
children: ReactNode;
|
|
@@ -355,6 +421,27 @@ interface LoaderProps {
|
|
|
355
421
|
|
|
356
422
|
declare const Loader: ({ label }: LoaderProps) => react.JSX.Element | null;
|
|
357
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
|
+
|
|
358
445
|
interface AppState {
|
|
359
446
|
fetchingCalls: number;
|
|
360
447
|
fetching: boolean;
|
|
@@ -571,21 +658,6 @@ interface AuthorizedProps<V extends LoginVendor = LoginVendor> {
|
|
|
571
658
|
|
|
572
659
|
declare const Authorized: <V extends LoginVendor>({ children, roles, login, accessPending, }: AuthorizedProps<V>) => react.JSX.Element | null;
|
|
573
660
|
|
|
574
|
-
interface SignOutButtonProps {
|
|
575
|
-
/** The accessible name of the icon button. */
|
|
576
|
-
label?: string;
|
|
577
|
-
/** The question of the modal a click opens. */
|
|
578
|
-
confirmTitle?: string;
|
|
579
|
-
/** The button of the modal that signs out. */
|
|
580
|
-
confirmLabel?: string;
|
|
581
|
-
/** The button of the modal that keeps the user signed in. */
|
|
582
|
-
cancelLabel?: string;
|
|
583
|
-
/** The toast when signing out fails. */
|
|
584
|
-
errorMessage?: string;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
declare const SignOutButton: ({ label, confirmTitle, confirmLabel, cancelLabel, errorMessage, }: SignOutButtonProps) => react.JSX.Element;
|
|
588
|
-
|
|
589
661
|
interface UseAuthResult extends Omit<AuthAdapter, "onSessionChange"> {
|
|
590
662
|
status: AuthStatus;
|
|
591
663
|
user: AuthUser | null;
|
|
@@ -597,5 +669,5 @@ declare const useAuth: () => UseAuthResult;
|
|
|
597
669
|
|
|
598
670
|
declare const ZustandProviders: ({ children, auth }: ZustandProvidersProps) => react.JSX.Element;
|
|
599
671
|
|
|
600
|
-
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 };
|
|
601
|
-
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
|
@@ -11,11 +11,14 @@ import {
|
|
|
11
11
|
Loader,
|
|
12
12
|
Login,
|
|
13
13
|
Modal,
|
|
14
|
+
Navigation,
|
|
14
15
|
ReduxProvider,
|
|
16
|
+
Sidebar,
|
|
15
17
|
SignOutButton,
|
|
16
18
|
Spinner,
|
|
17
19
|
Text,
|
|
18
20
|
Toaster,
|
|
21
|
+
TopNav,
|
|
19
22
|
ZustandProviders,
|
|
20
23
|
appInitialState,
|
|
21
24
|
getAuthSession,
|
|
@@ -23,10 +26,11 @@ import {
|
|
|
23
26
|
toast,
|
|
24
27
|
useAppStore,
|
|
25
28
|
useAuth,
|
|
29
|
+
useIsDesktop,
|
|
26
30
|
usePageStore,
|
|
27
31
|
useRouterStore,
|
|
28
32
|
useToastStore
|
|
29
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-TMUYZTIH.js";
|
|
30
34
|
import {
|
|
31
35
|
Error,
|
|
32
36
|
FormInput,
|
|
@@ -636,158 +640,12 @@ var WhatsAppButton = ({
|
|
|
636
640
|
return /* @__PURE__ */ jsx11(Button, { color: "success", icon: "SiWhatsapp", onClick: handleClick, children });
|
|
637
641
|
};
|
|
638
642
|
|
|
639
|
-
// core/sidebar/sidebar.tsx
|
|
640
|
-
import { useState as useState2 } from "react";
|
|
641
|
-
import Link from "next/link.js";
|
|
642
|
-
|
|
643
|
-
// core/sidebar/sidebar.styles.ts
|
|
644
|
-
import { tv as tv9 } from "tailwind-variants";
|
|
645
|
-
var sidebar = tv9({
|
|
646
|
-
base: "h-screen bg-neutral-800 text-neutral-300 flex flex-col overflow-hidden transition-all duration-200 divide-y divide-neutral-600/50",
|
|
647
|
-
variants: {
|
|
648
|
-
collapsed: {
|
|
649
|
-
true: "w-14",
|
|
650
|
-
false: "w-64"
|
|
651
|
-
}
|
|
652
|
-
},
|
|
653
|
-
defaultVariants: {
|
|
654
|
-
collapsed: false
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
|
-
var nav = tv9({
|
|
658
|
-
base: "flex-1 min-h-0 overflow-y-auto overflow-x-hidden divide-y divide-neutral-600/50"
|
|
659
|
-
});
|
|
660
|
-
var header = tv9({
|
|
661
|
-
base: "shrink-0 p-2"
|
|
662
|
-
});
|
|
663
|
-
var section = tv9({
|
|
664
|
-
base: "grid gap-1 p-2"
|
|
665
|
-
});
|
|
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
|
-
var footer = tv9({
|
|
685
|
-
base: "shrink-0 h-16 p-3 flex items-center gap-3",
|
|
686
|
-
variants: {
|
|
687
|
-
collapsed: {
|
|
688
|
-
true: "justify-center"
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
});
|
|
692
|
-
var avatar = tv9({
|
|
693
|
-
base: "shrink-0 size-8 rounded-full bg-neutral-600 text-white text-xs font-medium flex items-center justify-center"
|
|
694
|
-
});
|
|
695
|
-
var userInfo = tv9({
|
|
696
|
-
base: "flex flex-col min-w-0 text-white [&>*]:truncate [&>*:last-child]:text-xs [&>*:last-child]:text-neutral-400"
|
|
697
|
-
});
|
|
698
|
-
var toggleButton = tv9({
|
|
699
|
-
base: "shrink-0 h-14 grid p-2 [&>button]:justify-start [&>button]:px-3 [&>button]:overflow-hidden [&>button]:whitespace-nowrap"
|
|
700
|
-
});
|
|
701
|
-
|
|
702
|
-
// core/sidebar/sidebar.tsx
|
|
703
|
-
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
704
|
-
var getInitials = (name) => {
|
|
705
|
-
const parts = name.trim().split(/\s+/);
|
|
706
|
-
if (parts.length >= 2) {
|
|
707
|
-
return `${parts[0][0]}${parts[parts.length - 1][0]}`.toUpperCase();
|
|
708
|
-
}
|
|
709
|
-
return (parts[0]?.[0] ?? "").toUpperCase();
|
|
710
|
-
};
|
|
711
|
-
var Sidebar = ({
|
|
712
|
-
sections,
|
|
713
|
-
user,
|
|
714
|
-
activeHref,
|
|
715
|
-
defaultCollapsed = false,
|
|
716
|
-
collapseLabel,
|
|
717
|
-
homeHref = "/",
|
|
718
|
-
homeLabel,
|
|
719
|
-
onLogout
|
|
720
|
-
}) => {
|
|
721
|
-
const [collapsed, setCollapsed] = useState2(defaultCollapsed);
|
|
722
|
-
const initials = getInitials(user.name);
|
|
723
|
-
return /* @__PURE__ */ jsxs10("aside", { className: sidebar({ collapsed }), children: [
|
|
724
|
-
homeHref && /* @__PURE__ */ jsx12("div", { className: header(), children: /* @__PURE__ */ jsxs10(
|
|
725
|
-
Link,
|
|
726
|
-
{
|
|
727
|
-
href: homeHref,
|
|
728
|
-
className: item({ active: homeHref === activeHref, collapsed }),
|
|
729
|
-
"aria-label": homeLabel || "Home",
|
|
730
|
-
...homeHref === activeHref && { "aria-current": "page" },
|
|
731
|
-
children: [
|
|
732
|
-
/* @__PURE__ */ jsx12(Icon, { name: "Home" }),
|
|
733
|
-
homeLabel && /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: homeLabel })
|
|
734
|
-
]
|
|
735
|
-
}
|
|
736
|
-
) }),
|
|
737
|
-
/* @__PURE__ */ jsx12("nav", { "aria-label": "Main navigation", className: nav(), children: sections.map((sectionData, i) => /* @__PURE__ */ jsx12("div", { className: section(), children: sectionData.items.map((sidebarItem) => {
|
|
738
|
-
const isActive = sidebarItem.href === activeHref;
|
|
739
|
-
return /* @__PURE__ */ jsxs10(
|
|
740
|
-
Link,
|
|
741
|
-
{
|
|
742
|
-
href: sidebarItem.href,
|
|
743
|
-
className: item({ active: isActive, collapsed }),
|
|
744
|
-
...isActive && { "aria-current": "page" },
|
|
745
|
-
children: [
|
|
746
|
-
/* @__PURE__ */ jsx12(Icon, { name: sidebarItem.icon }),
|
|
747
|
-
/* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: sidebarItem.label })
|
|
748
|
-
]
|
|
749
|
-
},
|
|
750
|
-
sidebarItem.href
|
|
751
|
-
);
|
|
752
|
-
}) }, i)) }),
|
|
753
|
-
/* @__PURE__ */ jsxs10("div", { className: footer({ collapsed }), children: [
|
|
754
|
-
!collapsed && /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
755
|
-
/* @__PURE__ */ jsx12("div", { "aria-hidden": "true", className: avatar(), children: initials }),
|
|
756
|
-
/* @__PURE__ */ jsxs10("div", { className: userInfo(), children: [
|
|
757
|
-
/* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: user.name }),
|
|
758
|
-
/* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: user.email })
|
|
759
|
-
] })
|
|
760
|
-
] }),
|
|
761
|
-
/* @__PURE__ */ jsx12(
|
|
762
|
-
Button,
|
|
763
|
-
{
|
|
764
|
-
color: "ghost",
|
|
765
|
-
icon: "LogOut",
|
|
766
|
-
"aria-label": "Logout",
|
|
767
|
-
onClick: onLogout
|
|
768
|
-
}
|
|
769
|
-
)
|
|
770
|
-
] }),
|
|
771
|
-
/* @__PURE__ */ jsx12("div", { className: toggleButton(), children: /* @__PURE__ */ jsx12(
|
|
772
|
-
Button,
|
|
773
|
-
{
|
|
774
|
-
variant: "default",
|
|
775
|
-
color: "ghost",
|
|
776
|
-
icon: collapsed ? "ChevronRight" : "ChevronLeft",
|
|
777
|
-
"aria-label": collapsed ? "Expand sidebar" : void 0,
|
|
778
|
-
onClick: () => setCollapsed(!collapsed),
|
|
779
|
-
children: collapsed ? void 0 : collapseLabel
|
|
780
|
-
}
|
|
781
|
-
) })
|
|
782
|
-
] });
|
|
783
|
-
};
|
|
784
|
-
|
|
785
643
|
// core/tabs/tabs.tsx
|
|
786
644
|
import * as RadixTabs from "@radix-ui/react-tabs";
|
|
787
645
|
|
|
788
646
|
// core/tabs/tabs.styles.ts
|
|
789
|
-
import { tv as
|
|
790
|
-
var tabs =
|
|
647
|
+
import { tv as tv9 } from "tailwind-variants";
|
|
648
|
+
var tabs = tv9({
|
|
791
649
|
slots: {
|
|
792
650
|
// A border around the tabs and the panel, which holds them together. Takes
|
|
793
651
|
// the height of a parent that has one, and the panel gets what the list
|
|
@@ -810,7 +668,7 @@ var tabs = tv10({
|
|
|
810
668
|
});
|
|
811
669
|
|
|
812
670
|
// core/tabs/tabs.tsx
|
|
813
|
-
import { jsx as
|
|
671
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
814
672
|
var Tabs = ({
|
|
815
673
|
tabs: tabs2,
|
|
816
674
|
"aria-label": ariaLabel,
|
|
@@ -818,21 +676,21 @@ var Tabs = ({
|
|
|
818
676
|
onChange
|
|
819
677
|
}) => {
|
|
820
678
|
const { base, list, tab, text, panel } = tabs();
|
|
821
|
-
return /* @__PURE__ */
|
|
679
|
+
return /* @__PURE__ */ jsxs10(
|
|
822
680
|
RadixTabs.Root,
|
|
823
681
|
{
|
|
824
682
|
className: base(),
|
|
825
683
|
defaultValue: defaultTab,
|
|
826
684
|
onValueChange: onChange,
|
|
827
685
|
children: [
|
|
828
|
-
/* @__PURE__ */
|
|
829
|
-
/* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
subtitle && /* @__PURE__ */
|
|
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 })
|
|
832
690
|
] }),
|
|
833
|
-
count !== void 0 && /* @__PURE__ */
|
|
691
|
+
count !== void 0 && /* @__PURE__ */ jsx12(Tag, { color: "primary", size: "md", children: count })
|
|
834
692
|
] }, id)) }),
|
|
835
|
-
tabs2.map(({ id, children }) => /* @__PURE__ */
|
|
693
|
+
tabs2.map(({ id, children }) => /* @__PURE__ */ jsx12(RadixTabs.Content, { value: id, className: panel(), children }, id))
|
|
836
694
|
]
|
|
837
695
|
}
|
|
838
696
|
);
|
|
@@ -929,6 +787,7 @@ export {
|
|
|
929
787
|
Loader,
|
|
930
788
|
Login,
|
|
931
789
|
Modal,
|
|
790
|
+
Navigation,
|
|
932
791
|
Radio,
|
|
933
792
|
ReduxProvider,
|
|
934
793
|
Select,
|
|
@@ -941,6 +800,7 @@ export {
|
|
|
941
800
|
Text,
|
|
942
801
|
TextArea,
|
|
943
802
|
Toaster,
|
|
803
|
+
TopNav,
|
|
944
804
|
WhatsAppButton,
|
|
945
805
|
ZustandProviders,
|
|
946
806
|
appInitialState,
|
|
@@ -949,6 +809,7 @@ export {
|
|
|
949
809
|
toast,
|
|
950
810
|
useAppStore,
|
|
951
811
|
useAuth,
|
|
812
|
+
useIsDesktop,
|
|
952
813
|
usePageStore,
|
|
953
814
|
useRouterStore,
|
|
954
815
|
useToastStore
|
package/dist/next/index.d.ts
CHANGED
|
@@ -25,13 +25,22 @@ 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;
|
|
39
|
+
/** Called on a click, before the navigation, such as to close a menu. */
|
|
40
|
+
onClick?: () => void;
|
|
32
41
|
}
|
|
33
42
|
|
|
34
|
-
declare const Link: ({ children, href, color }: LinkProps) => react.JSX.Element;
|
|
43
|
+
declare const Link: ({ children, href, variant, color, active, "aria-label": ariaLabel, onClick, }: LinkProps) => react.JSX.Element;
|
|
35
44
|
|
|
36
45
|
type AppProvidersProps = ReduxProviderProps & Pick<ZustandProvidersProps, "auth">;
|
|
37
46
|
|
|
@@ -48,4 +57,4 @@ interface PageConfigProps {
|
|
|
48
57
|
declare const PageConfig: ({ children, title, reducers, initPage, }: PageConfigProps) => react.JSX.Element;
|
|
49
58
|
|
|
50
59
|
export { AppProviders, Link, NotFound, PageConfig, PageWrapper, RootLayout };
|
|
51
|
-
export type { AppProvidersProps, InitPageFunction, LinkProps, NotFoundProps, PageConfigProps, PageWrapperProps, RootLayoutProps };
|
|
60
|
+
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-TMUYZTIH.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,
|