lkt-toast 1.2.0 → 1.2.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/dist/build.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as H, mergeDefaults as D, ref as m, computed as r, onMounted as $, resolveComponent as z, createElementBlock as d, openBlock as n, normalizeClass as v, createElementVNode as o, createVNode as S, createBlock as h, createCommentVNode as B, unref as i, mergeProps as T, getCurrentInstance as E, Fragment as V, renderList as R } from "vue";
1
+ import { defineComponent as H, mergeDefaults as D, ref as m, computed as a, onMounted as $, resolveComponent as z, createElementBlock as d, openBlock as r, normalizeClass as v, createElementVNode as n, createVNode as S, createBlock as h, createCommentVNode as B, unref as i, mergeProps as T, getCurrentInstance as E, Fragment as V, renderList as R } from "vue";
2
2
  import { extractI18nValue as P, LktSettings as F, closeToast as b, ProgressValueFormat as N, ProgressAnimation as A, getDefaultValues as U, Toast as j, ToastController as y } from "lkt-vue-kernel";
3
3
  import { closeToast as oe, openToast as ne } from "lkt-vue-kernel";
4
4
  const O = {
@@ -9,6 +9,7 @@ const O = {
9
9
  props: /* @__PURE__ */ D({
10
10
  type: {},
11
11
  text: {},
12
+ class: {},
12
13
  details: {},
13
14
  icon: {},
14
15
  positionX: {},
@@ -17,10 +18,10 @@ const O = {
17
18
  zIndex: {}
18
19
  }, U(j)),
19
20
  setup(t) {
20
- const a = t, l = m(100), u = a.duration ?? 1e4, c = m(null), p = m(!1), k = r(() => {
21
+ const s = t, l = m(100), u = s.duration ?? 1e4, c = m(null), p = m(!1), k = a(() => {
21
22
  let e = [];
22
- return p.value && e.push("is-visible"), a.positionX && e.push(`animation-${a.positionX}`), e.join(" ");
23
- }), _ = r(() => P(a.text)), g = r(() => P(a.details)), I = F.defaultCloseToastIcon, x = () => {
23
+ return p.value && e.push("is-visible"), s.positionX && e.push(`animation-${s.positionX}`), s.class && e.push(s.class), e.join(" ");
24
+ }), _ = a(() => P(s.text)), g = a(() => P(s.details)), I = F.defaultCloseToastIcon, x = () => {
24
25
  c.value.pause();
25
26
  }, M = () => {
26
27
  c.value.start();
@@ -30,8 +31,8 @@ const O = {
30
31
  p.value = !0;
31
32
  }, 100);
32
33
  }), (e, f) => {
33
- const s = z("lkt-icon"), X = z("lkt-progress");
34
- return n(), d("section", {
34
+ const o = z("lkt-icon"), X = z("lkt-progress");
35
+ return r(), d("section", {
35
36
  class: v(["lkt-toast", k.value]),
36
37
  role: "status",
37
38
  "aria-live": "polite",
@@ -40,28 +41,28 @@ const O = {
40
41
  onMousemove: x,
41
42
  onMouseleave: M
42
43
  }, [
43
- o("div", O, [
44
- o("div", q, [
45
- o("div", w, [
46
- t.icon ? (n(), h(s, {
44
+ n("div", O, [
45
+ n("div", q, [
46
+ n("div", w, [
47
+ t.icon ? (r(), h(o, {
47
48
  key: 0,
48
49
  icon: t.icon
49
50
  }, null, 8, ["icon"])) : B("", !0),
50
- o("div", {
51
+ n("div", {
51
52
  class: "lkt-toast-text",
52
53
  innerHTML: _.value
53
54
  }, null, 8, G)
54
55
  ]),
55
- o("div", {
56
+ n("div", {
56
57
  class: "lkt-toast-close",
57
58
  onClick: f[0] || (f[0] = (C) => i(b)(t.zIndex))
58
59
  }, [
59
- o("i", {
60
+ n("i", {
60
61
  class: v(i(I))
61
62
  }, null, 2)
62
63
  ])
63
64
  ]),
64
- o("div", {
65
+ n("div", {
65
66
  class: "lkt-toast-details",
66
67
  innerHTML: g.value
67
68
  }, null, 8, J),
@@ -83,7 +84,7 @@ const O = {
83
84
  pauseOnHover: !0,
84
85
  events: {
85
86
  updatedVisibleProgress: (C) => {
86
- C === 0 && i(b)(a.zIndex);
87
+ C === 0 && i(b)(s.zIndex);
87
88
  }
88
89
  }
89
90
  }), null, 16, ["modelValue"])
@@ -93,45 +94,45 @@ const O = {
93
94
  }
94
95
  }), K = { class: "lkt-toast-canvas" }, Q = /* @__PURE__ */ H({
95
96
  __name: "LktToastCanvas",
96
- setup(t, { expose: a }) {
97
+ setup(t, { expose: s }) {
97
98
  const l = m(0), u = E(), c = m([]), p = () => {
98
99
  l.value = l.value + 1, setTimeout(() => {
99
100
  var e;
100
101
  (e = u == null ? void 0 : u.proxy) == null || e.$forceUpdate();
101
102
  }, 1);
102
- }, k = r(() => (l.value, y.components.filter((e) => e.positionX === "left"))), _ = r(() => (l.value, y.components.filter((e) => e.positionX === "center"))), g = r(() => (l.value, y.components.filter((e) => e.positionX === "right"))), I = r(() => k.value.length === 0 ? "" : "is-visible"), x = r(() => _.value.length === 0 ? "" : "is-visible"), M = r(() => g.value.length === 0 ? "" : "is-visible");
103
- return a({
103
+ }, k = a(() => (l.value, y.components.filter((e) => e.positionX === "left"))), _ = a(() => (l.value, y.components.filter((e) => e.positionX === "center"))), g = a(() => (l.value, y.components.filter((e) => e.positionX === "right"))), I = a(() => k.value.length === 0 ? "" : "is-visible"), x = a(() => _.value.length === 0 ? "" : "is-visible"), M = a(() => g.value.length === 0 ? "" : "is-visible");
104
+ return s({
104
105
  refresh: p
105
- }), (e, f) => (n(), d("section", K, [
106
- o("div", {
106
+ }), (e, f) => (r(), d("section", K, [
107
+ n("div", {
107
108
  class: v(["lkt-toast-stack left-stack", I.value])
108
109
  }, [
109
- (n(!0), d(V, null, R(k.value, (s) => (n(), h(L, T({
110
+ (r(!0), d(V, null, R(k.value, (o) => (r(), h(L, T({
110
111
  ref_for: !0,
111
112
  ref_key: "instanceReferences",
112
113
  ref: c,
113
- key: s.zIndex
114
- }, { ref_for: !0 }, s), null, 16))), 128))
114
+ key: o.zIndex
115
+ }, { ref_for: !0 }, o), null, 16))), 128))
115
116
  ], 2),
116
- o("div", {
117
+ n("div", {
117
118
  class: v(["lkt-toast-stack center-stack", x.value])
118
119
  }, [
119
- (n(!0), d(V, null, R(_.value, (s) => (n(), h(L, T({
120
+ (r(!0), d(V, null, R(_.value, (o) => (r(), h(L, T({
120
121
  ref_for: !0,
121
122
  ref_key: "instanceReferences",
122
123
  ref: c,
123
- key: s.zIndex
124
- }, { ref_for: !0 }, s), null, 16))), 128))
124
+ key: o.zIndex
125
+ }, { ref_for: !0 }, o), null, 16))), 128))
125
126
  ], 2),
126
- o("div", {
127
+ n("div", {
127
128
  class: v(["lkt-toast-stack right-stack", M.value])
128
129
  }, [
129
- (n(!0), d(V, null, R(g.value, (s) => (n(), h(L, T({
130
+ (r(!0), d(V, null, R(g.value, (o) => (r(), h(L, T({
130
131
  ref_for: !0,
131
132
  ref_key: "instanceReferences",
132
133
  ref: c,
133
- key: s.zIndex
134
- }, { ref_for: !0 }, s), null, 16))), 128))
134
+ key: o.zIndex
135
+ }, { ref_for: !0 }, o), null, 16))), 128))
135
136
  ], 2)
136
137
  ]));
137
138
  }
@@ -5,6 +5,7 @@ declare const _default: import("vue").DefineComponent<ToastConfig, {}, {}, {}, {
5
5
  zIndex: number;
6
6
  details: string | number;
7
7
  text: string | number;
8
+ class: string | number;
8
9
  icon: string | number;
9
10
  duration: number;
10
11
  buttonConfig: import("lkt-vue-kernel").ButtonConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-toast",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -23,6 +23,7 @@ const classes = computed(() => {
23
23
  let r: string[] = [];
24
24
  if (addAnimationClass.value) r.push('is-visible');
25
25
  if (props.positionX) r.push(`animation-${props.positionX}`);
26
+ if (props.class) r.push(props.class);
26
27
  return r.join(' ');
27
28
  }),
28
29
  computedText = computed(() => extractI18nValue(props.text)),