impact-nova 0.1.13 → 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/layout/dashboard-layout.d.ts +21 -6
- package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +32 -33
- package/dist/components/ui/accordion.js +25 -23
- 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/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +5 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +50 -52
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +1 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +34 -34
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +8 -11
- package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +17 -17
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +3 -3
- package/dist/components/ui/alert-dialog.js +45 -40
- package/dist/components/ui/alert.d.ts +21 -4
- package/dist/components/ui/alert.js +45 -25
- package/dist/components/ui/avatar.js +19 -16
- package/dist/components/ui/badge.js +8 -1
- package/dist/components/ui/breadcrumb.js +1 -0
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button-group.js +27 -32
- package/dist/components/ui/button-variants.d.ts +1 -1
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +11 -9
- package/dist/components/ui/calendar.d.ts +14 -2
- package/dist/components/ui/calendar.js +443 -376
- package/dist/components/ui/card.js +7 -6
- package/dist/components/ui/checkbox.js +64 -48
- package/dist/components/ui/chips.d.ts +1 -0
- package/dist/components/ui/chips.js +27 -19
- package/dist/components/ui/data-table/data-table-column-list.d.ts +4 -1
- package/dist/components/ui/data-table/data-table-column-list.js +58 -54
- package/dist/components/ui/data-table/data-table-sheet.d.ts +1 -1
- package/dist/components/ui/data-table/data-table-sheet.js +43 -40
- package/dist/components/ui/data-table/data-table-view-options.js +17 -17
- package/dist/components/ui/data-table/data-table.js +21 -20
- package/dist/components/ui/date-picker/date-picker.js +93 -93
- package/dist/components/ui/date-picker/date-range-picker.js +142 -133
- package/dist/components/ui/date-picker/month-picker.js +96 -93
- package/dist/components/ui/date-picker/month-range-picker.js +144 -134
- package/dist/components/ui/date-picker/multi-date-picker.js +43 -45
- package/dist/components/ui/date-picker/multi-month-picker.js +37 -39
- package/dist/components/ui/date-picker/multi-week-picker.js +56 -46
- package/dist/components/ui/date-picker/week-picker.js +119 -109
- package/dist/components/ui/date-picker/week-range-picker.js +170 -147
- package/dist/components/ui/dialog.js +15 -6
- package/dist/components/ui/drawer.js +16 -13
- package/dist/components/ui/dropdown-menu.js +4 -2
- package/dist/components/ui/dynamic-layout.d.ts +2 -2
- package/dist/components/ui/dynamic-layout.js +18 -15
- package/dist/components/ui/empty-container.js +69 -64
- package/dist/components/ui/file-upload.js +113 -106
- package/dist/components/ui/filter-panel/filter-panel.js +49 -46
- package/dist/components/ui/filter-strip/filter-strip.js +41 -37
- package/dist/components/ui/header.js +26 -25
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +43 -40
- package/dist/components/ui/hover-card.js +6 -5
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.js +79 -68
- package/dist/components/ui/loader.d.ts +1 -0
- package/dist/components/ui/loader.js +23 -13
- package/dist/components/ui/nested-list/components/NestedListContent.d.ts +1 -3
- package/dist/components/ui/nested-list/components/NestedListContent.js +16 -15
- package/dist/components/ui/nested-list/components/SortableItem.js +116 -80
- package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.d.ts +13 -1
- package/dist/components/ui/nested-list/hooks/useNestedListDragDrop.js +162 -112
- package/dist/components/ui/nested-list/nested-list.js +182 -189
- package/dist/components/ui/notification-panel/notification-item.js +19 -17
- package/dist/components/ui/notification-panel/notification-list.js +21 -21
- package/dist/components/ui/notification-panel/notification-panel.js +25 -25
- package/dist/components/ui/popover.js +37 -34
- package/dist/components/ui/progress.js +12 -10
- package/dist/components/ui/prompt.js +29 -27
- package/dist/components/ui/radio-group.js +55 -46
- package/dist/components/ui/select/components/Submenu.d.ts +1 -2
- package/dist/components/ui/select/components/Submenu.js +52 -48
- package/dist/components/ui/select/select.js +321 -324
- package/dist/components/ui/sheet.js +18 -15
- package/dist/components/ui/sidebar.d.ts +2 -2
- package/dist/components/ui/sidebar.js +3 -3
- package/dist/components/ui/skeleton.d.ts +2 -1
- package/dist/components/ui/skeleton.js +12 -11
- package/dist/components/ui/slider.js +39 -12
- package/dist/components/ui/smart-input.js +44 -39
- package/dist/components/ui/stepper.js +33 -29
- package/dist/components/ui/switch.js +6 -4
- package/dist/components/ui/tabs.js +50 -45
- package/dist/components/ui/tag-group.d.ts +2 -1
- package/dist/components/ui/tag-group.js +29 -25
- package/dist/components/ui/tag.d.ts +1 -0
- package/dist/components/ui/tag.js +26 -20
- package/dist/components/ui/textarea.js +18 -17
- package/dist/components/ui/toast.d.ts +1 -1
- package/dist/components/ui/toast.js +47 -41
- package/dist/components/ui/toaster.js +42 -42
- package/dist/components/ui/tooltip.js +18 -16
- package/dist/components/ui/types/date-picker.types.d.ts +33 -0
- package/dist/components/ui/types/empty-container.types.d.ts +5 -0
- package/dist/components/ui/types/nested-list.types.d.ts +1 -0
- package/dist/components/ui/types/select.types.d.ts +0 -1
- package/dist/icons/assets/bookmark.svg.js +4 -0
- package/dist/icons/assets/bookmark.svg2.js +5 -0
- package/dist/icons/assets/bookmarkFilled.svg.js +4 -0
- package/dist/icons/assets/bookmarkFilled.svg2.js +5 -0
- package/dist/icons/assets/download.svg.js +4 -0
- package/dist/icons/assets/download.svg2.js +5 -0
- package/dist/icons/index.d.ts +20 -6
- package/dist/icons/index.js +398 -370
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +318 -314
- package/dist/lib/fiscal-calendar.d.ts +62 -0
- package/dist/lib/fiscal-calendar.js +99 -0
- package/dist/lib/utils.d.ts +2 -1
- package/dist/lib/utils.js +29 -13
- package/package.json +5 -5
- package/dist/components/ui/select/hooks/useClickOutside.d.ts +0 -15
- package/dist/components/ui/select/hooks/useClickOutside.js +0 -43
- package/dist/components/ui/select/hooks/useMenuPosition.d.ts +0 -2
- package/dist/components/ui/select/hooks/useMenuPosition.js +0 -89
|
@@ -1,199 +1,208 @@
|
|
|
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 { Popover as
|
|
8
|
-
import { Calendar as
|
|
9
|
-
const
|
|
1
|
+
import { jsxs as g, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { X as re } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as ie, Info as de } from "../../../icons/index.js";
|
|
5
|
+
import { format as s, isValid as S, parse as D } from "date-fns";
|
|
6
|
+
import { cn as N, padValidDateString as A, maskDate as j } from "../../../lib/utils.js";
|
|
7
|
+
import { Popover as ce, PopoverTrigger as le, PopoverContent as fe } from "../popover.js";
|
|
8
|
+
import { Calendar as pe } from "../calendar.js";
|
|
9
|
+
const ae = i.forwardRef(
|
|
10
10
|
({
|
|
11
|
-
value:
|
|
12
|
-
onChange:
|
|
13
|
-
format:
|
|
14
|
-
startPlaceholder:
|
|
15
|
-
endPlaceholder:
|
|
16
|
-
minDate:
|
|
17
|
-
maxDate:
|
|
18
|
-
fromYear:
|
|
19
|
-
toYear:
|
|
11
|
+
value: e,
|
|
12
|
+
onChange: a,
|
|
13
|
+
format: t = "MM/dd/yyyy",
|
|
14
|
+
startPlaceholder: B = "Start Date",
|
|
15
|
+
endPlaceholder: O = "End Date",
|
|
16
|
+
minDate: T,
|
|
17
|
+
maxDate: z,
|
|
18
|
+
fromYear: H,
|
|
19
|
+
toYear: L,
|
|
20
20
|
showFooter: m = !0,
|
|
21
|
-
disabled:
|
|
22
|
-
label:
|
|
23
|
-
helperText:
|
|
24
|
-
prefix:
|
|
25
|
-
prefixClick:
|
|
26
|
-
isError:
|
|
27
|
-
size:
|
|
28
|
-
required:
|
|
29
|
-
className:
|
|
30
|
-
...
|
|
31
|
-
},
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
i(a), m || f?.(a);
|
|
21
|
+
disabled: x,
|
|
22
|
+
label: P,
|
|
23
|
+
helperText: V,
|
|
24
|
+
prefix: me,
|
|
25
|
+
prefixClick: ue,
|
|
26
|
+
isError: R,
|
|
27
|
+
size: k,
|
|
28
|
+
required: X,
|
|
29
|
+
className: q,
|
|
30
|
+
...G
|
|
31
|
+
}, J) => {
|
|
32
|
+
const E = i.useRef(null), K = i.useRef(null);
|
|
33
|
+
i.useRef(null), i.useRef(null), i.useImperativeHandle(J, () => E.current);
|
|
34
|
+
const [c, C] = i.useState(!1), [b, f] = i.useState(e), [w, u] = i.useState(e?.from ? s(e.from, t) : ""), [y, h] = i.useState(e?.to ? s(e.to, t) : ""), [Q, I] = i.useState(e?.from || /* @__PURE__ */ new Date());
|
|
35
|
+
i.useEffect(() => {
|
|
36
|
+
!c && e && (u(e?.from ? s(e.from, t) : ""), h(e?.to ? s(e.to, t) : ""), f(e));
|
|
37
|
+
}, [e, t, c]), i.useEffect(() => {
|
|
38
|
+
c && (f(e), u(e?.from ? s(e.from, t) : ""), h(e?.to ? s(e.to, t) : ""), I(e?.from || /* @__PURE__ */ new Date()));
|
|
39
|
+
}, [c, e]);
|
|
40
|
+
const U = (n) => {
|
|
41
|
+
f(n), n?.from && u(s(n.from, t)), n?.to && h(s(n.to, t)), m || n?.from && n?.to && n.from.getTime() !== n.to.getTime() && (a?.(n), C(!1));
|
|
42
|
+
}, W = (n) => {
|
|
43
|
+
let o = n !== void 0 ? n : b;
|
|
44
|
+
o?.from && !o.to && (o = { from: o.from, to: o.from }), a?.(o), C(!1);
|
|
45
|
+
}, Y = () => {
|
|
46
|
+
f(e), u(e?.from ? s(e.from, t) : ""), h(e?.to ? s(e.to, t) : ""), C(!1);
|
|
47
|
+
}, M = () => {
|
|
48
|
+
f(void 0), u(""), h(""), a?.(void 0), m || C(!1);
|
|
49
|
+
}, Z = (n) => {
|
|
50
|
+
const o = n.target.value, d = j(o, t, w);
|
|
51
|
+
if (u(d), d === "") {
|
|
52
|
+
const r = { from: void 0, to: b?.to };
|
|
53
|
+
f(r), m || a?.(r);
|
|
55
54
|
return;
|
|
56
55
|
}
|
|
57
|
-
const
|
|
58
|
-
if (S(d)
|
|
59
|
-
const
|
|
60
|
-
|
|
56
|
+
const l = D(d, t, /* @__PURE__ */ new Date());
|
|
57
|
+
if (S(l) && d.length === t.length) {
|
|
58
|
+
const r = { from: l, to: b?.to };
|
|
59
|
+
f(r), I(l), m || a?.(r);
|
|
61
60
|
}
|
|
62
|
-
},
|
|
63
|
-
const o =
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
|
|
61
|
+
}, $ = (n) => {
|
|
62
|
+
const o = n.target.value, d = j(o, t, y);
|
|
63
|
+
if (h(d), d === "") {
|
|
64
|
+
const r = { from: b?.from, to: void 0 };
|
|
65
|
+
f(r), m || a?.(r);
|
|
67
66
|
return;
|
|
68
67
|
}
|
|
69
|
-
const
|
|
70
|
-
if (S(d)
|
|
71
|
-
const
|
|
72
|
-
|
|
68
|
+
const l = D(d, t, /* @__PURE__ */ new Date());
|
|
69
|
+
if (S(l) && d.length === t.length) {
|
|
70
|
+
const r = { from: b?.from, to: l };
|
|
71
|
+
f(r), l && I(l), m || a?.(r);
|
|
73
72
|
}
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
}, v = () => {
|
|
74
|
+
if (c) return;
|
|
75
|
+
const n = A(w, t), o = A(y, t), d = D(n, t, /* @__PURE__ */ new Date()), l = D(o, t, /* @__PURE__ */ new Date()), r = S(d) && n.length === t.length, se = S(l) && o.length === t.length;
|
|
76
|
+
!r || !se ? (u(e?.from ? s(e.from, t) : ""), h(e?.to ? s(e.to, t) : ""), f(e)) : (u(n), h(o), m || a?.({ from: d, to: l }));
|
|
77
|
+
}, _ = e?.from ? s(e.from, t) : "", F = e?.to ? s(e.to, t) : "", ee = w !== _, te = y !== F, ne = w.length === t.length && !S(D(w, t, /* @__PURE__ */ new Date())), oe = y.length === t.length && !S(D(y, t, /* @__PURE__ */ new Date()));
|
|
78
|
+
return /* @__PURE__ */ g("div", { className: "w-full space-y-1.5 min-w-[240px]", "data-component": "date-range-picker", "data-disabled": x || void 0, children: [
|
|
79
|
+
P && /* @__PURE__ */ g(
|
|
79
80
|
"label",
|
|
80
81
|
{
|
|
81
|
-
className:
|
|
82
|
+
className: N(
|
|
82
83
|
"text-xs font-medium leading-[18px] text-[#60697d]",
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
x && "opacity-70",
|
|
85
|
+
R && "text-destructive"
|
|
85
86
|
),
|
|
86
87
|
children: [
|
|
87
|
-
|
|
88
|
+
P,
|
|
88
89
|
" ",
|
|
89
|
-
|
|
90
|
+
X && /* @__PURE__ */ p("span", { className: "text-destructive", children: "*" })
|
|
90
91
|
]
|
|
91
92
|
}
|
|
92
93
|
),
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ g(ce, { open: c, onOpenChange: C, children: [
|
|
95
|
+
/* @__PURE__ */ p(le, { asChild: !0, children: /* @__PURE__ */ g(
|
|
95
96
|
"div",
|
|
96
97
|
{
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
R
|
|
101
|
-
|
|
98
|
+
"data-state": c ? "open" : "closed",
|
|
99
|
+
className: N(
|
|
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",
|
|
101
|
+
R ? "border-destructive hover:border-destructive" : "border-input",
|
|
102
|
+
k === "sm" ? "h-6" : k === "md" ? "h-[28px]" : "h-8",
|
|
103
|
+
x && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
|
|
102
104
|
"cursor-pointer",
|
|
103
|
-
|
|
105
|
+
q
|
|
104
106
|
),
|
|
105
107
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ g("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
|
|
109
|
+
/* @__PURE__ */ p(
|
|
108
110
|
"input",
|
|
109
111
|
{
|
|
110
|
-
ref:
|
|
112
|
+
ref: E,
|
|
111
113
|
type: "text",
|
|
112
|
-
value:
|
|
113
|
-
onChange:
|
|
114
|
-
onBlur:
|
|
115
|
-
onClick: (
|
|
116
|
-
placeholder:
|
|
117
|
-
disabled: !!
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
value: w,
|
|
115
|
+
onChange: Z,
|
|
116
|
+
onBlur: v,
|
|
117
|
+
onClick: (n) => c && n.stopPropagation(),
|
|
118
|
+
placeholder: c ? t : B,
|
|
119
|
+
disabled: !!x,
|
|
120
|
+
"data-field": "start",
|
|
121
|
+
className: N(
|
|
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",
|
|
123
|
+
ne ? "text-destructive" : ee ? "text-muted-foreground" : ""
|
|
124
|
+
),
|
|
125
|
+
...G
|
|
120
126
|
}
|
|
121
127
|
),
|
|
122
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ p(
|
|
123
129
|
"input",
|
|
124
130
|
{
|
|
131
|
+
ref: K,
|
|
125
132
|
type: "text",
|
|
126
|
-
value:
|
|
127
|
-
onChange:
|
|
128
|
-
onBlur:
|
|
129
|
-
onClick: (
|
|
130
|
-
placeholder:
|
|
131
|
-
disabled: !!
|
|
132
|
-
|
|
133
|
+
value: y,
|
|
134
|
+
onChange: $,
|
|
135
|
+
onBlur: v,
|
|
136
|
+
onClick: (n) => c && n.stopPropagation(),
|
|
137
|
+
placeholder: c ? t : O,
|
|
138
|
+
disabled: !!x,
|
|
139
|
+
"data-field": "end",
|
|
140
|
+
className: N(
|
|
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",
|
|
142
|
+
oe ? "text-destructive" : te ? "text-muted-foreground" : ""
|
|
143
|
+
)
|
|
133
144
|
}
|
|
134
145
|
)
|
|
135
146
|
] }),
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
/* @__PURE__ */ g("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
148
|
+
e?.from && !x && /* @__PURE__ */ p(
|
|
149
|
+
re,
|
|
139
150
|
{
|
|
140
151
|
className: "h-4 w-4 cursor-pointer hover:text-foreground text-muted-foreground",
|
|
141
|
-
onClick: (
|
|
142
|
-
|
|
152
|
+
onClick: (n) => {
|
|
153
|
+
n.stopPropagation(), M();
|
|
143
154
|
}
|
|
144
155
|
}
|
|
145
156
|
),
|
|
146
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ p(ie, { className: "h-4 w-4 text-secondary-foreground" })
|
|
147
158
|
] })
|
|
148
159
|
]
|
|
149
160
|
}
|
|
150
161
|
) }),
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
-
|
|
162
|
+
/* @__PURE__ */ p(
|
|
163
|
+
fe,
|
|
153
164
|
{
|
|
154
165
|
className: "w-auto p-0",
|
|
155
166
|
align: "start",
|
|
156
|
-
onOpenAutoFocus: (
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
te,
|
|
167
|
+
onOpenAutoFocus: (n) => n.preventDefault(),
|
|
168
|
+
children: /* @__PURE__ */ p(
|
|
169
|
+
pe,
|
|
160
170
|
{
|
|
161
171
|
mode: "range",
|
|
162
|
-
selected:
|
|
163
|
-
onSelect:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
toYear: B,
|
|
172
|
+
selected: b,
|
|
173
|
+
onSelect: U,
|
|
174
|
+
month: Q,
|
|
175
|
+
onMonthChange: I,
|
|
176
|
+
disabled: { before: T, after: z },
|
|
177
|
+
fromYear: H,
|
|
178
|
+
toYear: L,
|
|
170
179
|
showFooter: m,
|
|
171
|
-
onApply:
|
|
172
|
-
onCancel:
|
|
173
|
-
onClear:
|
|
180
|
+
onApply: W,
|
|
181
|
+
onCancel: Y,
|
|
182
|
+
onClear: M,
|
|
174
183
|
captionLayout: "dropdown"
|
|
175
184
|
}
|
|
176
185
|
)
|
|
177
186
|
}
|
|
178
187
|
)
|
|
179
188
|
] }),
|
|
180
|
-
|
|
181
|
-
!
|
|
182
|
-
/* @__PURE__ */
|
|
189
|
+
V && /* @__PURE__ */ g("div", { className: N("flex items-center gap-1", R && "text-destructive"), children: [
|
|
190
|
+
!R && /* @__PURE__ */ p(de, { size: 10, className: "shrink-0 text-muted-foreground" }),
|
|
191
|
+
/* @__PURE__ */ p(
|
|
183
192
|
"p",
|
|
184
193
|
{
|
|
185
|
-
className:
|
|
194
|
+
className: N(
|
|
186
195
|
"text-[10px] text-[#7a8294]",
|
|
187
|
-
|
|
196
|
+
R && "text-destructive"
|
|
188
197
|
),
|
|
189
|
-
children:
|
|
198
|
+
children: V
|
|
190
199
|
}
|
|
191
200
|
)
|
|
192
201
|
] })
|
|
193
202
|
] });
|
|
194
203
|
}
|
|
195
204
|
);
|
|
196
|
-
|
|
205
|
+
ae.displayName = "DateRangePicker";
|
|
197
206
|
export {
|
|
198
|
-
|
|
207
|
+
ae as DateRangePicker
|
|
199
208
|
};
|
|
@@ -1,114 +1,117 @@
|
|
|
1
|
-
import { jsxs as P, jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { X
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import {
|
|
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 i } from "react/jsx-runtime";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as q } from "../../../icons/index.js";
|
|
5
|
+
import { isValid as M, parse as g } from "date-fns";
|
|
6
|
+
import { cn as z, padValidDateString as G, maskDate as J } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as K } from "../input.js";
|
|
8
|
+
import { Popover as L, PopoverTrigger as Q, PopoverContent as U } from "../popover.js";
|
|
9
|
+
import { Calendar as W } from "../calendar.js";
|
|
10
|
+
const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, Z = n.forwardRef(
|
|
11
11
|
({
|
|
12
|
-
value:
|
|
12
|
+
value: t,
|
|
13
13
|
onChange: a,
|
|
14
|
-
placeholder:
|
|
15
|
-
minDate:
|
|
16
|
-
maxDate:
|
|
17
|
-
fromYear:
|
|
18
|
-
toYear:
|
|
19
|
-
showFooter:
|
|
14
|
+
placeholder: k = "Select Month",
|
|
15
|
+
minDate: V,
|
|
16
|
+
maxDate: I,
|
|
17
|
+
fromYear: N,
|
|
18
|
+
toYear: Y,
|
|
19
|
+
showFooter: p = !0,
|
|
20
20
|
disabled: u,
|
|
21
|
-
className:
|
|
22
|
-
...
|
|
23
|
-
},
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
21
|
+
className: A,
|
|
22
|
+
...R
|
|
23
|
+
}, T) => {
|
|
24
|
+
const S = n.useRef(null);
|
|
25
|
+
n.useRef(null), n.useImperativeHandle(T, () => S.current);
|
|
26
|
+
const [o, m] = n.useState(!1), [w, r] = n.useState(t), [d, s] = n.useState(t ? c(t) : ""), [O, y] = n.useState(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date());
|
|
27
|
+
n.useEffect(() => {
|
|
28
|
+
!o && t && (s(c(t)), r(t));
|
|
29
|
+
}, [o, t]), n.useEffect(() => {
|
|
30
|
+
o && (r(t), y(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), s(t ? c(t) : ""));
|
|
31
|
+
}, [o, t]);
|
|
32
|
+
const j = (e) => {
|
|
33
|
+
r(e), e && s(c(e)), p || (a?.(e), m(!1));
|
|
34
|
+
}, B = (e) => {
|
|
35
|
+
a?.(e !== void 0 ? e : w), m(!1);
|
|
36
|
+
}, E = () => {
|
|
37
|
+
r(t), s(t ? c(t) : ""), m(!1);
|
|
38
|
+
}, D = () => {
|
|
39
|
+
r(void 0), s(""), a?.(void 0), p || m(!1);
|
|
40
|
+
}, $ = (e) => {
|
|
41
|
+
const f = e.target.value, l = J(f, "MM/yyyy", d);
|
|
42
|
+
if (s(l), l === "") {
|
|
43
|
+
r(void 0), p || a?.(void 0);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const h = g(l, "MM/yyyy", /* @__PURE__ */ new Date());
|
|
47
|
+
if (M(h) && l.length === 7) {
|
|
48
|
+
const C = { month: h.getMonth(), year: h.getFullYear() };
|
|
49
|
+
r(C), y(h), p || a?.(C);
|
|
50
|
+
}
|
|
51
|
+
}, b = () => {
|
|
52
|
+
if (o) return;
|
|
53
|
+
const e = G(d, "MM/yyyy"), f = g(e, "MM/yyyy", /* @__PURE__ */ new Date());
|
|
54
|
+
if (!M(f) || e.length !== 7)
|
|
55
|
+
s(t ? c(t) : ""), r(t);
|
|
56
|
+
else if (s(e), !p) {
|
|
57
|
+
const l = { month: f.getMonth(), year: f.getFullYear() };
|
|
58
|
+
a?.(l);
|
|
59
|
+
}
|
|
60
|
+
}, x = (t ? c(t) : "") !== d, H = d.length === 7 && !M(g(d, "MM/yyyy", /* @__PURE__ */ new Date()));
|
|
61
|
+
return /* @__PURE__ */ P(L, { open: o, onOpenChange: m, children: [
|
|
62
|
+
/* @__PURE__ */ i(Q, { asChild: !0, children: /* @__PURE__ */ i("div", { "data-component": "month-picker", "data-state": o ? "open" : "closed", "data-pending": x || void 0, children: /* @__PURE__ */ i(
|
|
63
|
+
K,
|
|
46
64
|
{
|
|
47
|
-
ref:
|
|
48
|
-
value:
|
|
49
|
-
onChange:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const d = T(t, "MM/yyyy", /* @__PURE__ */ new Date());
|
|
56
|
-
if (j(d)) {
|
|
57
|
-
const y = { month: d.getMonth(), year: d.getFullYear() };
|
|
58
|
-
s(y), m(d), i || a?.(y);
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
onBlur: () => {
|
|
62
|
-
if (M === "") {
|
|
63
|
-
g();
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
h(c ? f(c) : "");
|
|
67
|
-
},
|
|
68
|
-
onClick: (n) => l && n.stopPropagation(),
|
|
69
|
-
placeholder: l ? "MM/YYYY" : C,
|
|
65
|
+
ref: S,
|
|
66
|
+
value: d,
|
|
67
|
+
onChange: $,
|
|
68
|
+
onBlur: b,
|
|
69
|
+
onClick: (e) => o && e.stopPropagation(),
|
|
70
|
+
placeholder: o ? "MM/YYYY" : k,
|
|
70
71
|
disabled: u,
|
|
71
|
-
|
|
72
|
+
"data-form-control": "input",
|
|
73
|
+
className: z(
|
|
74
|
+
"cursor-pointer",
|
|
75
|
+
H ? "text-destructive" : x ? "text-muted-foreground" : "",
|
|
76
|
+
A
|
|
77
|
+
),
|
|
72
78
|
suffix: /* @__PURE__ */ P("div", { className: "flex items-center gap-1", children: [
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
t && !u && /* @__PURE__ */ i(
|
|
80
|
+
X,
|
|
75
81
|
{
|
|
76
82
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
77
|
-
onClick: (
|
|
78
|
-
|
|
83
|
+
onClick: (e) => {
|
|
84
|
+
e.stopPropagation(), D();
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
87
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ i(q, { className: "h-4 w-4 text-secondary-foreground" })
|
|
83
89
|
] }),
|
|
84
|
-
...
|
|
90
|
+
...R
|
|
85
91
|
}
|
|
86
92
|
) }) }),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
|
|
93
|
+
/* @__PURE__ */ i(
|
|
94
|
+
U,
|
|
89
95
|
{
|
|
90
96
|
className: "w-auto p-0",
|
|
91
97
|
align: "start",
|
|
92
|
-
onOpenAutoFocus: (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
H,
|
|
98
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
99
|
+
children: /* @__PURE__ */ i(
|
|
100
|
+
W,
|
|
96
101
|
{
|
|
97
102
|
pickerType: "month",
|
|
98
103
|
monthMode: "single",
|
|
99
|
-
selectedMonths:
|
|
100
|
-
onMonthSelect:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
onCancel: v,
|
|
111
|
-
onClear: g
|
|
104
|
+
selectedMonths: w,
|
|
105
|
+
onMonthSelect: j,
|
|
106
|
+
month: O,
|
|
107
|
+
onMonthChange: y,
|
|
108
|
+
disabled: { before: V, after: I },
|
|
109
|
+
fromYear: N,
|
|
110
|
+
toYear: Y,
|
|
111
|
+
showFooter: p,
|
|
112
|
+
onApply: B,
|
|
113
|
+
onCancel: E,
|
|
114
|
+
onClear: D
|
|
112
115
|
}
|
|
113
116
|
)
|
|
114
117
|
}
|
|
@@ -116,7 +119,7 @@ const f = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, J = r
|
|
|
116
119
|
] });
|
|
117
120
|
}
|
|
118
121
|
);
|
|
119
|
-
|
|
122
|
+
Z.displayName = "MonthPicker";
|
|
120
123
|
export {
|
|
121
|
-
|
|
124
|
+
Z as MonthPicker
|
|
122
125
|
};
|