@cypress-design/vue-alert 0.1.2 → 0.2.0
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/Alert.rootstory.tsx +85 -71
- package/Alert.stories.mdx +1 -1
- package/Alert.vue +77 -61
- package/AlertVue.cy.tsx +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.es.mjs +106 -98
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/vue/Alert.vue.d.ts +29 -6
- package/dist/vue/Alert.vue.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.mjs
CHANGED
|
@@ -1,73 +1,80 @@
|
|
|
1
|
-
import { h as
|
|
1
|
+
import { h as a, defineComponent as R, ref as z, useSlots as T, computed as f, onMounted as j, onUnmounted as I, openBlock as C, createElementBlock as x, normalizeClass as p, createElementVNode as m, unref as r, renderSlot as k, normalizeProps as A, guardReactiveProps as _, createBlock as B, resolveDynamicComponent as E, mergeProps as H, createCommentVNode as g, createVNode as S, createTextVNode as N, toDisplayString as O } from "vue";
|
|
2
2
|
import * as y from "@cypress-design/icon-registry";
|
|
3
|
-
import { ICON_COLOR_PROP_NAMES as
|
|
4
|
-
import { DetailsAnimation as
|
|
5
|
-
const
|
|
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 v = ({
|
|
6
6
|
body: s,
|
|
7
|
-
compiledClasses:
|
|
8
|
-
size:
|
|
9
|
-
class:
|
|
10
|
-
interactiveColorsOnGroup:
|
|
11
|
-
...
|
|
7
|
+
compiledClasses: o,
|
|
8
|
+
size: e,
|
|
9
|
+
class: t,
|
|
10
|
+
interactiveColorsOnGroup: h,
|
|
11
|
+
...i
|
|
12
12
|
}) => {
|
|
13
|
-
const c = Object.keys(
|
|
14
|
-
width:
|
|
15
|
-
height:
|
|
13
|
+
const c = Object.keys(i).reduce((n, d) => (P.includes(d) || (n[d] = i[d]), n), {}), l = {
|
|
14
|
+
width: e,
|
|
15
|
+
height: e,
|
|
16
|
+
viewBox: `0 0 ${e} ${e}`,
|
|
16
17
|
fill: "none",
|
|
17
18
|
innerHTML: s,
|
|
18
19
|
...c
|
|
19
20
|
};
|
|
20
|
-
return
|
|
21
|
-
},
|
|
22
|
-
const { sizeWithDefault:
|
|
23
|
-
16: '<path d="M3 13 13 3M3 3l10 10" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
return o.length && (l.class = o.join(" ")), l;
|
|
22
|
+
}, Z = (s) => {
|
|
23
|
+
const { sizeWithDefault: o, compiledClasses: e } = y.getComponentAttributes({ ...s, availableSizes: ["16", "24"] }), t = {
|
|
24
|
+
16: '<path d="M3 13 13 3M3 3l10 10" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
|
|
25
|
+
24: '<path d="M4 20 20 4M4 4l16 16" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
26
|
+
}[o];
|
|
27
|
+
if (!t)
|
|
28
|
+
throw Error(`Icon "action-delete-large" is not available in size ${o}`);
|
|
29
|
+
return a("svg", v({
|
|
28
30
|
...s,
|
|
29
|
-
size:
|
|
30
|
-
body:
|
|
31
|
-
compiledClasses:
|
|
31
|
+
size: o,
|
|
32
|
+
body: t,
|
|
33
|
+
compiledClasses: e
|
|
32
34
|
}));
|
|
33
|
-
},
|
|
34
|
-
const { sizeWithDefault:
|
|
35
|
+
}, W = (s) => {
|
|
36
|
+
const { sizeWithDefault: o, compiledClasses: e } = y.getComponentAttributes({ ...s, availableSizes: ["16"] }), t = {
|
|
35
37
|
16: '<path d="M12.95 12.95a7 7 0 1 1-9.9-9.9 7 7 0 0 1 9.9 9.9Z" stroke="currentColor" stroke-width="2" class="icon-dark"/><path d="m6 8 1.5 2L10 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon-dark"/>'
|
|
36
|
-
}[
|
|
37
|
-
if (!
|
|
38
|
-
throw Error(`Icon "checkmark-outline" is not available in size ${
|
|
39
|
-
return
|
|
38
|
+
}[o];
|
|
39
|
+
if (!t)
|
|
40
|
+
throw Error(`Icon "checkmark-outline" is not available in size ${o}`);
|
|
41
|
+
return a("svg", v({
|
|
40
42
|
...s,
|
|
41
|
-
size:
|
|
42
|
-
body:
|
|
43
|
-
compiledClasses:
|
|
43
|
+
size: o,
|
|
44
|
+
body: t,
|
|
45
|
+
compiledClasses: e
|
|
44
46
|
}));
|
|
45
|
-
},
|
|
46
|
-
const { sizeWithDefault:
|
|
47
|
+
}, L = (s) => {
|
|
48
|
+
const { sizeWithDefault: o, compiledClasses: e } = y.getComponentAttributes({ ...s, availableSizes: ["8", "16"] }), t = {
|
|
47
49
|
8: '<path d="m1 2.5 3 3 3-3" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
|
|
48
50
|
16: '<path d="m4 6 4 4 4-4" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
49
|
-
}[
|
|
50
|
-
if (!
|
|
51
|
-
throw Error(`Icon "chevron-down-small" is not available in size ${
|
|
52
|
-
return
|
|
51
|
+
}[o];
|
|
52
|
+
if (!t)
|
|
53
|
+
throw Error(`Icon "chevron-down-small" is not available in size ${o}`);
|
|
54
|
+
return a("svg", v({
|
|
53
55
|
...s,
|
|
54
|
-
size:
|
|
55
|
-
body:
|
|
56
|
-
compiledClasses:
|
|
56
|
+
size: o,
|
|
57
|
+
body: t,
|
|
58
|
+
compiledClasses: e
|
|
57
59
|
}));
|
|
58
|
-
},
|
|
59
|
-
const { sizeWithDefault:
|
|
60
|
+
}, $ = (s) => {
|
|
61
|
+
const { sizeWithDefault: o, compiledClasses: e } = y.getComponentAttributes({ ...s, availableSizes: ["16"] }), t = {
|
|
60
62
|
16: '<path fill-rule="evenodd" clip-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" fill="currentColor" class="icon-dark"/>'
|
|
61
|
-
}[
|
|
62
|
-
if (!
|
|
63
|
-
throw Error(`Icon "warning-circle" is not available in size ${
|
|
64
|
-
return
|
|
63
|
+
}[o];
|
|
64
|
+
if (!t)
|
|
65
|
+
throw Error(`Icon "warning-circle" is not available in size ${o}`);
|
|
66
|
+
return a("svg", v({
|
|
65
67
|
...s,
|
|
66
|
-
size:
|
|
67
|
-
body:
|
|
68
|
-
compiledClasses:
|
|
68
|
+
size: o,
|
|
69
|
+
body: t,
|
|
70
|
+
compiledClasses: e
|
|
69
71
|
}));
|
|
70
|
-
},
|
|
72
|
+
}, q = {
|
|
73
|
+
xs: "py-4px px-8px leading-22px text-14px",
|
|
74
|
+
sm: "py-8px px-12px leading-22px text-14px",
|
|
75
|
+
md: "py-12px px-16px leading-24px text-16px",
|
|
76
|
+
lg: "p-16px leading-24px text-16px"
|
|
77
|
+
}, G = "lg", D = {
|
|
71
78
|
neutral: {
|
|
72
79
|
headerClass: "text-gray-800 bg-gray-100",
|
|
73
80
|
bodyClass: "bg-gray-50 text-gray-500",
|
|
@@ -113,98 +120,99 @@ const h = ({
|
|
|
113
120
|
iconColor: "jade-500",
|
|
114
121
|
iconChevronColor: "jade-300"
|
|
115
122
|
}
|
|
116
|
-
},
|
|
123
|
+
}, U = "info", F = "Additional details", J = { class: "flex-1 font-medium" }, ee = /* @__PURE__ */ R({
|
|
117
124
|
__name: "Alert",
|
|
118
125
|
props: {
|
|
119
|
-
type: { default:
|
|
120
|
-
detailsTitle: { default:
|
|
126
|
+
type: { default: U },
|
|
127
|
+
detailsTitle: { default: F },
|
|
121
128
|
dismissible: { type: Boolean },
|
|
122
129
|
noIcon: { type: Boolean },
|
|
123
130
|
notRounded: { type: Boolean },
|
|
124
|
-
duration: null
|
|
131
|
+
duration: null,
|
|
132
|
+
size: { default: G }
|
|
125
133
|
},
|
|
126
134
|
emits: ["dismiss"],
|
|
127
|
-
setup(s, { emit:
|
|
128
|
-
const
|
|
129
|
-
let
|
|
135
|
+
setup(s, { emit: o }) {
|
|
136
|
+
const e = s, t = z(!1), h = T(), i = z(null), c = z(null), l = f(() => D[e.type]);
|
|
137
|
+
let n;
|
|
130
138
|
j(() => {
|
|
131
|
-
|
|
139
|
+
e.duration && (n = setTimeout(d, e.duration));
|
|
132
140
|
}), j(() => {
|
|
133
|
-
|
|
134
|
-
}),
|
|
135
|
-
|
|
141
|
+
i.value && c.value && new V(i.value, c.value);
|
|
142
|
+
}), I(() => {
|
|
143
|
+
n && clearTimeout(n);
|
|
136
144
|
});
|
|
137
145
|
function d() {
|
|
138
|
-
|
|
146
|
+
t.value = !0, o("dismiss"), n && (clearTimeout(n), n = void 0);
|
|
139
147
|
}
|
|
140
|
-
const u =
|
|
141
|
-
strokeColor:
|
|
148
|
+
const u = f(() => ({
|
|
149
|
+
strokeColor: D[e.type].iconColor,
|
|
142
150
|
class: "my-4px mr-8px"
|
|
143
|
-
})), w =
|
|
144
|
-
switch (
|
|
151
|
+
})), w = f(() => {
|
|
152
|
+
switch (e.type) {
|
|
145
153
|
case "info":
|
|
146
154
|
return null;
|
|
147
155
|
case "success":
|
|
148
|
-
return () =>
|
|
156
|
+
return () => a(W, u.value);
|
|
149
157
|
case "warning":
|
|
150
|
-
return () =>
|
|
158
|
+
return () => a($, u.value);
|
|
151
159
|
case "error":
|
|
152
|
-
return () =>
|
|
160
|
+
return () => a($, u.value);
|
|
153
161
|
default:
|
|
154
162
|
return null;
|
|
155
163
|
}
|
|
156
|
-
});
|
|
157
|
-
return (b,
|
|
164
|
+
}), M = f(() => q[e.size]);
|
|
165
|
+
return (b, K) => t.value ? g("", !0) : (C(), x("div", {
|
|
158
166
|
key: 0,
|
|
159
|
-
class:
|
|
167
|
+
class: p(["overflow-hidden text-left", e.notRounded ? void 0 : "rounded"])
|
|
160
168
|
}, [
|
|
161
|
-
|
|
162
|
-
class:
|
|
169
|
+
m("div", {
|
|
170
|
+
class: p(["flex", [r(l).headerClass, r(M)]])
|
|
163
171
|
}, [
|
|
164
|
-
|
|
165
|
-
!
|
|
172
|
+
k(b.$slots, "icon", A(_(r(u))), () => [
|
|
173
|
+
!e.noIcon && r(w) ? (C(), B(E(r(w)), A(H({ key: 0 }, r(u))), null, 16)) : g("", !0)
|
|
166
174
|
]),
|
|
167
|
-
|
|
168
|
-
|
|
175
|
+
m("div", J, [
|
|
176
|
+
k(b.$slots, "default")
|
|
169
177
|
]),
|
|
170
|
-
s.dismissible ? (C(),
|
|
178
|
+
s.dismissible ? (C(), x("button", {
|
|
171
179
|
key: 0,
|
|
172
180
|
class: "m-4px ml-8px h-16px",
|
|
173
181
|
onClick: d,
|
|
174
182
|
"aria-label": "Dismiss"
|
|
175
183
|
}, [
|
|
176
|
-
|
|
177
|
-
"stroke-color":
|
|
184
|
+
S(r(Z), {
|
|
185
|
+
"stroke-color": r(l).iconCloseColor
|
|
178
186
|
}, null, 8, ["stroke-color"])
|
|
179
187
|
])) : g("", !0)
|
|
180
188
|
], 2),
|
|
181
|
-
|
|
189
|
+
r(h).body ? (C(), x("div", {
|
|
182
190
|
key: 0,
|
|
183
|
-
class:
|
|
191
|
+
class: p(["p-16px", r(l).bodyClass])
|
|
184
192
|
}, [
|
|
185
|
-
|
|
193
|
+
k(b.$slots, "body")
|
|
186
194
|
], 2)) : g("", !0),
|
|
187
|
-
|
|
195
|
+
r(h).details ? (C(), x("details", {
|
|
188
196
|
key: 1,
|
|
189
|
-
class:
|
|
197
|
+
class: p(["p-16px border-t-1", [r(l).bodyClass, r(l).borderClass]]),
|
|
190
198
|
ref_key: "detailsRef",
|
|
191
|
-
ref:
|
|
199
|
+
ref: i
|
|
192
200
|
}, [
|
|
193
|
-
|
|
194
|
-
class:
|
|
201
|
+
m("summary", {
|
|
202
|
+
class: p(["flex font-medium cursor-pointer details-none", r(l).detailsHeaderClass])
|
|
195
203
|
}, [
|
|
196
|
-
|
|
197
|
-
strokeColor:
|
|
204
|
+
S(r(L), {
|
|
205
|
+
strokeColor: r(l).iconChevronColor,
|
|
198
206
|
class: "icon my-4px mr-8px transition transform -rotate-90 open:rotate-0"
|
|
199
207
|
}, null, 8, ["strokeColor"]),
|
|
200
|
-
|
|
208
|
+
N(" " + O(e.detailsTitle), 1)
|
|
201
209
|
], 2),
|
|
202
|
-
|
|
210
|
+
m("div", {
|
|
203
211
|
ref_key: "contentRef",
|
|
204
212
|
ref: c
|
|
205
213
|
}, [
|
|
206
|
-
|
|
207
|
-
|
|
214
|
+
m("div", null, [
|
|
215
|
+
k(b.$slots, "details")
|
|
208
216
|
])
|
|
209
217
|
], 512)
|
|
210
218
|
], 2)) : g("", !0)
|
|
@@ -212,8 +220,8 @@ const h = ({
|
|
|
212
220
|
}
|
|
213
221
|
});
|
|
214
222
|
export {
|
|
215
|
-
|
|
223
|
+
ee as default
|
|
216
224
|
};
|
|
217
225
|
|
|
218
|
-
/* <windicss-keep class="overflow-hidden text-left rounded flex
|
|
226
|
+
/* <windicss-keep class="my-4px mr-8px overflow-hidden text-left rounded flex flex-1 font-medium m-4px ml-8px h-16px p-16px 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 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"> */
|
|
219
227
|
//# sourceMappingURL=index.es.mjs.map
|