impact-nova 1.3.0 → 1.5.2
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/README.md +49 -0
- package/dist/components/layout/dashboard-layout.d.ts +15 -1
- package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +65 -64
- package/dist/components/ui/accordion.js +38 -34
- package/dist/components/ui/ag-grid-react/cell-renderers/badge-cell-renderer.js +1 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.d.ts +58 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.js +104 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/input-cell-editor.js +62 -54
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +54 -68
- package/dist/components/ui/ag-grid-react/cell-renderers/index.d.ts +3 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/index.js +33 -27
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +3 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.js +28 -12
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.d.ts +2 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.js +45 -44
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +23 -37
- package/dist/components/ui/ag-grid-react/cell-renderers/types.d.ts +33 -17
- package/dist/components/ui/ag-grid-react/editable-utils.d.ts +27 -0
- package/dist/components/ui/ag-grid-react/editable-utils.js +62 -0
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +99 -98
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +110 -143
- package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +72 -69
- package/dist/components/ui/ag-grid-react/headers/components/header-info.js +36 -35
- package/dist/components/ui/ag-grid-react/headers/components/info-modal.js +14 -12
- package/dist/components/ui/ag-grid-react/headers/custom-header.js +111 -110
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +204 -203
- package/dist/components/ui/alert.js +62 -58
- package/dist/components/ui/breadcrumb.js +81 -74
- package/dist/components/ui/calendar.js +354 -354
- package/dist/components/ui/chart/chart.js +63 -62
- package/dist/components/ui/chips.js +42 -38
- package/dist/components/ui/command-palette/command-palette-context.d.ts +52 -0
- package/dist/components/ui/command-palette/command-palette-context.js +110 -0
- package/dist/components/ui/command-palette/command-palette.d.ts +67 -0
- package/dist/components/ui/command-palette/command-palette.js +402 -0
- package/dist/components/ui/command-palette/index.d.ts +23 -0
- package/dist/components/ui/command-palette/index.js +44 -0
- package/dist/components/ui/command-palette/kbd.d.ts +28 -0
- package/dist/components/ui/command-palette/kbd.js +52 -0
- package/dist/components/ui/command-palette/shortcut-registry.d.ts +68 -0
- package/dist/components/ui/command-palette/shortcut-registry.js +183 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.d.ts +55 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.js +55 -0
- package/dist/components/ui/command-palette/shortcut-settings.d.ts +27 -0
- package/dist/components/ui/command-palette/shortcut-settings.js +266 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.d.ts +32 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.js +48 -0
- package/dist/components/ui/command-palette/use-global-shortcut.d.ts +3 -0
- package/dist/components/ui/command-palette/use-global-shortcut.js +7 -0
- package/dist/components/ui/command-palette/use-shortcut.d.ts +47 -0
- package/dist/components/ui/command-palette/use-shortcut.js +49 -0
- package/dist/components/ui/command-palette/utils.d.ts +119 -0
- package/dist/components/ui/command-palette/utils.js +248 -0
- package/dist/components/ui/data-table/data-table-column-list.js +87 -86
- package/dist/components/ui/data-table/data-table-format-options.js +45 -44
- package/dist/components/ui/data-table/data-table-view-options.js +39 -38
- package/dist/components/ui/date-picker/date-picker.js +89 -87
- package/dist/components/ui/date-picker/date-range-picker.js +140 -138
- package/dist/components/ui/date-picker/month-picker.js +82 -81
- package/dist/components/ui/date-picker/month-range-picker.js +108 -105
- package/dist/components/ui/date-picker/multi-date-picker.js +68 -66
- package/dist/components/ui/date-picker/multi-month-picker.js +59 -58
- package/dist/components/ui/date-picker/multi-week-picker.js +80 -78
- package/dist/components/ui/date-picker/week-picker.js +117 -115
- package/dist/components/ui/date-picker/week-range-picker.js +166 -164
- package/dist/components/ui/dialog.js +78 -73
- package/dist/components/ui/drawer.js +71 -66
- package/dist/components/ui/file-upload.js +131 -127
- package/dist/components/ui/filter-panel/filter-panel.js +98 -94
- package/dist/components/ui/filter-strip/filter-strip.js +95 -91
- package/dist/components/ui/filter-strip/filter-summary.js +91 -90
- package/dist/components/ui/header.js +57 -53
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +78 -76
- package/dist/components/ui/loader.js +17 -16
- package/dist/components/ui/nested-list/components/NestedListHeader.d.ts +1 -0
- package/dist/components/ui/nested-list/components/NestedListHeader.js +51 -48
- package/dist/components/ui/nested-list/components/SortableItem.js +60 -59
- package/dist/components/ui/nested-list/nested-list.js +184 -182
- package/dist/components/ui/notification-panel/notification-panel.js +60 -53
- package/dist/components/ui/popover.js +45 -40
- package/dist/components/ui/prompt.js +90 -86
- package/dist/components/ui/select/select.js +206 -209
- package/dist/components/ui/sheet.d.ts +1 -0
- package/dist/components/ui/sheet.js +50 -48
- package/dist/components/ui/sidebar.js +273 -267
- package/dist/components/ui/stepper.js +75 -63
- package/dist/components/ui/tag.js +48 -44
- package/dist/components/ui/toast.js +46 -41
- package/dist/i18n/ImpactNovaI18nContext.d.ts +21 -0
- package/dist/i18n/ImpactNovaI18nContext.js +76 -0
- package/dist/i18n/defaultMessages.d.ts +231 -0
- package/dist/i18n/defaultMessages.js +206 -0
- package/dist/i18n/getDateFnsLocale.d.ts +11 -0
- package/dist/i18n/getDateFnsLocale.js +21 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/locales/de.d.ts +2 -0
- package/dist/i18n/locales/de.js +206 -0
- package/dist/i18n/locales/es.d.ts +2 -0
- package/dist/i18n/locales/es.js +206 -0
- package/dist/i18n/locales/hi.d.ts +2 -0
- package/dist/i18n/locales/hi.js +206 -0
- package/dist/i18n/locales/index.d.ts +4 -0
- package/dist/i18n/locales/kn.d.ts +2 -0
- package/dist/i18n/locales/kn.js +206 -0
- package/dist/icons/assets/boxAdd.svg.js +5 -0
- package/dist/icons/assets/boxed.svg.js +5 -0
- package/dist/icons/assets/trolley.svg.js +5 -0
- package/dist/icons/assets/unlocked.svg.js +5 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +179 -171
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +232 -172
- package/package.json +36 -4
- package/dist/components/ui/ag-grid-react/cell-renderers/types.js +0 -74
|
@@ -1,124 +1,125 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as M, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import * as o from "react";
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import { isValid as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
10
|
-
import { Tooltip as
|
|
11
|
-
|
|
3
|
+
import { X as K } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as L } from "../../../icons/index.js";
|
|
5
|
+
import { isValid as u, parse as C } from "date-fns";
|
|
6
|
+
import { cn as Q, padValidDateString as U, maskDate as W } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as Z } from "../input.js";
|
|
8
|
+
import { Popover as _, PopoverTrigger as F, PopoverContent as v } from "../popover.js";
|
|
9
|
+
import { Calendar as tt } from "../calendar.js";
|
|
10
|
+
import { Tooltip as I, TooltipTrigger as T, TooltipContent as N } from "../tooltip.js";
|
|
11
|
+
import { useImpactNovaI18n as et } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
12
|
+
const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, nt = o.forwardRef(
|
|
12
13
|
({
|
|
13
14
|
value: t,
|
|
14
15
|
onChange: s,
|
|
15
|
-
placeholder:
|
|
16
|
-
minDate:
|
|
17
|
-
maxDate:
|
|
18
|
-
startMonth:
|
|
19
|
-
endMonth:
|
|
16
|
+
placeholder: V,
|
|
17
|
+
minDate: A,
|
|
18
|
+
maxDate: R,
|
|
19
|
+
startMonth: O,
|
|
20
|
+
endMonth: Y,
|
|
20
21
|
showFooter: d = !0,
|
|
21
|
-
disabled:
|
|
22
|
-
className:
|
|
23
|
-
...
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
o.useRef(null), o.useImperativeHandle(
|
|
27
|
-
const [r, h] = o.useState(!1), [
|
|
22
|
+
disabled: P,
|
|
23
|
+
className: j,
|
|
24
|
+
...B
|
|
25
|
+
}, E) => {
|
|
26
|
+
const { t: m } = et(), $ = V ?? m("datePicker.selectMonth"), w = o.useRef(null);
|
|
27
|
+
o.useRef(null), o.useImperativeHandle(E, () => w.current);
|
|
28
|
+
const [r, h] = o.useState(!1), [S, a] = o.useState(t), [l, i] = o.useState(t ? c(t) : ""), [b, g] = o.useState(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date());
|
|
28
29
|
o.useEffect(() => {
|
|
29
|
-
r || (
|
|
30
|
+
r || (i(t ? c(t) : ""), a(t));
|
|
30
31
|
}, [r, t]), o.useEffect(() => {
|
|
31
|
-
r && (
|
|
32
|
+
r && (a(t), g(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), i(t ? c(t) : ""));
|
|
32
33
|
}, [r, t]);
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
}, b = (e) => {
|
|
36
|
-
s?.(e !== void 0 ? e : w), h(!1);
|
|
37
|
-
}, H = () => {
|
|
38
|
-
i(t), a(t ? c(t) : ""), h(!1);
|
|
39
|
-
}, D = () => {
|
|
40
|
-
i(void 0), a(""), s?.(void 0), d || h(!1);
|
|
34
|
+
const H = (e) => {
|
|
35
|
+
a(e), e && i(c(e)), d || (s?.(e), h(!1));
|
|
41
36
|
}, X = (e) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
s?.(e !== void 0 ? e : S), h(!1);
|
|
38
|
+
}, q = () => {
|
|
39
|
+
a(t), i(t ? c(t) : ""), h(!1);
|
|
40
|
+
}, k = () => {
|
|
41
|
+
a(void 0), i(""), s?.(void 0), d || h(!1);
|
|
42
|
+
}, z = (e) => {
|
|
43
|
+
const p = e.target.value, f = W(p, "MM/yyyy", l);
|
|
44
|
+
if (i(f), f === "") {
|
|
45
|
+
a(void 0), d || s?.(void 0);
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const x = { month:
|
|
50
|
-
|
|
48
|
+
const y = C(f, "MM/yyyy", /* @__PURE__ */ new Date());
|
|
49
|
+
if (u(y) && f.length === 7) {
|
|
50
|
+
const x = { month: y.getMonth(), year: y.getFullYear() };
|
|
51
|
+
a(x), g(y), d || s?.(x);
|
|
51
52
|
}
|
|
52
|
-
},
|
|
53
|
+
}, G = () => {
|
|
53
54
|
if (r) return;
|
|
54
|
-
const e =
|
|
55
|
-
if (!
|
|
56
|
-
|
|
57
|
-
else if (
|
|
58
|
-
const f = { month:
|
|
55
|
+
const e = U(l, "MM/yyyy"), p = C(e, "MM/yyyy", /* @__PURE__ */ new Date());
|
|
56
|
+
if (!u(p) || e.length !== 7)
|
|
57
|
+
i(t ? c(t) : ""), a(t);
|
|
58
|
+
else if (i(e), !d) {
|
|
59
|
+
const f = { month: p.getMonth(), year: p.getFullYear() };
|
|
59
60
|
s?.(f);
|
|
60
61
|
}
|
|
61
|
-
},
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */ n(
|
|
64
|
-
|
|
62
|
+
}, D = (t ? c(t) : "") !== l, J = l.length === 7 && !u(C(l, "MM/yyyy", /* @__PURE__ */ new Date()));
|
|
63
|
+
return /* @__PURE__ */ M(_, { open: r, onOpenChange: h, children: [
|
|
64
|
+
/* @__PURE__ */ n(F, { asChild: !0, children: /* @__PURE__ */ n("div", { "data-component": "month-picker", "data-state": r ? "open" : "closed", "data-pending": D || void 0, children: /* @__PURE__ */ n(
|
|
65
|
+
Z,
|
|
65
66
|
{
|
|
66
|
-
ref:
|
|
67
|
-
value:
|
|
68
|
-
onChange:
|
|
69
|
-
onBlur:
|
|
67
|
+
ref: w,
|
|
68
|
+
value: l,
|
|
69
|
+
onChange: z,
|
|
70
|
+
onBlur: G,
|
|
70
71
|
onClick: (e) => r && e.stopPropagation(),
|
|
71
|
-
placeholder: r ? "
|
|
72
|
-
disabled:
|
|
72
|
+
placeholder: r ? m("datePicker.monthYearFormat") : $,
|
|
73
|
+
disabled: P,
|
|
73
74
|
"data-form-control": "input",
|
|
74
|
-
className:
|
|
75
|
+
className: Q(
|
|
75
76
|
"cursor-pointer",
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
J ? "text-destructive" : D ? "text-muted-foreground" : "",
|
|
78
|
+
j
|
|
78
79
|
),
|
|
79
|
-
suffix: /* @__PURE__ */
|
|
80
|
-
t && !
|
|
80
|
+
suffix: /* @__PURE__ */ M("div", { className: "flex items-center gap-1", children: [
|
|
81
|
+
t && !P && /* @__PURE__ */ M(I, { children: [
|
|
81
82
|
/* @__PURE__ */ n(T, { asChild: !0, children: /* @__PURE__ */ n(
|
|
82
|
-
|
|
83
|
+
K,
|
|
83
84
|
{
|
|
84
85
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
85
86
|
onClick: (e) => {
|
|
86
|
-
e.stopPropagation(),
|
|
87
|
+
e.stopPropagation(), k();
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
) }),
|
|
90
|
-
/* @__PURE__ */ n(
|
|
91
|
+
/* @__PURE__ */ n(N, { variant: "tertiary", side: "top", children: m("calendar.clear") })
|
|
91
92
|
] }),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */ n(T, { asChild: !0, children: /* @__PURE__ */ n(
|
|
94
|
-
/* @__PURE__ */ n(
|
|
93
|
+
/* @__PURE__ */ M(I, { children: [
|
|
94
|
+
/* @__PURE__ */ n(T, { asChild: !0, children: /* @__PURE__ */ n(L, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
95
|
+
/* @__PURE__ */ n(N, { variant: "tertiary", side: "top", children: m("datePicker.selectMonth") })
|
|
95
96
|
] })
|
|
96
97
|
] }),
|
|
97
|
-
...
|
|
98
|
+
...B
|
|
98
99
|
}
|
|
99
100
|
) }) }),
|
|
100
101
|
/* @__PURE__ */ n(
|
|
101
|
-
|
|
102
|
+
v,
|
|
102
103
|
{
|
|
103
104
|
className: "w-auto p-0",
|
|
104
105
|
align: "start",
|
|
105
106
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
106
107
|
children: /* @__PURE__ */ n(
|
|
107
|
-
|
|
108
|
+
tt,
|
|
108
109
|
{
|
|
109
110
|
pickerType: "month",
|
|
110
111
|
monthMode: "single",
|
|
111
|
-
selectedMonths:
|
|
112
|
-
onMonthSelect:
|
|
113
|
-
month:
|
|
114
|
-
onMonthChange:
|
|
115
|
-
disabled: { before:
|
|
116
|
-
startMonth:
|
|
117
|
-
endMonth:
|
|
112
|
+
selectedMonths: S,
|
|
113
|
+
onMonthSelect: H,
|
|
114
|
+
month: b,
|
|
115
|
+
onMonthChange: g,
|
|
116
|
+
disabled: { before: A, after: R },
|
|
117
|
+
startMonth: O,
|
|
118
|
+
endMonth: Y,
|
|
118
119
|
showFooter: d,
|
|
119
|
-
onApply:
|
|
120
|
-
onCancel:
|
|
121
|
-
onClear:
|
|
120
|
+
onApply: X,
|
|
121
|
+
onCancel: q,
|
|
122
|
+
onClear: k
|
|
122
123
|
}
|
|
123
124
|
)
|
|
124
125
|
}
|
|
@@ -126,7 +127,7 @@ const c = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, v = o
|
|
|
126
127
|
] });
|
|
127
128
|
}
|
|
128
129
|
);
|
|
129
|
-
|
|
130
|
+
nt.displayName = "MonthPicker";
|
|
130
131
|
export {
|
|
131
|
-
|
|
132
|
+
nt as MonthPicker
|
|
132
133
|
};
|
|
@@ -1,127 +1,130 @@
|
|
|
1
1
|
import { jsxs as f, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import { isValid as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
9
|
-
import { Tooltip as
|
|
10
|
-
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { X as ct } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as lt, Info as mt } from "../../../icons/index.js";
|
|
5
|
+
import { isValid as w, parse as S } from "date-fns";
|
|
6
|
+
import { cn as P, padValidDateString as A, maskDate as j } from "../../../lib/utils.js";
|
|
7
|
+
import { Popover as ft, PopoverTrigger as pt, PopoverContent as ht } from "../popover.js";
|
|
8
|
+
import { Calendar as yt } from "../calendar.js";
|
|
9
|
+
import { Tooltip as B, TooltipTrigger as O, TooltipContent as $ } from "../tooltip.js";
|
|
10
|
+
import { useImpactNovaI18n as ut } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
11
|
+
const n = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, gt = d.forwardRef(
|
|
11
12
|
({
|
|
12
13
|
value: t,
|
|
13
14
|
onChange: l,
|
|
14
|
-
placeholder:
|
|
15
|
-
minDate:
|
|
16
|
-
maxDate:
|
|
17
|
-
startMonth:
|
|
18
|
-
endMonth:
|
|
15
|
+
placeholder: z,
|
|
16
|
+
minDate: H,
|
|
17
|
+
maxDate: X,
|
|
18
|
+
startMonth: q,
|
|
19
|
+
endMonth: v,
|
|
19
20
|
showFooter: p = !0,
|
|
20
|
-
disabled:
|
|
21
|
-
className:
|
|
22
|
-
isError:
|
|
21
|
+
disabled: x,
|
|
22
|
+
className: F,
|
|
23
|
+
isError: k,
|
|
23
24
|
size: N,
|
|
24
|
-
label:
|
|
25
|
-
helperText:
|
|
25
|
+
label: I,
|
|
26
|
+
helperText: D,
|
|
26
27
|
required: G,
|
|
27
|
-
prefix:
|
|
28
|
-
prefixClick:
|
|
28
|
+
prefix: xt,
|
|
29
|
+
prefixClick: Mt,
|
|
29
30
|
...J
|
|
30
31
|
}, K) => {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, [
|
|
32
|
+
const { t: u } = ut();
|
|
33
|
+
z ?? u("datePicker.selectMonthRange");
|
|
34
|
+
const V = d.useRef(null), L = d.useRef(null);
|
|
35
|
+
d.useRef(null), d.useRef(null), d.useImperativeHandle(K, () => V.current);
|
|
36
|
+
const [s, R] = d.useState(!1), [E, i] = d.useState(t), [M, h] = d.useState(t?.from ? n(t.from) : ""), [b, y] = d.useState(t?.to ? n(t.to) : ""), [Q, C] = d.useState(() => t?.from ? new Date(t.from.year, t.from.month, 1) : /* @__PURE__ */ new Date());
|
|
37
|
+
d.useEffect(() => {
|
|
38
|
+
s || (h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), i(t));
|
|
39
|
+
}, [s, t]), d.useEffect(() => {
|
|
40
|
+
s && (i(t), h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), C(t?.from ? new Date(t.from.year, t.from.month, 1) : /* @__PURE__ */ new Date()));
|
|
41
|
+
}, [s, t]);
|
|
39
42
|
const U = (e) => {
|
|
40
|
-
i(e), e?.from && h(n(e.from)), e?.to && y(n(e.to)), !p && e?.from && e?.to && (e.from.month !== e.to.month || e.from.year !== e.to.year) && (l?.(e),
|
|
43
|
+
i(e), e?.from && h(n(e.from)), e?.to && y(n(e.to)), !p && e?.from && e?.to && (e.from.month !== e.to.month || e.from.year !== e.to.year) && (l?.(e), R(!1));
|
|
41
44
|
}, W = (e) => {
|
|
42
|
-
l?.(e !== void 0 ? e :
|
|
45
|
+
l?.(e !== void 0 ? e : E), R(!1);
|
|
43
46
|
}, Z = () => {
|
|
44
|
-
i(t), h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""),
|
|
45
|
-
},
|
|
46
|
-
i(void 0), h(""), y(""), l?.(void 0), p ||
|
|
47
|
-
},
|
|
48
|
-
const m = e.target.value, r =
|
|
47
|
+
i(t), h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), R(!1);
|
|
48
|
+
}, T = () => {
|
|
49
|
+
i(void 0), h(""), y(""), l?.(void 0), p || R(!1);
|
|
50
|
+
}, _ = (e) => {
|
|
51
|
+
const m = e.target.value, r = j(m, "MM/yyyy", M);
|
|
49
52
|
if (h(r), r === "") {
|
|
50
53
|
const c = { from: void 0, to: t?.to };
|
|
51
54
|
i(c), p || l?.(c);
|
|
52
55
|
return;
|
|
53
56
|
}
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
i(
|
|
57
|
+
const a = S(r, "MM/yyyy", /* @__PURE__ */ new Date());
|
|
58
|
+
if (w(a) && r.length === 7) {
|
|
59
|
+
const g = { from: { month: a.getMonth(), year: a.getFullYear() }, to: t?.to };
|
|
60
|
+
i(g), C(a), p || l?.(g);
|
|
58
61
|
}
|
|
59
|
-
},
|
|
60
|
-
const m = e.target.value, r =
|
|
62
|
+
}, tt = (e) => {
|
|
63
|
+
const m = e.target.value, r = j(m, "MM/yyyy", b);
|
|
61
64
|
if (y(r), r === "") {
|
|
62
65
|
const c = { from: t?.from, to: void 0 };
|
|
63
66
|
i(c), p || l?.(c);
|
|
64
67
|
return;
|
|
65
68
|
}
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
const c = { month:
|
|
69
|
-
i(
|
|
69
|
+
const a = S(r, "MM/yyyy", /* @__PURE__ */ new Date());
|
|
70
|
+
if (w(a) && r.length === 7) {
|
|
71
|
+
const c = { month: a.getMonth(), year: a.getFullYear() }, g = { from: t?.from, to: c };
|
|
72
|
+
i(g), C(a), p || l?.(g);
|
|
70
73
|
}
|
|
71
|
-
},
|
|
72
|
-
if (
|
|
73
|
-
const e =
|
|
74
|
-
!c || !
|
|
74
|
+
}, Y = () => {
|
|
75
|
+
if (s) return;
|
|
76
|
+
const e = A(M, "MM/yyyy"), m = A(b, "MM/yyyy"), r = S(e, "MM/yyyy", /* @__PURE__ */ new Date()), a = S(m, "MM/yyyy", /* @__PURE__ */ new Date()), c = w(r) && e.length === 7, g = w(a) && m.length === 7;
|
|
77
|
+
!c || !g ? (h(t?.from ? n(t.from) : ""), y(t?.to ? n(t.to) : ""), i(t)) : (h(e), y(m), p || l?.({
|
|
75
78
|
from: { month: r.getMonth(), year: r.getFullYear() },
|
|
76
|
-
to: { month:
|
|
79
|
+
to: { month: a.getMonth(), year: a.getFullYear() }
|
|
77
80
|
}));
|
|
78
|
-
},
|
|
79
|
-
return /* @__PURE__ */ f("div", { className: "w-full space-y-1.5 min-w-[240px]", "data-component": "month-range-picker", "data-disabled":
|
|
80
|
-
|
|
81
|
+
}, et = t?.from ? n(t.from) : "", ot = t?.to ? n(t.to) : "", nt = M !== et, rt = b !== ot, at = M.length === 7 && !w(S(M, "MM/yyyy", /* @__PURE__ */ new Date())), dt = b.length === 7 && !w(S(b, "MM/yyyy", /* @__PURE__ */ new Date())), st = u("datePicker.startMonth"), it = u("datePicker.endMonth");
|
|
82
|
+
return /* @__PURE__ */ f("div", { className: "w-full space-y-1.5 min-w-[240px]", "data-component": "month-range-picker", "data-disabled": x || void 0, children: [
|
|
83
|
+
I && /* @__PURE__ */ f(
|
|
81
84
|
"label",
|
|
82
85
|
{
|
|
83
|
-
className:
|
|
86
|
+
className: P(
|
|
84
87
|
"text-xs font-medium leading-[18px] text-[#60697d]",
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
x && "opacity-70",
|
|
89
|
+
k && "text-destructive"
|
|
87
90
|
),
|
|
88
91
|
children: [
|
|
89
|
-
|
|
92
|
+
I,
|
|
90
93
|
" ",
|
|
91
94
|
G && /* @__PURE__ */ o("span", { className: "text-destructive", children: "*" })
|
|
92
95
|
]
|
|
93
96
|
}
|
|
94
97
|
),
|
|
95
|
-
/* @__PURE__ */ f(
|
|
96
|
-
/* @__PURE__ */ o(
|
|
98
|
+
/* @__PURE__ */ f(ft, { open: s, onOpenChange: R, children: [
|
|
99
|
+
/* @__PURE__ */ o(pt, { asChild: !0, children: /* @__PURE__ */ f(
|
|
97
100
|
"div",
|
|
98
101
|
{
|
|
99
|
-
"data-state":
|
|
100
|
-
className:
|
|
102
|
+
"data-state": s ? "open" : "closed",
|
|
103
|
+
className: P(
|
|
101
104
|
"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",
|
|
102
|
-
|
|
105
|
+
k ? "border-destructive hover:border-destructive" : "border-input",
|
|
103
106
|
N === "sm" ? "h-6" : N === "md" ? "h-[28px]" : "h-8",
|
|
104
|
-
|
|
107
|
+
x && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
|
|
105
108
|
"cursor-pointer",
|
|
106
|
-
|
|
109
|
+
F
|
|
107
110
|
),
|
|
108
111
|
children: [
|
|
109
112
|
/* @__PURE__ */ f("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
|
|
110
113
|
/* @__PURE__ */ o(
|
|
111
114
|
"input",
|
|
112
115
|
{
|
|
113
|
-
ref:
|
|
116
|
+
ref: V,
|
|
114
117
|
type: "text",
|
|
115
|
-
value:
|
|
116
|
-
onChange:
|
|
117
|
-
onBlur:
|
|
118
|
-
onClick: (e) =>
|
|
119
|
-
placeholder:
|
|
120
|
-
disabled: !!
|
|
118
|
+
value: M,
|
|
119
|
+
onChange: _,
|
|
120
|
+
onBlur: Y,
|
|
121
|
+
onClick: (e) => s && e.stopPropagation(),
|
|
122
|
+
placeholder: s ? u("datePicker.monthYearFormat") : st,
|
|
123
|
+
disabled: !!x,
|
|
121
124
|
"data-field": "start",
|
|
122
|
-
className:
|
|
125
|
+
className: P(
|
|
123
126
|
"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",
|
|
124
|
-
|
|
127
|
+
at ? "text-destructive" : nt ? "text-muted-foreground" : ""
|
|
125
128
|
),
|
|
126
129
|
...J
|
|
127
130
|
}
|
|
@@ -131,85 +134,85 @@ const n = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, ft =
|
|
|
131
134
|
{
|
|
132
135
|
ref: L,
|
|
133
136
|
type: "text",
|
|
134
|
-
value:
|
|
135
|
-
onChange:
|
|
136
|
-
onBlur:
|
|
137
|
-
onClick: (e) =>
|
|
138
|
-
placeholder:
|
|
139
|
-
disabled: !!
|
|
137
|
+
value: b,
|
|
138
|
+
onChange: tt,
|
|
139
|
+
onBlur: Y,
|
|
140
|
+
onClick: (e) => s && e.stopPropagation(),
|
|
141
|
+
placeholder: s ? u("datePicker.monthYearFormat") : it,
|
|
142
|
+
disabled: !!x,
|
|
140
143
|
"data-field": "end",
|
|
141
|
-
className:
|
|
144
|
+
className: P(
|
|
142
145
|
"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",
|
|
143
|
-
|
|
146
|
+
dt ? "text-destructive" : rt ? "text-muted-foreground" : ""
|
|
144
147
|
)
|
|
145
148
|
}
|
|
146
149
|
)
|
|
147
150
|
] }),
|
|
148
151
|
/* @__PURE__ */ f("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
149
|
-
t?.from && !
|
|
150
|
-
/* @__PURE__ */ o(
|
|
151
|
-
|
|
152
|
+
t?.from && !x && /* @__PURE__ */ f(B, { children: [
|
|
153
|
+
/* @__PURE__ */ o(O, { asChild: !0, children: /* @__PURE__ */ o(
|
|
154
|
+
ct,
|
|
152
155
|
{
|
|
153
156
|
className: "h-4 w-4 cursor-pointer hover:text-foreground text-muted-foreground",
|
|
154
157
|
onClick: (e) => {
|
|
155
|
-
e.stopPropagation(),
|
|
158
|
+
e.stopPropagation(), T();
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
) }),
|
|
159
|
-
/* @__PURE__ */ o(
|
|
162
|
+
/* @__PURE__ */ o($, { variant: "tertiary", side: "top", children: u("calendar.clear") })
|
|
160
163
|
] }),
|
|
161
|
-
/* @__PURE__ */ f(
|
|
162
|
-
/* @__PURE__ */ o(
|
|
163
|
-
/* @__PURE__ */ o(
|
|
164
|
+
/* @__PURE__ */ f(B, { children: [
|
|
165
|
+
/* @__PURE__ */ o(O, { asChild: !0, children: /* @__PURE__ */ o(lt, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
166
|
+
/* @__PURE__ */ o($, { variant: "tertiary", side: "top", children: u("datePicker.selectMonthRange") })
|
|
164
167
|
] })
|
|
165
168
|
] })
|
|
166
169
|
]
|
|
167
170
|
}
|
|
168
171
|
) }),
|
|
169
172
|
/* @__PURE__ */ o(
|
|
170
|
-
|
|
173
|
+
ht,
|
|
171
174
|
{
|
|
172
175
|
className: "w-auto p-0",
|
|
173
176
|
align: "start",
|
|
174
177
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
175
178
|
children: /* @__PURE__ */ o(
|
|
176
|
-
|
|
179
|
+
yt,
|
|
177
180
|
{
|
|
178
181
|
pickerType: "month",
|
|
179
182
|
monthMode: "range",
|
|
180
|
-
selectedMonths:
|
|
183
|
+
selectedMonths: E,
|
|
181
184
|
onMonthSelect: U,
|
|
182
185
|
month: Q,
|
|
183
|
-
onMonthChange:
|
|
184
|
-
disabled: { before:
|
|
185
|
-
startMonth:
|
|
186
|
-
endMonth:
|
|
186
|
+
onMonthChange: C,
|
|
187
|
+
disabled: { before: H, after: X },
|
|
188
|
+
startMonth: q,
|
|
189
|
+
endMonth: v,
|
|
187
190
|
showFooter: p,
|
|
188
191
|
onApply: W,
|
|
189
192
|
onCancel: Z,
|
|
190
|
-
onClear:
|
|
193
|
+
onClear: T
|
|
191
194
|
}
|
|
192
195
|
)
|
|
193
196
|
}
|
|
194
197
|
)
|
|
195
198
|
] }),
|
|
196
|
-
|
|
197
|
-
!
|
|
199
|
+
D && /* @__PURE__ */ f("div", { className: P("flex items-center gap-1", k && "text-destructive"), children: [
|
|
200
|
+
!k && /* @__PURE__ */ o(mt, { size: 10, className: "shrink-0 text-muted-foreground" }),
|
|
198
201
|
/* @__PURE__ */ o(
|
|
199
202
|
"p",
|
|
200
203
|
{
|
|
201
|
-
className:
|
|
204
|
+
className: P(
|
|
202
205
|
"text-[10px] text-[#7a8294]",
|
|
203
|
-
|
|
206
|
+
k && "text-destructive"
|
|
204
207
|
),
|
|
205
|
-
children:
|
|
208
|
+
children: D
|
|
206
209
|
}
|
|
207
210
|
)
|
|
208
211
|
] })
|
|
209
212
|
] });
|
|
210
213
|
}
|
|
211
214
|
);
|
|
212
|
-
|
|
215
|
+
gt.displayName = "MonthRangePicker";
|
|
213
216
|
export {
|
|
214
|
-
|
|
217
|
+
gt as MonthRangePicker
|
|
215
218
|
};
|