@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.
- package/dist/assets/components/alert/Alert.style.css +1 -1
- package/dist/assets/components/avatar/Avatar.style.css +1 -1
- package/dist/assets/components/badge/Badge.style.css +1 -1
- package/dist/assets/components/breadcrumb/Breadcrumb.style.css +1 -1
- package/dist/assets/components/button/Button.style.css +1 -1
- package/dist/assets/components/button-group/ButtonGroup.style.css +1 -1
- package/dist/assets/components/card/Card.style.css +1 -1
- package/dist/assets/components/chart/Chart.style.css +1 -0
- package/dist/assets/components/command/Command.style.css +1 -1
- package/dist/assets/components/context-menu/ContextMenu.style.css +1 -1
- package/dist/assets/components/data-table/DataTable.style.css +1 -1
- package/dist/assets/components/dialog/Dialog.style.css +1 -1
- package/dist/assets/components/editor/Editor.styles.css +1 -1
- package/dist/assets/components/file-tabs/FileTabs.style.css +1 -1
- package/dist/assets/components/form/ColorInput.style.css +1 -0
- package/dist/assets/components/form/DateInput.style.css +1 -1
- package/dist/assets/components/form/EditorInput.style.css +1 -1
- package/dist/assets/components/form/Input.style.css +1 -1
- package/dist/assets/components/form/InputWrapper.style.css +1 -1
- package/dist/assets/components/form/SelectInput.style.css +1 -1
- package/dist/assets/components/json-view/JsonView.style.css +1 -1
- package/dist/assets/components/menu/Menu.style.css +1 -1
- package/dist/assets/components/resizable/Resizable.style.css +1 -1
- package/dist/assets/components/segmented-control/SegmentedControl.style.css +1 -1
- package/dist/assets/components/spacing/Spacing.style.css +1 -1
- package/dist/assets/components/tab/Tab.style.css +1 -1
- package/dist/assets/components/text/Text.style.css +1 -1
- package/dist/assets/components/toast/Toast.style.css +1 -1
- package/dist/assets/components/tooltip/Tooltip.style.css +1 -1
- package/dist/components/alert/Alert.js +33 -31
- package/dist/components/chart/Chart.d.ts +32 -0
- package/dist/components/chart/Chart.js +157 -0
- package/dist/components/chart/LineChart.d.ts +27 -0
- package/dist/components/chart/LineChart.js +76 -0
- package/dist/components/chart/index.d.ts +2 -0
- package/dist/components/chart/index.js +8 -0
- package/dist/components/command/Command.js +20 -22
- package/dist/components/form/ColorInput.d.ts +33 -0
- package/dist/components/form/ColorInput.js +355 -0
- package/dist/components/form/DateInput.js +82 -86
- package/dist/components/form/EditorInput.d.ts +26 -10
- package/dist/components/form/EditorInput.js +520 -148
- package/dist/components/form/EmailInput.js +16 -15
- package/dist/components/form/Input.d.ts +0 -20
- package/dist/components/form/Input.js +48 -425
- package/dist/components/form/InputLabel.d.ts +2 -1
- package/dist/components/form/InputLabel.js +20 -9
- package/dist/components/form/InputWrapper.d.ts +0 -1
- package/dist/components/form/InputWrapper.js +52 -48
- package/dist/components/form/NumberInput.js +17 -16
- package/dist/components/form/PasswordInput.js +23 -22
- package/dist/components/form/TagInput.d.ts +30 -0
- package/dist/components/form/TagInput.js +117 -0
- package/dist/components/form/TextInput.js +12 -11
- package/dist/components/form/index.d.ts +2 -2
- package/dist/components/form/index.js +83 -69
- package/dist/components/layout/Layout.js +37 -37
- package/dist/components/menu/Menu.d.ts +2 -2
- package/dist/components/menu/Menu.js +87 -87
- package/dist/components/scroll-area/ScrollArea.js +1 -1
- package/dist/components/toast/Toast.js +61 -61
- package/dist/index.d.ts +1 -0
- package/dist/index.js +247 -227
- package/dist/utils/index.js +11 -11
- package/dist/utils/size.d.ts +3 -3
- package/dist/utils/size.js +12 -6
- package/package.json +26 -20
- package/dist/components/form/Input.syntax.hook.d.ts +0 -10
- package/dist/components/form/Input.syntax.hook.js +0 -14
- package/dist/components/form/InputContentEditable.hook.d.ts +0 -52
- package/dist/components/form/InputContentEditable.hook.js +0 -449
- package/dist/components/form/InputSuggestion.d.ts +0 -27
- package/dist/components/form/InputSuggestion.js +0 -218
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { c as
|
|
1
|
+
import { jsx as n, jsxs as g, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { c as b } from "../../_virtual/compiler-runtime.js";
|
|
3
3
|
import { DatePicker as a, DateInput as C } from "@ark-ui/react";
|
|
4
4
|
import { toZoned as J, getLocalTimeZone as q, fromDate as K } from "@internationalized/date";
|
|
5
5
|
import { IconChevronDown as Q } from "@tabler/icons-react";
|
|
@@ -12,28 +12,28 @@ import { Flex as ee } from "../flex/Flex.js";
|
|
|
12
12
|
import { MenuTrigger as te, Menu as ne, MenuPortal as le, MenuContent as re } from "../menu/Menu.js";
|
|
13
13
|
import { SelectPortal as ie, SelectContent as ae, SelectViewport as ce, SelectItem as oe, SelectItemText as se, SelectValue as ue, SelectTrigger as me, SelectInput as de } from "./SelectInput.js";
|
|
14
14
|
import '../../assets/components/form/DateInput.style.css';/* empty css */
|
|
15
|
-
import { Button as
|
|
16
|
-
const
|
|
15
|
+
import { Button as he } from "../button/Button.js";
|
|
16
|
+
const fe = (t) => K(new Date(t * 1e3), q()), _e = (t) => Math.floor(J(t, q()).toDate().getTime() / 1e3), Y = (t) => {
|
|
17
17
|
const e = Array.isArray(t) ? t : [t], l = [];
|
|
18
18
|
for (const r of e)
|
|
19
|
-
r == null || r === "" || (typeof r == "number" ? Number.isNaN(r) || l.push(
|
|
19
|
+
r == null || r === "" || (typeof r == "number" ? Number.isNaN(r) || l.push(fe(r)) : l.push(r));
|
|
20
20
|
return l;
|
|
21
21
|
}, qe = (t) => {
|
|
22
|
-
const e =
|
|
22
|
+
const e = b.c(43), {
|
|
23
23
|
title: l,
|
|
24
24
|
description: r,
|
|
25
25
|
left: i,
|
|
26
26
|
leftType: c,
|
|
27
27
|
rightType: o,
|
|
28
28
|
right: s,
|
|
29
|
-
formValidation:
|
|
30
|
-
initialValue:
|
|
31
|
-
defaultValue:
|
|
29
|
+
formValidation: m,
|
|
30
|
+
initialValue: u,
|
|
31
|
+
defaultValue: f,
|
|
32
32
|
value: d,
|
|
33
|
-
granularity:
|
|
33
|
+
granularity: h,
|
|
34
34
|
closeOnSelect: _,
|
|
35
35
|
name: p,
|
|
36
|
-
disabled:
|
|
36
|
+
disabled: T,
|
|
37
37
|
readOnly: k,
|
|
38
38
|
locale: v,
|
|
39
39
|
placeholderValue: A,
|
|
@@ -41,7 +41,7 @@ const he = (t) => K(new Date(t * 1e3), q()), _e = (t) => Math.floor(J(t, q()).to
|
|
|
41
41
|
children: z
|
|
42
42
|
} = t;
|
|
43
43
|
let $;
|
|
44
|
-
e[0] !==
|
|
44
|
+
e[0] !== f || e[1] !== u || e[2] !== d ? ($ = () => Y(d ?? u ?? f), e[0] = f, e[1] = u, e[2] = d, e[3] = $) : $ = e[3];
|
|
45
45
|
const [w, L] = F.useState($);
|
|
46
46
|
let R, M;
|
|
47
47
|
e[4] !== d ? (R = () => {
|
|
@@ -49,41 +49,41 @@ const he = (t) => K(new Date(t * 1e3), q()), _e = (t) => Math.floor(J(t, q()).to
|
|
|
49
49
|
}, M = [d], e[4] = d, e[5] = R, e[6] = M) : (R = e[5], M = e[6]), F.useEffect(R, M);
|
|
50
50
|
const [y, W] = F.useState(!1);
|
|
51
51
|
let O;
|
|
52
|
-
e[7] !==
|
|
53
|
-
L(I.value),
|
|
54
|
-
}, e[7] =
|
|
55
|
-
const
|
|
52
|
+
e[7] !== m || e[8] !== G ? (O = (I) => {
|
|
53
|
+
L(I.value), m?.setValue?.(I.value[0] ? _e(I.value[0]) : null), G?.(I);
|
|
54
|
+
}, e[7] = m, e[8] = G, e[9] = O) : O = e[9];
|
|
55
|
+
const V = O;
|
|
56
56
|
let P;
|
|
57
|
-
e[10] !== w || e[11] !==
|
|
57
|
+
e[10] !== w || e[11] !== T || e[12] !== h || e[13] !== V || e[14] !== v || e[15] !== p || e[16] !== A || e[17] !== k ? (P = S("date-input", {
|
|
58
58
|
value: w,
|
|
59
|
-
onValueChange:
|
|
60
|
-
granularity:
|
|
59
|
+
onValueChange: V,
|
|
60
|
+
granularity: h,
|
|
61
61
|
name: p,
|
|
62
|
-
disabled:
|
|
62
|
+
disabled: T,
|
|
63
63
|
readOnly: k,
|
|
64
64
|
locale: v,
|
|
65
65
|
placeholderValue: A
|
|
66
|
-
}), e[10] = w, e[11] =
|
|
66
|
+
}), e[10] = w, e[11] = T, e[12] = h, e[13] = V, e[14] = v, e[15] = p, e[16] = A, e[17] = k, e[18] = P) : P = e[18];
|
|
67
67
|
const E = P;
|
|
68
68
|
let j;
|
|
69
69
|
e[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (j = (I) => W(I.open), e[19] = j) : j = e[19];
|
|
70
|
-
let
|
|
71
|
-
e[20] !== z || e[21] !== r || e[22] !==
|
|
70
|
+
let N;
|
|
71
|
+
e[20] !== z || e[21] !== r || e[22] !== m || e[23] !== i || e[24] !== c || e[25] !== s || e[26] !== o || e[27] !== l ? (N = /* @__PURE__ */ n(X, { title: l, description: r, left: i, leftType: c, right: s, rightType: o, formValidation: m, children: z }), e[20] = z, e[21] = r, e[22] = m, e[23] = i, e[24] = c, e[25] = s, e[26] = o, e[27] = l, e[28] = N) : N = e[28];
|
|
72
72
|
let x;
|
|
73
|
-
e[29] !== y || e[30] !==
|
|
73
|
+
e[29] !== y || e[30] !== N ? (x = /* @__PURE__ */ n(ne, { open: y, onOpenChange: W, children: N }), e[29] = y, e[30] = N, e[31] = x) : x = e[31];
|
|
74
74
|
let D;
|
|
75
|
-
e[32] !== _ || e[33] !== w || e[34] !==
|
|
75
|
+
e[32] !== _ || e[33] !== w || e[34] !== T || e[35] !== V || e[36] !== v || e[37] !== y || e[38] !== x ? (D = /* @__PURE__ */ n(a.Root, { value: w, onValueChange: V, open: y, onOpenChange: j, closeOnSelect: _, disabled: T, locale: v, children: x }), e[32] = _, e[33] = w, e[34] = T, e[35] = V, e[36] = v, e[37] = y, e[38] = x, e[39] = D) : D = e[39];
|
|
76
76
|
let B;
|
|
77
77
|
return e[40] !== E || e[41] !== D ? (B = /* @__PURE__ */ n(C.Root, { ...E, children: D }), e[40] = E, e[41] = D, e[42] = B) : B = e[42], B;
|
|
78
78
|
}, Je = (t) => {
|
|
79
|
-
const e =
|
|
79
|
+
const e = b.c(4);
|
|
80
80
|
let l;
|
|
81
81
|
e[0] !== t ? (l = S("date-input__control", t), e[0] = t, e[1] = l) : l = e[1];
|
|
82
82
|
const r = l;
|
|
83
83
|
let i;
|
|
84
84
|
return e[2] !== r ? (i = /* @__PURE__ */ n(C.Control, { ...r }), e[2] = r, e[3] = i) : i = e[3], i;
|
|
85
85
|
}, Ke = (t) => {
|
|
86
|
-
const e =
|
|
86
|
+
const e = b.c(8);
|
|
87
87
|
let l;
|
|
88
88
|
e[0] !== t ? (l = S("date-input__segment-group", t), e[0] = t, e[1] = l) : l = e[1];
|
|
89
89
|
const r = l;
|
|
@@ -94,110 +94,106 @@ const he = (t) => K(new Date(t * 1e3), q()), _e = (t) => Math.floor(J(t, q()).to
|
|
|
94
94
|
let o;
|
|
95
95
|
e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ n(C.HiddenInput, {}), e[5] = o) : o = e[5];
|
|
96
96
|
let s;
|
|
97
|
-
return e[6] !== c ? (s = /* @__PURE__ */
|
|
97
|
+
return e[6] !== c ? (s = /* @__PURE__ */ g(H, { children: [
|
|
98
98
|
c,
|
|
99
99
|
o
|
|
100
100
|
] }), e[6] = c, e[7] = s) : s = e[7], s;
|
|
101
101
|
}, Qe = (t) => {
|
|
102
|
-
const e =
|
|
102
|
+
const e = b.c(4);
|
|
103
103
|
let l;
|
|
104
104
|
e[0] !== t ? (l = S("date-input__trigger", t), e[0] = t, e[1] = l) : l = e[1];
|
|
105
105
|
const r = l;
|
|
106
106
|
let i;
|
|
107
107
|
return e[2] !== r ? (i = /* @__PURE__ */ n(te, { ...r }), e[2] = r, e[3] = i) : i = e[3], i;
|
|
108
108
|
}, pe = (t) => {
|
|
109
|
-
const e =
|
|
109
|
+
const e = b.c(4);
|
|
110
110
|
let l;
|
|
111
111
|
e[0] !== t ? (l = S("date-input__prev-trigger", t), e[0] = t, e[1] = l) : l = e[1];
|
|
112
112
|
const r = l;
|
|
113
113
|
let i;
|
|
114
114
|
return e[2] !== r ? (i = /* @__PURE__ */ n(a.PrevTrigger, { ...r }), e[2] = r, e[3] = i) : i = e[3], i;
|
|
115
115
|
}, ge = (t) => {
|
|
116
|
-
const e =
|
|
116
|
+
const e = b.c(4);
|
|
117
117
|
let l;
|
|
118
118
|
e[0] !== t ? (l = S("date-input__next-trigger", t), e[0] = t, e[1] = l) : l = e[1];
|
|
119
119
|
const r = l;
|
|
120
120
|
let i;
|
|
121
121
|
return e[2] !== r ? (i = /* @__PURE__ */ n(a.NextTrigger, { ...r }), e[2] = r, e[3] = i) : i = e[3], i;
|
|
122
122
|
}, Z = () => {
|
|
123
|
-
const t =
|
|
123
|
+
const t = b.c(2);
|
|
124
124
|
let e;
|
|
125
125
|
t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n(pe, { children: "‹" }), t[0] = e) : e = t[0];
|
|
126
126
|
let l;
|
|
127
|
-
return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */
|
|
127
|
+
return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ g(a.ViewControl, { className: "date-input__view-control", children: [
|
|
128
128
|
e,
|
|
129
129
|
/* @__PURE__ */ n(a.ViewTrigger, { className: "date-input__view-trigger", children: /* @__PURE__ */ n(a.RangeText, { className: "date-input__range-text" }) }),
|
|
130
130
|
/* @__PURE__ */ n(ge, { children: "›" })
|
|
131
131
|
] }), t[1] = l) : l = t[1], l;
|
|
132
132
|
}, Xe = (t) => {
|
|
133
|
-
const e =
|
|
133
|
+
const e = b.c(20);
|
|
134
134
|
let l, r, i, c, o, s;
|
|
135
135
|
if (e[0] !== t) {
|
|
136
136
|
const {
|
|
137
137
|
withTime: p,
|
|
138
|
-
...
|
|
138
|
+
...T
|
|
139
139
|
} = t;
|
|
140
|
-
s = p, r = le, l = re, c = "end", o = 8, i = S("date-input__content",
|
|
140
|
+
s = p, r = le, l = re, c = "end", o = 8, i = S("date-input__content", T), e[0] = t, e[1] = l, e[2] = r, e[3] = i, e[4] = c, e[5] = o, e[6] = s;
|
|
141
141
|
} else
|
|
142
142
|
l = e[1], r = e[2], i = e[3], c = e[4], o = e[5], s = e[6];
|
|
143
|
-
const
|
|
144
|
-
let
|
|
145
|
-
e[7] !== s ? (
|
|
143
|
+
const m = i;
|
|
144
|
+
let u;
|
|
145
|
+
e[7] !== s ? (u = /* @__PURE__ */ n(a.View, { view: "day", className: "date-input__view", children: /* @__PURE__ */ n(a.Context, { children: (p) => /* @__PURE__ */ g(H, { children: [
|
|
146
146
|
/* @__PURE__ */ n(Z, {}),
|
|
147
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ g(a.Table, { className: "date-input__table", children: [
|
|
148
148
|
/* @__PURE__ */ n(a.TableHead, { children: /* @__PURE__ */ n(a.TableRow, { children: p.weekDays.map(Se) }) }),
|
|
149
149
|
/* @__PURE__ */ n(a.TableBody, { children: p.weeks.map(we) })
|
|
150
150
|
] }),
|
|
151
151
|
s && /* @__PURE__ */ n(be, {})
|
|
152
|
-
] }) }) }), e[7] = s, e[8] =
|
|
153
|
-
let
|
|
154
|
-
e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
152
|
+
] }) }) }), e[7] = s, e[8] = u) : u = e[8];
|
|
153
|
+
let f;
|
|
154
|
+
e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ n(a.View, { view: "month", className: "date-input__view", children: /* @__PURE__ */ n(a.Context, { children: Ne }) }), e[9] = f) : f = e[9];
|
|
155
155
|
let d;
|
|
156
156
|
e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ n(a.View, { view: "year", className: "date-input__view", children: /* @__PURE__ */ n(a.Context, { children: Ie }) }), e[10] = d) : d = e[10];
|
|
157
|
-
let
|
|
158
|
-
e[11] !== l || e[12] !== c || e[13] !== o || e[14] !==
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
let h;
|
|
158
|
+
e[11] !== l || e[12] !== c || e[13] !== o || e[14] !== m || e[15] !== u ? (h = /* @__PURE__ */ g(l, { align: c, sideOffset: o, ...m, children: [
|
|
159
|
+
u,
|
|
160
|
+
f,
|
|
161
161
|
d
|
|
162
|
-
] }), e[11] = l, e[12] = c, e[13] = o, e[14] =
|
|
162
|
+
] }), e[11] = l, e[12] = c, e[13] = o, e[14] = m, e[15] = u, e[16] = h) : h = e[16];
|
|
163
163
|
let _;
|
|
164
|
-
return e[17] !== r || e[18] !==
|
|
164
|
+
return e[17] !== r || e[18] !== h ? (_ = /* @__PURE__ */ n(r, { children: h }), e[17] = r, e[18] = h, e[19] = _) : _ = e[19], _;
|
|
165
165
|
}, be = () => {
|
|
166
|
-
const t =
|
|
166
|
+
const t = b.c(1);
|
|
167
167
|
let e;
|
|
168
168
|
return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n(C.Context, { children: Me }), t[0] = e) : e = t[0], e;
|
|
169
169
|
}, U = (t) => {
|
|
170
|
-
const e =
|
|
170
|
+
const e = b.c(15), {
|
|
171
171
|
label: l,
|
|
172
172
|
value: r,
|
|
173
173
|
count: i,
|
|
174
174
|
disabled: c,
|
|
175
175
|
onValueChange: o
|
|
176
176
|
} = t, s = String(r);
|
|
177
|
-
let u;
|
|
178
|
-
e[0] !== o ? (u = (g) => o(Number(g)), e[0] = o, e[1] = u) : u = e[1];
|
|
179
177
|
let m;
|
|
180
|
-
e[
|
|
181
|
-
|
|
182
|
-
}, e[2] =
|
|
183
|
-
let h;
|
|
184
|
-
e[3] !== l ? (h = /* @__PURE__ */ n(ue, { "aria-label": l }), e[3] = l, e[4] = h) : h = e[4];
|
|
185
|
-
let d;
|
|
186
|
-
e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ n(Q, { size: 13 }), e[5] = d) : d = e[5];
|
|
178
|
+
e[0] !== o ? (m = (p) => o(Number(p)), e[0] = o, e[1] = m) : m = e[1];
|
|
179
|
+
let u;
|
|
180
|
+
e[2] !== l ? (u = /* @__PURE__ */ n(ue, { "aria-label": l }), e[2] = l, e[3] = u) : u = e[3];
|
|
187
181
|
let f;
|
|
188
|
-
e[
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
182
|
+
e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ n(Q, { size: 13 }), e[4] = f) : f = e[4];
|
|
183
|
+
let d;
|
|
184
|
+
e[5] !== u ? (d = /* @__PURE__ */ n(me, { asChild: !0, children: /* @__PURE__ */ n(he, { paddingSize: "xxs", justify: "start", children: /* @__PURE__ */ g(ee, { justify: "space-between", w: "100%", align: "center", children: [
|
|
185
|
+
u,
|
|
186
|
+
f
|
|
187
|
+
] }) }) }), e[5] = u, e[6] = d) : d = e[6];
|
|
188
|
+
let h;
|
|
189
|
+
e[7] !== i ? (h = /* @__PURE__ */ n(ie, { children: /* @__PURE__ */ n(ae, { position: "item-aligned", children: /* @__PURE__ */ n(ce, { children: Array.from({
|
|
194
190
|
length: i
|
|
195
|
-
}, Oe) }) }) }), e[
|
|
196
|
-
let
|
|
197
|
-
return e[
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
] }), e[
|
|
191
|
+
}, Oe) }) }) }), e[7] = i, e[8] = h) : h = e[8];
|
|
192
|
+
let _;
|
|
193
|
+
return e[9] !== c || e[10] !== s || e[11] !== m || e[12] !== d || e[13] !== h ? (_ = /* @__PURE__ */ g(de, { value: s, disabled: c, onValueChange: m, children: [
|
|
194
|
+
d,
|
|
195
|
+
h
|
|
196
|
+
] }), e[9] = c, e[10] = s, e[11] = m, e[12] = d, e[13] = h, e[14] = _) : _ = e[14], _;
|
|
201
197
|
};
|
|
202
198
|
function Te(t, e) {
|
|
203
199
|
return /* @__PURE__ */ n(C.Segment, { segment: t, className: "date-input__segment" }, e);
|
|
@@ -217,16 +213,16 @@ function we(t, e) {
|
|
|
217
213
|
function ye(t, e) {
|
|
218
214
|
return /* @__PURE__ */ n(a.TableCell, { value: t.value, children: /* @__PURE__ */ n(a.TableCellTrigger, { className: "date-input__cell", children: t.label }) }, e);
|
|
219
215
|
}
|
|
220
|
-
function
|
|
216
|
+
function Ve(t, e) {
|
|
221
217
|
return /* @__PURE__ */ n(a.TableRow, { children: t.map(ye) }, e);
|
|
222
218
|
}
|
|
223
|
-
function
|
|
224
|
-
return /* @__PURE__ */
|
|
219
|
+
function Ne(t) {
|
|
220
|
+
return /* @__PURE__ */ g(H, { children: [
|
|
225
221
|
/* @__PURE__ */ n(Z, {}),
|
|
226
222
|
/* @__PURE__ */ n(a.Table, { className: "date-input__table", children: /* @__PURE__ */ n(a.TableBody, { children: t.getMonthsGrid({
|
|
227
223
|
columns: 4,
|
|
228
224
|
format: "short"
|
|
229
|
-
}).map(
|
|
225
|
+
}).map(Ve) }) })
|
|
230
226
|
] });
|
|
231
227
|
}
|
|
232
228
|
function xe(t, e) {
|
|
@@ -236,7 +232,7 @@ function De(t, e) {
|
|
|
236
232
|
return /* @__PURE__ */ n(a.TableRow, { children: t.map(xe) }, e);
|
|
237
233
|
}
|
|
238
234
|
function Ie(t) {
|
|
239
|
-
return /* @__PURE__ */
|
|
235
|
+
return /* @__PURE__ */ g(H, { children: [
|
|
240
236
|
/* @__PURE__ */ n(Z, {}),
|
|
241
237
|
/* @__PURE__ */ n(a.Table, { className: "date-input__table", children: /* @__PURE__ */ n(a.TableBody, { children: t.getYearsGrid({
|
|
242
238
|
columns: 4
|
|
@@ -247,7 +243,7 @@ function $e(t) {
|
|
|
247
243
|
return t.type;
|
|
248
244
|
}
|
|
249
245
|
function Re(t, e) {
|
|
250
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ g(F.Fragment, { children: [
|
|
251
247
|
e > 0 && /* @__PURE__ */ n("span", { className: "date-input__time-separator", children: ":" }),
|
|
252
248
|
t
|
|
253
249
|
] }, e);
|
|
@@ -255,20 +251,20 @@ function Re(t, e) {
|
|
|
255
251
|
function Me(t) {
|
|
256
252
|
const e = new Set(t.getSegments().map($e));
|
|
257
253
|
return /* @__PURE__ */ n(a.Context, { children: (l) => {
|
|
258
|
-
const r = l.value[0], i = r?.hour ?? 0, c = r?.minute ?? 0, o = r?.second ?? 0, s = l.value.length === 0,
|
|
259
|
-
return e.has("hour") &&
|
|
260
|
-
hour:
|
|
254
|
+
const r = l.value[0], i = r?.hour ?? 0, c = r?.minute ?? 0, o = r?.second ?? 0, s = l.value.length === 0, m = [];
|
|
255
|
+
return e.has("hour") && m.push(/* @__PURE__ */ n(U, { label: "Hour", value: i, count: 24, disabled: s, onValueChange: (u) => l.setTime({
|
|
256
|
+
hour: u,
|
|
261
257
|
minute: c,
|
|
262
258
|
second: o
|
|
263
|
-
}) }, "hour")), e.has("minute") &&
|
|
259
|
+
}) }, "hour")), e.has("minute") && m.push(/* @__PURE__ */ n(U, { label: "Minute", value: c, count: 60, disabled: s, onValueChange: (u) => l.setTime({
|
|
264
260
|
hour: i,
|
|
265
|
-
minute:
|
|
261
|
+
minute: u,
|
|
266
262
|
second: o
|
|
267
|
-
}) }, "minute")), e.has("second") &&
|
|
263
|
+
}) }, "minute")), e.has("second") && m.push(/* @__PURE__ */ n(U, { label: "Second", value: o, count: 60, disabled: s, onValueChange: (u) => l.setTime({
|
|
268
264
|
hour: i,
|
|
269
265
|
minute: c,
|
|
270
|
-
second:
|
|
271
|
-
}) }, "second")), /* @__PURE__ */ n("div", { className: "date-input__time", children:
|
|
266
|
+
second: u
|
|
267
|
+
}) }, "second")), /* @__PURE__ */ n("div", { className: "date-input__time", children: m.map(Re) });
|
|
272
268
|
} });
|
|
273
269
|
}
|
|
274
270
|
function Oe(t, e) {
|
|
@@ -1,27 +1,43 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { ValidationProps } from './useForm';
|
|
3
3
|
import { InputWrapperProps } from './InputWrapper';
|
|
4
|
-
import {
|
|
4
|
+
import { Component } from '../../utils';
|
|
5
|
+
import { MenuContentProps, MenuItemProps } from '../menu/Menu';
|
|
5
6
|
export interface EditorTokenRule {
|
|
6
7
|
pattern: RegExp;
|
|
7
|
-
/**
|
|
8
|
-
* Wrap a matched token. `children` is Slate's leaf content — include it
|
|
9
|
-
* somewhere so cursor positioning stays accurate.
|
|
10
|
-
*/
|
|
11
8
|
wrap?: (matchedText: string, children: React.ReactNode, match: RegExpExecArray) => React.ReactNode;
|
|
12
9
|
style?: React.CSSProperties;
|
|
13
10
|
className?: string;
|
|
11
|
+
void?: boolean;
|
|
14
12
|
}
|
|
15
|
-
export interface EditorInputProps extends Omit<InputWrapperProps, "onChange">, ValidationProps<any> {
|
|
13
|
+
export interface EditorInputProps extends Omit<InputWrapperProps, "onChange" | "onSelect">, ValidationProps<any> {
|
|
14
|
+
wrapperComponent?: Component<HTMLDivElement>;
|
|
16
15
|
tokenRules?: EditorTokenRule[];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
onSuggestionSelect?: (suggestion: InputSuggestion) => void;
|
|
16
|
+
onSelect?: (value: any, data: any) => void;
|
|
17
|
+
search?: string;
|
|
20
18
|
disabled?: boolean;
|
|
21
19
|
readonly?: boolean;
|
|
22
|
-
/** Render as a single-line input: Enter is blocked, newlines in pasted or external values become spaces. */
|
|
23
20
|
singleLine?: boolean;
|
|
24
21
|
onChange?: (value: string) => void;
|
|
25
22
|
placeholder?: string;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export type EditorInputValueProps = Component<HTMLDivElement>;
|
|
26
|
+
export type EditorInputTriggerProps = Component<HTMLButtonElement>;
|
|
27
|
+
export type EditorInputMenuProps = MenuContentProps;
|
|
28
|
+
export type EditorInputMenuItemProps = MenuItemProps & {
|
|
29
|
+
value: any;
|
|
30
|
+
data?: any;
|
|
31
|
+
onlyOnce?: boolean;
|
|
32
|
+
aliases?: string[];
|
|
33
|
+
};
|
|
34
|
+
export interface EditorInputSubMenuProps {
|
|
35
|
+
label: React.ReactNode;
|
|
36
|
+
children: React.ReactNode;
|
|
26
37
|
}
|
|
27
38
|
export declare const EditorInput: React.FC<EditorInputProps>;
|
|
39
|
+
export declare const EditorInputValue: React.FC<EditorInputValueProps>;
|
|
40
|
+
export declare const EditorInputTrigger: React.FC<EditorInputTriggerProps>;
|
|
41
|
+
export declare const EditorInputMenu: React.FC<EditorInputMenuProps>;
|
|
42
|
+
export declare const EditorInputMenuItem: React.FC<EditorInputMenuItemProps>;
|
|
43
|
+
export declare const EditorInputSubMenu: React.FC<EditorInputSubMenuProps>;
|