@cypress-design/vue-alert 0.5.3 → 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.
@@ -6,8 +6,8 @@ transforming...
6
6
  ✓ 5 modules transformed.
7
7
  rendering chunks...
8
8
  computing gzip size...
9
- dist/index.es.mjs 10.56 kB │ gzip: 2.87 kB │ map: 270.36 kB
10
- dist/index.umd.js 8.82 kB │ gzip: 2.72 kB │ map: 269.68 kB
11
- ✓ built in 9.30s
9
+ dist/index.es.mjs 10.97 kB │ gzip: 2.89 kB │ map: 295.13 kB
10
+ dist/index.umd.js 9.03 kB │ gzip: 2.72 kB │ map: 294.33 kB
11
+ ✓ built in 13.67s
12
12
  $ yarn vue-tsc --project ./tsconfig.build.json
13
13
  $ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vue-tsc --project ./tsconfig.build.json
package/Alert.vue CHANGED
@@ -88,7 +88,7 @@ let timeout: number | undefined
88
88
 
89
89
  onMounted(() => {
90
90
  if (props.duration) {
91
- timeout = setTimeout(dismiss, props.duration) as any
91
+ timeout = setTimeout(dismiss, props.duration)
92
92
  }
93
93
  })
94
94
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @cypress-design/vue-alert
2
2
 
3
+ ## 0.5.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#219](https://github.com/cypress-io/cypress-design/pull/219) [`0a4ce3b`](https://github.com/cypress-io/cypress-design/commit/0a4ce3bb55b9ab0510f7fb9ba207d5fdc3cb723f) Thanks [@elevatebart](https://github.com/elevatebart)! - refactor some typings so eslint passes without warning
8
+
9
+ - Updated dependencies [[`0a4ce3b`](https://github.com/cypress-io/cypress-design/commit/0a4ce3bb55b9ab0510f7fb9ba207d5fdc3cb723f)]:
10
+ - @cypress-design/vue-icon@0.22.3
11
+
3
12
  ## 0.5.3
4
13
 
5
14
  ### Patch Changes
@@ -86,7 +86,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
86
86
  type: AlertVariant;
87
87
  detailsTitle: string;
88
88
  size: "xs" | "sm" | "md" | "lg";
89
- }>, {
89
+ }, {}>, {
90
90
  icon?(_: {
91
91
  strokeColor: import("@cypress-design/vue-icon").WindiColor | undefined;
92
92
  class: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.vue.d.ts","sourceRoot":"","sources":["../Alert.vue.ts"],"names":[],"mappings":"AAWA,OAAO,EAGL,YAAY,EAKb,MAAM,iCAAiC,CAAA;;IAkIpC;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;IA/BH;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;AAiQP,wBAA8G;AAE9G,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,C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CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AAWN,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC;AACJ,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
package/dist/index.es.mjs CHANGED
@@ -1,79 +1,96 @@
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";
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
5
  const k = ({
6
- body: s,
7
- compiledClasses: o,
8
- size: e,
9
- class: t,
10
- interactiveColorsOnGroup: h,
11
- ...p
6
+ body: l,
7
+ compiledClasses: a,
8
+ size: r,
9
+ ...s
12
10
  }) => {
13
- const m = Object.keys(p).reduce(
14
- (l, a) => (!V.includes(a) && a !== "name" && (l[a] = p[a]), l),
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
- ), i = {
17
- width: e,
18
- height: e,
19
- viewBox: `0 0 ${e} ${e}`,
16
+ ), t = {
17
+ width: r,
18
+ height: r,
19
+ viewBox: `0 0 ${r} ${r}`,
20
20
  fill: "none",
21
- innerHTML: s,
22
- ...m
21
+ innerHTML: l,
22
+ class: void 0,
23
+ ...e
23
24
  // add all standard attributes back to the svg tag
24
25
  };
25
- return o.length && (i.class = o.join(" ")), i;
26
- }, _ = (s) => {
27
- const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["16", "24"] }), t = {
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
- }[o];
31
- if (!t)
32
- throw Error(`Icon "action-delete-large" is not available in size ${o}`);
33
- return n("svg", k({
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: o,
36
- body: t,
37
- compiledClasses: e
40
+ size: e,
41
+ body: o,
42
+ compiledClasses: t
38
43
  }));
39
- }, W = (s) => {
40
- const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["16"] }), t = {
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
- }[o];
43
- if (!t)
44
- throw Error(`Icon "checkmark-outline" is not available in size ${o}`);
45
- return n("svg", k({
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: o,
48
- body: t,
49
- compiledClasses: e
56
+ size: e,
57
+ body: o,
58
+ compiledClasses: t
50
59
  }));
51
- }, L = (s) => {
52
- const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["8", "16"] }), t = {
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
- }[o];
56
- if (!t)
57
- throw Error(`Icon "chevron-down-small" is not available in size ${o}`);
58
- return n("svg", k({
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: o,
61
- body: t,
62
- compiledClasses: e
73
+ size: e,
74
+ body: o,
75
+ compiledClasses: t
63
76
  }));
