@code0-tech/pictor 0.18.2 → 1.0.0

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.
Files changed (39) hide show
  1. package/dist/assets/components/button/Button.style.css +1 -1
  2. package/dist/assets/components/command/Command.style.css +1 -1
  3. package/dist/assets/components/context-menu/ContextMenu.style.css +1 -1
  4. package/dist/assets/components/dialog/Dialog.style.css +1 -1
  5. package/dist/assets/components/form/Input.style.css +1 -1
  6. package/dist/assets/components/form/SelectInput.style.css +1 -1
  7. package/dist/assets/components/menu/Menu.style.css +1 -1
  8. package/dist/assets/components/segmented-control/SegmentedControl.style.css +1 -1
  9. package/dist/assets/components/tab/Tab.style.css +1 -1
  10. package/dist/assets/components/tooltip/Tooltip.style.css +1 -1
  11. package/dist/components/breadcrumb/Breadcrumb.js +9 -8
  12. package/dist/components/context-menu/ContextMenu.d.ts +1 -1
  13. package/dist/components/context-menu/ContextMenu.js +89 -102
  14. package/dist/components/data-table/DataTable.js +11 -10
  15. package/dist/components/dialog/Dialog.js +75 -80
  16. package/dist/components/editor/Editor.js +3 -2
  17. package/dist/components/form/EditorInput.js +490 -460
  18. package/dist/components/form/Input.js +18 -17
  19. package/dist/components/form/NumberInput.js +4 -4
  20. package/dist/components/form/PasswordInput.js +15 -15
  21. package/dist/components/form/TextInput.js +7 -7
  22. package/dist/components/gantt/GanttGroup.js +40 -39
  23. package/dist/components/json-view/JsonView.js +3 -3
  24. package/dist/components/menu/Menu.js +104 -117
  25. package/dist/components/progress/ProgressCircle.js +7 -6
  26. package/dist/components/progress/ProgressLinear.js +6 -5
  27. package/dist/components/segmented-control/SegmentedControl.d.ts +2 -2
  28. package/dist/components/segmented-control/SegmentedControl.js +44 -20
  29. package/dist/components/tab/Tab.js +58 -32
  30. package/dist/components/toast/Toast.d.ts +1 -1
  31. package/dist/components/toast/Toast.js +64 -65
  32. package/dist/components/tooltip/Tooltip.js +46 -51
  33. package/dist/index.js +181 -170
  34. package/dist/node_modules/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.js +12 -0
  35. package/dist/utils/index.d.ts +1 -0
  36. package/dist/utils/index.js +25 -14
  37. package/dist/utils/motion.d.ts +55 -0
  38. package/dist/utils/motion.js +115 -0
  39. package/package.json +8 -8
@@ -1,86 +1,85 @@
1
- import { jsxs as I, jsx as o, Fragment as w } from "react/jsx-runtime";
2
- import { c as v } from "../../_virtual/compiler-runtime.js";
1
+ import { jsxs as $, jsx as o, Fragment as w } from "react/jsx-runtime";
2
+ import { c as T } from "../../_virtual/compiler-runtime.js";
3
3
  import { toast as F } 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 { mergeComponentProps as P } from "../../utils/component.js";
7
+ import { mergeComponentProps as S } from "../../utils/component.js";
8
+ import { usePopperMotion as b } from "../../utils/motion.js";
8
9
  import "js-md5";
