kitzo 2.3.34 → 2.3.36
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o = `.kitzo-toaster {
|
|
2
2
|
--default-bg: hsl(0, 0%, 100%);
|
|
3
3
|
--default-text: hsl(0, 0%, 10%);
|
|
4
4
|
--default-border: hsl(0, 0%, 94%);
|
|
@@ -98,26 +98,6 @@ const r = `.kitzo-toaster {
|
|
|
98
98
|
transition: none !important;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
/*! toast transfor origin */
|
|
102
|
-
.kitzo-toast.transform-origin-top-left {
|
|
103
|
-
transform-origin: top left;
|
|
104
|
-
}
|
|
105
|
-
.kitzo-toast.transform-origin-top-center {
|
|
106
|
-
transform-origin: top center;
|
|
107
|
-
}
|
|
108
|
-
.kitzo-toast.transform-origin-top-right {
|
|
109
|
-
transform-origin: top right;
|
|
110
|
-
}
|
|
111
|
-
.kitzo-toast.transform-origin-bottom-left {
|
|
112
|
-
transform-origin: bottom left;
|
|
113
|
-
}
|
|
114
|
-
.kitzo-toast.transform-origin-bottom-center {
|
|
115
|
-
transform-origin: bottom center;
|
|
116
|
-
}
|
|
117
|
-
.kitzo-toast.transform-origin-bottom-right {
|
|
118
|
-
transform-origin: bottom right;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
101
|
/*! Toast theme styles */
|
|
122
102
|
.kitzo-toast[data-type='default'] {
|
|
123
103
|
background-color: var(--default-bg);
|
|
@@ -175,12 +155,10 @@ const r = `.kitzo-toaster {
|
|
|
175
155
|
|
|
176
156
|
.kitzo-toast[data-screen-y='top'] {
|
|
177
157
|
--motion-y: -120%;
|
|
178
|
-
transform-origin: top;
|
|
179
158
|
}
|
|
180
159
|
|
|
181
160
|
.kitzo-toast[data-screen-y='bottom'] {
|
|
182
161
|
--motion-y: 120%;
|
|
183
|
-
transform-origin: bottom;
|
|
184
162
|
}
|
|
185
163
|
|
|
186
164
|
.kitzo-toast[data-status='leaving'][data-exit='swipe'] {
|
|
@@ -219,6 +197,40 @@ const r = `.kitzo-toaster {
|
|
|
219
197
|
}
|
|
220
198
|
}
|
|
221
199
|
|
|
200
|
+
/*! toast transfor origin */
|
|
201
|
+
.kitzo-toast[data-position^='top'] {
|
|
202
|
+
transform-origin: top;
|
|
203
|
+
}
|
|
204
|
+
.kitzo-toast[data-position^='bottom'] {
|
|
205
|
+
transform-origin: bottom;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.kitzo-toast[data-animate-transform-origin='true'][data-position='top-left'] {
|
|
209
|
+
transform-origin: top left;
|
|
210
|
+
}
|
|
211
|
+
.kitzo-toast[data-animate-transform-origin='true'][data-position='top-center'] {
|
|
212
|
+
transform-origin: top;
|
|
213
|
+
}
|
|
214
|
+
.kitzo-toast[data-animate-transform-origin='true'][data-position='top-right'] {
|
|
215
|
+
transform-origin: top right;
|
|
216
|
+
}
|
|
217
|
+
.kitzo-toast[data-animate-transform-origin='true'][data-position='bottom-left'] {
|
|
218
|
+
transform-origin: bottom left;
|
|
219
|
+
}
|
|
220
|
+
.kitzo-toast[data-animate-transform-origin='true'][data-position='bottom-center'] {
|
|
221
|
+
transform-origin: bottom;
|
|
222
|
+
}
|
|
223
|
+
.kitzo-toast[data-animate-transform-origin='true'][data-position='bottom-right'] {
|
|
224
|
+
transform-origin: bottom right;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.kitzo-toast[data-status='leaving'][data-position^='top'] {
|
|
228
|
+
transform-origin: top;
|
|
229
|
+
}
|
|
230
|
+
.kitzo-toast[data-status='leaving'][data-position^='bottom'] {
|
|
231
|
+
transform-origin: bottom;
|
|
232
|
+
}
|
|
233
|
+
|
|
222
234
|
/*! svg stylings */
|
|
223
235
|
.svg-container {
|
|
224
236
|
display: grid;
|
|
@@ -259,12 +271,12 @@ const r = `.kitzo-toaster {
|
|
|
259
271
|
rotate: 360deg;
|
|
260
272
|
}
|
|
261
273
|
}`;
|
|
262
|
-
function
|
|
274
|
+
function a() {
|
|
263
275
|
if (!document.getElementById("kitzo-toast-styles")) {
|
|
264
276
|
const t = document.createElement("style");
|
|
265
|
-
t.id = "kitzo-toast-styles", t.textContent =
|
|
277
|
+
t.id = "kitzo-toast-styles", t.textContent = o, document.head.appendChild(t);
|
|
266
278
|
}
|
|
267
279
|
}
|
|
268
280
|
export {
|
|
269
|
-
|
|
281
|
+
a as default
|
|
270
282
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createToast as
|
|
1
|
+
import { createToast as a, updateToast as s, genId as c } from "./createToast.js";
|
|
2
2
|
import { notify as e } from "./listenar.js";
|
|
3
3
|
const i = (r, t) => {
|
|
4
4
|
r != null && e(
|
|
5
|
-
|
|
5
|
+
a({
|
|
6
6
|
type: "default",
|
|
7
7
|
action: "add",
|
|
8
8
|
content: r,
|
|
@@ -11,11 +11,11 @@ const i = (r, t) => {
|
|
|
11
11
|
);
|
|
12
12
|
};
|
|
13
13
|
i.dismiss = (r) => {
|
|
14
|
-
|
|
14
|
+
e({ action: "dismiss", id: r });
|
|
15
15
|
};
|
|
16
16
|
i.info = (r, t) => {
|
|
17
17
|
r != null && e(
|
|
18
|
-
|
|
18
|
+
a({
|
|
19
19
|
action: "add",
|
|
20
20
|
type: "info",
|
|
21
21
|
content: r,
|
|
@@ -25,7 +25,7 @@ i.info = (r, t) => {
|
|
|
25
25
|
};
|
|
26
26
|
i.success = (r, t) => {
|
|
27
27
|
r != null && e(
|
|
28
|
-
|
|
28
|
+
a({
|
|
29
29
|
action: "add",
|
|
30
30
|
type: "success",
|
|
31
31
|
content: r,
|
|
@@ -35,7 +35,7 @@ i.success = (r, t) => {
|
|
|
35
35
|
};
|
|
36
36
|
i.warning = (r, t) => {
|
|
37
37
|
r != null && e(
|
|
38
|
-
|
|
38
|
+
a({
|
|
39
39
|
action: "add",
|
|
40
40
|
type: "warning",
|
|
41
41
|
content: r,
|
|
@@ -45,7 +45,7 @@ i.warning = (r, t) => {
|
|
|
45
45
|
};
|
|
46
46
|
i.error = (r, t) => {
|
|
47
47
|
r != null && e(
|
|
48
|
-
|
|
48
|
+
a({
|
|
49
49
|
action: "add",
|
|
50
50
|
type: "error",
|
|
51
51
|
content: r,
|
|
@@ -55,7 +55,7 @@ i.error = (r, t) => {
|
|
|
55
55
|
};
|
|
56
56
|
i.loading = (r, t) => {
|
|
57
57
|
r != null && e(
|
|
58
|
-
|
|
58
|
+
a({
|
|
59
59
|
action: "add",
|
|
60
60
|
type: "loading",
|
|
61
61
|
content: r,
|
|
@@ -65,7 +65,7 @@ i.loading = (r, t) => {
|
|
|
65
65
|
};
|
|
66
66
|
i.custom = (r, t) => {
|
|
67
67
|
r != null && e(
|
|
68
|
-
|
|
68
|
+
a({
|
|
69
69
|
action: "add",
|
|
70
70
|
type: "custom",
|
|
71
71
|
content: r,
|
|
@@ -79,7 +79,7 @@ i.update = (r, t, n) => {
|
|
|
79
79
|
i.promise = (async (r, t, n) => {
|
|
80
80
|
const u = c();
|
|
81
81
|
e(
|
|
82
|
-
|
|
82
|
+
a({
|
|
83
83
|
action: "add",
|
|
84
84
|
type: "loading",
|
|
85
85
|
content: t.loading,
|
|
@@ -88,11 +88,11 @@ i.promise = (async (r, t, n) => {
|
|
|
88
88
|
})
|
|
89
89
|
);
|
|
90
90
|
try {
|
|
91
|
-
const
|
|
92
|
-
return i.update(u, d, { ...n, type: "success" }),
|
|
93
|
-
} catch (
|
|
94
|
-
const d = typeof t.error == "function" ? await t.error(
|
|
95
|
-
throw i.update(u, d, { ...n, type: "error" }),
|
|
91
|
+
const o = await r, d = typeof t.success == "function" ? await t.success(o) : t.success;
|
|
92
|
+
return i.update(u, d, { ...n, type: "success" }), o;
|
|
93
|
+
} catch (o) {
|
|
94
|
+
const d = typeof t.error == "function" ? await t.error(o) : t.error;
|
|
95
|
+
throw i.update(u, d, { ...n, type: "error" }), o;
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
export {
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsxs as x, jsx as
|
|
2
|
-
import { resumeToast as
|
|
1
|
+
import { jsxs as x, jsx as t, Fragment as o } from "react/jsx-runtime";
|
|
2
|
+
import { resumeToast as m, pauseToast as p } from "../helpers/manageToasts/timers.js";
|
|
3
3
|
import S from "../helpers/triggerToasts.js";
|
|
4
|
-
import { InfoSvg as w, ErrorSvg as
|
|
4
|
+
import { InfoSvg as w, ErrorSvg as E, WarningSvg as T, SuccessSvg as k, LoadingSvg as I } from "./Svgs.js";
|
|
5
5
|
import { useToasterContext as L } from "../context/ToasterContext.js";
|
|
6
6
|
function C({
|
|
7
|
-
t:
|
|
8
|
-
position:
|
|
9
|
-
shouldAnimateTransformOrigin:
|
|
10
|
-
swipeToClose:
|
|
7
|
+
t: f,
|
|
8
|
+
position: n,
|
|
9
|
+
shouldAnimateTransformOrigin: c,
|
|
10
|
+
swipeToClose: u
|
|
11
11
|
}) {
|
|
12
|
-
const { setToasts:
|
|
13
|
-
loading: /* @__PURE__ */
|
|
14
|
-
success: /* @__PURE__ */
|
|
15
|
-
warning: /* @__PURE__ */
|
|
16
|
-
error: /* @__PURE__ */
|
|
17
|
-
info: /* @__PURE__ */
|
|
12
|
+
const { setToasts: l, pauseOnHover: s } = L(), { id: e, type: r, action: g, content: i, status: v, showIcon: h, icon: a, isPromise: y } = f, d = {
|
|
13
|
+
loading: /* @__PURE__ */ t(I, {}),
|
|
14
|
+
success: /* @__PURE__ */ t(k, {}),
|
|
15
|
+
warning: /* @__PURE__ */ t(T, {}),
|
|
16
|
+
error: /* @__PURE__ */ t(E, {}),
|
|
17
|
+
info: /* @__PURE__ */ t(w, {}),
|
|
18
18
|
default: null,
|
|
19
19
|
custom: null
|
|
20
20
|
};
|
|
21
21
|
return /* @__PURE__ */ x(
|
|
22
22
|
"div",
|
|
23
23
|
{
|
|
24
|
-
id:
|
|
24
|
+
id: e,
|
|
25
25
|
style: {
|
|
26
26
|
pointerEvents: "all",
|
|
27
27
|
display: "flex",
|
|
@@ -32,34 +32,36 @@ function C({
|
|
|
32
32
|
"data-action": g,
|
|
33
33
|
"data-status": v,
|
|
34
34
|
"data-type": r,
|
|
35
|
-
"data-
|
|
36
|
-
"data-screen-
|
|
35
|
+
"data-position": n,
|
|
36
|
+
"data-screen-x": n.split("-")[1],
|
|
37
|
+
"data-screen-y": n.split("-")[0],
|
|
37
38
|
"data-exit": "auto",
|
|
38
39
|
"data-is-promise": y,
|
|
39
|
-
"data-swipeable":
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
"data-swipeable": u,
|
|
41
|
+
"data-animate-transform-origin": c,
|
|
42
|
+
className: `kitzo-toast ${c ? `transform-origin-${n}` : ""}`,
|
|
43
|
+
onPointerEnter: () => s && p(e),
|
|
44
|
+
onPointerLeave: () => s && m(e, l),
|
|
45
|
+
onMouseEnter: () => s && p(e),
|
|
46
|
+
onMouseLeave: () => s && m(e, l),
|
|
45
47
|
children: [
|
|
46
|
-
h && /* @__PURE__ */
|
|
48
|
+
h && /* @__PURE__ */ t(o, { children: a ? /* @__PURE__ */ t(o, { children: typeof a == "string" || typeof a == "number" ? /* @__PURE__ */ t(
|
|
47
49
|
"div",
|
|
48
50
|
{
|
|
49
51
|
style: {
|
|
50
52
|
flexShrink: 0
|
|
51
53
|
},
|
|
52
54
|
className: "svg-container",
|
|
53
|
-
children:
|
|
55
|
+
children: a
|
|
54
56
|
}
|
|
55
|
-
) : /* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
+
) : /* @__PURE__ */ t(o, { children: a }) }) : /* @__PURE__ */ t(o, { children: d[r] && /* @__PURE__ */ t("div", { style: { flexShrink: 0 }, className: "svg-container", children: d[r] }) }) }),
|
|
58
|
+
/* @__PURE__ */ t(
|
|
57
59
|
"div",
|
|
58
60
|
{
|
|
59
61
|
style: {
|
|
60
62
|
flex: 1
|
|
61
63
|
},
|
|
62
|
-
children: typeof i == "function" ? i(() => S.dismiss(
|
|
64
|
+
children: typeof i == "function" ? i(() => S.dismiss(e)) : i
|
|
63
65
|
}
|
|
64
66
|
)
|
|
65
67
|
]
|