@code0-tech/pictor 0.0.0-mvp.13 → 0.0.0-mvp.14
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 +1 @@
|
|
|
1
|
-
.toast{padding:1rem}.toast{border-radius:1rem;font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px;line-height:1.5}.toast__header{align-items:flex-start;justify-content:space-between;gap:.
|
|
1
|
+
.toast{padding:1rem;width:100%;overflow:hidden}.toast{border-radius:1rem;font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px;line-height:1.5}.toast__header{align-items:flex-start;justify-content:space-between;gap:.7rem}.toast__icon{display:flex;align-items:center;justify-content:center}.toast__content{box-sizing:border-box;margin-left:27px}.toast__header-wrapper{align-items:flex-start;gap:.7rem}.toast__header-wrapper>svg{min-width:1rem;min-height:1rem}.toast__dismissible{cursor:pointer;display:flex;align-items:center;justify-content:center}.toast__dismissible{border-radius:1rem}.toast__dismissible svg{min-width:1rem;min-height:1rem}@keyframes toast-duration{0%{width:0%}to{width:100%}}.toast:hover .toast__duration:after{animation-play-state:paused}.toast__duration{position:relative;margin:1rem -1rem -1rem;padding:.35rem 1rem .6rem}.toast__duration{border-top:1px solid rgba(255,255,255,.1)}.toast__duration:after{content:"";position:absolute;left:0;bottom:0;width:0%;height:4px;background:#ffffff1a;animation-name:toast-duration;animation-duration:var(--toast-duration, 4s);animation-timing-function:linear;animation-fill-mode:forwards}.toast--primary{border:none;background:#030014;color:#ffffffbf;position:relative;box-sizing:border-box;box-shadow:inset 0 0 0 1px #ffffff1a}.toast--secondary{border:none;background:#1c1a2c;color:#ffffffbf;position:relative;box-sizing:border-box;box-shadow:inset 0 0 0 1px #ffffff1a}.toast--success{border:none;background:#071314;color:#ffffffbf;position:relative;box-sizing:border-box;box-shadow:inset 0 0 0 1px #ffffff1a}.toast--warning{border:none;background:#1c1313;color:#ffffffbf;position:relative;box-sizing:border-box;box-shadow:inset 0 0 0 1px #ffffff1a}.toast--error{border:none;background:#180016;color:#ffffffbf;position:relative;box-sizing:border-box;box-shadow:inset 0 0 0 1px #ffffff1a}.toast--info{border:none;background:#0e1a24;color:#ffffffbf;position:relative;box-sizing:border-box;box-shadow:inset 0 0 0 1px #ffffff1a}
|
|
@@ -7,6 +7,7 @@ export interface ToastProps extends Omit<Code0Component<HTMLDivElement>, "title"
|
|
|
7
7
|
color?: Color;
|
|
8
8
|
dismissible?: boolean;
|
|
9
9
|
onClose?: (event: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
|
|
10
|
+
duration?: number;
|
|
10
11
|
}
|
|
11
12
|
export declare function toast(toast: Omit<ToastProps, 'id'>): string | number;
|
|
12
13
|
export declare function Toast(props: ToastProps): React.JSX.Element;
|
|
@@ -1,70 +1,62 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import { toast as
|
|
1
|
+
import { jsx as s, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { c as p } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { toast as d } from "sonner";
|
|
4
4
|
import '../../assets/components/toast/Toast.style.css';/* empty css */
|
|
5
5
|
import "../../utils/contextStore.js";
|
|
6
6
|
import "react";
|
|
7
|
-
import { mergeCode0Props as
|
|
8
|
-
import { IconX as
|
|
9
|
-
import { Text as
|
|
10
|
-
import { Flex as
|
|
11
|
-
function
|
|
12
|
-
return
|
|
7
|
+
import { mergeCode0Props as f } from "../../utils/utils.js";
|
|
8
|
+
import { IconX as u, IconCircleX as N, IconAlertCircle as y, IconCircleCheck as C, IconInfoCircle as z, IconCircleDot as l } from "@tabler/icons-react";
|
|
9
|
+
import { Text as c } from "../text/Text.js";
|
|
10
|
+
import { Flex as m } from "../flex/Flex.js";
|
|
11
|
+
function D(o) {
|
|
12
|
+
return d.custom((e) => /* @__PURE__ */ s(I, { id: e, ...o, children: o.children }), {
|
|
13
|
+
duration: o.duration ?? 4e3
|
|
14
|
+
});
|
|
13
15
|
}
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
m,
|
|
43
|
-
d
|
|
44
|
-
] }), e[16] = m, e[17] = d, e[18] = f) : f = e[18];
|
|
45
|
-
let _;
|
|
46
|
-
e[19] !== o ? (_ = o && /* @__PURE__ */ s("div", { className: "toast__content", children: o }), e[19] = o, e[20] = _) : _ = e[20];
|
|
47
|
-
let h;
|
|
48
|
-
return e[21] !== l || e[22] !== f || e[23] !== _ ? (h = /* @__PURE__ */ N("div", { ...l, children: [
|
|
49
|
-
f,
|
|
50
|
-
_
|
|
51
|
-
] }), e[21] = l, e[22] = f, e[23] = _, e[24] = h) : h = e[24], h;
|
|
16
|
+
function I(o) {
|
|
17
|
+
const {
|
|
18
|
+
dismissible: e = !1,
|
|
19
|
+
color: t = "secondary",
|
|
20
|
+
title: i,
|
|
21
|
+
onClose: _ = () => {
|
|
22
|
+
},
|
|
23
|
+
children: a,
|
|
24
|
+
duration: n = 4e3,
|
|
25
|
+
...h
|
|
26
|
+
} = o;
|
|
27
|
+
return /* @__PURE__ */ r("div", { ...f(`toast toast--${t}`, h), children: [
|
|
28
|
+
/* @__PURE__ */ r(m, { className: "toast__header", children: [
|
|
29
|
+
/* @__PURE__ */ r(m, { className: "toast__header-wrapper", children: [
|
|
30
|
+
t && /* @__PURE__ */ s(x, { color: t }),
|
|
31
|
+
/* @__PURE__ */ s(c, { size: "md", children: i })
|
|
32
|
+
] }),
|
|
33
|
+
e && /* @__PURE__ */ s("span", { className: "toast__dismissible", onClick: () => d.dismiss(o.id), children: /* @__PURE__ */ s(u, { size: 18 }) })
|
|
34
|
+
] }),
|
|
35
|
+
a && /* @__PURE__ */ s("div", { className: "toast__content", children: a }),
|
|
36
|
+
/* @__PURE__ */ s("div", { className: "toast__duration", style: {
|
|
37
|
+
"--toast-duration": `${n}ms`
|
|
38
|
+
}, children: /* @__PURE__ */ r(c, { hierarchy: "tertiary", children: [
|
|
39
|
+
"This message will close in ",
|
|
40
|
+
/* @__PURE__ */ s(c, { hierarchy: "primary", children: n / 1e3 }),
|
|
41
|
+
" seconds"
|
|
42
|
+
] }) })
|
|
43
|
+
] });
|
|
52
44
|
}
|
|
53
|
-
const
|
|
54
|
-
const e =
|
|
55
|
-
color:
|
|
56
|
-
} =
|
|
57
|
-
let
|
|
58
|
-
return e[0] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
59
|
-
primary: /* @__PURE__ */ s(
|
|
60
|
-
secondary: /* @__PURE__ */ s(
|
|
61
|
-
info: /* @__PURE__ */ s(
|
|
62
|
-
success: /* @__PURE__ */ s(
|
|
63
|
-
warning: /* @__PURE__ */ s(
|
|
64
|
-
error: /* @__PURE__ */ s(
|
|
65
|
-
}, e[0] =
|
|
45
|
+
const x = (o) => {
|
|
46
|
+
const e = p.c(1), {
|
|
47
|
+
color: t
|
|
48
|
+
} = o;
|
|
49
|
+
let i;
|
|
50
|
+
return e[0] === Symbol.for("react.memo_cache_sentinel") ? (i = {
|
|
51
|
+
primary: /* @__PURE__ */ s(l, { className: "toast__icon", size: 18 }),
|
|
52
|
+
secondary: /* @__PURE__ */ s(l, { className: "toast__icon", size: 18 }),
|
|
53
|
+
info: /* @__PURE__ */ s(z, { className: "toast__icon", size: 18 }),
|
|
54
|
+
success: /* @__PURE__ */ s(C, { className: "toast__icon", size: 18 }),
|
|
55
|
+
warning: /* @__PURE__ */ s(y, { className: "toast__icon", size: 18 }),
|
|
56
|
+
error: /* @__PURE__ */ s(N, { className: "toast__icon", size: 18 })
|
|
57
|
+
}, e[0] = i) : i = e[0], i[t] ?? null;
|
|
66
58
|
};
|
|
67
59
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
I as Toast,
|
|
61
|
+
D as toast
|
|
70
62
|
};
|