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