asheeui 0.6.8 → 0.6.9
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/components/autocomplete/Autocomplete.d.ts +34 -17
- package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/Autocomplete.js +86 -102
- package/dist/components/autocomplete/autocomplete-config.d.ts +2 -20
- package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete-config.js +9 -13
- package/dist/components/button/Button.d.ts +31 -5
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +68 -64
- package/dist/components/card/Card.d.ts +58 -54
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +152 -158
- package/dist/components/card/card-config.d.ts +66 -33
- package/dist/components/card/card-config.d.ts.map +1 -1
- package/dist/components/card/card-config.js +9 -9
- package/dist/components/date-picker/Calendar.d.ts +57 -0
- package/dist/components/date-picker/Calendar.d.ts.map +1 -0
- package/dist/components/date-picker/Calendar.js +224 -0
- package/dist/components/date-picker/DatePicker.d.ts +68 -155
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +194 -466
- package/dist/components/date-picker/TimeSpinner.d.ts +46 -0
- package/dist/components/date-picker/TimeSpinner.d.ts.map +1 -0
- package/dist/components/date-picker/TimeSpinner.js +84 -0
- package/dist/components/date-picker/date-picker-config.d.ts +21 -1
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +10 -14
- package/dist/components/date-picker/date-picker-styles.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-styles.js +4 -11
- package/dist/components/date-picker/date-picker.helpers.d.ts +111 -0
- package/dist/components/date-picker/date-picker.helpers.d.ts.map +1 -0
- package/dist/components/date-picker/date-picker.helpers.js +110 -0
- package/dist/components/date-picker/index.js +3 -0
- package/dist/components/input/Input.d.ts +13 -7
- package/dist/components/input/Input.d.ts.map +1 -1
- package/dist/components/input/Input.js +96 -91
- package/dist/components/keyboard/KeyboardContext.d.ts +130 -0
- package/dist/components/keyboard/KeyboardContext.d.ts.map +1 -0
- package/dist/components/keyboard/KeyboardContext.js +13 -0
- package/dist/components/keyboard/KeyboardProvider.d.ts +78 -0
- package/dist/components/keyboard/KeyboardProvider.d.ts.map +1 -0
- package/dist/components/keyboard/KeyboardProvider.js +183 -0
- package/dist/components/keyboard/OnScreenKeyboard.d.ts +65 -43
- package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
- package/dist/components/keyboard/OnScreenKeyboard.js +119 -113
- package/dist/components/keyboard/index.d.ts +2 -1
- package/dist/components/keyboard/index.d.ts.map +1 -1
- package/dist/components/keyboard/index.js +2 -1
- package/dist/components/keyboard/keyboard-config.d.ts +40 -36
- package/dist/components/keyboard/keyboard-config.d.ts.map +1 -1
- package/dist/components/keyboard/keyboard-config.js +15 -10
- package/dist/components/keyboard/use-keyboard-field.d.ts +6 -4
- package/dist/components/keyboard/use-keyboard-field.d.ts.map +1 -1
- package/dist/components/keyboard/use-keyboard-field.js +12 -12
- package/dist/components/multi-select/MultiSelect.d.ts +75 -40
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +188 -188
- package/dist/components/multi-select/multi-select-config.d.ts +2 -20
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +10 -14
- package/dist/components/select/Select.d.ts +60 -45
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +147 -159
- package/dist/components/select/select-config.d.ts +3 -29
- package/dist/components/select/select-config.d.ts.map +1 -1
- package/dist/components/select/select-config.js +6 -14
- package/dist/components/select/select-styles.js +1 -6
- package/dist/components/select-menu/SelectMenu.d.ts +45 -30
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +125 -124
- package/dist/components/select-menu/select-menu-config.d.ts +25 -2
- package/dist/components/select-menu/select-menu-config.d.ts.map +1 -1
- package/dist/components/select-menu/select-menu-config.js +4 -3
- package/dist/components/switch/Switch.d.ts +9 -33
- package/dist/components/switch/Switch.d.ts.map +1 -1
- package/dist/components/switch/Switch.js +68 -74
- package/dist/components/switch/switch-styles.d.ts +1 -6
- package/dist/components/switch/switch-styles.d.ts.map +1 -1
- package/dist/components/switch/switch-styles.js +6 -12
- package/dist/components/textarea/Textarea.d.ts +19 -1
- package/dist/components/textarea/Textarea.d.ts.map +1 -1
- package/dist/components/textarea/Textarea.js +95 -90
- package/dist/components/toast/ToastContext.d.ts +122 -0
- package/dist/components/toast/ToastContext.d.ts.map +1 -0
- package/dist/components/toast/ToastContext.js +28 -0
- package/dist/components/toast/ToastProvider.d.ts +98 -0
- package/dist/components/toast/ToastProvider.d.ts.map +1 -0
- package/dist/components/toast/ToastProvider.js +188 -0
- package/dist/components/toast/index.d.ts +2 -1
- package/dist/components/toast/index.d.ts.map +1 -1
- package/dist/components/toast/index.js +2 -1
- package/dist/components/toast/toast-config.d.ts +36 -0
- package/dist/components/toast/toast-config.d.ts.map +1 -1
- package/dist/icons/ChevronUpIcon.d.ts +3 -0
- package/dist/icons/ChevronUpIcon.d.ts.map +1 -0
- package/dist/icons/ChevronUpIcon.js +21 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/index.js +62 -59
- package/dist/theme/color.js +2 -2
- package/package.json +1 -1
- package/dist/components/keyboard/keyboard-context.d.ts +0 -118
- package/dist/components/keyboard/keyboard-context.d.ts.map +0 -1
- package/dist/components/keyboard/keyboard-context.js +0 -90
- package/dist/components/toast/toast-context.d.ts +0 -163
- package/dist/components/toast/toast-context.d.ts.map +0 -1
- package/dist/components/toast/toast-context.js +0 -177
|
@@ -1,482 +1,210 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useClick as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { CalendarIcon as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { FALLBACK_DATE_PICKER_CONFIG as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
const Oe = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], ze = [
|
|
21
|
-
"January",
|
|
22
|
-
"February",
|
|
23
|
-
"March",
|
|
24
|
-
"April",
|
|
25
|
-
"May",
|
|
26
|
-
"June",
|
|
27
|
-
"July",
|
|
28
|
-
"August",
|
|
29
|
-
"September",
|
|
30
|
-
"October",
|
|
31
|
-
"November",
|
|
32
|
-
"December"
|
|
33
|
-
];
|
|
34
|
-
function T(e) {
|
|
35
|
-
return String(e).padStart(2, "0");
|
|
36
|
-
}
|
|
37
|
-
function He(e, n) {
|
|
38
|
-
const i = T(e.getDate()), m = T(e.getMonth() + 1), l = e.getFullYear(), a = T(e.getHours()), u = T(e.getMinutes());
|
|
39
|
-
switch (n) {
|
|
40
|
-
case "date":
|
|
41
|
-
return `${i}/${m}/${l}`;
|
|
42
|
-
case "time":
|
|
43
|
-
return `${a}:${u}`;
|
|
44
|
-
case "datetime":
|
|
45
|
-
return `${i}/${m}/${l} ${a}:${u}`;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function Ve(e) {
|
|
49
|
-
switch (e) {
|
|
50
|
-
case "date":
|
|
51
|
-
return "Select date...";
|
|
52
|
-
case "time":
|
|
53
|
-
return "Select time...";
|
|
54
|
-
case "datetime":
|
|
55
|
-
return "Select date & time...";
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function Je(e, n) {
|
|
59
|
-
const i = new Date(e, n + 1, 0).getDate(), m = new Date(e, n, 1).getDay(), l = [
|
|
60
|
-
...Array(m).fill(null),
|
|
61
|
-
...Array.from({ length: i }, (a, u) => u + 1)
|
|
62
|
-
];
|
|
63
|
-
for (; l.length % 7 !== 0; ) l.push(null);
|
|
64
|
-
return l;
|
|
65
|
-
}
|
|
66
|
-
function oe({
|
|
67
|
-
value: e,
|
|
68
|
-
max: n,
|
|
69
|
-
label: i,
|
|
70
|
-
onChange: m,
|
|
71
|
-
resolvedColor: l,
|
|
72
|
-
radiusClass: a
|
|
73
|
-
}) {
|
|
74
|
-
const u = () => m(e >= n ? 0 : e + 1), y = () => m(e <= 0 ? n : e - 1), S = O[l] ?? O.primary;
|
|
75
|
-
return /* @__PURE__ */ h("div", { className: "flex flex-col items-center gap-0.5", children: [
|
|
76
|
-
/* @__PURE__ */ r("span", { className: "text-[10px] uppercase tracking-widest text-foreground/70 select-none", children: i }),
|
|
77
|
-
/* @__PURE__ */ r(
|
|
78
|
-
"button",
|
|
79
|
-
{
|
|
80
|
-
type: "button",
|
|
81
|
-
className: d(
|
|
82
|
-
"w-10 h-7 flex items-center justify-center text-xs text-foreground/70 transition-colors",
|
|
83
|
-
a,
|
|
84
|
-
S.hover
|
|
85
|
-
),
|
|
86
|
-
onClick: u,
|
|
87
|
-
"aria-label": `Increment ${i}`,
|
|
88
|
-
children: "▲"
|
|
89
|
-
}
|
|
90
|
-
),
|
|
91
|
-
/* @__PURE__ */ r(
|
|
92
|
-
"div",
|
|
93
|
-
{
|
|
94
|
-
className: d(
|
|
95
|
-
"w-10 h-10 flex items-center justify-center text-base font-mono font-bold text-foreground bg-background border border-border select-none",
|
|
96
|
-
a
|
|
97
|
-
),
|
|
98
|
-
children: T(e)
|
|
99
|
-
}
|
|
100
|
-
),
|
|
101
|
-
/* @__PURE__ */ r(
|
|
102
|
-
"button",
|
|
103
|
-
{
|
|
104
|
-
type: "button",
|
|
105
|
-
className: d(
|
|
106
|
-
"w-10 h-7 flex items-center justify-center text-xs text-foreground/70 transition-colors",
|
|
107
|
-
a,
|
|
108
|
-
S.hover
|
|
109
|
-
),
|
|
110
|
-
onClick: y,
|
|
111
|
-
"aria-label": `Decrement ${i}`,
|
|
112
|
-
children: "▼"
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
] });
|
|
116
|
-
}
|
|
117
|
-
function Be({
|
|
118
|
-
selected: e,
|
|
119
|
-
mode: n,
|
|
120
|
-
isClearable: i,
|
|
121
|
-
resolvedSizeKey: m,
|
|
122
|
-
resolvedColor: l,
|
|
123
|
-
radiusClass: a,
|
|
124
|
-
onSelect: u,
|
|
125
|
-
onClose: y,
|
|
126
|
-
disableFuture: S = !1
|
|
127
|
-
}) {
|
|
128
|
-
const c = /* @__PURE__ */ new Date(), [g, C] = R(
|
|
129
|
-
(e == null ? void 0 : e.getFullYear()) ?? c.getFullYear()
|
|
130
|
-
), [f, N] = R(
|
|
131
|
-
(e == null ? void 0 : e.getMonth()) ?? c.getMonth()
|
|
132
|
-
), [b, P] = R((e == null ? void 0 : e.getHours()) ?? 0), [F, z] = R((e == null ? void 0 : e.getMinutes()) ?? 0), x = O[l] ?? O.primary;
|
|
133
|
-
function E(t, s) {
|
|
134
|
-
const _ = e ?? /* @__PURE__ */ new Date();
|
|
135
|
-
u(
|
|
136
|
-
new Date(_.getFullYear(), _.getMonth(), _.getDate(), t, s, 0, 0)
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
function H(t) {
|
|
140
|
-
P(t), E(t, F);
|
|
141
|
-
}
|
|
142
|
-
function V(t) {
|
|
143
|
-
z(t), E(b, t);
|
|
144
|
-
}
|
|
145
|
-
function J(t) {
|
|
146
|
-
u(new Date(g, f, t, b, F, 0, 0)), n === "date" && y();
|
|
147
|
-
}
|
|
148
|
-
function M() {
|
|
149
|
-
f === 0 ? (N(11), C((t) => t - 1)) : N((t) => t - 1);
|
|
150
|
-
}
|
|
151
|
-
function A() {
|
|
152
|
-
f === 11 ? (N(0), C((t) => t + 1)) : N((t) => t + 1);
|
|
153
|
-
}
|
|
154
|
-
function o(t) {
|
|
155
|
-
return !!e && e.getFullYear() === g && e.getMonth() === f && e.getDate() === t;
|
|
156
|
-
}
|
|
157
|
-
function B(t) {
|
|
158
|
-
return c.getFullYear() === g && c.getMonth() === f && c.getDate() === t;
|
|
159
|
-
}
|
|
160
|
-
const G = new Date(
|
|
161
|
-
c.getFullYear(),
|
|
162
|
-
c.getMonth(),
|
|
163
|
-
c.getDate()
|
|
164
|
-
);
|
|
165
|
-
function w(t) {
|
|
166
|
-
return S ? new Date(g, f, t) > G : !1;
|
|
167
|
-
}
|
|
168
|
-
const $ = !S || g < c.getFullYear() || g === c.getFullYear() && f < c.getMonth(), L = n === "date" || n === "datetime", Y = n === "time" || n === "datetime", K = n !== "date" || i && !!e, k = Je(g, f), v = Ae(() => k.map((t, s) => ({
|
|
169
|
-
key: t !== null ? `day-${t}` : `empty-slot-${s}`,
|
|
170
|
-
day: t
|
|
171
|
-
})), [k]);
|
|
172
|
-
return /* @__PURE__ */ h(
|
|
173
|
-
"div",
|
|
174
|
-
{
|
|
175
|
-
className: d(
|
|
176
|
-
"bg-background border border-border shadow-xl select-none p-3 min-w-70",
|
|
177
|
-
a
|
|
178
|
-
),
|
|
179
|
-
children: [
|
|
180
|
-
L && /* @__PURE__ */ h(xe, { children: [
|
|
181
|
-
/* @__PURE__ */ h("div", { className: "flex items-center justify-between pb-2 mb-2 border-b border-border", children: [
|
|
182
|
-
/* @__PURE__ */ r(
|
|
183
|
-
"button",
|
|
184
|
-
{
|
|
185
|
-
type: "button",
|
|
186
|
-
onClick: M,
|
|
187
|
-
"aria-label": "Previous month",
|
|
188
|
-
className: d(
|
|
189
|
-
"p-1 text-foreground transition-colors",
|
|
190
|
-
a,
|
|
191
|
-
x.hover
|
|
192
|
-
),
|
|
193
|
-
children: /* @__PURE__ */ r(Fe, {})
|
|
194
|
-
}
|
|
195
|
-
),
|
|
196
|
-
/* @__PURE__ */ h("span", { className: "font-medium text-sm text-foreground", children: [
|
|
197
|
-
ze[f],
|
|
198
|
-
" ",
|
|
199
|
-
g
|
|
200
|
-
] }),
|
|
201
|
-
/* @__PURE__ */ r(
|
|
202
|
-
"button",
|
|
203
|
-
{
|
|
204
|
-
type: "button",
|
|
205
|
-
onClick: A,
|
|
206
|
-
disabled: !$,
|
|
207
|
-
"aria-label": "Next month",
|
|
208
|
-
className: d(
|
|
209
|
-
"p-1 text-foreground transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
|
|
210
|
-
a,
|
|
211
|
-
x.hover
|
|
212
|
-
),
|
|
213
|
-
children: /* @__PURE__ */ r(_e, {})
|
|
214
|
-
}
|
|
215
|
-
)
|
|
216
|
-
] }),
|
|
217
|
-
/* @__PURE__ */ h("div", { className: "grid grid-cols-7 gap-1 text-center", children: [
|
|
218
|
-
Oe.map((t) => /* @__PURE__ */ r(
|
|
219
|
-
"div",
|
|
220
|
-
{
|
|
221
|
-
className: "text-xs font-semibold text-foreground/70 py-1",
|
|
222
|
-
children: t
|
|
223
|
-
},
|
|
224
|
-
t
|
|
225
|
-
)),
|
|
226
|
-
v.map(
|
|
227
|
-
({ key: t, day: s }) => s === null ? /* @__PURE__ */ r("div", {}, t) : /* @__PURE__ */ r(
|
|
228
|
-
"button",
|
|
229
|
-
{
|
|
230
|
-
type: "button",
|
|
231
|
-
onClick: () => J(s),
|
|
232
|
-
disabled: w(s),
|
|
233
|
-
className: d(
|
|
234
|
-
"w-full flex items-center justify-center font-medium transition-colors",
|
|
235
|
-
$e[m],
|
|
236
|
-
a,
|
|
237
|
-
w(s) ? "opacity-30 cursor-not-allowed text-foreground/70" : o(s) ? d(x.bg, "font-semibold") : B(s) ? d("border", x.border, x.text) : d("text-foreground", x.hover)
|
|
238
|
-
),
|
|
239
|
-
children: s
|
|
240
|
-
},
|
|
241
|
-
s
|
|
242
|
-
)
|
|
243
|
-
)
|
|
244
|
-
] })
|
|
245
|
-
] }),
|
|
246
|
-
Y && /* @__PURE__ */ h("div", { className: "flex items-center justify-center gap-4 py-3 border-t border-border mt-2", children: [
|
|
247
|
-
/* @__PURE__ */ r(
|
|
248
|
-
oe,
|
|
249
|
-
{
|
|
250
|
-
value: b,
|
|
251
|
-
max: 23,
|
|
252
|
-
label: "HH",
|
|
253
|
-
onChange: H,
|
|
254
|
-
resolvedColor: l,
|
|
255
|
-
radiusClass: a
|
|
256
|
-
}
|
|
257
|
-
),
|
|
258
|
-
/* @__PURE__ */ r("span", { className: "text-xl font-bold text-foreground/70 select-none pt-3", children: ":" }),
|
|
259
|
-
/* @__PURE__ */ r(
|
|
260
|
-
oe,
|
|
261
|
-
{
|
|
262
|
-
value: F,
|
|
263
|
-
max: 59,
|
|
264
|
-
label: "MM",
|
|
265
|
-
onChange: V,
|
|
266
|
-
resolvedColor: l,
|
|
267
|
-
radiusClass: a
|
|
268
|
-
}
|
|
269
|
-
)
|
|
270
|
-
] }),
|
|
271
|
-
K && /* @__PURE__ */ h("div", { className: "flex items-center justify-between border-t border-border pt-2 mt-2", children: [
|
|
272
|
-
i && e && /* @__PURE__ */ r(
|
|
273
|
-
"button",
|
|
274
|
-
{
|
|
275
|
-
type: "button",
|
|
276
|
-
onClick: () => {
|
|
277
|
-
u(null), y();
|
|
278
|
-
},
|
|
279
|
-
className: "text-xs text-foreground/70 hover:text-danger transition-colors",
|
|
280
|
-
children: "Clear"
|
|
281
|
-
}
|
|
282
|
-
),
|
|
283
|
-
n !== "date" && /* @__PURE__ */ r(
|
|
284
|
-
"button",
|
|
285
|
-
{
|
|
286
|
-
type: "button",
|
|
287
|
-
onClick: y,
|
|
288
|
-
className: d(
|
|
289
|
-
"ml-auto text-xs font-medium px-3 py-1.5 hover:opacity-90 transition-opacity",
|
|
290
|
-
a,
|
|
291
|
-
x.bg
|
|
292
|
-
),
|
|
293
|
-
children: "Done"
|
|
294
|
-
}
|
|
295
|
-
)
|
|
296
|
-
] })
|
|
297
|
-
]
|
|
298
|
-
}
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
const Ge = Ne(
|
|
2
|
+
import { jsx as n, jsxs as g, Fragment as de } from "react/jsx-runtime";
|
|
3
|
+
import { useClick as me, useDismiss as fe, useRole as pe, useInteractions as ve, FloatingFocusManager as ye } from "@floating-ui/react";
|
|
4
|
+
import { forwardRef as Ie, useId as Pe, useState as h, useRef as Re, useEffect as Se, useCallback as d } from "react";
|
|
5
|
+
import { createPortal as Fe } from "react-dom";
|
|
6
|
+
import { CalendarIcon as Ne } from "../../icons/CalendarIcon.js";
|
|
7
|
+
import { ClearIcon as xe } from "../../icons/ClearIcon.js";
|
|
8
|
+
import { ClockIcon as Ae } from "../../icons/ClockIcon.js";
|
|
9
|
+
import { useAsheeConfig as De } from "../../libs/context.js";
|
|
10
|
+
import { resolveCascade as m, resolveRadiusKey as Ke, resolveClassKey as we } from "../../utils/resolve-token.js";
|
|
11
|
+
import { Input as Ee } from "../input/Input.js";
|
|
12
|
+
import { Calendar as _e } from "./Calendar.js";
|
|
13
|
+
import { formatDisplay as I, parseDateString as Le, getNewCursorPosition as Te, getDefaultPlaceholder as ze } from "./date-picker.helpers.js";
|
|
14
|
+
import { FALLBACK_DATE_PICKER_CONFIG as f } from "./date-picker-config.js";
|
|
15
|
+
import { RADIUS_CLASS as Oe } from "../../shared/radius.js";
|
|
16
|
+
import { useSelectFloating as be } from "../select-menu/use-select-floating.js";
|
|
17
|
+
import { cn as Me } from "../../utils/cn.js";
|
|
18
|
+
import { FALLBACK_SELECT_MENU_CONFIG as Ve } from "../select-menu/select-menu-config.js";
|
|
19
|
+
const ge = Ie(
|
|
302
20
|
({
|
|
303
|
-
selected:
|
|
304
|
-
onChange:
|
|
305
|
-
mode:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
placeholder: z,
|
|
321
|
-
className: x,
|
|
322
|
-
id: E,
|
|
323
|
-
style: H,
|
|
324
|
-
portal: V,
|
|
325
|
-
portalTarget: J
|
|
326
|
-
}, M) => {
|
|
327
|
-
var X;
|
|
328
|
-
const A = Ce(), o = (X = A.components) == null ? void 0 : X.datePicker, B = Me(), G = E ?? B, [w, $] = R(!1), L = I(
|
|
329
|
-
m,
|
|
330
|
-
o == null ? void 0 : o.size,
|
|
21
|
+
selected: r,
|
|
22
|
+
onChange: t,
|
|
23
|
+
mode: j,
|
|
24
|
+
isClearable: x = !1,
|
|
25
|
+
disableFuture: B = !1,
|
|
26
|
+
placeholder: G,
|
|
27
|
+
size: A,
|
|
28
|
+
radius: P,
|
|
29
|
+
color: D,
|
|
30
|
+
disabled: u,
|
|
31
|
+
picker: l,
|
|
32
|
+
...K
|
|
33
|
+
}, c) => {
|
|
34
|
+
var T, z, O;
|
|
35
|
+
const R = De(), e = (T = R.components) == null ? void 0 : T.datePicker, U = Pe(), W = K.id ?? U, [p, v] = h(!1), [S, a] = h(""), w = Re(null), s = m(
|
|
36
|
+
j,
|
|
37
|
+
e == null ? void 0 : e.mode,
|
|
331
38
|
void 0,
|
|
332
|
-
|
|
333
|
-
),
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
A.defaultVariant,
|
|
337
|
-
p.variant
|
|
338
|
-
), K = I(
|
|
339
|
-
u,
|
|
340
|
-
o == null ? void 0 : o.color,
|
|
341
|
-
A.defaultColor,
|
|
342
|
-
p.color
|
|
343
|
-
), k = Pe(
|
|
344
|
-
typeof l == "string" ? l : void 0,
|
|
345
|
-
typeof (o == null ? void 0 : o.radius) == "string" ? o.radius : void 0,
|
|
346
|
-
A.defaultRadius,
|
|
347
|
-
p.radius
|
|
348
|
-
), v = y ?? p.status, t = I(
|
|
349
|
-
c,
|
|
350
|
-
o == null ? void 0 : o.labelAlign,
|
|
39
|
+
f.mode
|
|
40
|
+
), q = m(
|
|
41
|
+
l == null ? void 0 : l.portal,
|
|
42
|
+
(z = e == null ? void 0 : e.picker) == null ? void 0 : z.portal,
|
|
351
43
|
void 0,
|
|
352
|
-
|
|
353
|
-
),
|
|
354
|
-
|
|
355
|
-
|
|
44
|
+
Ve.portal
|
|
45
|
+
), H = m(
|
|
46
|
+
l == null ? void 0 : l.portalTarget,
|
|
47
|
+
(O = e == null ? void 0 : e.picker) == null ? void 0 : O.portalTarget,
|
|
356
48
|
void 0,
|
|
357
|
-
|
|
358
|
-
),
|
|
359
|
-
|
|
360
|
-
|
|
49
|
+
null
|
|
50
|
+
), J = m(
|
|
51
|
+
A,
|
|
52
|
+
e == null ? void 0 : e.size,
|
|
361
53
|
void 0,
|
|
362
|
-
|
|
363
|
-
),
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
54
|
+
f.size
|
|
55
|
+
), Q = m(
|
|
56
|
+
D,
|
|
57
|
+
e == null ? void 0 : e.color,
|
|
58
|
+
R.defaultColor,
|
|
59
|
+
f.color
|
|
60
|
+
), E = Ke(
|
|
61
|
+
typeof P == "string" ? P : void 0,
|
|
62
|
+
typeof (e == null ? void 0 : e.radius) == "string" ? e.radius : void 0,
|
|
63
|
+
R.defaultRadius,
|
|
64
|
+
f.radius
|
|
65
|
+
), X = we(
|
|
66
|
+
E === "full" ? "xl" : E,
|
|
67
|
+
Oe,
|
|
68
|
+
f.radius
|
|
69
|
+
), { refs: F, floatingStyles: Y, context: y } = be({
|
|
70
|
+
isOpen: p,
|
|
71
|
+
onOpenChange: v,
|
|
72
|
+
disabled: u,
|
|
73
|
+
matchReferenceWidth: !1
|
|
74
|
+
// Allow calendar to size naturally side-by-side
|
|
75
|
+
}), Z = me(y, { enabled: !u }), $ = fe(y, {
|
|
76
|
+
enabled: !u,
|
|
77
|
+
outsidePress: !0,
|
|
78
|
+
outsidePressEvent: "mousedown",
|
|
79
|
+
escapeKey: !0
|
|
80
|
+
}), C = pe(y, { role: "dialog" }), { getReferenceProps: k, getFloatingProps: ee } = ve([
|
|
81
|
+
Z,
|
|
82
|
+
$,
|
|
83
|
+
C
|
|
84
|
+
]);
|
|
85
|
+
Se(() => {
|
|
86
|
+
a(r ? I(r, s) : "");
|
|
87
|
+
}, [r, s]);
|
|
88
|
+
const te = d(
|
|
89
|
+
(o) => {
|
|
90
|
+
t == null || t(o), a(o ? I(o, s) : ""), (s === "date" || o === null) && v(!1);
|
|
91
|
+
},
|
|
92
|
+
[t, s]
|
|
93
|
+
), oe = d(() => v(!1), []), se = d(
|
|
94
|
+
(o) => {
|
|
95
|
+
var i;
|
|
96
|
+
o.stopPropagation(), t == null || t(null), a(""), v(!1), (i = w.current) == null || i.focus();
|
|
97
|
+
},
|
|
98
|
+
[t]
|
|
99
|
+
), re = d(
|
|
100
|
+
(o) => {
|
|
101
|
+
const i = o.target, ie = i.value, ue = S, ce = i.selectionStart ?? 0, b = ie.replace(/\D/g, "");
|
|
102
|
+
if (b.length === 0) {
|
|
103
|
+
a(""), t == null || t(null);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const N = Le(
|
|
107
|
+
b,
|
|
108
|
+
s,
|
|
109
|
+
r ?? void 0
|
|
110
|
+
);
|
|
111
|
+
if (N) {
|
|
112
|
+
t == null || t(N);
|
|
113
|
+
const M = I(N, s);
|
|
114
|
+
a(M);
|
|
115
|
+
const V = Te(
|
|
116
|
+
ue,
|
|
117
|
+
M,
|
|
118
|
+
ce
|
|
119
|
+
);
|
|
120
|
+
requestAnimationFrame(() => {
|
|
121
|
+
i.setSelectionRange(V, V);
|
|
122
|
+
});
|
|
123
|
+
} else
|
|
124
|
+
a(r ? I(r, s) : "");
|
|
388
125
|
},
|
|
389
|
-
[
|
|
390
|
-
),
|
|
391
|
-
|
|
126
|
+
[s, r, t, S]
|
|
127
|
+
), le = G ?? ze(s), ae = /* @__PURE__ */ g(de, { children: [
|
|
128
|
+
x && r && !u && /* @__PURE__ */ n(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
onClick: se,
|
|
133
|
+
"aria-label": "Clear selection",
|
|
134
|
+
className: "p-0.5 rounded text-foreground/70 hover:text-foreground transition-colors",
|
|
135
|
+
children: /* @__PURE__ */ n(xe, { className: "size-3.5" })
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ n("span", { className: "text-foreground/70 pointer-events-none", children: s === "time" ? /* @__PURE__ */ n(Ae, {}) : /* @__PURE__ */ n(Ne, {}) })
|
|
139
|
+
] }), _ = p ? /* @__PURE__ */ n(
|
|
140
|
+
ye,
|
|
392
141
|
{
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
children: /* @__PURE__ */
|
|
398
|
-
|
|
142
|
+
context: y,
|
|
143
|
+
modal: !1,
|
|
144
|
+
initialFocus: -1,
|
|
145
|
+
returnFocus: !1,
|
|
146
|
+
children: /* @__PURE__ */ n(
|
|
147
|
+
"div",
|
|
399
148
|
{
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
149
|
+
ref: F.setFloating,
|
|
150
|
+
style: {
|
|
151
|
+
...Y,
|
|
152
|
+
width: "max-content",
|
|
153
|
+
minWidth: "fit-content"
|
|
154
|
+
},
|
|
155
|
+
className: Me(
|
|
156
|
+
"z-100 outline-none animate-in fade-in-0 zoom-in-95 duration-150 ease-out",
|
|
157
|
+
l == null ? void 0 : l.className
|
|
158
|
+
),
|
|
159
|
+
...ee(),
|
|
160
|
+
children: /* @__PURE__ */ n(
|
|
161
|
+
_e,
|
|
162
|
+
{
|
|
163
|
+
selected: r,
|
|
164
|
+
mode: s,
|
|
165
|
+
isClearable: x,
|
|
166
|
+
resolvedSizeKey: J,
|
|
167
|
+
onSelect: te,
|
|
168
|
+
onClose: oe,
|
|
169
|
+
disableFuture: B,
|
|
170
|
+
resolvedColor: Q,
|
|
171
|
+
radiusClass: X
|
|
172
|
+
}
|
|
173
|
+
)
|
|
409
174
|
}
|
|
410
|
-
)
|
|
411
|
-
}
|
|
412
|
-
) }) : null, Q = re ?? (typeof document < "u" ? document.body : null);
|
|
413
|
-
return /* @__PURE__ */ r(
|
|
414
|
-
Ee,
|
|
415
|
-
{
|
|
416
|
-
id: G,
|
|
417
|
-
label: S,
|
|
418
|
-
labelAlign: t,
|
|
419
|
-
description: g,
|
|
420
|
-
message: C,
|
|
421
|
-
status: v,
|
|
422
|
-
required: f,
|
|
423
|
-
isLoading: N,
|
|
424
|
-
children: /* @__PURE__ */ h("div", { className: "w-full relative inline-block", children: [
|
|
425
|
-
/* @__PURE__ */ h(
|
|
426
|
-
"div",
|
|
427
|
-
{
|
|
428
|
-
ref: (D) => {
|
|
429
|
-
W.setReference(D), typeof M == "function" ? M(D) : M && (M.current = D);
|
|
430
|
-
},
|
|
431
|
-
role: "combobox",
|
|
432
|
-
tabIndex: b ? -1 : 0,
|
|
433
|
-
"aria-expanded": w,
|
|
434
|
-
"aria-haspopup": "dialog",
|
|
435
|
-
"aria-invalid": v === "error",
|
|
436
|
-
"aria-disabled": b,
|
|
437
|
-
className: d(
|
|
438
|
-
"w-full flex items-center justify-between cursor-pointer text-foreground outline-none transition-colors select-none shrink-0",
|
|
439
|
-
"focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
440
|
-
b && "pointer-events-none opacity-50 cursor-not-allowed",
|
|
441
|
-
Ye[L],
|
|
442
|
-
ne,
|
|
443
|
-
ae,
|
|
444
|
-
se,
|
|
445
|
-
x
|
|
446
|
-
),
|
|
447
|
-
style: H,
|
|
448
|
-
...me(),
|
|
449
|
-
children: [
|
|
450
|
-
/* @__PURE__ */ r(
|
|
451
|
-
"span",
|
|
452
|
-
{
|
|
453
|
-
className: Z ? "text-foreground" : "text-foreground/70",
|
|
454
|
-
children: Z ?? be
|
|
455
|
-
}
|
|
456
|
-
),
|
|
457
|
-
/* @__PURE__ */ h("div", { className: "flex items-center gap-1.5 ml-2 shrink-0", children: [
|
|
458
|
-
P && e && !b && /* @__PURE__ */ r(
|
|
459
|
-
"button",
|
|
460
|
-
{
|
|
461
|
-
type: "button",
|
|
462
|
-
onClick: ge,
|
|
463
|
-
"aria-label": "Clear selection",
|
|
464
|
-
className: "p-0.5 rounded text-foreground/70 hover:text-foreground transition-colors",
|
|
465
|
-
children: /* @__PURE__ */ r(Re, { className: "size-3.5" })
|
|
466
|
-
}
|
|
467
|
-
),
|
|
468
|
-
/* @__PURE__ */ r("span", { className: "text-foreground/70 pointer-events-none", children: s === "time" ? /* @__PURE__ */ r(Te, {}) : /* @__PURE__ */ r(Ie, {}) })
|
|
469
|
-
] })
|
|
470
|
-
]
|
|
471
|
-
}
|
|
472
|
-
),
|
|
473
|
-
w && (_ && Q ? ke(q, Q) : q)
|
|
474
|
-
] })
|
|
175
|
+
)
|
|
475
176
|
}
|
|
177
|
+
) : null, L = H ?? (typeof document < "u" ? document.body : null), ne = d(
|
|
178
|
+
(o) => {
|
|
179
|
+
o && (F.setReference(o), w.current = o, typeof c == "function" ? c(o) : c && (c.current = o));
|
|
180
|
+
},
|
|
181
|
+
[F, c]
|
|
476
182
|
);
|
|
183
|
+
return /* @__PURE__ */ g("div", { className: "w-full relative inline-block", children: [
|
|
184
|
+
/* @__PURE__ */ n(
|
|
185
|
+
Ee,
|
|
186
|
+
{
|
|
187
|
+
...K,
|
|
188
|
+
ref: ne,
|
|
189
|
+
id: W,
|
|
190
|
+
size: A,
|
|
191
|
+
radius: P,
|
|
192
|
+
color: D,
|
|
193
|
+
placeholder: le,
|
|
194
|
+
value: S,
|
|
195
|
+
onChange: re,
|
|
196
|
+
endContent: ae,
|
|
197
|
+
disabled: u,
|
|
198
|
+
"aria-expanded": p,
|
|
199
|
+
"aria-haspopup": "dialog",
|
|
200
|
+
...k()
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
p && (q && L ? Fe(_, L) : _)
|
|
204
|
+
] });
|
|
477
205
|
}
|
|
478
206
|
);
|
|
479
|
-
|
|
207
|
+
ge.displayName = "DatePicker";
|
|
480
208
|
export {
|
|
481
|
-
|
|
209
|
+
ge as DatePicker
|
|
482
210
|
};
|