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,91 +1,93 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import { format as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
10
|
-
import { Tooltip as
|
|
11
|
-
|
|
1
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { X as j } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as R } from "../../../icons/index.js";
|
|
5
|
+
import { format as b } from "date-fns";
|
|
6
|
+
import { cn as E } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as F } from "../input.js";
|
|
8
|
+
import { Popover as V, PopoverTrigger as X, PopoverContent as $ } from "../popover.js";
|
|
9
|
+
import { Calendar as q } from "../calendar.js";
|
|
10
|
+
import { Tooltip as u, TooltipTrigger as g, TooltipContent as y } from "../tooltip.js";
|
|
11
|
+
import { getDateFnsLocale as z } from "../../../i18n/getDateFnsLocale.js";
|
|
12
|
+
import { useImpactNovaI18n as B } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
13
|
+
const G = r.forwardRef(
|
|
12
14
|
({
|
|
13
15
|
value: e,
|
|
14
|
-
onChange:
|
|
15
|
-
format:
|
|
16
|
-
placeholder:
|
|
17
|
-
minDate:
|
|
18
|
-
maxDate:
|
|
19
|
-
startMonth:
|
|
20
|
-
endMonth:
|
|
16
|
+
onChange: i,
|
|
17
|
+
format: C = "MM/dd/yyyy",
|
|
18
|
+
placeholder: P,
|
|
19
|
+
minDate: M,
|
|
20
|
+
maxDate: x,
|
|
21
|
+
startMonth: D,
|
|
22
|
+
endMonth: N,
|
|
21
23
|
showFooter: s = !0,
|
|
22
|
-
disabled:
|
|
23
|
-
className:
|
|
24
|
-
...
|
|
25
|
-
},
|
|
26
|
-
const [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
}, S = (
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */ t(
|
|
41
|
-
|
|
24
|
+
disabled: d,
|
|
25
|
+
className: T,
|
|
26
|
+
...k
|
|
27
|
+
}, A) => {
|
|
28
|
+
const { locale: p, t: c } = B(), v = r.useMemo(() => z(p), [p]), L = P ?? c("datePicker.selectMultipleDates"), [m, n] = r.useState(!1), [f, a] = r.useState(e);
|
|
29
|
+
r.useEffect(() => {
|
|
30
|
+
a(e);
|
|
31
|
+
}, [m, e]);
|
|
32
|
+
const O = (o) => {
|
|
33
|
+
a(o), s || i?.(o);
|
|
34
|
+
}, S = (o) => {
|
|
35
|
+
i?.(o !== void 0 ? o : f), n(!1);
|
|
36
|
+
}, w = () => {
|
|
37
|
+
a(e), n(!1);
|
|
38
|
+
}, h = () => {
|
|
39
|
+
a(void 0), i?.(void 0), s || n(!1);
|
|
40
|
+
}, I = e && e.length > 0 ? e.length === 1 ? b(e[0], C, { locale: v }) : `${e.length} dates selected` : "";
|
|
41
|
+
return /* @__PURE__ */ l(V, { open: m, onOpenChange: n, children: [
|
|
42
|
+
/* @__PURE__ */ t(X, { asChild: !0, children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
43
|
+
F,
|
|
42
44
|
{
|
|
43
|
-
ref:
|
|
44
|
-
value:
|
|
45
|
-
placeholder:
|
|
45
|
+
ref: A,
|
|
46
|
+
value: I,
|
|
47
|
+
placeholder: L,
|
|
46
48
|
readOnly: !0,
|
|
47
|
-
disabled:
|
|
48
|
-
className:
|
|
49
|
-
suffix: /* @__PURE__ */
|
|
50
|
-
e && e.length > 0 && !
|
|
51
|
-
/* @__PURE__ */ t(
|
|
52
|
-
|
|
49
|
+
disabled: d,
|
|
50
|
+
className: E("cursor-pointer", T),
|
|
51
|
+
suffix: /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
|
|
52
|
+
e && e.length > 0 && !d && /* @__PURE__ */ l(u, { children: [
|
|
53
|
+
/* @__PURE__ */ t(g, { asChild: !0, children: /* @__PURE__ */ t(
|
|
54
|
+
j,
|
|
53
55
|
{
|
|
54
56
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
55
|
-
onClick: (
|
|
56
|
-
|
|
57
|
+
onClick: (o) => {
|
|
58
|
+
o.stopPropagation(), h();
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
) }),
|
|
60
|
-
/* @__PURE__ */ t(
|
|
62
|
+
/* @__PURE__ */ t(y, { variant: "tertiary", side: "top", children: c("calendar.clear") })
|
|
61
63
|
] }),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */ t(
|
|
64
|
-
/* @__PURE__ */ t(
|
|
64
|
+
/* @__PURE__ */ l(u, { children: [
|
|
65
|
+
/* @__PURE__ */ t(g, { asChild: !0, children: /* @__PURE__ */ t(R, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
66
|
+
/* @__PURE__ */ t(y, { variant: "tertiary", side: "top", children: c("datePicker.selectMultipleDates") })
|
|
65
67
|
] })
|
|
66
68
|
] }),
|
|
67
|
-
...
|
|
69
|
+
...k
|
|
68
70
|
}
|
|
69
71
|
) }) }),
|
|
70
72
|
/* @__PURE__ */ t(
|
|
71
|
-
|
|
73
|
+
$,
|
|
72
74
|
{
|
|
73
75
|
className: "w-auto p-0",
|
|
74
76
|
align: "start",
|
|
75
|
-
onOpenAutoFocus: (
|
|
77
|
+
onOpenAutoFocus: (o) => o.preventDefault(),
|
|
76
78
|
children: /* @__PURE__ */ t(
|
|
77
|
-
|
|
79
|
+
q,
|
|
78
80
|
{
|
|
79
81
|
mode: "multiple",
|
|
80
|
-
selected:
|
|
81
|
-
onSelect:
|
|
82
|
-
disabled: { before:
|
|
83
|
-
startMonth:
|
|
84
|
-
endMonth:
|
|
82
|
+
selected: f,
|
|
83
|
+
onSelect: O,
|
|
84
|
+
disabled: { before: M, after: x },
|
|
85
|
+
startMonth: D,
|
|
86
|
+
endMonth: N,
|
|
85
87
|
showFooter: s,
|
|
86
88
|
onApply: S,
|
|
87
|
-
onCancel:
|
|
88
|
-
onClear:
|
|
89
|
+
onCancel: w,
|
|
90
|
+
onClear: h,
|
|
89
91
|
captionLayout: "dropdown"
|
|
90
92
|
}
|
|
91
93
|
)
|
|
@@ -94,7 +96,7 @@ const X = a.forwardRef(
|
|
|
94
96
|
] });
|
|
95
97
|
}
|
|
96
98
|
);
|
|
97
|
-
|
|
99
|
+
G.displayName = "MultiDatePicker";
|
|
98
100
|
export {
|
|
99
|
-
|
|
101
|
+
G as MultiDatePicker
|
|
100
102
|
};
|
|
@@ -1,90 +1,91 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Input as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
9
|
-
import { Tooltip as
|
|
10
|
-
|
|
1
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import { X as I } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as j } from "../../../icons/index.js";
|
|
5
|
+
import { cn as R } from "../../../lib/utils.js";
|
|
6
|
+
import { Input as $ } from "../input.js";
|
|
7
|
+
import { Popover as b, PopoverTrigger as D, PopoverContent as E } from "../popover.js";
|
|
8
|
+
import { Calendar as L } from "../calendar.js";
|
|
9
|
+
import { Tooltip as f, TooltipTrigger as u, TooltipContent as g } from "../tooltip.js";
|
|
10
|
+
import { useImpactNovaI18n as V } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
11
|
+
const X = c.forwardRef(
|
|
11
12
|
({
|
|
12
13
|
value: e,
|
|
13
|
-
onChange:
|
|
14
|
-
placeholder:
|
|
15
|
-
minDate:
|
|
14
|
+
onChange: s,
|
|
15
|
+
placeholder: y,
|
|
16
|
+
minDate: M,
|
|
16
17
|
maxDate: C,
|
|
17
|
-
startMonth:
|
|
18
|
-
endMonth:
|
|
18
|
+
startMonth: P,
|
|
19
|
+
endMonth: T,
|
|
19
20
|
showFooter: a = !0,
|
|
20
|
-
disabled:
|
|
21
|
-
className:
|
|
21
|
+
disabled: p,
|
|
22
|
+
className: k,
|
|
22
23
|
...x
|
|
23
24
|
}, N) => {
|
|
24
|
-
const [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */ t(
|
|
39
|
-
|
|
25
|
+
const { t: r } = V(), A = y ?? r("datePicker.selectMultipleMonths"), [d, n] = c.useState(!1), [h, i] = c.useState(e);
|
|
26
|
+
c.useEffect(() => {
|
|
27
|
+
i(e);
|
|
28
|
+
}, [d, e]);
|
|
29
|
+
const S = (o) => {
|
|
30
|
+
i(o), a || s?.(o);
|
|
31
|
+
}, O = (o) => {
|
|
32
|
+
s?.(o !== void 0 ? o : h), n(!1);
|
|
33
|
+
}, v = () => {
|
|
34
|
+
i(e), n(!1);
|
|
35
|
+
}, m = () => {
|
|
36
|
+
i(void 0), s?.(void 0), a || n(!1);
|
|
37
|
+
}, w = e && e.length > 0 ? e.length === 1 ? `${e[0].month + 1}/${e[0].year}` : r("datePicker.monthsSelected", { count: e.length }) : "";
|
|
38
|
+
return /* @__PURE__ */ l(b, { open: d, onOpenChange: n, children: [
|
|
39
|
+
/* @__PURE__ */ t(D, { asChild: !0, children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
40
|
+
$,
|
|
40
41
|
{
|
|
41
42
|
ref: N,
|
|
42
|
-
value:
|
|
43
|
-
placeholder:
|
|
43
|
+
value: w,
|
|
44
|
+
placeholder: A,
|
|
44
45
|
readOnly: !0,
|
|
45
|
-
disabled:
|
|
46
|
-
className:
|
|
47
|
-
suffix: /* @__PURE__ */
|
|
48
|
-
e && e.length > 0 && !
|
|
49
|
-
/* @__PURE__ */ t(
|
|
50
|
-
|
|
46
|
+
disabled: p,
|
|
47
|
+
className: R("cursor-pointer", k),
|
|
48
|
+
suffix: /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
|
|
49
|
+
e && e.length > 0 && !p && /* @__PURE__ */ l(f, { children: [
|
|
50
|
+
/* @__PURE__ */ t(u, { asChild: !0, children: /* @__PURE__ */ t(
|
|
51
|
+
I,
|
|
51
52
|
{
|
|
52
53
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
53
54
|
onClick: (o) => {
|
|
54
|
-
o.stopPropagation(),
|
|
55
|
+
o.stopPropagation(), m();
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
) }),
|
|
58
|
-
/* @__PURE__ */ t(g, { variant: "tertiary", side: "top", children: "
|
|
59
|
+
/* @__PURE__ */ t(g, { variant: "tertiary", side: "top", children: r("calendar.clear") })
|
|
59
60
|
] }),
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */ t(
|
|
62
|
-
/* @__PURE__ */ t(g, { variant: "tertiary", side: "top", children: "
|
|
61
|
+
/* @__PURE__ */ l(f, { children: [
|
|
62
|
+
/* @__PURE__ */ t(u, { asChild: !0, children: /* @__PURE__ */ t(j, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
63
|
+
/* @__PURE__ */ t(g, { variant: "tertiary", side: "top", children: r("datePicker.selectMultipleMonths") })
|
|
63
64
|
] })
|
|
64
65
|
] }),
|
|
65
66
|
...x
|
|
66
67
|
}
|
|
67
68
|
) }) }),
|
|
68
69
|
/* @__PURE__ */ t(
|
|
69
|
-
|
|
70
|
+
E,
|
|
70
71
|
{
|
|
71
72
|
className: "w-auto p-0",
|
|
72
73
|
align: "start",
|
|
73
74
|
onOpenAutoFocus: (o) => o.preventDefault(),
|
|
74
75
|
children: /* @__PURE__ */ t(
|
|
75
|
-
|
|
76
|
+
L,
|
|
76
77
|
{
|
|
77
78
|
pickerType: "month",
|
|
78
79
|
monthMode: "multiple",
|
|
79
|
-
selectedMonths:
|
|
80
|
-
onMonthSelect:
|
|
81
|
-
disabled: { before:
|
|
82
|
-
startMonth:
|
|
83
|
-
endMonth:
|
|
80
|
+
selectedMonths: h,
|
|
81
|
+
onMonthSelect: S,
|
|
82
|
+
disabled: { before: M, after: C },
|
|
83
|
+
startMonth: P,
|
|
84
|
+
endMonth: T,
|
|
84
85
|
showFooter: a,
|
|
85
|
-
onApply:
|
|
86
|
-
onCancel:
|
|
87
|
-
onClear:
|
|
86
|
+
onApply: O,
|
|
87
|
+
onCancel: v,
|
|
88
|
+
onClear: m,
|
|
88
89
|
captionLayout: "dropdown"
|
|
89
90
|
}
|
|
90
91
|
)
|
|
@@ -93,7 +94,7 @@ const I = s.forwardRef(
|
|
|
93
94
|
] });
|
|
94
95
|
}
|
|
95
96
|
);
|
|
96
|
-
|
|
97
|
+
X.displayName = "MultiMonthPicker";
|
|
97
98
|
export {
|
|
98
|
-
|
|
99
|
+
X as MultiMonthPicker
|
|
99
100
|
};
|
|
@@ -1,107 +1,109 @@
|
|
|
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
|
-
import { Tooltip as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as q } from "../../../icons/index.js";
|
|
5
|
+
import { format as g } from "date-fns";
|
|
6
|
+
import { cn as z } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as B } from "../input.js";
|
|
8
|
+
import { Popover as F, PopoverTrigger as G, PopoverContent as H } from "../popover.js";
|
|
9
|
+
import { Calendar as J } from "../calendar.js";
|
|
10
|
+
import { Tooltip as C, TooltipTrigger as M, TooltipContent as P } from "../tooltip.js";
|
|
11
|
+
import { getDateFnsLocale as K } from "../../../i18n/getDateFnsLocale.js";
|
|
12
|
+
import { useImpactNovaI18n as Q } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
13
|
+
const U = (e, o = "MM/dd/yyyy", n) => {
|
|
14
|
+
const l = g(e.startDate, o, n ? { locale: n } : {}), d = g(e.endDate, o, n ? { locale: n } : {});
|
|
15
|
+
return `${l} - ${d}`;
|
|
16
|
+
}, Y = s.forwardRef(
|
|
15
17
|
({
|
|
16
18
|
value: e,
|
|
17
19
|
onChange: o,
|
|
18
|
-
format:
|
|
19
|
-
placeholder:
|
|
20
|
-
minDate:
|
|
21
|
-
maxDate:
|
|
22
|
-
startMonth:
|
|
23
|
-
endMonth:
|
|
24
|
-
showFooter:
|
|
25
|
-
calendarType:
|
|
26
|
-
fiscalMode:
|
|
20
|
+
format: n = "MM/dd/yyyy",
|
|
21
|
+
placeholder: l,
|
|
22
|
+
minDate: d,
|
|
23
|
+
maxDate: T,
|
|
24
|
+
startMonth: W,
|
|
25
|
+
endMonth: w,
|
|
26
|
+
showFooter: p = !0,
|
|
27
|
+
calendarType: x = "calendar",
|
|
28
|
+
fiscalMode: N = "basic",
|
|
27
29
|
selectionMode: S = "week",
|
|
28
|
-
fiscalMonthPattern:
|
|
29
|
-
fiscalYearStartMonth:
|
|
30
|
-
weekStartsOn:
|
|
31
|
-
disabled:
|
|
32
|
-
className:
|
|
33
|
-
...
|
|
34
|
-
},
|
|
35
|
-
const [
|
|
36
|
-
|
|
30
|
+
fiscalMonthPattern: A,
|
|
31
|
+
fiscalYearStartMonth: v = 1,
|
|
32
|
+
weekStartsOn: D = 1,
|
|
33
|
+
disabled: f,
|
|
34
|
+
className: L,
|
|
35
|
+
...O
|
|
36
|
+
}, I) => {
|
|
37
|
+
const { locale: h, t: m } = Q(), $ = s.useMemo(() => K(h), [h]), b = l ?? m("datePicker.selectWeeks"), [y, a] = s.useState(!1), [k, i] = s.useState(e);
|
|
38
|
+
s.useEffect(() => {
|
|
37
39
|
i(e);
|
|
38
|
-
}, [
|
|
39
|
-
const
|
|
40
|
-
i(r),
|
|
41
|
-
},
|
|
42
|
-
o?.(r !== void 0 ? r :
|
|
43
|
-
},
|
|
44
|
-
i(e),
|
|
45
|
-
},
|
|
46
|
-
i(void 0), o?.(void 0),
|
|
47
|
-
},
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */ t(
|
|
50
|
-
|
|
40
|
+
}, [y, e]);
|
|
41
|
+
const j = (r) => {
|
|
42
|
+
i(r), p || o?.(r);
|
|
43
|
+
}, R = (r) => {
|
|
44
|
+
o?.(r !== void 0 ? r : k), a(!1);
|
|
45
|
+
}, E = () => {
|
|
46
|
+
i(e), a(!1);
|
|
47
|
+
}, u = () => {
|
|
48
|
+
i(void 0), o?.(void 0), p || a(!1);
|
|
49
|
+
}, V = e && e.length > 0 ? e.length === 1 ? U(e[0], n, $) : `${e.length} weeks selected` : "";
|
|
50
|
+
return /* @__PURE__ */ c(F, { open: y, onOpenChange: a, children: [
|
|
51
|
+
/* @__PURE__ */ t(G, { asChild: !0, children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
52
|
+
B,
|
|
51
53
|
{
|
|
52
|
-
ref:
|
|
53
|
-
value:
|
|
54
|
-
placeholder:
|
|
54
|
+
ref: I,
|
|
55
|
+
value: V,
|
|
56
|
+
placeholder: b,
|
|
55
57
|
readOnly: !0,
|
|
56
|
-
disabled:
|
|
57
|
-
className:
|
|
58
|
-
suffix: /* @__PURE__ */
|
|
59
|
-
e && e.length > 0 && !
|
|
60
|
-
/* @__PURE__ */ t(
|
|
61
|
-
|
|
58
|
+
disabled: f,
|
|
59
|
+
className: z("cursor-pointer", L),
|
|
60
|
+
suffix: /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
|
|
61
|
+
e && e.length > 0 && !f && /* @__PURE__ */ c(C, { children: [
|
|
62
|
+
/* @__PURE__ */ t(M, { asChild: !0, children: /* @__PURE__ */ t(
|
|
63
|
+
X,
|
|
62
64
|
{
|
|
63
65
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
64
66
|
onClick: (r) => {
|
|
65
|
-
r.stopPropagation(),
|
|
67
|
+
r.stopPropagation(), u();
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
) }),
|
|
69
|
-
/* @__PURE__ */ t(
|
|
71
|
+
/* @__PURE__ */ t(P, { variant: "tertiary", side: "top", children: m("calendar.clear") })
|
|
70
72
|
] }),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */ t(
|
|
73
|
-
/* @__PURE__ */ t(
|
|
73
|
+
/* @__PURE__ */ c(C, { children: [
|
|
74
|
+
/* @__PURE__ */ t(M, { asChild: !0, children: /* @__PURE__ */ t(q, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
75
|
+
/* @__PURE__ */ t(P, { variant: "tertiary", side: "top", children: m("datePicker.selectWeeks") })
|
|
74
76
|
] })
|
|
75
77
|
] }),
|
|
76
|
-
...
|
|
78
|
+
...O
|
|
77
79
|
}
|
|
78
80
|
) }) }),
|
|
79
81
|
/* @__PURE__ */ t(
|
|
80
|
-
|
|
82
|
+
H,
|
|
81
83
|
{
|
|
82
84
|
className: "w-auto p-0",
|
|
83
85
|
align: "start",
|
|
84
86
|
onOpenAutoFocus: (r) => r.preventDefault(),
|
|
85
87
|
children: /* @__PURE__ */ t(
|
|
86
|
-
|
|
88
|
+
J,
|
|
87
89
|
{
|
|
88
90
|
pickerType: "week",
|
|
89
91
|
weekMode: "multiple",
|
|
90
|
-
selectedWeeks:
|
|
91
|
-
onWeekSelect:
|
|
92
|
-
disabled: { before:
|
|
93
|
-
startMonth:
|
|
94
|
-
endMonth:
|
|
95
|
-
showFooter:
|
|
96
|
-
calendarType:
|
|
97
|
-
fiscalMode:
|
|
92
|
+
selectedWeeks: k,
|
|
93
|
+
onWeekSelect: j,
|
|
94
|
+
disabled: { before: d, after: T },
|
|
95
|
+
startMonth: W,
|
|
96
|
+
endMonth: w,
|
|
97
|
+
showFooter: p,
|
|
98
|
+
calendarType: x,
|
|
99
|
+
fiscalMode: N,
|
|
98
100
|
selectionMode: S,
|
|
99
|
-
fiscalMonthPattern:
|
|
100
|
-
fiscalYearStartMonth:
|
|
101
|
-
weekStartsOn:
|
|
102
|
-
onApply:
|
|
103
|
-
onCancel:
|
|
104
|
-
onClear:
|
|
101
|
+
fiscalMonthPattern: A,
|
|
102
|
+
fiscalYearStartMonth: v,
|
|
103
|
+
weekStartsOn: D,
|
|
104
|
+
onApply: R,
|
|
105
|
+
onCancel: E,
|
|
106
|
+
onClear: u,
|
|
105
107
|
captionLayout: "dropdown"
|
|
106
108
|
}
|
|
107
109
|
)
|
|
@@ -110,7 +112,7 @@ const G = (e, o = "MM/dd/yyyy") => {
|
|
|
110
112
|
] });
|
|
111
113
|
}
|
|
112
114
|
);
|
|
113
|
-
|
|
115
|
+
Y.displayName = "MultiWeekPicker";
|
|
114
116
|
export {
|
|
115
|
-
|
|
117
|
+
Y as MultiWeekPicker
|
|
116
118
|
};
|