@yuno-payments/dashboard-design-system 0.0.64 → 0.0.65
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.
|
@@ -8,5 +8,10 @@ export interface DatePickerProps {
|
|
|
8
8
|
minDate?: Date;
|
|
9
9
|
maxDate?: Date;
|
|
10
10
|
dateFormat?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
orientation?: "vertical" | "horizontal" | "responsive";
|
|
15
|
+
id?: string;
|
|
11
16
|
}
|
|
12
|
-
export declare function DatePicker({ date, onDateChange, placeholder, disabled, className, iconPosition, minDate, maxDate, dateFormat, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function DatePicker({ date, onDateChange, placeholder, disabled, className, iconPosition, minDate, maxDate, dateFormat, label, error, description, orientation, id, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,58 +1,83 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import "react";
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Calendar as
|
|
6
|
-
import { Popover as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { j as e } from "../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { useId as C } from "react";
|
|
3
|
+
import { cn as m } from "../../lib/utils.js";
|
|
4
|
+
import { Button as D } from "./button.js";
|
|
5
|
+
import { Calendar as F } from "./calendar.js";
|
|
6
|
+
import { Popover as N, PopoverTrigger as P, PopoverContent as b } from "./popover.js";
|
|
7
|
+
import { Field as I, FieldLabel as k, FieldDescription as E, FieldError as $ } from "./field.js";
|
|
8
|
+
import M from "../../node_modules/lucide-react/dist/esm/icons/calendar.js";
|
|
9
|
+
import B from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
|
|
10
|
+
import { formatDate as S } from "../../node_modules/date-fns/format.js";
|
|
11
|
+
function O({
|
|
12
|
+
date: s,
|
|
13
|
+
onDateChange: f,
|
|
14
|
+
placeholder: x = "Pick a date",
|
|
15
|
+
disabled: p = !1,
|
|
16
|
+
className: n,
|
|
17
|
+
iconPosition: d = "start",
|
|
18
|
+
minDate: u,
|
|
19
|
+
maxDate: h,
|
|
20
|
+
dateFormat: j = "MMM d, yyyy",
|
|
21
|
+
label: o,
|
|
22
|
+
error: t,
|
|
23
|
+
description: i,
|
|
24
|
+
orientation: v = "vertical",
|
|
25
|
+
id: w
|
|
20
26
|
}) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
d,
|
|
27
|
+
const y = C(), r = w || y, a = !!t, g = d === "start", l = d === "end", c = /* @__PURE__ */ e.jsxs(N, { children: [
|
|
28
|
+
/* @__PURE__ */ e.jsx(P, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
29
|
+
D,
|
|
25
30
|
{
|
|
26
31
|
variant: "outline",
|
|
27
|
-
className:
|
|
32
|
+
className: m(
|
|
28
33
|
"w-full text-left font-normal h-9",
|
|
29
|
-
|
|
30
|
-
!
|
|
31
|
-
|
|
34
|
+
l ? "justify-between" : "justify-start",
|
|
35
|
+
!s && "text-muted-foreground",
|
|
36
|
+
a && "border-destructive focus-visible:border-destructive",
|
|
37
|
+
n
|
|
32
38
|
),
|
|
33
|
-
disabled:
|
|
39
|
+
disabled: p,
|
|
40
|
+
"aria-invalid": a ? !0 : void 0,
|
|
41
|
+
"aria-describedby": i || t ? `${r}-description` : void 0,
|
|
42
|
+
id: r,
|
|
34
43
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
45
|
+
g && /* @__PURE__ */ e.jsx(M, { className: "h-4 w-4" }),
|
|
46
|
+
s ? S(s, j) : /* @__PURE__ */ e.jsx("span", { children: x })
|
|
38
47
|
] }),
|
|
39
|
-
|
|
48
|
+
l && /* @__PURE__ */ e.jsx(B, { className: "h-4 w-4 opacity-50" })
|
|
40
49
|
]
|
|
41
50
|
}
|
|
42
51
|
) }),
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
|
|
52
|
+
/* @__PURE__ */ e.jsx(b, { className: "w-auto p-0", children: /* @__PURE__ */ e.jsx(
|
|
53
|
+
F,
|
|
45
54
|
{
|
|
46
55
|
mode: "single",
|
|
47
|
-
selected:
|
|
48
|
-
onSelect:
|
|
56
|
+
selected: s,
|
|
57
|
+
onSelect: f,
|
|
49
58
|
initialFocus: !0,
|
|
50
|
-
fromDate:
|
|
51
|
-
toDate:
|
|
59
|
+
fromDate: u,
|
|
60
|
+
toDate: h
|
|
52
61
|
}
|
|
53
62
|
) })
|
|
54
63
|
] });
|
|
64
|
+
return o || t || i ? /* @__PURE__ */ e.jsxs(
|
|
65
|
+
I,
|
|
66
|
+
{
|
|
67
|
+
orientation: v,
|
|
68
|
+
"data-invalid": a,
|
|
69
|
+
className: m("w-full", n),
|
|
70
|
+
children: [
|
|
71
|
+
o && /* @__PURE__ */ e.jsx(k, { htmlFor: r, children: o }),
|
|
72
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [
|
|
73
|
+
c,
|
|
74
|
+
i && !t && /* @__PURE__ */ e.jsx(E, { id: `${r}-description`, children: i }),
|
|
75
|
+
t && /* @__PURE__ */ e.jsx($, { id: `${r}-description`, children: t })
|
|
76
|
+
] })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
) : c;
|
|
55
80
|
}
|
|
56
81
|
export {
|
|
57
|
-
|
|
82
|
+
O as DatePicker
|
|
58
83
|
};
|