@zentauri-ui/zentauri-components 0.0.84 → 0.0.92
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 +47 -29
- package/dist/chunk-BZSIXBA7.js +70 -0
- package/dist/chunk-BZSIXBA7.js.map +1 -0
- package/dist/chunk-E5UX537J.js +11 -0
- package/dist/chunk-E5UX537J.js.map +1 -0
- package/dist/chunk-MEWYFWBX.mjs +14 -0
- package/dist/chunk-MEWYFWBX.mjs.map +1 -0
- package/dist/chunk-VJHD7QZH.mjs +73 -0
- package/dist/chunk-VJHD7QZH.mjs.map +1 -0
- package/dist/ui/accordion.d.mts +70 -0
- package/dist/ui/accordion.d.ts +70 -0
- package/dist/ui/accordion.js +280 -0
- package/dist/ui/accordion.js.map +1 -0
- package/dist/ui/accordion.mjs +282 -0
- package/dist/ui/accordion.mjs.map +1 -0
- package/dist/ui/alert.d.mts +66 -0
- package/dist/ui/alert.d.ts +66 -0
- package/dist/ui/alert.js +218 -0
- package/dist/ui/alert.js.map +1 -0
- package/dist/ui/alert.mjs +220 -0
- package/dist/ui/alert.mjs.map +1 -0
- package/dist/ui/badge.d.mts +37 -0
- package/dist/ui/badge.d.ts +37 -0
- package/dist/ui/badge.js +159 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/badge.mjs +161 -0
- package/dist/ui/badge.mjs.map +1 -0
- package/dist/ui/buttons.d.mts +27 -0
- package/dist/ui/buttons.d.ts +27 -0
- package/dist/ui/buttons.js +107 -0
- package/dist/ui/buttons.js.map +1 -0
- package/dist/ui/buttons.mjs +109 -0
- package/dist/ui/buttons.mjs.map +1 -0
- package/dist/ui/card.d.mts +77 -0
- package/dist/ui/card.d.ts +77 -0
- package/dist/ui/card.js +252 -0
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/card.mjs +254 -0
- package/dist/ui/card.mjs.map +1 -0
- package/dist/ui/divider.d.mts +39 -0
- package/dist/ui/divider.d.ts +39 -0
- package/dist/ui/divider.js +194 -0
- package/dist/ui/divider.js.map +1 -0
- package/dist/ui/divider.mjs +196 -0
- package/dist/ui/divider.mjs.map +1 -0
- package/dist/ui/drawer.d.mts +81 -0
- package/dist/ui/drawer.d.ts +81 -0
- package/dist/ui/drawer.js +377 -0
- package/dist/ui/drawer.js.map +1 -0
- package/dist/ui/drawer.mjs +379 -0
- package/dist/ui/drawer.mjs.map +1 -0
- package/dist/ui/dropdown.d.mts +50 -0
- package/dist/ui/dropdown.d.ts +50 -0
- package/dist/ui/dropdown.js +272 -0
- package/dist/ui/dropdown.js.map +1 -0
- package/dist/ui/dropdown.mjs +274 -0
- package/dist/ui/dropdown.mjs.map +1 -0
- package/dist/ui/empty-state.d.mts +55 -0
- package/dist/ui/empty-state.d.ts +55 -0
- package/dist/ui/empty-state.js +148 -0
- package/dist/ui/empty-state.js.map +1 -0
- package/dist/ui/empty-state.mjs +150 -0
- package/dist/ui/empty-state.mjs.map +1 -0
- package/dist/ui/inputs.d.mts +35 -0
- package/dist/ui/inputs.d.ts +35 -0
- package/dist/ui/inputs.js +426 -0
- package/dist/ui/inputs.js.map +1 -0
- package/dist/ui/inputs.mjs +428 -0
- package/dist/ui/inputs.mjs.map +1 -0
- package/dist/ui/modal.d.mts +84 -0
- package/dist/ui/modal.d.ts +84 -0
- package/dist/ui/modal.js +378 -0
- package/dist/ui/modal.js.map +1 -0
- package/dist/ui/modal.mjs +380 -0
- package/dist/ui/modal.mjs.map +1 -0
- package/dist/ui/pagination.d.mts +114 -0
- package/dist/ui/pagination.d.ts +114 -0
- package/dist/ui/pagination.js +425 -0
- package/dist/ui/pagination.js.map +1 -0
- package/dist/ui/pagination.mjs +427 -0
- package/dist/ui/pagination.mjs.map +1 -0
- package/dist/ui/progress.d.mts +61 -0
- package/dist/ui/progress.d.ts +61 -0
- package/dist/ui/progress.js +231 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/progress.mjs +233 -0
- package/dist/ui/progress.mjs.map +1 -0
- package/dist/ui/select.d.mts +73 -0
- package/dist/ui/select.d.ts +73 -0
- package/dist/ui/select.js +321 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/select.mjs +323 -0
- package/dist/ui/select.mjs.map +1 -0
- package/dist/ui/skeleton.d.mts +90 -0
- package/dist/ui/skeleton.d.ts +90 -0
- package/dist/ui/skeleton.js +538 -0
- package/dist/ui/skeleton.js.map +1 -0
- package/dist/ui/skeleton.mjs +540 -0
- package/dist/ui/skeleton.mjs.map +1 -0
- package/dist/ui/spinner.d.mts +27 -0
- package/dist/ui/spinner.d.ts +27 -0
- package/dist/ui/spinner.js +187 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/spinner.mjs +189 -0
- package/dist/ui/spinner.mjs.map +1 -0
- package/dist/ui/table.d.mts +81 -0
- package/dist/ui/table.d.ts +81 -0
- package/dist/ui/table.js +287 -0
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/table.mjs +289 -0
- package/dist/ui/table.mjs.map +1 -0
- package/dist/ui/tabs.d.mts +58 -0
- package/dist/ui/tabs.d.ts +58 -0
- package/dist/ui/tabs.js +268 -0
- package/dist/ui/tabs.js.map +1 -0
- package/dist/ui/tabs.mjs +270 -0
- package/dist/ui/tabs.mjs.map +1 -0
- package/dist/ui/toast.d.mts +86 -0
- package/dist/ui/toast.d.ts +86 -0
- package/dist/ui/toast.js +252 -0
- package/dist/ui/toast.js.map +1 -0
- package/dist/ui/toast.mjs +254 -0
- package/dist/ui/toast.mjs.map +1 -0
- package/dist/ui/toggle.d.mts +37 -0
- package/dist/ui/toggle.d.ts +37 -0
- package/dist/ui/toggle.js +152 -0
- package/dist/ui/toggle.js.map +1 -0
- package/dist/ui/toggle.mjs +154 -0
- package/dist/ui/toggle.mjs.map +1 -0
- package/dist/ui/tooltip.d.mts +46 -0
- package/dist/ui/tooltip.d.ts +46 -0
- package/dist/ui/tooltip.js +208 -0
- package/dist/ui/tooltip.js.map +1 -0
- package/dist/ui/tooltip.mjs +210 -0
- package/dist/ui/tooltip.mjs.map +1 -0
- package/dist/variants-Dd9pe-ov.d.mts +8 -0
- package/dist/variants-Dd9pe-ov.d.ts +8 -0
- package/package.json +15 -14
- package/dist/ui/index.cjs +0 -5764
- package/dist/ui/index.cjs.map +0 -1
- package/dist/ui/index.d.cts +0 -1164
- package/dist/ui/index.d.ts +0 -1164
- package/dist/ui/index.js +0 -5626
- package/dist/ui/index.js.map +0 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { HTMLMotionProps } from 'framer-motion';
|
|
6
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
|
+
|
|
8
|
+
type ToastAnimation = "none" | "slide" | "fade";
|
|
9
|
+
type ToastPresetMotionProps = Pick<HTMLMotionProps<"div">, "initial" | "animate" | "exit" | "transition">;
|
|
10
|
+
type ToastAnimationPresets = Record<ToastAnimation, ToastPresetMotionProps>;
|
|
11
|
+
declare const toastAnimationPresets: ToastAnimationPresets;
|
|
12
|
+
|
|
13
|
+
declare const toastViewportVariants: (props?: ({
|
|
14
|
+
position?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | null | undefined;
|
|
15
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
16
|
+
declare const toastRootVariants: (props?: ({
|
|
17
|
+
appearance?: "default" | "success" | "warning" | "error" | "info" | "ghost" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "emerald" | "gray" | "amber" | "violet" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | null | undefined;
|
|
18
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
19
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
20
|
+
|
|
21
|
+
type ToastViewportVariantProps = VariantProps<typeof toastViewportVariants>;
|
|
22
|
+
type ToastRootVariantProps = VariantProps<typeof toastRootVariants>;
|
|
23
|
+
type ToastPosition = NonNullable<ToastViewportVariantProps["position"]>;
|
|
24
|
+
type ToastInput = ToastRootVariantProps & {
|
|
25
|
+
id?: string;
|
|
26
|
+
title?: ReactNode;
|
|
27
|
+
description?: ReactNode;
|
|
28
|
+
durationMs?: number;
|
|
29
|
+
animation?: ToastAnimation;
|
|
30
|
+
};
|
|
31
|
+
type ToastContextValue = {
|
|
32
|
+
toast: (input: ToastInput) => string;
|
|
33
|
+
dismiss: (id: string) => void;
|
|
34
|
+
};
|
|
35
|
+
type ToastProviderProps = {
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
};
|
|
38
|
+
type ToastViewportProps = ToastViewportVariantProps & {
|
|
39
|
+
className?: string;
|
|
40
|
+
};
|
|
41
|
+
type ToastProps = ToastRootVariantProps & {
|
|
42
|
+
toastId: string;
|
|
43
|
+
animation?: ToastAnimation;
|
|
44
|
+
className?: string;
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
};
|
|
47
|
+
type ToastSectionProps = {
|
|
48
|
+
className?: string;
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
onClick?: () => void;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
declare function toast(input: ToastInput): string;
|
|
54
|
+
declare function useToast(): ToastContextValue;
|
|
55
|
+
declare function ToastProvider({ children }: ToastProviderProps): react_jsx_runtime.JSX.Element;
|
|
56
|
+
declare namespace ToastProvider {
|
|
57
|
+
var displayName: string;
|
|
58
|
+
}
|
|
59
|
+
declare function ToastViewport({ position, className }: ToastViewportProps): react.ReactPortal | null;
|
|
60
|
+
declare namespace ToastViewport {
|
|
61
|
+
var displayName: string;
|
|
62
|
+
}
|
|
63
|
+
declare function Toast({ toastId: _toastId, appearance, size, animation, className, children }: ToastProps): react_jsx_runtime.JSX.Element;
|
|
64
|
+
declare namespace Toast {
|
|
65
|
+
var displayName: string;
|
|
66
|
+
}
|
|
67
|
+
declare function ToastTitle({ className, children }: ToastSectionProps): react_jsx_runtime.JSX.Element;
|
|
68
|
+
declare namespace ToastTitle {
|
|
69
|
+
var displayName: string;
|
|
70
|
+
}
|
|
71
|
+
declare function ToastDescription({ className, children }: ToastSectionProps): react_jsx_runtime.JSX.Element;
|
|
72
|
+
declare namespace ToastDescription {
|
|
73
|
+
var displayName: string;
|
|
74
|
+
}
|
|
75
|
+
declare function ToastAction({ className, children }: ToastSectionProps): react_jsx_runtime.JSX.Element;
|
|
76
|
+
declare namespace ToastAction {
|
|
77
|
+
var displayName: string;
|
|
78
|
+
}
|
|
79
|
+
declare function ToastClose({ className, children, onClick, ...rest }: ToastSectionProps & {
|
|
80
|
+
onClick?: () => void;
|
|
81
|
+
}): react_jsx_runtime.JSX.Element;
|
|
82
|
+
declare namespace ToastClose {
|
|
83
|
+
var displayName: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { Toast, ToastAction, type ToastAnimation, ToastClose, type ToastContextValue, ToastDescription, type ToastInput, type ToastPosition, type ToastProps, ToastProvider, type ToastProviderProps, type ToastSectionProps, ToastTitle, ToastViewport, type ToastViewportProps, toast, toastAnimationPresets, toastRootVariants, toastViewportVariants, useToast };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { HTMLMotionProps } from 'framer-motion';
|
|
6
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
|
+
|
|
8
|
+
type ToastAnimation = "none" | "slide" | "fade";
|
|
9
|
+
type ToastPresetMotionProps = Pick<HTMLMotionProps<"div">, "initial" | "animate" | "exit" | "transition">;
|
|
10
|
+
type ToastAnimationPresets = Record<ToastAnimation, ToastPresetMotionProps>;
|
|
11
|
+
declare const toastAnimationPresets: ToastAnimationPresets;
|
|
12
|
+
|
|
13
|
+
declare const toastViewportVariants: (props?: ({
|
|
14
|
+
position?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | null | undefined;
|
|
15
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
16
|
+
declare const toastRootVariants: (props?: ({
|
|
17
|
+
appearance?: "default" | "success" | "warning" | "error" | "info" | "ghost" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "emerald" | "gray" | "amber" | "violet" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | null | undefined;
|
|
18
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
19
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
20
|
+
|
|
21
|
+
type ToastViewportVariantProps = VariantProps<typeof toastViewportVariants>;
|
|
22
|
+
type ToastRootVariantProps = VariantProps<typeof toastRootVariants>;
|
|
23
|
+
type ToastPosition = NonNullable<ToastViewportVariantProps["position"]>;
|
|
24
|
+
type ToastInput = ToastRootVariantProps & {
|
|
25
|
+
id?: string;
|
|
26
|
+
title?: ReactNode;
|
|
27
|
+
description?: ReactNode;
|
|
28
|
+
durationMs?: number;
|
|
29
|
+
animation?: ToastAnimation;
|
|
30
|
+
};
|
|
31
|
+
type ToastContextValue = {
|
|
32
|
+
toast: (input: ToastInput) => string;
|
|
33
|
+
dismiss: (id: string) => void;
|
|
34
|
+
};
|
|
35
|
+
type ToastProviderProps = {
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
};
|
|
38
|
+
type ToastViewportProps = ToastViewportVariantProps & {
|
|
39
|
+
className?: string;
|
|
40
|
+
};
|
|
41
|
+
type ToastProps = ToastRootVariantProps & {
|
|
42
|
+
toastId: string;
|
|
43
|
+
animation?: ToastAnimation;
|
|
44
|
+
className?: string;
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
};
|
|
47
|
+
type ToastSectionProps = {
|
|
48
|
+
className?: string;
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
onClick?: () => void;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
declare function toast(input: ToastInput): string;
|
|
54
|
+
declare function useToast(): ToastContextValue;
|
|
55
|
+
declare function ToastProvider({ children }: ToastProviderProps): react_jsx_runtime.JSX.Element;
|
|
56
|
+
declare namespace ToastProvider {
|
|
57
|
+
var displayName: string;
|
|
58
|
+
}
|
|
59
|
+
declare function ToastViewport({ position, className }: ToastViewportProps): react.ReactPortal | null;
|
|
60
|
+
declare namespace ToastViewport {
|
|
61
|
+
var displayName: string;
|
|
62
|
+
}
|
|
63
|
+
declare function Toast({ toastId: _toastId, appearance, size, animation, className, children }: ToastProps): react_jsx_runtime.JSX.Element;
|
|
64
|
+
declare namespace Toast {
|
|
65
|
+
var displayName: string;
|
|
66
|
+
}
|
|
67
|
+
declare function ToastTitle({ className, children }: ToastSectionProps): react_jsx_runtime.JSX.Element;
|
|
68
|
+
declare namespace ToastTitle {
|
|
69
|
+
var displayName: string;
|
|
70
|
+
}
|
|
71
|
+
declare function ToastDescription({ className, children }: ToastSectionProps): react_jsx_runtime.JSX.Element;
|
|
72
|
+
declare namespace ToastDescription {
|
|
73
|
+
var displayName: string;
|
|
74
|
+
}
|
|
75
|
+
declare function ToastAction({ className, children }: ToastSectionProps): react_jsx_runtime.JSX.Element;
|
|
76
|
+
declare namespace ToastAction {
|
|
77
|
+
var displayName: string;
|
|
78
|
+
}
|
|
79
|
+
declare function ToastClose({ className, children, onClick, ...rest }: ToastSectionProps & {
|
|
80
|
+
onClick?: () => void;
|
|
81
|
+
}): react_jsx_runtime.JSX.Element;
|
|
82
|
+
declare namespace ToastClose {
|
|
83
|
+
var displayName: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { Toast, ToastAction, type ToastAnimation, ToastClose, type ToastContextValue, ToastDescription, type ToastInput, type ToastPosition, type ToastProps, ToastProvider, type ToastProviderProps, type ToastSectionProps, ToastTitle, ToastViewport, type ToastViewportProps, toast, toastAnimationPresets, toastRootVariants, toastViewportVariants, useToast };
|
package/dist/ui/toast.js
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkE5UX537Jjs = require('../chunk-E5UX537J.js');
|
|
4
|
+
|
|
5
|
+
// src/ui/toast/toast.tsx
|
|
6
|
+
var _framermotion = require('framer-motion');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _react = require('react');
|
|
16
|
+
var _reactdom = require('react-dom');
|
|
17
|
+
|
|
18
|
+
// src/ui/toast/animations.ts
|
|
19
|
+
var toastAnimationPresets = {
|
|
20
|
+
none: {},
|
|
21
|
+
slide: {
|
|
22
|
+
initial: { opacity: 0, x: 24 },
|
|
23
|
+
animate: { opacity: 1, x: 0 },
|
|
24
|
+
exit: { opacity: 0, x: 16 },
|
|
25
|
+
transition: { type: "spring", stiffness: 380, damping: 28 }
|
|
26
|
+
},
|
|
27
|
+
fade: {
|
|
28
|
+
initial: { opacity: 0 },
|
|
29
|
+
animate: { opacity: 1 },
|
|
30
|
+
exit: { opacity: 0 },
|
|
31
|
+
transition: { duration: 0.18 }
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// src/ui/toast/variants.ts
|
|
36
|
+
var _classvarianceauthority = require('class-variance-authority');
|
|
37
|
+
var toastViewportVariants = _classvarianceauthority.cva.call(void 0, "fixed z-[60] flex max-h-screen flex-col gap-2 p-4", {
|
|
38
|
+
variants: {
|
|
39
|
+
position: {
|
|
40
|
+
"top-left": "left-0 top-0 items-start",
|
|
41
|
+
"top-center": "left-1/2 top-0 -translate-x-1/2 items-center",
|
|
42
|
+
"top-right": "right-0 top-0 items-end",
|
|
43
|
+
"bottom-left": "bottom-0 left-0 items-start",
|
|
44
|
+
"bottom-center": "bottom-0 left-1/2 -translate-x-1/2 items-center",
|
|
45
|
+
"bottom-right": "bottom-0 right-0 items-end"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
position: "bottom-right"
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
var toastRootVariants = _classvarianceauthority.cva.call(void 0,
|
|
53
|
+
"pointer-events-auto w-[min(100vw-2rem,380px)] rounded-xl border border-white/10 bg-slate-950 p-4 text-slate-50 shadow-[0_18px_48px_rgba(15,23,42,0.45)]",
|
|
54
|
+
{
|
|
55
|
+
variants: {
|
|
56
|
+
appearance: {
|
|
57
|
+
default: "bg-slate-950",
|
|
58
|
+
success: "border-emerald-500/40 bg-emerald-950",
|
|
59
|
+
warning: "border-amber-500/40 bg-amber-950",
|
|
60
|
+
error: "border-rose-500/50 bg-rose-950",
|
|
61
|
+
info: "border-sky-500/40 bg-sky-950",
|
|
62
|
+
ghost: "border-transparent bg-transparent text-slate-200",
|
|
63
|
+
purple: "border-purple-600 bg-purple-950/70 backdrop-blur-xl",
|
|
64
|
+
pink: "border-pink-600 bg-pink-950/70 backdrop-blur-xl",
|
|
65
|
+
orange: "border-orange-600 bg-orange-950/70 backdrop-blur-xl",
|
|
66
|
+
yellow: "border-yellow-600 bg-yellow-950/70 backdrop-blur-xl",
|
|
67
|
+
teal: "border-teal-600 bg-teal-950/70 backdrop-blur-xl",
|
|
68
|
+
indigo: "border-indigo-600 bg-indigo-950/70 backdrop-blur-xl",
|
|
69
|
+
emerald: "border-emerald-600 bg-emerald-950/70 backdrop-blur-xl",
|
|
70
|
+
gray: "border-gray-600 bg-gray-950/70 backdrop-blur-xl",
|
|
71
|
+
amber: "border-amber-600 bg-amber-950/70 backdrop-blur-xl",
|
|
72
|
+
violet: "border-violet-600 bg-violet-950/70 backdrop-blur-xl",
|
|
73
|
+
"gradient-blue": "border-gradient-to-r from-blue-600 to-purple-600 bg-gradient-to-r from-blue-950/70 to-purple-950/70 backdrop-blur-xl",
|
|
74
|
+
"gradient-green": "border-gradient-to-r from-green-600 to-lime-600 bg-gradient-to-r from-green-950/70 to-lime-950/70 backdrop-blur-xl",
|
|
75
|
+
"gradient-red": "border-gradient-to-r from-red-600 to-pink-600 bg-gradient-to-r from-red-950/70 to-pink-950/70 backdrop-blur-xl",
|
|
76
|
+
"gradient-yellow": "border-gradient-to-r from-yellow-600 to-orange-600 bg-gradient-to-r from-yellow-950/70 to-orange-950/70 backdrop-blur-xl",
|
|
77
|
+
"gradient-purple": "border-gradient-to-r from-purple-600 to-pink-600 bg-gradient-to-r from-purple-950/70 to-pink-950/70 backdrop-blur-xl",
|
|
78
|
+
"gradient-teal": "border-gradient-to-r from-teal-600 to-cyan-600 bg-gradient-to-r from-teal-950/70 to-cyan-950/70 backdrop-blur-xl",
|
|
79
|
+
"gradient-indigo": "border-gradient-to-r from-indigo-600 to-purple-600 bg-gradient-to-r from-indigo-950/70 to-purple-950/70 backdrop-blur-xl",
|
|
80
|
+
"gradient-pink": "border-gradient-to-r from-pink-600 to-rose-600 bg-gradient-to-r from-pink-950/70 to-rose-950/70 backdrop-blur-xl",
|
|
81
|
+
"gradient-orange": "border-gradient-to-r from-orange-600 to-red-600 bg-gradient-to-r from-orange-950/70 to-red-950/70 backdrop-blur-xl"
|
|
82
|
+
},
|
|
83
|
+
size: {
|
|
84
|
+
sm: "p-3 text-xs",
|
|
85
|
+
md: "p-4 text-sm",
|
|
86
|
+
lg: "p-5 text-base"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
defaultVariants: {
|
|
90
|
+
appearance: "default",
|
|
91
|
+
size: "md"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// src/ui/toast/toast.tsx
|
|
97
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
98
|
+
var ToastStoreContext = _react.createContext.call(void 0, null);
|
|
99
|
+
var toastDispatcher = null;
|
|
100
|
+
function toast(input) {
|
|
101
|
+
if (!toastDispatcher) {
|
|
102
|
+
return "";
|
|
103
|
+
}
|
|
104
|
+
return toastDispatcher(input);
|
|
105
|
+
}
|
|
106
|
+
function useToast() {
|
|
107
|
+
const ctx = _react.useContext.call(void 0, ToastStoreContext);
|
|
108
|
+
if (!ctx) {
|
|
109
|
+
throw new Error("useToast must be used within <ToastProvider>");
|
|
110
|
+
}
|
|
111
|
+
return { toast: ctx.push, dismiss: ctx.dismiss };
|
|
112
|
+
}
|
|
113
|
+
function ToastProvider({ children }) {
|
|
114
|
+
const [toasts, setToasts] = _react.useState.call(void 0, []);
|
|
115
|
+
const timers = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
|
|
116
|
+
const dismiss = _react.useCallback.call(void 0, (id) => {
|
|
117
|
+
const timerId = timers.current.get(id);
|
|
118
|
+
if (timerId) {
|
|
119
|
+
window.clearTimeout(timerId);
|
|
120
|
+
timers.current.delete(id);
|
|
121
|
+
}
|
|
122
|
+
setToasts((prev) => prev.filter((toastItem) => toastItem.id !== id));
|
|
123
|
+
}, []);
|
|
124
|
+
const push = _react.useCallback.call(void 0,
|
|
125
|
+
(input) => {
|
|
126
|
+
const id = _nullishCoalesce(input.id, () => ( `toast-${Math.random().toString(16).slice(2)}`));
|
|
127
|
+
const durationMs = _nullishCoalesce(input.durationMs, () => ( 4500));
|
|
128
|
+
const record = {
|
|
129
|
+
...input,
|
|
130
|
+
id,
|
|
131
|
+
durationMs,
|
|
132
|
+
animation: _nullishCoalesce(input.animation, () => ( "slide"))
|
|
133
|
+
};
|
|
134
|
+
setToasts((prev) => [...prev, record]);
|
|
135
|
+
const timerId = window.setTimeout(() => dismiss(id), durationMs);
|
|
136
|
+
timers.current.set(id, timerId);
|
|
137
|
+
return id;
|
|
138
|
+
},
|
|
139
|
+
[dismiss]
|
|
140
|
+
);
|
|
141
|
+
const ctx = _react.useMemo.call(void 0,
|
|
142
|
+
() => ({
|
|
143
|
+
toasts,
|
|
144
|
+
push,
|
|
145
|
+
dismiss
|
|
146
|
+
}),
|
|
147
|
+
[dismiss, push, toasts]
|
|
148
|
+
);
|
|
149
|
+
_react.useEffect.call(void 0, () => {
|
|
150
|
+
toastDispatcher = push;
|
|
151
|
+
return () => {
|
|
152
|
+
toastDispatcher = null;
|
|
153
|
+
};
|
|
154
|
+
}, [push]);
|
|
155
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ToastStoreContext.Provider, { value: ctx, children });
|
|
156
|
+
}
|
|
157
|
+
ToastProvider.displayName = "ToastProvider";
|
|
158
|
+
function ToastViewport({ position = "bottom-right", className }) {
|
|
159
|
+
const ctx = _react.useContext.call(void 0, ToastStoreContext);
|
|
160
|
+
if (!ctx) {
|
|
161
|
+
throw new Error("ToastViewport must be used within <ToastProvider>");
|
|
162
|
+
}
|
|
163
|
+
const portalTarget = typeof document !== "undefined" ? document.body : null;
|
|
164
|
+
if (!portalTarget) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
return _reactdom.createPortal.call(void 0,
|
|
168
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunkE5UX537Jjs.cn.call(void 0, toastViewportVariants({ position }), className), "data-slot": "toast-viewport", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _framermotion.AnimatePresence, { children: ctx.toasts.map((item) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
169
|
+
Toast,
|
|
170
|
+
{
|
|
171
|
+
toastId: item.id,
|
|
172
|
+
appearance: item.appearance,
|
|
173
|
+
size: item.size,
|
|
174
|
+
animation: item.animation,
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ToastTitle, { children: item.title }),
|
|
177
|
+
item.description ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ToastDescription, { children: item.description }) : null,
|
|
178
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ToastClose, { onClick: () => ctx.dismiss(item.id) })
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
item.id
|
|
182
|
+
)) }) }),
|
|
183
|
+
portalTarget
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
ToastViewport.displayName = "ToastViewport";
|
|
187
|
+
function Toast({ toastId: _toastId, appearance, size, animation = "slide", className, children }) {
|
|
188
|
+
const motionProps = toastAnimationPresets[animation];
|
|
189
|
+
const live = appearance === "error" ? "assertive" : "polite";
|
|
190
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
191
|
+
_framermotion.motion.div,
|
|
192
|
+
{
|
|
193
|
+
layout: true,
|
|
194
|
+
"data-slot": "toast",
|
|
195
|
+
role: appearance === "error" ? "alert" : "status",
|
|
196
|
+
"aria-live": live,
|
|
197
|
+
"aria-atomic": "true",
|
|
198
|
+
className: _chunkE5UX537Jjs.cn.call(void 0, "relative", toastRootVariants({ appearance, size }), className),
|
|
199
|
+
initial: animation === "none" ? false : motionProps.initial,
|
|
200
|
+
animate: animation === "none" ? void 0 : motionProps.animate,
|
|
201
|
+
exit: animation === "none" ? void 0 : motionProps.exit,
|
|
202
|
+
transition: motionProps.transition,
|
|
203
|
+
children
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
Toast.displayName = "Toast";
|
|
208
|
+
function ToastTitle({ className, children }) {
|
|
209
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-slot": "toast-title", className: _chunkE5UX537Jjs.cn.call(void 0, "font-semibold", className), children });
|
|
210
|
+
}
|
|
211
|
+
ToastTitle.displayName = "ToastTitle";
|
|
212
|
+
function ToastDescription({ className, children }) {
|
|
213
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-slot": "toast-description", className: _chunkE5UX537Jjs.cn.call(void 0, "text-sm text-slate-300", className), children });
|
|
214
|
+
}
|
|
215
|
+
ToastDescription.displayName = "ToastDescription";
|
|
216
|
+
function ToastAction({ className, children }) {
|
|
217
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { "data-slot": "toast-action", className: _chunkE5UX537Jjs.cn.call(void 0, "mt-3", className), children });
|
|
218
|
+
}
|
|
219
|
+
ToastAction.displayName = "ToastAction";
|
|
220
|
+
function ToastClose({ className, children, onClick, ...rest }) {
|
|
221
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
222
|
+
"button",
|
|
223
|
+
{
|
|
224
|
+
type: "button",
|
|
225
|
+
"data-slot": "toast-close",
|
|
226
|
+
"aria-label": "Dismiss notification",
|
|
227
|
+
className: _chunkE5UX537Jjs.cn.call(void 0,
|
|
228
|
+
"absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-md text-slate-200 transition hover:bg-white/10",
|
|
229
|
+
className
|
|
230
|
+
),
|
|
231
|
+
onClick,
|
|
232
|
+
...rest,
|
|
233
|
+
children: _nullishCoalesce(children, () => ( "\xD7"))
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
ToastClose.displayName = "ToastClose";
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
exports.Toast = Toast; exports.ToastAction = ToastAction; exports.ToastClose = ToastClose; exports.ToastDescription = ToastDescription; exports.ToastProvider = ToastProvider; exports.ToastTitle = ToastTitle; exports.ToastViewport = ToastViewport; exports.toast = toast; exports.toastAnimationPresets = toastAnimationPresets; exports.toastRootVariants = toastRootVariants; exports.toastViewportVariants = toastViewportVariants; exports.useToast = useToast;
|
|
252
|
+
//# sourceMappingURL=toast.js.map
|
|
@@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ACA,EAAA;AACA;AACA;AACA;AACA,EAAA;AACA;AACA;AACA;AACA,EAAA;AACA;AACA;AACA;AACA,EAAA;AACA,IAAA;AACA,IAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,QAAA;AACA,QAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,IAAA;AACA,EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/shubham/Desktop/Repos/NEXT JS/zentauri-ui/packages/components/dist/ui/toast.js","sourcesContent":[null]}
|