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