@code0-tech/pictor 0.15.0 → 0.17.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 (73) hide show
  1. package/dist/assets/components/alert/Alert.style.css +1 -1
  2. package/dist/assets/components/avatar/Avatar.style.css +1 -1
  3. package/dist/assets/components/badge/Badge.style.css +1 -1
  4. package/dist/assets/components/breadcrumb/Breadcrumb.style.css +1 -1
  5. package/dist/assets/components/button/Button.style.css +1 -1
  6. package/dist/assets/components/button-group/ButtonGroup.style.css +1 -1
  7. package/dist/assets/components/card/Card.style.css +1 -1
  8. package/dist/assets/components/chart/Chart.style.css +1 -0
  9. package/dist/assets/components/command/Command.style.css +1 -1
  10. package/dist/assets/components/context-menu/ContextMenu.style.css +1 -1
  11. package/dist/assets/components/data-table/DataTable.style.css +1 -1
  12. package/dist/assets/components/dialog/Dialog.style.css +1 -1
  13. package/dist/assets/components/editor/Editor.styles.css +1 -1
  14. package/dist/assets/components/file-tabs/FileTabs.style.css +1 -1
  15. package/dist/assets/components/form/ColorInput.style.css +1 -0
  16. package/dist/assets/components/form/DateInput.style.css +1 -1
  17. package/dist/assets/components/form/EditorInput.style.css +1 -1
  18. package/dist/assets/components/form/Input.style.css +1 -1
  19. package/dist/assets/components/form/InputWrapper.style.css +1 -1
  20. package/dist/assets/components/form/SelectInput.style.css +1 -1
  21. package/dist/assets/components/json-view/JsonView.style.css +1 -1
  22. package/dist/assets/components/menu/Menu.style.css +1 -1
  23. package/dist/assets/components/resizable/Resizable.style.css +1 -1
  24. package/dist/assets/components/segmented-control/SegmentedControl.style.css +1 -1
  25. package/dist/assets/components/spacing/Spacing.style.css +1 -1
  26. package/dist/assets/components/tab/Tab.style.css +1 -1
  27. package/dist/assets/components/text/Text.style.css +1 -1
  28. package/dist/assets/components/toast/Toast.style.css +1 -1
  29. package/dist/assets/components/tooltip/Tooltip.style.css +1 -1
  30. package/dist/components/alert/Alert.js +33 -31
  31. package/dist/components/chart/Chart.d.ts +32 -0
  32. package/dist/components/chart/Chart.js +157 -0
  33. package/dist/components/chart/LineChart.d.ts +27 -0
  34. package/dist/components/chart/LineChart.js +76 -0
  35. package/dist/components/chart/index.d.ts +2 -0
  36. package/dist/components/chart/index.js +8 -0
  37. package/dist/components/command/Command.js +20 -22
  38. package/dist/components/form/ColorInput.d.ts +33 -0
  39. package/dist/components/form/ColorInput.js +355 -0
  40. package/dist/components/form/DateInput.js +82 -86
  41. package/dist/components/form/EditorInput.d.ts +26 -10
  42. package/dist/components/form/EditorInput.js +520 -148
  43. package/dist/components/form/EmailInput.js +16 -15
  44. package/dist/components/form/Input.d.ts +0 -20
  45. package/dist/components/form/Input.js +48 -425
  46. package/dist/components/form/InputLabel.d.ts +2 -1
  47. package/dist/components/form/InputLabel.js +20 -9
  48. package/dist/components/form/InputWrapper.d.ts +0 -1
  49. package/dist/components/form/InputWrapper.js +52 -48
  50. package/dist/components/form/NumberInput.js +17 -16
  51. package/dist/components/form/PasswordInput.js +23 -22
  52. package/dist/components/form/TagInput.d.ts +30 -0
  53. package/dist/components/form/TagInput.js +117 -0
  54. package/dist/components/form/TextInput.js +12 -11
  55. package/dist/components/form/index.d.ts +2 -2
  56. package/dist/components/form/index.js +83 -69
  57. package/dist/components/layout/Layout.js +37 -37
  58. package/dist/components/menu/Menu.d.ts +2 -2
  59. package/dist/components/menu/Menu.js +87 -87
  60. package/dist/components/scroll-area/ScrollArea.js +1 -1
  61. package/dist/components/toast/Toast.js +61 -61
  62. package/dist/index.d.ts +1 -0
  63. package/dist/index.js +247 -227
  64. package/dist/utils/index.js +11 -11
  65. package/dist/utils/size.d.ts +3 -3
  66. package/dist/utils/size.js +12 -6
  67. package/package.json +26 -20
  68. package/dist/components/form/Input.syntax.hook.d.ts +0 -10
  69. package/dist/components/form/Input.syntax.hook.js +0 -14
  70. package/dist/components/form/InputContentEditable.hook.d.ts +0 -52
  71. package/dist/components/form/InputContentEditable.hook.js +0 -449
  72. package/dist/components/form/InputSuggestion.d.ts +0 -27
  73. package/dist/components/form/InputSuggestion.js +0 -218
