@code0-tech/pictor 0.0.0-mvp.12 → 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:center;justify-content:space-between}.toast__content{margin:.35rem 0;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}
@@ -17,12 +17,12 @@ const k = (n) => {
17
17
  r = d, i = f === void 0 ? "secondary" : f;
18
18
  let s;
19
19
  e[5] === Symbol.for("react.memo_cache_sentinel") ? (s = {
20
- primary: /* @__PURE__ */ t(a, { size: 16 }),
21
- secondary: /* @__PURE__ */ t(a, { size: 16 }),
22
- info: /* @__PURE__ */ t(u, { size: 16 }),
23
- success: /* @__PURE__ */ t(y, { size: 16 }),
24
- warning: /* @__PURE__ */ t(x, { size: 16 }),
25
- error: /* @__PURE__ */ t(h, { size: 16 })
20
+ primary: /* @__PURE__ */ t(a, { size: 18 }),
21
+ secondary: /* @__PURE__ */ t(a, { size: 18 }),
22
+ info: /* @__PURE__ */ t(u, { size: 18 }),
23
+ success: /* @__PURE__ */ t(y, { size: 18 }),
24
+ warning: /* @__PURE__ */ t(x, { size: 18 }),
25
+ error: /* @__PURE__ */ t(h, { size: 18 })
26
26
  }, e[5] = s) : s = e[5], c = s, o = I(`alert alert--${i}`, p), e[0] = n, e[1] = r, e[2] = i, e[3] = c, e[4] = o;
27
27
  } else
28
28
  r = e[1], i = e[2], c = e[3], o = e[4];
@@ -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 i, jsxs as p } from "react/jsx-runtime";
2
- import { c as x } from "../../_virtual/compiler-runtime.js";
3
- import { toast as y } 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 g, IconCircleX as T, IconAlertCircle as j, IconCircleCheck as k, IconInfoCircle as w, IconCircleDot as z } from "@tabler/icons-react";
9
- import { Text as X } from "../text/Text.js";
10
- import { Flex as I } from "../flex/Flex.js";
11
- function L(s) {
12
- return y.custom((e) => /* @__PURE__ */ i(A, { id: e, ...s, children: s.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(s) {
15
- const e = x.c(25);
16
- let o, t, r, l, c;
17
- if (e[0] !== s) {
18
- const {
19
- dismissible: u,
20
- color: C,
21
- title: b,
22
- onClose: E,
23
- children: v,
24
- ...N
25
- } = s;
26
- c = b, o = v, r = u === void 0 ? !1 : u, t = C === void 0 ? "secondary" : C, l = $(`toast toast--${t}`, N), e[0] = s, e[1] = o, e[2] = t, e[3] = r, e[4] = l, e[5] = c;
27
- } else
28
- o = e[1], t = e[2], r = e[3], l = e[4], c = e[5];
29
- let n;
30
- e[6] !== t ? (n = t && /* @__PURE__ */ i(D, { color: t }), e[6] = t, e[7] = n) : n = e[7];
31
- let m;
32
- e[8] !== c ? (m = /* @__PURE__ */ i(X, { size: "md", hierarchy: "primary", children: c }), e[8] = c, e[9] = m) : m = e[9];
33
- let a;
34
- e[10] !== n || e[11] !== m ? (a = /* @__PURE__ */ p(I, { align: "center", className: "toast__header-wrapper", children: [
35
- n,
36
- m
37
- ] }), e[10] = n, e[11] = m, e[12] = a) : a = e[12];
38
- let d;
39
- e[13] !== r || e[14] !== s.id ? (d = r && /* @__PURE__ */ i("span", { className: "toast__dismissible", onClick: () => y.dismiss(s.id), children: /* @__PURE__ */ i(g, { size: 16 }) }), e[13] = r, e[14] = s.id, e[15] = d) : d = e[15];
40
- let f;
41
- e[16] !== a || e[17] !== d ? (f = /* @__PURE__ */ p(I, { className: "toast__header", children: [
42
- a,
43
- d
44
- ] }), e[16] = a, e[17] = d, e[18] = f) : f = e[18];
45
- let h;
46
- e[19] !== o ? (h = o && /* @__PURE__ */ i("div", { className: "toast__content", children: o }), e[19] = o, e[20] = h) : h = e[20];
47
- let _;
48
- return e[21] !== l || e[22] !== f || e[23] !== h ? (_ = /* @__PURE__ */ p("div", { ...l, children: [
49
- f,
50
- h
51
- ] }), e[21] = l, e[22] = f, e[23] = h, e[24] = _) : _ = e[24], _;
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 = (s) => {
54
- const e = x.c(1), {
55
- color: o
56
- } = s;
57
- let t;
58
- return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = {
59
- primary: /* @__PURE__ */ i(z, { size: 16 }),
60
- secondary: /* @__PURE__ */ i(z, { size: 16 }),
61
- info: /* @__PURE__ */ i(w, { size: 16 }),
62
- success: /* @__PURE__ */ i(k, { size: 16 }),
63
- warning: /* @__PURE__ */ i(j, { size: 16 }),
64
- error: /* @__PURE__ */ i(T, { size: 16 })
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.12",
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": {