64
- }, D = (s) => {
65
- const { sizeWithDefault: o, compiledClasses: e } = x.getComponentAttributes({ ...s, availableSizes: ["16"] }), t = {
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
- }[o];
68
- if (!t)
69
- throw Error(`Icon "warning-circle" is not available in size ${o}`);
70
- return n("svg", k({
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: o,
73
- body: t,
74
- compiledClasses: e
89
+ size: e,
90
+ body: o,
91
+ compiledClasses: t
75
92
  }));
76
- }, G = {
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]",
@@ -161,100 +178,100 @@ const k = ({
161
178
  dismissible: { type: Boolean },
162
179
  noIcon: { type: Boolean },
163
180
  notRounded: { type: Boolean },
164
- duration: null,
181
+ duration: {},
165
182
  size: { default: U }
166
183
  },
167
184
  emits: ["dismiss"],
168
- setup(s, { emit: o }) {
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] ?? {});
170
- let a;
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;
171
188
  A(() => {
172
- e.duration && (a = setTimeout(w, e.duration));
189
+ r.duration && (u = setTimeout(w, r.duration));
173
190
  }), A(() => {
174
- m.value && i.value && new Z(m.value, i.value);
175
- }), I(() => {
176
- a && clearTimeout(a);
191
+ o.value && i.value && new V(o.value, i.value);
192
+ }), G(() => {
193
+ u && clearTimeout(u);
177
194
  });
178
195
  function w() {
179
- t.value = !0, o("dismiss"), a && (clearTimeout(a), a = void 0);
196
+ s.value = !0, a("dismiss"), u && (clearTimeout(u), u = void 0);
180
197
  }
