@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.
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { alertAnimationPresets, AlertBase } from '../../chunk-UJ3AER3U.mjs';
3
+ import '../../chunk-DFEZH7TC.mjs';
4
+ import { motion } from 'framer-motion';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ var AlertAnimated = ({
8
+ animation = "none",
9
+ ...props
10
+ }) => {
11
+ const motionProps = alertAnimationPresets[animation];
12
+ return /* @__PURE__ */ jsx(
13
+ AlertBase,
14
+ {
15
+ as: motion.div,
16
+ initial: animation === "none" ? false : void 0,
17
+ ...motionProps,
18
+ ...props
19
+ }
20
+ );
21
+ };
22
+
23
+ export { AlertAnimated };
24
+ //# sourceMappingURL=animated.mjs.map
25
+ //# sourceMappingURL=animated.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/ui/alert/animated/alert-animated.tsx"],"names":[],"mappings":";;;;;AAKO,IAAM,gBAAgB,CAAC;AAAA,EAC5B,SAAA,GAAY,MAAA;AAAA,EACZ,GAAG;AACL,CAAA,KAA0B;AACxB,EAAA,MAAM,WAAA,GAAc,sBAAsB,SAAS,CAAA;AAEnD,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,IAAI,MAAA,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.mjs","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"]}
@@ -1,41 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { VariantProps } from 'class-variance-authority';
2
+ import { b as AlertSectionProps, c as AlertProps, a as AlertAnimation } from '../types-BQ2H3yG7.mjs';
3
+ export { d as AlertSize, e as alertDescriptionVariants, f as alertTitleVariants, g as alertVariants } from '../types-BQ2H3yG7.mjs';
3
4
  import { HTMLMotionProps } from 'framer-motion';
4
- import { ReactNode } from 'react';
5
- import * as class_variance_authority_types from 'class-variance-authority/types';
5
+ import 'class-variance-authority';
6
+ import 'react';
7
+ import 'class-variance-authority/types';
6
8
 
