impact-nova 0.1.13 → 1.0.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/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 +83 -87
- package/dist/components/ui/date-picker/date-range-picker.js +129 -125
- package/dist/components/ui/date-picker/month-picker.js +90 -93
- package/dist/components/ui/date-picker/month-range-picker.js +132 -129
- package/dist/components/ui/date-picker/multi-date-picker.js +37 -38
- package/dist/components/ui/date-picker/multi-month-picker.js +29 -30
- package/dist/components/ui/date-picker/multi-week-picker.js +49 -38
- package/dist/components/ui/date-picker/week-picker.js +116 -112
- package/dist/components/ui/date-picker/week-range-picker.js +153 -142
- 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/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,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsx as o, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a, useCallback as y } from "react";
|
|
3
3
|
import { AgGridWrapper as T } from "../ag-grid-react/index.js";
|
|
4
4
|
import { cn as l } from "../../../lib/utils.js";
|
|
5
5
|
import { DataTableContext as v, useDataTable as S } from "./data-table-context.js";
|
|
@@ -7,21 +7,21 @@ const R = ({
|
|
|
7
7
|
children: e,
|
|
8
8
|
className: t
|
|
9
9
|
}) => {
|
|
10
|
-
const [
|
|
11
|
-
n(
|
|
12
|
-
}, []),
|
|
10
|
+
const [i, n] = a(null), [r, m] = a(null), [s, c] = a("medium"), [u, f] = a("full"), [d, h] = a("default"), p = y((x) => {
|
|
11
|
+
n(x);
|
|
12
|
+
}, []), g = {
|
|
13
13
|
small: "12px",
|
|
14
14
|
medium: "14px",
|
|
15
15
|
large: "16px"
|
|
16
|
-
}[s],
|
|
16
|
+
}[s], b = {
|
|
17
17
|
default: "46px",
|
|
18
18
|
compact: "30px",
|
|
19
19
|
comfort: "52px"
|
|
20
20
|
}[d];
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
gridApi:
|
|
23
|
-
registerApi:
|
|
24
|
-
sheetTarget:
|
|
21
|
+
return /* @__PURE__ */ o(v.Provider, { value: {
|
|
22
|
+
gridApi: i,
|
|
23
|
+
registerApi: p,
|
|
24
|
+
sheetTarget: r,
|
|
25
25
|
setSheetTarget: m,
|
|
26
26
|
fontSize: s,
|
|
27
27
|
setFontSize: c,
|
|
@@ -29,29 +29,30 @@ const R = ({
|
|
|
29
29
|
setNumericFormat: f,
|
|
30
30
|
rowHeight: d,
|
|
31
31
|
setRowHeight: h
|
|
32
|
-
}, children: /* @__PURE__ */
|
|
32
|
+
}, children: /* @__PURE__ */ o(
|
|
33
33
|
"div",
|
|
34
34
|
{
|
|
35
|
+
"data-component": "data-table",
|
|
35
36
|
className: l("flex flex-col w-full h-full min-h-0 rounded-[inherit]", t),
|
|
36
37
|
style: {
|
|
37
|
-
"--ag-font-size":
|
|
38
|
-
"--ag-row-height":
|
|
38
|
+
"--ag-font-size": g,
|
|
39
|
+
"--ag-row-height": b
|
|
39
40
|
},
|
|
40
41
|
children: e
|
|
41
42
|
}
|
|
42
43
|
) });
|
|
43
44
|
};
|
|
44
45
|
function j(e) {
|
|
45
|
-
const { registerApi: t, setSheetTarget:
|
|
46
|
-
t(
|
|
46
|
+
const { registerApi: t, setSheetTarget: i } = S(), n = (r) => {
|
|
47
|
+
t(r.api), e.onGridReady && e.onGridReady(r);
|
|
47
48
|
};
|
|
48
49
|
return /* @__PURE__ */ w("div", { className: l("relative flex-1 min-h-0 w-full bg-white rounded-b-[inherit] grid-rounded-bottom", e.className), children: [
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ o(T, { ...e, onGridReady: n }),
|
|
51
|
+
/* @__PURE__ */ o(
|
|
51
52
|
"div",
|
|
52
53
|
{
|
|
53
|
-
ref:
|
|
54
|
-
className: "absolute inset-0 pointer-events-none z-[
|
|
54
|
+
ref: i,
|
|
55
|
+
className: "absolute inset-0 pointer-events-none z-[39] flex overflow-hidden"
|
|
55
56
|
}
|
|
56
57
|
)
|
|
57
58
|
] });
|
|
@@ -59,7 +60,7 @@ function j(e) {
|
|
|
59
60
|
const C = ({
|
|
60
61
|
children: e,
|
|
61
62
|
className: t
|
|
62
|
-
}) => /* @__PURE__ */
|
|
63
|
+
}) => /* @__PURE__ */ o("div", { "data-component": "data-table-toolbar", className: l("flex items-center justify-between px-4 py-3 shrink-0 bg-white rounded-t-[inherit]", t), children: e });
|
|
63
64
|
export {
|
|
64
65
|
R as DataTable,
|
|
65
66
|
j as DataTableContent,
|
|
@@ -1,76 +1,74 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { X
|
|
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 P, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as q } from "../../../icons/index.js";
|
|
5
|
+
import { format as f, parse as x, isValid as v } from "date-fns";
|
|
6
|
+
import { cn as z, maskDate as G } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as H } from "../input.js";
|
|
8
|
+
import { Popover as J, PopoverTrigger as K, PopoverContent as Q } from "../popover.js";
|
|
9
|
+
import { Calendar as U } from "../calendar.js";
|
|
10
|
+
const W = i.forwardRef(
|
|
11
11
|
({
|
|
12
|
-
value:
|
|
13
|
-
onChange:
|
|
14
|
-
format:
|
|
12
|
+
value: t,
|
|
13
|
+
onChange: p,
|
|
14
|
+
format: n = "MM/dd/yyyy",
|
|
15
15
|
placeholder: S = "Select Date",
|
|
16
|
-
minDate:
|
|
17
|
-
maxDate:
|
|
18
|
-
fromYear:
|
|
19
|
-
toYear:
|
|
20
|
-
showFooter:
|
|
21
|
-
disabled:
|
|
22
|
-
className:
|
|
23
|
-
...
|
|
24
|
-
},
|
|
25
|
-
const [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, [
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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);
|
|
16
|
+
minDate: k,
|
|
17
|
+
maxDate: M,
|
|
18
|
+
fromYear: N,
|
|
19
|
+
toYear: w,
|
|
20
|
+
showFooter: s = !0,
|
|
21
|
+
disabled: y,
|
|
22
|
+
className: A,
|
|
23
|
+
...V
|
|
24
|
+
}, I) => {
|
|
25
|
+
const [o, l] = i.useState(!1), [r, c] = i.useState(t), [d, u] = i.useState(t ? f(t, n) : ""), [O, h] = i.useState(t || /* @__PURE__ */ new Date());
|
|
26
|
+
i.useEffect(() => {
|
|
27
|
+
u(t ? f(t, n) : "");
|
|
28
|
+
}, [t, n]), i.useEffect(() => {
|
|
29
|
+
o && (c(t), h(t || /* @__PURE__ */ new Date()));
|
|
30
|
+
}, [o]);
|
|
31
|
+
const T = (e) => {
|
|
32
|
+
c(e), s || (p?.(e), l(!1));
|
|
33
|
+
}, j = (e) => {
|
|
34
|
+
p?.(e !== void 0 ? e : r), l(!1);
|
|
35
|
+
}, B = () => {
|
|
36
|
+
c(t), l(!1);
|
|
41
37
|
}, D = () => {
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
c(void 0), u(""), p?.(void 0), s || l(!1);
|
|
39
|
+
}, E = (e) => {
|
|
40
|
+
const m = G(e.target.value, n);
|
|
41
|
+
if (u(m), m === "") {
|
|
42
|
+
c(void 0), s || p?.(void 0);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const g = x(m, n, /* @__PURE__ */ new Date());
|
|
46
|
+
v(g) && (c(g), h(g), s || p?.(g));
|
|
47
|
+
}, R = () => {
|
|
48
|
+
if (o) return;
|
|
49
|
+
if (d === "") {
|
|
50
|
+
D();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const e = x(d, n, /* @__PURE__ */ new Date());
|
|
54
|
+
v(e) || u(r ? f(r, n) : "");
|
|
55
|
+
}, C = s && o && (r ? f(r, n) : "") !== d, L = s && o ? r ? f(r, n) : "" : d;
|
|
56
|
+
return /* @__PURE__ */ P(J, { open: o, onOpenChange: l, children: [
|
|
57
|
+
/* @__PURE__ */ a(K, { asChild: !0, children: /* @__PURE__ */ a("div", { "data-component": "date-picker", "data-state": o ? "open" : "closed", "data-pending": C || void 0, children: /* @__PURE__ */ a(
|
|
58
|
+
H,
|
|
47
59
|
{
|
|
48
|
-
ref:
|
|
49
|
-
value:
|
|
50
|
-
onChange:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (h === "") {
|
|
61
|
-
D();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const e = y(h, t, /* @__PURE__ */ new Date());
|
|
65
|
-
k(e) || f(c ? g(c, t) : "");
|
|
66
|
-
},
|
|
67
|
-
onClick: (e) => r && e.stopPropagation(),
|
|
68
|
-
placeholder: r ? t : S,
|
|
69
|
-
disabled: P,
|
|
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,
|
|
60
|
+
ref: I,
|
|
61
|
+
value: L,
|
|
62
|
+
onChange: E,
|
|
63
|
+
onBlur: R,
|
|
64
|
+
onClick: (e) => o && e.stopPropagation(),
|
|
65
|
+
placeholder: o ? n : S,
|
|
66
|
+
disabled: y,
|
|
67
|
+
"data-form-control": "input",
|
|
68
|
+
className: z("cursor-pointer", C && "text-muted-foreground", A),
|
|
69
|
+
suffix: /* @__PURE__ */ P("div", { className: "flex items-center gap-1", children: [
|
|
70
|
+
t && !y && /* @__PURE__ */ a(
|
|
71
|
+
X,
|
|
74
72
|
{
|
|
75
73
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
76
74
|
onClick: (e) => {
|
|
@@ -78,34 +76,32 @@ const K = l.forwardRef(
|
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
78
|
),
|
|
81
|
-
/* @__PURE__ */ a(
|
|
79
|
+
/* @__PURE__ */ a(q, { className: "h-4 w-4 text-secondary-foreground" })
|
|
82
80
|
] }),
|
|
83
|
-
...
|
|
81
|
+
...V
|
|
84
82
|
}
|
|
85
83
|
) }) }),
|
|
86
84
|
/* @__PURE__ */ a(
|
|
87
|
-
|
|
85
|
+
Q,
|
|
88
86
|
{
|
|
89
87
|
className: "w-auto p-0",
|
|
90
88
|
align: "start",
|
|
91
89
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
92
|
-
onInteractOutside: (e) => e.preventDefault(),
|
|
93
90
|
children: /* @__PURE__ */ a(
|
|
94
|
-
|
|
91
|
+
U,
|
|
95
92
|
{
|
|
96
93
|
mode: "single",
|
|
97
|
-
selected:
|
|
98
|
-
onSelect:
|
|
99
|
-
onPendingChange: B,
|
|
94
|
+
selected: r,
|
|
95
|
+
onSelect: T,
|
|
100
96
|
month: O,
|
|
101
|
-
onMonthChange:
|
|
102
|
-
fromDate:
|
|
103
|
-
toDate:
|
|
104
|
-
fromYear:
|
|
105
|
-
toYear:
|
|
106
|
-
showFooter:
|
|
107
|
-
onApply:
|
|
108
|
-
onCancel:
|
|
97
|
+
onMonthChange: h,
|
|
98
|
+
fromDate: k,
|
|
99
|
+
toDate: M,
|
|
100
|
+
fromYear: N,
|
|
101
|
+
toYear: w,
|
|
102
|
+
showFooter: s,
|
|
103
|
+
onApply: j,
|
|
104
|
+
onCancel: B,
|
|
109
105
|
onClear: D,
|
|
110
106
|
captionLayout: "dropdown"
|
|
111
107
|
}
|
|
@@ -115,7 +111,7 @@ const K = l.forwardRef(
|
|
|
115
111
|
] });
|
|
116
112
|
}
|
|
117
113
|
);
|
|
118
|
-
|
|
114
|
+
W.displayName = "DatePicker";
|
|
119
115
|
export {
|
|
120
|
-
|
|
116
|
+
W as DatePicker
|
|
121
117
|
};
|
|
@@ -1,199 +1,203 @@
|
|
|
1
|
-
import { jsxs as u, jsx 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 u, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import * as m from "react";
|
|
3
|
+
import { X as ee } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as te, Info as ne } from "../../../icons/index.js";
|
|
5
|
+
import { format as a, parse as I, isValid as M } from "date-fns";
|
|
6
|
+
import { cn as g, maskDate as V } from "../../../lib/utils.js";
|
|
7
|
+
import { Popover as oe, PopoverTrigger as re, PopoverContent as se } from "../popover.js";
|
|
8
|
+
import { Calendar as ie } from "../calendar.js";
|
|
9
|
+
const de = m.forwardRef(
|
|
10
10
|
({
|
|
11
11
|
value: t,
|
|
12
|
-
onChange:
|
|
12
|
+
onChange: p,
|
|
13
13
|
format: n = "MM/dd/yyyy",
|
|
14
|
-
startPlaceholder:
|
|
15
|
-
endPlaceholder:
|
|
16
|
-
minDate:
|
|
17
|
-
maxDate:
|
|
18
|
-
fromYear:
|
|
19
|
-
toYear:
|
|
20
|
-
showFooter:
|
|
21
|
-
disabled:
|
|
22
|
-
label:
|
|
23
|
-
helperText:
|
|
24
|
-
prefix:
|
|
25
|
-
prefixClick:
|
|
14
|
+
startPlaceholder: A = "Start Date",
|
|
15
|
+
endPlaceholder: E = "End Date",
|
|
16
|
+
minDate: j,
|
|
17
|
+
maxDate: B,
|
|
18
|
+
fromYear: O,
|
|
19
|
+
toYear: T,
|
|
20
|
+
showFooter: i = !0,
|
|
21
|
+
disabled: x,
|
|
22
|
+
label: N,
|
|
23
|
+
helperText: C,
|
|
24
|
+
prefix: ae,
|
|
25
|
+
prefixClick: ce,
|
|
26
26
|
isError: h,
|
|
27
|
-
size:
|
|
28
|
-
required:
|
|
29
|
-
className:
|
|
30
|
-
...
|
|
31
|
-
},
|
|
32
|
-
const [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, [t, n]),
|
|
36
|
-
|
|
37
|
-
}, [
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (b(o), o === "") {
|
|
53
|
-
const a = { from: void 0, to: r?.to };
|
|
54
|
-
i(a), m || f?.(a);
|
|
27
|
+
size: D,
|
|
28
|
+
required: z,
|
|
29
|
+
className: L,
|
|
30
|
+
...X
|
|
31
|
+
}, q) => {
|
|
32
|
+
const [s, b] = m.useState(!1), [o, l] = m.useState(t), [G, y] = m.useState(t?.from ? a(t.from, n) : ""), [H, w] = m.useState(t?.to ? a(t.to, n) : ""), [J, v] = m.useState(t?.from || /* @__PURE__ */ new Date());
|
|
33
|
+
m.useEffect(() => {
|
|
34
|
+
y(t?.from ? a(t.from, n) : ""), w(t?.to ? a(t.to, n) : "");
|
|
35
|
+
}, [t, n]), m.useEffect(() => {
|
|
36
|
+
s && (l(t), v(t?.from || /* @__PURE__ */ new Date()));
|
|
37
|
+
}, [s]);
|
|
38
|
+
const K = (e) => {
|
|
39
|
+
l(e), i || e?.from && e?.to && e.from.getTime() !== e.to.getTime() && (p?.(e), b(!1));
|
|
40
|
+
}, Q = (e) => {
|
|
41
|
+
let r = e !== void 0 ? e : o;
|
|
42
|
+
r?.from && !r.to && (r = { from: r.from, to: r.from }), p?.(r), b(!1);
|
|
43
|
+
}, U = () => {
|
|
44
|
+
l(t), b(!1);
|
|
45
|
+
}, S = () => {
|
|
46
|
+
l(void 0), y(""), w(""), p?.(void 0), i || b(!1);
|
|
47
|
+
}, W = (e) => {
|
|
48
|
+
const r = V(e.target.value, n);
|
|
49
|
+
if (y(r), r === "") {
|
|
50
|
+
const d = { from: void 0, to: o?.to };
|
|
51
|
+
l(d), i || p?.(d);
|
|
55
52
|
return;
|
|
56
53
|
}
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
|
|
54
|
+
const f = I(r, n, /* @__PURE__ */ new Date());
|
|
55
|
+
if (M(f)) {
|
|
56
|
+
const d = { from: f, to: o?.to };
|
|
57
|
+
l(d), v(f), i || p?.(d);
|
|
61
58
|
}
|
|
62
|
-
},
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
|
|
59
|
+
}, Y = (e) => {
|
|
60
|
+
const r = V(e.target.value, n);
|
|
61
|
+
if (w(r), r === "") {
|
|
62
|
+
const d = { from: o?.from, to: void 0 };
|
|
63
|
+
l(d), i || p?.(d);
|
|
67
64
|
return;
|
|
68
65
|
}
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
const
|
|
72
|
-
|
|
66
|
+
const f = I(r, n, /* @__PURE__ */ new Date());
|
|
67
|
+
if (M(f)) {
|
|
68
|
+
const d = { from: o?.from, to: f };
|
|
69
|
+
l(d), f && v(f), i || p?.(d);
|
|
73
70
|
}
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
return /* @__PURE__ */ u("div", { className: "w-full space-y-1.5 min-w-[240px]", children: [
|
|
78
|
-
|
|
71
|
+
}, P = () => {
|
|
72
|
+
s || (y(o?.from ? a(o.from, n) : ""), w(o?.to ? a(o.to, n) : ""));
|
|
73
|
+
}, Z = t?.from ? a(t.from, n) : "", $ = t?.to ? a(t.to, n) : "", k = i && s ? o?.from ? a(o.from, n) : "" : G, R = i && s ? o?.to ? a(o.to, n) : o?.from ? a(o.from, n) : "" : H, _ = i && s && k !== Z, F = i && s && R !== $;
|
|
74
|
+
return /* @__PURE__ */ u("div", { className: "w-full space-y-1.5 min-w-[240px]", "data-component": "date-range-picker", "data-disabled": x || void 0, children: [
|
|
75
|
+
N && /* @__PURE__ */ u(
|
|
79
76
|
"label",
|
|
80
77
|
{
|
|
81
|
-
className:
|
|
78
|
+
className: g(
|
|
82
79
|
"text-xs font-medium leading-[18px] text-[#60697d]",
|
|
83
|
-
|
|
80
|
+
x && "opacity-70",
|
|
84
81
|
h && "text-destructive"
|
|
85
82
|
),
|
|
86
83
|
children: [
|
|
87
|
-
|
|
84
|
+
N,
|
|
88
85
|
" ",
|
|
89
|
-
|
|
86
|
+
z && /* @__PURE__ */ c("span", { className: "text-destructive", children: "*" })
|
|
90
87
|
]
|
|
91
88
|
}
|
|
92
89
|
),
|
|
93
|
-
/* @__PURE__ */ u(
|
|
94
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ u(oe, { open: s, onOpenChange: b, children: [
|
|
91
|
+
/* @__PURE__ */ c(re, { asChild: !0, children: /* @__PURE__ */ u(
|
|
95
92
|
"div",
|
|
96
93
|
{
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
"data-state": s ? "open" : "closed",
|
|
95
|
+
className: g(
|
|
96
|
+
"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",
|
|
99
97
|
h ? "border-destructive hover:border-destructive" : "border-input",
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
D === "sm" ? "h-6" : D === "md" ? "h-[28px]" : "h-8",
|
|
99
|
+
x && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
|
|
102
100
|
"cursor-pointer",
|
|
103
|
-
|
|
101
|
+
L
|
|
104
102
|
),
|
|
105
103
|
children: [
|
|
106
104
|
/* @__PURE__ */ u("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
|
|
107
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ c(
|
|
108
106
|
"input",
|
|
109
107
|
{
|
|
110
|
-
ref:
|
|
108
|
+
ref: q,
|
|
111
109
|
type: "text",
|
|
112
|
-
value:
|
|
113
|
-
onChange:
|
|
114
|
-
onBlur:
|
|
115
|
-
onClick: (e) =>
|
|
116
|
-
placeholder:
|
|
117
|
-
disabled: !!
|
|
118
|
-
|
|
119
|
-
|
|
110
|
+
value: k,
|
|
111
|
+
onChange: W,
|
|
112
|
+
onBlur: P,
|
|
113
|
+
onClick: (e) => s && e.stopPropagation(),
|
|
114
|
+
placeholder: s ? n : A,
|
|
115
|
+
disabled: !!x,
|
|
116
|
+
"data-field": "start",
|
|
117
|
+
className: g(
|
|
118
|
+
"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",
|
|
119
|
+
_ && "text-muted-foreground"
|
|
120
|
+
),
|
|
121
|
+
...X
|
|
120
122
|
}
|
|
121
123
|
),
|
|
122
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ c(
|
|
123
125
|
"input",
|
|
124
126
|
{
|
|
125
127
|
type: "text",
|
|
126
|
-
value:
|
|
127
|
-
onChange:
|
|
128
|
-
onBlur:
|
|
129
|
-
onClick: (e) =>
|
|
130
|
-
placeholder:
|
|
131
|
-
disabled: !!
|
|
132
|
-
|
|
128
|
+
value: R,
|
|
129
|
+
onChange: Y,
|
|
130
|
+
onBlur: P,
|
|
131
|
+
onClick: (e) => s && e.stopPropagation(),
|
|
132
|
+
placeholder: s ? n : E,
|
|
133
|
+
disabled: !!x,
|
|
134
|
+
"data-field": "end",
|
|
135
|
+
className: g(
|
|
136
|
+
"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",
|
|
137
|
+
F && "text-muted-foreground"
|
|
138
|
+
)
|
|
133
139
|
}
|
|
134
140
|
)
|
|
135
141
|
] }),
|
|
136
142
|
/* @__PURE__ */ u("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
137
|
-
t?.from && !
|
|
138
|
-
|
|
143
|
+
t?.from && !x && /* @__PURE__ */ c(
|
|
144
|
+
ee,
|
|
139
145
|
{
|
|
140
146
|
className: "h-4 w-4 cursor-pointer hover:text-foreground text-muted-foreground",
|
|
141
147
|
onClick: (e) => {
|
|
142
|
-
e.stopPropagation(),
|
|
148
|
+
e.stopPropagation(), S();
|
|
143
149
|
}
|
|
144
150
|
}
|
|
145
151
|
),
|
|
146
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ c(te, { className: "h-4 w-4 text-secondary-foreground" })
|
|
147
153
|
] })
|
|
148
154
|
]
|
|
149
155
|
}
|
|
150
156
|
) }),
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
-
|
|
157
|
+
/* @__PURE__ */ c(
|
|
158
|
+
se,
|
|
153
159
|
{
|
|
154
160
|
className: "w-auto p-0",
|
|
155
161
|
align: "start",
|
|
156
162
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
te,
|
|
163
|
+
children: /* @__PURE__ */ c(
|
|
164
|
+
ie,
|
|
160
165
|
{
|
|
161
166
|
mode: "range",
|
|
162
|
-
selected:
|
|
163
|
-
onSelect:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
onClear: C,
|
|
167
|
+
selected: o,
|
|
168
|
+
onSelect: K,
|
|
169
|
+
month: J,
|
|
170
|
+
onMonthChange: v,
|
|
171
|
+
disabled: { before: j, after: B },
|
|
172
|
+
fromYear: O,
|
|
173
|
+
toYear: T,
|
|
174
|
+
showFooter: i,
|
|
175
|
+
onApply: Q,
|
|
176
|
+
onCancel: U,
|
|
177
|
+
onClear: S,
|
|
174
178
|
captionLayout: "dropdown"
|
|
175
179
|
}
|
|
176
180
|
)
|
|
177
181
|
}
|
|
178
182
|
)
|
|
179
183
|
] }),
|
|
180
|
-
|
|
181
|
-
!h && /* @__PURE__ */
|
|
182
|
-
/* @__PURE__ */
|
|
184
|
+
C && /* @__PURE__ */ u("div", { className: g("flex items-center gap-1", h && "text-destructive"), children: [
|
|
185
|
+
!h && /* @__PURE__ */ c(ne, { size: 10, className: "shrink-0 text-muted-foreground" }),
|
|
186
|
+
/* @__PURE__ */ c(
|
|
183
187
|
"p",
|
|
184
188
|
{
|
|
185
|
-
className:
|
|
189
|
+
className: g(
|
|
186
190
|
"text-[10px] text-[#7a8294]",
|
|
187
191
|
h && "text-destructive"
|
|
188
192
|
),
|
|
189
|
-
children:
|
|
193
|
+
children: C
|
|
190
194
|
}
|
|
191
195
|
)
|
|
192
196
|
] })
|
|
193
197
|
] });
|
|
194
198
|
}
|
|
195
199
|
);
|
|
196
|
-
|
|
200
|
+
de.displayName = "DateRangePicker";
|
|
197
201
|
export {
|
|
198
|
-
|
|
202
|
+
de as DateRangePicker
|
|
199
203
|
};
|