@cypress-design/vue-alert 0.5.1 → 0.5.3
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/.turbo/turbo-build.log +4 -4
- package/Alert.vue +31 -15
- package/CHANGELOG.md +18 -0
- package/ReadMe.md +66 -24
- package/dist/Alert.vue.d.ts +31 -14
- package/dist/Alert.vue.d.ts.map +1 -1
- package/dist/index.es.mjs +93 -73
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.json +1 -0
package/dist/index.es.mjs
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { h as
|
|
2
|
-
import * as
|
|
3
|
-
import { ICON_COLOR_PROP_NAMES as
|
|
4
|
-
import { DetailsAnimation as
|
|
5
|
-
const
|
|
1
|
+
import { h as n, defineComponent as R, ref as z, useSlots as H, computed as b, onMounted as A, onUnmounted as I, openBlock as c, createElementBlock as f, normalizeClass as u, unref as r, createElementVNode as y, renderSlot as v, normalizeProps as $, guardReactiveProps as T, createBlock as B, resolveDynamicComponent as E, mergeProps as N, createCommentVNode as C, createVNode as S, createTextVNode as O, toDisplayString as P } from "vue";
|
|
2
|
+
import * as x from "@cypress-design/icon-registry";
|
|
3
|
+
import { ICON_COLOR_PROP_NAMES as V } from "@cypress-design/icon-registry";
|
|
4
|
+
import { DetailsAnimation as Z } from "@cypress-design/details-animation";
|
|
5
|
+
const k = ({
|
|
6
6
|
body: s,
|
|
7
7
|
compiledClasses: o,
|
|
8
8
|
size: e,
|
|
9
9
|
class: t,
|
|
10
10
|
interactiveColorsOnGroup: h,
|
|
11
|
-
...
|
|
11
|
+
...p
|
|
12
12
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
(
|
|
13
|
+
const m = Object.keys(p).reduce(
|
|
14
|
+
(l, a) => (!V.includes(a) && a !== "name" && (l[a] = p[a]), l),
|
|
15
15
|
{}
|
|
16
|
-
),
|
|
16
|
+
), i = {
|
|
17
17
|
width: e,
|
|
18
18
|
height: e,
|
|
19
19
|
viewBox: `0 0 ${e} ${e}`,
|
|
20
20
|
fill: "none",
|
|
21
21
|
innerHTML: s,
|
|
22
|
-
...
|
|
22
|
+
...m
|
|
23
23
|
// add all standard attributes back to the svg tag
|
|
24
24
|
};
|
|
25
|
-
return o.length && (
|
|
26
|
-
},
|
|
27
|
-
const { sizeWithDefault: o, compiledClasses: e } =
|
|
25
|
+
return o.length && (i.class = o.join(" ")), i;
|
|
26
|
+
}, _ = (s) => {
|
|
27
|
+
const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["16", "24"] }), t = {
|
|
28
28
|
16: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 13 13 3M3 3l10 10" class="icon-dark"/>',
|
|
29
29
|
24: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 20 20 4M4 4l16 16" class="icon-dark"/>'
|
|
30
30
|
}[o];
|
|
31
31
|
if (!t)
|
|
32
32
|
throw Error(`Icon "action-delete-large" is not available in size ${o}`);
|
|
33
|
-
return
|
|
33
|
+
return n("svg", k({
|
|
34
34
|
...s,
|
|
35
35
|
size: o,
|
|
36
36
|
body: t,
|
|
37
37
|
compiledClasses: e
|
|
38
38
|
}));
|
|
39
|
-
},
|
|
40
|
-
const { sizeWithDefault: o, compiledClasses: e } =
|
|
39
|
+
}, W = (s) => {
|
|
40
|
+
const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["16"] }), t = {
|
|
41
41
|
16: '<path stroke="currentColor" stroke-width="2" d="M12.95 12.95a7 7 0 1 1-9.9-9.9 7 7 0 0 1 9.9 9.9Z" class="icon-dark"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m6 8 1.5 2L10 6" class="icon-dark"/>'
|
|
42
42
|
}[o];
|
|
43
43
|
if (!t)
|
|
44
44
|
throw Error(`Icon "checkmark-outline" is not available in size ${o}`);
|
|
45
|
-
return
|
|
45
|
+
return n("svg", k({
|
|
46
46
|
...s,
|
|
47
47
|
size: o,
|
|
48
48
|
body: t,
|
|
49
49
|
compiledClasses: e
|
|
50
50
|
}));
|
|
51
|
-
},
|
|
52
|
-
const { sizeWithDefault: o, compiledClasses: e } =
|
|
51
|
+
}, L = (s) => {
|
|
52
|
+
const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["8", "16"] }), t = {
|
|
53
53
|
8: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 2.5 3 3 3-3" class="icon-dark"/>',
|
|
54
54
|
16: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m4 6 4 4 4-4" class="icon-dark"/>'
|
|
55
55
|
}[o];
|
|
56
56
|
if (!t)
|
|
57
57
|
throw Error(`Icon "chevron-down-small" is not available in size ${o}`);
|
|
58
|
-
return
|
|
58
|
+
return n("svg", k({
|
|
59
59
|
...s,
|
|
60
60
|
size: o,
|
|
61
61
|
body: t,
|
|
62
62
|
compiledClasses: e
|
|
63
63
|
}));
|
|
64
|
-
},
|
|
65
|
-
const { sizeWithDefault: o, compiledClasses: e } =
|
|
64
|
+
}, D = (s) => {
|
|
65
|
+
const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["16"] }), t = {
|
|
66
66
|
16: '<path fill="currentColor" fill-rule="evenodd" d="M2 8a6 6 0 1 1 12 0A6 6 0 0 1 2 8Zm6-8a8 8 0 1 0 0 16A8 8 0 0 0 8 0Zm1 5a1 1 0 0 0-2 0v3a1 1 0 0 0 2 0V5Zm-1 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" class="icon-dark" clip-rule="evenodd"/>'
|
|
67
67
|
}[o];
|
|
68
68
|
if (!t)
|
|
69
69
|
throw Error(`Icon "warning-circle" is not available in size ${o}`);
|
|
70
|
-
return
|
|
70
|
+
return n("svg", k({
|
|
71
71
|
...s,
|
|
72
72
|
size: o,
|
|
73
73
|
body: t,
|
|
74
74
|
compiledClasses: e
|
|
75
75
|
}));
|
|
76
|
-
},
|
|
76
|
+
}, G = {
|
|
77
77
|
xs: "py-[4px] px-[8px] leading-[22px] text-[14px]",
|
|
78
78
|
sm: "py-[8px] px-[12px] leading-[22px] text-[14px]",
|
|
79
79
|
md: "py-[12px] px-[16px] leading-[24px] text-[16px]",
|
|
80
80
|
lg: "p-[16px] leading-[24px] text-[16px]"
|
|
81
|
-
},
|
|
81
|
+
}, U = "lg", q = {
|
|
82
82
|
neutral: {
|
|
83
83
|
headerClass: "text-gray-800 bg-gray-100",
|
|
84
84
|
bodyClass: "bg-gray-50 text-gray-500",
|
|
@@ -138,109 +138,129 @@ const v = ({
|
|
|
138
138
|
iconColor: "jade-500",
|
|
139
139
|
/* <tw-keep strokeColor="jade-300"/> */
|
|
140
140
|
iconChevronColor: "jade-300"
|
|
141
|
+
},
|
|
142
|
+
clear: {
|
|
143
|
+
wrapperClass: "border-gray-50 bg-white border text-gray-700",
|
|
144
|
+
headerClass: "",
|
|
145
|
+
bodyClass: "border-gray-50 border-t",
|
|
146
|
+
borderClass: "border-gray-50",
|
|
147
|
+
detailsHeaderClass: "text-gray-700",
|
|
148
|
+
/* <tw-keep strokeColor="gray-600"/> */
|
|
149
|
+
iconCloseColor: "gray-600",
|
|
150
|
+
/* <tw-keep strokeColor="gray-500"/> */
|
|
151
|
+
iconColor: "gray-500",
|
|
152
|
+
/* <tw-keep strokeColor="gray-300"/> */
|
|
153
|
+
iconChevronColor: "gray-300"
|
|
141
154
|
}
|
|
142
|
-
},
|
|
155
|
+
}, F = "info", J = "Additional details", K = { class: "flex-1 font-medium" }, oe = /* @__PURE__ */ R({
|
|
143
156
|
__name: "Alert",
|
|
144
157
|
props: {
|
|
145
|
-
|
|
146
|
-
|
|
158
|
+
variant: { default: void 0 },
|
|
159
|
+
type: { default: F },
|
|
160
|
+
detailsTitle: { default: J },
|
|
147
161
|
dismissible: { type: Boolean },
|
|
148
162
|
noIcon: { type: Boolean },
|
|
149
163
|
notRounded: { type: Boolean },
|
|
150
164
|
duration: null,
|
|
151
|
-
size: { default:
|
|
165
|
+
size: { default: U }
|
|
152
166
|
},
|
|
153
167
|
emits: ["dismiss"],
|
|
154
168
|
setup(s, { emit: o }) {
|
|
155
|
-
const e = s, t = z(!1), h =
|
|
169
|
+
const e = s, t = z(!1), h = H(), p = b(() => e.variant ?? e.type), m = z(null), i = z(null), l = b(() => q[p.value] ?? {});
|
|
156
170
|
let a;
|
|
157
|
-
|
|
158
|
-
e.duration && (a = setTimeout(
|
|
159
|
-
}),
|
|
160
|
-
|
|
161
|
-
}),
|
|
171
|
+
A(() => {
|
|
172
|
+
e.duration && (a = setTimeout(w, e.duration));
|
|
173
|
+
}), A(() => {
|
|
174
|
+
m.value && i.value && new Z(m.value, i.value);
|
|
175
|
+
}), I(() => {
|
|
162
176
|
a && clearTimeout(a);
|
|
163
177
|
});
|
|
164
|
-
function
|
|
178
|
+
function w() {
|
|
165
179
|
t.value = !0, o("dismiss"), a && (clearTimeout(a), a = void 0);
|
|
166
180
|
}
|
|
167
|
-
const
|
|
181
|
+
const g = b(() => ({
|
|
168
182
|
strokeColor: l.value.iconColor,
|
|
169
183
|
class: "my-[4px] mr-[8px]"
|
|
170
|
-
})),
|
|
171
|
-
switch (
|
|
184
|
+
})), j = b(() => {
|
|
185
|
+
switch (p.value) {
|
|
172
186
|
case "info":
|
|
173
187
|
return null;
|
|
174
188
|
case "success":
|
|
175
|
-
return () =>
|
|
189
|
+
return () => n(W, g.value);
|
|
176
190
|
case "warning":
|
|
177
|
-
return () =>
|
|
191
|
+
return () => n(D, g.value);
|
|
178
192
|
case "error":
|
|
179
|
-
return () =>
|
|
193
|
+
return () => n(D, g.value);
|
|
180
194
|
default:
|
|
181
195
|
return null;
|
|
182
196
|
}
|
|
183
|
-
}),
|
|
184
|
-
return (
|
|
197
|
+
}), M = b(() => G[e.size] ?? {});
|
|
198
|
+
return (d, Q) => t.value ? C("", !0) : (c(), f("div", {
|
|
185
199
|
key: 0,
|
|
186
|
-
class:
|
|
200
|
+
class: u(["overflow-hidden text-left", [r(l).wrapperClass, { rounded: !e.notRounded }]])
|
|
187
201
|
}, [
|
|
188
|
-
|
|
189
|
-
class:
|
|
202
|
+
y("div", {
|
|
203
|
+
class: u(["flex", [r(l).headerClass, r(M)]])
|
|
190
204
|
}, [
|
|
191
|
-
|
|
192
|
-
!e.noIcon && r(
|
|
205
|
+
v(d.$slots, "icon", $(T(r(g))), () => [
|
|
206
|
+
!e.noIcon && r(j) ? (c(), B(E(r(j)), $(N({ key: 0 }, r(g))), null, 16)) : C("", !0)
|
|
193
207
|
]),
|
|
194
|
-
|
|
195
|
-
|
|
208
|
+
y("div", K, [
|
|
209
|
+
v(d.$slots, "default")
|
|
196
210
|
]),
|
|
197
|
-
s.dismissible ? (
|
|
211
|
+
s.dismissible ? (c(), f("button", {
|
|
198
212
|
key: 0,
|
|
199
213
|
class: "m-[4px] ml-[8px] h-[16px]",
|
|
200
|
-
onClick:
|
|
214
|
+
onClick: w,
|
|
201
215
|
"aria-label": "Dismiss"
|
|
202
216
|
}, [
|
|
203
|
-
S(r(
|
|
217
|
+
S(r(_), {
|
|
204
218
|
"stroke-color": r(l).iconCloseColor
|
|
205
219
|
}, null, 8, ["stroke-color"])
|
|
206
|
-
])) :
|
|
220
|
+
])) : C("", !0)
|
|
207
221
|
], 2),
|
|
208
|
-
r(h).body ? (
|
|
222
|
+
r(h).body ? (c(), f("div", {
|
|
209
223
|
key: 0,
|
|
210
|
-
class:
|
|
224
|
+
class: u(["p-[16px]", r(l).bodyClass])
|
|
211
225
|
}, [
|
|
212
|
-
|
|
213
|
-
], 2)) :
|
|
214
|
-
r(h).details ? (
|
|
226
|
+
v(d.$slots, "body")
|
|
227
|
+
], 2)) : C("", !0),
|
|
228
|
+
r(h).details ? (c(), f("details", {
|
|
215
229
|
key: 1,
|
|
216
|
-
class:
|
|
230
|
+
class: u(["p-[16px] border-t border-t-1", [r(l).bodyClass, r(l).borderClass]]),
|
|
217
231
|
ref_key: "detailsRef",
|
|
218
|
-
ref:
|
|
232
|
+
ref: m
|
|
219
233
|
}, [
|
|
220
|
-
|
|
221
|
-
class:
|
|
234
|
+
y("summary", {
|
|
235
|
+
class: u(["flex font-medium cursor-pointer details-none", r(l).detailsHeaderClass])
|
|
222
236
|
}, [
|
|
223
|
-
S(r(
|
|
237
|
+
S(r(L), {
|
|
224
238
|
strokeColor: r(l).iconChevronColor,
|
|
225
239
|
class: "icon my-[4px] mr-[8px] transition transform -rotate-90 open:rotate-0"
|
|
226
240
|
}, null, 8, ["strokeColor"]),
|
|
227
|
-
|
|
241
|
+
O(" " + P(e.detailsTitle), 1)
|
|
228
242
|
], 2),
|
|
229
|
-
|
|
243
|
+
y("div", {
|
|
230
244
|
ref_key: "contentRef",
|
|
231
|
-
ref:
|
|
245
|
+
ref: i
|
|
232
246
|
}, [
|
|
233
|
-
|
|
234
|
-
|
|
247
|
+
y("div", null, [
|
|
248
|
+
v(d.$slots, "details")
|
|
235
249
|
])
|
|
236
250
|
], 512)
|
|
237
|
-
], 2)) :
|
|
251
|
+
], 2)) : C("", !0),
|
|
252
|
+
d.$slots.footer ? (c(), f("div", {
|
|
253
|
+
key: 2,
|
|
254
|
+
class: u(r(l).bodyClass)
|
|
255
|
+
}, [
|
|
256
|
+
v(d.$slots, "footer")
|
|
257
|
+
], 2)) : C("", !0)
|
|
238
258
|
], 2));
|
|
239
259
|
}
|
|
240
260
|
});
|
|
241
261
|
export {
|
|
242
|
-
|
|
262
|
+
oe as default
|
|
243
263
|
};
|
|
244
264
|
//# sourceMappingURL=index.es.mjs.map
|
|
245
265
|
|
|
246
|
-
/* <
|
|
266
|
+
/* <wind-keep class="my-[4px] mr-[8px] overflow-hidden text-left flex flex-1 font-medium m-[4px] ml-[8px] h-[16px] p-[16px] border-t border-t-1 cursor-pointer details-none transition transform -rotate-90 open:rotate-0 py-[4px] px-[8px] leading-[22px] text-[14px] py-[8px] px-[12px] py-[12px] px-[16px] leading-[24px] text-[16px] text-gray-800 bg-gray-100 bg-gray-50 text-gray-500 border-gray-100 text-gray-600 text-indigo-700 bg-indigo-100 bg-indigo-50 text-indigo-500 border-indigo-100 text-indigo-600 text-orange-700 bg-orange-100 bg-orange-50 text-orange-500 border-orange-100 text-orange-600 text-red-700 bg-red-100 bg-red-50 text-red-500 border-red-100 text-red-600 text-jade-700 bg-jade-100 bg-jade-50 text-jade-600 border-jade-100 border-gray-50 bg-white border text-gray-700 icon-dark-gray-600 icon-dark-gray-500 icon-dark-gray-300 icon-dark-indigo-500 icon-dark-indigo-300 icon-dark-orange-500 icon-dark-orange-400 icon-dark-orange-300 icon-dark-red-500 icon-dark-red-400 icon-dark-red-300 icon-dark-jade-600 icon-dark-jade-500 icon-dark-jade-300"> */
|