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