@cypress-design/vue-alert 0.0.1 → 0.1.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/Alert.rootstory.tsx +2 -2
- package/Alert.stories.mdx +1 -1
- package/Alert.vue +7 -1
- package/CHANGELOG.md +33 -0
- package/dist/index.es.mjs +215 -0
- package/dist/index.es.mjs.map +1 -0
- package/dist/index.umd.js +2 -223
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -0
- package/dist/vue/Alert.vue.d.ts +155 -33
- package/dist/vue/Alert.vue.d.ts.map +1 -1
- package/package.json +5 -5
- package/tsconfig.build.json +3 -2
- package/vite.config.ts +7 -0
- package/dist/index.es.js +0 -223
- package/dist/index.es.js.map +0 -1
- package/rollup.config.js +0 -48
package/Alert.rootstory.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import dedent from 'dedent'
|
|
|
3
3
|
import { ref } from 'vue'
|
|
4
4
|
import Alert from './Alert.vue'
|
|
5
5
|
|
|
6
|
-
export default (
|
|
6
|
+
export default () => ({
|
|
7
7
|
setup() {
|
|
8
8
|
const displayTimedAlert = ref(false)
|
|
9
9
|
return () => (
|
|
@@ -107,4 +107,4 @@ export default (() => ({
|
|
|
107
107
|
</div>
|
|
108
108
|
)
|
|
109
109
|
},
|
|
110
|
-
})
|
|
110
|
+
})
|
package/Alert.stories.mdx
CHANGED
package/Alert.vue
CHANGED
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script lang="ts" setup>
|
|
34
|
-
import {
|
|
34
|
+
import type { FunctionalComponent, ComputedRef } from 'vue';
|
|
35
|
+
import { computed, useSlots, h, ref, onMounted, onUnmounted } from 'vue'
|
|
35
36
|
import {
|
|
36
37
|
IconChevronDownSmall, IconActionDeleteLarge,
|
|
37
38
|
IconWarningCircle, IconCheckmarkOutline,
|
|
@@ -132,8 +133,13 @@ const icon: ComputedRef<FunctionalComponent | null> = computed(() => {
|
|
|
132
133
|
</script>
|
|
133
134
|
|
|
134
135
|
<style scoped>
|
|
136
|
+
details :deep(summary::-webkit-details-marker) {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
135
140
|
details summary .icon {
|
|
136
141
|
transform: rotate(-90deg);
|
|
142
|
+
transition: transform 0.2s;
|
|
137
143
|
}
|
|
138
144
|
|
|
139
145
|
details[open] summary .icon {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @cypress-design/vue-alert
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#68](https://github.com/cypress-io/cypress-design/pull/68) [`8c577fb`](https://github.com/cypress-io/cypress-design/commit/8c577fb0c6a0411cf8218dfe78281834df3d6f13) Thanks [@elevatebart](https://github.com/elevatebart)! - feat: publish `.mjs` files for esm intead of `.js`
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`8c577fb`](https://github.com/cypress-io/cypress-design/commit/8c577fb0c6a0411cf8218dfe78281834df3d6f13)]:
|
|
10
|
+
- @cypress-design/vue-icon@0.5.2
|
|
11
|
+
|
|
12
|
+
## 0.1.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#51](https://github.com/cypress-io/cypress-design/pull/51) [`ccd8f9a`](https://github.com/cypress-io/cypress-design/commit/ccd8f9a8feb624c0a52deaa9754c76969f43fc1e) Thanks [@elevatebart](https://github.com/elevatebart)! - in the build asset, add a comment containing all used windicss classes in the component
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#46](https://github.com/cypress-io/cypress-design/pull/46) [`2608f59`](https://github.com/cypress-io/cypress-design/commit/2608f59e77f13ebdc25834309bf5d6390b37c350) Thanks [@elevatebart](https://github.com/elevatebart)! - fix alert story and details caret on webkit
|
|
21
|
+
|
|
22
|
+
* [#50](https://github.com/cypress-io/cypress-design/pull/50) [`1cb98e6`](https://github.com/cypress-io/cypress-design/commit/1cb98e6fc921e61e4645cdc9a60d48acb6d812c7) Thanks [@elevatebart](https://github.com/elevatebart)! - animate transition of details caret from closed to open
|
|
23
|
+
|
|
24
|
+
* Updated dependencies [[`ccd8f9a`](https://github.com/cypress-io/cypress-design/commit/ccd8f9a8feb624c0a52deaa9754c76969f43fc1e), [`0866c65`](https://github.com/cypress-io/cypress-design/commit/0866c654f24c36951c98468d789462748606b428), [`43b53eb`](https://github.com/cypress-io/cypress-design/commit/43b53eb6bd10111629239a87374cfcc894eda0e3)]:
|
|
25
|
+
- @cypress-design/vue-icon@0.5.0
|
|
26
|
+
|
|
27
|
+
## 0.0.2
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [`e3eb9c7`](https://github.com/cypress-io/cypress-design/commit/e3eb9c7fee2d7a6e0a773e85ed4b73be04d83587) Thanks [@elevatebart](https://github.com/elevatebart)! - downgrade typescript to 4.4 for compat with app
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`e3eb9c7`](https://github.com/cypress-io/cypress-design/commit/e3eb9c7fee2d7a6e0a773e85ed4b73be04d83587)]:
|
|
34
|
+
- @cypress-design/vue-icon@0.4.2
|
|
35
|
+
|
|
3
36
|
## 0.0.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { h as n, defineComponent as j, ref as A, useSlots as I, computed as f, onMounted as D, onUnmounted as S, openBlock as C, createElementBlock as b, normalizeClass as p, createElementVNode as v, unref as t, renderSlot as y, normalizeProps as x, guardReactiveProps as $, createBlock as E, resolveDynamicComponent as H, mergeProps as M, createCommentVNode as m, createVNode as _, createTextVNode as N, toDisplayString as O } from "vue";
|
|
2
|
+
import * as h from "@cypress-design/icon-registry";
|
|
3
|
+
import { ICON_COLOR_PROP_NAMES as T } from "@cypress-design/icon-registry";
|
|
4
|
+
const k = ({
|
|
5
|
+
body: s,
|
|
6
|
+
compiledClasses: e,
|
|
7
|
+
size: o,
|
|
8
|
+
class: r,
|
|
9
|
+
interactiveColorsOnGroup: c,
|
|
10
|
+
...l
|
|
11
|
+
}) => {
|
|
12
|
+
const a = Object.keys(l).reduce((i, d) => (T.includes(d) || (i[d] = l[d]), i), {}), u = {
|
|
13
|
+
width: o,
|
|
14
|
+
height: o,
|
|
15
|
+
fill: "none",
|
|
16
|
+
innerHTML: s,
|
|
17
|
+
...a
|
|
18
|
+
};
|
|
19
|
+
return e.length && (u.class = e.join(" ")), u;
|
|
20
|
+
}, B = (s) => {
|
|
21
|
+
const { sizeWithDefault: e, compiledClasses: o } = h.getComponentAttributes({ ...s, availableSizes: ["16"] }), r = {
|
|
22
|
+
16: '<path d="M3 13 13 3M3 3l10 10" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
23
|
+
}[e];
|
|
24
|
+
if (!r)
|
|
25
|
+
throw Error(`Icon "action-delete-large" is not available in size ${e}`);
|
|
26
|
+
return n("svg", k({
|
|
27
|
+
...s,
|
|
28
|
+
size: e,
|
|
29
|
+
body: r,
|
|
30
|
+
compiledClasses: o
|
|
31
|
+
}));
|
|
32
|
+
}, P = (s) => {
|
|
33
|
+
const { sizeWithDefault: e, compiledClasses: o } = h.getComponentAttributes({ ...s, availableSizes: ["16"] }), r = {
|
|
34
|
+
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"/>'
|
|
35
|
+
}[e];
|
|
36
|
+
if (!r)
|
|
37
|
+
throw Error(`Icon "checkmark-outline" is not available in size ${e}`);
|
|
38
|
+
return n("svg", k({
|
|
39
|
+
...s,
|
|
40
|
+
size: e,
|
|
41
|
+
body: r,
|
|
42
|
+
compiledClasses: o
|
|
43
|
+
}));
|
|
44
|
+
}, R = (s) => {
|
|
45
|
+
const { sizeWithDefault: e, compiledClasses: o } = h.getComponentAttributes({ ...s, availableSizes: ["8", "16"] }), r = {
|
|
46
|
+
8: '<path d="m1 2.5 3 3 3-3" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
|
|
47
|
+
16: '<path d="m4 6 4 4 4-4" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
48
|
+
}[e];
|
|
49
|
+
if (!r)
|
|
50
|
+
throw Error(`Icon "chevron-down-small" is not available in size ${e}`);
|
|
51
|
+
return n("svg", k({
|
|
52
|
+
...s,
|
|
53
|
+
size: e,
|
|
54
|
+
body: r,
|
|
55
|
+
compiledClasses: o
|
|
56
|
+
}));
|
|
57
|
+
}, z = (s) => {
|
|
58
|
+
const { sizeWithDefault: e, compiledClasses: o } = h.getComponentAttributes({ ...s, availableSizes: ["16"] }), r = {
|
|
59
|
+
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"/>'
|
|
60
|
+
}[e];
|
|
61
|
+
if (!r)
|
|
62
|
+
throw Error(`Icon "warning-circle" is not available in size ${e}`);
|
|
63
|
+
return n("svg", k({
|
|
64
|
+
...s,
|
|
65
|
+
size: e,
|
|
66
|
+
body: r,
|
|
67
|
+
compiledClasses: o
|
|
68
|
+
}));
|
|
69
|
+
}, w = {
|
|
70
|
+
neutral: {
|
|
71
|
+
headerClass: "text-gray-800 bg-gray-100",
|
|
72
|
+
bodyClass: "bg-gray-50 text-gray-500",
|
|
73
|
+
borderClass: "border-gray-100",
|
|
74
|
+
detailsHeaderClass: "text-gray-600",
|
|
75
|
+
iconCloseColor: "gray-600",
|
|
76
|
+
iconColor: "gray-500",
|
|
77
|
+
iconChevronColor: "gray-300"
|
|
78
|
+
},
|
|
79
|
+
info: {
|
|
80
|
+
headerClass: "text-indigo-700 bg-indigo-100",
|
|
81
|
+
bodyClass: "bg-indigo-50 text-indigo-500",
|
|
82
|
+
borderClass: "border-indigo-100",
|
|
83
|
+
detailsHeaderClass: "text-indigo-600",
|
|
84
|
+
iconCloseColor: "indigo-500",
|
|
85
|
+
iconColor: "indigo-500",
|
|
86
|
+
iconChevronColor: "indigo-300"
|
|
87
|
+
},
|
|
88
|
+
warning: {
|
|
89
|
+
headerClass: "text-orange-700 bg-orange-100",
|
|
90
|
+
bodyClass: "bg-orange-50 text-orange-500",
|
|
91
|
+
borderClass: "border-orange-100",
|
|
92
|
+
detailsHeaderClass: "text-orange-600",
|
|
93
|
+
iconCloseColor: "orange-500",
|
|
94
|
+
iconColor: "orange-400",
|
|
95
|
+
iconChevronColor: "orange-300"
|
|
96
|
+
},
|
|
97
|
+
error: {
|
|
98
|
+
headerClass: "text-red-700 bg-red-100",
|
|
99
|
+
bodyClass: "bg-red-50 text-red-500",
|
|
100
|
+
borderClass: "border-red-100",
|
|
101
|
+
detailsHeaderClass: "text-red-600",
|
|
102
|
+
iconCloseColor: "red-500",
|
|
103
|
+
iconColor: "red-400",
|
|
104
|
+
iconChevronColor: "red-300"
|
|
105
|
+
},
|
|
106
|
+
success: {
|
|
107
|
+
headerClass: "text-jade-700 bg-jade-100",
|
|
108
|
+
bodyClass: "bg-jade-50 text-jade-600",
|
|
109
|
+
borderClass: "border-jade-100",
|
|
110
|
+
detailsHeaderClass: "text-jade-600",
|
|
111
|
+
iconCloseColor: "jade-600",
|
|
112
|
+
iconColor: "jade-500",
|
|
113
|
+
iconChevronColor: "jade-300"
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const V = (s, e) => {
|
|
117
|
+
const o = s.__vccOpts || s;
|
|
118
|
+
for (const [r, c] of e)
|
|
119
|
+
o[r] = c;
|
|
120
|
+
return o;
|
|
121
|
+
}, Z = { class: "flex-1 font-medium" }, W = { class: "mt-16px" }, L = /* @__PURE__ */ j({
|
|
122
|
+
__name: "Alert",
|
|
123
|
+
props: {
|
|
124
|
+
type: { default: "info" },
|
|
125
|
+
detailsTitle: { default: "Additional details" },
|
|
126
|
+
dismissible: { type: Boolean },
|
|
127
|
+
noIcon: { type: Boolean },
|
|
128
|
+
notRounded: { type: Boolean },
|
|
129
|
+
duration: null
|
|
130
|
+
},
|
|
131
|
+
emits: ["dismiss"],
|
|
132
|
+
setup(s, { emit: e }) {
|
|
133
|
+
const o = s, r = A(!1), c = I(), l = f(() => w[o.type]);
|
|
134
|
+
let a;
|
|
135
|
+
D(() => {
|
|
136
|
+
o.duration && (a = setTimeout(u, o.duration));
|
|
137
|
+
}), S(() => {
|
|
138
|
+
a && clearTimeout(a);
|
|
139
|
+
});
|
|
140
|
+
function u() {
|
|
141
|
+
r.value = !0, e("dismiss"), a && (clearTimeout(a), a = void 0);
|
|
142
|
+
}
|
|
143
|
+
const i = f(() => ({
|
|
144
|
+
strokeColor: w[o.type].iconColor,
|
|
145
|
+
class: "my-4px mr-8px"
|
|
146
|
+
})), d = f(() => {
|
|
147
|
+
switch (o.type) {
|
|
148
|
+
case "info":
|
|
149
|
+
return null;
|
|
150
|
+
case "success":
|
|
151
|
+
return () => n(P, i.value);
|
|
152
|
+
case "warning":
|
|
153
|
+
return () => n(z, i.value);
|
|
154
|
+
case "error":
|
|
155
|
+
return () => n(z, i.value);
|
|
156
|
+
default:
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return (g, G) => r.value ? m("", !0) : (C(), b("div", {
|
|
161
|
+
key: 0,
|
|
162
|
+
class: p(["overflow-hidden text-left", o.notRounded ? void 0 : "rounded"])
|
|
163
|
+
}, [
|
|
164
|
+
v("div", {
|
|
165
|
+
class: p(["flex p-16px", t(l).headerClass])
|
|
166
|
+
}, [
|
|
167
|
+
y(g.$slots, "icon", x($(t(i))), () => [
|
|
168
|
+
!o.noIcon && t(d) ? (C(), E(H(t(d)), x(M({ key: 0 }, t(i))), null, 16)) : m("", !0)
|
|
169
|
+
], !0),
|
|
170
|
+
v("div", Z, [
|
|
171
|
+
y(g.$slots, "default", {}, void 0, !0)
|
|
172
|
+
]),
|
|
173
|
+
s.dismissible ? (C(), b("button", {
|
|
174
|
+
key: 0,
|
|
175
|
+
class: "m-4px ml-8px h-16px",
|
|
176
|
+
onClick: u,
|
|
177
|
+
"aria-label": "Dismiss"
|
|
178
|
+
}, [
|
|
179
|
+
_(t(B), {
|
|
180
|
+
"stroke-color": t(l).iconCloseColor
|
|
181
|
+
}, null, 8, ["stroke-color"])
|
|
182
|
+
])) : m("", !0)
|
|
183
|
+
], 2),
|
|
184
|
+
t(c).body ? (C(), b("div", {
|
|
185
|
+
key: 0,
|
|
186
|
+
class: p(["p-16px", t(l).bodyClass])
|
|
187
|
+
}, [
|
|
188
|
+
y(g.$slots, "body", {}, void 0, !0)
|
|
189
|
+
], 2)) : m("", !0),
|
|
190
|
+
t(c).details ? (C(), b("details", {
|
|
191
|
+
key: 1,
|
|
192
|
+
class: p(["p-16px border-t-1", [t(l).bodyClass, t(l).borderClass]])
|
|
193
|
+
}, [
|
|
194
|
+
v("summary", {
|
|
195
|
+
class: p(["flex font-medium cursor-pointer", t(l).detailsHeaderClass])
|
|
196
|
+
}, [
|
|
197
|
+
_(t(R), {
|
|
198
|
+
strokeColor: t(l).iconChevronColor,
|
|
199
|
+
class: "icon my-4px mr-8px"
|
|
200
|
+
}, null, 8, ["strokeColor"]),
|
|
201
|
+
N(" " + O(o.detailsTitle), 1)
|
|
202
|
+
], 2),
|
|
203
|
+
v("div", W, [
|
|
204
|
+
y(g.$slots, "details", {}, void 0, !0)
|
|
205
|
+
])
|
|
206
|
+
], 2)) : m("", !0)
|
|
207
|
+
], 2));
|
|
208
|
+
}
|
|
209
|
+
}), F = /* @__PURE__ */ V(L, [["__scopeId", "data-v-5e7e1d8e"]]);
|
|
210
|
+
export {
|
|
211
|
+
F as default
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/* <windicss-keep class="overflow-hidden text-left rounded flex p-16px flex-1 font-medium m-4px ml-8px h-16px border-t-1 cursor-pointer my-4px mr-8px mt-16px transform 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"> */
|
|
215
|
+
//# sourceMappingURL=index.es.mjs.map
|