7
- declare const alertVariants: (props?: ({
8
- 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;
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
9
  declare function AlertIcon({ className, children }: AlertSectionProps): react_jsx_runtime.JSX.Element;
40
10
  declare namespace AlertIcon {
41
11
  var displayName: string;
@@ -59,8 +29,13 @@ declare function AlertDefaultIcon({ appearance, }: {
59
29
  appearance?: AlertProps["appearance"];
60
30
  }): react_jsx_runtime.JSX.Element;
61
31
 
32
+ declare const Alert: {
33
+ (props: AlertProps): react_jsx_runtime.JSX.Element;
34
+ displayName: string;
35
+ };
36
+
62
37
  type AlertPresetMotionProps = Pick<HTMLMotionProps<"div">, "initial" | "animate" | "transition">;
63
38
  type AlertAnimationPresets = Record<AlertAnimation, AlertPresetMotionProps>;
64
39
  declare const alertAnimationPresets: AlertAnimationPresets;
65
40
 
66
- export { Alert, type AlertAnimation, AlertClose, AlertDefaultIcon, AlertDescription, AlertIcon, type AlertProps, type AlertSectionProps, type AlertSize, AlertTitle, alertAnimationPresets, alertDescriptionVariants, alertTitleVariants, alertVariants };
41
+ export { Alert, AlertAnimation, AlertClose, AlertDefaultIcon, AlertDescription, AlertIcon, AlertProps, AlertSectionProps, AlertTitle, alertAnimationPresets };
@@ -1,41 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { VariantProps } from 'class-variance-authority';
2
+ import { b as AlertSectionProps, c as AlertProps, a as AlertAnimation } from '../types-BQ2H3yG7.js';
3
+ export { d as AlertSize, e as alertDescriptionVariants, f as alertTitleVariants, g as alertVariants } from '../types-BQ2H3yG7.js';
3
4
  import { HTMLMotionProps } from 'framer-motion';
4
- import { ReactNode } from 'react';
5
- import * as class_variance_authority_types from 'class-variance-authority/types';
5
+ import 'class-variance-authority';
6
+ import 'react';
7
+ import 'class-variance-authority/types';
6
8
 
7
- declare const alertVariants: (props?: ({
8
- 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;
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
9
  declare function AlertIcon({ className, children }: AlertSectionProps): react_jsx_runtime.JSX.Element;
40
10
  declare namespace AlertIcon {
41
11
  var displayName: string;
@@ -59,8 +29,13 @@ declare function AlertDefaultIcon({ appearance, }: {
59
29
  appearance?: AlertProps["appearance"];
60
30
  }): react_jsx_runtime.JSX.Element;
61
31
 
32
+ declare const Alert: {
33
+ (props: AlertProps): react_jsx_runtime.JSX.Element;
34
+ displayName: string;
35
+ };
36
+
62
37
  type AlertPresetMotionProps = Pick<HTMLMotionProps<"div">, "initial" | "animate" | "transition">;
63
38
  type AlertAnimationPresets = Record<AlertAnimation, AlertPresetMotionProps>;
64
39
  declare const alertAnimationPresets: AlertAnimationPresets;
65
40
 
66
- export { Alert, type AlertAnimation, AlertClose, AlertDefaultIcon, AlertDescription, AlertIcon, type AlertProps, type AlertSectionProps, type AlertSize, AlertTitle, alertAnimationPresets, alertDescriptionVariants, alertTitleVariants, alertVariants };
41
+ export { Alert, AlertAnimation, AlertClose, AlertDefaultIcon, AlertDescription, AlertIcon, AlertProps, AlertSectionProps, AlertTitle, alertAnimationPresets };
package/dist/ui/alert.js CHANGED
@@ -1,229 +1,51 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkUOZYPWDZ_js = require('../chunk-UOZYPWDZ.js');
5
- var react = require('react');
6
- var framerMotion = require('framer-motion');
7
- var hi2 = require('react-icons/hi2');
8
- var classVarianceAuthority = require('class-variance-authority');
4
+ var chunkP6YRSEOY_js = require('../chunk-P6YRSEOY.js');
5
+ require('../chunk-UOZYPWDZ.js');
9
6
  var jsxRuntime = require('react/jsx-runtime');
10
7
 
11
- // src/ui/alert/animations.ts
12
- var alertAnimationPresets = {
13
- none: {},
14
- "slide-down": {
15
- initial: { y: -8, opacity: 0 },
16
- animate: { y: 0, opacity: 1 },
17
- transition: { type: "spring", stiffness: 420, damping: 30 }
18
- },
19
- fade: {
20
- initial: { opacity: 0 },
21
- animate: { opacity: 1 },
22
- transition: { duration: 0.2 }
23
- },
24
- pop: {
25
- initial: { scale: 0.96, opacity: 0 },
26
- animate: { scale: 1, opacity: 1 },
27
- transition: { type: "spring", stiffness: 520, damping: 28 }
28
- }
8
+ var Alert = (props) => {
9
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkP6YRSEOY_js.AlertBase, { ...props });
29
10
  };
30
- var alertVariants = classVarianceAuthority.cva(
31
- "relative flex w-full gap-3 border text-sm ring-offset-slate-950 transition-colors",
32
- {
33
- variants: {
34
- appearance: {
35
- default: "border-white/10 bg-white/5 text-slate-50",
36
- success: "border-emerald-500/40 bg-emerald-500/10 text-emerald-50",
37
- warning: "border-amber-500/40 bg-amber-500/10 text-amber-50",
38
- error: "border-rose-500/50 bg-rose-500/10 text-rose-50",
39
- info: "border-sky-500/40 bg-sky-500/10 text-sky-50",
40
- ghost: "border-transparent bg-transparent text-slate-200",
41
- purple: "border-purple-600 bg-purple-950/70 backdrop-blur-xl",
42
- pink: "border-pink-600 bg-pink-950/70 backdrop-blur-xl",
43
- orange: "border-orange-600 bg-orange-950/70 backdrop-blur-xl",
44
- yellow: "border-yellow-600 bg-yellow-950/70 backdrop-blur-xl",
45
- teal: "border-teal-600 bg-teal-950/70 backdrop-blur-xl",
46
- indigo: "border-indigo-600 bg-indigo-950/70 backdrop-blur-xl",
47
- gray: "border-gray-600 bg-gray-950/70 backdrop-blur-xl",
48
- violet: "border-violet-600 bg-violet-950/70 backdrop-blur-xl",
49
- "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",
50
- "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",
51
- "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",
52
- "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",
53
- "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",
54
- "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",
55
- "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",
56
- "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",
57
- "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"
58
- },
59
- size: {
60
- sm: "rounded-lg p-3",
61
- md: "rounded-xl p-4",
62
- lg: "rounded-2xl p-5 text-base"
63
- }
64
- },
65
- defaultVariants: {
66
- appearance: "default",
67
- size: "md"
68
- }
69
- }
70
- );
71
- var alertTitleVariants = classVarianceAuthority.cva("font-semibold leading-tight", {
72
- variants: {
73
- size: {
74
- sm: "text-xs md:text-sm",
75
- md: "text-xs md:text-sm",
76
- lg: "text-xs md:text-sm"
77
- }
78
- },
79
- defaultVariants: { size: "md" }
80
- });
81
- var alertDescriptionVariants = classVarianceAuthority.cva("text-slate-300", {
82
- variants: {
83
- size: {
84
- sm: "text-xs md:text-sm",
85
- md: "text-xs md:text-sm",
86
- lg: "text-xs md:text-sm"
87
- }
88
- },
89
- defaultVariants: { size: "md" }
90
- });
91
- var AlertSizeContext = react.createContext("md");
92
- function useAlertSize() {
93
- const ctx = react.useContext(AlertSizeContext);
94
- if (!ctx) {
95
- throw new Error("useAlertSize must be used within an Alert");
96
- }
97
- return ctx;
98
- }
99
- function Alert(props) {
100
- const {
101
- className,
102
- triggerClassName,
103
- appearance,
104
- size = "md",
105
- animation = "none",
106
- closable = false,
107
- onClose,
108
- closeLabel = "Dismiss alert",
109
- children,
110
- ref,
111
- ...rest
112
- } = props;
113
- const motionProps = alertAnimationPresets[animation];
114
- const live = appearance === "error" ? "assertive" : "polite";
115
- const ctx = react.useMemo(() => size ?? "md", [size]);
116
- return /* @__PURE__ */ jsxRuntime.jsx(AlertSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsxs(
117
- framerMotion.motion.div,
118
- {
119
- ref,
120
- "data-slot": "alert",
121
- role: "alert",
122
- "aria-live": live,
123
- className: chunkUOZYPWDZ_js.cn(
124
- alertVariants({ appearance, size }),
125
- closable ? "pr-12" : "",
126
- className
127
- ),
128
- initial: animation === "none" ? false : void 0,
129
- ...motionProps,
130
- ...rest,
131
- children: [
132
- children,
133
- closable ? /* @__PURE__ */ jsxRuntime.jsx(
134
- "button",
135
- {
136
- type: "button",
137
- "data-slot": "alert-close",
138
- "aria-label": closeLabel,
139
- onClick: onClose,
140
- className: chunkUOZYPWDZ_js.cn(
141
- "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",
142
- triggerClassName
143
- ),
144
- children: /* @__PURE__ */ jsxRuntime.jsx(hi2.HiXMark, { className: "size-4", "aria-hidden": true })
145
- }
146
- ) : null
147
- ]
148
- }
149
- ) });
150
- }
151
11
  Alert.displayName = "Alert";
152
- function AlertIcon({ className, children }) {
153
- return /* @__PURE__ */ jsxRuntime.jsx(
154
- "span",
155
- {
156
- "data-slot": "alert-icon",
157
- className: chunkUOZYPWDZ_js.cn("mt-0.5 shrink-0 text-current", className),
158
- children
159
- }
160
- );
161
- }
162
- AlertIcon.displayName = "AlertIcon";
163
- function AlertTitle({ className, children }) {
164
- const size = useAlertSize();
165
- return /* @__PURE__ */ jsxRuntime.jsx(
166
- "div",
167
- {
168
- "data-slot": "alert-title",
169
- className: chunkUOZYPWDZ_js.cn(alertTitleVariants({ size }), className),
170
- children
171
- }
172
- );
173
- }
174
- AlertTitle.displayName = "AlertTitle";
175
- function AlertDescription({ className, children }) {
176
- const size = useAlertSize();
177
- return /* @__PURE__ */ jsxRuntime.jsx(
178
- "div",
179
- {
180
- "data-slot": "alert-description",
181
- className: chunkUOZYPWDZ_js.cn(alertDescriptionVariants({ size }), className),
182
- children
183
- }
184
- );
185
- }
186
- AlertDescription.displayName = "AlertDescription";
187
- function AlertClose({
188
- className,
189
- children,
190
- "aria-label": ariaLabel = "Dismiss alert",
191
- onClick
192
- }) {
193
- return /* @__PURE__ */ jsxRuntime.jsx(
194
- "button",
195
- {
196
- type: "button",
197
- "data-slot": "alert-close",
198
- "aria-label": ariaLabel,
199
- onClick,
200
- className: chunkUOZYPWDZ_js.cn(
201
- "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",
202
- className
203
- ),
204
- children: children ?? /* @__PURE__ */ jsxRuntime.jsx(hi2.HiXMark, { className: "size-4", "aria-hidden": true })
205
- }
206
- );
207
- }
208
- AlertClose.displayName = "AlertClose";
209
- function AlertDefaultIcon({
210
- appearance
211
- }) {
212
- if (appearance === "error") {
213
- return /* @__PURE__ */ jsxRuntime.jsx(hi2.HiExclamationTriangle, { className: "size-5", "aria-hidden": true });
214
- }
215
- return /* @__PURE__ */ jsxRuntime.jsx(hi2.HiInformationCircle, { className: "size-5", "aria-hidden": true });
216
- }
217
12
 
13
+ Object.defineProperty(exports, "AlertClose", {
14
+ enumerable: true,
15
+ get: function () { return chunkP6YRSEOY_js.AlertClose; }
16
+ });
17
+ Object.defineProperty(exports, "AlertDefaultIcon", {
18
+ enumerable: true,
19
+ get: function () { return chunkP6YRSEOY_js.AlertDefaultIcon; }
20
+ });
21
+ Object.defineProperty(exports, "AlertDescription", {
22
+ enumerable: true,
23
+ get: function () { return chunkP6YRSEOY_js.AlertDescription; }
24
+ });
25
+ Object.defineProperty(exports, "AlertIcon", {
26
+ enumerable: true,
27
+ get: function () { return chunkP6YRSEOY_js.AlertIcon; }
28
+ });
29
+ Object.defineProperty(exports, "AlertTitle", {
30
+ enumerable: true,
31
+ get: function () { return chunkP6YRSEOY_js.AlertTitle; }
32
+ });
33
+ Object.defineProperty(exports, "alertAnimationPresets", {
34
+ enumerable: true,
35
+ get: function () { return chunkP6YRSEOY_js.alertAnimationPresets; }
36
+ });
37
+ Object.defineProperty(exports, "alertDescriptionVariants", {
38
+ enumerable: true,
39
+ get: function () { return chunkP6YRSEOY_js.alertDescriptionVariants; }
40
+ });
41
+ Object.defineProperty(exports, "alertTitleVariants", {
42
+ enumerable: true,
43
+ get: function () { return chunkP6YRSEOY_js.alertTitleVariants; }
44
+ });
45
+ Object.defineProperty(exports, "alertVariants", {
46
+ enumerable: true,
47
+ get: function () { return chunkP6YRSEOY_js.alertVariants; }
48
+ });
218
49
  exports.Alert = Alert;
219
- exports.AlertClose = AlertClose;
220
- exports.AlertDefaultIcon = AlertDefaultIcon;
221
- exports.AlertDescription = AlertDescription;
222
- exports.AlertIcon = AlertIcon;
223
- exports.AlertTitle = AlertTitle;
224
- exports.alertAnimationPresets = alertAnimationPresets;
225
- exports.alertDescriptionVariants = alertDescriptionVariants;
226
- exports.alertTitleVariants = alertTitleVariants;
227
- exports.alertVariants = alertVariants;
228
50
  //# sourceMappingURL=alert.js.map
229
51
  //# sourceMappingURL=alert.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/alert/animations.ts","../../src/ui/alert/variants.ts","../../src/ui/alert/alert.tsx"],"names":["cva","createContext","useContext","useMemo","jsx","jsxs","motion","cn","HiXMark","HiExclamationTriangle","HiInformationCircle"],"mappings":";;;;;;;;;;AAcO,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,I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AAEA,UAAA,CAAW,WAAA,GAAc,YAAA;AAElB,SAAS,gBAAA,CAAiB;AAAA,EAC/B;AACF,CAAA,EAEG;AACD,EAAA,IAAI,eAAe,OAAA,EAAS;AAC1B,IAAA,uBAAOJ,cAAA,CAACK,yBAAA,EAAA,EAAsB,SAAA,EAAU,QAAA,EAAS,eAAW,IAAA,EAAC,CAAA;AAAA,EAC/D;AACA,EAAA,uBAAOL,cAAA,CAACM,uBAAA,EAAA,EAAoB,SAAA,EAAU,QAAA,EAAS,eAAW,IAAA,EAAC,CAAA;AAC7D","file":"alert.js","sourcesContent":["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","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 { motion } from \"framer-motion\";\nimport {\n HiExclamationTriangle,\n HiInformationCircle,\n HiXMark,\n} 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\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"]}
1
+ {"version":3,"sources":["../../src/ui/alert/alert.tsx"],"names":["jsx","AlertBase"],"mappings":";;;;;;AAIO,IAAM,KAAA,GAAQ,CAAC,KAAA,KAAsB;AAC1C,EAAA,uBAAOA,cAAA,CAACC,0BAAA,EAAA,EAAW,GAAG,KAAA,EAAO,CAAA;AAC/B;AAEA,KAAA,CAAM,WAAA,GAAc,OAAA","file":"alert.js","sourcesContent":["// alert.tsx ← users import this by default\nimport { AlertBase } from \"./alert-base\";\nimport type { AlertProps } from \"./types\";\n\nexport const Alert = (props: AlertProps) => {\n return <AlertBase {...props} />;\n}\n\nAlert.displayName = \"Alert\";"]}