triafly-ui-kit 1.0.59 → 1.0.60
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.
@@ -0,0 +1 @@
|
|
1
|
+
.toast-provider{position:fixed;bottom:20px;right:20px;z-index:101;display:flex;flex-direction:column;gap:10px}.toast-provider__element{color:var(--color-text-primary-inversed);padding:20px 24px;border-radius:8px;display:flex;justify-content:space-between;align-items:center;min-width:250px;max-width:400px;font-size:16px;box-shadow:0 6px 15px -2px var(--effect-shadow-L, rgba(18, 18, 18, .08));animation:fadeIn .5s ease-in-out;background-color:var(--color-bg-neutral-basic-inversed)}@keyframes fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { createContext as
|
3
|
-
import
|
4
|
-
import
|
5
|
-
const
|
6
|
-
const o =
|
1
|
+
import { jsxs as p, jsx as l } from "react/jsx-runtime";
|
2
|
+
import { createContext as x, useState as f, useCallback as u, useMemo as h, useContext as w } from "react";
|
3
|
+
import g from "react-dom";
|
4
|
+
import '../../assets/src/context/ToastContext/ToastContext.css';/* empty css */
|
5
|
+
const m = x(void 0), j = () => {
|
6
|
+
const o = w(m);
|
7
7
|
if (!o)
|
8
8
|
throw new Error("useToast must be used within a ToastProvider");
|
9
9
|
return o;
|
10
10
|
}, M = ({ children: o }) => {
|
11
|
-
const [r, n] =
|
11
|
+
const [r, n] = f([]), T = 3, c = 4e3, i = u((t) => {
|
12
12
|
n((e) => e.filter((s) => s.id !== t));
|
13
13
|
}, []), d = u(
|
14
14
|
(t) => {
|
@@ -19,22 +19,22 @@ const T = f(void 0), y = () => {
|
|
19
19
|
};
|
20
20
|
n((s) => {
|
21
21
|
const a = [...s, e];
|
22
|
-
return a.length >
|
22
|
+
return a.length > T ? a.slice(1) : a;
|
23
23
|
}), setTimeout(() => i(e.id), c);
|
24
24
|
},
|
25
25
|
[i]
|
26
26
|
);
|
27
27
|
console.log("тест addToast"), console.log("toasts", r);
|
28
|
-
const
|
29
|
-
return /* @__PURE__ */
|
28
|
+
const v = h(() => ({ addToast: d }), [d]);
|
29
|
+
return /* @__PURE__ */ p(m.Provider, { value: v, children: [
|
30
30
|
o,
|
31
|
-
|
32
|
-
/* @__PURE__ */ l("div", { className:
|
31
|
+
g.createPortal(
|
32
|
+
/* @__PURE__ */ l("div", { className: "toast-provider", children: r.map((t) => /* @__PURE__ */ l("div", { className: "toast-provider__element", children: t.message }, t.id)) }),
|
33
33
|
document.body
|
34
34
|
)
|
35
35
|
] });
|
36
36
|
};
|
37
37
|
export {
|
38
38
|
M as ToastProvider,
|
39
|
-
|
39
|
+
j as useToast
|
40
40
|
};
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
._Wrapper_12sk9_1{position:fixed;bottom:20px;right:20px;z-index:101;display:flex;flex-direction:column;gap:10px}._Toast_12sk9_11{color:var(--color-text-primary-inversed);padding:20px 24px;border-radius:8px;display:flex;justify-content:space-between;align-items:center;min-width:250px;max-width:400px;font-size:16px;box-shadow:0 6px 15px -2px var(--effect-shadow-L, rgba(18, 18, 18, .08));animation:_fadeIn_12sk9_1 .5s ease-in-out;background-color:var(--color-bg-neutral-basic-inversed)}@keyframes _fadeIn_12sk9_1{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
|