@sth87/shadcn-design-system 0.2.12 → 0.3.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/README.md +2 -3
- package/dist/AI_CONTEXT.md +4 -4
- package/dist/cjs/components/Calendar/Calendar.cjs +1 -1
- package/dist/cjs/components/Calendar/index.cjs +1 -1
- package/dist/cjs/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/cjs/components/Checkbox/Confetti.cjs +1 -0
- package/dist/cjs/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/cjs/components/DatePicker/RangePicker.cjs +1 -1
- package/dist/cjs/components/DatePicker/TimePicker.cjs +1 -1
- package/dist/cjs/components/Slider/Slider.cjs +1 -1
- package/dist/cjs/components/Slider/SpecSliderLabel.cjs +1 -0
- package/dist/cjs/components/Table/TableFilter/data-table-filter-popover.cjs +1 -1
- package/dist/cjs/components/Tabs/Tabs.cjs +1 -1
- package/dist/cjs/components/Tooltip/SpecTooltip.cjs +1 -0
- package/dist/cjs/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/calendar-logic.cjs +1 -0
- package/dist/cjs/packages/ui/src/components/calendar.cjs +1 -1
- package/dist/cjs/styles/index.css +1 -1
- package/dist/cjs/utils/animations.cjs +1 -1
- package/dist/cjs/utils/date-format.cjs +1 -0
- package/dist/esm/components/Calendar/Calendar.js +23 -19
- package/dist/esm/components/Calendar/index.js +7 -3
- package/dist/esm/components/Checkbox/Checkbox.js +46 -44
- package/dist/esm/components/Checkbox/Confetti.js +28 -0
- package/dist/esm/components/DatePicker/DatePicker.js +78 -81
- package/dist/esm/components/DatePicker/RangePicker.js +121 -124
- package/dist/esm/components/DatePicker/TimePicker.js +122 -124
- package/dist/esm/components/Slider/Slider.js +140 -199
- package/dist/esm/components/Slider/SpecSliderLabel.js +60 -0
- package/dist/esm/components/Table/TableFilter/data-table-filter-popover.js +30 -26
- package/dist/esm/components/Tabs/Tabs.js +80 -91
- package/dist/esm/components/Tooltip/SpecTooltip.js +69 -0
- package/dist/esm/components/Tooltip/Tooltip.js +42 -85
- package/dist/esm/index.js +162 -158
- package/dist/esm/packages/ui/src/components/calendar-logic.js +83 -0
- package/dist/esm/packages/ui/src/components/calendar.js +459 -184
- package/dist/esm/styles/index.css +1 -1
- package/dist/esm/utils/animations.js +36 -44
- package/dist/esm/utils/date-format.js +162 -0
- package/dist/types/components/Calendar/Calendar.d.ts +5 -5
- package/dist/types/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/types/components/Calendar/index.d.ts +1 -1
- package/dist/types/components/Calendar/index.d.ts.map +1 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/types/components/Checkbox/Confetti.d.ts +2 -0
- package/dist/types/components/Checkbox/Confetti.d.ts.map +1 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/types/components/DatePicker/RangePicker.d.ts.map +1 -1
- package/dist/types/components/DatePicker/TimePicker.d.ts.map +1 -1
- package/dist/types/components/Marquee/Marquee.d.ts +1 -1
- package/dist/types/components/Slider/Slider.d.ts +1 -1
- package/dist/types/components/Slider/Slider.d.ts.map +1 -1
- package/dist/types/components/Slider/SpecSliderLabel.d.ts +14 -0
- package/dist/types/components/Slider/SpecSliderLabel.d.ts.map +1 -0
- package/dist/types/components/Table/TableFilter/data-table-filter-popover.d.ts.map +1 -1
- package/dist/types/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/types/components/Tooltip/SpecTooltip.d.ts +11 -0
- package/dist/types/components/Tooltip/SpecTooltip.d.ts.map +1 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/components/Upload/Upload.d.ts +1 -1
- package/dist/types/packages/ui/src/components/badge.d.ts +2 -2
- package/dist/types/packages/ui/src/components/button.d.ts +1 -1
- package/dist/types/packages/ui/src/components/calendar-logic.d.ts +72 -0
- package/dist/types/packages/ui/src/components/calendar-logic.d.ts.map +1 -0
- package/dist/types/packages/ui/src/components/calendar.d.ts +95 -6
- package/dist/types/packages/ui/src/components/calendar.d.ts.map +1 -1
- package/dist/types/utils/animations.d.ts +0 -19
- package/dist/types/utils/animations.d.ts.map +1 -1
- package/dist/types/utils/date-format.d.ts +24 -0
- package/dist/types/utils/date-format.d.ts.map +1 -0
- package/package.json +2 -3
- package/dist/cjs/utils/css.cjs +0 -1
- package/dist/esm/utils/css.js +0 -24
- package/dist/types/utils/css.d.ts +0 -4
- package/dist/types/utils/css.d.ts.map +0 -1
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsxs as R, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import * as b from "react";
|
|
3
3
|
import { Calendar as xe } from "../../packages/ui/src/components/calendar.js";
|
|
4
|
-
import { Popover as Ce, PopoverTrigger as
|
|
5
|
-
import { Drawer as Se, DrawerTrigger as
|
|
6
|
-
import { cn as
|
|
4
|
+
import { Popover as Ce, PopoverTrigger as $e, PopoverContent as Pe } from "../../packages/ui/src/components/popover.js";
|
|
5
|
+
import { Drawer as Se, DrawerTrigger as Ve, DrawerContent as ke, DrawerHeader as Oe, DrawerTitle as je, DrawerDescription as Le } from "../../packages/ui/src/components/drawer.js";
|
|
6
|
+
import { cn as T } from "../../packages/ui/src/lib/utils.js";
|
|
7
7
|
import { TimePicker as ce } from "./TimePicker.js";
|
|
8
|
-
import { CalendarIcon as
|
|
8
|
+
import { CalendarIcon as Ee, MoveRight as Ae } from "lucide-react";
|
|
9
9
|
import { isMobile as P } from "react-device-detect";
|
|
10
|
-
import { format as O, parse as Be, isValid as Ue } from "date-fns";
|
|
11
|
-
import { enUS as Ye, vi as _e } from "date-fns/locale";
|
|
12
10
|
import { DATE_FORMAT as me } from "../../constants/common.js";
|
|
13
|
-
import { FloatingLabel as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
import { FloatingLabel as Be } from "../FloatLabel.js";
|
|
12
|
+
import { parseDate as Ue, formatDate as k } from "../../utils/date-format.js";
|
|
13
|
+
import { enUS as Ye, vi as _e } from "../../packages/ui/src/components/calendar-logic.js";
|
|
14
|
+
import Ke from "../Button/Button.js";
|
|
15
|
+
import qe from "../Input/Input.js";
|
|
16
|
+
function Ge(w, d = me, C) {
|
|
17
|
+
return w ? k(w, d, C) : "";
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
return Ue(h) ? h : void 0;
|
|
22
|
-
};
|
|
23
|
-
function Qe(w) {
|
|
19
|
+
const D = (w, d = me) => Ue(w, d, /* @__PURE__ */ new Date());
|
|
20
|
+
function Je(w) {
|
|
24
21
|
return w.replace(/dd|MM|yyyy/g, (d) => {
|
|
25
22
|
switch (d) {
|
|
26
23
|
case "dd":
|
|
@@ -43,61 +40,61 @@ function Qe(w) {
|
|
|
43
40
|
}
|
|
44
41
|
});
|
|
45
42
|
}
|
|
46
|
-
function
|
|
43
|
+
function fo({
|
|
47
44
|
label: w,
|
|
48
45
|
value: d,
|
|
49
|
-
placeholder:
|
|
50
|
-
onChange:
|
|
46
|
+
placeholder: C,
|
|
47
|
+
onChange: N,
|
|
51
48
|
onSelect: c,
|
|
52
49
|
calendarClassName: fe,
|
|
53
50
|
side: le = "bottom",
|
|
54
51
|
align: ue = "end",
|
|
55
|
-
format:
|
|
52
|
+
format: $ = "dd/MM/yyyy",
|
|
56
53
|
language: ge = "vi",
|
|
57
|
-
mask:
|
|
54
|
+
mask: O,
|
|
58
55
|
closeOnSelect: we = !1,
|
|
59
|
-
showOutsideDays:
|
|
60
|
-
calendarConfig:
|
|
56
|
+
showOutsideDays: he = !0,
|
|
57
|
+
calendarConfig: j,
|
|
61
58
|
timeConfig: Z,
|
|
62
59
|
desktopMode: S = "popover",
|
|
63
60
|
mobileMode: ee = "drawer",
|
|
64
|
-
children:
|
|
65
|
-
separator:
|
|
66
|
-
showTime:
|
|
67
|
-
timeFormat:
|
|
61
|
+
children: L,
|
|
62
|
+
separator: ve = /* @__PURE__ */ m(Ae, { className: "ds:size-5" }),
|
|
63
|
+
showTime: y = !1,
|
|
64
|
+
timeFormat: h = "HH:mm",
|
|
68
65
|
hideDate: oe = !1,
|
|
69
|
-
numberOfMonths:
|
|
70
|
-
variant:
|
|
66
|
+
numberOfMonths: pe = 1,
|
|
67
|
+
variant: be = "default",
|
|
71
68
|
color: De = "primary",
|
|
72
69
|
...n
|
|
73
70
|
}) {
|
|
74
|
-
const te =
|
|
75
|
-
let l,
|
|
76
|
-
typeof
|
|
71
|
+
const te = b.useId();
|
|
72
|
+
let l, E;
|
|
73
|
+
typeof $ == "string" ? (l = $, E = $) : (l = $.input, E = $.output);
|
|
77
74
|
let A;
|
|
78
|
-
|
|
79
|
-
const re = d?.from ?
|
|
75
|
+
O === !0 ? A = Je(l) : typeof O == "string" && (A = O);
|
|
76
|
+
const re = d?.from ? D(d.from, l) : void 0, ye = d?.to ? D(d.to, l) : void 0, ze = {
|
|
80
77
|
from: re,
|
|
81
78
|
to: ye
|
|
82
|
-
}, [se,
|
|
79
|
+
}, [se, V] = b.useState(!1), [s, f] = b.useState(ze), [Me, B] = b.useState(
|
|
83
80
|
re || /* @__PURE__ */ new Date()
|
|
84
|
-
), [
|
|
81
|
+
), [H, v] = b.useState(d?.from || ""), [I, p] = b.useState(d?.to || ""), [U, Y] = b.useState(void 0), [_, K] = b.useState(void 0), q = b.useRef(null), G = b.useRef(null), Fe = !!(H.trim() || I.trim()), J = j?.locale ? j?.locale : ge === "en" ? Ye : _e, t = (e) => {
|
|
85
82
|
if (!e) return "";
|
|
86
|
-
let o =
|
|
87
|
-
return
|
|
83
|
+
let o = Ge(e, E, J);
|
|
84
|
+
return y && (o += ` ${k(e, h)}`), o;
|
|
88
85
|
}, Ne = (e) => {
|
|
89
86
|
f(e);
|
|
90
87
|
const o = t(e?.from), r = t(e?.to);
|
|
91
|
-
|
|
88
|
+
v(o), p(r), c?.(e, { from: o, to: r });
|
|
92
89
|
}, Re = (e) => {
|
|
93
|
-
if (
|
|
94
|
-
|
|
90
|
+
if (v(e), e.trim() === "") {
|
|
91
|
+
v(""), p("");
|
|
95
92
|
const u = { from: void 0, to: void 0 };
|
|
96
93
|
f(u), c?.(u, u);
|
|
97
94
|
return;
|
|
98
95
|
}
|
|
99
96
|
let o;
|
|
100
|
-
|
|
97
|
+
y ? o = D(e, `${l} ${h}`) : o = D(e, l);
|
|
101
98
|
const r = { from: o, to: s?.to };
|
|
102
99
|
o ? (f(r), B(o), Y(o), c?.(r, {
|
|
103
100
|
from: t(o),
|
|
@@ -108,13 +105,13 @@ function lo({
|
|
|
108
105
|
}));
|
|
109
106
|
}, Te = (e) => {
|
|
110
107
|
if (p(e), e.trim() === "") {
|
|
111
|
-
|
|
108
|
+
v(""), p("");
|
|
112
109
|
const u = { from: void 0, to: void 0 };
|
|
113
110
|
f(u), c?.(u, u);
|
|
114
111
|
return;
|
|
115
112
|
}
|
|
116
113
|
let o;
|
|
117
|
-
|
|
114
|
+
y ? o = D(e, `${l} ${h}`) : o = D(e, l);
|
|
118
115
|
const r = {
|
|
119
116
|
from: s?.from,
|
|
120
117
|
to: o
|
|
@@ -140,10 +137,10 @@ function lo({
|
|
|
140
137
|
from: o,
|
|
141
138
|
to: s?.to
|
|
142
139
|
};
|
|
143
|
-
f(r),
|
|
140
|
+
f(r), v(t(o)), c?.(r, {
|
|
144
141
|
from: t(o),
|
|
145
142
|
to: t(s?.to)
|
|
146
|
-
}),
|
|
143
|
+
}), N?.(r, {
|
|
147
144
|
from: t(o),
|
|
148
145
|
to: t(s?.to)
|
|
149
146
|
});
|
|
@@ -165,29 +162,29 @@ function lo({
|
|
|
165
162
|
f(r), p(t(o)), c?.(r, {
|
|
166
163
|
from: t(s?.from),
|
|
167
164
|
to: t(o)
|
|
168
|
-
}),
|
|
165
|
+
}), N?.(r, {
|
|
169
166
|
from: t(s?.from),
|
|
170
167
|
to: t(o)
|
|
171
168
|
});
|
|
172
169
|
}
|
|
173
|
-
}, ne =
|
|
174
|
-
fromValue:
|
|
175
|
-
toValue:
|
|
170
|
+
}, ne = L ? L({
|
|
171
|
+
fromValue: H,
|
|
172
|
+
toValue: I,
|
|
176
173
|
range: s,
|
|
177
174
|
onSelect: Ne,
|
|
178
175
|
onFromChange: Re,
|
|
179
176
|
onToChange: Te
|
|
180
|
-
}) : /* @__PURE__ */
|
|
181
|
-
|
|
177
|
+
}) : /* @__PURE__ */ R(
|
|
178
|
+
Ke,
|
|
182
179
|
{
|
|
183
180
|
variant: "ghost",
|
|
184
181
|
className: "ds:!p-1 ds:!leading-0 ds:h-auto ds:rounded ds:hover:bg-accent ds:transition-colors",
|
|
185
182
|
size: n?.size,
|
|
186
183
|
children: [
|
|
187
184
|
/* @__PURE__ */ m(
|
|
188
|
-
|
|
185
|
+
Ee,
|
|
189
186
|
{
|
|
190
|
-
className:
|
|
187
|
+
className: T({
|
|
191
188
|
"ds:size-3": n.size === "xs" || n.size === "sm",
|
|
192
189
|
"ds:size-3.5": !n.size || n.size === "normal",
|
|
193
190
|
"ds:size-4": n.size === "lg" || n.size === "xl"
|
|
@@ -197,26 +194,26 @@ function lo({
|
|
|
197
194
|
/* @__PURE__ */ m("span", { className: "ds:sr-only", children: "Select date range" })
|
|
198
195
|
]
|
|
199
196
|
}
|
|
200
|
-
), ie = /* @__PURE__ */
|
|
197
|
+
), ie = /* @__PURE__ */ R(
|
|
201
198
|
"div",
|
|
202
199
|
{
|
|
203
|
-
className:
|
|
200
|
+
className: T("ds:flex ds:items-stretch", y && !oe ? "ds:gap-0" : ""),
|
|
204
201
|
children: [
|
|
205
202
|
!oe && /* @__PURE__ */ m(
|
|
206
203
|
xe,
|
|
207
204
|
{
|
|
208
|
-
...
|
|
205
|
+
...j,
|
|
209
206
|
mode: "range",
|
|
210
207
|
selected: s,
|
|
211
208
|
captionLayout: "dropdown",
|
|
212
209
|
month: Me,
|
|
213
210
|
onMonthChange: B,
|
|
214
|
-
numberOfMonths: P ? 1 :
|
|
215
|
-
variant:
|
|
211
|
+
numberOfMonths: P ? 1 : pe || 1,
|
|
212
|
+
variant: be,
|
|
216
213
|
color: De,
|
|
217
214
|
onSelect: (e) => {
|
|
218
215
|
let o = e;
|
|
219
|
-
if (
|
|
216
|
+
if (y) {
|
|
220
217
|
const i = U, a = _;
|
|
221
218
|
o = {
|
|
222
219
|
from: e?.from ? new Date(
|
|
@@ -239,20 +236,20 @@ function lo({
|
|
|
239
236
|
}
|
|
240
237
|
f(o);
|
|
241
238
|
const r = t(o?.from), u = t(o?.to);
|
|
242
|
-
|
|
239
|
+
v(r), p(u), c?.(o, {
|
|
243
240
|
from: r,
|
|
244
241
|
to: u
|
|
245
|
-
}),
|
|
242
|
+
}), N?.(o, {
|
|
246
243
|
from: r,
|
|
247
244
|
to: u
|
|
248
|
-
}), we && o?.from && o?.to && !
|
|
245
|
+
}), we && o?.from && o?.to && !y && V(!1);
|
|
249
246
|
},
|
|
250
247
|
locale: J,
|
|
251
248
|
formatters: {
|
|
252
249
|
formatMonthDropdown: (e) => e.toLocaleString(J.code, { month: "short" })
|
|
253
250
|
},
|
|
254
|
-
showOutsideDays:
|
|
255
|
-
className:
|
|
251
|
+
showOutsideDays: he,
|
|
252
|
+
className: T(
|
|
256
253
|
"ds:mx-auto",
|
|
257
254
|
{
|
|
258
255
|
"ds:[--cell-size:clamp(0px,calc(100vw/7.5),52px)] ds:mb-8 ds:bg-transparent": P || S === "drawer",
|
|
@@ -262,17 +259,17 @@ function lo({
|
|
|
262
259
|
)
|
|
263
260
|
}
|
|
264
261
|
),
|
|
265
|
-
|
|
262
|
+
y && /* @__PURE__ */ R("div", { className: "ds:flex ds:gap-0 ds:border-l ds:border-border", children: [
|
|
266
263
|
/* @__PURE__ */ m(
|
|
267
264
|
ce,
|
|
268
265
|
{
|
|
269
266
|
...Z?.[0],
|
|
270
|
-
value: U ?
|
|
267
|
+
value: U ? k(U, h) : void 0,
|
|
271
268
|
onSelect: He,
|
|
272
|
-
format:
|
|
269
|
+
format: h,
|
|
273
270
|
showHours: !0,
|
|
274
271
|
showMinutes: !0,
|
|
275
|
-
showSeconds:
|
|
272
|
+
showSeconds: h === "HH:mm:ss",
|
|
276
273
|
standalone: !1
|
|
277
274
|
}
|
|
278
275
|
),
|
|
@@ -281,24 +278,24 @@ function lo({
|
|
|
281
278
|
ce,
|
|
282
279
|
{
|
|
283
280
|
...Z?.[1],
|
|
284
|
-
value: _ ?
|
|
281
|
+
value: _ ? k(_, h) : void 0,
|
|
285
282
|
onSelect: Ie,
|
|
286
|
-
format:
|
|
283
|
+
format: h,
|
|
287
284
|
showHours: !0,
|
|
288
285
|
showMinutes: !0,
|
|
289
|
-
showSeconds:
|
|
286
|
+
showSeconds: h === "HH:mm:ss",
|
|
290
287
|
standalone: !1
|
|
291
288
|
}
|
|
292
289
|
)
|
|
293
290
|
] })
|
|
294
291
|
]
|
|
295
292
|
}
|
|
296
|
-
), Q = /* @__PURE__ */
|
|
297
|
-
/* @__PURE__ */ m(
|
|
293
|
+
), Q = /* @__PURE__ */ R(Ce, { open: se, onOpenChange: V, children: [
|
|
294
|
+
/* @__PURE__ */ m($e, { asChild: !0, disabled: n.disabled, children: ne }),
|
|
298
295
|
/* @__PURE__ */ m(
|
|
299
296
|
Pe,
|
|
300
297
|
{
|
|
301
|
-
className:
|
|
298
|
+
className: T(
|
|
302
299
|
"ds:w-auto ds:overflow-hidden ds:p-0",
|
|
303
300
|
"ds:backdrop-blur ds:bg-background/50"
|
|
304
301
|
),
|
|
@@ -307,31 +304,31 @@ function lo({
|
|
|
307
304
|
children: ie
|
|
308
305
|
}
|
|
309
306
|
)
|
|
310
|
-
] }), W = /* @__PURE__ */
|
|
311
|
-
/* @__PURE__ */ m(
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
|
|
307
|
+
] }), W = /* @__PURE__ */ R(Se, { open: se, onOpenChange: V, children: [
|
|
308
|
+
/* @__PURE__ */ m(Ve, { asChild: !0, children: ne }),
|
|
309
|
+
/* @__PURE__ */ R(
|
|
310
|
+
ke,
|
|
314
311
|
{
|
|
315
|
-
className:
|
|
312
|
+
className: T(
|
|
316
313
|
"ds:w-auto ds:overflow-hidden ds:p-0",
|
|
317
314
|
"ds:backdrop-blur ds:bg-background"
|
|
318
315
|
),
|
|
319
316
|
children: [
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
-
/* @__PURE__ */ m(
|
|
322
|
-
/* @__PURE__ */ m(
|
|
317
|
+
/* @__PURE__ */ R(Oe, { className: "ds:sr-only", children: [
|
|
318
|
+
/* @__PURE__ */ m(je, { children: "Select date range" }),
|
|
319
|
+
/* @__PURE__ */ m(Le, { children: "Set your date range" })
|
|
323
320
|
] }),
|
|
324
321
|
ie
|
|
325
322
|
]
|
|
326
323
|
}
|
|
327
324
|
)
|
|
328
325
|
] });
|
|
329
|
-
if (
|
|
326
|
+
if (L)
|
|
330
327
|
return (P ? ee : S) === "drawer" ? W : Q;
|
|
331
328
|
const ae = (e, o, r, u) => {
|
|
332
329
|
const i = e === "from";
|
|
333
330
|
return /* @__PURE__ */ m(
|
|
334
|
-
|
|
331
|
+
qe,
|
|
335
332
|
{
|
|
336
333
|
...n,
|
|
337
334
|
...u,
|
|
@@ -339,80 +336,80 @@ function lo({
|
|
|
339
336
|
id: te,
|
|
340
337
|
size: n.isFloatLabel ? n.size ? n.size : "xl" : n.size,
|
|
341
338
|
className: n.className,
|
|
342
|
-
inputClassName:
|
|
339
|
+
inputClassName: T(
|
|
343
340
|
"ds:border-0 ds:focus:ring-0 ds:rounded-none ds:hover:bg-transparent ds:active:bg-transparent ds:focus-visible:ring-0 ds:focus-visible:border-0 ds:shadow-none",
|
|
344
341
|
i ? "ds:pr-0" : ""
|
|
345
342
|
),
|
|
346
343
|
label: n.isFloatLabel && typeof w == "object" ? i ? w?.from || "" : w?.to || "" : "",
|
|
347
|
-
placeholder: typeof
|
|
344
|
+
placeholder: typeof C == "object" ? i ? C?.from || "" : C?.to || "" : C,
|
|
348
345
|
clearable: !i,
|
|
349
346
|
value: o,
|
|
350
347
|
mask: A,
|
|
351
348
|
onChange: (a) => {
|
|
352
|
-
const
|
|
353
|
-
if (r(
|
|
354
|
-
|
|
355
|
-
const
|
|
356
|
-
f(
|
|
349
|
+
const z = a.target.value;
|
|
350
|
+
if (r(z), z.trim() === "") {
|
|
351
|
+
v(""), p("");
|
|
352
|
+
const M = { from: void 0, to: void 0 };
|
|
353
|
+
f(M), c?.(M, M), N?.(M, M);
|
|
357
354
|
return;
|
|
358
355
|
}
|
|
359
356
|
let g;
|
|
360
|
-
|
|
361
|
-
const
|
|
357
|
+
y ? g = D(z, `${l} ${h}`) : g = D(z, l);
|
|
358
|
+
const x = i ? { from: g, to: s?.to } : { from: s?.from, to: g };
|
|
362
359
|
if (g) {
|
|
363
|
-
f(
|
|
364
|
-
const
|
|
360
|
+
f(x), i && B(g), i ? Y(g) : K(g);
|
|
361
|
+
const M = t(
|
|
365
362
|
i ? g : s?.from
|
|
366
363
|
), de = t(i ? s?.to : g);
|
|
367
|
-
c?.(
|
|
368
|
-
from: i ?
|
|
369
|
-
to: i ?
|
|
364
|
+
c?.(x, { from: M, to: de }), N?.(x, {
|
|
365
|
+
from: i ? z : H,
|
|
366
|
+
to: i ? I : z
|
|
370
367
|
});
|
|
371
368
|
} else
|
|
372
|
-
c?.(
|
|
369
|
+
c?.(x, {
|
|
373
370
|
from: t(s?.from),
|
|
374
371
|
to: i ? t(s?.to) : void 0
|
|
375
|
-
}),
|
|
372
|
+
}), N?.(x, {
|
|
376
373
|
from: t(s?.from),
|
|
377
374
|
to: i ? t(s?.to) : void 0
|
|
378
375
|
});
|
|
379
376
|
},
|
|
380
377
|
onClear: i ? void 0 : () => {
|
|
381
|
-
|
|
378
|
+
v(""), p("");
|
|
382
379
|
const a = { from: void 0, to: void 0 };
|
|
383
|
-
f(a), c?.(a, a),
|
|
380
|
+
f(a), c?.(a, a), N?.(a, a);
|
|
384
381
|
},
|
|
385
382
|
onBlur: () => {
|
|
386
383
|
const a = document.activeElement;
|
|
387
384
|
a !== q.current && a !== G.current && setTimeout(() => {
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
390
|
-
const g = (
|
|
391
|
-
if (
|
|
385
|
+
const z = document.activeElement;
|
|
386
|
+
if (z !== q.current && z !== G.current) {
|
|
387
|
+
const g = (F) => {
|
|
388
|
+
if (F.trim() === "") return !0;
|
|
392
389
|
let X;
|
|
393
|
-
return
|
|
394
|
-
},
|
|
395
|
-
if (!
|
|
396
|
-
|
|
397
|
-
const
|
|
390
|
+
return y ? X = D(F, `${l} ${h}`) : X = D(F, l), !!X;
|
|
391
|
+
}, x = g(H), M = g(I);
|
|
392
|
+
if (!x || !M || H.trim() && !I.trim() || !H.trim() && I.trim()) {
|
|
393
|
+
v(""), p("");
|
|
394
|
+
const F = {
|
|
398
395
|
from: void 0,
|
|
399
396
|
to: void 0
|
|
400
397
|
};
|
|
401
|
-
f(
|
|
398
|
+
f(F), c?.(F, F), N?.(F, F);
|
|
402
399
|
}
|
|
403
400
|
}
|
|
404
401
|
}, 100);
|
|
405
402
|
},
|
|
406
403
|
onKeyDown: (a) => {
|
|
407
|
-
a.key === "ArrowDown" && (a.preventDefault(),
|
|
404
|
+
a.key === "ArrowDown" && (a.preventDefault(), V(!0));
|
|
408
405
|
}
|
|
409
406
|
}
|
|
410
407
|
);
|
|
411
408
|
};
|
|
412
|
-
return /* @__PURE__ */
|
|
409
|
+
return /* @__PURE__ */ R(
|
|
413
410
|
"div",
|
|
414
411
|
{
|
|
415
|
-
className:
|
|
412
|
+
className: T(
|
|
416
413
|
"ds:group ds:relative ds:flex ds:items-center ds:border ds:rounded-md ds:focus-within:ring-2 ds:focus-within:ring-offset-2 ds:bg-background ds:transition-[color,box-shadow]",
|
|
417
414
|
{
|
|
418
415
|
"ds:border-input ds:focus-within:ring-ring": !n.state,
|
|
@@ -422,21 +419,21 @@ function lo({
|
|
|
422
419
|
}
|
|
423
420
|
),
|
|
424
421
|
children: [
|
|
425
|
-
ae("from",
|
|
422
|
+
ae("from", H, v),
|
|
426
423
|
/* @__PURE__ */ m(
|
|
427
424
|
"span",
|
|
428
425
|
{
|
|
429
|
-
className:
|
|
426
|
+
className: T("ds:text-muted-foreground ds:select-none ds:pl-2", {
|
|
430
427
|
"ds:opacity-30": n.disabled
|
|
431
428
|
}),
|
|
432
|
-
children:
|
|
429
|
+
children: ve
|
|
433
430
|
}
|
|
434
431
|
),
|
|
435
|
-
ae("to",
|
|
432
|
+
ae("to", I, p, {
|
|
436
433
|
suffixIcon: P ? ee === "drawer" ? W : Q : S === "drawer" ? W : Q
|
|
437
434
|
}),
|
|
438
435
|
n.isFloatLabel && typeof w == "string" && /* @__PURE__ */ m(
|
|
439
|
-
|
|
436
|
+
Be,
|
|
440
437
|
{
|
|
441
438
|
htmlFor: te,
|
|
442
439
|
size: n.size,
|
|
@@ -451,5 +448,5 @@ function lo({
|
|
|
451
448
|
);
|
|
452
449
|
}
|
|
453
450
|
export {
|
|
454
|
-
|
|
451
|
+
fo as RangePicker
|
|
455
452
|
};
|