@zentauri-ui/zentauri-components 1.2.0 → 1.2.1
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/dist/chunk-P6YRSEOY.js +225 -0
- package/dist/chunk-P6YRSEOY.js.map +1 -0
- package/dist/chunk-UJ3AER3U.mjs +214 -0
- package/dist/chunk-UJ3AER3U.mjs.map +1 -0
- package/dist/types-BQ2H3yG7.d.mts +34 -0
- package/dist/types-BQ2H3yG7.d.ts +34 -0
- package/dist/ui/alert/animated.d.mts +13 -0
- package/dist/ui/alert/animated.d.ts +13 -0
- package/dist/ui/alert/animated.js +27 -0
- package/dist/ui/alert/animated.js.map +1 -0
- package/dist/ui/alert/animated.mjs +25 -0
- package/dist/ui/alert/animated.mjs.map +1 -0
- package/dist/ui/alert.d.mts +11 -36
- package/dist/ui/alert.d.ts +11 -36
- package/dist/ui/alert.js +40 -218
- package/dist/ui/alert.js.map +1 -1
- package/dist/ui/alert.mjs +7 -211
- package/dist/ui/alert.mjs.map +1 -1
- package/package.json +7 -2
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkUOZYPWDZ_js = require('./chunk-UOZYPWDZ.js');
|
|
4
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var hi2 = require('react-icons/hi2');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
var alertVariants = classVarianceAuthority.cva(
|
|
10
|
+
"relative flex w-full gap-3 border text-sm ring-offset-slate-950 transition-colors",
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
appearance: {
|
|
14
|
+
default: "border-white/10 bg-white/5 text-slate-50",
|
|
15
|
+
success: "border-emerald-500/40 bg-emerald-500/10 text-emerald-50",
|
|
16
|
+
warning: "border-amber-500/40 bg-amber-500/10 text-amber-50",
|
|
17
|
+
error: "border-rose-500/50 bg-rose-500/10 text-rose-50",
|
|
18
|
+
info: "border-sky-500/40 bg-sky-500/10 text-sky-50",
|
|
19
|
+
ghost: "border-transparent bg-transparent text-slate-200",
|
|
20
|
+
purple: "border-purple-600 bg-purple-950/70 backdrop-blur-xl",
|
|
21
|
+
pink: "border-pink-600 bg-pink-950/70 backdrop-blur-xl",
|
|
22
|
+
orange: "border-orange-600 bg-orange-950/70 backdrop-blur-xl",
|
|
23
|
+
yellow: "border-yellow-600 bg-yellow-950/70 backdrop-blur-xl",
|
|
24
|
+
teal: "border-teal-600 bg-teal-950/70 backdrop-blur-xl",
|
|
25
|
+
indigo: "border-indigo-600 bg-indigo-950/70 backdrop-blur-xl",
|
|
26
|
+
gray: "border-gray-600 bg-gray-950/70 backdrop-blur-xl",
|
|
27
|
+
violet: "border-violet-600 bg-violet-950/70 backdrop-blur-xl",
|
|
28
|
+
"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",
|
|
29
|
+
"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",
|
|
30
|
+
"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",
|
|
31
|
+
"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",
|
|
32
|
+
"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",
|
|
33
|
+
"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",
|
|
34
|
+
"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",
|
|
35
|
+
"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",
|
|
36
|
+
"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"
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
sm: "rounded-lg p-3",
|
|
40
|
+
md: "rounded-xl p-4",
|
|
41
|
+
lg: "rounded-2xl p-5 text-base"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
appearance: "default",
|
|
46
|
+
size: "md"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
var alertTitleVariants = classVarianceAuthority.cva("font-semibold leading-tight", {
|
|
51
|
+
variants: {
|
|
52
|
+
size: {
|
|
53
|
+
sm: "text-xs md:text-sm",
|
|
54
|
+
md: "text-xs md:text-sm",
|
|
55
|
+
lg: "text-xs md:text-sm"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
defaultVariants: { size: "md" }
|
|
59
|
+
});
|
|
60
|
+
var alertDescriptionVariants = classVarianceAuthority.cva("text-slate-300", {
|
|
61
|
+
variants: {
|
|
62
|
+
size: {
|
|
63
|
+
sm: "text-xs md:text-sm",
|
|
64
|
+
md: "text-xs md:text-sm",
|
|
65
|
+
lg: "text-xs md:text-sm"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
defaultVariants: { size: "md" }
|
|
69
|
+
});
|
|
70
|
+
var AlertSizeContext = react.createContext("md");
|
|
71
|
+
function useAlertSize() {
|
|
72
|
+
const ctx = react.useContext(AlertSizeContext);
|
|
73
|
+
if (!ctx) {
|
|
74
|
+
throw new Error("useAlertSize must be used within an Alert");
|
|
75
|
+
}
|
|
76
|
+
return ctx;
|
|
77
|
+
}
|
|
78
|
+
function AlertBase(props) {
|
|
79
|
+
const {
|
|
80
|
+
className,
|
|
81
|
+
triggerClassName,
|
|
82
|
+
appearance = "default",
|
|
83
|
+
size = "md",
|
|
84
|
+
closable = false,
|
|
85
|
+
onClose,
|
|
86
|
+
closeLabel = "Dismiss alert",
|
|
87
|
+
children,
|
|
88
|
+
ref,
|
|
89
|
+
as: Wrapper = "div",
|
|
90
|
+
...rest
|
|
91
|
+
} = props;
|
|
92
|
+
const live = appearance === "error" ? "assertive" : "polite";
|
|
93
|
+
const ctx = react.useMemo(() => size ?? "md", [size]);
|
|
94
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AlertSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
95
|
+
Wrapper,
|
|
96
|
+
{
|
|
97
|
+
ref,
|
|
98
|
+
"data-slot": "alert",
|
|
99
|
+
role: "alert",
|
|
100
|
+
"aria-live": live,
|
|
101
|
+
className: chunkUOZYPWDZ_js.cn(
|
|
102
|
+
alertVariants({ appearance, size }),
|
|
103
|
+
closable ? "pr-12" : "",
|
|
104
|
+
className
|
|
105
|
+
),
|
|
106
|
+
...rest,
|
|
107
|
+
children: [
|
|
108
|
+
children,
|
|
109
|
+
closable ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
110
|
+
"button",
|
|
111
|
+
{
|
|
112
|
+
type: "button",
|
|
113
|
+
"data-slot": "alert-close",
|
|
114
|
+
"aria-label": closeLabel,
|
|
115
|
+
onClick: onClose,
|
|
116
|
+
className: chunkUOZYPWDZ_js.cn(
|
|
117
|
+
"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",
|
|
118
|
+
triggerClassName
|
|
119
|
+
),
|
|
120
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(hi2.HiXMark, { className: "size-4", "aria-hidden": true })
|
|
121
|
+
}
|
|
122
|
+
) : null
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
) });
|
|
126
|
+
}
|
|
127
|
+
AlertBase.displayName = "AlertBase";
|
|
128
|
+
function AlertIcon({ className, children }) {
|
|
129
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
130
|
+
"span",
|
|
131
|
+
{
|
|
132
|
+
"data-slot": "alert-icon",
|
|
133
|
+
className: chunkUOZYPWDZ_js.cn("mt-0.5 shrink-0 text-current", className),
|
|
134
|
+
children
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
AlertIcon.displayName = "AlertIcon";
|
|
139
|
+
function AlertTitle({ className, children }) {
|
|
140
|
+
const size = useAlertSize();
|
|
141
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
142
|
+
"div",
|
|
143
|
+
{
|
|
144
|
+
"data-slot": "alert-title",
|
|
145
|
+
className: chunkUOZYPWDZ_js.cn(alertTitleVariants({ size }), className),
|
|
146
|
+
children
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
AlertTitle.displayName = "AlertTitle";
|
|
151
|
+
function AlertDescription({ className, children }) {
|
|
152
|
+
const size = useAlertSize();
|
|
153
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
154
|
+
"div",
|
|
155
|
+
{
|
|
156
|
+
"data-slot": "alert-description",
|
|
157
|
+
className: chunkUOZYPWDZ_js.cn(alertDescriptionVariants({ size }), className),
|
|
158
|
+
children
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
AlertDescription.displayName = "AlertDescription";
|
|
163
|
+
function AlertClose({
|
|
164
|
+
className,
|
|
165
|
+
children,
|
|
166
|
+
"aria-label": ariaLabel = "Dismiss alert",
|
|
167
|
+
onClick
|
|
168
|
+
}) {
|
|
169
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
170
|
+
"button",
|
|
171
|
+
{
|
|
172
|
+
type: "button",
|
|
173
|
+
"data-slot": "alert-close",
|
|
174
|
+
"aria-label": ariaLabel,
|
|
175
|
+
onClick,
|
|
176
|
+
className: chunkUOZYPWDZ_js.cn(
|
|
177
|
+
"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",
|
|
178
|
+
className
|
|
179
|
+
),
|
|
180
|
+
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(hi2.HiXMark, { className: "size-4", "aria-hidden": true })
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
AlertClose.displayName = "AlertClose";
|
|
185
|
+
function AlertDefaultIcon({
|
|
186
|
+
appearance
|
|
187
|
+
}) {
|
|
188
|
+
if (appearance === "error") {
|
|
189
|
+
return /* @__PURE__ */ jsxRuntime.jsx(hi2.HiExclamationTriangle, { className: "size-5", "aria-hidden": true });
|
|
190
|
+
}
|
|
191
|
+
return /* @__PURE__ */ jsxRuntime.jsx(hi2.HiInformationCircle, { className: "size-5", "aria-hidden": true });
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// src/ui/alert/animations.ts
|
|
195
|
+
var alertAnimationPresets = {
|
|
196
|
+
none: {},
|
|
197
|
+
"slide-down": {
|
|
198
|
+
initial: { y: -8, opacity: 0 },
|
|
199
|
+
animate: { y: 0, opacity: 1 },
|
|
200
|
+
transition: { type: "spring", stiffness: 420, damping: 30 }
|
|
201
|
+
},
|
|
202
|
+
fade: {
|
|
203
|
+
initial: { opacity: 0 },
|
|
204
|
+
animate: { opacity: 1 },
|
|
205
|
+
transition: { duration: 0.2 }
|
|
206
|
+
},
|
|
207
|
+
pop: {
|
|
208
|
+
initial: { scale: 0.96, opacity: 0 },
|
|
209
|
+
animate: { scale: 1, opacity: 1 },
|
|
210
|
+
transition: { type: "spring", stiffness: 520, damping: 28 }
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
exports.AlertBase = AlertBase;
|
|
215
|
+
exports.AlertClose = AlertClose;
|
|
216
|
+
exports.AlertDefaultIcon = AlertDefaultIcon;
|
|
217
|
+
exports.AlertDescription = AlertDescription;
|
|
218
|
+
exports.AlertIcon = AlertIcon;
|
|
219
|
+
exports.AlertTitle = AlertTitle;
|
|
220
|
+
exports.alertAnimationPresets = alertAnimationPresets;
|
|
221
|
+
exports.alertDescriptionVariants = alertDescriptionVariants;
|
|
222
|
+
exports.alertTitleVariants = alertTitleVariants;
|
|
223
|
+
exports.alertVariants = alertVariants;
|
|
224
|
+
//# sourceMappingURL=chunk-P6YRSEOY.js.map
|
|
225
|
+
//# sourceMappingURL=chunk-P6YRSEOY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/alert/variants.ts","../src/ui/alert/alert-base.tsx","../src/ui/alert/animations.ts"],"names":["cva","createContext","useContext","useMemo","jsx","jsxs","cn","HiXMark","HiExclamationTriangle","HiInformationCircle"],"mappings":";;;;;;;;AAEO,IAAM,aAAA,GAAgBA,0BAAA;AAAA,EAC3B,mFAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,UAAA,EAAY;AAAA,QACV,OAAA,EAAS,0CAAA;AAAA,QACT,OAAA,EAAS,yDAAA;AAAA,QACT,OAAA,EAAS,mDAAA;AAAA,QACT,KAAA,EAAO,gDAAA;AAAA,QACP,IAAA,EAAM,6CAAA;AAAA,QACN,KAAA,EAAO,kDAAA;AAAA,QACP,MAAA,EAAQ,qDAAA;AAAA,QACR,IAAA,EAAM,iDAAA;AAAA,QACN,MAAA,EAAQ,qDAAA;AAAA,QACR,MAAA,EAAQ,qDAAA;AAAA,QACR,IAAA,EAAM,iDAAA;AAAA,QACN,MAAA,EAAQ,qDAAA;AAAA,QACR,IAAA,EAAM,iDAAA;AAAA,QACN,MAAA,EAAQ,qDAAA;AAAA,QACR,eAAA,EACE,sHAAA;AAAA,QACF,gBAAA,EACE,oHAAA;AAAA,QACF,cAAA,EACE,gHAAA;AAAA,QACF,iBAAA,EACE,0HAAA;AAAA,QACF,iBAAA,EACE,sHAAA;AAAA,QACF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,EAAO,CAAA,EAAG,SAAS,CAAA,EAAE;AAAA,IAChC,YAAY,EAAE,IAAA,EAAM,UAAU,SAAA,EAAW,GAAA,EAAK,SAAS,EAAA;AAAG;AAE9D","file":"chunk-P6YRSEOY.js","sourcesContent":["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\":\n \"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\":\n \"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\":\n \"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\":\n \"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\":\n \"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\":\n \"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\":\n \"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\":\n \"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\":\n \"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","\"use client\";\n\nimport { createContext, useContext, useMemo } from \"react\";\nimport {\n HiExclamationTriangle,\n HiInformationCircle,\n HiXMark,\n} from \"react-icons/hi2\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { AlertBaseProps, 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 AlertBase(props: AlertBaseProps) {\n const {\n className,\n triggerClassName,\n appearance = \"default\",\n size = \"md\",\n closable = false,\n onClose,\n closeLabel = \"Dismiss alert\",\n children,\n ref,\n as: Wrapper = \"div\",\n ...rest\n } = props;\n\n const live = appearance === \"error\" ? \"assertive\" : \"polite\";\n const ctx = useMemo(() => size ?? \"md\", [size]);\n\n return (\n <AlertSizeContext.Provider value={ctx}>\n <Wrapper\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 {...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 </Wrapper>\n </AlertSizeContext.Provider>\n );\n}\n\nAlertBase.displayName = \"AlertBase\";\n\nexport function AlertIcon({ className, children }: AlertSectionProps) {\n return (\n <span\n data-slot=\"alert-icon\"\n className={cn(\"mt-0.5 shrink-0 text-current\", className)}\n >\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\n data-slot=\"alert-title\"\n className={cn(alertTitleVariants({ size }), className)}\n >\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({\n appearance,\n}: {\n appearance?: AlertProps[\"appearance\"];\n}) {\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 { 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<\n AlertAnimation,\n AlertPresetMotionProps\n>;\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"]}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { cn } from './chunk-DFEZH7TC.mjs';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { createContext, useMemo, useContext } from 'react';
|
|
4
|
+
import { HiXMark, HiExclamationTriangle, HiInformationCircle } from 'react-icons/hi2';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var alertVariants = cva(
|
|
8
|
+
"relative flex w-full gap-3 border text-sm ring-offset-slate-950 transition-colors",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
appearance: {
|
|
12
|
+
default: "border-white/10 bg-white/5 text-slate-50",
|
|
13
|
+
success: "border-emerald-500/40 bg-emerald-500/10 text-emerald-50",
|
|
14
|
+
warning: "border-amber-500/40 bg-amber-500/10 text-amber-50",
|
|
15
|
+
error: "border-rose-500/50 bg-rose-500/10 text-rose-50",
|
|
16
|
+
info: "border-sky-500/40 bg-sky-500/10 text-sky-50",
|
|
17
|
+
ghost: "border-transparent bg-transparent text-slate-200",
|
|
18
|
+
purple: "border-purple-600 bg-purple-950/70 backdrop-blur-xl",
|
|
19
|
+
pink: "border-pink-600 bg-pink-950/70 backdrop-blur-xl",
|
|
20
|
+
orange: "border-orange-600 bg-orange-950/70 backdrop-blur-xl",
|
|
21
|
+
yellow: "border-yellow-600 bg-yellow-950/70 backdrop-blur-xl",
|
|
22
|
+
teal: "border-teal-600 bg-teal-950/70 backdrop-blur-xl",
|
|
23
|
+
indigo: "border-indigo-600 bg-indigo-950/70 backdrop-blur-xl",
|
|
24
|
+
gray: "border-gray-600 bg-gray-950/70 backdrop-blur-xl",
|
|
25
|
+
violet: "border-violet-600 bg-violet-950/70 backdrop-blur-xl",
|
|
26
|
+
"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",
|
|
27
|
+
"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",
|
|
28
|
+
"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",
|
|
29
|
+
"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",
|
|
30
|
+
"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",
|
|
31
|
+
"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",
|
|
32
|
+
"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",
|
|
33
|
+
"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",
|
|
34
|
+
"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"
|
|
35
|
+
},
|
|
36
|
+
size: {
|
|
37
|
+
sm: "rounded-lg p-3",
|
|
38
|
+
md: "rounded-xl p-4",
|
|
39
|
+
lg: "rounded-2xl p-5 text-base"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
appearance: "default",
|
|
44
|
+
size: "md"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
var alertTitleVariants = cva("font-semibold leading-tight", {
|
|
49
|
+
variants: {
|
|
50
|
+
size: {
|
|
51
|
+
sm: "text-xs md:text-sm",
|
|
52
|
+
md: "text-xs md:text-sm",
|
|
53
|
+
lg: "text-xs md:text-sm"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: { size: "md" }
|
|
57
|
+
});
|
|
58
|
+
var alertDescriptionVariants = cva("text-slate-300", {
|
|
59
|
+
variants: {
|
|
60
|
+
size: {
|
|
61
|
+
sm: "text-xs md:text-sm",
|
|
62
|
+
md: "text-xs md:text-sm",
|
|
63
|
+
lg: "text-xs md:text-sm"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: { size: "md" }
|
|
67
|
+
});
|
|
68
|
+
var AlertSizeContext = createContext("md");
|
|
69
|
+
function useAlertSize() {
|
|
70
|
+
const ctx = useContext(AlertSizeContext);
|
|
71
|
+
if (!ctx) {
|
|
72
|
+
throw new Error("useAlertSize must be used within an Alert");
|
|
73
|
+
}
|
|
74
|
+
return ctx;
|
|
75
|
+
}
|
|
76
|
+
function AlertBase(props) {
|
|
77
|
+
const {
|
|
78
|
+
className,
|
|
79
|
+
triggerClassName,
|
|
80
|
+
appearance = "default",
|
|
81
|
+
size = "md",
|
|
82
|
+
closable = false,
|
|
83
|
+
onClose,
|
|
84
|
+
closeLabel = "Dismiss alert",
|
|
85
|
+
children,
|
|
86
|
+
ref,
|
|
87
|
+
as: Wrapper = "div",
|
|
88
|
+
...rest
|
|
89
|
+
} = props;
|
|
90
|
+
const live = appearance === "error" ? "assertive" : "polite";
|
|
91
|
+
const ctx = useMemo(() => size ?? "md", [size]);
|
|
92
|
+
return /* @__PURE__ */ jsx(AlertSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
|
|
93
|
+
Wrapper,
|
|
94
|
+
{
|
|
95
|
+
ref,
|
|
96
|
+
"data-slot": "alert",
|
|
97
|
+
role: "alert",
|
|
98
|
+
"aria-live": live,
|
|
99
|
+
className: cn(
|
|
100
|
+
alertVariants({ appearance, size }),
|
|
101
|
+
closable ? "pr-12" : "",
|
|
102
|
+
className
|
|
103
|
+
),
|
|
104
|
+
...rest,
|
|
105
|
+
children: [
|
|
106
|
+
children,
|
|
107
|
+
closable ? /* @__PURE__ */ jsx(
|
|
108
|
+
"button",
|
|
109
|
+
{
|
|
110
|
+
type: "button",
|
|
111
|
+
"data-slot": "alert-close",
|
|
112
|
+
"aria-label": closeLabel,
|
|
113
|
+
onClick: onClose,
|
|
114
|
+
className: cn(
|
|
115
|
+
"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",
|
|
116
|
+
triggerClassName
|
|
117
|
+
),
|
|
118
|
+
children: /* @__PURE__ */ jsx(HiXMark, { className: "size-4", "aria-hidden": true })
|
|
119
|
+
}
|
|
120
|
+
) : null
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
) });
|
|
124
|
+
}
|
|
125
|
+
AlertBase.displayName = "AlertBase";
|
|
126
|
+
function AlertIcon({ className, children }) {
|
|
127
|
+
return /* @__PURE__ */ jsx(
|
|
128
|
+
"span",
|
|
129
|
+
{
|
|
130
|
+
"data-slot": "alert-icon",
|
|
131
|
+
className: cn("mt-0.5 shrink-0 text-current", className),
|
|
132
|
+
children
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
AlertIcon.displayName = "AlertIcon";
|
|
137
|
+
function AlertTitle({ className, children }) {
|
|
138
|
+
const size = useAlertSize();
|
|
139
|
+
return /* @__PURE__ */ jsx(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
"data-slot": "alert-title",
|
|
143
|
+
className: cn(alertTitleVariants({ size }), className),
|
|
144
|
+
children
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
AlertTitle.displayName = "AlertTitle";
|
|
149
|
+
function AlertDescription({ className, children }) {
|
|
150
|
+
const size = useAlertSize();
|
|
151
|
+
return /* @__PURE__ */ jsx(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
"data-slot": "alert-description",
|
|
155
|
+
className: cn(alertDescriptionVariants({ size }), className),
|
|
156
|
+
children
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
AlertDescription.displayName = "AlertDescription";
|
|
161
|
+
function AlertClose({
|
|
162
|
+
className,
|
|
163
|
+
children,
|
|
164
|
+
"aria-label": ariaLabel = "Dismiss alert",
|
|
165
|
+
onClick
|
|
166
|
+
}) {
|
|
167
|
+
return /* @__PURE__ */ jsx(
|
|
168
|
+
"button",
|
|
169
|
+
{
|
|
170
|
+
type: "button",
|
|
171
|
+
"data-slot": "alert-close",
|
|
172
|
+
"aria-label": ariaLabel,
|
|
173
|
+
onClick,
|
|
174
|
+
className: cn(
|
|
175
|
+
"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",
|
|
176
|
+
className
|
|
177
|
+
),
|
|
178
|
+
children: children ?? /* @__PURE__ */ jsx(HiXMark, { className: "size-4", "aria-hidden": true })
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
AlertClose.displayName = "AlertClose";
|
|
183
|
+
function AlertDefaultIcon({
|
|
184
|
+
appearance
|
|
185
|
+
}) {
|
|
186
|
+
if (appearance === "error") {
|
|
187
|
+
return /* @__PURE__ */ jsx(HiExclamationTriangle, { className: "size-5", "aria-hidden": true });
|
|
188
|
+
}
|
|
189
|
+
return /* @__PURE__ */ jsx(HiInformationCircle, { className: "size-5", "aria-hidden": true });
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/ui/alert/animations.ts
|
|
193
|
+
var alertAnimationPresets = {
|
|
194
|
+
none: {},
|
|
195
|
+
"slide-down": {
|
|
196
|
+
initial: { y: -8, opacity: 0 },
|
|
197
|
+
animate: { y: 0, opacity: 1 },
|
|
198
|
+
transition: { type: "spring", stiffness: 420, damping: 30 }
|
|
199
|
+
},
|
|
200
|
+
fade: {
|
|
201
|
+
initial: { opacity: 0 },
|
|
202
|
+
animate: { opacity: 1 },
|
|
203
|
+
transition: { duration: 0.2 }
|
|
204
|
+
},
|
|
205
|
+
pop: {
|
|
206
|
+
initial: { scale: 0.96, opacity: 0 },
|
|
207
|
+
animate: { scale: 1, opacity: 1 },
|
|
208
|
+
transition: { type: "spring", stiffness: 520, damping: 28 }
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export { AlertBase, AlertClose, AlertDefaultIcon, AlertDescription, AlertIcon, AlertTitle, alertAnimationPresets, alertDescriptionVariants, alertTitleVariants, alertVariants };
|
|
213
|
+
//# sourceMappingURL=chunk-UJ3AER3U.mjs.map
|
|
214
|
+
//# sourceMappingURL=chunk-UJ3AER3U.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/alert/variants.ts","../src/ui/alert/alert-base.tsx","../src/ui/alert/animations.ts"],"names":[],"mappings":";;;;;;AAEO,IAAM,aAAA,GAAgB,GAAA;AAAA,EAC3B,mFAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,UAAA,EAAY;AAAA,QACV,OAAA,EAAS,0CAAA;AAAA,QACT,OAAA,EAAS,yDAAA;AAAA,QACT,OAAA,EAAS,mDAAA;AAAA,QACT,KAAA,EAAO,gDAAA;AAAA,QACP,IAAA,EAAM,6CAAA;AAAA,QACN,KAAA,EAAO,kDAAA;AAAA,QACP,MAAA,EAAQ,qDAAA;AAAA,QACR,IAAA,EAAM,iDAAA;AAAA,QACN,MAAA,EAAQ,qDAAA;AAAA,QACR,MAAA,EAAQ,qDAAA;AAAA,QACR,IAAA,EAAM,iDAAA;AAAA,QACN,MAAA,EAAQ,qDAAA;AAAA,QACR,IAAA,EAAM,iDAAA;AAAA,QACN,MAAA,EAAQ,qDAAA;AAAA,QACR,eAAA,EACE,sHAAA;AAAA,QACF,gBAAA,EACE,oHAAA;AAAA,QACF,cAAA,EACE,gHAAA;AAAA,QACF,iBAAA,EACE,0HAAA;AAAA,QACF,iBAAA,EACE,sHAAA;AAAA,QACF,eAAA,EACE,kHAAA;AAAA,QACF,iBAAA,EACE,0HAAA;AAAA,QACF,eAAA,EACE,kHAAA;AAAA,QACF,iBAAA,EACE;AAAA,OACJ;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,gBAAA;AAAA,QACJ,EAAA,EAAI,gBA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ACvD;AAEJ;AAEA,UAAA,CAAW,WAAA,GAAc,YAAA;AAElB,SAAS,gBAAA,CAAiB;AAAA,EAC/B;AACF,CAAA,EAEG;AACD,EAAA,IAAI,eAAe,OAAA,EAAS;AAC1B,IAAA,uBAAO,GAAA,CAAC,qBAAA,EAAA,EAAsB,SAAA,EAAU,QAAA,EAAS,eAAW,IAAA,EAAC,CAAA;AAAA,EAC/D;AACA,EAAA,uBAAO,GAAA,CAAC,mBAAA,EAAA,EAAoB,SAAA,EAAU,QAAA,EAAS,eAAW,IAAA,EAAC,CAAA;AAC7D;;;AC9IO,IAAM,qBAAA,GAA+C;AAAA,EAC1D,MAAM,EAAC;AAAA,EACP,YAAA,EAAc;AAAA,IACZ,OAAA,EAAS,EAAE,CAAA,EAAG,EAAA,EAAI,SAAS,CAAA,EAAE;AAAA,IAC7B,OAAA,EAAS,EAAE,CAAA,EAAG,CAAA,EAAG,SAAS,CAAA,EAAE;AAAA,IAC5B,YAAY,EAAE,IAAA,EAAM,UAAU,SAAA,EAAW,GAAA,EAAK,SAAS,EAAA;AAAG,GAC5D;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,OAAA,EAAS,EAAE,OAAA,EAAS,CAAA,EAAE;AAAA,IACtB,OAAA,EAAS,EAAE,OAAA,EAAS,CAAA,EAAE;AAAA,IACtB,UAAA,EAAY,EAAE,QAAA,EAAU,GAAA;AAAI,GAC9B;AAAA,EACA,GAAA,EAAK;AAAA,IACH,OAAA,EAAS,EAAE,KAAA,EAAO,IAAA,EAAM,SAAS,CAAA,EAAE;AAAA,IACnC,OAAA,EAAS,EAAE,KAAA,EAAO,CAAA,EAAG,SAAS,CAAA,EAAE;AAAA,IAChC,YAAY,EAAE,IAAA,EAAM,UAAU,SAAA,EAAW,GAAA,EAAK,SAAS,EAAA;AAAG;AAE9D","file":"chunk-UJ3AER3U.mjs","sourcesContent":["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\":\n \"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\":\n \"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\":\n \"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\":\n \"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\":\n \"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\":\n \"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\":\n \"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\":\n \"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\":\n \"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","\"use client\";\n\nimport { createContext, useContext, useMemo } from \"react\";\nimport {\n HiExclamationTriangle,\n HiInformationCircle,\n HiXMark,\n} from \"react-icons/hi2\";\n\nimport { cn } from \"../../lib/utils\";\n\nimport type { AlertBaseProps, 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 AlertBase(props: AlertBaseProps) {\n const {\n className,\n triggerClassName,\n appearance = \"default\",\n size = \"md\",\n closable = false,\n onClose,\n closeLabel = \"Dismiss alert\",\n children,\n ref,\n as: Wrapper = \"div\",\n ...rest\n } = props;\n\n const live = appearance === \"error\" ? \"assertive\" : \"polite\";\n const ctx = useMemo(() => size ?? \"md\", [size]);\n\n return (\n <AlertSizeContext.Provider value={ctx}>\n <Wrapper\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 {...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 </Wrapper>\n </AlertSizeContext.Provider>\n );\n}\n\nAlertBase.displayName = \"AlertBase\";\n\nexport function AlertIcon({ className, children }: AlertSectionProps) {\n return (\n <span\n data-slot=\"alert-icon\"\n className={cn(\"mt-0.5 shrink-0 text-current\", className)}\n >\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\n data-slot=\"alert-title\"\n className={cn(alertTitleVariants({ size }), className)}\n >\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({\n appearance,\n}: {\n appearance?: AlertProps[\"appearance\"];\n}) {\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 { 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<\n AlertAnimation,\n AlertPresetMotionProps\n>;\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"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { ComponentPropsWithRef, ElementType, ReactNode } from 'react';
|
|
3
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
|
+
|
|
5
|
+
declare const alertVariants: (props?: ({
|
|
6
|
+
appearance?: "default" | "success" | "warning" | "error" | "info" | "ghost" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "gray" | "violet" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | null | undefined;
|
|
7
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
+
declare const alertTitleVariants: (props?: ({
|
|
10
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
11
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
|
+
declare const alertDescriptionVariants: (props?: ({
|
|
13
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
14
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
|
+
|
|
16
|
+
type AlertAnimation = "none" | "slide-down" | "fade" | "pop";
|
|
17
|
+
type AlertAppearance = VariantProps<typeof alertVariants>["appearance"];
|
|
18
|
+
type AlertSize = VariantProps<typeof alertVariants>["size"];
|
|
19
|
+
interface AlertBaseProps extends ComponentPropsWithRef<"div"> {
|
|
20
|
+
appearance?: AlertAppearance;
|
|
21
|
+
size?: AlertSize;
|
|
22
|
+
closable?: boolean;
|
|
23
|
+
onClose?: () => void;
|
|
24
|
+
closeLabel?: string;
|
|
25
|
+
triggerClassName?: string;
|
|
26
|
+
as?: ElementType;
|
|
27
|
+
}
|
|
28
|
+
type AlertSectionProps = {
|
|
29
|
+
className?: string;
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
};
|
|
32
|
+
type AlertProps = Omit<AlertBaseProps, "as">;
|
|
33
|
+
|
|
34
|
+
export { type AlertBaseProps as A, type AlertAnimation as a, type AlertSectionProps as b, type AlertProps as c, type AlertSize as d, alertDescriptionVariants as e, alertTitleVariants as f, alertVariants as g };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { ComponentPropsWithRef, ElementType, ReactNode } from 'react';
|
|
3
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
|
+
|
|
5
|
+
declare const alertVariants: (props?: ({
|
|
6
|
+
appearance?: "default" | "success" | "warning" | "error" | "info" | "ghost" | "purple" | "pink" | "orange" | "yellow" | "teal" | "indigo" | "gray" | "violet" | "gradient-blue" | "gradient-green" | "gradient-red" | "gradient-yellow" | "gradient-purple" | "gradient-teal" | "gradient-indigo" | "gradient-pink" | "gradient-orange" | null | undefined;
|
|
7
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
+
declare const alertTitleVariants: (props?: ({
|
|
10
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
11
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
|
+
declare const alertDescriptionVariants: (props?: ({
|
|
13
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
14
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
|
+
|
|
16
|
+
type AlertAnimation = "none" | "slide-down" | "fade" | "pop";
|
|
17
|
+
type AlertAppearance = VariantProps<typeof alertVariants>["appearance"];
|
|
18
|
+
type AlertSize = VariantProps<typeof alertVariants>["size"];
|
|
19
|
+
interface AlertBaseProps extends ComponentPropsWithRef<"div"> {
|
|
20
|
+
appearance?: AlertAppearance;
|
|
21
|
+
size?: AlertSize;
|
|
22
|
+
closable?: boolean;
|
|
23
|
+
onClose?: () => void;
|
|
24
|
+
closeLabel?: string;
|
|
25
|
+
triggerClassName?: string;
|
|
26
|
+
as?: ElementType;
|
|
27
|
+
}
|
|
28
|
+
type AlertSectionProps = {
|
|
29
|
+
className?: string;
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
};
|
|
32
|
+
type AlertProps = Omit<AlertBaseProps, "as">;
|
|
33
|
+
|
|
34
|
+
export { type AlertBaseProps as A, type AlertAnimation as a, type AlertSectionProps as b, type AlertProps as c, type AlertSize as d, alertDescriptionVariants as e, alertTitleVariants as f, alertVariants as g };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { A as AlertBaseProps, a as AlertAnimation } from '../../types-BQ2H3yG7.mjs';
|
|
3
|
+
import 'class-variance-authority';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'class-variance-authority/types';
|
|
6
|
+
|
|
7
|
+
type AlertAnimatedProps = Omit<AlertBaseProps, "as"> & {
|
|
8
|
+
animation?: AlertAnimation;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
declare const AlertAnimated: ({ animation, ...props }: AlertAnimatedProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { AlertAnimated, type AlertAnimatedProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { A as AlertBaseProps, a as AlertAnimation } from '../../types-BQ2H3yG7.js';
|
|
3
|
+
import 'class-variance-authority';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'class-variance-authority/types';
|
|
6
|
+
|
|
7
|
+
type AlertAnimatedProps = Omit<AlertBaseProps, "as"> & {
|
|
8
|
+
animation?: AlertAnimation;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
declare const AlertAnimated: ({ animation, ...props }: AlertAnimatedProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { AlertAnimated, type AlertAnimatedProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunkP6YRSEOY_js = require('../../chunk-P6YRSEOY.js');
|
|
5
|
+
require('../../chunk-UOZYPWDZ.js');
|
|
6
|
+
var framerMotion = require('framer-motion');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
var AlertAnimated = ({
|
|
10
|
+
animation = "none",
|
|
11
|
+
...props
|
|
12
|
+
}) => {
|
|
13
|
+
const motionProps = chunkP6YRSEOY_js.alertAnimationPresets[animation];
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
+
chunkP6YRSEOY_js.AlertBase,
|
|
16
|
+
{
|
|
17
|
+
as: framerMotion.motion.div,
|
|
18
|
+
initial: animation === "none" ? false : void 0,
|
|
19
|
+
...motionProps,
|
|
20
|
+
...props
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.AlertAnimated = AlertAnimated;
|
|
26
|
+
//# sourceMappingURL=animated.js.map
|
|
27
|
+
//# sourceMappingURL=animated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ui/alert/animated/alert-animated.tsx"],"names":["alertAnimationPresets","jsx","AlertBase","motion"],"mappings":";;;;;;;AAKO,IAAM,gBAAgB,CAAC;AAAA,EAC5B,SAAA,GAAY,MAAA;AAAA,EACZ,GAAG;AACL,CAAA,KAA0B;AACxB,EAAA,MAAM,WAAA,GAAcA,uCAAsB,SAAS,CAAA;AAEnD,EAAA,uBACEC,cAAA;AAAA,IAACC,0BAAA;AAAA,IAAA;AAAA,MACC,IAAIC,mBAAA,CAAO,GAAA;AAAA,MACX,OAAA,EAAS,SAAA,KAAc,MAAA,GAAS,KAAA,GAAQ,MAAA;AAAA,MACvC,GAAG,WAAA;AAAA,MACH,GAAG;AAAA;AAAA,GACN;AAEJ","file":"animated.js","sourcesContent":["import { motion } from \"framer-motion\";\nimport { AlertBase } from \"../alert-base\";\nimport { alertAnimationPresets } from \"../animations\";\nimport type { AlertAnimatedProps } from \"./types\";\n\nexport const AlertAnimated = ({\n animation = \"none\",\n ...props\n}: AlertAnimatedProps) => {\n const motionProps = alertAnimationPresets[animation];\n\n return (\n <AlertBase\n as={motion.div}\n initial={animation === \"none\" ? false : undefined}\n {...motionProps}\n {...props}\n />\n );\n};\n"]}
|