@zentauri-ui/zentauri-components 0.0.83 → 0.0.91
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 +50 -29
- package/dist/ui/accordion.cjs +311 -0
- package/dist/ui/accordion.cjs.map +1 -0
- package/dist/ui/accordion.d.cts +70 -0
- package/dist/ui/accordion.d.ts +70 -0
- package/dist/ui/accordion.js +286 -0
- package/dist/ui/accordion.js.map +1 -0
- package/dist/ui/alert.cjs +257 -0
- package/dist/ui/alert.cjs.map +1 -0
- package/dist/ui/alert.d.cts +66 -0
- package/dist/ui/alert.d.ts +66 -0
- package/dist/ui/alert.js +224 -0
- package/dist/ui/alert.js.map +1 -0
- package/dist/ui/badge.cjs +192 -0
- package/dist/ui/badge.cjs.map +1 -0
- package/dist/ui/badge.d.cts +37 -0
- package/dist/ui/badge.d.ts +37 -0
- package/dist/ui/badge.js +165 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/buttons.cjs +202 -0
- package/dist/ui/buttons.cjs.map +1 -0
- package/dist/ui/buttons.d.cts +27 -0
- package/dist/ui/buttons.d.ts +27 -0
- package/dist/ui/buttons.js +176 -0
- package/dist/ui/buttons.js.map +1 -0
- package/dist/ui/card.cjs +293 -0
- package/dist/ui/card.cjs.map +1 -0
- package/dist/ui/card.d.cts +77 -0
- package/dist/ui/card.d.ts +77 -0
- package/dist/ui/card.js +258 -0
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/divider.cjs +229 -0
- package/dist/ui/divider.cjs.map +1 -0
- package/dist/ui/divider.d.cts +39 -0
- package/dist/ui/divider.d.ts +39 -0
- package/dist/ui/divider.js +200 -0
- package/dist/ui/divider.js.map +1 -0
- package/dist/ui/drawer.cjs +408 -0
- package/dist/ui/drawer.cjs.map +1 -0
- package/dist/ui/drawer.d.cts +81 -0
- package/dist/ui/drawer.d.ts +81 -0
- package/dist/ui/drawer.js +383 -0
- package/dist/ui/drawer.js.map +1 -0
- package/dist/ui/dropdown.cjs +302 -0
- package/dist/ui/dropdown.cjs.map +1 -0
- package/dist/ui/dropdown.d.cts +50 -0
- package/dist/ui/dropdown.d.ts +50 -0
- package/dist/ui/dropdown.js +278 -0
- package/dist/ui/dropdown.js.map +1 -0
- package/dist/ui/empty-state.cjs +186 -0
- package/dist/ui/empty-state.cjs.map +1 -0
- package/dist/ui/empty-state.d.cts +55 -0
- package/dist/ui/empty-state.d.ts +55 -0
- package/dist/ui/empty-state.js +154 -0
- package/dist/ui/empty-state.js.map +1 -0
- package/dist/ui/index.d.cts +27 -1164
- package/dist/ui/index.d.ts +27 -1164
- package/dist/ui/inputs.cjs +458 -0
- package/dist/ui/inputs.cjs.map +1 -0
- package/dist/ui/inputs.d.cts +35 -0
- package/dist/ui/inputs.d.ts +35 -0
- package/dist/ui/inputs.js +432 -0
- package/dist/ui/inputs.js.map +1 -0
- package/dist/ui/modal.cjs +406 -0
- package/dist/ui/modal.cjs.map +1 -0
- package/dist/ui/modal.d.cts +84 -0
- package/dist/ui/modal.d.ts +84 -0
- package/dist/ui/modal.js +384 -0
- package/dist/ui/modal.js.map +1 -0
- package/dist/ui/pagination.cjs +523 -0
- package/dist/ui/pagination.cjs.map +1 -0
- package/dist/ui/pagination.d.cts +114 -0
- package/dist/ui/pagination.d.ts +114 -0
- package/dist/ui/pagination.js +494 -0
- package/dist/ui/pagination.js.map +1 -0
- package/dist/ui/progress.cjs +268 -0
- package/dist/ui/progress.cjs.map +1 -0
- package/dist/ui/progress.d.cts +61 -0
- package/dist/ui/progress.d.ts +61 -0
- package/dist/ui/progress.js +237 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/select.cjs +360 -0
- package/dist/ui/select.cjs.map +1 -0
- package/dist/ui/select.d.cts +73 -0
- package/dist/ui/select.d.ts +73 -0
- package/dist/ui/select.js +327 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/skeleton.cjs +576 -0
- package/dist/ui/skeleton.cjs.map +1 -0
- package/dist/ui/skeleton.d.cts +90 -0
- package/dist/ui/skeleton.d.ts +90 -0
- package/dist/ui/skeleton.js +544 -0
- package/dist/ui/skeleton.js.map +1 -0
- package/dist/ui/spinner.cjs +219 -0
- package/dist/ui/spinner.cjs.map +1 -0
- package/dist/ui/spinner.d.cts +27 -0
- package/dist/ui/spinner.d.ts +27 -0
- package/dist/ui/spinner.js +193 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/table.cjs +328 -0
- package/dist/ui/table.cjs.map +1 -0
- package/dist/ui/table.d.cts +81 -0
- package/dist/ui/table.d.ts +81 -0
- package/dist/ui/table.js +293 -0
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/tabs.cjs +300 -0
- package/dist/ui/tabs.cjs.map +1 -0
- package/dist/ui/tabs.d.cts +58 -0
- package/dist/ui/tabs.d.ts +58 -0
- package/dist/ui/tabs.js +274 -0
- package/dist/ui/tabs.js.map +1 -0
- package/dist/ui/toast.cjs +285 -0
- package/dist/ui/toast.cjs.map +1 -0
- package/dist/ui/toast.d.cts +86 -0
- package/dist/ui/toast.d.ts +86 -0
- package/dist/ui/toast.js +258 -0
- package/dist/ui/toast.js.map +1 -0
- package/dist/ui/toggle.cjs +185 -0
- package/dist/ui/toggle.cjs.map +1 -0
- package/dist/ui/toggle.d.cts +37 -0
- package/dist/ui/toggle.d.ts +37 -0
- package/dist/ui/toggle.js +158 -0
- package/dist/ui/toggle.js.map +1 -0
- package/dist/ui/tooltip.cjs +242 -0
- package/dist/ui/tooltip.cjs.map +1 -0
- package/dist/ui/tooltip.d.cts +46 -0
- package/dist/ui/tooltip.d.ts +46 -0
- package/dist/ui/tooltip.js +214 -0
- package/dist/ui/tooltip.js.map +1 -0
- package/dist/variants-1Bx3BEeS.d.cts +8 -0
- package/dist/variants-1Bx3BEeS.d.ts +8 -0
- package/package.json +7 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { HTMLMotionProps } from 'framer-motion';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
|
+
|
|
7
|
+
declare const alertVariants: (props?: ({
|
|
8
|
+
appearance?: "default" | "ghost" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | "success" | "warning" | "error" | "info" | "gray" | "violet" | null | undefined;
|
|
9
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
10
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
|
+
declare const alertTitleVariants: (props?: ({
|
|
12
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
13
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
14
|
+
declare const alertDescriptionVariants: (props?: ({
|
|
15
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
16
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
17
|
+
|
|
18
|
+
type AlertAnimation = "none" | "slide-down" | "fade" | "pop";
|
|
19
|
+
type AlertVariantProps = VariantProps<typeof alertVariants> & {
|
|
20
|
+
closable?: boolean;
|
|
21
|
+
};
|
|
22
|
+
type AlertProps = AlertVariantProps & Omit<HTMLMotionProps<"div">, "children"> & {
|
|
23
|
+
triggerClassName?: string;
|
|
24
|
+
animation?: AlertAnimation;
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
onClose?: () => void;
|
|
27
|
+
closeLabel?: string;
|
|
28
|
+
};
|
|
29
|
+
type AlertSectionProps = {
|
|
30
|
+
className?: string;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
};
|
|
33
|
+
type AlertSize = NonNullable<AlertProps["size"]>;
|
|
34
|
+
|
|
35
|
+
declare function Alert(props: AlertProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare namespace Alert {
|
|
37
|
+
var displayName: string;
|
|
38
|
+
}
|
|
39
|
+
declare function AlertIcon({ className, children }: AlertSectionProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
declare namespace AlertIcon {
|
|
41
|
+
var displayName: string;
|
|
42
|
+
}
|
|
43
|
+
declare function AlertTitle({ className, children }: AlertSectionProps): react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare namespace AlertTitle {
|
|
45
|
+
var displayName: string;
|
|
46
|
+
}
|
|
47
|
+
declare function AlertDescription({ className, children }: AlertSectionProps): react_jsx_runtime.JSX.Element;
|
|
48
|
+
declare namespace AlertDescription {
|
|
49
|
+
var displayName: string;
|
|
50
|
+
}
|
|
51
|
+
declare function AlertClose({ className, children, "aria-label": ariaLabel, onClick, }: AlertSectionProps & {
|
|
52
|
+
onClick?: () => void;
|
|
53
|
+
"aria-label"?: string;
|
|
54
|
+
}): react_jsx_runtime.JSX.Element;
|
|
55
|
+
declare namespace AlertClose {
|
|
56
|
+
var displayName: string;
|
|
57
|
+
}
|
|
58
|
+
declare function AlertDefaultIcon({ appearance }: {
|
|
59
|
+
appearance?: AlertProps["appearance"];
|
|
60
|
+
}): react_jsx_runtime.JSX.Element;
|
|
61
|
+
|
|
62
|
+
type AlertPresetMotionProps = Pick<HTMLMotionProps<"div">, "initial" | "animate" | "transition">;
|
|
63
|
+
type AlertAnimationPresets = Record<AlertAnimation, AlertPresetMotionProps>;
|
|
64
|
+
declare const alertAnimationPresets: AlertAnimationPresets;
|
|
65
|
+
|
|
66
|
+
export { Alert, type AlertAnimation, AlertClose, AlertDefaultIcon, AlertDescription, AlertIcon, type AlertProps, type AlertSectionProps, type AlertSize, AlertTitle, alertAnimationPresets, alertDescriptionVariants, alertTitleVariants, alertVariants };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { HTMLMotionProps } from 'framer-motion';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
|
+
|
|
7
|
+
declare const alertVariants: (props?: ({
|
|
8
|
+
appearance?: "default" | "ghost" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | "success" | "warning" | "error" | "info" | "gray" | "violet" | null | undefined;
|
|
9
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
10
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
|
+
declare const alertTitleVariants: (props?: ({
|
|
12
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
13
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
14
|
+
declare const alertDescriptionVariants: (props?: ({
|
|
15
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
16
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
17
|
+
|
|
18
|
+
type AlertAnimation = "none" | "slide-down" | "fade" | "pop";
|
|
19
|
+
type AlertVariantProps = VariantProps<typeof alertVariants> & {
|
|
20
|
+
closable?: boolean;
|
|
21
|
+
};
|
|
22
|
+
type AlertProps = AlertVariantProps & Omit<HTMLMotionProps<"div">, "children"> & {
|
|
23
|
+
triggerClassName?: string;
|
|
24
|
+
animation?: AlertAnimation;
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
onClose?: () => void;
|
|
27
|
+
closeLabel?: string;
|
|
28
|
+
};
|
|
29
|
+
type AlertSectionProps = {
|
|
30
|
+
className?: string;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
};
|
|
33
|
+
type AlertSize = NonNullable<AlertProps["size"]>;
|
|
34
|
+
|
|
35
|
+
declare function Alert(props: AlertProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare namespace Alert {
|
|
37
|
+
var displayName: string;
|
|
38
|
+
}
|
|
39
|
+
declare function AlertIcon({ className, children }: AlertSectionProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
declare namespace AlertIcon {
|
|
41
|
+
var displayName: string;
|
|
42
|
+
}
|
|
43
|
+
declare function AlertTitle({ className, children }: AlertSectionProps): react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare namespace AlertTitle {
|
|
45
|
+
var displayName: string;
|
|
46
|
+
}
|
|
47
|
+
declare function AlertDescription({ className, children }: AlertSectionProps): react_jsx_runtime.JSX.Element;
|
|
48
|
+
declare namespace AlertDescription {
|
|
49
|
+
var displayName: string;
|
|
50
|
+
}
|
|
51
|
+
declare function AlertClose({ className, children, "aria-label": ariaLabel, onClick, }: AlertSectionProps & {
|
|
52
|
+
onClick?: () => void;
|
|
53
|
+
"aria-label"?: string;
|
|
54
|
+
}): react_jsx_runtime.JSX.Element;
|
|
55
|
+
declare namespace AlertClose {
|
|
56
|
+
var displayName: string;
|
|
57
|
+
}
|
|
58
|
+
declare function AlertDefaultIcon({ appearance }: {
|
|
59
|
+
appearance?: AlertProps["appearance"];
|
|
60
|
+
}): react_jsx_runtime.JSX.Element;
|
|
61
|
+
|
|
62
|
+
type AlertPresetMotionProps = Pick<HTMLMotionProps<"div">, "initial" | "animate" | "transition">;
|
|
63
|
+
type AlertAnimationPresets = Record<AlertAnimation, AlertPresetMotionProps>;
|
|
64
|
+
declare const alertAnimationPresets: AlertAnimationPresets;
|
|
65
|
+
|
|
66
|
+
export { Alert, type AlertAnimation, AlertClose, AlertDefaultIcon, AlertDescription, AlertIcon, type AlertProps, type AlertSectionProps, type AlertSize, AlertTitle, alertAnimationPresets, alertDescriptionVariants, alertTitleVariants, alertVariants };
|
package/dist/ui/alert.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// src/ui/alert/alert.tsx
|
|
5
|
+
import { createContext, useContext, useMemo } from "react";
|
|
6
|
+
import { motion } from "framer-motion";
|
|
7
|
+
import { HiExclamationTriangle, HiInformationCircle, HiXMark } from "react-icons/hi2";
|
|
8
|
+
|
|
9
|
+
// src/lib/utils.ts
|
|
10
|
+
import { clsx } from "clsx";
|
|
11
|
+
import { twMerge } from "tailwind-merge";
|
|
12
|
+
function cn(...inputs) {
|
|
13
|
+
return twMerge(clsx(inputs));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/ui/alert/animations.ts
|
|
17
|
+
var alertAnimationPresets = {
|
|
18
|
+
none: {},
|
|
19
|
+
"slide-down": {
|
|
20
|
+
initial: { y: -8, opacity: 0 },
|
|
21
|
+
animate: { y: 0, opacity: 1 },
|
|
22
|
+
transition: { type: "spring", stiffness: 420, damping: 30 }
|
|
23
|
+
},
|
|
24
|
+
fade: {
|
|
25
|
+
initial: { opacity: 0 },
|
|
26
|
+
animate: { opacity: 1 },
|
|
27
|
+
transition: { duration: 0.2 }
|
|
28
|
+
},
|
|
29
|
+
pop: {
|
|
30
|
+
initial: { scale: 0.96, opacity: 0 },
|
|
31
|
+
animate: { scale: 1, opacity: 1 },
|
|
32
|
+
transition: { type: "spring", stiffness: 520, damping: 28 }
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// src/ui/alert/variants.ts
|
|
37
|
+
import { cva } from "class-variance-authority";
|
|
38
|
+
var alertVariants = cva(
|
|
39
|
+
"relative flex w-full gap-3 border text-sm ring-offset-slate-950 transition-colors",
|
|
40
|
+
{
|
|
41
|
+
variants: {
|
|
42
|
+
appearance: {
|
|
43
|
+
default: "border-white/10 bg-white/5 text-slate-50",
|
|
44
|
+
success: "border-emerald-500/40 bg-emerald-500/10 text-emerald-50",
|
|
45
|
+
warning: "border-amber-500/40 bg-amber-500/10 text-amber-50",
|
|
46
|
+
error: "border-rose-500/50 bg-rose-500/10 text-rose-50",
|
|
47
|
+
info: "border-sky-500/40 bg-sky-500/10 text-sky-50",
|
|
48
|
+
ghost: "border-transparent bg-transparent text-slate-200",
|
|
49
|
+
purple: "border-purple-600 bg-purple-950/70 backdrop-blur-xl",
|
|
50
|
+
pink: "border-pink-600 bg-pink-950/70 backdrop-blur-xl",
|
|
51
|
+
orange: "border-orange-600 bg-orange-950/70 backdrop-blur-xl",
|
|
52
|
+
yellow: "border-yellow-600 bg-yellow-950/70 backdrop-blur-xl",
|
|
53
|
+
teal: "border-teal-600 bg-teal-950/70 backdrop-blur-xl",
|
|
54
|
+
indigo: "border-indigo-600 bg-indigo-950/70 backdrop-blur-xl",
|
|
55
|
+
gray: "border-gray-600 bg-gray-950/70 backdrop-blur-xl",
|
|
56
|
+
violet: "border-violet-600 bg-violet-950/70 backdrop-blur-xl",
|
|
57
|
+
"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",
|
|
58
|
+
"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",
|
|
59
|
+
"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",
|
|
60
|
+
"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",
|
|
61
|
+
"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",
|
|
62
|
+
"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",
|
|
63
|
+
"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",
|
|
64
|
+
"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",
|
|
65
|
+
"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"
|
|
66
|
+
},
|
|
67
|
+
size: {
|
|
68
|
+
sm: "rounded-lg p-3",
|
|
69
|
+
md: "rounded-xl p-4",
|
|
70
|
+
lg: "rounded-2xl p-5 text-base"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
defaultVariants: {
|
|
74
|
+
appearance: "default",
|
|
75
|
+
size: "md"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
var alertTitleVariants = cva("font-semibold leading-tight", {
|
|
80
|
+
variants: {
|
|
81
|
+
size: {
|
|
82
|
+
sm: "text-xs md:text-sm",
|
|
83
|
+
md: "text-xs md:text-sm",
|
|
84
|
+
lg: "text-xs md:text-sm"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
defaultVariants: { size: "md" }
|
|
88
|
+
});
|
|
89
|
+
var alertDescriptionVariants = cva("text-slate-300", {
|
|
90
|
+
variants: {
|
|
91
|
+
size: {
|
|
92
|
+
sm: "text-xs md:text-sm",
|
|
93
|
+
md: "text-xs md:text-sm",
|
|
94
|
+
lg: "text-xs md:text-sm"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
defaultVariants: { size: "md" }
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// src/ui/alert/alert.tsx
|
|
101
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
102
|
+
var AlertSizeContext = createContext("md");
|
|
103
|
+
function useAlertSize() {
|
|
104
|
+
const ctx = useContext(AlertSizeContext);
|
|
105
|
+
if (!ctx) {
|
|
106
|
+
throw new Error("useAlertSize must be used within an Alert");
|
|
107
|
+
}
|
|
108
|
+
return ctx;
|
|
109
|
+
}
|
|
110
|
+
function Alert(props) {
|
|
111
|
+
const {
|
|
112
|
+
className,
|
|
113
|
+
triggerClassName,
|
|
114
|
+
appearance,
|
|
115
|
+
size = "md",
|
|
116
|
+
animation = "none",
|
|
117
|
+
closable = false,
|
|
118
|
+
onClose,
|
|
119
|
+
closeLabel = "Dismiss alert",
|
|
120
|
+
children,
|
|
121
|
+
ref,
|
|
122
|
+
...rest
|
|
123
|
+
} = props;
|
|
124
|
+
const motionProps = alertAnimationPresets[animation];
|
|
125
|
+
const live = appearance === "error" ? "assertive" : "polite";
|
|
126
|
+
const ctx = useMemo(() => size ?? "md", [size]);
|
|
127
|
+
return /* @__PURE__ */ jsx(AlertSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
|
|
128
|
+
motion.div,
|
|
129
|
+
{
|
|
130
|
+
ref,
|
|
131
|
+
"data-slot": "alert",
|
|
132
|
+
role: "alert",
|
|
133
|
+
"aria-live": live,
|
|
134
|
+
className: cn(
|
|
135
|
+
alertVariants({ appearance, size }),
|
|
136
|
+
closable ? "pr-12" : "",
|
|
137
|
+
className
|
|
138
|
+
),
|
|
139
|
+
initial: animation === "none" ? false : void 0,
|
|
140
|
+
...motionProps,
|
|
141
|
+
...rest,
|
|
142
|
+
children: [
|
|
143
|
+
children,
|
|
144
|
+
closable ? /* @__PURE__ */ jsx(
|
|
145
|
+
"button",
|
|
146
|
+
{
|
|
147
|
+
type: "button",
|
|
148
|
+
"data-slot": "alert-close",
|
|
149
|
+
"aria-label": closeLabel,
|
|
150
|
+
onClick: onClose,
|
|
151
|
+
className: cn(
|
|
152
|
+
"absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-md text-slate-200 transition hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/30",
|
|
153
|
+
triggerClassName
|
|
154
|
+
),
|
|
155
|
+
children: /* @__PURE__ */ jsx(HiXMark, { className: "size-4", "aria-hidden": true })
|
|
156
|
+
}
|
|
157
|
+
) : null
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
) });
|
|
161
|
+
}
|
|
162
|
+
Alert.displayName = "Alert";
|
|
163
|
+
function AlertIcon({ className, children }) {
|
|
164
|
+
return /* @__PURE__ */ jsx("span", { "data-slot": "alert-icon", className: cn("mt-0.5 shrink-0 text-current", className), children });
|
|
165
|
+
}
|
|
166
|
+
AlertIcon.displayName = "AlertIcon";
|
|
167
|
+
function AlertTitle({ className, children }) {
|
|
168
|
+
const size = useAlertSize();
|
|
169
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "alert-title", className: cn(alertTitleVariants({ size }), className), children });
|
|
170
|
+
}
|
|
171
|
+
AlertTitle.displayName = "AlertTitle";
|
|
172
|
+
function AlertDescription({ className, children }) {
|
|
173
|
+
const size = useAlertSize();
|
|
174
|
+
return /* @__PURE__ */ jsx(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
"data-slot": "alert-description",
|
|
178
|
+
className: cn(alertDescriptionVariants({ size }), className),
|
|
179
|
+
children
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
AlertDescription.displayName = "AlertDescription";
|
|
184
|
+
function AlertClose({
|
|
185
|
+
className,
|
|
186
|
+
children,
|
|
187
|
+
"aria-label": ariaLabel = "Dismiss alert",
|
|
188
|
+
onClick
|
|
189
|
+
}) {
|
|
190
|
+
return /* @__PURE__ */ jsx(
|
|
191
|
+
"button",
|
|
192
|
+
{
|
|
193
|
+
type: "button",
|
|
194
|
+
"data-slot": "alert-close",
|
|
195
|
+
"aria-label": ariaLabel,
|
|
196
|
+
onClick,
|
|
197
|
+
className: cn(
|
|
198
|
+
"inline-flex size-8 items-center justify-center rounded-md text-slate-200 transition hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/30",
|
|
199
|
+
className
|
|
200
|
+
),
|
|
201
|
+
children: children ?? /* @__PURE__ */ jsx(HiXMark, { className: "size-4", "aria-hidden": true })
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
AlertClose.displayName = "AlertClose";
|
|
206
|
+
function AlertDefaultIcon({ appearance }) {
|
|
207
|
+
if (appearance === "error") {
|
|
208
|
+
return /* @__PURE__ */ jsx(HiExclamationTriangle, { className: "size-5", "aria-hidden": true });
|
|
209
|
+
}
|
|
210
|
+
return /* @__PURE__ */ jsx(HiInformationCircle, { className: "size-5", "aria-hidden": true });
|
|
211
|
+
}
|
|
212
|
+
export {
|
|
213
|
+
Alert,
|
|
214
|
+
AlertClose,
|
|
215
|
+
AlertDefaultIcon,
|
|
216
|
+
AlertDescription,
|
|
217
|
+
AlertIcon,
|
|
218
|
+
AlertTitle,
|
|
219
|
+
alertAnimationPresets,
|
|
220
|
+
alertDescriptionVariants,
|
|
221
|
+
alertTitleVariants,
|
|
222
|
+
alertVariants
|
|
223
|
+
};
|
|
224
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/alert/alert.tsx","../../src/lib/utils.ts","../../src/ui/alert/animations.ts","../../src/ui/alert/variants.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, useMemo } from \"react\";\nimport { motion } from \"framer-motion\";\nimport { HiExclamationTriangle, HiInformationCircle, HiXMark } from \"react-icons/hi2\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport { alertAnimationPresets } from \"./animations\";\nimport type { AlertProps, AlertSectionProps, AlertSize } from \"./types\";\nimport {\n alertDescriptionVariants,\n alertTitleVariants,\n alertVariants,\n} from \"./variants\";\n\nconst AlertSizeContext = createContext<AlertSize>(\"md\");\n\nfunction useAlertSize(): AlertSize {\n const ctx = useContext(AlertSizeContext);\n if (!ctx) {\n throw new Error(\"useAlertSize must be used within an Alert\");\n }\n return ctx;\n}\n\nexport function Alert(props: AlertProps) {\n const {\n className,\n triggerClassName,\n appearance,\n size = \"md\",\n animation = \"none\",\n closable = false,\n onClose,\n closeLabel = \"Dismiss alert\",\n children,\n ref,\n ...rest\n } = props;\n const motionProps = alertAnimationPresets[animation];\n const live = appearance === \"error\" ? \"assertive\" : \"polite\";\n\n const ctx = useMemo(() => size ?? \"md\", [size]);\n\n return (\n <AlertSizeContext.Provider value={ctx}>\n <motion.div\n ref={ref}\n data-slot=\"alert\"\n role=\"alert\"\n aria-live={live}\n className={cn(\n alertVariants({ appearance, size }),\n closable ? \"pr-12\" : \"\",\n className,\n )}\n initial={animation === \"none\" ? false : undefined}\n {...motionProps}\n {...rest}\n >\n {children}\n {closable ? (\n <button\n type=\"button\"\n data-slot=\"alert-close\"\n aria-label={closeLabel}\n onClick={onClose}\n className={cn(\n \"absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-md text-slate-200 transition hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/30\",\n triggerClassName,\n )}\n >\n <HiXMark className=\"size-4\" aria-hidden />\n </button>\n ) : null}\n </motion.div>\n </AlertSizeContext.Provider>\n );\n}\n\nAlert.displayName = \"Alert\";\n\nexport function AlertIcon({ className, children }: AlertSectionProps) {\n return (\n <span data-slot=\"alert-icon\" className={cn(\"mt-0.5 shrink-0 text-current\", className)}>\n {children}\n </span>\n );\n}\n\nAlertIcon.displayName = \"AlertIcon\";\n\nexport function AlertTitle({ className, children }: AlertSectionProps) {\n const size = useAlertSize();\n return (\n <div data-slot=\"alert-title\" className={cn(alertTitleVariants({ size }), className)}>\n {children}\n </div>\n );\n}\n\nAlertTitle.displayName = \"AlertTitle\";\n\nexport function AlertDescription({ className, children }: AlertSectionProps) {\n const size = useAlertSize();\n return (\n <div\n data-slot=\"alert-description\"\n className={cn(alertDescriptionVariants({ size }), className)}\n >\n {children}\n </div>\n );\n}\n\nAlertDescription.displayName = \"AlertDescription\";\n\nexport function AlertClose({\n className,\n children,\n \"aria-label\": ariaLabel = \"Dismiss alert\",\n onClick,\n}: AlertSectionProps & { onClick?: () => void; \"aria-label\"?: string }) {\n return (\n <button\n type=\"button\"\n data-slot=\"alert-close\"\n aria-label={ariaLabel}\n onClick={onClick}\n className={cn(\n \"inline-flex size-8 items-center justify-center rounded-md text-slate-200 transition hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/30\",\n className,\n )}\n >\n {children ?? <HiXMark className=\"size-4\" aria-hidden />}\n </button>\n );\n}\n\nAlertClose.displayName = \"AlertClose\";\n\nexport function AlertDefaultIcon({ appearance }: { appearance?: AlertProps[\"appearance\"] }) {\n if (appearance === \"error\") {\n return <HiExclamationTriangle className=\"size-5\" aria-hidden />;\n }\n return <HiInformationCircle className=\"size-5\" aria-hidden />;\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}","import type { HTMLMotionProps } from \"framer-motion\";\n\nimport type { AlertAnimation } from \"./types\";\n\ntype AlertPresetMotionProps = Pick<\n HTMLMotionProps<\"div\">,\n \"initial\" | \"animate\" | \"transition\"\n>;\n\nexport type AlertAnimationPresets = Record<AlertAnimation, AlertPresetMotionProps>;\n\nexport const alertAnimationPresets: AlertAnimationPresets = {\n none: {},\n \"slide-down\": {\n initial: { y: -8, opacity: 0 },\n animate: { y: 0, opacity: 1 },\n transition: { type: \"spring\", stiffness: 420, damping: 30 },\n },\n fade: {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n transition: { duration: 0.2 },\n },\n pop: {\n initial: { scale: 0.96, opacity: 0 },\n animate: { scale: 1, opacity: 1 },\n transition: { type: \"spring\", stiffness: 520, damping: 28 },\n },\n};\n","import { cva } from \"class-variance-authority\";\n\nexport const alertVariants = cva(\n \"relative flex w-full gap-3 border text-sm ring-offset-slate-950 transition-colors\",\n {\n variants: {\n appearance: {\n default: \"border-white/10 bg-white/5 text-slate-50\",\n success: \"border-emerald-500/40 bg-emerald-500/10 text-emerald-50\",\n warning: \"border-amber-500/40 bg-amber-500/10 text-amber-50\",\n error: \"border-rose-500/50 bg-rose-500/10 text-rose-50\",\n info: \"border-sky-500/40 bg-sky-500/10 text-sky-50\",\n ghost: \"border-transparent bg-transparent text-slate-200\",\n purple: \"border-purple-600 bg-purple-950/70 backdrop-blur-xl\",\n pink: \"border-pink-600 bg-pink-950/70 backdrop-blur-xl\",\n orange: \"border-orange-600 bg-orange-950/70 backdrop-blur-xl\",\n yellow: \"border-yellow-600 bg-yellow-950/70 backdrop-blur-xl\",\n teal: \"border-teal-600 bg-teal-950/70 backdrop-blur-xl\",\n indigo: \"border-indigo-600 bg-indigo-950/70 backdrop-blur-xl\",\n gray: \"border-gray-600 bg-gray-950/70 backdrop-blur-xl\",\n violet: \"border-violet-600 bg-violet-950/70 backdrop-blur-xl\",\n \"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\",\n \"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\",\n \"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\",\n \"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\",\n \"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\",\n \"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\",\n \"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\",\n \"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\",\n \"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\",\n },\n size: {\n sm: \"rounded-lg p-3\",\n md: \"rounded-xl p-4\",\n lg: \"rounded-2xl p-5 text-base\",\n },\n },\n defaultVariants: {\n appearance: \"default\",\n size: \"md\",\n },\n },\n);\n\nexport const alertTitleVariants = cva(\"font-semibold leading-tight\", {\n variants: {\n size: {\n sm: \"text-xs md:text-sm\",\n md: \"text-xs md:text-sm\",\n lg: \"text-xs md:text-sm\",\n },\n },\n defaultVariants: { size: \"md\" },\n});\n\nexport const alertDescriptionVariants = cva(\"text-slate-300\", {\n variants: {\n size: {\n sm: \"text-xs md:text-sm\",\n md: \"text-xs md:text-sm\",\n lg: \"text-xs md:text-sm\",\n },\n },\n defaultVariants: { size: \"md\" },\n});\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/ui/badge/index.ts
|
|
21
|
+
var badge_exports = {};
|
|
22
|
+
__export(badge_exports, {
|
|
23
|
+
Badge: () => Badge,
|
|
24
|
+
badgeAnimationPresets: () => badgeAnimationPresets,
|
|
25
|
+
badgeCloseButtonVariants: () => badgeCloseButtonVariants,
|
|
26
|
+
badgeVariants: () => badgeVariants
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(badge_exports);
|
|
29
|
+
|
|
30
|
+
// src/ui/badge/badge.tsx
|
|
31
|
+
var import_framer_motion = require("framer-motion");
|
|
32
|
+
var import_hi2 = require("react-icons/hi2");
|
|
33
|
+
|
|
34
|
+
// src/lib/utils.ts
|
|
35
|
+
var import_clsx = require("clsx");
|
|
36
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
37
|
+
function cn(...inputs) {
|
|
38
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/ui/badge/animations.ts
|
|
42
|
+
var badgeAnimationPresets = {
|
|
43
|
+
none: {},
|
|
44
|
+
pop: {
|
|
45
|
+
initial: { scale: 0.92, opacity: 0 },
|
|
46
|
+
animate: { scale: 1, opacity: 1 },
|
|
47
|
+
transition: { type: "spring", stiffness: 520, damping: 28 }
|
|
48
|
+
},
|
|
49
|
+
bounce: {
|
|
50
|
+
whileHover: { y: -2, scale: 1.04 },
|
|
51
|
+
whileTap: { scale: 0.96 },
|
|
52
|
+
transition: { type: "spring", bounce: 0.45, stiffness: 420, damping: 18 }
|
|
53
|
+
},
|
|
54
|
+
fade: {
|
|
55
|
+
initial: { opacity: 0 },
|
|
56
|
+
animate: { opacity: 1 },
|
|
57
|
+
transition: { duration: 0.2 }
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// src/ui/badge/variants.ts
|
|
62
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
63
|
+
var buttonLikeSolidAppearances = {
|
|
64
|
+
default: "bg-slate-50 text-slate-950 shadow-[0_1px_2px_rgba(15,23,42,0.12)]",
|
|
65
|
+
secondary: "bg-slate-800 text-slate-50",
|
|
66
|
+
destructive: "bg-rose-600 text-white",
|
|
67
|
+
outline: "border border-white/10 bg-white/5 text-slate-50",
|
|
68
|
+
ghost: "bg-transparent text-slate-200",
|
|
69
|
+
glass: "border border-white/15 bg-white/10 text-white backdrop-blur-md",
|
|
70
|
+
emerald: "bg-emerald-600 text-white",
|
|
71
|
+
indigo: "bg-indigo-600 text-white",
|
|
72
|
+
purple: "bg-purple-600 text-white",
|
|
73
|
+
pink: "bg-pink-600 text-white",
|
|
74
|
+
rose: "bg-rose-600 text-white",
|
|
75
|
+
sky: "bg-sky-600 text-white",
|
|
76
|
+
teal: "bg-teal-600 text-white",
|
|
77
|
+
yellow: "bg-yellow-600 text-white",
|
|
78
|
+
orange: "bg-orange-600 text-white",
|
|
79
|
+
"gradient-blue": "bg-gradient-to-r from-blue-600 to-purple-600 text-white",
|
|
80
|
+
"gradient-green": "bg-gradient-to-r from-green-600 to-lime-600 text-white",
|
|
81
|
+
"gradient-red": "bg-gradient-to-r from-red-600 to-pink-600 text-white",
|
|
82
|
+
"gradient-yellow": "bg-gradient-to-r from-yellow-600 to-orange-600 text-white",
|
|
83
|
+
"gradient-purple": "bg-gradient-to-r from-purple-600 to-pink-600 text-white",
|
|
84
|
+
"gradient-teal": "bg-gradient-to-r from-teal-600 to-cyan-600 text-white",
|
|
85
|
+
"gradient-indigo": "bg-gradient-to-r from-indigo-600 to-purple-600 text-white",
|
|
86
|
+
"gradient-pink": "bg-gradient-to-r from-pink-600 to-rose-600 text-white",
|
|
87
|
+
"gradient-orange": "bg-gradient-to-r from-orange-600 to-red-600 text-white"
|
|
88
|
+
};
|
|
89
|
+
var badgeAppearances = {
|
|
90
|
+
...buttonLikeSolidAppearances,
|
|
91
|
+
outline: "border border-white/15 bg-transparent text-slate-200 shadow-none",
|
|
92
|
+
ghost: "bg-transparent text-slate-300 shadow-none"
|
|
93
|
+
};
|
|
94
|
+
var badgeVariants = (0, import_class_variance_authority.cva)(
|
|
95
|
+
[
|
|
96
|
+
"inline-flex max-w-full items-center justify-center gap-1 font-medium",
|
|
97
|
+
"whitespace-nowrap ring-offset-slate-950 transition-colors",
|
|
98
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-300 focus-visible:ring-offset-2",
|
|
99
|
+
"select-none"
|
|
100
|
+
],
|
|
101
|
+
{
|
|
102
|
+
variants: {
|
|
103
|
+
appearance: badgeAppearances,
|
|
104
|
+
size: {
|
|
105
|
+
sm: "h-6 min-h-6 px-2 text-[0.65rem] leading-none",
|
|
106
|
+
md: "h-7 min-h-7 px-2.5 text-xs leading-none",
|
|
107
|
+
lg: "h-8 min-h-8 px-3 text-sm leading-none"
|
|
108
|
+
},
|
|
109
|
+
shape: {
|
|
110
|
+
pill: "rounded-full",
|
|
111
|
+
square: "rounded-md",
|
|
112
|
+
dot: "h-2.5 min-h-2.5 w-2.5 min-w-2.5 rounded-full p-0 px-0 text-[0]"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
defaultVariants: {
|
|
116
|
+
appearance: "default",
|
|
117
|
+
size: "md",
|
|
118
|
+
shape: "pill"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
var badgeCloseButtonVariants = (0, import_class_variance_authority.cva)(
|
|
123
|
+
"inline-flex shrink-0 items-center justify-center rounded-md p-0.5 text-current opacity-70 transition hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/40",
|
|
124
|
+
{
|
|
125
|
+
variants: {
|
|
126
|
+
size: {
|
|
127
|
+
sm: "size-4",
|
|
128
|
+
md: "size-5",
|
|
129
|
+
lg: "size-6"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
defaultVariants: { size: "md" }
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
// src/ui/badge/badge.tsx
|
|
137
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
138
|
+
function Badge(props) {
|
|
139
|
+
const {
|
|
140
|
+
className,
|
|
141
|
+
appearance,
|
|
142
|
+
size,
|
|
143
|
+
shape,
|
|
144
|
+
animation = "none",
|
|
145
|
+
closable = false,
|
|
146
|
+
onClose,
|
|
147
|
+
closeLabel = "Remove",
|
|
148
|
+
children,
|
|
149
|
+
ref,
|
|
150
|
+
"aria-label": ariaLabel,
|
|
151
|
+
...rest
|
|
152
|
+
} = props;
|
|
153
|
+
const motionProps = badgeAnimationPresets[animation];
|
|
154
|
+
const isDot = shape === "dot";
|
|
155
|
+
const resolvedAriaLabel = ariaLabel ?? (isDot ? "Status indicator" : void 0);
|
|
156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
157
|
+
import_framer_motion.motion.span,
|
|
158
|
+
{
|
|
159
|
+
ref,
|
|
160
|
+
role: "status",
|
|
161
|
+
"data-slot": "badge",
|
|
162
|
+
"aria-label": resolvedAriaLabel,
|
|
163
|
+
className: cn(badgeVariants({ appearance, size, shape }), className),
|
|
164
|
+
initial: animation === "none" ? false : void 0,
|
|
165
|
+
...motionProps,
|
|
166
|
+
...rest,
|
|
167
|
+
children: [
|
|
168
|
+
!isDot ? children : null,
|
|
169
|
+
closable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
170
|
+
"button",
|
|
171
|
+
{
|
|
172
|
+
type: "button",
|
|
173
|
+
"data-slot": "badge-close",
|
|
174
|
+
"aria-label": closeLabel,
|
|
175
|
+
onClick: onClose,
|
|
176
|
+
className: badgeCloseButtonVariants({ size }),
|
|
177
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_hi2.HiXMark, { className: "size-3.5", "aria-hidden": true })
|
|
178
|
+
}
|
|
179
|
+
) : null
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
Badge.displayName = "Badge";
|
|
185
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
186
|
+
0 && (module.exports = {
|
|
187
|
+
Badge,
|
|
188
|
+
badgeAnimationPresets,
|
|
189
|
+
badgeCloseButtonVariants,
|
|
190
|
+
badgeVariants
|
|
191
|
+
});
|
|
192
|
+
//# sourceMappingURL=badge.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/badge/index.ts","../../src/ui/badge/badge.tsx","../../src/lib/utils.ts","../../src/ui/badge/animations.ts","../../src/ui/badge/variants.ts"],"sourcesContent":["export { Badge } from \"./badge\";\nexport type { BadgeAnimation, BadgeProps } from \"./types\";\nexport { badgeAnimationPresets } from \"./animations\";\nexport { badgeVariants, badgeCloseButtonVariants } from \"./variants\";\n","\"use client\";\n\nimport { motion } from \"framer-motion\";\nimport { HiXMark } from \"react-icons/hi2\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport { badgeAnimationPresets } from \"./animations\";\nimport type { BadgeProps } from \"./types\";\nimport { badgeCloseButtonVariants, badgeVariants } from \"./variants\";\n\nexport function Badge(props: BadgeProps) {\n const {\n className,\n appearance,\n size,\n shape,\n animation = \"none\",\n closable = false,\n onClose,\n closeLabel = \"Remove\",\n children,\n ref,\n \"aria-label\": ariaLabel,\n ...rest\n } = props;\n const motionProps = badgeAnimationPresets[animation];\n const isDot = shape === \"dot\";\n const resolvedAriaLabel =\n ariaLabel ?? (isDot ? \"Status indicator\" : undefined);\n\n return (\n <motion.span\n ref={ref}\n role=\"status\"\n data-slot=\"badge\"\n aria-label={resolvedAriaLabel}\n className={cn(badgeVariants({ appearance, size, shape }), className)}\n initial={animation === \"none\" ? false : undefined}\n {...motionProps}\n {...rest}\n >\n {!isDot ? children : null}\n {closable ? (\n <button\n type=\"button\"\n data-slot=\"badge-close\"\n aria-label={closeLabel}\n onClick={onClose}\n className={badgeCloseButtonVariants({ size })}\n >\n <HiXMark className=\"size-3.5\" aria-hidden />\n </button>\n ) : null}\n </motion.span>\n );\n}\n\nBadge.displayName = \"Badge\";\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}","import type { HTMLMotionProps } from \"framer-motion\";\n\nimport type { BadgeAnimation } from \"./types\";\n\ntype BadgePresetMotionProps = Pick<\n HTMLMotionProps<\"span\">,\n \"style\" | \"transition\" | \"whileHover\" | \"whileTap\" | \"animate\" | \"initial\"\n>;\n\nexport type BadgeAnimationPresets = Record<\n BadgeAnimation,\n BadgePresetMotionProps\n>;\n\nexport const badgeAnimationPresets: BadgeAnimationPresets = {\n none: {},\n pop: {\n initial: { scale: 0.92, opacity: 0 },\n animate: { scale: 1, opacity: 1 },\n transition: { type: \"spring\", stiffness: 520, damping: 28 },\n },\n bounce: {\n whileHover: { y: -2, scale: 1.04 },\n whileTap: { scale: 0.96 },\n transition: { type: \"spring\", bounce: 0.45, stiffness: 420, damping: 18 },\n },\n fade: {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n transition: { duration: 0.2 },\n },\n};\n","import { cva } from \"class-variance-authority\";\n\n/**\n * Tailwind class maps mirroring `buttons/variants.ts` appearance tokens.\n * Reused by primitives that should stay visually aligned with Button.\n */\nexport const buttonLikeSolidAppearances = {\n default:\n \"bg-slate-50 text-slate-950 shadow-[0_1px_2px_rgba(15,23,42,0.12)]\",\n secondary: \"bg-slate-800 text-slate-50\",\n destructive: \"bg-rose-600 text-white\",\n outline: \"border border-white/10 bg-white/5 text-slate-50\",\n ghost: \"bg-transparent text-slate-200\",\n glass: \"border border-white/15 bg-white/10 text-white backdrop-blur-md\",\n emerald: \"bg-emerald-600 text-white\",\n indigo: \"bg-indigo-600 text-white\",\n purple: \"bg-purple-600 text-white\",\n pink: \"bg-pink-600 text-white\",\n rose: \"bg-rose-600 text-white\",\n sky: \"bg-sky-600 text-white\",\n teal: \"bg-teal-600 text-white\",\n yellow: \"bg-yellow-600 text-white\",\n orange: \"bg-orange-600 text-white\",\n \"gradient-blue\":\n \"bg-gradient-to-r from-blue-600 to-purple-600 text-white\",\n \"gradient-green\":\n \"bg-gradient-to-r from-green-600 to-lime-600 text-white\",\n \"gradient-red\":\n \"bg-gradient-to-r from-red-600 to-pink-600 text-white\",\n \"gradient-yellow\":\n \"bg-gradient-to-r from-yellow-600 to-orange-600 text-white\",\n \"gradient-purple\":\n \"bg-gradient-to-r from-purple-600 to-pink-600 text-white\",\n \"gradient-teal\":\n \"bg-gradient-to-r from-teal-600 to-cyan-600 text-white\",\n \"gradient-indigo\":\n \"bg-gradient-to-r from-indigo-600 to-purple-600 text-white\",\n \"gradient-pink\":\n \"bg-gradient-to-r from-pink-600 to-rose-600 text-white\",\n \"gradient-orange\":\n \"bg-gradient-to-r from-orange-600 to-red-600 text-white\",\n} as const;\n\nexport type ButtonLikeSolidAppearance = keyof typeof buttonLikeSolidAppearances;\n\n\nconst badgeAppearances = {\n ...buttonLikeSolidAppearances,\n outline:\n \"border border-white/15 bg-transparent text-slate-200 shadow-none\",\n ghost: \"bg-transparent text-slate-300 shadow-none\",\n} as const;\n\nexport const badgeVariants = cva(\n [\n \"inline-flex max-w-full items-center justify-center gap-1 font-medium\",\n \"whitespace-nowrap ring-offset-slate-950 transition-colors\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-300 focus-visible:ring-offset-2\",\n \"select-none\",\n ],\n {\n variants: {\n appearance: badgeAppearances,\n size: {\n sm: \"h-6 min-h-6 px-2 text-[0.65rem] leading-none\",\n md: \"h-7 min-h-7 px-2.5 text-xs leading-none\",\n lg: \"h-8 min-h-8 px-3 text-sm leading-none\",\n },\n shape: {\n pill: \"rounded-full\",\n square: \"rounded-md\",\n dot: \"h-2.5 min-h-2.5 w-2.5 min-w-2.5 rounded-full p-0 px-0 text-[0]\",\n },\n },\n defaultVariants: {\n appearance: \"default\",\n size: \"md\",\n shape: \"pill\",\n },\n },\n);\n\nexport const badgeCloseButtonVariants = cva(\n \"inline-flex shrink-0 items-center justify-center rounded-md p-0.5 text-current opacity-70 transition hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/40\",\n {\n variants: {\n size: {\n sm: \"size-4\",\n md: \"size-5\",\n lg: \"size-6\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n);\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { HTMLMotionProps } from 'framer-motion';
|
|
4
|
+
import { MouseEventHandler, ReactNode } from 'react';
|
|
5
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
|
+
|
|
7
|
+
declare const badgeVariants: (props?: ({
|
|
8
|
+
appearance?: "default" | "outline" | "ghost" | "sky" | "rose" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "emerald" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | "secondary" | "destructive" | "glass" | null | undefined;
|
|
9
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
10
|
+
shape?: "pill" | "square" | "dot" | null | undefined;
|
|
11
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
|
+
declare const badgeCloseButtonVariants: (props?: ({
|
|
13
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
14
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
|
+
|
|
16
|
+
type BadgeAnimation = "none" | "pop" | "bounce" | "fade";
|
|
17
|
+
type BadgeVariantProps = VariantProps<typeof badgeVariants>;
|
|
18
|
+
type BadgeProps = BadgeVariantProps & Omit<HTMLMotionProps<"span">, "children"> & {
|
|
19
|
+
animation?: BadgeAnimation;
|
|
20
|
+
closable?: boolean;
|
|
21
|
+
onClose?: MouseEventHandler<HTMLButtonElement>;
|
|
22
|
+
closeLabel?: string;
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
/** Dot shape hides text; set for accessibility. */
|
|
25
|
+
"aria-label"?: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
declare function Badge(props: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
29
|
+
declare namespace Badge {
|
|
30
|
+
var displayName: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type BadgePresetMotionProps = Pick<HTMLMotionProps<"span">, "style" | "transition" | "whileHover" | "whileTap" | "animate" | "initial">;
|
|
34
|
+
type BadgeAnimationPresets = Record<BadgeAnimation, BadgePresetMotionProps>;
|
|
35
|
+
declare const badgeAnimationPresets: BadgeAnimationPresets;
|
|
36
|
+
|
|
37
|
+
export { Badge, type BadgeAnimation, type BadgeProps, badgeAnimationPresets, badgeCloseButtonVariants, badgeVariants };
|