@cypress-design/vue-alert 0.2.0 → 0.3.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 +4 -4
- package/Alert.vue +5 -5
- package/AlertVue.cy.tsx +1 -0
- package/CHANGELOG.md +11 -0
- package/dist/constants.d.ts +4 -4
- package/dist/index.es.mjs +37 -37
- 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/Alert.rootstory.tsx
CHANGED
|
@@ -6,14 +6,14 @@ import Alert from './Alert.vue'
|
|
|
6
6
|
export default () => {
|
|
7
7
|
const displayTimedAlert = ref(false)
|
|
8
8
|
return (
|
|
9
|
-
<div class="flex flex-col p-4 gap-16px">
|
|
9
|
+
<div class="flex flex-col p-4 gap-[16px]">
|
|
10
10
|
<Alert type="error" detailsTitle="Stack trace" data-cy="alert-1">
|
|
11
11
|
{{
|
|
12
12
|
default: () => 'Spec not found',
|
|
13
13
|
body: () => (
|
|
14
14
|
<>
|
|
15
15
|
There is no spec matching the following location:
|
|
16
|
-
<code class="bg-red-100 m-8px rounded px-2px">
|
|
16
|
+
<code class="bg-red-100 m-[8px] rounded px-[2px]">
|
|
17
17
|
path/to/spec.cy.js
|
|
18
18
|
</code>
|
|
19
19
|
<br />
|
|
@@ -23,7 +23,7 @@ export default () => {
|
|
|
23
23
|
</>
|
|
24
24
|
),
|
|
25
25
|
details: () => (
|
|
26
|
-
<pre class="bg-white rounded border border-red-500 px-16px py-8px overflow-x-auto">
|
|
26
|
+
<pre class="bg-white rounded border border-red-500 px-[16px] py-[8px] overflow-x-auto">
|
|
27
27
|
{dedent`Uncaught Error: Error occurred in defineConfig()
|
|
28
28
|
Trace: add called with 2 and 3
|
|
29
29
|
at sum (/home/dev/Documents/stacktrace.js:2:13)
|
|
@@ -62,7 +62,7 @@ export default () => {
|
|
|
62
62
|
}}
|
|
63
63
|
</Alert>
|
|
64
64
|
<button
|
|
65
|
-
class="border rounded p-8px"
|
|
65
|
+
class="border rounded p-[8px]"
|
|
66
66
|
onClick={() => (displayTimedAlert.value = true)}
|
|
67
67
|
>
|
|
68
68
|
open alert for 5 seconds
|
package/Alert.vue
CHANGED
|
@@ -106,7 +106,7 @@ function dismiss() {
|
|
|
106
106
|
const computedIconProps = computed(() => {
|
|
107
107
|
return {
|
|
108
108
|
strokeColor: alertClasses[props.type].iconColor,
|
|
109
|
-
class: 'my-4px mr-8px',
|
|
109
|
+
class: 'my-[4px] mr-[8px]',
|
|
110
110
|
}
|
|
111
111
|
})
|
|
112
112
|
|
|
@@ -151,20 +151,20 @@ const sizeClasses = computed(() => {
|
|
|
151
151
|
</div>
|
|
152
152
|
<button
|
|
153
153
|
v-if="dismissible"
|
|
154
|
-
class="m-4px ml-8px h-16px"
|
|
154
|
+
class="m-[4px] ml-[8px] h-[16px]"
|
|
155
155
|
@click="dismiss"
|
|
156
156
|
aria-label="Dismiss"
|
|
157
157
|
>
|
|
158
158
|
<IconActionDeleteLarge :stroke-color="typeClasses.iconCloseColor" />
|
|
159
159
|
</button>
|
|
160
160
|
</div>
|
|
161
|
-
<div v-if="slots.body" class="p-16px" :class="typeClasses.bodyClass">
|
|
161
|
+
<div v-if="slots.body" class="p-[16px]" :class="typeClasses.bodyClass">
|
|
162
162
|
<!-- @slot body/details of the alert -->
|
|
163
163
|
<slot name="body" />
|
|
164
164
|
</div>
|
|
165
165
|
<details
|
|
166
166
|
v-if="slots.details"
|
|
167
|
-
class="p-16px border-t-1"
|
|
167
|
+
class="p-[16px] border-t-1"
|
|
168
168
|
ref="detailsRef"
|
|
169
169
|
:class="[typeClasses.bodyClass, typeClasses.borderClass]"
|
|
170
170
|
>
|
|
@@ -174,7 +174,7 @@ const sizeClasses = computed(() => {
|
|
|
174
174
|
>
|
|
175
175
|
<IconChevronDownSmall
|
|
176
176
|
:strokeColor="typeClasses.iconChevronColor"
|
|
177
|
-
class="icon my-4px mr-8px transition transform -rotate-90 open:rotate-0"
|
|
177
|
+
class="icon my-[4px] mr-[8px] transition transform -rotate-90 open:rotate-0"
|
|
178
178
|
/>
|
|
179
179
|
{{ props.detailsTitle }}
|
|
180
180
|
</summary>
|
package/AlertVue.cy.tsx
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @cypress-design/vue-alert
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#151](https://github.com/cypress-io/cypress-design/pull/151) [`8b0e735`](https://github.com/cypress-io/cypress-design/commit/8b0e7356eb64a6b3583d3486dda8ecbb11c34cca) Thanks [@elevatebart](https://github.com/elevatebart)! - refactor: use clases compatible with both windi and tailwind
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`106b61a`](https://github.com/cypress-io/cypress-design/commit/106b61a97888f956a4c9d235fde5efb4243e1445), [`7b4f416`](https://github.com/cypress-io/cypress-design/commit/7b4f4162a0d150aa8cab7ec239faebb58c39464d)]:
|
|
12
|
+
- @cypress-design/vue-icon@0.18.0
|
|
13
|
+
|
|
3
14
|
## 0.2.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { WindiColor } from '@cypress-design/icon-registry';
|
|
2
2
|
export declare type AlertType = 'info' | 'success' | 'error' | 'warning' | 'neutral';
|
|
3
3
|
export declare const alertSizesClasses: {
|
|
4
|
-
readonly xs: "py-4px px-8px leading-22px text-14px";
|
|
5
|
-
readonly sm: "py-8px px-12px leading-22px text-14px";
|
|
6
|
-
readonly md: "py-12px px-16px leading-24px text-16px";
|
|
7
|
-
readonly lg: "p-16px leading-24px text-16px";
|
|
4
|
+
readonly xs: "py-[4px] px-[8px] leading-[22px] text-[14px]";
|
|
5
|
+
readonly sm: "py-[8px] px-[12px] leading-[22px] text-[14px]";
|
|
6
|
+
readonly md: "py-[12px] px-[16px] leading-[24px] text-[16px]";
|
|
7
|
+
readonly lg: "p-[16px] leading-[24px] text-[16px]";
|
|
8
8
|
};
|
|
9
9
|
export declare type AlertSize = keyof typeof alertSizesClasses;
|
|
10
10
|
export declare const defaultAlertSize: AlertSize;
|
package/dist/index.es.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as
|
|
1
|
+
import { h as i, 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 B, createBlock as E, resolveDynamicComponent as H, mergeProps as _, 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
3
|
import { ICON_COLOR_PROP_NAMES as P } from "@cypress-design/icon-registry";
|
|
4
4
|
import { DetailsAnimation as V } from "@cypress-design/details-animation";
|
|
@@ -8,9 +8,9 @@ const v = ({
|
|
|
8
8
|
size: e,
|
|
9
9
|
class: t,
|
|
10
10
|
interactiveColorsOnGroup: h,
|
|
11
|
-
...
|
|
11
|
+
...d
|
|
12
12
|
}) => {
|
|
13
|
-
const c = Object.keys(
|
|
13
|
+
const c = Object.keys(d).reduce((a, n) => (!P.includes(n) && n !== "name" && (a[n] = d[n]), a), {}), l = {
|
|
14
14
|
width: e,
|
|
15
15
|
height: e,
|
|
16
16
|
viewBox: `0 0 ${e} ${e}`,
|
|
@@ -26,7 +26,7 @@ const v = ({
|
|
|
26
26
|
}[o];
|
|
27
27
|
if (!t)
|
|
28
28
|
throw Error(`Icon "action-delete-large" is not available in size ${o}`);
|
|
29
|
-
return
|
|
29
|
+
return i("svg", v({
|
|
30
30
|
...s,
|
|
31
31
|
size: o,
|
|
32
32
|
body: t,
|
|
@@ -38,7 +38,7 @@ const v = ({
|
|
|
38
38
|
}[o];
|
|
39
39
|
if (!t)
|
|
40
40
|
throw Error(`Icon "checkmark-outline" is not available in size ${o}`);
|
|
41
|
-
return
|
|
41
|
+
return i("svg", v({
|
|
42
42
|
...s,
|
|
43
43
|
size: o,
|
|
44
44
|
body: t,
|
|
@@ -51,7 +51,7 @@ const v = ({
|
|
|
51
51
|
}[o];
|
|
52
52
|
if (!t)
|
|
53
53
|
throw Error(`Icon "chevron-down-small" is not available in size ${o}`);
|
|
54
|
-
return
|
|
54
|
+
return i("svg", v({
|
|
55
55
|
...s,
|
|
56
56
|
size: o,
|
|
57
57
|
body: t,
|
|
@@ -63,18 +63,18 @@ const v = ({
|
|
|
63
63
|
}[o];
|
|
64
64
|
if (!t)
|
|
65
65
|
throw Error(`Icon "warning-circle" is not available in size ${o}`);
|
|
66
|
-
return
|
|
66
|
+
return i("svg", v({
|
|
67
67
|
...s,
|
|
68
68
|
size: o,
|
|
69
69
|
body: t,
|
|
70
70
|
compiledClasses: e
|
|
71
71
|
}));
|
|
72
|
-
},
|
|
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
|
-
},
|
|
72
|
+
}, G = {
|
|
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
|
+
}, U = "lg", D = {
|
|
78
78
|
neutral: {
|
|
79
79
|
headerClass: "text-gray-800 bg-gray-100",
|
|
80
80
|
bodyClass: "bg-gray-50 text-gray-500",
|
|
@@ -120,48 +120,48 @@ const v = ({
|
|
|
120
120
|
iconColor: "jade-500",
|
|
121
121
|
iconChevronColor: "jade-300"
|
|
122
122
|
}
|
|
123
|
-
},
|
|
123
|
+
}, q = "info", F = "Additional details", J = { class: "flex-1 font-medium" }, ee = /* @__PURE__ */ R({
|
|
124
124
|
__name: "Alert",
|
|
125
125
|
props: {
|
|
126
|
-
type: { default:
|
|
126
|
+
type: { default: q },
|
|
127
127
|
detailsTitle: { default: F },
|
|
128
128
|
dismissible: { type: Boolean },
|
|
129
129
|
noIcon: { type: Boolean },
|
|
130
130
|
notRounded: { type: Boolean },
|
|
131
131
|
duration: null,
|
|
132
|
-
size: { default:
|
|
132
|
+
size: { default: U }
|
|
133
133
|
},
|
|
134
134
|
emits: ["dismiss"],
|
|
135
135
|
setup(s, { emit: o }) {
|
|
136
|
-
const e = s, t = z(!1), h = T(),
|
|
137
|
-
let
|
|
136
|
+
const e = s, t = z(!1), h = T(), d = z(null), c = z(null), l = f(() => D[e.type]);
|
|
137
|
+
let a;
|
|
138
138
|
j(() => {
|
|
139
|
-
e.duration && (
|
|
139
|
+
e.duration && (a = setTimeout(n, e.duration));
|
|
140
140
|
}), j(() => {
|
|
141
|
-
|
|
141
|
+
d.value && c.value && new V(d.value, c.value);
|
|
142
142
|
}), I(() => {
|
|
143
|
-
|
|
143
|
+
a && clearTimeout(a);
|
|
144
144
|
});
|
|
145
|
-
function
|
|
146
|
-
t.value = !0, o("dismiss"),
|
|
145
|
+
function n() {
|
|
146
|
+
t.value = !0, o("dismiss"), a && (clearTimeout(a), a = void 0);
|
|
147
147
|
}
|
|
148
148
|
const u = f(() => ({
|
|
149
149
|
strokeColor: D[e.type].iconColor,
|
|
150
|
-
class: "my-4px mr-8px"
|
|
150
|
+
class: "my-[4px] mr-[8px]"
|
|
151
151
|
})), w = f(() => {
|
|
152
152
|
switch (e.type) {
|
|
153
153
|
case "info":
|
|
154
154
|
return null;
|
|
155
155
|
case "success":
|
|
156
|
-
return () =>
|
|
156
|
+
return () => i(W, u.value);
|
|
157
157
|
case "warning":
|
|
158
|
-
return () =>
|
|
158
|
+
return () => i($, u.value);
|
|
159
159
|
case "error":
|
|
160
|
-
return () =>
|
|
160
|
+
return () => i($, u.value);
|
|
161
161
|
default:
|
|
162
162
|
return null;
|
|
163
163
|
}
|
|
164
|
-
}), M = f(() =>
|
|
164
|
+
}), M = f(() => G[e.size]);
|
|
165
165
|
return (b, K) => t.value ? g("", !0) : (C(), x("div", {
|
|
166
166
|
key: 0,
|
|
167
167
|
class: p(["overflow-hidden text-left", e.notRounded ? void 0 : "rounded"])
|
|
@@ -169,16 +169,16 @@ const v = ({
|
|
|
169
169
|
m("div", {
|
|
170
170
|
class: p(["flex", [r(l).headerClass, r(M)]])
|
|
171
171
|
}, [
|
|
172
|
-
k(b.$slots, "icon", A(
|
|
173
|
-
!e.noIcon && r(w) ? (C(),
|
|
172
|
+
k(b.$slots, "icon", A(B(r(u))), () => [
|
|
173
|
+
!e.noIcon && r(w) ? (C(), E(H(r(w)), A(_({ key: 0 }, r(u))), null, 16)) : g("", !0)
|
|
174
174
|
]),
|
|
175
175
|
m("div", J, [
|
|
176
176
|
k(b.$slots, "default")
|
|
177
177
|
]),
|
|
178
178
|
s.dismissible ? (C(), x("button", {
|
|
179
179
|
key: 0,
|
|
180
|
-
class: "m-4px ml-8px h-16px",
|
|
181
|
-
onClick:
|
|
180
|
+
class: "m-[4px] ml-[8px] h-[16px]",
|
|
181
|
+
onClick: n,
|
|
182
182
|
"aria-label": "Dismiss"
|
|
183
183
|
}, [
|
|
184
184
|
S(r(Z), {
|
|
@@ -188,22 +188,22 @@ const v = ({
|
|
|
188
188
|
], 2),
|
|
189
189
|
r(h).body ? (C(), x("div", {
|
|
190
190
|
key: 0,
|
|
191
|
-
class: p(["p-16px", r(l).bodyClass])
|
|
191
|
+
class: p(["p-[16px]", r(l).bodyClass])
|
|
192
192
|
}, [
|
|
193
193
|
k(b.$slots, "body")
|
|
194
194
|
], 2)) : g("", !0),
|
|
195
195
|
r(h).details ? (C(), x("details", {
|
|
196
196
|
key: 1,
|
|
197
|
-
class: p(["p-16px border-t-1", [r(l).bodyClass, r(l).borderClass]]),
|
|
197
|
+
class: p(["p-[16px] border-t-1", [r(l).bodyClass, r(l).borderClass]]),
|
|
198
198
|
ref_key: "detailsRef",
|
|
199
|
-
ref:
|
|
199
|
+
ref: d
|
|
200
200
|
}, [
|
|
201
201
|
m("summary", {
|
|
202
202
|
class: p(["flex font-medium cursor-pointer details-none", r(l).detailsHeaderClass])
|
|
203
203
|
}, [
|
|
204
204
|
S(r(L), {
|
|
205
205
|
strokeColor: r(l).iconChevronColor,
|
|
206
|
-
class: "icon my-4px mr-8px transition transform -rotate-90 open:rotate-0"
|
|
206
|
+
class: "icon my-[4px] mr-[8px] transition transform -rotate-90 open:rotate-0"
|
|
207
207
|
}, null, 8, ["strokeColor"]),
|
|
208
208
|
N(" " + O(e.detailsTitle), 1)
|
|
209
209
|
], 2),
|
|
@@ -223,5 +223,5 @@ export {
|
|
|
223
223
|
ee as default
|
|
224
224
|
};
|
|
225
225
|
|
|
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"> */
|
|
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"> */
|
|
227
227
|
//# sourceMappingURL=index.es.mjs.map
|