@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
package/dist/ui/alert.mjs
CHANGED
|
@@ -1,218 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { cva } from 'class-variance-authority';
|
|
7
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { AlertBase } from '../chunk-UJ3AER3U.mjs';
|
|
3
|
+
export { AlertClose, AlertDefaultIcon, AlertDescription, AlertIcon, AlertTitle, alertAnimationPresets, alertDescriptionVariants, alertTitleVariants, alertVariants } from '../chunk-UJ3AER3U.mjs';
|
|
4
|
+
import '../chunk-DFEZH7TC.mjs';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
none: {},
|
|
12
|
-
"slide-down": {
|
|
13
|
-
initial: { y: -8, opacity: 0 },
|
|
14
|
-
animate: { y: 0, opacity: 1 },
|
|
15
|
-
transition: { type: "spring", stiffness: 420, damping: 30 }
|
|
16
|
-
},
|
|
17
|
-
fade: {
|
|
18
|
-
initial: { opacity: 0 },
|
|
19
|
-
animate: { opacity: 1 },
|
|
20
|
-
transition: { duration: 0.2 }
|
|
21
|
-
},
|
|
22
|
-
pop: {
|
|
23
|
-
initial: { scale: 0.96, opacity: 0 },
|
|
24
|
-
animate: { scale: 1, opacity: 1 },
|
|
25
|
-
transition: { type: "spring", stiffness: 520, damping: 28 }
|
|
26
|
-
}
|
|
7
|
+
var Alert = (props) => {
|
|
8
|
+
return /* @__PURE__ */ jsx(AlertBase, { ...props });
|
|
27
9
|
};
|
|
28
|
-
var alertVariants = cva(
|
|
29
|
-
"relative flex w-full gap-3 border text-sm ring-offset-slate-950 transition-colors",
|
|
30
|
-
{
|
|
31
|
-
variants: {
|
|
32
|
-
appearance: {
|
|
33
|
-
default: "border-white/10 bg-white/5 text-slate-50",
|
|
34
|
-
success: "border-emerald-500/40 bg-emerald-500/10 text-emerald-50",
|
|
35
|
-
warning: "border-amber-500/40 bg-amber-500/10 text-amber-50",
|
|
36
|
-
error: "border-rose-500/50 bg-rose-500/10 text-rose-50",
|
|
37
|
-
info: "border-sky-500/40 bg-sky-500/10 text-sky-50",
|
|
38
|
-
ghost: "border-transparent bg-transparent text-slate-200",
|
|
39
|
-
purple: "border-purple-600 bg-purple-950/70 backdrop-blur-xl",
|
|
40
|
-
pink: "border-pink-600 bg-pink-950/70 backdrop-blur-xl",
|
|
41
|
-
orange: "border-orange-600 bg-orange-950/70 backdrop-blur-xl",
|
|
42
|
-
yellow: "border-yellow-600 bg-yellow-950/70 backdrop-blur-xl",
|
|
43
|
-
teal: "border-teal-600 bg-teal-950/70 backdrop-blur-xl",
|
|
44
|
-
indigo: "border-indigo-600 bg-indigo-950/70 backdrop-blur-xl",
|
|
45
|
-
gray: "border-gray-600 bg-gray-950/70 backdrop-blur-xl",
|
|
46
|
-
violet: "border-violet-600 bg-violet-950/70 backdrop-blur-xl",
|
|
47
|
-
"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",
|
|
48
|
-
"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",
|
|
49
|
-
"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",
|
|
50
|
-
"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",
|
|
51
|
-
"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",
|
|
52
|
-
"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",
|
|
53
|
-
"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",
|
|
54
|
-
"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",
|
|
55
|
-
"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"
|
|
56
|
-
},
|
|
57
|
-
size: {
|
|
58
|
-
sm: "rounded-lg p-3",
|
|
59
|
-
md: "rounded-xl p-4",
|
|
60
|
-
lg: "rounded-2xl p-5 text-base"
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
defaultVariants: {
|
|
64
|
-
appearance: "default",
|
|
65
|
-
size: "md"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
var alertTitleVariants = cva("font-semibold leading-tight", {
|
|
70
|
-
variants: {
|
|
71
|
-
size: {
|
|
72
|
-
sm: "text-xs md:text-sm",
|
|
73
|
-
md: "text-xs md:text-sm",
|
|
74
|
-
lg: "text-xs md:text-sm"
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
defaultVariants: { size: "md" }
|
|
78
|
-
});
|
|
79
|
-
var alertDescriptionVariants = cva("text-slate-300", {
|
|
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 AlertSizeContext = createContext("md");
|
|
90
|
-
function useAlertSize() {
|
|
91
|
-
const ctx = useContext(AlertSizeContext);
|
|
92
|
-
if (!ctx) {
|
|
93
|
-
throw new Error("useAlertSize must be used within an Alert");
|
|
94
|
-
}
|
|
95
|
-
return ctx;
|
|
96
|
-
}
|
|
97
|
-
function Alert(props) {
|
|
98
|
-
const {
|
|
99
|
-
className,
|
|
100
|
-
triggerClassName,
|
|
101
|
-
appearance,
|
|
102
|
-
size = "md",
|
|
103
|
-
animation = "none",
|
|
104
|
-
closable = false,
|
|
105
|
-
onClose,
|
|
106
|
-
closeLabel = "Dismiss alert",
|
|
107
|
-
children,
|
|
108
|
-
ref,
|
|
109
|
-
...rest
|
|
110
|
-
} = props;
|
|
111
|
-
const motionProps = alertAnimationPresets[animation];
|
|
112
|
-
const live = appearance === "error" ? "assertive" : "polite";
|
|
113
|
-
const ctx = useMemo(() => size ?? "md", [size]);
|
|
114
|
-
return /* @__PURE__ */ jsx(AlertSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
|
|
115
|
-
motion.div,
|
|
116
|
-
{
|
|
117
|
-
ref,
|
|
118
|
-
"data-slot": "alert",
|
|
119
|
-
role: "alert",
|
|
120
|
-
"aria-live": live,
|
|
121
|
-
className: cn(
|
|
122
|
-
alertVariants({ appearance, size }),
|
|
123
|
-
closable ? "pr-12" : "",
|
|
124
|
-
className
|
|
125
|
-
),
|
|
126
|
-
initial: animation === "none" ? false : void 0,
|
|
127
|
-
...motionProps,
|
|
128
|
-
...rest,
|
|
129
|
-
children: [
|
|
130
|
-
children,
|
|
131
|
-
closable ? /* @__PURE__ */ jsx(
|
|
132
|
-
"button",
|
|
133
|
-
{
|
|
134
|
-
type: "button",
|
|
135
|
-
"data-slot": "alert-close",
|
|
136
|
-
"aria-label": closeLabel,
|
|
137
|
-
onClick: onClose,
|
|
138
|
-
className: cn(
|
|
139
|
-
"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",
|
|
140
|
-
triggerClassName
|
|
141
|
-
),
|
|
142
|
-
children: /* @__PURE__ */ jsx(HiXMark, { className: "size-4", "aria-hidden": true })
|
|
143
|
-
}
|
|
144
|
-
) : null
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
) });
|
|
148
|
-
}
|
|
149
10
|
Alert.displayName = "Alert";
|
|
150
|
-
function AlertIcon({ className, children }) {
|
|
151
|
-
return /* @__PURE__ */ jsx(
|
|
152
|
-
"span",
|
|
153
|
-
{
|
|
154
|
-
"data-slot": "alert-icon",
|
|
155
|
-
className: cn("mt-0.5 shrink-0 text-current", className),
|
|
156
|
-
children
|
|
157
|
-
}
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
AlertIcon.displayName = "AlertIcon";
|
|
161
|
-
function AlertTitle({ className, children }) {
|
|
162
|
-
const size = useAlertSize();
|
|
163
|
-
return /* @__PURE__ */ jsx(
|
|
164
|
-
"div",
|
|
165
|
-
{
|
|
166
|
-
"data-slot": "alert-title",
|
|
167
|
-
className: cn(alertTitleVariants({ size }), className),
|
|
168
|
-
children
|
|
169
|
-
}
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
AlertTitle.displayName = "AlertTitle";
|
|
173
|
-
function AlertDescription({ className, children }) {
|
|
174
|
-
const size = useAlertSize();
|
|
175
|
-
return /* @__PURE__ */ jsx(
|
|
176
|
-
"div",
|
|
177
|
-
{
|
|
178
|
-
"data-slot": "alert-description",
|
|
179
|
-
className: cn(alertDescriptionVariants({ size }), className),
|
|
180
|
-
children
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
AlertDescription.displayName = "AlertDescription";
|
|
185
|
-
function AlertClose({
|
|
186
|
-
className,
|
|
187
|
-
children,
|
|
188
|
-
"aria-label": ariaLabel = "Dismiss alert",
|
|
189
|
-
onClick
|
|
190
|
-
}) {
|
|
191
|
-
return /* @__PURE__ */ jsx(
|
|
192
|
-
"button",
|
|
193
|
-
{
|
|
194
|
-
type: "button",
|
|
195
|
-
"data-slot": "alert-close",
|
|
196
|
-
"aria-label": ariaLabel,
|
|
197
|
-
onClick,
|
|
198
|
-
className: cn(
|
|
199
|
-
"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",
|
|
200
|
-
className
|
|
201
|
-
),
|
|
202
|
-
children: children ?? /* @__PURE__ */ jsx(HiXMark, { className: "size-4", "aria-hidden": true })
|
|
203
|
-
}
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
AlertClose.displayName = "AlertClose";
|
|
207
|
-
function AlertDefaultIcon({
|
|
208
|
-
appearance
|
|
209
|
-
}) {
|
|
210
|
-
if (appearance === "error") {
|
|
211
|
-
return /* @__PURE__ */ jsx(HiExclamationTriangle, { className: "size-5", "aria-hidden": true });
|
|
212
|
-
}
|
|
213
|
-
return /* @__PURE__ */ jsx(HiInformationCircle, { className: "size-5", "aria-hidden": true });
|
|
214
|
-
}
|
|
215
11
|
|
|
216
|
-
export { Alert
|
|
12
|
+
export { Alert };
|
|
217
13
|
//# sourceMappingURL=alert.mjs.map
|
|
218
14
|
//# sourceMappingURL=alert.mjs.map
|
package/dist/ui/alert.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/alert/animations.ts","../../src/ui/alert/variants.ts","../../src/ui/alert/alert.tsx"],"names":[],"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,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;AC7BO,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,kD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AAC3E,EAAA,MAAM,OAAO,YAAA,EAAa;AAC1B,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,mBAAA;AAAA,MACV,WAAW,EAAA,CAAG,wBAAA,CAAyB,EAAE,IAAA,EAAM,GAAG,SAAS,CAAA;AAAA,MAE1D;AAAA;AAAA,GACH;AAEJ;AAEA,gBAAA,CAAiB,WAAA,GAAc,kBAAA;AAExB,SAAS,UAAA,CAAW;AAAA,EACzB,SAAA;AAAA,EACA,QAAA;AAAA,EACA,cAAc,SAAA,GAAY,eAAA;AAAA,EAC1B;AACF,CAAA,EAAwE;AACtE,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,QAAA;AAAA,MACL,WAAA,EAAU,aAAA;AAAA,MACV,YAAA,EAAY,SAAA;AAAA,MACZ,OAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACT,mLAAA;AAAA,QACA;AAAA,OACF;AAAA,MAEC,sCAAY,GAAA,CAAC,OAAA,EAAA,EAAQ,SAAA,EAAU,QAAA,EAAS,eAAW,IAAA,EAAC;AAAA;AAAA,GACvD;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","file":"alert.mjs","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":[],"mappings":";;;;;AAIO,IAAM,KAAA,GAAQ,CAAC,KAAA,KAAsB;AAC1C,EAAA,uBAAO,GAAA,CAAC,SAAA,EAAA,EAAW,GAAG,KAAA,EAAO,CAAA;AAC/B;AAEA,KAAA,CAAM,WAAA,GAAc,OAAA","file":"alert.mjs","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\";"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zentauri-ui/zentauri-components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A UI component library built with React and Tailwind CSS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": ["dist"],
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
"import": "./dist/ui/*.mjs",
|
|
15
15
|
"require": "./dist/ui/*.js"
|
|
16
16
|
},
|
|
17
|
+
"./ui/*/animated": {
|
|
18
|
+
"types": "./dist/ui/*/animated.d.ts",
|
|
19
|
+
"import": "./dist/ui/*/animated.mjs",
|
|
20
|
+
"require": "./dist/ui/*/animated.js"
|
|
21
|
+
},
|
|
17
22
|
"./hooks/*": {
|
|
18
23
|
"types": "./dist/hooks/*.d.ts",
|
|
19
24
|
"import": "./dist/hooks/*.mjs",
|
|
@@ -21,7 +26,7 @@
|
|
|
21
26
|
}
|
|
22
27
|
},
|
|
23
28
|
"scripts": {
|
|
24
|
-
"dev": "tsup --watch",
|
|
29
|
+
"dev": "NODE_OPTIONS=--max-old-space-size=8192 tsup --watch",
|
|
25
30
|
"build": "NODE_OPTIONS=--max-old-space-size=8192 tsup",
|
|
26
31
|
"test": "vitest run",
|
|
27
32
|
"test:watch": "vitest"
|