@@ -1,218 +0,0 @@
1
- import { jsx as I, jsxs as B } from "react/jsx-runtime";
2
- import { c as x } from "../../_virtual/compiler-runtime.js";
3
- import { MenuItem as L, MenuContent as F, MenuLabel as k } from "../menu/Menu.js";
4
- import i from "react";
5
- import { ScrollArea as N, ScrollAreaViewport as O, ScrollAreaScrollbar as T, ScrollAreaThumb as j } from "../scroll-area/ScrollArea.js";
6
- import { IconChevronDown as $, IconChevronUp as z } from "@tabler/icons-react";
7
- const D = i.memo((l) => {
8
- const e = x.c(17), {
9
- suggestion: n,
10
- visibleIndex: u,
11
- isActive: p,
12
- inputRef: d,
13
- onSelect: v,
14
- onActivate: c,
15
- itemRef: f
16
- } = l;
17
- if (u === null)
18
- return null;
19
- let m;
20
- if (e[0] !== d || e[1] !== c || e[2] !== u) {
21
- const b = () => {
22
- c(u), d?.current?.focus({
23
- preventScroll: !0
24
- });
25
- };
26
- m = (M) => {
27
- M.preventDefault(), b();
28
- }, e[0] = d, e[1] = c, e[2] = u, e[3] = m;
29
- } else
30
- m = e[3];
31
- const g = m;
32
- let a;
33
- e[4] !== c || e[5] !== u ? (a = (b) => {
34
- b.preventDefault(), b.stopPropagation(), c(u);
35
- }, e[4] = c, e[5] = u, e[6] = a) : a = e[6];
36
- const y = a;
37
- let C;
38
- e[7] !== v || e[8] !== n ? (C = () => setTimeout(() => v(n), 0), e[7] = v, e[8] = n, e[9] = C) : C = e[9];
39
- let o;
40
- return e[10] !== g || e[11] !== y || e[12] !== p || e[13] !== f || e[14] !== n.children || e[15] !== C ? (o = /* @__PURE__ */ I(L, { textValue: "", onPointerDown: g, onPointerMove: y, onSelect: C, "data-focus": p, ref: f, children: n.children }), e[10] = g, e[11] = y, e[12] = p, e[13] = f, e[14] = n.children, e[15] = C, e[16] = o) : o = e[16], o;
41
- }, (l, e) => l.suggestion === e.suggestion && l.visibleIndex === e.visibleIndex && l.isActive === e.isActive && l.inputRef === e.inputRef && l.onSelect === e.onSelect && l.onActivate === e.onActivate && l.itemRef === e.itemRef);
42
- D.displayName = "SuggestionMenuItem";
43
- const P = i.forwardRef((l, e) => {
44
- const n = x.c(12);
45
- let u, p, d;
46
- n[0] !== l ? ({
47
- children: u,
48
- inputRef: p,
49
- ...d
50
- } = l, n[0] = l, n[1] = u, n[2] = p, n[3] = d) : (u = n[1], p = n[2], d = n[3]);
51
- const v = i.useRef(null);
52
- let c, f;
53
- n[4] !== p ? (c = (g) => {
54
- g.preventDefault(), p?.current?.focus({
55
- preventScroll: !0
56
- });
57
- }, f = () => p?.current?.focus({
58
- preventScroll: !0
59
- }), n[4] = p, n[5] = c, n[6] = f) : (c = n[5], f = n[6]);
60
- let m;
61
- return n[7] !== u || n[8] !== d || n[9] !== c || n[10] !== f ? (m = /* @__PURE__ */ I(F, { ref: v, onContextMenuCapture: H, onInteractOutside: U, onCloseAutoFocus: q, onOpenAutoFocus: c, onFocusCapture: f, align: "start", sideOffset: 8, ...d, children: u }), n[7] = u, n[8] = d, n[9] = c, n[10] = f, n[11] = m) : m = n[11], m;
62
- });
63
- P.displayName = "InputSuggestionMenuContent";
64
- const Z = i.memo(P), V = i.forwardRef((l, e) => {
65
- const {
66
- suggestions: n,
67
- onSuggestionSelect: u = () => {
68
- },
69
- inputRef: p,
70
- ...d
71
- } = l, v = i.useRef([]), c = i.useRef(/* @__PURE__ */ new Map()), [f, m] = i.useState({}), g = i.useRef(null), a = i.useCallback((t, r) => {
72
- const s = g.current;
73
- if (!(!r?.force && s === t) && (s !== null && v.current[s]?.removeAttribute("data-focus"), g.current = t, t !== null)) {
74
- const h = v.current[t];
75
- h && (h.setAttribute("data-focus", "true"), r?.scrollIntoView && h.scrollIntoView({
76
- block: "nearest"
77
- }));
78
- }
79
- }, []);
80
- i.useEffect(() => {
81
- if (!n) {
82
- m({});
83
- return;
84
- }
85
- m((t) => {
86
- const r = {};
87
- return n.forEach((s) => {
88
- s.groupBy && (t.hasOwnProperty(s.groupBy) ? r[s.groupBy] = t[s.groupBy] : r[s.groupBy] = !1);
89
- }), r;
90
- });
91
- }, [n]);
92
- const {
93
- groupLabelCount: y,
94
- visibleSuggestionCount: C,
95
- visibleSuggestions: o
96
- } = i.useMemo(() => {
97
- if (!n) return {
98
- groupLabelCount: 0,
99
- visibleSuggestionCount: 0,
100
- visibleSuggestions: []
101
- };
102
- let t = 0, r = 0;
103
- const s = [];
104
- return n.forEach((h, A, R) => {
105
- const S = A > 0 ? R[A - 1]?.groupBy : void 0;
106
- h.groupBy && h.groupBy !== S && (t += 1), h.groupBy && f[h.groupBy] || (r += 1, s.push(h));
107
- }), {
108
- groupLabelCount: t,
109
- visibleSuggestionCount: r,
110
- visibleSuggestions: s
111
- };
112
- }, [f, n]);
113
- i.useEffect(() => {
114
- const t = g.current;
115
- if (t !== null) {
116
- if (t > o.length - 1) {
117
- a(o.length ? o.length - 1 : null, {
118
- force: !0
119
- });
120
- return;
121
- }
122
- a(t, {
123
- force: !0
124
- });
125
- }
126
- }, [a, o]), i.useImperativeHandle(e, () => ({
127
- focusFirstItem: () => {
128
- if (o.length)
129
- return a(0, {
130
- scrollIntoView: !0
131
- }), o[0];
132
- },
133
- focusLastItem: () => {
134
- if (!o.length) return;
135
- const t = o.length - 1;
136
- return a(t, {
137
- scrollIntoView: !0
138
- }), o[t];
139
- },
140
- highlightNextItem: () => {
141
- if (!o.length) return;
142
- const t = g.current, r = t === null ? 0 : Math.min(t + 1, o.length - 1);
143
- return a(r, {
144
- scrollIntoView: !0
145
- }), o[r];
146
- },
147
- highlightPreviousItem: () => {
148
- if (!o.length) return;
149
- const t = g.current, r = t === null ? o.length - 1 : Math.max(t - 1, 0);
150
- return a(r, {
151
- scrollIntoView: !0
152
- }), o[r];
153
- },
154
- selectActiveItem: () => {
155
- const t = g.current;
156
- if (t === null || !o[t]) return;
157
- const r = o[t];
158
- return setTimeout(() => u(r), 0), r;
159
- },
160
- clearActiveItem: () => a(null)
161
- }), [u, a, o]);
162
- const b = (t) => {
163
- m((r) => ({
164
- ...r,
165
- [t]: !r[t]
166
- }));
167
- }, M = i.useCallback((t) => {
168
- let r = c.current.get(t);
169
- return r || (r = (s) => {
170
- v.current[t] = s;
171
- }, c.current.set(t, r)), r;
172
- }, []);
173
- let E = -1;
174
- return /* @__PURE__ */ B(N, { h: `${Math.max(C + y, 1) * 27}px`, mah: "calc(var(--radix-popper-available-height) - 3rem - 69px)", ...d, children: [
175
- /* @__PURE__ */ I(O, { children: n?.map((t, r, s) => {
176
- const h = r > 0 ? s[r - 1]?.groupBy : void 0, A = t.groupBy && t.groupBy !== h, R = t.groupBy ? f[t.groupBy] : !1, S = R ? null : ++E, w = S !== null && g.current === S;
177
- return /* @__PURE__ */ B(i.Fragment, { children: [
178
- A && t.groupBy && /* @__PURE__ */ B(k, { onPointerDown: (G) => G.preventDefault(), onClick: () => b(t.groupBy), style: {
179
- display: "flex",
180
- alignItems: "center",
181
- justifyContent: "space-between",
182
- cursor: "pointer"
183
- }, children: [
184
- /* @__PURE__ */ I("span", { children: t.groupBy }),
185
- R ? /* @__PURE__ */ I($, { size: 16 }) : /* @__PURE__ */ I(z, { size: 16 })
186
- ] }),
187
- !R && /* @__PURE__ */ I(
188
- D,
189
- {
190
- suggestion: t,
191
- visibleIndex: S,
192
- isActive: w,
193
- inputRef: p,
194
- onSelect: u,
195
- onActivate: a,
196
- itemRef: S !== null ? M(S) : void 0
197
- }
198
- )
199
- ] }, r);
200
- }) }),
201
- /* @__PURE__ */ I(T, { orientation: "vertical", children: /* @__PURE__ */ I(j, {}) })
202
- ] });
203
- });
204
- V.displayName = "InputSuggestionMenuContentItems";
205
- const _ = i.memo(V);
206
- function H(l) {
207
- return l.stopPropagation();
208
- }
209
- function U(l) {
210
- return l.target instanceof HTMLInputElement && l.preventDefault();
211
- }
212
- function q(l) {
213
- return l.preventDefault();
214
- }
215
- export {
216
- Z as InputSuggestionMenuContent,
217
- _ as InputSuggestionMenuContentItems
218
- };