impact-nova 0.1.11 → 0.1.13
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/ui/ag-grid-react/headers/custom-header.js +42 -35
- package/dist/components/ui/ag-grid-react/headers/header-search-input.d.ts +4 -1
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +217 -209
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.d.ts +5 -1
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.js +210 -204
- package/dist/components/ui/ag-grid-react/process-backend-columndefs.js +26 -11
- package/dist/components/ui/calendar.d.ts +2 -1
- package/dist/components/ui/calendar.js +272 -264
- package/dist/components/ui/date-picker/date-picker.js +59 -55
- package/dist/components/ui/date-picker/date-range-picker.js +76 -73
- package/dist/components/ui/date-picker/month-picker.js +67 -63
- package/dist/components/ui/date-picker/month-range-picker.js +62 -58
- package/dist/components/ui/date-picker/week-picker.js +51 -47
- package/dist/components/ui/date-picker/week-range-picker.js +55 -51
- package/dist/components/ui/types/ag-grid.types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import { format as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
10
|
-
const
|
|
1
|
+
import { jsxs as C, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import * as l from "react";
|
|
3
|
+
import { X as R } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as T } from "../../../icons/index.js";
|
|
5
|
+
import { format as g, parse as y, isValid as k } from "date-fns";
|
|
6
|
+
import { cn as L, maskDate as X } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as q } from "../input.js";
|
|
8
|
+
import { Popover as z, PopoverTrigger as G, PopoverContent as H } from "../popover.js";
|
|
9
|
+
import { Calendar as J } from "../calendar.js";
|
|
10
|
+
const K = l.forwardRef(
|
|
11
11
|
({
|
|
12
12
|
value: n,
|
|
13
13
|
onChange: i,
|
|
@@ -22,87 +22,91 @@ const J = a.forwardRef(
|
|
|
22
22
|
className: N,
|
|
23
23
|
...M
|
|
24
24
|
}, A) => {
|
|
25
|
-
const [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, [n, t]),
|
|
29
|
-
console.log("[DatePicker] useEffect - open:",
|
|
30
|
-
}, [
|
|
25
|
+
const [r, d] = l.useState(!1), [c, s] = l.useState(n), [h, f] = l.useState(n ? g(n, t) : ""), [O, m] = l.useState(n || /* @__PURE__ */ new Date());
|
|
26
|
+
l.useEffect(() => {
|
|
27
|
+
f(n ? g(n, t) : "");
|
|
28
|
+
}, [n, t]), l.useEffect(() => {
|
|
29
|
+
console.log("[DatePicker] useEffect - open:", r, "value:", n, "pendingDate:", c), r && (s(n), m(n || /* @__PURE__ */ new Date()));
|
|
30
|
+
}, [r]);
|
|
31
31
|
const V = (e) => {
|
|
32
|
-
console.log("[DatePicker] handleSelect called:", e),
|
|
32
|
+
console.log("[DatePicker] handleSelect called:", e), s(e), p || (console.log("[DatePicker] No footer - applying immediately"), i?.(e), d(!1));
|
|
33
33
|
}, B = (e) => {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
}, E = () => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
const o = e;
|
|
35
|
+
f(o ? g(o, t) : "");
|
|
36
|
+
}, E = (e) => {
|
|
37
|
+
const o = e !== void 0 ? e : c;
|
|
38
|
+
console.log("[DatePicker] handleApply called, appliedDate:", e, "pendingDate:", c, "using:", o), i?.(o), d(!1);
|
|
39
|
+
}, j = () => {
|
|
40
|
+
console.log("[DatePicker] handleCancel called"), s(n), d(!1);
|
|
41
|
+
}, D = () => {
|
|
42
|
+
console.log("[DatePicker] handleClear called"), s(void 0), f(""), i?.(void 0), p || d(!1);
|
|
40
43
|
};
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
44
|
+
return /* @__PURE__ */ C(z, { open: r, onOpenChange: d, children: [
|
|
45
|
+
/* @__PURE__ */ a(G, { asChild: !0, children: /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
46
|
+
q,
|
|
44
47
|
{
|
|
45
48
|
ref: A,
|
|
46
|
-
value:
|
|
49
|
+
value: h,
|
|
47
50
|
onChange: (e) => {
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
+
const o = X(e.target.value, t);
|
|
52
|
+
if (f(o), o === "") {
|
|
53
|
+
s(void 0), p || i?.(void 0);
|
|
51
54
|
return;
|
|
52
55
|
}
|
|
53
|
-
const u =
|
|
54
|
-
k(u) && (
|
|
56
|
+
const u = y(o, t, /* @__PURE__ */ new Date());
|
|
57
|
+
k(u) && (s(u), m(u), p || i?.(u));
|
|
55
58
|
},
|
|
56
59
|
onBlur: () => {
|
|
57
|
-
if (
|
|
58
|
-
|
|
60
|
+
if (h === "") {
|
|
61
|
+
D();
|
|
59
62
|
return;
|
|
60
63
|
}
|
|
61
|
-
const e =
|
|
62
|
-
k(e) ||
|
|
64
|
+
const e = y(h, t, /* @__PURE__ */ new Date());
|
|
65
|
+
k(e) || f(c ? g(c, t) : "");
|
|
63
66
|
},
|
|
64
|
-
onClick: (e) =>
|
|
65
|
-
placeholder:
|
|
67
|
+
onClick: (e) => r && e.stopPropagation(),
|
|
68
|
+
placeholder: r ? t : S,
|
|
66
69
|
disabled: P,
|
|
67
|
-
className:
|
|
68
|
-
suffix: /* @__PURE__ */
|
|
69
|
-
n && !P && /* @__PURE__ */
|
|
70
|
-
|
|
70
|
+
className: L("cursor-pointer", N),
|
|
71
|
+
suffix: /* @__PURE__ */ C("div", { className: "flex items-center gap-1", children: [
|
|
72
|
+
n && !P && /* @__PURE__ */ a(
|
|
73
|
+
R,
|
|
71
74
|
{
|
|
72
75
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
73
76
|
onClick: (e) => {
|
|
74
|
-
e.stopPropagation(),
|
|
77
|
+
e.stopPropagation(), D();
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
),
|
|
78
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ a(T, { className: "h-4 w-4 text-secondary-foreground" })
|
|
79
82
|
] }),
|
|
80
83
|
...M
|
|
81
84
|
}
|
|
82
85
|
) }) }),
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
|
|
86
|
+
/* @__PURE__ */ a(
|
|
87
|
+
H,
|
|
85
88
|
{
|
|
86
89
|
className: "w-auto p-0",
|
|
87
90
|
align: "start",
|
|
88
91
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
89
92
|
onInteractOutside: (e) => e.preventDefault(),
|
|
90
|
-
children: /* @__PURE__ */
|
|
91
|
-
|
|
93
|
+
children: /* @__PURE__ */ a(
|
|
94
|
+
J,
|
|
92
95
|
{
|
|
93
96
|
mode: "single",
|
|
94
|
-
selected:
|
|
97
|
+
selected: c,
|
|
95
98
|
onSelect: V,
|
|
99
|
+
onPendingChange: B,
|
|
96
100
|
month: O,
|
|
97
|
-
onMonthChange:
|
|
101
|
+
onMonthChange: m,
|
|
98
102
|
fromDate: v,
|
|
99
103
|
toDate: w,
|
|
100
104
|
fromYear: x,
|
|
101
105
|
toYear: I,
|
|
102
106
|
showFooter: p,
|
|
103
|
-
onApply:
|
|
104
|
-
onCancel:
|
|
105
|
-
onClear:
|
|
107
|
+
onApply: E,
|
|
108
|
+
onCancel: j,
|
|
109
|
+
onClear: D,
|
|
106
110
|
captionLayout: "dropdown"
|
|
107
111
|
}
|
|
108
112
|
)
|
|
@@ -111,7 +115,7 @@ const J = a.forwardRef(
|
|
|
111
115
|
] });
|
|
112
116
|
}
|
|
113
117
|
);
|
|
114
|
-
|
|
118
|
+
K.displayName = "DatePicker";
|
|
115
119
|
export {
|
|
116
|
-
|
|
120
|
+
K as DatePicker
|
|
117
121
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as u, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import * as c from "react";
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import { format as
|
|
3
|
+
import { X as Y } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as Z, Info as $ } from "../../../icons/index.js";
|
|
5
|
+
import { format as p, parse as k, isValid as S } from "date-fns";
|
|
6
6
|
import { cn as v, maskDate as I } from "../../../lib/utils.js";
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
9
|
-
const
|
|
7
|
+
import { Popover as _, PopoverTrigger as F, PopoverContent as ee } from "../popover.js";
|
|
8
|
+
import { Calendar as te } from "../calendar.js";
|
|
9
|
+
const ne = c.forwardRef(
|
|
10
10
|
({
|
|
11
11
|
value: t,
|
|
12
|
-
onChange:
|
|
12
|
+
onChange: f,
|
|
13
13
|
format: n = "MM/dd/yyyy",
|
|
14
14
|
startPlaceholder: M = "Start Date",
|
|
15
15
|
endPlaceholder: V = "End Date",
|
|
@@ -17,68 +17,71 @@ const te = c.forwardRef(
|
|
|
17
17
|
maxDate: O,
|
|
18
18
|
fromYear: j,
|
|
19
19
|
toYear: B,
|
|
20
|
-
showFooter:
|
|
20
|
+
showFooter: m = !0,
|
|
21
21
|
disabled: g,
|
|
22
22
|
label: D,
|
|
23
|
-
helperText:
|
|
24
|
-
prefix:
|
|
25
|
-
prefixClick:
|
|
26
|
-
isError:
|
|
27
|
-
size:
|
|
23
|
+
helperText: P,
|
|
24
|
+
prefix: oe,
|
|
25
|
+
prefixClick: re,
|
|
26
|
+
isError: h,
|
|
27
|
+
size: R,
|
|
28
28
|
required: E,
|
|
29
29
|
className: z,
|
|
30
30
|
...L
|
|
31
31
|
}, T) => {
|
|
32
|
-
const [l,
|
|
32
|
+
const [l, x] = c.useState(!1), [r, i] = c.useState(t), [X, b] = c.useState(t?.from ? p(t.from, n) : ""), [q, y] = c.useState(t?.to ? p(t.to, n) : ""), [G, w] = c.useState(t?.from || /* @__PURE__ */ new Date());
|
|
33
33
|
c.useEffect(() => {
|
|
34
|
-
b(t?.from ?
|
|
34
|
+
b(t?.from ? p(t.from, n) : ""), y(t?.to ? p(t.to, n) : "");
|
|
35
35
|
}, [t, n]), c.useEffect(() => {
|
|
36
|
-
console.log("[DateRangePicker] useEffect - open:", l, "value:", t, "pendingRange:",
|
|
36
|
+
console.log("[DateRangePicker] useEffect - open:", l, "value:", t, "pendingRange:", r), l && (i(t), w(t?.from || /* @__PURE__ */ new Date()));
|
|
37
37
|
}, [l]);
|
|
38
38
|
const H = (e) => {
|
|
39
|
-
console.log("[DateRangePicker] handleSelect called:", e), i(e), !
|
|
39
|
+
console.log("[DateRangePicker] handleSelect called:", e), i(e), !m && e?.from && e?.to && (console.log("[DateRangePicker] No footer - applying immediately"), f?.(e), x(!1));
|
|
40
40
|
}, J = (e) => {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
}, K = () => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
const o = e;
|
|
42
|
+
b(o?.from ? p(o.from, n) : ""), y(o?.to ? p(o.to, n) : "");
|
|
43
|
+
}, K = (e) => {
|
|
44
|
+
const o = e !== void 0 ? e : r;
|
|
45
|
+
console.log("[DateRangePicker] handleApply called, appliedRange:", e, "pendingRange:", r, "using:", o), f?.(o), x(!1);
|
|
46
|
+
}, Q = () => {
|
|
47
|
+
console.log("[DateRangePicker] handleCancel called"), i(t), x(!1);
|
|
48
|
+
}, C = () => {
|
|
49
|
+
console.log("[DateRangePicker] handleClear called"), i(void 0), b(""), y(""), f?.(void 0), m || x(!1);
|
|
50
|
+
}, U = (e) => {
|
|
51
|
+
const o = I(e.target.value, n);
|
|
52
|
+
if (b(o), o === "") {
|
|
53
|
+
const a = { from: void 0, to: r?.to };
|
|
54
|
+
i(a), m || f?.(a);
|
|
52
55
|
return;
|
|
53
56
|
}
|
|
54
|
-
const d =
|
|
57
|
+
const d = k(o, n, /* @__PURE__ */ new Date());
|
|
55
58
|
if (S(d)) {
|
|
56
|
-
const
|
|
57
|
-
i(
|
|
59
|
+
const a = { from: d, to: r?.to };
|
|
60
|
+
i(a), w(d), m || f?.(a);
|
|
58
61
|
}
|
|
59
|
-
},
|
|
60
|
-
const
|
|
61
|
-
if (y(
|
|
62
|
-
const
|
|
63
|
-
i(
|
|
62
|
+
}, W = (e) => {
|
|
63
|
+
const o = I(e.target.value, n);
|
|
64
|
+
if (y(o), o === "") {
|
|
65
|
+
const a = { from: r?.from, to: void 0 };
|
|
66
|
+
i(a), m || f?.(a);
|
|
64
67
|
return;
|
|
65
68
|
}
|
|
66
|
-
const d =
|
|
69
|
+
const d = k(o, n, /* @__PURE__ */ new Date());
|
|
67
70
|
if (S(d)) {
|
|
68
|
-
const
|
|
69
|
-
i(
|
|
71
|
+
const a = { from: r?.from, to: d };
|
|
72
|
+
i(a), d && w(d), m || f?.(a);
|
|
70
73
|
}
|
|
71
|
-
},
|
|
72
|
-
b(
|
|
74
|
+
}, N = () => {
|
|
75
|
+
b(r?.from ? p(r.from, n) : ""), y(r?.to ? p(r.to, n) : "");
|
|
73
76
|
};
|
|
74
|
-
return /* @__PURE__ */
|
|
75
|
-
D && /* @__PURE__ */
|
|
77
|
+
return /* @__PURE__ */ u("div", { className: "w-full space-y-1.5 min-w-[240px]", children: [
|
|
78
|
+
D && /* @__PURE__ */ u(
|
|
76
79
|
"label",
|
|
77
80
|
{
|
|
78
81
|
className: v(
|
|
79
82
|
"text-xs font-medium leading-[18px] text-[#60697d]",
|
|
80
83
|
g && "opacity-70",
|
|
81
|
-
|
|
84
|
+
h && "text-destructive"
|
|
82
85
|
),
|
|
83
86
|
children: [
|
|
84
87
|
D,
|
|
@@ -87,28 +90,28 @@ const te = c.forwardRef(
|
|
|
87
90
|
]
|
|
88
91
|
}
|
|
89
92
|
),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */ s(
|
|
93
|
+
/* @__PURE__ */ u(_, { open: l, onOpenChange: x, children: [
|
|
94
|
+
/* @__PURE__ */ s(F, { asChild: !0, children: /* @__PURE__ */ u(
|
|
92
95
|
"div",
|
|
93
96
|
{
|
|
94
97
|
className: v(
|
|
95
98
|
"flex w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 text-sm shadow-sm transition-colors hover:border-primary disabled:cursor-not-allowed disabled:bg-disabled-secondary-bg disabled:text-disabled-text disabled:border-border",
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
h ? "border-destructive hover:border-destructive" : "border-input",
|
|
100
|
+
R === "sm" ? "h-6" : R === "md" ? "h-[28px]" : "h-8",
|
|
98
101
|
g && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
|
|
99
102
|
"cursor-pointer",
|
|
100
103
|
z
|
|
101
104
|
),
|
|
102
105
|
children: [
|
|
103
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
|
|
104
107
|
/* @__PURE__ */ s(
|
|
105
108
|
"input",
|
|
106
109
|
{
|
|
107
110
|
ref: T,
|
|
108
111
|
type: "text",
|
|
109
112
|
value: X,
|
|
110
|
-
onChange:
|
|
111
|
-
onBlur:
|
|
113
|
+
onChange: U,
|
|
114
|
+
onBlur: N,
|
|
112
115
|
onClick: (e) => l && e.stopPropagation(),
|
|
113
116
|
placeholder: l ? n : M,
|
|
114
117
|
disabled: !!g,
|
|
@@ -121,8 +124,8 @@ const te = c.forwardRef(
|
|
|
121
124
|
{
|
|
122
125
|
type: "text",
|
|
123
126
|
value: q,
|
|
124
|
-
onChange:
|
|
125
|
-
onBlur:
|
|
127
|
+
onChange: W,
|
|
128
|
+
onBlur: N,
|
|
126
129
|
onClick: (e) => l && e.stopPropagation(),
|
|
127
130
|
placeholder: l ? n : V,
|
|
128
131
|
disabled: !!g,
|
|
@@ -130,67 +133,67 @@ const te = c.forwardRef(
|
|
|
130
133
|
}
|
|
131
134
|
)
|
|
132
135
|
] }),
|
|
133
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
134
137
|
t?.from && !g && /* @__PURE__ */ s(
|
|
135
|
-
|
|
138
|
+
Y,
|
|
136
139
|
{
|
|
137
140
|
className: "h-4 w-4 cursor-pointer hover:text-foreground text-muted-foreground",
|
|
138
141
|
onClick: (e) => {
|
|
139
|
-
e.stopPropagation(),
|
|
142
|
+
e.stopPropagation(), C();
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
145
|
),
|
|
143
|
-
/* @__PURE__ */ s(
|
|
146
|
+
/* @__PURE__ */ s(Z, { className: "h-4 w-4 text-secondary-foreground" })
|
|
144
147
|
] })
|
|
145
148
|
]
|
|
146
149
|
}
|
|
147
150
|
) }),
|
|
148
151
|
/* @__PURE__ */ s(
|
|
149
|
-
|
|
152
|
+
ee,
|
|
150
153
|
{
|
|
151
154
|
className: "w-auto p-0",
|
|
152
155
|
align: "start",
|
|
153
156
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
154
157
|
onInteractOutside: (e) => e.preventDefault(),
|
|
155
158
|
children: /* @__PURE__ */ s(
|
|
156
|
-
|
|
159
|
+
te,
|
|
157
160
|
{
|
|
158
161
|
mode: "range",
|
|
159
|
-
selected:
|
|
162
|
+
selected: r,
|
|
160
163
|
onSelect: H,
|
|
164
|
+
onPendingChange: J,
|
|
161
165
|
month: G,
|
|
162
166
|
onMonthChange: w,
|
|
163
|
-
|
|
164
|
-
toDate: O,
|
|
167
|
+
disabled: { before: A, after: O },
|
|
165
168
|
fromYear: j,
|
|
166
169
|
toYear: B,
|
|
167
|
-
showFooter:
|
|
168
|
-
onApply:
|
|
169
|
-
onCancel:
|
|
170
|
-
onClear:
|
|
170
|
+
showFooter: m,
|
|
171
|
+
onApply: K,
|
|
172
|
+
onCancel: Q,
|
|
173
|
+
onClear: C,
|
|
171
174
|
captionLayout: "dropdown"
|
|
172
175
|
}
|
|
173
176
|
)
|
|
174
177
|
}
|
|
175
178
|
)
|
|
176
179
|
] }),
|
|
177
|
-
|
|
178
|
-
!
|
|
180
|
+
P && /* @__PURE__ */ u("div", { className: v("flex items-center gap-1", h && "text-destructive"), children: [
|
|
181
|
+
!h && /* @__PURE__ */ s($, { size: 10, className: "shrink-0 text-muted-foreground" }),
|
|
179
182
|
/* @__PURE__ */ s(
|
|
180
183
|
"p",
|
|
181
184
|
{
|
|
182
185
|
className: v(
|
|
183
186
|
"text-[10px] text-[#7a8294]",
|
|
184
|
-
|
|
187
|
+
h && "text-destructive"
|
|
185
188
|
),
|
|
186
|
-
children:
|
|
189
|
+
children: P
|
|
187
190
|
}
|
|
188
191
|
)
|
|
189
192
|
] })
|
|
190
193
|
] });
|
|
191
194
|
}
|
|
192
195
|
);
|
|
193
|
-
|
|
196
|
+
ne.displayName = "DateRangePicker";
|
|
194
197
|
export {
|
|
195
|
-
|
|
198
|
+
ne as DateRangePicker
|
|
196
199
|
};
|
|
@@ -1,110 +1,114 @@
|
|
|
1
|
-
import { jsxs as P, jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import { parse as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
10
|
-
const
|
|
1
|
+
import { jsxs as P, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { X as B } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as E } from "../../../icons/index.js";
|
|
5
|
+
import { parse as T, isValid as j } from "date-fns";
|
|
6
|
+
import { cn as R, maskDate as $ } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as X } from "../input.js";
|
|
8
|
+
import { Popover as q, PopoverTrigger as z, PopoverContent as G } from "../popover.js";
|
|
9
|
+
import { Calendar as H } from "../calendar.js";
|
|
10
|
+
const f = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, J = r.forwardRef(
|
|
11
11
|
({
|
|
12
12
|
value: e,
|
|
13
|
-
onChange:
|
|
13
|
+
onChange: a,
|
|
14
14
|
placeholder: C = "Select Month",
|
|
15
15
|
minDate: k,
|
|
16
16
|
maxDate: S,
|
|
17
17
|
fromYear: D,
|
|
18
18
|
toYear: w,
|
|
19
19
|
showFooter: i = !0,
|
|
20
|
-
disabled:
|
|
20
|
+
disabled: u,
|
|
21
21
|
className: x,
|
|
22
22
|
...I
|
|
23
23
|
}, N) => {
|
|
24
|
-
const [
|
|
25
|
-
|
|
26
|
-
h(e ?
|
|
27
|
-
}, [e]),
|
|
28
|
-
console.log("[MonthPicker] useEffect - open:",
|
|
29
|
-
}, [
|
|
30
|
-
const Y = (
|
|
31
|
-
console.log("[MonthPicker] handleSelect called:",
|
|
32
|
-
}, O = (
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
}, V = () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
const [l, p] = r.useState(!1), [c, s] = r.useState(e), [M, h] = r.useState(e ? f(e) : ""), [A, m] = r.useState(() => e ? new Date(e.year, e.month, 1) : /* @__PURE__ */ new Date());
|
|
25
|
+
r.useEffect(() => {
|
|
26
|
+
h(e ? f(e) : "");
|
|
27
|
+
}, [e]), r.useEffect(() => {
|
|
28
|
+
console.log("[MonthPicker] useEffect - open:", l, "value:", e, "pendingMonth:", c), l && (s(e), m(e ? new Date(e.year, e.month, 1) : /* @__PURE__ */ new Date()));
|
|
29
|
+
}, [l]);
|
|
30
|
+
const Y = (n) => {
|
|
31
|
+
console.log("[MonthPicker] handleSelect called:", n), s(n), i || (console.log("[MonthPicker] No footer - applying immediately"), a?.(n), p(!1));
|
|
32
|
+
}, O = (n) => {
|
|
33
|
+
const t = n;
|
|
34
|
+
h(t ? f(t) : "");
|
|
35
|
+
}, V = (n) => {
|
|
36
|
+
const t = n !== void 0 ? n : c;
|
|
37
|
+
console.log("[MonthPicker] handleApply called, appliedMonth:", n, "pendingMonth:", c, "using:", t), a?.(t), p(!1);
|
|
38
|
+
}, v = () => {
|
|
39
|
+
console.log("[MonthPicker] handleCancel called"), s(e), p(!1);
|
|
40
|
+
}, g = () => {
|
|
41
|
+
console.log("[MonthPicker] handleClear called"), s(void 0), h(""), a?.(void 0), i || p(!1);
|
|
39
42
|
};
|
|
40
|
-
return /* @__PURE__ */ P(
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
|
|
43
|
+
return /* @__PURE__ */ P(q, { open: l, onOpenChange: p, children: [
|
|
44
|
+
/* @__PURE__ */ o(z, { asChild: !0, children: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
|
|
45
|
+
X,
|
|
43
46
|
{
|
|
44
47
|
ref: N,
|
|
45
|
-
value:
|
|
46
|
-
onChange: (
|
|
47
|
-
const
|
|
48
|
-
if (h(
|
|
49
|
-
|
|
48
|
+
value: M,
|
|
49
|
+
onChange: (n) => {
|
|
50
|
+
const t = $(n.target.value, "MM/yyyy");
|
|
51
|
+
if (h(t), t === "") {
|
|
52
|
+
s(void 0), i || a?.(void 0);
|
|
50
53
|
return;
|
|
51
54
|
}
|
|
52
|
-
const d =
|
|
53
|
-
if (
|
|
55
|
+
const d = T(t, "MM/yyyy", /* @__PURE__ */ new Date());
|
|
56
|
+
if (j(d)) {
|
|
54
57
|
const y = { month: d.getMonth(), year: d.getFullYear() };
|
|
55
|
-
|
|
58
|
+
s(y), m(d), i || a?.(y);
|
|
56
59
|
}
|
|
57
60
|
},
|
|
58
61
|
onBlur: () => {
|
|
59
|
-
if (
|
|
60
|
-
|
|
62
|
+
if (M === "") {
|
|
63
|
+
g();
|
|
61
64
|
return;
|
|
62
65
|
}
|
|
63
|
-
h(
|
|
66
|
+
h(c ? f(c) : "");
|
|
64
67
|
},
|
|
65
|
-
onClick: (
|
|
66
|
-
placeholder:
|
|
67
|
-
disabled:
|
|
68
|
-
className:
|
|
68
|
+
onClick: (n) => l && n.stopPropagation(),
|
|
69
|
+
placeholder: l ? "MM/YYYY" : C,
|
|
70
|
+
disabled: u,
|
|
71
|
+
className: R("cursor-pointer", x),
|
|
69
72
|
suffix: /* @__PURE__ */ P("div", { className: "flex items-center gap-1", children: [
|
|
70
|
-
e && !
|
|
71
|
-
|
|
73
|
+
e && !u && /* @__PURE__ */ o(
|
|
74
|
+
B,
|
|
72
75
|
{
|
|
73
76
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
74
|
-
onClick: (
|
|
75
|
-
|
|
77
|
+
onClick: (n) => {
|
|
78
|
+
n.stopPropagation(), g();
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
),
|
|
79
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ o(E, { className: "h-4 w-4 text-secondary-foreground" })
|
|
80
83
|
] }),
|
|
81
84
|
...I
|
|
82
85
|
}
|
|
83
86
|
) }) }),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
87
|
+
/* @__PURE__ */ o(
|
|
88
|
+
G,
|
|
86
89
|
{
|
|
87
90
|
className: "w-auto p-0",
|
|
88
91
|
align: "start",
|
|
89
|
-
onOpenAutoFocus: (
|
|
90
|
-
onInteractOutside: (
|
|
91
|
-
children: /* @__PURE__ */
|
|
92
|
-
|
|
92
|
+
onOpenAutoFocus: (n) => n.preventDefault(),
|
|
93
|
+
onInteractOutside: (n) => n.preventDefault(),
|
|
94
|
+
children: /* @__PURE__ */ o(
|
|
95
|
+
H,
|
|
93
96
|
{
|
|
94
97
|
pickerType: "month",
|
|
95
98
|
monthMode: "single",
|
|
96
|
-
selectedMonths:
|
|
99
|
+
selectedMonths: c,
|
|
97
100
|
onMonthSelect: Y,
|
|
101
|
+
onPendingChange: O,
|
|
98
102
|
month: A,
|
|
99
|
-
onMonthChange:
|
|
103
|
+
onMonthChange: m,
|
|
100
104
|
fromDate: k,
|
|
101
105
|
toDate: S,
|
|
102
106
|
fromYear: D,
|
|
103
107
|
toYear: w,
|
|
104
108
|
showFooter: i,
|
|
105
|
-
onApply:
|
|
106
|
-
onCancel:
|
|
107
|
-
onClear:
|
|
109
|
+
onApply: V,
|
|
110
|
+
onCancel: v,
|
|
111
|
+
onClear: g
|
|
108
112
|
}
|
|
109
113
|
)
|
|
110
114
|
}
|
|
@@ -112,7 +116,7 @@ const u = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, H = o
|
|
|
112
116
|
] });
|
|
113
117
|
}
|
|
114
118
|
);
|
|
115
|
-
|
|
119
|
+
J.displayName = "MonthPicker";
|
|
116
120
|
export {
|
|
117
|
-
|
|
121
|
+
J as MonthPicker
|
|
118
122
|
};
|