@code0-tech/pictor 0.14.0 → 0.16.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/LICENSE +19 -0
- package/dist/assets/components/avatar/Avatar.style.css +1 -1
- package/dist/assets/components/chart/Chart.style.css +1 -0
- package/dist/assets/components/form/ColorInput.style.css +1 -0
- package/dist/assets/components/form/DateInput.style.css +1 -0
- 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 +46 -37
- package/dist/components/form/ColorInput.d.ts +33 -0
- package/dist/components/form/ColorInput.js +355 -0
- package/dist/components/form/DateInput.d.ts +37 -0
- package/dist/components/form/DateInput.js +285 -0
- package/dist/components/form/Input.js +229 -221
- package/dist/components/form/InputLabel.d.ts +2 -1
- package/dist/components/form/InputLabel.js +20 -9
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +76 -61
- package/dist/components/toast/Toast.js +61 -61
- package/dist/index.d.ts +1 -0
- package/dist/index.js +242 -221
- package/package.json +32 -24
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { jsx as c, jsxs as C, Fragment as ae } from "react/jsx-runtime";
|
|
2
|
+
import { c as v } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { ColorPicker as g, parseColor as w } from "@ark-ui/react";
|
|
4
|
+
import "../../utils/contextStore.js";
|
|
5
|
+
import b from "react";
|
|
6
|
+
import { mergeComponentProps as x } from "../../utils/component.js";
|
|
7
|
+
import "js-md5";
|
|
8
|
+
import { InputWrapper as se } from "./InputWrapper.js";
|
|
9
|
+
import { Flex as ce } from "../flex/Flex.js";
|
|
10
|
+
import { Badge as ee } from "../badge/Badge.js";
|
|
11
|
+
import { Button as te } from "../button/Button.js";
|
|
12
|
+
import { MenuTrigger as ie, Menu as ue, MenuPortal as he, MenuContent as me } from "../menu/Menu.js";
|
|
13
|
+
import { SegmentedControlItem as q, SegmentedControl as de } from "../segmented-control/SegmentedControl.js";
|
|
14
|
+
import { useCopyToClipboard as fe } from "@uidotdev/usehooks";
|
|
15
|
+
import { useHotkeys as le } from "react-hotkeys-hook";
|
|
16
|
+
import '../../assets/components/form/ColorInput.style.css';/* empty css */
|
|
17
|
+
const L = b.createContext({
|
|
18
|
+
hasValue: !1,
|
|
19
|
+
placeholder: null
|
|
20
|
+
}), pe = /^(#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|(rgba?|hsla?|hsba?)\(\s*-?[\d.]+%?(\s*,\s*-?[\d.]+%?){2,3}\s*\))$/i, J = (o) => {
|
|
21
|
+
const e = o.trim();
|
|
22
|
+
return pe.test(e) ? w(e) : void 0;
|
|
23
|
+
}, ne = (o) => {
|
|
24
|
+
if (typeof o == "string") return J(o);
|
|
25
|
+
if (o != null)
|
|
26
|
+
return o;
|
|
27
|
+
}, _e = (o) => {
|
|
28
|
+
const e = o.trim().replace(/°/g, "").replace(/deg\b/gi, "");
|
|
29
|
+
if (!e) return null;
|
|
30
|
+
const t = J(e);
|
|
31
|
+
if (t) {
|
|
32
|
+
const a = e.toLowerCase(), s = a.startsWith("#") ? "hexa" : a.startsWith("hsl") ? "hsla" : "rgba";
|
|
33
|
+
return {
|
|
34
|
+
color: t,
|
|
35
|
+
notation: s
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (/^[0-9a-f]+$/i.test(e) && (e.length === 6 || e.length === 8 || (e.length === 3 || e.length === 4) && /[a-f]/i.test(e))) return {
|
|
39
|
+
color: w(`#${e}`),
|
|
40
|
+
notation: "hexa"
|
|
41
|
+
};
|
|
42
|
+
const l = e.split(/[\s,]+/).filter(Boolean), r = l.map((a) => Number(a.replace("%", "")));
|
|
43
|
+
if ((l.length === 3 || l.length === 4) && r.every((a) => !Number.isNaN(a))) {
|
|
44
|
+
const a = l.length === 4 ? r[3] : 1;
|
|
45
|
+
return l[1].includes("%") || l[2].includes("%") ? {
|
|
46
|
+
color: w(`hsla(${r[0]}, ${r[1]}%, ${r[2]}%, ${a})`),
|
|
47
|
+
notation: "hsla"
|
|
48
|
+
} : {
|
|
49
|
+
color: w(`rgba(${r[0]}, ${r[1]}, ${r[2]}, ${a})`),
|
|
50
|
+
notation: "rgba"
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}, Be = (o) => {
|
|
55
|
+
const e = v.c(42), {
|
|
56
|
+
title: t,
|
|
57
|
+
description: n,
|
|
58
|
+
left: l,
|
|
59
|
+
leftType: r,
|
|
60
|
+
rightType: a,
|
|
61
|
+
right: s,
|
|
62
|
+
formValidation: i,
|
|
63
|
+
initialValue: h,
|
|
64
|
+
defaultValue: m,
|
|
65
|
+
value: u,
|
|
66
|
+
placeholder: f,
|
|
67
|
+
name: d,
|
|
68
|
+
disabled: p,
|
|
69
|
+
readOnly: _,
|
|
70
|
+
closeOnSelect: k,
|
|
71
|
+
onValueChange: G,
|
|
72
|
+
children: K
|
|
73
|
+
} = o, W = f === void 0 ? "Pick a color" : f, j = u ?? h ?? m;
|
|
74
|
+
let H;
|
|
75
|
+
e[0] !== j ? (H = ne(j), e[0] = j, e[1] = H) : H = e[1];
|
|
76
|
+
const S = H;
|
|
77
|
+
let A;
|
|
78
|
+
e[2] !== S ? (A = () => S ?? w("hsla(0, 0%, 0%, 1)"), e[2] = S, e[3] = A) : A = e[3];
|
|
79
|
+
const [z, Q] = b.useState(A);
|
|
80
|
+
let E;
|
|
81
|
+
e[4] !== S ? (E = () => S !== void 0, e[4] = S, e[5] = E) : E = e[5];
|
|
82
|
+
const [D, Y] = b.useState(E), [y, Z] = b.useState(!1);
|
|
83
|
+
let O, P;
|
|
84
|
+
e[6] !== u ? (O = () => {
|
|
85
|
+
if (u === void 0)
|
|
86
|
+
return;
|
|
87
|
+
const N = ne(u);
|
|
88
|
+
Y(N !== void 0), N && Q(N);
|
|
89
|
+
}, P = [u], e[6] = u, e[7] = O, e[8] = P) : (O = e[7], P = e[8]), b.useEffect(O, P);
|
|
90
|
+
let R;
|
|
91
|
+
e[9] !== i || e[10] !== G ? (R = (N) => {
|
|
92
|
+
Q(N.value), Y(!0), i?.setValue?.(N.value.toString("hsla")), G?.(N);
|
|
93
|
+
}, e[9] = i, e[10] = G, e[11] = R) : R = e[11];
|
|
94
|
+
const X = R;
|
|
95
|
+
let B;
|
|
96
|
+
e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (B = (N) => Z(N.open), e[12] = B) : B = e[12];
|
|
97
|
+
let M;
|
|
98
|
+
e[13] !== k || e[14] !== z || e[15] !== p || e[16] !== X || e[17] !== d || e[18] !== y || e[19] !== _ ? (M = x("color-input", {
|
|
99
|
+
value: z,
|
|
100
|
+
onValueChange: X,
|
|
101
|
+
open: y,
|
|
102
|
+
onOpenChange: B,
|
|
103
|
+
name: d,
|
|
104
|
+
disabled: p,
|
|
105
|
+
readOnly: _,
|
|
106
|
+
closeOnSelect: k
|
|
107
|
+
}), e[13] = k, e[14] = z, e[15] = p, e[16] = X, e[17] = d, e[18] = y, e[19] = _, e[20] = M) : M = e[20];
|
|
108
|
+
const U = M;
|
|
109
|
+
let T;
|
|
110
|
+
e[21] !== D || e[22] !== W ? (T = {
|
|
111
|
+
hasValue: D,
|
|
112
|
+
placeholder: W
|
|
113
|
+
}, e[21] = D, e[22] = W, e[23] = T) : T = e[23];
|
|
114
|
+
let V;
|
|
115
|
+
e[24] !== K || e[25] !== n || e[26] !== i || e[27] !== l || e[28] !== r || e[29] !== s || e[30] !== a || e[31] !== t ? (V = /* @__PURE__ */ c(se, { title: t, description: n, left: l, leftType: r, right: s, rightType: a, formValidation: i, children: K }), e[24] = K, e[25] = n, e[26] = i, e[27] = l, e[28] = r, e[29] = s, e[30] = a, e[31] = t, e[32] = V) : V = e[32];
|
|
116
|
+
let $;
|
|
117
|
+
e[33] !== y || e[34] !== V ? ($ = /* @__PURE__ */ c(ue, { open: y, onOpenChange: Z, children: V }), e[33] = y, e[34] = V, e[35] = $) : $ = e[35];
|
|
118
|
+
let I;
|
|
119
|
+
e[36] !== T || e[37] !== $ ? (I = /* @__PURE__ */ c(L.Provider, { value: T, children: $ }), e[36] = T, e[37] = $, e[38] = I) : I = e[38];
|
|
120
|
+
let F;
|
|
121
|
+
return e[39] !== U || e[40] !== I ? (F = /* @__PURE__ */ c(g.Root, { ...U, children: I }), e[39] = U, e[40] = I, e[41] = F) : F = e[41], F;
|
|
122
|
+
}, Me = (o) => {
|
|
123
|
+
const e = v.c(9);
|
|
124
|
+
let t, n, l;
|
|
125
|
+
if (e[0] !== o) {
|
|
126
|
+
const {
|
|
127
|
+
children: i,
|
|
128
|
+
...h
|
|
129
|
+
} = o;
|
|
130
|
+
n = i, t = g.Control, l = x("color-input__control", h), e[0] = o, e[1] = t, e[2] = n, e[3] = l;
|
|
131
|
+
} else
|
|
132
|
+
t = e[1], n = e[2], l = e[3];
|
|
133
|
+
const r = l;
|
|
134
|
+
let a;
|
|
135
|
+
e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ c(g.HiddenInput, {}), e[4] = a) : a = e[4];
|
|
136
|
+
let s;
|
|
137
|
+
return e[5] !== t || e[6] !== n || e[7] !== r ? (s = /* @__PURE__ */ C(t, { ...r, children: [
|
|
138
|
+
n,
|
|
139
|
+
a
|
|
140
|
+
] }), e[5] = t, e[6] = n, e[7] = r, e[8] = s) : s = e[8], s;
|
|
141
|
+
}, Fe = (o) => {
|
|
142
|
+
const e = v.c(3), {
|
|
143
|
+
hasValue: t
|
|
144
|
+
} = b.useContext(L);
|
|
145
|
+
let n;
|
|
146
|
+
return e[0] !== t || e[1] !== o ? (n = /* @__PURE__ */ c("div", { className: "color-input__swatch-wrapper", children: t ? /* @__PURE__ */ C(ae, { children: [
|
|
147
|
+
/* @__PURE__ */ c(g.TransparencyGrid, { className: "color-input__transparency-grid" }),
|
|
148
|
+
/* @__PURE__ */ c(g.ValueSwatch, { ...x("color-input__swatch", o) })
|
|
149
|
+
] }) : /* @__PURE__ */ c("div", { className: "color-input__swatch color-input__swatch--empty" }) }), e[0] = t, e[1] = o, e[2] = n) : n = e[2], n;
|
|
150
|
+
}, Le = (o) => {
|
|
151
|
+
const e = v.c(7), {
|
|
152
|
+
hasValue: t,
|
|
153
|
+
placeholder: n
|
|
154
|
+
} = b.useContext(L);
|
|
155
|
+
if (!t) {
|
|
156
|
+
let r;
|
|
157
|
+
e[0] !== o ? (r = x("color-input__value-text color-input__value-text--placeholder", o), e[0] = o, e[1] = r) : r = e[1];
|
|
158
|
+
let a;
|
|
159
|
+
return e[2] !== n || e[3] !== r ? (a = /* @__PURE__ */ c("span", { ...r, children: n }), e[2] = n, e[3] = r, e[4] = a) : a = e[4], a;
|
|
160
|
+
}
|
|
161
|
+
let l;
|
|
162
|
+
return e[5] !== o ? (l = /* @__PURE__ */ c(g.Context, { children: (r) => /* @__PURE__ */ c("span", { ...x("color-input__value-text", o), children: r.value.toString("hsla") }) }), e[5] = o, e[6] = l) : l = e[6], l;
|
|
163
|
+
}, Ge = (o) => {
|
|
164
|
+
const e = v.c(4);
|
|
165
|
+
let t;
|
|
166
|
+
e[0] !== o ? (t = x("color-input__trigger", o), e[0] = o, e[1] = t) : t = e[1];
|
|
167
|
+
const n = t;
|
|
168
|
+
let l;
|
|
169
|
+
return e[2] !== n ? (l = /* @__PURE__ */ c(ie, { ...n }), e[2] = n, e[3] = l) : l = e[3], l;
|
|
170
|
+
}, Ke = (o) => {
|
|
171
|
+
const e = v.c(21);
|
|
172
|
+
let t, n, l, r, a, s;
|
|
173
|
+
if (e[0] !== o) {
|
|
174
|
+
const {
|
|
175
|
+
defaultNotation: _,
|
|
176
|
+
...k
|
|
177
|
+
} = o;
|
|
178
|
+
l = _, n = he, t = me, a = "end", s = 8, r = x("color-input__content", k), e[0] = o, e[1] = t, e[2] = n, e[3] = l, e[4] = r, e[5] = a, e[6] = s;
|
|
179
|
+
} else
|
|
180
|
+
t = e[1], n = e[2], l = e[3], r = e[4], a = e[5], s = e[6];
|
|
181
|
+
const i = r;
|
|
182
|
+
let h;
|
|
183
|
+
e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ C(g.Area, { className: "color-input__area", children: [
|
|
184
|
+
/* @__PURE__ */ c(g.AreaBackground, { className: "color-input__area-background" }),
|
|
185
|
+
/* @__PURE__ */ c(g.AreaThumb, { className: "color-input__area-thumb" })
|
|
186
|
+
] }), e[7] = h) : h = e[7];
|
|
187
|
+
let m;
|
|
188
|
+
e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ C(g.ChannelSlider, { channel: "hue", className: "color-input__channel-slider", children: [
|
|
189
|
+
/* @__PURE__ */ c(g.ChannelSliderTrack, { className: "color-input__channel-slider-track" }),
|
|
190
|
+
/* @__PURE__ */ c(g.ChannelSliderThumb, { className: "color-input__channel-slider-thumb" })
|
|
191
|
+
] }), e[8] = m) : m = e[8];
|
|
192
|
+
let u;
|
|
193
|
+
e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ C("div", { className: "color-input__sliders", children: [
|
|
194
|
+
m,
|
|
195
|
+
/* @__PURE__ */ C(g.ChannelSlider, { channel: "alpha", className: "color-input__channel-slider", children: [
|
|
196
|
+
/* @__PURE__ */ c(g.TransparencyGrid, { className: "color-input__channel-slider-grid" }),
|
|
197
|
+
/* @__PURE__ */ c(g.ChannelSliderTrack, { className: "color-input__channel-slider-track" }),
|
|
198
|
+
/* @__PURE__ */ c(g.ChannelSliderThumb, { className: "color-input__channel-slider-thumb" })
|
|
199
|
+
] })
|
|
200
|
+
] }), e[9] = u) : u = e[9];
|
|
201
|
+
let f;
|
|
202
|
+
e[10] !== l ? (f = /* @__PURE__ */ C("div", { className: "color-input__body", children: [
|
|
203
|
+
h,
|
|
204
|
+
u,
|
|
205
|
+
/* @__PURE__ */ c(g.Context, { children: (_) => /* @__PURE__ */ c(ge, { api: _, defaultNotation: l ?? "hsla" }) })
|
|
206
|
+
] }), e[10] = l, e[11] = f) : f = e[11];
|
|
207
|
+
let d;
|
|
208
|
+
e[12] !== t || e[13] !== a || e[14] !== s || e[15] !== i || e[16] !== f ? (d = /* @__PURE__ */ c(t, { align: a, sideOffset: s, ...i, children: f }), e[12] = t, e[13] = a, e[14] = s, e[15] = i, e[16] = f, e[17] = d) : d = e[17];
|
|
209
|
+
let p;
|
|
210
|
+
return e[18] !== n || e[19] !== d ? (p = /* @__PURE__ */ c(n, { children: d }), e[18] = n, e[19] = d, e[20] = p) : p = e[20], p;
|
|
211
|
+
}, ge = (o) => {
|
|
212
|
+
const e = v.c(14), {
|
|
213
|
+
api: t,
|
|
214
|
+
defaultNotation: n
|
|
215
|
+
} = o, [l, r] = b.useState(n);
|
|
216
|
+
let a;
|
|
217
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = (_) => {
|
|
218
|
+
(_ === "rgba" || _ === "hsla" || _ === "hexa") && r(_);
|
|
219
|
+
}, e[0] = a) : a = e[0];
|
|
220
|
+
const s = a;
|
|
221
|
+
let i, h, m;
|
|
222
|
+
e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ c(q, { value: "rgba", children: "RGBA" }), h = /* @__PURE__ */ c(q, { value: "hsla", children: "HSLA" }), m = /* @__PURE__ */ c(q, { value: "hexa", children: "HEXA" }), e[1] = i, e[2] = h, e[3] = m) : (i = e[1], h = e[2], m = e[3]);
|
|
223
|
+
let u;
|
|
224
|
+
e[4] !== l ? (u = /* @__PURE__ */ C(de, { type: "single", value: l, onValueChange: s, className: "segmented-control color-input__notation", children: [
|
|
225
|
+
i,
|
|
226
|
+
h,
|
|
227
|
+
m
|
|
228
|
+
] }), e[4] = l, e[5] = u) : u = e[5];
|
|
229
|
+
let f, d;
|
|
230
|
+
e[6] !== t || e[7] !== l ? (f = l === "hexa" ? /* @__PURE__ */ C("label", { className: "color-input__channel color-input__channel--hex", children: [
|
|
231
|
+
/* @__PURE__ */ c("span", { className: "color-input__channel-label", children: "HEXA" }),
|
|
232
|
+
/* @__PURE__ */ c(be, { api: t })
|
|
233
|
+
] }) : /* @__PURE__ */ C("div", { className: "color-input__channel-row", children: [
|
|
234
|
+
(l === "rgba" ? ["red", "green", "blue"] : ["hue", "saturation", "lightness"]).map((_) => /* @__PURE__ */ c(oe, { api: t, format: l, channel: _ }, _)),
|
|
235
|
+
/* @__PURE__ */ c(oe, { api: t, format: l, channel: "alpha" })
|
|
236
|
+
] }), d = /* @__PURE__ */ c(Ce, { api: t, notation: l, setNotation: r }), e[6] = t, e[7] = l, e[8] = f, e[9] = d) : (f = e[8], d = e[9]);
|
|
237
|
+
let p;
|
|
238
|
+
return e[10] !== u || e[11] !== f || e[12] !== d ? (p = /* @__PURE__ */ C("div", { className: "color-input__channels", onKeyDown: ve, children: [
|
|
239
|
+
u,
|
|
240
|
+
f,
|
|
241
|
+
d
|
|
242
|
+
] }), e[10] = u, e[11] = f, e[12] = d, e[13] = p) : p = e[13], p;
|
|
243
|
+
}, Ce = ({
|
|
244
|
+
api: o,
|
|
245
|
+
notation: e,
|
|
246
|
+
setNotation: t
|
|
247
|
+
}) => {
|
|
248
|
+
const {
|
|
249
|
+
hasValue: n
|
|
250
|
+
} = b.useContext(L), [, l] = fe(), r = b.useRef(o);
|
|
251
|
+
r.current = o;
|
|
252
|
+
const a = () => {
|
|
253
|
+
n && l(e === "hexa" ? o.value.toString("hexa") : o.value.toString(e));
|
|
254
|
+
}, s = () => {
|
|
255
|
+
navigator.clipboard.readText().then((h) => {
|
|
256
|
+
const m = _e(h);
|
|
257
|
+
m && (r.current.setValue(m.color), t(m.notation), document.activeElement instanceof HTMLElement && document.activeElement.blur());
|
|
258
|
+
}, () => {
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
le("mod+c", a, {
|
|
262
|
+
enabled: n,
|
|
263
|
+
enableOnFormTags: !0
|
|
264
|
+
}, [n, e, o]), le("mod+v", s, {
|
|
265
|
+
enableOnFormTags: !0
|
|
266
|
+
});
|
|
267
|
+
const i = /mac|iphone|ipad|ipod/i.test(navigator.userAgent) ? "⌘" : "Ctrl";
|
|
268
|
+
return /* @__PURE__ */ C(ce, { className: "color-input__actions", align: "center", children: [
|
|
269
|
+
/* @__PURE__ */ C(te, { paddingSize: "xxs", onClick: s, children: [
|
|
270
|
+
"Paste",
|
|
271
|
+
/* @__PURE__ */ C(ee, { children: [
|
|
272
|
+
i,
|
|
273
|
+
"V"
|
|
274
|
+
] })
|
|
275
|
+
] }),
|
|
276
|
+
/* @__PURE__ */ C(te, { paddingSize: "xxs", onClick: a, disabled: !n, children: [
|
|
277
|
+
"Copy",
|
|
278
|
+
/* @__PURE__ */ C(ee, { children: [
|
|
279
|
+
i,
|
|
280
|
+
"C"
|
|
281
|
+
] })
|
|
282
|
+
] })
|
|
283
|
+
] });
|
|
284
|
+
}, oe = (o) => {
|
|
285
|
+
const e = v.c(18), {
|
|
286
|
+
channel: t,
|
|
287
|
+
format: n,
|
|
288
|
+
api: l
|
|
289
|
+
} = o;
|
|
290
|
+
let r;
|
|
291
|
+
e[0] !== t[0] ? (r = t[0].toUpperCase(), e[0] = t[0], e[1] = r) : r = e[1];
|
|
292
|
+
let a;
|
|
293
|
+
e[2] !== r ? (a = /* @__PURE__ */ c("span", { className: "color-input__channel-label", children: r }), e[2] = r, e[3] = a) : a = e[3];
|
|
294
|
+
let s;
|
|
295
|
+
e[4] !== l || e[5] !== t ? (s = l.getChannelValue(t), e[4] = l, e[5] = t, e[6] = s) : s = e[6];
|
|
296
|
+
const i = t === "alpha" ? "decimal" : "numeric";
|
|
297
|
+
let h;
|
|
298
|
+
e[7] !== l || e[8] !== t || e[9] !== n ? (h = (f) => {
|
|
299
|
+
const d = Number(f);
|
|
300
|
+
f.trim() === "" || Number.isNaN(d) || l.setValue(l.value.toFormat(n).withChannelValue(t, d));
|
|
301
|
+
}, e[7] = l, e[8] = t, e[9] = n, e[10] = h) : h = e[10];
|
|
302
|
+
let m;
|
|
303
|
+
e[11] !== s || e[12] !== i || e[13] !== h ? (m = /* @__PURE__ */ c(re, { committed: s, inputMode: i, commit: h }), e[11] = s, e[12] = i, e[13] = h, e[14] = m) : m = e[14];
|
|
304
|
+
let u;
|
|
305
|
+
return e[15] !== a || e[16] !== m ? (u = /* @__PURE__ */ C("label", { className: "color-input__channel", children: [
|
|
306
|
+
a,
|
|
307
|
+
m
|
|
308
|
+
] }), e[15] = a, e[16] = m, e[17] = u) : u = e[17], u;
|
|
309
|
+
}, be = (o) => {
|
|
310
|
+
const e = v.c(7), {
|
|
311
|
+
api: t
|
|
312
|
+
} = o;
|
|
313
|
+
let n;
|
|
314
|
+
e[0] !== t.value ? (n = t.value.toString("hexa"), e[0] = t.value, e[1] = n) : n = e[1];
|
|
315
|
+
let l;
|
|
316
|
+
e[2] !== t ? (l = (a) => {
|
|
317
|
+
const s = J(a);
|
|
318
|
+
s && t.setValue(s);
|
|
319
|
+
}, e[2] = t, e[3] = l) : l = e[3];
|
|
320
|
+
let r;
|
|
321
|
+
return e[4] !== n || e[5] !== l ? (r = /* @__PURE__ */ c(re, { committed: n, commit: l }), e[4] = n, e[5] = l, e[6] = r) : r = e[6], r;
|
|
322
|
+
}, re = (o) => {
|
|
323
|
+
const e = v.c(13), {
|
|
324
|
+
committed: t,
|
|
325
|
+
commit: n,
|
|
326
|
+
inputMode: l
|
|
327
|
+
} = o, r = l === void 0 ? "text" : l, [a, s] = b.useState(t), i = b.useRef(!1);
|
|
328
|
+
let h, m;
|
|
329
|
+
e[0] !== t ? (h = () => {
|
|
330
|
+
i.current || s(t);
|
|
331
|
+
}, m = [t], e[0] = t, e[1] = h, e[2] = m) : (h = e[1], m = e[2]), b.useEffect(h, m);
|
|
332
|
+
let u;
|
|
333
|
+
e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = () => i.current = !0, e[3] = u) : u = e[3];
|
|
334
|
+
let f;
|
|
335
|
+
e[4] !== n ? (f = (_) => {
|
|
336
|
+
s(_.target.value), n(_.target.value);
|
|
337
|
+
}, e[4] = n, e[5] = f) : f = e[5];
|
|
338
|
+
let d;
|
|
339
|
+
e[6] !== t ? (d = () => {
|
|
340
|
+
i.current = !1, s(t);
|
|
341
|
+
}, e[6] = t, e[7] = d) : d = e[7];
|
|
342
|
+
let p;
|
|
343
|
+
return e[8] !== a || e[9] !== r || e[10] !== f || e[11] !== d ? (p = /* @__PURE__ */ c("input", { className: "color-input__channel-input", type: "text", inputMode: r, value: a, spellCheck: !1, autoComplete: "off", onFocus: u, onChange: f, onBlur: d }), e[8] = a, e[9] = r, e[10] = f, e[11] = d, e[12] = p) : p = e[12], p;
|
|
344
|
+
};
|
|
345
|
+
function ve(o) {
|
|
346
|
+
o.key !== "Escape" && !o.metaKey && !o.ctrlKey && o.stopPropagation();
|
|
347
|
+
}
|
|
348
|
+
export {
|
|
349
|
+
Be as ColorInput,
|
|
350
|
+
Ke as ColorInputContent,
|
|
351
|
+
Me as ColorInputControl,
|
|
352
|
+
Fe as ColorInputSwatch,
|
|
353
|
+
Ge as ColorInputTrigger,
|
|
354
|
+
Le as ColorInputValueText
|
|
355
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DateInput as ArkDateInput, DatePicker, DateValue } from '@ark-ui/react';
|
|
2
|
+
import { ComponentProps } from '../../utils';
|
|
3
|
+
import { default as React } from 'react';
|
|
4
|
+
import { InputWrapperProps } from './InputWrapper';
|
|
5
|
+
import { MenuContentProps, MenuTriggerProps } from '../menu/Menu';
|
|
6
|
+
type DateGranularity = "day" | "hour" | "minute" | "second";
|
|
7
|
+
interface ValueChangeDetails {
|
|
8
|
+
value: DateValue[];
|
|
9
|
+
valueAsString: string[];
|
|
10
|
+
}
|
|
11
|
+
export type DateProps = InputWrapperProps & {
|
|
12
|
+
granularity?: DateGranularity;
|
|
13
|
+
closeOnSelect?: boolean;
|
|
14
|
+
name?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
locale?: string;
|
|
18
|
+
placeholderValue?: DateValue;
|
|
19
|
+
onValueChange?: (details: ValueChangeDetails) => void;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
export type DateInputControlProps = ComponentProps & ArkDateInput.ControlProps;
|
|
23
|
+
export type DateInputFieldProps = ComponentProps & ArkDateInput.SegmentGroupProps;
|
|
24
|
+
export type DateInputTriggerProps = ComponentProps & MenuTriggerProps;
|
|
25
|
+
export type DateInputContentProps = ComponentProps & MenuContentProps & {
|
|
26
|
+
withTime?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type DateInputPrevTriggerProps = ComponentProps & DatePicker.PrevTriggerProps;
|
|
29
|
+
export type DateInputNextTriggerProps = ComponentProps & DatePicker.NextTriggerProps;
|
|
30
|
+
export declare const DateInput: React.FC<DateProps>;
|
|
31
|
+
export declare const DateInputControl: React.FC<DateInputControlProps>;
|
|
32
|
+
export declare const DateInputField: React.FC<DateInputFieldProps>;
|
|
33
|
+
export declare const DateInputTrigger: React.FC<DateInputTriggerProps>;
|
|
34
|
+
export declare const DateInputPrevTrigger: React.FC<DateInputPrevTriggerProps>;
|
|
35
|
+
export declare const DateInputNextTrigger: React.FC<DateInputNextTriggerProps>;
|
|
36
|
+
export declare const DateInputContent: React.FC<DateInputContentProps>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { jsx as n, jsxs as b, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { c as T } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { DatePicker as a, DateInput as C } from "@ark-ui/react";
|
|
4
|
+
import { toZoned as J, getLocalTimeZone as q, fromDate as K } from "@internationalized/date";
|
|
5
|
+
import { IconChevronDown as Q } from "@tabler/icons-react";
|
|
6
|
+
import "../../utils/contextStore.js";
|
|
7
|
+
import F from "react";
|
|
8
|
+
import { mergeComponentProps as S } from "../../utils/component.js";
|
|
9
|
+
import "js-md5";
|
|
10
|
+
import { InputWrapper as X } from "./InputWrapper.js";
|
|
11
|
+
import { Flex as ee } from "../flex/Flex.js";
|
|
12
|
+
import { MenuTrigger as te, Menu as ne, MenuPortal as le, MenuContent as re } from "../menu/Menu.js";
|
|
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
|
+
import '../../assets/components/form/DateInput.style.css';/* empty css */
|
|
15
|
+
import { Button as fe } from "../button/Button.js";
|
|
16
|
+
const he = (t) => K(new Date(t * 1e3), q()), _e = (t) => Math.floor(J(t, q()).toDate().getTime() / 1e3), Y = (t) => {
|
|
17
|
+
const e = Array.isArray(t) ? t : [t], l = [];
|
|
18
|
+
for (const r of e)
|
|
19
|
+
r == null || r === "" || (typeof r == "number" ? Number.isNaN(r) || l.push(he(r)) : l.push(r));
|
|
20
|
+
return l;
|
|
21
|
+
}, qe = (t) => {
|
|
22
|
+
const e = T.c(43), {
|
|
23
|
+
title: l,
|
|
24
|
+
description: r,
|
|
25
|
+
left: i,
|
|
26
|
+
leftType: c,
|
|
27
|
+
rightType: o,
|
|
28
|
+
right: s,
|
|
29
|
+
formValidation: u,
|
|
30
|
+
initialValue: m,
|
|
31
|
+
defaultValue: h,
|
|
32
|
+
value: d,
|
|
33
|
+
granularity: f,
|
|
34
|
+
closeOnSelect: _,
|
|
35
|
+
name: p,
|
|
36
|
+
disabled: g,
|
|
37
|
+
readOnly: k,
|
|
38
|
+
locale: v,
|
|
39
|
+
placeholderValue: A,
|
|
40
|
+
onValueChange: G,
|
|
41
|
+
children: z
|
|
42
|
+
} = t;
|
|
43
|
+
let $;
|
|
44
|
+
e[0] !== h || e[1] !== m || e[2] !== d ? ($ = () => Y(d ?? m ?? h), e[0] = h, e[1] = m, e[2] = d, e[3] = $) : $ = e[3];
|
|
45
|
+
const [w, L] = F.useState($);
|
|
46
|
+
let R, M;
|
|
47
|
+
e[4] !== d ? (R = () => {
|
|
48
|
+
d !== void 0 && L(Y(d));
|
|
49
|
+
}, M = [d], e[4] = d, e[5] = R, e[6] = M) : (R = e[5], M = e[6]), F.useEffect(R, M);
|
|
50
|
+
const [y, W] = F.useState(!1);
|
|
51
|
+
let O;
|
|
52
|
+
e[7] !== u || e[8] !== G ? (O = (I) => {
|
|
53
|
+
L(I.value), u?.setValue?.(I.value[0] ? _e(I.value[0]) : null), G?.(I);
|
|
54
|
+
}, e[7] = u, e[8] = G, e[9] = O) : O = e[9];
|
|
55
|
+
const N = O;
|
|
56
|
+
let P;
|
|
57
|
+
e[10] !== w || e[11] !== g || e[12] !== f || e[13] !== N || e[14] !== v || e[15] !== p || e[16] !== A || e[17] !== k ? (P = S("date-input", {
|
|
58
|
+
value: w,
|
|
59
|
+
onValueChange: N,
|
|
60
|
+
granularity: f,
|
|
61
|
+
name: p,
|
|
62
|
+
disabled: g,
|
|
63
|
+
readOnly: k,
|
|
64
|
+
locale: v,
|
|
65
|
+
placeholderValue: A
|
|
66
|
+
}), e[10] = w, e[11] = g, e[12] = f, e[13] = N, e[14] = v, e[15] = p, e[16] = A, e[17] = k, e[18] = P) : P = e[18];
|
|
67
|
+
const E = P;
|
|
68
|
+
let j;
|
|
69
|
+
e[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (j = (I) => W(I.open), e[19] = j) : j = e[19];
|
|
70
|
+
let V;
|
|
71
|
+
e[20] !== z || e[21] !== r || e[22] !== u || e[23] !== i || e[24] !== c || e[25] !== s || e[26] !== o || e[27] !== l ? (V = /* @__PURE__ */ n(X, { title: l, description: r, left: i, leftType: c, right: s, rightType: o, formValidation: u, children: z }), e[20] = z, e[21] = r, e[22] = u, e[23] = i, e[24] = c, e[25] = s, e[26] = o, e[27] = l, e[28] = V) : V = e[28];
|
|
72
|
+
let x;
|
|
73
|
+
e[29] !== y || e[30] !== V ? (x = /* @__PURE__ */ n(ne, { open: y, onOpenChange: W, children: V }), e[29] = y, e[30] = V, e[31] = x) : x = e[31];
|
|
74
|
+
let D;
|
|
75
|
+
e[32] !== _ || e[33] !== w || e[34] !== g || e[35] !== N || e[36] !== v || e[37] !== y || e[38] !== x ? (D = /* @__PURE__ */ n(a.Root, { value: w, onValueChange: N, open: y, onOpenChange: j, closeOnSelect: _, disabled: g, locale: v, children: x }), e[32] = _, e[33] = w, e[34] = g, e[35] = N, e[36] = v, e[37] = y, e[38] = x, e[39] = D) : D = e[39];
|
|
76
|
+
let B;
|
|
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
|
+
}, Je = (t) => {
|
|
79
|
+
const e = T.c(4);
|
|
80
|
+
let l;
|
|
81
|
+
e[0] !== t ? (l = S("date-input__control", t), e[0] = t, e[1] = l) : l = e[1];
|
|
82
|
+
const r = l;
|
|
83
|
+
let i;
|
|
84
|
+
return e[2] !== r ? (i = /* @__PURE__ */ n(C.Control, { ...r }), e[2] = r, e[3] = i) : i = e[3], i;
|
|
85
|
+
}, Ke = (t) => {
|
|
86
|
+
const e = T.c(8);
|
|
87
|
+
let l;
|
|
88
|
+
e[0] !== t ? (l = S("date-input__segment-group", t), e[0] = t, e[1] = l) : l = e[1];
|
|
89
|
+
const r = l;
|
|
90
|
+
let i;
|
|
91
|
+
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ n(C.Context, { children: Ce }), e[2] = i) : i = e[2];
|
|
92
|
+
let c;
|
|
93
|
+
e[3] !== r ? (c = /* @__PURE__ */ n(C.SegmentGroup, { ...r, children: i }), e[3] = r, e[4] = c) : c = e[4];
|
|
94
|
+
let o;
|
|
95
|
+
e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ n(C.HiddenInput, {}), e[5] = o) : o = e[5];
|
|
96
|
+
let s;
|
|
97
|
+
return e[6] !== c ? (s = /* @__PURE__ */ b(H, { children: [
|
|
98
|
+
c,
|
|
99
|
+
o
|
|
100
|
+
] }), e[6] = c, e[7] = s) : s = e[7], s;
|
|
101
|
+
}, Qe = (t) => {
|
|
102
|
+
const e = T.c(4);
|
|
103
|
+
let l;
|
|
104
|
+
e[0] !== t ? (l = S("date-input__trigger", t), e[0] = t, e[1] = l) : l = e[1];
|
|
105
|
+
const r = l;
|
|
106
|
+
let i;
|
|
107
|
+
return e[2] !== r ? (i = /* @__PURE__ */ n(te, { ...r }), e[2] = r, e[3] = i) : i = e[3], i;
|
|
108
|
+
}, pe = (t) => {
|
|
109
|
+
const e = T.c(4);
|
|
110
|
+
let l;
|
|
111
|
+
e[0] !== t ? (l = S("date-input__prev-trigger", t), e[0] = t, e[1] = l) : l = e[1];
|
|
112
|
+
const r = l;
|
|
113
|
+
let i;
|
|
114
|
+
return e[2] !== r ? (i = /* @__PURE__ */ n(a.PrevTrigger, { ...r }), e[2] = r, e[3] = i) : i = e[3], i;
|
|
115
|
+
}, ge = (t) => {
|
|
116
|
+
const e = T.c(4);
|
|
117
|
+
let l;
|
|
118
|
+
e[0] !== t ? (l = S("date-input__next-trigger", t), e[0] = t, e[1] = l) : l = e[1];
|
|
119
|
+
const r = l;
|
|
120
|
+
let i;
|
|
121
|
+
return e[2] !== r ? (i = /* @__PURE__ */ n(a.NextTrigger, { ...r }), e[2] = r, e[3] = i) : i = e[3], i;
|
|
122
|
+
}, Z = () => {
|
|
123
|
+
const t = T.c(2);
|
|
124
|
+
let e;
|
|
125
|
+
t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n(pe, { children: "‹" }), t[0] = e) : e = t[0];
|
|
126
|
+
let l;
|
|
127
|
+
return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ b(a.ViewControl, { className: "date-input__view-control", children: [
|
|
128
|
+
e,
|
|
129
|
+
/* @__PURE__ */ n(a.ViewTrigger, { className: "date-input__view-trigger", children: /* @__PURE__ */ n(a.RangeText, { className: "date-input__range-text" }) }),
|
|
130
|
+
/* @__PURE__ */ n(ge, { children: "›" })
|
|
131
|
+
] }), t[1] = l) : l = t[1], l;
|
|
132
|
+
}, Xe = (t) => {
|
|
133
|
+
const e = T.c(20);
|
|
134
|
+
let l, r, i, c, o, s;
|
|
135
|
+
if (e[0] !== t) {
|
|
136
|
+
const {
|
|
137
|
+
withTime: p,
|
|
138
|
+
...g
|
|
139
|
+
} = t;
|
|
140
|
+
s = p, r = le, l = re, c = "end", o = 8, i = S("date-input__content", g), e[0] = t, e[1] = l, e[2] = r, e[3] = i, e[4] = c, e[5] = o, e[6] = s;
|
|
141
|
+
} else
|
|
142
|
+
l = e[1], r = e[2], i = e[3], c = e[4], o = e[5], s = e[6];
|
|
143
|
+
const u = i;
|
|
144
|
+
let m;
|
|
145
|
+
e[7] !== s ? (m = /* @__PURE__ */ n(a.View, { view: "day", className: "date-input__view", children: /* @__PURE__ */ n(a.Context, { children: (p) => /* @__PURE__ */ b(H, { children: [
|
|
146
|
+
/* @__PURE__ */ n(Z, {}),
|
|
147
|
+
/* @__PURE__ */ b(a.Table, { className: "date-input__table", children: [
|
|
148
|
+
/* @__PURE__ */ n(a.TableHead, { children: /* @__PURE__ */ n(a.TableRow, { children: p.weekDays.map(Se) }) }),
|
|
149
|
+
/* @__PURE__ */ n(a.TableBody, { children: p.weeks.map(we) })
|
|
150
|
+
] }),
|
|
151
|
+
s && /* @__PURE__ */ n(be, {})
|
|
152
|
+
] }) }) }), e[7] = s, e[8] = m) : m = e[8];
|
|
153
|
+
let h;
|
|
154
|
+
e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ n(a.View, { view: "month", className: "date-input__view", children: /* @__PURE__ */ n(a.Context, { children: Ve }) }), e[9] = h) : h = e[9];
|
|
155
|
+
let d;
|
|
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 f;
|
|
158
|
+
e[11] !== l || e[12] !== c || e[13] !== o || e[14] !== u || e[15] !== m ? (f = /* @__PURE__ */ b(l, { align: c, sideOffset: o, ...u, children: [
|
|
159
|
+
m,
|
|
160
|
+
h,
|
|
161
|
+
d
|
|
162
|
+
] }), e[11] = l, e[12] = c, e[13] = o, e[14] = u, e[15] = m, e[16] = f) : f = e[16];
|
|
163
|
+
let _;
|
|
164
|
+
return e[17] !== r || e[18] !== f ? (_ = /* @__PURE__ */ n(r, { children: f }), e[17] = r, e[18] = f, e[19] = _) : _ = e[19], _;
|
|
165
|
+
}, be = () => {
|
|
166
|
+
const t = T.c(1);
|
|
167
|
+
let e;
|
|
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
|
+
}, U = (t) => {
|
|
170
|
+
const e = T.c(16), {
|
|
171
|
+
label: l,
|
|
172
|
+
value: r,
|
|
173
|
+
count: i,
|
|
174
|
+
disabled: c,
|
|
175
|
+
onValueChange: o
|
|
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
|
+
let m;
|
|
180
|
+
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = {
|
|
181
|
+
className: "date-input__time-select"
|
|
182
|
+
}, e[2] = m) : m = 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];
|
|
187
|
+
let f;
|
|
188
|
+
e[6] !== h ? (f = /* @__PURE__ */ n(me, { asChild: !0, children: /* @__PURE__ */ n(fe, { paddingSize: "xxs", justify: "start", children: /* @__PURE__ */ b(ee, { justify: "space-between", w: "100%", align: "center", children: [
|
|
189
|
+
h,
|
|
190
|
+
d
|
|
191
|
+
] }) }) }), e[6] = h, e[7] = f) : f = e[7];
|
|
192
|
+
let _;
|
|
193
|
+
e[8] !== i ? (_ = /* @__PURE__ */ n(ie, { children: /* @__PURE__ */ n(ae, { position: "item-aligned", children: /* @__PURE__ */ n(ce, { children: Array.from({
|
|
194
|
+
length: i
|
|
195
|
+
}, Oe) }) }) }), e[8] = i, e[9] = _) : _ = e[9];
|
|
196
|
+
let p;
|
|
197
|
+
return e[10] !== c || e[11] !== s || e[12] !== u || e[13] !== f || e[14] !== _ ? (p = /* @__PURE__ */ b(de, { value: s, disabled: c, onValueChange: u, wrapperComponent: m, children: [
|
|
198
|
+
f,
|
|
199
|
+
_
|
|
200
|
+
] }), e[10] = c, e[11] = s, e[12] = u, e[13] = f, e[14] = _, e[15] = p) : p = e[15], p;
|
|
201
|
+
};
|
|
202
|
+
function Te(t, e) {
|
|
203
|
+
return /* @__PURE__ */ n(C.Segment, { segment: t, className: "date-input__segment" }, e);
|
|
204
|
+
}
|
|
205
|
+
function Ce(t) {
|
|
206
|
+
return t.getSegments().map(Te);
|
|
207
|
+
}
|
|
208
|
+
function Se(t, e) {
|
|
209
|
+
return /* @__PURE__ */ n(a.TableHeader, { className: "date-input__table-header", children: t.narrow }, e);
|
|
210
|
+
}
|
|
211
|
+
function ve(t, e) {
|
|
212
|
+
return /* @__PURE__ */ n(a.TableCell, { value: t, children: /* @__PURE__ */ n(a.TableCellTrigger, { className: "date-input__cell", children: t.day }) }, e);
|
|
213
|
+
}
|
|
214
|
+
function we(t, e) {
|
|
215
|
+
return /* @__PURE__ */ n(a.TableRow, { children: t.map(ve) }, e);
|
|
216
|
+
}
|
|
217
|
+
function ye(t, e) {
|
|
218
|
+
return /* @__PURE__ */ n(a.TableCell, { value: t.value, children: /* @__PURE__ */ n(a.TableCellTrigger, { className: "date-input__cell", children: t.label }) }, e);
|
|
219
|
+
}
|
|
220
|
+
function Ne(t, e) {
|
|
221
|
+
return /* @__PURE__ */ n(a.TableRow, { children: t.map(ye) }, e);
|
|
222
|
+
}
|
|
223
|
+
function Ve(t) {
|
|
224
|
+
return /* @__PURE__ */ b(H, { children: [
|
|
225
|
+
/* @__PURE__ */ n(Z, {}),
|
|
226
|
+
/* @__PURE__ */ n(a.Table, { className: "date-input__table", children: /* @__PURE__ */ n(a.TableBody, { children: t.getMonthsGrid({
|
|
227
|
+
columns: 4,
|
|
228
|
+
format: "short"
|
|
229
|
+
}).map(Ne) }) })
|
|
230
|
+
] });
|
|
231
|
+
}
|
|
232
|
+
function xe(t, e) {
|
|
233
|
+
return /* @__PURE__ */ n(a.TableCell, { value: t.value, children: /* @__PURE__ */ n(a.TableCellTrigger, { className: "date-input__cell", children: t.label }) }, e);
|
|
234
|
+
}
|
|
235
|
+
function De(t, e) {
|
|
236
|
+
return /* @__PURE__ */ n(a.TableRow, { children: t.map(xe) }, e);
|
|
237
|
+
}
|
|
238
|
+
function Ie(t) {
|
|
239
|
+
return /* @__PURE__ */ b(H, { children: [
|
|
240
|
+
/* @__PURE__ */ n(Z, {}),
|
|
241
|
+
/* @__PURE__ */ n(a.Table, { className: "date-input__table", children: /* @__PURE__ */ n(a.TableBody, { children: t.getYearsGrid({
|
|
242
|
+
columns: 4
|
|
243
|
+
}).map(De) }) })
|
|
244
|
+
] });
|
|
245
|
+
}
|
|
246
|
+
function $e(t) {
|
|
247
|
+
return t.type;
|
|
248
|
+
}
|
|
249
|
+
function Re(t, e) {
|
|
250
|
+
return /* @__PURE__ */ b(F.Fragment, { children: [
|
|
251
|
+
e > 0 && /* @__PURE__ */ n("span", { className: "date-input__time-separator", children: ":" }),
|
|
252
|
+
t
|
|
253
|
+
] }, e);
|
|
254
|
+
}
|
|
255
|
+
function Me(t) {
|
|
256
|
+
const e = new Set(t.getSegments().map($e));
|
|
257
|
+
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, u = [];
|
|
259
|
+
return e.has("hour") && u.push(/* @__PURE__ */ n(U, { label: "Hour", value: i, count: 24, disabled: s, onValueChange: (m) => l.setTime({
|
|
260
|
+
hour: m,
|
|
261
|
+
minute: c,
|
|
262
|
+
second: o
|
|
263
|
+
}) }, "hour")), e.has("minute") && u.push(/* @__PURE__ */ n(U, { label: "Minute", value: c, count: 60, disabled: s, onValueChange: (m) => l.setTime({
|
|
264
|
+
hour: i,
|
|
265
|
+
minute: m,
|
|
266
|
+
second: o
|
|
267
|
+
}) }, "minute")), e.has("second") && u.push(/* @__PURE__ */ n(U, { label: "Second", value: o, count: 60, disabled: s, onValueChange: (m) => l.setTime({
|
|
268
|
+
hour: i,
|
|
269
|
+
minute: c,
|
|
270
|
+
second: m
|
|
271
|
+
}) }, "second")), /* @__PURE__ */ n("div", { className: "date-input__time", children: u.map(Re) });
|
|
272
|
+
} });
|
|
273
|
+
}
|
|
274
|
+
function Oe(t, e) {
|
|
275
|
+
return /* @__PURE__ */ n(oe, { value: String(e), children: /* @__PURE__ */ n(se, { children: String(e).padStart(2, "0") }) }, e);
|
|
276
|
+
}
|
|
277
|
+
export {
|
|
278
|
+
qe as DateInput,
|
|
279
|
+
Xe as DateInputContent,
|
|
280
|
+
Je as DateInputControl,
|
|
281
|
+
Ke as DateInputField,
|
|
282
|
+
ge as DateInputNextTrigger,
|
|
283
|
+
pe as DateInputPrevTrigger,
|
|
284
|
+
Qe as DateInputTrigger
|
|
285
|
+
};
|