lkt-toast 1.1.0 → 1.1.2

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.css CHANGED
@@ -1 +1 @@
1
- .lkt-toast-canvas{display:block;position:fixed;bottom:0;left:0;right:0;z-index:999}.lkt-toast-stack{display:flex;flex-direction:column-reverse;gap:var(--lkt-toast--stack--gap);position:absolute;bottom:0}.lkt-toast-stack.is-visible{padding-bottom:var(--lkt-toast--stack--padding)}.lkt-toast-stack.right-stack.is-visible{padding-right:var(--lkt-toast--stack--padding)}.lkt-toast-stack.left-stack.is-visible{padding-left:var(--lkt-toast--stack--padding)}.lkt-toast-stack.left-stack{left:0;align-items:flex-start}.lkt-toast-stack.center-stack{left:50%;transform:translate(-50%);align-items:center}.lkt-toast-stack.right-stack{right:0;align-items:flex-end}.lkt-toast{padding:var(--lkt-toast--toast--padding);border-radius:var(--lkt-toast--toast--border-radius);background:var(--lkt-toast--toast--bg);transition:var(--lkt-toast--toast--transition);width:var(--lkt-toast--toast--width);border:var(--lkt-toast--toast--border-width) var(--lkt-toast--toast--border-style) var(--lkt-toast--toast--border-color)}.lkt-toast.animation-left{transform:translate(-100%)}.lkt-toast.animation-right{transform:translate(100%)}.lkt-toast.animation-left.is-visible,.lkt-toast.animation-right.is-visible{transform:translate(0)}.lkt-toast.animation-center{transform:translateY(100%)}.lkt-toast.animation-center.is-visible{transform:translateY(0)}.lkt-toast-inner{display:flex;flex-direction:column;gap:var(--lkt-toast--toast--gap)}.lkt-toast-header{display:flex;align-items:center;justify-content:space-between;gap:var(--lkt-toast--toast--gap);font-size:var(--lkt-toast--header--font-size);font-weight:var(--lkt-toast--header--font-weight)}.lkt-toast-header-text{display:flex;align-items:center;justify-content:center;gap:var(--lkt-toast--toast--gap)}.lkt-toast-details{font-size:var(--lkt-toast--details--font-size);font-weight:var(--lkt-toast--details--font-weight)}.lkt-toast .lkt-progress{--lkt-progress-bar-height: var(--lkt-toast--progress--height);--lkt-progress-min-height: var(--lkt-toast--progress--height);--lkt-progress-bar-percentage-color: var(--lkt-toast--progress--color)}
1
+ .lkt-toast-canvas{display:block;position:fixed;bottom:0;left:0;right:0;z-index:999}.lkt-toast-stack{display:flex;flex-direction:column-reverse;gap:var(--lkt-toast--stack--gap);position:absolute;bottom:0}.lkt-toast-stack.is-visible{padding-bottom:var(--lkt-toast--stack--padding)}.lkt-toast-stack.right-stack.is-visible{padding-right:var(--lkt-toast--stack--padding)}.lkt-toast-stack.left-stack.is-visible{padding-left:var(--lkt-toast--stack--padding)}.lkt-toast-stack.left-stack{left:0;align-items:flex-start}.lkt-toast-stack.center-stack{left:50%;transform:translate(-50%);align-items:center}.lkt-toast-stack.right-stack{right:0;align-items:flex-end}.lkt-toast{padding:var(--lkt-toast--toast--padding);border-radius:var(--lkt-toast--toast--border-radius);background:var(--lkt-toast--toast--background);transition:var(--lkt-toast--toast--transition);width:var(--lkt-toast--toast--width);border:var(--lkt-toast--toast--border-width) var(--lkt-toast--toast--border-style) var(--lkt-toast--toast--border-color)}.lkt-toast.animation-left{transform:translate(-100%)}.lkt-toast.animation-right{transform:translate(100%)}.lkt-toast.animation-left.is-visible,.lkt-toast.animation-right.is-visible{transform:translate(0)}.lkt-toast.animation-center{transform:translateY(100%)}.lkt-toast.animation-center.is-visible{transform:translateY(0)}.lkt-toast-inner{display:flex;flex-direction:column;gap:var(--lkt-toast--toast--gap)}.lkt-toast-header{display:flex;align-items:center;justify-content:space-between;gap:var(--lkt-toast--toast--gap);font-size:var(--lkt-toast--header--font-size);font-weight:var(--lkt-toast--header--font-weight)}.lkt-toast-header-text{display:flex;align-items:center;justify-content:center;gap:var(--lkt-toast--toast--gap)}.lkt-toast-details{font-size:var(--lkt-toast--details--font-size);font-weight:var(--lkt-toast--details--font-weight)}.lkt-toast .lkt-progress{--lkt-progress-bar-height: var(--lkt-toast--progress--height);--lkt-progress-min-height: var(--lkt-toast--progress--height);--lkt-progress-bar-percentage-color: var(--lkt-toast--progress--color)}
package/dist/build.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- declare function $(t: any): void;
2
- declare namespace ee {
3
- function install(t: any): void;
1
+ declare function $(e: any): void;
2
+ declare namespace se {
3
+ function install(e: any): void;
4
4
  }
5
- declare function Z(t: any): void;
6
- declare function te(t: any): void;
7
- export { $ as closeToast, ee as default, Z as openToast, te as setToastCanvas };
5
+ declare function te(e: any): void;
6
+ declare function ne(e: any): void;
7
+ export { $ as closeToast, se as default, te as openToast, ne as setToastCanvas };
package/dist/build.js CHANGED
@@ -1,38 +1,38 @@
1
- import { defineComponent as D, mergeDefaults as B, ref as m, computed as c, onMounted as N, resolveComponent as b, createElementBlock as p, openBlock as l, normalizeClass as I, createElementVNode as r, createVNode as w, createBlock as C, createCommentVNode as U, unref as E, getCurrentInstance as j, Fragment as M, renderList as R, mergeProps as V } from "vue";
2
- import { extractI18nValue as P, getDefaultValues as A, Toast as F } from "lkt-vue-kernel";
3
- const T = class T {
1
+ import { defineComponent as D, mergeDefaults as N, ref as m, computed as c, onMounted as w, resolveComponent as E, createElementBlock as p, openBlock as l, normalizeClass as k, createElementVNode as r, createVNode as U, createBlock as C, createCommentVNode as j, unref as M, getCurrentInstance as A, Fragment as R, renderList as V, mergeProps as X } from "vue";
2
+ import { extractI18nValue as P, LktSettings as F, getDefaultValues as S, Toast as q } from "lkt-vue-kernel";
3
+ const z = class z {
4
4
  };
5
- T.canvas = void 0, T.defaultCloseIcon = "";
6
- let f = T;
7
- const o = class o {
8
- static open(n) {
9
- o.components.push({ ...n, zIndex: o.zIndex }), ++o.zIndex;
5
+ z.canvas = void 0, z.defaultCloseIcon = "";
6
+ let f = z;
7
+ const a = class a {
8
+ static open(s) {
9
+ a.components.push({ ...s, zIndex: a.zIndex }), ++a.zIndex;
10
10
  }
11
- static close(n) {
12
- const s = o.components.findIndex((i) => i.zIndex === n);
13
- s >= 0 && (o.components.splice(s, 1), o.components.length === 0 && (o.zIndex = 1e3));
11
+ static close(s) {
12
+ const n = a.components.findIndex((u) => u.zIndex === s);
13
+ n >= 0 && (a.components.splice(n, 1), a.components.length === 0 && (a.zIndex = 1e3));
14
14
  }
15
15
  };
16
- o.components = [], o.zIndex = 1e3;
17
- let v = o;
18
- const Z = (t) => {
16
+ a.components = [], a.zIndex = 1e3;
17
+ let v = a;
18
+ const te = (e) => {
19
19
  if (!f.canvas) {
20
20
  console.warn("ToastCanvas not defined");
21
21
  return;
22
22
  }
23
- v.open(t), f.canvas.refresh();
24
- }, $ = (t) => {
23
+ v.open(e), f.canvas.refresh();
24
+ }, $ = (e) => {
25
25
  if (!f.canvas) {
26
26
  console.warn("ToastCanvas not defined");
27
27
  return;
28
28
  }
29
- v.close(t), f.canvas.refresh();
30
- }, q = {
29
+ v.close(e), f.canvas.refresh();
30
+ }, G = {
31
31
  class: "lkt-toast-inner",
32
32
  ref: "inner"
33
- }, G = { class: "lkt-toast-header" }, J = { class: "lkt-toast-header-text" }, K = ["innerHTML"], O = ["innerHTML"], z = /* @__PURE__ */ D({
33
+ }, J = { class: "lkt-toast-header" }, K = { class: "lkt-toast-header-text" }, O = ["innerHTML"], Q = ["innerHTML"], T = /* @__PURE__ */ D({
34
34
  __name: "LktToast",
35
- props: /* @__PURE__ */ B({
35
+ props: /* @__PURE__ */ N({
36
36
  type: {},
37
37
  text: {},
38
38
  details: {},
@@ -41,59 +41,64 @@ const Z = (t) => {
41
41
  duration: {},
42
42
  buttonConfig: {},
43
43
  zIndex: {}
44
- }, A(F)),
45
- setup(t) {
46
- const n = t, s = m(100), i = n.duration ?? 1e4, u = m(null), k = m(!1), h = c(() => {
47
- let e = [];
48
- return k.value && e.push("is-visible"), n.positionX && e.push(`animation-${n.positionX}`), e.join(" ");
49
- }), x = c(() => P(n.text)), g = c(() => P(n.details)), y = () => {
50
- $(n.zIndex);
51
- }, _ = () => {
52
- u.value.pause();
53
- }, L = () => {
54
- u.value.start();
44
+ }, S(q)),
45
+ setup(e) {
46
+ const s = e, n = m(100), u = s.duration ?? 1e4, d = m(null), h = m(!1), g = c(() => {
47
+ let i = [];
48
+ return h.value && i.push("is-visible"), s.positionX && i.push(`animation-${s.positionX}`), i.join(" ");
49
+ }), x = c(() => P(s.text)), _ = c(() => P(s.details)), L = F.defaultCloseToastIcon, y = () => {
50
+ $(s.zIndex);
51
+ }, I = () => {
52
+ d.value.pause();
53
+ }, o = () => {
54
+ d.value.start();
55
55
  };
56
- return N(() => {
56
+ return w(() => {
57
57
  setTimeout(() => {
58
- k.value = !0;
58
+ h.value = !0;
59
59
  }, 100);
60
- }), (e, d) => {
61
- const a = b("lkt-icon"), H = b("lkt-progress");
60
+ }), (i, t) => {
61
+ const H = E("lkt-icon"), B = E("lkt-progress");
62
62
  return l(), p("section", {
63
- class: I(["lkt-toast", h.value]),
64
- onMouseenter: _,
65
- onMousemove: _,
66
- onMouseleave: L
63
+ class: k(["lkt-toast", g.value]),
64
+ role: "status",
65
+ "aria-live": "polite",
66
+ "aria-atomic": "true",
67
+ onMouseenter: I,
68
+ onMousemove: I,
69
+ onMouseleave: o
67
70
  }, [
68
- r("div", q, [
69
- r("div", G, [
70
- r("div", J, [
71
- e.icon ? (l(), C(a, {
71
+ r("div", G, [
72
+ r("div", J, [
73
+ r("div", K, [
74
+ i.icon ? (l(), C(H, {
72
75
  key: 0,
73
- icon: e.icon
74
- }, null, 8, ["icon"])) : U("", !0),
76
+ icon: i.icon
77
+ }, null, 8, ["icon"])) : j("", !0),
75
78
  r("div", {
76
79
  class: "lkt-toast-text",
77
80
  innerHTML: x.value
78
- }, null, 8, K)
81
+ }, null, 8, O)
79
82
  ]),
80
83
  r("div", {
81
84
  class: "lkt-toast-close",
82
- onClick: d[0] || (d[0] = (X) => E($)(e.zIndex))
83
- }, d[2] || (d[2] = [
84
- r("i", { class: "lkt-icon-close" }, null, -1)
85
- ]))
85
+ onClick: t[0] || (t[0] = (b) => M($)(i.zIndex))
86
+ }, [
87
+ r("i", {
88
+ class: k(M(L))
89
+ }, null, 2)
90
+ ])
86
91
  ]),
87
92
  r("div", {
88
93
  class: "lkt-toast-details",
89
- innerHTML: g.value
90
- }, null, 8, O),
91
- w(H, {
94
+ innerHTML: _.value
95
+ }, null, 8, Q),
96
+ U(B, {
92
97
  ref_key: "progressRef",
93
- ref: u,
94
- modelValue: s.value,
95
- "onUpdate:modelValue": d[1] || (d[1] = (X) => s.value = X),
96
- duration: E(i),
98
+ ref: d,
99
+ modelValue: n.value,
100
+ "onUpdate:modelValue": t[1] || (t[1] = (b) => n.value = b),
101
+ duration: M(u),
97
102
  type: "decremental",
98
103
  "value-format": "hidden",
99
104
  "pause-on-hover": "",
@@ -103,60 +108,60 @@ const Z = (t) => {
103
108
  ], 34);
104
109
  };
105
110
  }
106
- }), Q = { class: "lkt-toast-canvas" }, S = /* @__PURE__ */ D({
111
+ }), W = { class: "lkt-toast-canvas" }, Y = /* @__PURE__ */ D({
107
112
  __name: "LktToastCanvas",
108
- setup(t, { expose: n }) {
109
- const s = m(0), i = j(), u = m([]), k = () => {
110
- s.value = s.value + 1, setTimeout(() => {
111
- var e;
112
- (e = i == null ? void 0 : i.proxy) == null || e.$forceUpdate();
113
+ setup(e, { expose: s }) {
114
+ const n = m(0), u = A(), d = m([]), h = () => {
115
+ n.value = n.value + 1, setTimeout(() => {
116
+ var o;
117
+ (o = u == null ? void 0 : u.proxy) == null || o.$forceUpdate();
113
118
  }, 1);
114
- }, h = c(() => (s.value, v.components.filter((e) => e.positionX === "left"))), x = c(() => (s.value, v.components.filter((e) => e.positionX === "center"))), g = c(() => (s.value, v.components.filter((e) => e.positionX === "right"))), y = c(() => h.value.length === 0 ? "" : "is-visible"), _ = c(() => x.value.length === 0 ? "" : "is-visible"), L = c(() => g.value.length === 0 ? "" : "is-visible");
115
- return n({
116
- refresh: k
117
- }), (e, d) => (l(), p("section", Q, [
119
+ }, g = c(() => (n.value, v.components.filter((o) => o.positionX === "left"))), x = c(() => (n.value, v.components.filter((o) => o.positionX === "center"))), _ = c(() => (n.value, v.components.filter((o) => o.positionX === "right"))), L = c(() => g.value.length === 0 ? "" : "is-visible"), y = c(() => x.value.length === 0 ? "" : "is-visible"), I = c(() => _.value.length === 0 ? "" : "is-visible");
120
+ return s({
121
+ refresh: h
122
+ }), (o, i) => (l(), p("section", W, [
118
123
  r("div", {
119
- class: I(["lkt-toast-stack left-stack", y.value])
124
+ class: k(["lkt-toast-stack left-stack", L.value])
120
125
  }, [
121
- (l(!0), p(M, null, R(h.value, (a) => (l(), C(z, V({
126
+ (l(!0), p(R, null, V(g.value, (t) => (l(), C(T, X({
122
127
  ref_for: !0,
123
128
  ref_key: "instanceReferences",
124
- ref: u,
125
- key: a.zIndex
126
- }, a), null, 16))), 128))
129
+ ref: d,
130
+ key: t.zIndex
131
+ }, t), null, 16))), 128))
127
132
  ], 2),
128
133
  r("div", {
129
- class: I(["lkt-toast-stack center-stack", _.value])
134
+ class: k(["lkt-toast-stack center-stack", y.value])
130
135
  }, [
131
- (l(!0), p(M, null, R(x.value, (a) => (l(), C(z, V({
136
+ (l(!0), p(R, null, V(x.value, (t) => (l(), C(T, X({
132
137
  ref_for: !0,
133
138
  ref_key: "instanceReferences",
134
- ref: u,
135
- key: a.zIndex
136
- }, a), null, 16))), 128))
139
+ ref: d,
140
+ key: t.zIndex
141
+ }, t), null, 16))), 128))
137
142
  ], 2),
138
143
  r("div", {
139
- class: I(["lkt-toast-stack right-stack", L.value])
144
+ class: k(["lkt-toast-stack right-stack", I.value])
140
145
  }, [
141
- (l(!0), p(M, null, R(g.value, (a) => (l(), C(z, V({
146
+ (l(!0), p(R, null, V(_.value, (t) => (l(), C(T, X({
142
147
  ref_for: !0,
143
148
  ref_key: "instanceReferences",
144
- ref: u,
145
- key: a.zIndex
146
- }, a), null, 16))), 128))
149
+ ref: d,
150
+ key: t.zIndex
151
+ }, t), null, 16))), 128))
147
152
  ], 2)
148
153
  ]));
149
154
  }
150
- }), ee = {
151
- install: (t) => {
152
- t.component("lkt-toast-canvas") === void 0 && t.component("lkt-toast-canvas", S), t.component("lkt-toast") === void 0 && t.component("lkt-toast", z);
155
+ }), se = {
156
+ install: (e) => {
157
+ e.component("lkt-toast-canvas") === void 0 && e.component("lkt-toast-canvas", Y), e.component("lkt-toast") === void 0 && e.component("lkt-toast", T);
153
158
  }
154
- }, te = (t) => {
155
- f.canvas = t;
159
+ }, ne = (e) => {
160
+ f.canvas = e;
156
161
  };
157
162
  export {
158
163
  $ as closeToast,
159
- ee as default,
160
- Z as openToast,
161
- te as setToastCanvas
164
+ se as default,
165
+ te as openToast,
166
+ ne as setToastCanvas
162
167
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-toast",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -39,11 +39,9 @@
39
39
  "vue": "^3.3.0",
40
40
  "vue-tsc": "^2.2.0"
41
41
  },
42
- "dependencies": {
43
- },
44
42
  "peerDependencies": {
45
- "lkt-loader": "^1.0.1",
46
- "lkt-vue-kernel": "^1.0.26",
43
+ "lkt-loader": "^1.2.0",
44
+ "lkt-vue-kernel": "^1.0.51",
47
45
  "vue": "^3.3.0"
48
46
  }
49
47
  }
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import {computed, onMounted, ref} from 'vue';
3
- import {extractI18nValue, getDefaultValues, Toast, ToastConfig} from "lkt-vue-kernel";
3
+ import {extractI18nValue, getDefaultValues, LktSettings, Toast, ToastConfig} from "lkt-vue-kernel";
4
4
  import {closeToast} from "../functions/functions";
5
5
 
6
6
  const props = withDefaults(defineProps<ToastConfig>(), getDefaultValues(Toast));
@@ -20,13 +20,17 @@ const classes = computed(() => {
20
20
  computedDetails = computed(() => extractI18nValue(props.details))
21
21
  ;
22
22
 
23
+ const calculatedCloseIcon = LktSettings.defaultCloseToastIcon
24
+
23
25
  const onProgressEnd = () => {
24
26
  closeToast(props.zIndex);
25
27
  },
26
28
  onProgressMouseEnter = () => {
29
+ //@ts-ignore
27
30
  progressRef.value.pause();
28
31
  },
29
32
  onProgressMouseLeave = () => {
33
+ //@ts-ignore
30
34
  progressRef.value.start();
31
35
  };
32
36
 
@@ -41,6 +45,9 @@ onMounted(() => {
41
45
  <template>
42
46
  <section class="lkt-toast"
43
47
  :class="classes"
48
+ role="status"
49
+ aria-live="polite"
50
+ aria-atomic="true"
44
51
  @mouseenter="onProgressMouseEnter"
45
52
  @mousemove="onProgressMouseEnter"
46
53
  @mouseleave="onProgressMouseLeave">
@@ -48,13 +55,13 @@ onMounted(() => {
48
55
  <div class="lkt-toast-header">
49
56
  <div class="lkt-toast-header-text">
50
57
  <lkt-icon v-if="icon" :icon="icon"/>
51
- <div class="lkt-toast-text" v-html="computedText"></div>
58
+ <div class="lkt-toast-text" v-html="computedText"/>
52
59
  </div>
53
60
  <div class="lkt-toast-close" @click="closeToast(zIndex)">
54
- <i class="lkt-icon-close"/>
61
+ <i :class="calculatedCloseIcon"/>
55
62
  </div>
56
63
  </div>
57
- <div class="lkt-toast-details" v-html="computedDetails"></div>
64
+ <div class="lkt-toast-details" v-html="computedDetails"/>
58
65
  <lkt-progress
59
66
  ref="progressRef"
60
67
  v-model="progressPercentage"
package/theme/default.css CHANGED
@@ -5,7 +5,7 @@
5
5
  --lkt-toast--toast--gap: 10px;
6
6
  --lkt-toast--toast--padding: 15px;
7
7
  --lkt-toast--toast--border-radius: 20px;
8
- --lkt-toast--toast--bg: #ffffff;
8
+ --lkt-toast--toast--background: #ffffff;
9
9
  --lkt-toast--toast--transition: 300ms;
10
10
  --lkt-toast--toast--width: 250px;
11
11
  --lkt-toast--toast--border-width: 1px;