9
- import { IconCircleX as S, IconAlertCircle as b, IconCircleCheck as k, IconInfoCircle as A, IconCircleDot as y } from "@tabler/icons-react";
10
- import { Text as D } from "../text/Text.js";
11
- import { Flex as x } from "../flex/Flex.js";
12
- const E = ["primary", "secondary", "tertiary", "info", "success", "warning", "error"], R = (r) => E.includes(r);
13
- function Y({
10
+ import { IconCircleX as k, IconAlertCircle as A, IconCircleCheck as D, IconInfoCircle as E, IconCircleDot as I } from "@tabler/icons-react";
11
+ import { Text as M } from "../text/Text.js";
12
+ import { Flex as P } from "../flex/Flex.js";
13
+ import { motion as R } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
14
+ const X = ["primary", "secondary", "tertiary", "info", "success", "warning", "error"], q = (r) => X.includes(r);
15
+ function st({
14
16
  wrapper: r,
15
17
  ...t
16
18
  }) {
17
- return F.custom((s) => {
18
- const e = /* @__PURE__ */ o(X, { id: s, ...t, children: t.children });
19
+ return F.custom((i) => {
20
+ const e = /* @__PURE__ */ o(B, { id: i, ...t, children: t.children });
19
21
  return /* @__PURE__ */ o(w, { children: r ? r(e) : e });
20
22
  }, {
21
23
  duration: t.duration ?? 4e3
22
24
  });
23
25
  }
24
- function X(r) {
25
- const t = v.c(28);
26
- let s, e, c, i, l, n, a, m;
27
- if (t[0] !== r) {
28
- const {
29
- color: C,
30
- icon: g,
31
- title: $,
32
- children: T,
33
- duration: B,
34
- ...N
35
- } = r;
36
- c = g, m = $, s = T, e = C === void 0 ? "secondary" : C;
37
- let h;
38
- t[9] !== e ? (h = R(e), t[9] = e, t[10] = h) : h = t[10], i = h;
39
- const j = i ? {} : {
40
- style: {
41
- color: e,
42
- ...N.style
43
- }
44
- }, z = e === "error";
45
- l = z ? "alert" : "status", n = z ? "assertive" : "polite", a = P(`toast toast--${i ? e : "secondary"}`, {
46
- ...N,
47
- ...j
48
- }), t[0] = r, t[1] = s, t[2] = e, t[3] = c, t[4] = i, t[5] = l, t[6] = n, t[7] = a, t[8] = m;
49
- } else
50
- s = t[1], e = t[2], c = t[3], i = t[4], l = t[5], n = t[6], a = t[7], m = t[8];
51
- let d;
52
- t[11] !== e || t[12] !== c || t[13] !== i ? (d = c ?? (i && /* @__PURE__ */ o(q, { color: e })), t[11] = e, t[12] = c, t[13] = i, t[14] = d) : d = t[14];
53
- let _;
54
- t[15] !== m ? (_ = /* @__PURE__ */ o(D, { size: "md", hierarchy: "primary", children: m }), t[15] = m, t[16] = _) : _ = t[16];
26
+ function B(r) {
27
+ const t = T.c(23), {
28
+ color: i,
29
+ icon: e,
30
+ title: p,
31
+ children: d,
32
+ duration: H,
33
+ ...x
34
+ } = r, s = i === void 0 ? "secondary" : i;
55
35
  let f;
56
- t[17] !== d || t[18] !== _ ? (f = /* @__PURE__ */ o(x, { className: "toast__header", children: /* @__PURE__ */ I(x, { className: "toast__header-wrapper", children: [
57
- d,
58
- _
59
- ] }) }), t[17] = d, t[18] = _, t[19] = f) : f = t[19];
60
- let p;
61
- t[20] !== s ? (p = s && /* @__PURE__ */ o("div", { className: "toast__content", children: s }), t[20] = s, t[21] = p) : p = t[21];
62
- let u;
63
- return t[22] !== l || t[23] !== n || t[24] !== a || t[25] !== f || t[26] !== p ? (u = /* @__PURE__ */ I("div", { role: l, "aria-live": n, ...a, children: [
64
- f,
65
- p
66
- ] }), t[22] = l, t[23] = n, t[24] = a, t[25] = f, t[26] = p, t[27] = u) : u = t[27], u;
36
+ t[0] !== s ? (f = q(s), t[0] = s, t[1] = f) : f = t[1];
37
+ const m = f, j = m ? {} : {
38
+ style: {
39
+ color: s,
40
+ ...x.style
41
+ }
42
+ }, g = s === "error", {
43
+ initial: u,
44
+ animate: h,
45
+ transition: y
46
+ } = b(), C = R, N = g ? "alert" : "status", z = g ? "assertive" : "polite", v = S(`toast toast--${m ? s : "secondary"}`, {
47
+ ...x,
48
+ ...j
49
+ });
50
+ let c;
51
+ t[2] !== s || t[3] !== e || t[4] !== m ? (c = e ?? (m && /* @__PURE__ */ o(G, { color: s })), t[2] = s, t[3] = e, t[4] = m, t[5] = c) : c = t[5];
52
+ let n;
53
+ t[6] !== p ? (n = /* @__PURE__ */ o(M, { size: "md", hierarchy: "primary", children: p }), t[6] = p, t[7] = n) : n = t[7];
54
+ let a;
55
+ t[8] !== c || t[9] !== n ? (a = /* @__PURE__ */ o(P, { className: "toast__header", children: /* @__PURE__ */ $(P, { className: "toast__header-wrapper", children: [
56
+ c,
57
+ n
58
+ ] }) }), t[8] = c, t[9] = n, t[10] = a) : a = t[10];
59
+ let l;
60
+ t[11] !== d ? (l = d && /* @__PURE__ */ o("div", { className: "toast__content", children: d }), t[11] = d, t[12] = l) : l = t[12];
61
+ let _;
62
+ return t[13] !== h || t[14] !== u || t[15] !== l || t[16] !== C.div || t[17] !== N || t[18] !== z || t[19] !== v || t[20] !== a || t[21] !== y ? (_ = /* @__PURE__ */ $(C.div, { role: N, "aria-live": z, initial: u, animate: h, transition: y, ...v, children: [
63
+ a,
64
+ l
65
+ ] }), t[13] = h, t[14] = u, t[15] = l, t[16] = C.div, t[17] = N, t[18] = z, t[19] = v, t[20] = a, t[21] = y, t[22] = _) : _ = t[22], _;
67
66
  }
68
- const q = (r) => {
69
- const t = v.c(1), {
70
- color: s
67
+ const G = (r) => {
68
+ const t = T.c(1), {
69
+ color: i
71
70
  } = r;
72
71
  let e;
73
72
  return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = {
74
- primary: /* @__PURE__ */ o(y, { className: "toast__icon", size: 16 }),
75
- secondary: /* @__PURE__ */ o(y, { className: "toast__icon", size: 16 }),
76
- tertiary: /* @__PURE__ */ o(y, { className: "toast__icon", size: 16 }),
77
- info: /* @__PURE__ */ o(A, { className: "toast__icon", size: 16 }),
78
- success: /* @__PURE__ */ o(k, { className: "toast__icon", size: 16 }),
79
- warning: /* @__PURE__ */ o(b, { className: "toast__icon", size: 16 }),
80
- error: /* @__PURE__ */ o(S, { className: "toast__icon", size: 16 })
81
- }, t[0] = e) : e = t[0], e[s] ?? null;
73
+ primary: /* @__PURE__ */ o(I, { className: "toast__icon", size: 16 }),
74
+ secondary: /* @__PURE__ */ o(I, { className: "toast__icon", size: 16 }),
75
+ tertiary: /* @__PURE__ */ o(I, { className: "toast__icon", size: 16 }),
76
+ info: /* @__PURE__ */ o(E, { className: "toast__icon", size: 16 }),
77
+ success: /* @__PURE__ */ o(D, { className: "toast__icon", size: 16 }),
78
+ warning: /* @__PURE__ */ o(A, { className: "toast__icon", size: 16 }),
79
+ error: /* @__PURE__ */ o(k, { className: "toast__icon", size: 16 })
80
+ }, t[0] = e) : e = t[0], e[i] ?? null;
82
81
  };
83
82
  export {
84
- X as Toast,
85
- Y as toast
83
+ B as Toast,
84
+ st as toast
86
85
  };
@@ -1,61 +1,56 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { c as m } from "../../_virtual/compiler-runtime.js";
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { c as p } from "../../_virtual/compiler-runtime.js";
3
+ import f from "react";
3
4
  import "../../utils/contextStore.js";
4
- import "react";
5
- import { mergeComponentProps as a } from "../../utils/component.js";
5
+ import { mergeComponentProps as m } from "../../utils/component.js";
6
+ import { useObservedOpen as _, usePopperMotion as d, popperTransformOrigin as T } from "../../utils/motion.js";
6
7
  import "js-md5";
7
8
  import * as s from "@radix-ui/react-tooltip";
8
9
  import '../../assets/components/tooltip/Tooltip.style.css';/* empty css */
9
10
  import { AutoScrollArea as g } from "../scroll-area/ScrollArea.js";
10
- const y = (i) => {
11
- const t = m.c(4);
12
- let o;
13
- t[0] !== i ? (o = a("tooltip", i), t[0] = i, t[1] = o) : o = t[1];
14
- const e = o;
15
- let l;
16
- return t[2] !== e ? (l = /* @__PURE__ */ n(s.TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ n(s.Tooltip, { ...e }) }), t[2] = e, t[3] = l) : l = t[3], l;
17
- }, C = (i) => {
18
- const t = m.c(4);
19
- let o;
20
- t[0] !== i ? (o = a("tooltip__trigger", i), t[0] = i, t[1] = o) : o = t[1];
21
- const e = o;
22
- let l;
23
- return t[2] !== e ? (l = /* @__PURE__ */ n(s.TooltipTrigger, { ...e }), t[2] = e, t[3] = l) : l = t[3], l;
24
- }, v = (i) => {
25
- const t = m.c(4);
26
- let o;
27
- t[0] !== i ? (o = a("tooltip__portal", i), t[0] = i, t[1] = o) : o = t[1];
28
- const e = o;
29
- let l;
30
- return t[2] !== e ? (l = /* @__PURE__ */ n(s.TooltipPortal, { ...e }), t[2] = e, t[3] = l) : l = t[3], l;
31
- }, R = (i) => {
32
- const t = m.c(12);
33
- let o, e, l, r;
34
- if (t[0] !== i) {
35
- const {
36
- children: _,
37
- ...d
38
- } = i;
39
- e = _, o = s.TooltipContent, r = i.align, l = a(`tooltip__content tooltip__content--${i.color ?? "tertiary"}`, d), t[0] = i, t[1] = o, t[2] = e, t[3] = l, t[4] = r;
40
- } else
41
- o = t[1], e = t[2], l = t[3], r = t[4];
42
- const T = l;
43
- let c;
44
- t[5] !== e ? (c = /* @__PURE__ */ n(g, { children: /* @__PURE__ */ n("div", { className: "tooltip__content-inner", children: e }) }), t[5] = e, t[6] = c) : c = t[6];
45
- let f;
46
- return t[7] !== o || t[8] !== r || t[9] !== T || t[10] !== c ? (f = /* @__PURE__ */ n(o, { align: r, ...T, children: c }), t[7] = o, t[8] = r, t[9] = T, t[10] = c, t[11] = f) : f = t[11], f;
47
- }, j = (i) => {
48
- const t = m.c(5), o = `tooltip__arrow tooltip__arrow--${i.color ?? "tertiary"}}`;
11
+ import { motion as h } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
12
+ import { AnimatePresence as C } from "../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js";
13
+ const u = f.createContext(!1), j = (o) => {
14
+ const t = p.c(8), [n, i] = _(o.open, o.defaultOpen, o.onOpenChange);
49
15
  let e;
50
- t[0] !== i || t[1] !== o ? (e = a(o, i), t[0] = i, t[1] = o, t[2] = e) : e = t[2];
16
+ t[0] !== o ? (e = m("tooltip", o), t[0] = o, t[1] = e) : e = t[1];
51
17
  const l = e;
52
- let r;
53
- return t[3] !== l ? (r = /* @__PURE__ */ n(s.TooltipArrow, { ...l }), t[3] = l, t[4] = r) : r = t[4], r;
18
+ let c;
19
+ t[2] !== i || t[3] !== l ? (c = /* @__PURE__ */ r(s.Tooltip, { ...l, onOpenChange: i }), t[2] = i, t[3] = l, t[4] = c) : c = t[4];
20
+ let a;
21
+ return t[5] !== n || t[6] !== c ? (a = /* @__PURE__ */ r(s.TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ r(u.Provider, { value: n, children: c }) }), t[5] = n, t[6] = c, t[7] = a) : a = t[7], a;
22
+ }, D = (o) => {
23
+ const t = p.c(4);
24
+ let n;
25
+ t[0] !== o ? (n = m("tooltip__trigger", o), t[0] = o, t[1] = n) : n = t[1];
26
+ const i = n;
27
+ let e;
28
+ return t[2] !== i ? (e = /* @__PURE__ */ r(s.TooltipTrigger, { ...i }), t[2] = i, t[3] = e) : e = t[3], e;
29
+ }, E = (o) => {
30
+ const t = p.c(4);
31
+ let n;
32
+ t[0] !== o ? (n = m("tooltip__portal", o), t[0] = o, t[1] = n) : n = t[1];
33
+ const i = n;
34
+ let e;
35
+ return t[2] !== i ? (e = /* @__PURE__ */ r(s.TooltipPortal, { forceMount: !0, ...i }), t[2] = i, t[3] = e) : e = t[3], e;
36
+ }, N = (o) => {
37
+ const {
38
+ children: t,
39
+ ...n
40
+ } = o, i = f.useContext(u), e = f.useRef(i), l = d();
41
+ return /* @__PURE__ */ r(C, { initial: !e.current, children: i && /* @__PURE__ */ r(s.TooltipContent, { forceMount: !0, asChild: !0, align: o.align, ...m(`tooltip__content tooltip__content--${o.color ?? "tertiary"}`, n), children: /* @__PURE__ */ r(h.div, { ...l, style: T("tooltip"), children: /* @__PURE__ */ r(g, { children: /* @__PURE__ */ r("div", { className: "tooltip__content-inner", children: t }) }) }) }, "tooltip__content") });
42
+ }, S = (o) => {
43
+ const t = p.c(5), n = `tooltip__arrow tooltip__arrow--${o.color ?? "tertiary"}}`;
44
+ let i;
45
+ t[0] !== o || t[1] !== n ? (i = m(n, o), t[0] = o, t[1] = n, t[2] = i) : i = t[2];
46
+ const e = i;
47
+ let l;
48
+ return t[3] !== e ? (l = /* @__PURE__ */ r(s.TooltipArrow, { ...e }), t[3] = e, t[4] = l) : l = t[4], l;
54
49
  };
55
50
  export {
56
- y as Tooltip,
57
- j as TooltipArrow,
58
- R as TooltipContent,
59
- v as TooltipPortal,
60
- C as TooltipTrigger
51
+ j as Tooltip,
52
+ S as TooltipArrow,
53
+ N as TooltipContent,
54
+ E as TooltipPortal,
55
+ D as TooltipTrigger
61
56
  };