@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:.35rem}.toast__icon{display:flex;align-items:center;justify-content:center}.toast__content{margin-top:.35rem;box-sizing:border-box}.toast__header-wrapper{align-items:center;gap:.35rem}.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}.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}
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 N } from "react/jsx-runtime";
2
- import { c as I } from "../../_virtual/compiler-runtime.js";
3
- import { toast as x } from "sonner";
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 $ } from "../../utils/utils.js";
8
- import { IconX as T, IconCircleX as g, IconAlertCircle as j, IconCircleCheck as k, IconInfoCircle as w, IconCircleDot as C } from "@tabler/icons-react";
9
- import { Text as X } from "../text/Text.js";
10
- import { Flex as z } from "../flex/Flex.js";
11
- function L(i) {
12
- return x.custom((e) => /* @__PURE__ */ s(A, { id: e, ...i, children: i.children }));
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 A(i) {
15
- const e = I.c(25);
16
- let o, t, c, l, r;
17
- if (e[0] !== i) {
18
- const {
19
- dismissible: p,
20
- color: u,
21
- title: y,
22
- onClose: E,
23
- children: b,
24
- ...v
25
- } = i;
26
- r = y, o = b, c = p === void 0 ? !1 : p, t = u === void 0 ? "secondary" : u, l = $(`toast toast--${t}`, v), e[0] = i, e[1] = o, e[2] = t, e[3] = c, e[4] = l, e[5] = r;
27
- } else
28
- o = e[1], t = e[2], c = e[3], l = e[4], r = e[5];
29
- let n;
30
- e[6] !== t ? (n = t && /* @__PURE__ */ s(D, { color: t }), e[6] = t, e[7] = n) : n = e[7];
31
- let a;
32
- e[8] !== r ? (a = /* @__PURE__ */ s(X, { size: "md", hierarchy: "primary", children: r }), e[8] = r, e[9] = a) : a = e[9];
33
- let m;
34
- e[10] !== n || e[11] !== a ? (m = /* @__PURE__ */ N(z, { className: "toast__header-wrapper", children: [
35
- n,
36
- a
37
- ] }), e[10] = n, e[11] = a, e[12] = m) : m = e[12];
38
- let d;
39
- e[13] !== c || e[14] !== i.id ? (d = c && /* @__PURE__ */ s("span", { className: "toast__dismissible", onClick: () => x.dismiss(i.id), children: /* @__PURE__ */ s(T, { size: 18 }) }), e[13] = c, e[14] = i.id, e[15] = d) : d = e[15];
40
- let f;
41
- e[16] !== m || e[17] !== d ? (f = /* @__PURE__ */ N(z, { className: "toast__header", children: [
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 D = (i) => {
54
- const e = I.c(1), {
55
- color: o
56
- } = i;
57
- let t;
58
- return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = {
59
- primary: /* @__PURE__ */ s(C, { className: "toast__icon", size: 18 }),
60
- secondary: /* @__PURE__ */ s(C, { className: "toast__icon", size: 18 }),
61
- info: /* @__PURE__ */ s(w, { className: "toast__icon", size: 18 }),
62
- success: /* @__PURE__ */ s(k, { className: "toast__icon", size: 18 }),
63
- warning: /* @__PURE__ */ s(j, { className: "toast__icon", size: 18 }),
64
- error: /* @__PURE__ */ s(g, { className: "toast__icon", size: 18 })
65
- }, e[0] = t) : t = e[0], t[o] ?? null;
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
- A as Toast,
69
- L as toast
60
+ I as Toast,
61
+ D as toast
70
62
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code0-tech/pictor",
3
- "version": "0.0.0-mvp.13",
3
+ "version": "0.0.0-mvp.14",
4
4
  "type": "module",
5
5
  "description": "A simple template for a custom React component library",
6
6
  "scripts": {