@timmbr/ui 1.0.0-beta → 1.1.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/README.md +20 -16
- package/dist/components/Avatar/Avatar.styles.d.ts +1 -1
- package/dist/components/Badge/Badge.styles.d.ts +1 -1
- package/dist/components/Button/Button.styles.d.ts +2 -2
- package/dist/components/Chip/Chip.styles.d.ts +1 -1
- package/dist/components/CrossZoneLink/CrossZoneLink.d.ts +10 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.d.ts.map +1 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.js +111 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.d.ts +8 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.d.ts.map +1 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.js +33 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.types.d.ts +31 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.types.d.ts.map +1 -0
- package/dist/components/CrossZoneLink/index.d.ts +4 -0
- package/dist/components/CrossZoneLink/index.d.ts.map +1 -0
- package/dist/components/Divider/Divider.styles.d.ts +1 -1
- package/dist/components/FormField/FormField.js +3 -3
- package/dist/components/Heading/Heading.styles.d.ts +2 -2
- package/dist/components/Icon/Icon.styles.d.ts +1 -1
- package/dist/components/Inline/Inline.styles.d.ts +2 -2
- package/dist/components/Input/Input.js +3 -3
- package/dist/components/Input/Input.styles.d.ts +1 -1
- package/dist/components/Input/Input.styles.js +1 -1
- package/dist/components/Input/Input.types.d.ts +1 -1
- package/dist/components/Input/Input.types.d.ts.map +1 -1
- package/dist/components/LinkButton/LinkButton.d.ts +13 -0
- package/dist/components/LinkButton/LinkButton.d.ts.map +1 -0
- package/dist/components/LinkButton/LinkButton.js +179 -0
- package/dist/components/LinkButton/LinkButton.styles.d.ts +8 -0
- package/dist/components/LinkButton/LinkButton.styles.d.ts.map +1 -0
- package/dist/components/LinkButton/LinkButton.styles.js +61 -0
- package/dist/components/LinkButton/LinkButton.types.d.ts +60 -0
- package/dist/components/LinkButton/LinkButton.types.d.ts.map +1 -0
- package/dist/components/LinkButton/index.d.ts +4 -0
- package/dist/components/LinkButton/index.d.ts.map +1 -0
- package/dist/components/Progress/Progress.styles.d.ts +1 -1
- package/dist/components/Radio/Radio.js +3 -3
- package/dist/components/Select/Select.js +3 -3
- package/dist/components/Select/Select.styles.d.ts +1 -1
- package/dist/components/SideBarNavigation/SideBarNavigation.context.d.ts +15 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.context.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.context.js +10 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.d.ts +4 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.helpers.d.ts +19 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.helpers.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.helpers.js +48 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.js +132 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.styles.d.ts +18 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.styles.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.styles.js +85 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.types.d.ts +69 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.types.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/index.d.ts +13 -0
- package/dist/components/SideBarNavigation/index.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarBranding.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarBranding.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarBranding.js +58 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarFooter.d.ts +10 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarFooter.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarFooter.js +27 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarNavItem.d.ts +14 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarNavItem.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarNavItem.js +147 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarPopoverMenu.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarPopoverMenu.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarPopoverMenu.js +106 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarProfile.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarProfile.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarProfile.js +118 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarSubItem.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarSubItem.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarSubItem.js +34 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarToggle.d.ts +8 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarToggle.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarToggle.js +40 -0
- package/dist/components/Stack/Stack.styles.d.ts +2 -2
- package/dist/components/Tabs/Tabs.styles.d.ts +2 -2
- package/dist/components/Text/Text.styles.d.ts +2 -2
- package/dist/components/Textarea/Textarea.js +3 -3
- package/dist/components/Textarea/Textarea.styles.d.ts +1 -1
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/Toast/Toast.js +12 -3
- package/dist/components/Toast/Toast.types.d.ts +34 -0
- package/dist/components/Toast/Toast.types.d.ts.map +1 -1
- package/dist/components/Toast/ToastContainer.d.ts +7 -0
- package/dist/components/Toast/ToastContainer.d.ts.map +1 -0
- package/dist/components/Toast/ToastContainer.js +104 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/toastStore.d.ts +31 -0
- package/dist/components/Toast/toastStore.d.ts.map +1 -0
- package/dist/components/Toast/toastStore.js +104 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -1
- package/dist/providers/TimmbrConfigProvider.d.ts +20 -2
- package/dist/providers/TimmbrConfigProvider.d.ts.map +1 -1
- package/dist/providers/TimmbrConfigProvider.js +38 -3
- package/package.json +14 -6
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { motion, sidebarToggleIconVariants } from '@timmbr/motion';
|
|
4
|
+
import { ChevronLeft } from '@timmbr/icons';
|
|
5
|
+
import { cn } from '@timmbr/utils';
|
|
6
|
+
import { sidebarToggleVariants } from '../SideBarNavigation.styles.js';
|
|
7
|
+
import { useSidebarContext } from '../SideBarNavigation.context.js';
|
|
8
|
+
|
|
9
|
+
const SidebarToggle = ({
|
|
10
|
+
collapsed,
|
|
11
|
+
onToggle,
|
|
12
|
+
className
|
|
13
|
+
}) => {
|
|
14
|
+
const { shouldAnimate } = useSidebarContext();
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
"button",
|
|
17
|
+
{
|
|
18
|
+
type: "button",
|
|
19
|
+
onClick: onToggle,
|
|
20
|
+
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
21
|
+
className: sidebarToggleVariants({ className }),
|
|
22
|
+
"data-testid": "sidebar-toggle-btn",
|
|
23
|
+
children: /* @__PURE__ */ jsx(
|
|
24
|
+
motion.span,
|
|
25
|
+
{
|
|
26
|
+
initial: false,
|
|
27
|
+
animate: shouldAnimate ? collapsed ? "collapsed" : "expanded" : void 0,
|
|
28
|
+
variants: shouldAnimate ? sidebarToggleIconVariants : void 0,
|
|
29
|
+
className: cn(
|
|
30
|
+
"inline-flex items-center justify-center",
|
|
31
|
+
!shouldAnimate && (collapsed ? "rotate-180" : "")
|
|
32
|
+
),
|
|
33
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-3.5 stroke-[2.5]" })
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { SidebarToggle };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const stackVariants: (props?: ({
|
|
3
|
-
align?: "
|
|
4
|
-
justify?: "center" | "
|
|
3
|
+
align?: "center" | "start" | "stretch" | "end" | "baseline" | null | undefined;
|
|
4
|
+
justify?: "center" | "start" | "end" | "between" | "around" | "evenly" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
export type StackVariants = VariantProps<typeof stackVariants>;
|
|
7
7
|
//# sourceMappingURL=Stack.styles.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const tabsListVariants: (props?: ({
|
|
3
|
-
variant?: "
|
|
3
|
+
variant?: "underline" | "outline" | "pills" | null | undefined;
|
|
4
4
|
size?: "default" | "sm" | "lg" | "md" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
export declare const tabsTriggerVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "underline" | "outline" | "pills" | null | undefined;
|
|
8
8
|
size?: "default" | "sm" | "lg" | "md" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
10
|
export declare const tabsContentVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const textVariants: (props?: ({
|
|
3
3
|
variant?: "caption" | "body-1" | "body-2" | "body-2-medium" | "body-2-semibold" | "body-2-light" | "body-3" | "body-3-light" | "subtitle-1" | "subtitle-2" | null | undefined;
|
|
4
|
-
foreground?: "default" | "inherit" | "white" | "subtle" | "primary" | "secondary" | "
|
|
5
|
-
weight?: "bold" | "
|
|
4
|
+
foreground?: "default" | "destructive" | "inherit" | "white" | "subtle" | "primary" | "secondary" | "muted" | null | undefined;
|
|
5
|
+
weight?: "bold" | "normal" | "medium" | "light" | "semibold" | null | undefined;
|
|
6
6
|
italic?: boolean | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
export type TextVariants = VariantProps<typeof textVariants>;
|
|
@@ -145,12 +145,12 @@ const Textarea = React.forwardRef(
|
|
|
145
145
|
{
|
|
146
146
|
id: `${id}-desc`,
|
|
147
147
|
className: cn(
|
|
148
|
-
"text-xs mt-0.5 flex items-
|
|
148
|
+
"text-xs mt-0.5 flex items-start gap-1.5 flex-1",
|
|
149
149
|
isError ? "text-destructive font-medium" : "text-muted"
|
|
150
150
|
),
|
|
151
151
|
children: [
|
|
152
|
-
isError ? /* @__PURE__ */ jsx(AlertCircle, { className: "w-3.5 h-3.5 shrink-0", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Info, { className: "w-3.5 h-3.5 shrink-0", "aria-hidden": "true" }),
|
|
153
|
-
/* @__PURE__ */ jsx("span", { children: errorMessage || helperText })
|
|
152
|
+
isError ? /* @__PURE__ */ jsx(AlertCircle, { className: "w-3.5 h-3.5 shrink-0 mt-0.5", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Info, { className: "w-3.5 h-3.5 shrink-0 mt-0.5", "aria-hidden": "true" }),
|
|
153
|
+
/* @__PURE__ */ jsx("span", { className: "leading-tight", children: errorMessage || helperText })
|
|
154
154
|
]
|
|
155
155
|
}
|
|
156
156
|
) : /* @__PURE__ */ jsx("span", {}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const textareaVariants: (props?: ({
|
|
3
|
-
variant?: "
|
|
3
|
+
variant?: "filled" | "outline" | "subtle" | null | undefined;
|
|
4
4
|
size?: "default" | "sm" | "lg" | "md" | null | undefined;
|
|
5
5
|
resize?: "none" | "both" | "horizontal" | "vertical" | null | undefined;
|
|
6
6
|
isError?: boolean | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AAMxD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AAMxD,OAAO,KAAK,EAAiB,UAAU,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnF,eAAO,MAAM,aAAa,6CAA0B,CAAC;AAWrD,eAAO,MAAM,aAAa,6FAexB,CAAC;AAGH,eAAO,MAAM,KAAK,kFAuChB,CAAC;AAGH,eAAO,MAAM,WAAW,iKAatB,CAAC;AAGH,eAAO,MAAM,UAAU,gKAgBrB,CAAC;AAGH,eAAO,MAAM,UAAU,0JAUrB,CAAC;AAGH,eAAO,MAAM,gBAAgB,gKAU3B,CAAC"}
|
|
@@ -4,18 +4,27 @@ import * as React from 'react';
|
|
|
4
4
|
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
5
5
|
import { cn } from '@timmbr/utils';
|
|
6
6
|
import { X } from '@timmbr/icons';
|
|
7
|
+
import { useGlobalAnimation } from '../../providers/AnimationProvider.js';
|
|
7
8
|
import { resolveMotion } from '../../types/motion.js';
|
|
8
9
|
import { toastVariants } from './Toast.styles.js';
|
|
9
|
-
import { useGlobalAnimation } from '../../providers/AnimationProvider.js';
|
|
10
10
|
|
|
11
11
|
const ToastProvider = ToastPrimitive.Provider;
|
|
12
|
-
const
|
|
12
|
+
const positionClasses = {
|
|
13
|
+
"top-left": "top-4 left-4 flex-col",
|
|
14
|
+
"top-center": "top-4 left-1/2 -translate-x-1/2 flex-col",
|
|
15
|
+
"top-right": "top-4 right-4 flex-col",
|
|
16
|
+
"bottom-left": "bottom-4 left-4 flex-col-reverse",
|
|
17
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2 flex-col-reverse",
|
|
18
|
+
"bottom-right": "bottom-4 right-4 flex-col-reverse"
|
|
19
|
+
};
|
|
20
|
+
const ToastViewport = React.forwardRef(({ className, stacked, position = "bottom-right", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
13
21
|
ToastPrimitive.Viewport,
|
|
14
22
|
{
|
|
15
23
|
ref,
|
|
16
24
|
"data-slot": "toast-viewport",
|
|
17
25
|
className: cn(
|
|
18
|
-
"fixed
|
|
26
|
+
"fixed z-[100] group/toast-viewport flex gap-2 p-0 w-full sm:w-[420px] max-w-[420px]",
|
|
27
|
+
positionClasses[position] || positionClasses["bottom-right"],
|
|
19
28
|
stacked && "relative h-[80px]",
|
|
20
29
|
className
|
|
21
30
|
),
|
|
@@ -2,6 +2,36 @@ import type * as React from 'react';
|
|
|
2
2
|
import type * as ToastPrimitive from '@radix-ui/react-toast';
|
|
3
3
|
import type { ToastVariants } from './Toast.styles';
|
|
4
4
|
import type { MotionProp } from '../../types/motion';
|
|
5
|
+
export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
6
|
+
export interface ToastActionConfig {
|
|
7
|
+
label: React.ReactNode;
|
|
8
|
+
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
9
|
+
altText?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ToastOptions {
|
|
12
|
+
id?: string;
|
|
13
|
+
title?: React.ReactNode;
|
|
14
|
+
description?: React.ReactNode;
|
|
15
|
+
variant?: 'default' | 'destructive' | 'success' | 'warning' | 'info';
|
|
16
|
+
duration?: number;
|
|
17
|
+
position?: ToastPosition;
|
|
18
|
+
dismissible?: boolean;
|
|
19
|
+
action?: ToastActionConfig | React.ReactNode;
|
|
20
|
+
motion?: MotionProp;
|
|
21
|
+
onDismiss?: () => void;
|
|
22
|
+
onOpenChange?: (open: boolean) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface ToastItem extends ToastOptions {
|
|
25
|
+
id: string;
|
|
26
|
+
open: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface ToastGlobalConfig {
|
|
29
|
+
position?: ToastPosition;
|
|
30
|
+
duration?: number;
|
|
31
|
+
maxVisible?: number;
|
|
32
|
+
swipeDirection?: 'up' | 'down' | 'left' | 'right';
|
|
33
|
+
stacked?: boolean;
|
|
34
|
+
}
|
|
5
35
|
export interface ToastProps extends React.ComponentPropsWithoutRef<typeof ToastPrimitive.Root>, ToastVariants {
|
|
6
36
|
/**
|
|
7
37
|
* Motion transition control.
|
|
@@ -21,6 +51,10 @@ export interface ToastViewportProps extends React.ComponentPropsWithoutRef<typeo
|
|
|
21
51
|
* Whether the viewport operates in stacked card-deck mode.
|
|
22
52
|
*/
|
|
23
53
|
stacked?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Viewport position on screen.
|
|
56
|
+
*/
|
|
57
|
+
position?: ToastPosition;
|
|
24
58
|
}
|
|
25
59
|
export interface ToastActionElement extends React.ReactElement<React.ComponentPropsWithoutRef<typeof ToastPrimitive.Action>> {
|
|
26
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.types.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,KAAK,cA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E,aAAa,CAAC;CAC1B;AAED,MAAM,WAAW,kBACf,SAAQ,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;CAAG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ToastGlobalConfig } from './Toast.types';
|
|
3
|
+
export interface ToastContainerProps {
|
|
4
|
+
config?: ToastGlobalConfig;
|
|
5
|
+
}
|
|
6
|
+
export declare const ToastContainer: React.FC<ToastContainerProps>;
|
|
7
|
+
//# sourceMappingURL=ToastContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastContainer.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/ToastContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,eAAe,CAAC;AAUvB,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAuGxD,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { AlertCircle, AlertTriangle, CheckCircle, Info } from '@timmbr/icons';
|
|
5
|
+
import { Toast, ToastTitle, ToastDescription, ToastClose, ToastViewport, ToastAction } from './Toast.js';
|
|
6
|
+
import { toastStore } from './toastStore.js';
|
|
7
|
+
import { Inline } from '../Inline/Inline.js';
|
|
8
|
+
import { Stack } from '../Stack/Stack.js';
|
|
9
|
+
|
|
10
|
+
const VARIANT_ICONS = {
|
|
11
|
+
default: Info,
|
|
12
|
+
info: Info,
|
|
13
|
+
success: CheckCircle,
|
|
14
|
+
warning: AlertTriangle,
|
|
15
|
+
destructive: AlertCircle
|
|
16
|
+
};
|
|
17
|
+
const ToastContainer = ({ config }) => {
|
|
18
|
+
const [toasts, setToasts] = React.useState(() => toastStore.getToasts());
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (config?.maxVisible) {
|
|
21
|
+
toastStore.setMaxVisible(config.maxVisible);
|
|
22
|
+
}
|
|
23
|
+
return toastStore.subscribe(() => {
|
|
24
|
+
setToasts([...toastStore.getToasts()]);
|
|
25
|
+
});
|
|
26
|
+
}, [config?.maxVisible]);
|
|
27
|
+
const defaultPosition = config?.position || "bottom-right";
|
|
28
|
+
const defaultDuration = config?.duration ?? 4e3;
|
|
29
|
+
const toastsByPosition = React.useMemo(() => {
|
|
30
|
+
const map = /* @__PURE__ */ new Map();
|
|
31
|
+
for (const item of toasts) {
|
|
32
|
+
const pos = item.position || defaultPosition;
|
|
33
|
+
const list = map.get(pos) || [];
|
|
34
|
+
list.push(item);
|
|
35
|
+
map.set(pos, list);
|
|
36
|
+
}
|
|
37
|
+
return map;
|
|
38
|
+
}, [toasts, defaultPosition]);
|
|
39
|
+
if (toasts.length === 0) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const renderAction = (action) => {
|
|
43
|
+
if (!action) return null;
|
|
44
|
+
if (React.isValidElement(action)) {
|
|
45
|
+
return action;
|
|
46
|
+
}
|
|
47
|
+
const actionObj = action;
|
|
48
|
+
if (actionObj && actionObj.label && actionObj.onClick) {
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
ToastAction,
|
|
51
|
+
{
|
|
52
|
+
altText: actionObj.altText || (typeof actionObj.label === "string" ? actionObj.label : "Action"),
|
|
53
|
+
onClick: actionObj.onClick,
|
|
54
|
+
children: actionObj.label
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
};
|
|
60
|
+
return /* @__PURE__ */ jsx(Fragment, { children: Array.from(toastsByPosition.entries()).map(([pos, items]) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
61
|
+
items.map((item, index) => {
|
|
62
|
+
const Icon = VARIANT_ICONS[item.variant || "default"] || Info;
|
|
63
|
+
const isDestructive = item.variant === "destructive";
|
|
64
|
+
return /* @__PURE__ */ jsxs(
|
|
65
|
+
Toast,
|
|
66
|
+
{
|
|
67
|
+
open: item.open,
|
|
68
|
+
variant: item.variant,
|
|
69
|
+
duration: item.duration ?? defaultDuration,
|
|
70
|
+
motion: item.motion,
|
|
71
|
+
index: config?.stacked ? index : void 0,
|
|
72
|
+
total: config?.stacked ? items.length : void 0,
|
|
73
|
+
onOpenChange: (open) => {
|
|
74
|
+
if (!open) {
|
|
75
|
+
toastStore.dismiss(item.id);
|
|
76
|
+
item.onDismiss?.();
|
|
77
|
+
}
|
|
78
|
+
item.onOpenChange?.(open);
|
|
79
|
+
},
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ jsxs(Inline, { gap: 3, align: "start", className: "flex-1 min-w-0 pr-2", children: [
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
Icon,
|
|
84
|
+
{
|
|
85
|
+
className: `size-4.5 shrink-0 mt-0.5 ${isDestructive ? "text-white" : "text-current opacity-90"}`
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ jsxs(Stack, { gap: "2xs", className: "flex-1 min-w-0", children: [
|
|
89
|
+
item.title && /* @__PURE__ */ jsx(ToastTitle, { children: item.title }),
|
|
90
|
+
item.description && /* @__PURE__ */ jsx(ToastDescription, { children: item.description })
|
|
91
|
+
] })
|
|
92
|
+
] }),
|
|
93
|
+
renderAction(item.action),
|
|
94
|
+
item.dismissible !== false && /* @__PURE__ */ jsx(ToastClose, {})
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
item.id
|
|
98
|
+
);
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsx(ToastViewport, { position: pos, stacked: config?.stacked })
|
|
101
|
+
] }, pos)) });
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export { ToastContainer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ToastItem, ToastOptions } from './Toast.types';
|
|
3
|
+
type ToastSubscriber = () => void;
|
|
4
|
+
declare class ToastStore {
|
|
5
|
+
private toasts;
|
|
6
|
+
private listeners;
|
|
7
|
+
private maxVisible;
|
|
8
|
+
subscribe(listener: ToastSubscriber): () => void;
|
|
9
|
+
private notify;
|
|
10
|
+
getToasts(): ToastItem[];
|
|
11
|
+
setMaxVisible(max: number): void;
|
|
12
|
+
addToast(options: ToastOptions): string;
|
|
13
|
+
dismiss(id?: string): void;
|
|
14
|
+
}
|
|
15
|
+
export declare const toastStore: ToastStore;
|
|
16
|
+
export interface ToastFunction {
|
|
17
|
+
(options: ToastOptions): string;
|
|
18
|
+
error: (title: React.ReactNode, description?: React.ReactNode, options?: Partial<ToastOptions>) => string;
|
|
19
|
+
success: (title: React.ReactNode, description?: React.ReactNode, options?: Partial<ToastOptions>) => string;
|
|
20
|
+
warning: (title: React.ReactNode, description?: React.ReactNode, options?: Partial<ToastOptions>) => string;
|
|
21
|
+
info: (title: React.ReactNode, description?: React.ReactNode, options?: Partial<ToastOptions>) => string;
|
|
22
|
+
dismiss: (id?: string) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const toast: ToastFunction;
|
|
25
|
+
export declare function useToast(): {
|
|
26
|
+
toast: ToastFunction;
|
|
27
|
+
dismiss: (id?: string) => void;
|
|
28
|
+
toasts: ToastItem[];
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=toastStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toastStore.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/toastStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7D,KAAK,eAAe,GAAG,MAAM,IAAI,CAAC;AAElC,cAAM,UAAU;IACd,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,UAAU,CAAa;IAE/B,SAAS,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,IAAI;IAOhD,OAAO,CAAC,MAAM;IAId,SAAS,IAAI,SAAS,EAAE;IAIxB,aAAa,CAAC,GAAG,EAAE,MAAM;IAIzB,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM;IAuBvC,OAAO,CAAC,EAAE,CAAC,EAAE,MAAM;CAkBpB;AAED,eAAO,MAAM,UAAU,YAAmB,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC5B,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAAC;IAChC,KAAK,EAAE,CACL,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,EAC7B,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,KAC5B,MAAM,CAAC;IACZ,OAAO,EAAE,CACP,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,EAC7B,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,KAC5B,MAAM,CAAC;IACZ,OAAO,EAAE,CACP,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,EAC7B,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,KAC5B,MAAM,CAAC;IACZ,IAAI,EAAE,CACJ,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,EAC7B,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,KAC5B,MAAM,CAAC;IACZ,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,KAAK,EAAE,aAiDnB,CAAC;AAEF,wBAAgB,QAAQ;;mBAWa,MAAM;;EAG1C"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
class ToastStore {
|
|
5
|
+
toasts = [];
|
|
6
|
+
listeners = /* @__PURE__ */ new Set();
|
|
7
|
+
maxVisible = 5;
|
|
8
|
+
subscribe(listener) {
|
|
9
|
+
this.listeners.add(listener);
|
|
10
|
+
return () => {
|
|
11
|
+
this.listeners.delete(listener);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
notify() {
|
|
15
|
+
this.listeners.forEach((listener) => listener());
|
|
16
|
+
}
|
|
17
|
+
getToasts() {
|
|
18
|
+
return this.toasts;
|
|
19
|
+
}
|
|
20
|
+
setMaxVisible(max) {
|
|
21
|
+
this.maxVisible = max;
|
|
22
|
+
}
|
|
23
|
+
addToast(options) {
|
|
24
|
+
const id = options.id || Math.random().toString(36).substring(2, 9);
|
|
25
|
+
const existingIndex = this.toasts.findIndex((t) => t.id === id);
|
|
26
|
+
const newToast = {
|
|
27
|
+
...options,
|
|
28
|
+
id,
|
|
29
|
+
open: true
|
|
30
|
+
};
|
|
31
|
+
if (existingIndex !== -1) {
|
|
32
|
+
this.toasts[existingIndex] = newToast;
|
|
33
|
+
} else {
|
|
34
|
+
this.toasts = [...this.toasts, newToast];
|
|
35
|
+
if (this.toasts.length > this.maxVisible) {
|
|
36
|
+
this.toasts = this.toasts.slice(-this.maxVisible);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
this.notify();
|
|
40
|
+
return id;
|
|
41
|
+
}
|
|
42
|
+
dismiss(id) {
|
|
43
|
+
if (!id) {
|
|
44
|
+
this.toasts = this.toasts.map((t) => ({ ...t, open: false }));
|
|
45
|
+
} else {
|
|
46
|
+
this.toasts = this.toasts.map((t) => t.id === id ? { ...t, open: false } : t);
|
|
47
|
+
}
|
|
48
|
+
this.notify();
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
if (!id) {
|
|
51
|
+
this.toasts = [];
|
|
52
|
+
} else {
|
|
53
|
+
this.toasts = this.toasts.filter((t) => t.id !== id);
|
|
54
|
+
}
|
|
55
|
+
this.notify();
|
|
56
|
+
}, 350);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const toastStore = new ToastStore();
|
|
60
|
+
const toast = Object.assign(
|
|
61
|
+
(options) => toastStore.addToast(options),
|
|
62
|
+
{
|
|
63
|
+
error: (title, description, options) => toastStore.addToast({
|
|
64
|
+
...options,
|
|
65
|
+
title,
|
|
66
|
+
description,
|
|
67
|
+
variant: "destructive"
|
|
68
|
+
}),
|
|
69
|
+
success: (title, description, options) => toastStore.addToast({
|
|
70
|
+
...options,
|
|
71
|
+
title,
|
|
72
|
+
description,
|
|
73
|
+
variant: "success"
|
|
74
|
+
}),
|
|
75
|
+
warning: (title, description, options) => toastStore.addToast({
|
|
76
|
+
...options,
|
|
77
|
+
title,
|
|
78
|
+
description,
|
|
79
|
+
variant: "warning"
|
|
80
|
+
}),
|
|
81
|
+
info: (title, description, options) => toastStore.addToast({
|
|
82
|
+
...options,
|
|
83
|
+
title,
|
|
84
|
+
description,
|
|
85
|
+
variant: "info"
|
|
86
|
+
}),
|
|
87
|
+
dismiss: (id) => toastStore.dismiss(id)
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
function useToast() {
|
|
91
|
+
const [toasts, setToasts] = React.useState(() => toastStore.getToasts());
|
|
92
|
+
React.useEffect(() => {
|
|
93
|
+
return toastStore.subscribe(() => {
|
|
94
|
+
setToasts([...toastStore.getToasts()]);
|
|
95
|
+
});
|
|
96
|
+
}, []);
|
|
97
|
+
return {
|
|
98
|
+
toast,
|
|
99
|
+
dismiss: React.useCallback((id) => toastStore.dismiss(id), []),
|
|
100
|
+
toasts
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { toast, toastStore, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,9 @@ export * from './components/Popover';
|
|
|
21
21
|
export * from './components/Toast';
|
|
22
22
|
export * from './components/Tooltip';
|
|
23
23
|
export * from './components/Tabs';
|
|
24
|
+
export * from './components/SideBarNavigation';
|
|
24
25
|
export * from './components/Button';
|
|
26
|
+
export * from './components/LinkButton';
|
|
25
27
|
export * from './components/Accordion';
|
|
26
28
|
export * from './components/Avatar';
|
|
27
29
|
export * from './components/Badge';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAG/B,cAAc,aAAa,CAAC;AAG5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CA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BAAmB,CAAC;AAGlC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { Center } from './components/Center/Center.js';
|
|
|
10
10
|
export { Checkbox } from './components/Checkbox/Checkbox.js';
|
|
11
11
|
export { Chip } from './components/Chip/Chip.js';
|
|
12
12
|
export { Container } from './components/Container/Container.js';
|
|
13
|
+
export { DEFAULT_STORAGE_KEY, isNavItemActive, isRouteActive, readStoredCollapsed, writeStoredCollapsed } from './components/SideBarNavigation/SideBarNavigation.helpers.js';
|
|
13
14
|
export { DataList, DataListItem, DataListLabel, DataListValue } from './components/DataList/DataList.js';
|
|
14
15
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './components/Dialog/Dialog.js';
|
|
15
16
|
export { Divider } from './components/Divider/Divider.js';
|
|
@@ -23,6 +24,7 @@ export { Icon } from './components/Icon/Icon.js';
|
|
|
23
24
|
export { Inline } from './components/Inline/Inline.js';
|
|
24
25
|
export { Input } from './components/Input/Input.js';
|
|
25
26
|
export { Label } from './components/Label/Label.js';
|
|
27
|
+
export { LinkButton } from './components/LinkButton/LinkButton.js';
|
|
26
28
|
export { List, ListItem, ListItemAction, ListItemIcon, ListItemText } from './components/List/List.js';
|
|
27
29
|
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from './components/Pagination/Pagination.js';
|
|
28
30
|
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger } from './components/Popover/Popover.js';
|
|
@@ -30,6 +32,15 @@ export { Progress } from './components/Progress/Progress.js';
|
|
|
30
32
|
export { Radio, RadioGroup, RadioItem } from './components/Radio/Radio.js';
|
|
31
33
|
export { RangeSlider } from './components/RangeSlider/RangeSlider.js';
|
|
32
34
|
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectRoot, SelectSeparator, SelectTrigger, SelectValue } from './components/Select/Select.js';
|
|
35
|
+
export { SideBarNavigation } from './components/SideBarNavigation/SideBarNavigation.js';
|
|
36
|
+
export { SidebarBranding } from './components/SideBarNavigation/subcomponents/SidebarBranding.js';
|
|
37
|
+
export { SidebarContext, useSidebarContext } from './components/SideBarNavigation/SideBarNavigation.context.js';
|
|
38
|
+
export { SidebarFooter } from './components/SideBarNavigation/subcomponents/SidebarFooter.js';
|
|
39
|
+
export { SidebarNavItem } from './components/SideBarNavigation/subcomponents/SidebarNavItem.js';
|
|
40
|
+
export { SidebarPopoverMenu } from './components/SideBarNavigation/subcomponents/SidebarPopoverMenu.js';
|
|
41
|
+
export { SidebarProfile } from './components/SideBarNavigation/subcomponents/SidebarProfile.js';
|
|
42
|
+
export { SidebarSubItem } from './components/SideBarNavigation/subcomponents/SidebarSubItem.js';
|
|
43
|
+
export { SidebarToggle } from './components/SideBarNavigation/subcomponents/SidebarToggle.js';
|
|
33
44
|
export { Skeleton } from './components/Skeleton/Skeleton.js';
|
|
34
45
|
export { Spinner } from './components/Spinner/Spinner.js';
|
|
35
46
|
export { Stack } from './components/Stack/Stack.js';
|
|
@@ -40,8 +51,9 @@ export { TablePagination } from './components/Table/TablePagination.js';
|
|
|
40
51
|
export { Tabs, TabsContent, TabsList, TabsTrigger } from './components/Tabs/Tabs.js';
|
|
41
52
|
export { Text } from './components/Text/Text.js';
|
|
42
53
|
export { Textarea } from './components/Textarea/Textarea.js';
|
|
43
|
-
export { TimmbrConfigProvider, defaultTimmbrConfig, useTimmbrConfig } from './providers/TimmbrConfigProvider.js';
|
|
54
|
+
export { TimmbrConfigProvider, defaultTimmbrConfig, resolveZoneHref, useTimmbrConfig } from './providers/TimmbrConfigProvider.js';
|
|
44
55
|
export { Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport } from './components/Toast/Toast.js';
|
|
56
|
+
export { ToastContainer } from './components/Toast/ToastContainer.js';
|
|
45
57
|
export { Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger } from './components/Tooltip/Tooltip.js';
|
|
46
58
|
export { accordionContentVariants, accordionItemVariants, accordionTriggerVariants } from './components/Accordion/Accordion.styles.js';
|
|
47
59
|
export { alertIconVariants, alertVariants } from './components/Alert/Alert.styles.js';
|
|
@@ -66,7 +78,9 @@ export { iconVariants } from './components/Icon/Icon.styles.js';
|
|
|
66
78
|
export { inlineVariants } from './components/Inline/Inline.styles.js';
|
|
67
79
|
export { inputFieldVariants, inputWrapperVariants } from './components/Input/Input.styles.js';
|
|
68
80
|
export { labelVariants } from './components/Label/Label.styles.js';
|
|
81
|
+
export { linkButtonVariants } from './components/LinkButton/LinkButton.styles.js';
|
|
69
82
|
export { listItemActionVariants, listItemIconVariants, listItemTextVariants, listItemVariants, listVariants } from './components/List/List.styles.js';
|
|
83
|
+
export { navBadgeVariants, navItemVariants, sidebarContainerVariants, sidebarToggleVariants, subItemVariants } from './components/SideBarNavigation/SideBarNavigation.styles.js';
|
|
70
84
|
export { paginationLinkVariants } from './components/Pagination/Pagination.styles.js';
|
|
71
85
|
export { popoverContentVariants } from './components/Popover/Popover.styles.js';
|
|
72
86
|
export { progressIndicatorVariants, progressRootVariants } from './components/Progress/Progress.styles.js';
|
|
@@ -82,5 +96,6 @@ export { tableCellVariants, tableContainerVariants, tableFooterVariants, tableHe
|
|
|
82
96
|
export { tabsContentVariants, tabsListVariants, tabsTriggerVariants } from './components/Tabs/Tabs.styles.js';
|
|
83
97
|
export { textVariants } from './components/Text/Text.styles.js';
|
|
84
98
|
export { textareaVariants } from './components/Textarea/Textarea.styles.js';
|
|
99
|
+
export { toast, toastStore, useToast } from './components/Toast/toastStore.js';
|
|
85
100
|
export { toastVariants } from './components/Toast/Toast.styles.js';
|
|
86
101
|
export { tooltipContentVariants } from './components/Tooltip/Tooltip.styles.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { ToastGlobalConfig } from '../components/Toast/Toast.types';
|
|
2
3
|
export interface ComponentConfig {
|
|
3
4
|
button?: {
|
|
4
5
|
defaultVariant?: 'default' | 'outline' | 'ghost';
|
|
@@ -11,6 +12,17 @@ export interface ComponentConfig {
|
|
|
11
12
|
defaultSize?: number;
|
|
12
13
|
};
|
|
13
14
|
}
|
|
15
|
+
export interface ZoneConfig {
|
|
16
|
+
/**
|
|
17
|
+
* Current active Next.js zone identifier (e.g. 'main', 'app', 'docs', 'store').
|
|
18
|
+
*/
|
|
19
|
+
currentZone?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Map of zone identifiers to base URLs or path prefixes.
|
|
22
|
+
* Example: { docs: 'https://docs.timmbr.com', app: '/app', store: 'https://store.timmbr.com' }
|
|
23
|
+
*/
|
|
24
|
+
zones?: Record<string, string>;
|
|
25
|
+
}
|
|
14
26
|
export interface TimmbrConfig {
|
|
15
27
|
animations?: {
|
|
16
28
|
enabled?: boolean;
|
|
@@ -18,8 +30,14 @@ export interface TimmbrConfig {
|
|
|
18
30
|
theme?: {
|
|
19
31
|
mode?: 'light' | 'dark' | 'system';
|
|
20
32
|
};
|
|
33
|
+
zones?: ZoneConfig;
|
|
21
34
|
components?: ComponentConfig;
|
|
35
|
+
toast?: ToastGlobalConfig;
|
|
22
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolves target href with optional zone key and zone dictionary.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveZoneHref(href: string, zone?: string, zones?: Record<string, string>): string;
|
|
23
41
|
export declare const defaultTimmbrConfig: Required<TimmbrConfig>;
|
|
24
42
|
export interface TimmbrConfigProviderProps {
|
|
25
43
|
children: React.ReactNode;
|
|
@@ -27,8 +45,8 @@ export interface TimmbrConfigProviderProps {
|
|
|
27
45
|
}
|
|
28
46
|
/**
|
|
29
47
|
* Global configuration provider for the Timmbr Design System.
|
|
30
|
-
* Supports customizing animation behavior, default component variants/sizes, and
|
|
31
|
-
*
|
|
48
|
+
* Supports customizing animation behavior, default component variants/sizes, themes, and global toast defaults.
|
|
49
|
+
* Automatically initializes and renders the centralized Toast system.
|
|
32
50
|
*/
|
|
33
51
|
export declare const TimmbrConfigProvider: React.FC<TimmbrConfigProviderProps>;
|
|
34
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimmbrConfigProvider.d.ts","sourceRoot":"","sources":["../../src/providers/TimmbrConfigProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TimmbrConfigProvider.d.ts","sourceRoot":"","sources":["../../src/providers/TimmbrConfigProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAIzE,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE;QACP,cAAc,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;QACjD,WAAW,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;KAChD,CAAC;IACF,SAAS,CAAC,EAAE;QACV,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,IAAI,CAAC,EAAE;QACL,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM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