181
- const g = b(() => ({
182
- strokeColor: l.value.iconColor,
198
+ const v = g(() => ({
199
+ strokeColor: n.value.iconColor,
183
200
  class: "my-[4px] mr-[8px]"
184
- })), j = b(() => {
185
- switch (p.value) {
201
+ })), j = g(() => {
202
+ switch (t.value) {
186
203
  case "info":
187
204
  return null;
188
205
  case "success":
189
- return () => n(W, g.value);
206
+ return () => c(Z, v.value);
190
207
  case "warning":
191
- return () => n(D, g.value);
208
+ return () => c(S, v.value);
192
209
  case "error":
193
- return () => n(D, g.value);
210
+ return () => c(S, v.value);
194
211
  default:
195
212
  return null;
196
213
  }
197
- }), M = b(() => G[e.size] ?? {});
198
- return (d, Q) => t.value ? C("", !0) : (c(), f("div", {
214
+ }), M = g(() => L[r.size] ?? {});
215
+ return (d, Q) => s.value ? m("", !0) : (C(), b("div", {
199
216
  key: 0,
200
- class: u(["overflow-hidden text-left", [r(l).wrapperClass, { rounded: !e.notRounded }]])
217
+ class: p(["overflow-hidden text-left", [n.value.wrapperClass, { rounded: !r.notRounded }]])
201
218
  }, [
202
- y("div", {
203
- class: u(["flex", [r(l).headerClass, r(M)]])
219
+ f("div", {
220
+ class: p(["flex", [n.value.headerClass, M.value]])
204
221
  }, [
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)
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)
207
224
  ]),
208
- y("div", K, [
209
- v(d.$slots, "default")
225
+ f("div", K, [
226
+ y(d.$slots, "default")
210
227
  ]),
211
- s.dismissible ? (c(), f("button", {
228
+ d.dismissible ? (C(), b("button", {
212
229
  key: 0,
213
230
  class: "m-[4px] ml-[8px] h-[16px]",
214
231
  onClick: w,
215
232
  "aria-label": "Dismiss"
216
233
  }, [
217
- S(r(_), {
218
- "stroke-color": r(l).iconCloseColor
234
+ $(x(_), {
235
+ "stroke-color": n.value.iconCloseColor
219
236
  }, null, 8, ["stroke-color"])
220
- ])) : C("", !0)
237
+ ])) : m("", !0)
221
238
  ], 2),
222
- r(h).body ? (c(), f("div", {
239
+ x(e).body ? (C(), b("div", {
223
240
  key: 0,
224
- class: u(["p-[16px]", r(l).bodyClass])
241
+ class: p(["p-[16px]", n.value.bodyClass])
225
242
  }, [
226
- v(d.$slots, "body")
227
- ], 2)) : C("", !0),
228
- r(h).details ? (c(), f("details", {
243
+ y(d.$slots, "body")
244
+ ], 2)) : m("", !0),
245
+ x(e).details ? (C(), b("details", {
229
246
  key: 1,
230
- class: u(["p-[16px] border-t border-t-1", [r(l).bodyClass, r(l).borderClass]]),
247
+ class: p(["p-[16px] border-t border-t-1", [n.value.bodyClass, n.value.borderClass]]),
231
248
  ref_key: "detailsRef",
232
- ref: m
249
+ ref: o
233
250
  }, [
234
- y("summary", {
235
- class: u(["flex font-medium cursor-pointer details-none", r(l).detailsHeaderClass])
251
+ f("summary", {
252
+ class: p(["flex font-medium cursor-pointer details-none", n.value.detailsHeaderClass])
236
253
  }, [
237
- S(r(L), {
238
- strokeColor: r(l).iconChevronColor,
254
+ $(x(W), {
255
+ strokeColor: n.value.iconChevronColor,
239
256
  class: "icon my-[4px] mr-[8px] transition transform -rotate-90 open:rotate-0"
240
257
  }, null, 8, ["strokeColor"]),
241
- O(" " + P(e.detailsTitle), 1)
258
+ E(" " + N(r.detailsTitle), 1)
242
259
  ], 2),
243
- y("div", {
260
+ f("div", {
244
261
  ref_key: "contentRef",
245
262
  ref: i
246
263
  }, [
247
- y("div", null, [
248
- v(d.$slots, "details")
264
+ f("div", null, [
265
+ y(d.$slots, "details")
249
266
  ])
250
267
  ], 512)
251
- ], 2)) : C("", !0),
252
- d.$slots.footer ? (c(), f("div", {
268
+ ], 2)) : m("", !0),
269
+ d.$slots.footer ? (C(), b("div", {
253
270
  key: 2,
254
- class: u(r(l).bodyClass)
271
+ class: p(n.value.bodyClass)
255
272
  }, [
256
- v(d.$slots, "footer")
257
- ], 2)) : C("", !0)
273
+ y(d.$slots, "footer")
274
+ ], 2)) : m("", !0)
258
275
  ], 2));
259
276
  }
260
277
  });