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,118 +1,120 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import { format as f, isValid as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
10
|
-
import { Tooltip as T, TooltipTrigger as V, TooltipContent as
|
|
11
|
-
|
|
1
|
+
import { jsxs as C, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { X as W } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as Y } from "../../../icons/index.js";
|
|
5
|
+
import { format as f, isValid as k, parse as w } from "date-fns";
|
|
6
|
+
import { cn as Z, padValidDateString as _, maskDate as $ } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as F } from "../input.js";
|
|
8
|
+
import { Popover as ee, PopoverTrigger as ne, PopoverContent as te } from "../popover.js";
|
|
9
|
+
import { Calendar as oe } from "../calendar.js";
|
|
10
|
+
import { Tooltip as T, TooltipTrigger as V, TooltipContent as A } from "../tooltip.js";
|
|
11
|
+
import { getDateFnsLocale as re } from "../../../i18n/getDateFnsLocale.js";
|
|
12
|
+
import { useImpactNovaI18n as le } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
13
|
+
const ce = o.forwardRef(
|
|
12
14
|
({
|
|
13
15
|
value: e,
|
|
14
16
|
onChange: p,
|
|
15
17
|
format: t = "MM/dd/yyyy",
|
|
16
|
-
placeholder:
|
|
17
|
-
minDate:
|
|
18
|
-
maxDate:
|
|
19
|
-
startMonth:
|
|
20
|
-
endMonth:
|
|
21
|
-
showFooter:
|
|
22
|
-
disabled:
|
|
23
|
-
className:
|
|
24
|
-
...
|
|
25
|
-
},
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, [
|
|
32
|
-
|
|
33
|
-
}, [e, t,
|
|
34
|
-
|
|
35
|
-
}, [
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
p?.(n !== void 0 ? n :
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
|
|
18
|
+
placeholder: v,
|
|
19
|
+
minDate: L,
|
|
20
|
+
maxDate: E,
|
|
21
|
+
startMonth: O,
|
|
22
|
+
endMonth: j,
|
|
23
|
+
showFooter: d = !0,
|
|
24
|
+
disabled: I,
|
|
25
|
+
className: B,
|
|
26
|
+
...b
|
|
27
|
+
}, H) => {
|
|
28
|
+
const { locale: S, t: P } = le(), l = o.useMemo(() => re(S), [S]), X = v ?? P("datePicker.selectDate"), m = o.useRef(null), g = o.useRef(null);
|
|
29
|
+
o.useImperativeHandle(H, () => m.current);
|
|
30
|
+
const [c, u] = o.useState(!1), [M, i] = o.useState(e), [s, a] = o.useState(e ? f(e, t, { locale: l }) : ""), [q, x] = o.useState(e || /* @__PURE__ */ new Date());
|
|
31
|
+
o.useEffect(() => {
|
|
32
|
+
m.current && g.current !== null && (m.current.setSelectionRange(g.current, g.current), g.current = null);
|
|
33
|
+
}, [s]), o.useEffect(() => {
|
|
34
|
+
c || (a(e ? f(e, t, { locale: l }) : ""), i(e));
|
|
35
|
+
}, [e, t, c, l]), o.useEffect(() => {
|
|
36
|
+
c && (i(e), x(e || /* @__PURE__ */ new Date()));
|
|
37
|
+
}, [c, e]);
|
|
38
|
+
const z = (n) => {
|
|
39
|
+
i(n), n && a(f(n, t, { locale: l })), d || (p?.(n), u(!1));
|
|
40
|
+
}, G = (n) => {
|
|
41
|
+
p?.(n !== void 0 ? n : M), u(!1);
|
|
42
|
+
}, J = () => {
|
|
43
|
+
i(e), a(e ? f(e, t, { locale: l }) : ""), u(!1);
|
|
44
|
+
}, N = () => {
|
|
45
|
+
i(void 0), a(""), p?.(void 0), d || u(!1);
|
|
46
|
+
}, K = (n) => {
|
|
47
|
+
const h = n.target.value, D = $(h, t, s);
|
|
48
|
+
if (a(D), D === "") {
|
|
49
|
+
i(void 0), d || p?.(void 0);
|
|
48
50
|
return;
|
|
49
51
|
}
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
if (
|
|
54
|
-
const n =
|
|
55
|
-
!
|
|
56
|
-
}, R = (e ? f(e, t) : "") !==
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */ r(
|
|
59
|
-
|
|
52
|
+
const y = w(D, t, /* @__PURE__ */ new Date(), { locale: l });
|
|
53
|
+
k(y) && D.length === t.length && (i(y), x(y), d || p?.(y));
|
|
54
|
+
}, Q = () => {
|
|
55
|
+
if (c) return;
|
|
56
|
+
const n = _(s, t), h = w(n, t, /* @__PURE__ */ new Date(), { locale: l });
|
|
57
|
+
!k(h) || n.length !== t.length ? (a(e ? f(e, t, { locale: l }) : ""), i(e)) : (a(n), d || p?.(h));
|
|
58
|
+
}, R = (e ? f(e, t, { locale: l }) : "") !== s, U = s.length === t.length && !k(w(s, t, /* @__PURE__ */ new Date(), { locale: l }));
|
|
59
|
+
return /* @__PURE__ */ C(ee, { open: c, onOpenChange: u, children: [
|
|
60
|
+
/* @__PURE__ */ r(ne, { asChild: !0, children: /* @__PURE__ */ r("div", { "data-component": "date-picker", "data-state": c ? "open" : "closed", "data-pending": R || void 0, children: /* @__PURE__ */ r(
|
|
61
|
+
F,
|
|
60
62
|
{
|
|
61
|
-
ref:
|
|
62
|
-
value:
|
|
63
|
-
onChange:
|
|
64
|
-
onBlur:
|
|
65
|
-
onClick: (n) =>
|
|
66
|
-
placeholder:
|
|
67
|
-
disabled:
|
|
63
|
+
ref: m,
|
|
64
|
+
value: s,
|
|
65
|
+
onChange: K,
|
|
66
|
+
onBlur: Q,
|
|
67
|
+
onClick: (n) => c && n.stopPropagation(),
|
|
68
|
+
placeholder: c ? t : X,
|
|
69
|
+
disabled: I,
|
|
68
70
|
"data-form-control": "input",
|
|
69
|
-
className:
|
|
71
|
+
className: Z(
|
|
70
72
|
"cursor-pointer",
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
U ? "text-destructive" : R ? "text-muted-foreground" : "",
|
|
74
|
+
B
|
|
73
75
|
),
|
|
74
|
-
suffix: /* @__PURE__ */
|
|
75
|
-
e && !
|
|
76
|
+
suffix: /* @__PURE__ */ C("div", { className: "flex items-center gap-1", children: [
|
|
77
|
+
e && !I && /* @__PURE__ */ C(T, { children: [
|
|
76
78
|
/* @__PURE__ */ r(V, { asChild: !0, children: /* @__PURE__ */ r(
|
|
77
|
-
|
|
79
|
+
W,
|
|
78
80
|
{
|
|
79
81
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
80
82
|
onClick: (n) => {
|
|
81
|
-
n.stopPropagation(),
|
|
83
|
+
n.stopPropagation(), N();
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
) }),
|
|
85
|
-
/* @__PURE__ */ r(
|
|
87
|
+
/* @__PURE__ */ r(A, { variant: "tertiary", side: "top", children: P("calendar.clear") })
|
|
86
88
|
] }),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */ r(V, { asChild: !0, children: /* @__PURE__ */ r(
|
|
89
|
-
/* @__PURE__ */ r(
|
|
89
|
+
/* @__PURE__ */ C(T, { children: [
|
|
90
|
+
/* @__PURE__ */ r(V, { asChild: !0, children: /* @__PURE__ */ r(Y, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
91
|
+
/* @__PURE__ */ r(A, { variant: "tertiary", side: "top", children: P("datePicker.selectDate") })
|
|
90
92
|
] })
|
|
91
93
|
] }),
|
|
92
|
-
...
|
|
94
|
+
...b
|
|
93
95
|
}
|
|
94
96
|
) }) }),
|
|
95
97
|
/* @__PURE__ */ r(
|
|
96
|
-
|
|
98
|
+
te,
|
|
97
99
|
{
|
|
98
100
|
className: "w-auto p-0",
|
|
99
101
|
align: "start",
|
|
100
102
|
onOpenAutoFocus: (n) => n.preventDefault(),
|
|
101
103
|
children: /* @__PURE__ */ r(
|
|
102
|
-
|
|
104
|
+
oe,
|
|
103
105
|
{
|
|
104
106
|
mode: "single",
|
|
105
|
-
selected:
|
|
106
|
-
onSelect:
|
|
107
|
-
month:
|
|
108
|
-
onMonthChange:
|
|
109
|
-
disabled: { before:
|
|
110
|
-
startMonth:
|
|
111
|
-
endMonth:
|
|
112
|
-
showFooter:
|
|
113
|
-
onApply:
|
|
114
|
-
onCancel:
|
|
115
|
-
onClear:
|
|
107
|
+
selected: M,
|
|
108
|
+
onSelect: z,
|
|
109
|
+
month: q,
|
|
110
|
+
onMonthChange: x,
|
|
111
|
+
disabled: { before: L, after: E },
|
|
112
|
+
startMonth: O,
|
|
113
|
+
endMonth: j,
|
|
114
|
+
showFooter: d,
|
|
115
|
+
onApply: G,
|
|
116
|
+
onCancel: J,
|
|
117
|
+
onClear: N,
|
|
116
118
|
captionLayout: "dropdown"
|
|
117
119
|
}
|
|
118
120
|
)
|
|
@@ -121,7 +123,7 @@ const ee = i.forwardRef(
|
|
|
121
123
|
] });
|
|
122
124
|
}
|
|
123
125
|
);
|
|
124
|
-
|
|
126
|
+
ce.displayName = "DatePicker";
|
|
125
127
|
export {
|
|
126
|
-
|
|
128
|
+
ce as DatePicker
|
|
127
129
|
};
|
|
@@ -1,215 +1,217 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import { format as i, isValid as C, parse as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
9
|
-
import { Tooltip as
|
|
10
|
-
|
|
1
|
+
import { jsxs as m, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { X as me } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as he, Info as ue } from "../../../icons/index.js";
|
|
5
|
+
import { format as i, isValid as C, parse as D } from "date-fns";
|
|
6
|
+
import { cn as N, padValidDateString as j, maskDate as B } from "../../../lib/utils.js";
|
|
7
|
+
import { Popover as ge, PopoverTrigger as xe, PopoverContent as be } from "../popover.js";
|
|
8
|
+
import { Calendar as we } from "../calendar.js";
|
|
9
|
+
import { Tooltip as O, TooltipTrigger as z, TooltipContent as H } from "../tooltip.js";
|
|
10
|
+
import { getDateFnsLocale as ye } from "../../../i18n/getDateFnsLocale.js";
|
|
11
|
+
import { useImpactNovaI18n as Pe } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
12
|
+
const Ce = s.forwardRef(
|
|
11
13
|
({
|
|
12
14
|
value: e,
|
|
13
|
-
onChange:
|
|
15
|
+
onChange: h,
|
|
14
16
|
format: t = "MM/dd/yyyy",
|
|
15
|
-
startPlaceholder:
|
|
16
|
-
endPlaceholder:
|
|
17
|
-
minDate:
|
|
18
|
-
maxDate:
|
|
19
|
-
startMonth:
|
|
20
|
-
endMonth:
|
|
21
|
-
showFooter:
|
|
22
|
-
disabled:
|
|
23
|
-
label:
|
|
24
|
-
helperText:
|
|
25
|
-
prefix:
|
|
26
|
-
prefixClick:
|
|
27
|
-
isError:
|
|
28
|
-
size:
|
|
29
|
-
required:
|
|
30
|
-
className:
|
|
31
|
-
...
|
|
32
|
-
},
|
|
33
|
-
const E =
|
|
34
|
-
|
|
35
|
-
const [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, [e, t,
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
|
|
17
|
+
startPlaceholder: X,
|
|
18
|
+
endPlaceholder: q,
|
|
19
|
+
minDate: G,
|
|
20
|
+
maxDate: J,
|
|
21
|
+
startMonth: K,
|
|
22
|
+
endMonth: Q,
|
|
23
|
+
showFooter: u = !0,
|
|
24
|
+
disabled: b,
|
|
25
|
+
label: V,
|
|
26
|
+
helperText: v,
|
|
27
|
+
prefix: De,
|
|
28
|
+
prefixClick: Ne,
|
|
29
|
+
isError: R,
|
|
30
|
+
size: M,
|
|
31
|
+
required: U,
|
|
32
|
+
className: W,
|
|
33
|
+
...Y
|
|
34
|
+
}, Z) => {
|
|
35
|
+
const { locale: E, t: I } = Pe(), o = s.useMemo(() => ye(E), [E]), $ = X ?? I("datePicker.startDate"), _ = q ?? I("datePicker.endDate"), T = s.useRef(null), F = s.useRef(null);
|
|
36
|
+
s.useRef(null), s.useRef(null), s.useImperativeHandle(Z, () => T.current);
|
|
37
|
+
const [a, S] = s.useState(!1), [w, p] = s.useState(e), [y, g] = s.useState(e?.from ? i(e.from, t, { locale: o }) : ""), [P, x] = s.useState(e?.to ? i(e.to, t, { locale: o }) : ""), [ee, k] = s.useState(e?.from || /* @__PURE__ */ new Date());
|
|
38
|
+
s.useEffect(() => {
|
|
39
|
+
a || (g(e?.from ? i(e.from, t, { locale: o }) : ""), x(e?.to ? i(e.to, t, { locale: o }) : ""), p(e));
|
|
40
|
+
}, [e, t, a, o]), s.useEffect(() => {
|
|
41
|
+
a && (p(e), g(e?.from ? i(e.from, t, { locale: o }) : ""), x(e?.to ? i(e.to, t, { locale: o }) : ""), k(e?.from || /* @__PURE__ */ new Date()));
|
|
42
|
+
}, [a, e, t, o]);
|
|
43
|
+
const te = (n) => {
|
|
44
|
+
p(n), n?.from && g(i(n.from, t, { locale: o })), n?.to && x(i(n.to, t, { locale: o })), u || n?.from && n?.to && n.from.getTime() !== n.to.getTime() && (h?.(n), S(!1));
|
|
45
|
+
}, ne = (n) => {
|
|
46
|
+
let r = n !== void 0 ? n : w;
|
|
47
|
+
r?.from && !r.to && (r = { from: r.from, to: r.from }), h?.(r), S(!1);
|
|
48
|
+
}, oe = () => {
|
|
49
|
+
p(e), g(e?.from ? i(e.from, t, { locale: o }) : ""), x(e?.to ? i(e.to, t, { locale: o }) : ""), S(!1);
|
|
50
|
+
}, A = () => {
|
|
51
|
+
p(void 0), g(""), x(""), h?.(void 0), u || S(!1);
|
|
52
|
+
}, re = (n) => {
|
|
53
|
+
const r = n.target.value, d = B(r, t, y);
|
|
54
|
+
if (g(d), d === "") {
|
|
55
|
+
const c = { from: void 0, to: w?.to };
|
|
56
|
+
p(c), u || h?.(c);
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
|
-
const f =
|
|
58
|
-
if (C(f) &&
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
const f = D(d, t, /* @__PURE__ */ new Date(), { locale: o });
|
|
60
|
+
if (C(f) && d.length === t.length) {
|
|
61
|
+
const c = { from: f, to: w?.to };
|
|
62
|
+
p(c), k(f), u || h?.(c);
|
|
61
63
|
}
|
|
62
|
-
},
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
|
|
64
|
+
}, le = (n) => {
|
|
65
|
+
const r = n.target.value, d = B(r, t, P);
|
|
66
|
+
if (x(d), d === "") {
|
|
67
|
+
const c = { from: w?.from, to: void 0 };
|
|
68
|
+
p(c), u || h?.(c);
|
|
67
69
|
return;
|
|
68
70
|
}
|
|
69
|
-
const f =
|
|
70
|
-
if (C(f) &&
|
|
71
|
-
const
|
|
72
|
-
|
|
71
|
+
const f = D(d, t, /* @__PURE__ */ new Date(), { locale: o });
|
|
72
|
+
if (C(f) && d.length === t.length) {
|
|
73
|
+
const c = { from: w?.from, to: f };
|
|
74
|
+
p(c), f && k(f), u || h?.(c);
|
|
73
75
|
}
|
|
74
|
-
},
|
|
75
|
-
if (
|
|
76
|
-
const n =
|
|
77
|
-
!
|
|
78
|
-
},
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
|
|
76
|
+
}, L = () => {
|
|
77
|
+
if (a) return;
|
|
78
|
+
const n = j(y, t), r = j(P, t), d = D(n, t, /* @__PURE__ */ new Date(), { locale: o }), f = D(r, t, /* @__PURE__ */ new Date(), { locale: o }), c = C(d) && n.length === t.length, pe = C(f) && r.length === t.length;
|
|
79
|
+
!c || !pe ? (g(e?.from ? i(e.from, t, { locale: o }) : ""), x(e?.to ? i(e.to, t, { locale: o }) : ""), p(e)) : (g(n), x(r), u || h?.({ from: d, to: f }));
|
|
80
|
+
}, se = e?.from ? i(e.from, t, { locale: o }) : "", ie = e?.to ? i(e.to, t, { locale: o }) : "", ce = y !== se, de = P !== ie, ae = y.length === t.length && !C(D(y, t, /* @__PURE__ */ new Date(), { locale: o })), fe = P.length === t.length && !C(D(P, t, /* @__PURE__ */ new Date(), { locale: o }));
|
|
81
|
+
return /* @__PURE__ */ m("div", { className: "w-full space-y-1.5 min-w-[240px]", "data-component": "date-range-picker", "data-disabled": b || void 0, children: [
|
|
82
|
+
V && /* @__PURE__ */ m(
|
|
81
83
|
"label",
|
|
82
84
|
{
|
|
83
|
-
className:
|
|
85
|
+
className: N(
|
|
84
86
|
"text-xs font-medium leading-[18px] text-[#60697d]",
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
b && "opacity-70",
|
|
88
|
+
R && "text-destructive"
|
|
87
89
|
),
|
|
88
90
|
children: [
|
|
89
|
-
|
|
91
|
+
V,
|
|
90
92
|
" ",
|
|
91
|
-
|
|
93
|
+
U && /* @__PURE__ */ l("span", { className: "text-destructive", children: "*" })
|
|
92
94
|
]
|
|
93
95
|
}
|
|
94
96
|
),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
+
/* @__PURE__ */ m(ge, { open: a, onOpenChange: S, children: [
|
|
98
|
+
/* @__PURE__ */ l(xe, { asChild: !0, children: /* @__PURE__ */ m(
|
|
97
99
|
"div",
|
|
98
100
|
{
|
|
99
|
-
"data-state":
|
|
100
|
-
className:
|
|
101
|
+
"data-state": a ? "open" : "closed",
|
|
102
|
+
className: N(
|
|
101
103
|
"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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
R ? "border-destructive hover:border-destructive" : "border-input",
|
|
105
|
+
M === "sm" ? "h-6" : M === "md" ? "h-[28px]" : "h-8",
|
|
106
|
+
b && "pointer-events-none opacity-100 bg-disabled-secondary-bg border-border text-disabled-text hover:border-border",
|
|
105
107
|
"cursor-pointer",
|
|
106
|
-
|
|
108
|
+
W
|
|
107
109
|
),
|
|
108
110
|
children: [
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ m("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
|
|
112
|
+
/* @__PURE__ */ l(
|
|
111
113
|
"input",
|
|
112
114
|
{
|
|
113
|
-
ref:
|
|
115
|
+
ref: T,
|
|
114
116
|
type: "text",
|
|
115
|
-
value:
|
|
116
|
-
onChange:
|
|
117
|
-
onBlur:
|
|
118
|
-
onClick: (n) =>
|
|
119
|
-
placeholder:
|
|
120
|
-
disabled: !!
|
|
117
|
+
value: y,
|
|
118
|
+
onChange: re,
|
|
119
|
+
onBlur: L,
|
|
120
|
+
onClick: (n) => a && n.stopPropagation(),
|
|
121
|
+
placeholder: a ? t : $,
|
|
122
|
+
disabled: !!b,
|
|
121
123
|
"data-field": "start",
|
|
122
|
-
className:
|
|
124
|
+
className: N(
|
|
123
125
|
"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
|
-
|
|
126
|
+
ae ? "text-destructive" : ce ? "text-muted-foreground" : ""
|
|
125
127
|
),
|
|
126
|
-
...
|
|
128
|
+
...Y
|
|
127
129
|
}
|
|
128
130
|
),
|
|
129
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ l(
|
|
130
132
|
"input",
|
|
131
133
|
{
|
|
132
|
-
ref:
|
|
134
|
+
ref: F,
|
|
133
135
|
type: "text",
|
|
134
|
-
value:
|
|
135
|
-
onChange:
|
|
136
|
-
onBlur:
|
|
137
|
-
onClick: (n) =>
|
|
138
|
-
placeholder:
|
|
139
|
-
disabled: !!
|
|
136
|
+
value: P,
|
|
137
|
+
onChange: le,
|
|
138
|
+
onBlur: L,
|
|
139
|
+
onClick: (n) => a && n.stopPropagation(),
|
|
140
|
+
placeholder: a ? t : _,
|
|
141
|
+
disabled: !!b,
|
|
140
142
|
"data-field": "end",
|
|
141
|
-
className:
|
|
143
|
+
className: N(
|
|
142
144
|
"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
|
-
|
|
145
|
+
fe ? "text-destructive" : de ? "text-muted-foreground" : ""
|
|
144
146
|
)
|
|
145
147
|
}
|
|
146
148
|
)
|
|
147
149
|
] }),
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
e?.from && !
|
|
150
|
-
/* @__PURE__ */
|
|
151
|
-
|
|
150
|
+
/* @__PURE__ */ m("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
151
|
+
e?.from && !b && /* @__PURE__ */ m(O, { children: [
|
|
152
|
+
/* @__PURE__ */ l(z, { asChild: !0, children: /* @__PURE__ */ l(
|
|
153
|
+
me,
|
|
152
154
|
{
|
|
153
155
|
className: "h-4 w-4 cursor-pointer hover:text-foreground text-muted-foreground",
|
|
154
156
|
onClick: (n) => {
|
|
155
|
-
n.stopPropagation(),
|
|
157
|
+
n.stopPropagation(), A();
|
|
156
158
|
}
|
|
157
159
|
}
|
|
158
160
|
) }),
|
|
159
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ l(H, { variant: "tertiary", side: "top", children: I("calendar.clear") })
|
|
160
162
|
] }),
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ m(O, { children: [
|
|
164
|
+
/* @__PURE__ */ l(z, { asChild: !0, children: /* @__PURE__ */ l(he, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
165
|
+
/* @__PURE__ */ l(H, { variant: "tertiary", side: "top", children: I("datePicker.selectMonthRange") })
|
|
164
166
|
] })
|
|
165
167
|
] })
|
|
166
168
|
]
|
|
167
169
|
}
|
|
168
170
|
) }),
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
|
|
171
|
+
/* @__PURE__ */ l(
|
|
172
|
+
be,
|
|
171
173
|
{
|
|
172
174
|
className: "w-auto p-0",
|
|
173
175
|
align: "start",
|
|
174
176
|
onOpenAutoFocus: (n) => n.preventDefault(),
|
|
175
|
-
children: /* @__PURE__ */
|
|
176
|
-
|
|
177
|
+
children: /* @__PURE__ */ l(
|
|
178
|
+
we,
|
|
177
179
|
{
|
|
178
180
|
mode: "range",
|
|
179
|
-
selected:
|
|
180
|
-
onSelect:
|
|
181
|
-
month:
|
|
182
|
-
onMonthChange:
|
|
183
|
-
disabled: { before:
|
|
184
|
-
startMonth:
|
|
185
|
-
endMonth:
|
|
186
|
-
showFooter:
|
|
187
|
-
onApply:
|
|
188
|
-
onCancel:
|
|
189
|
-
onClear:
|
|
181
|
+
selected: w,
|
|
182
|
+
onSelect: te,
|
|
183
|
+
month: ee,
|
|
184
|
+
onMonthChange: k,
|
|
185
|
+
disabled: { before: G, after: J },
|
|
186
|
+
startMonth: K,
|
|
187
|
+
endMonth: Q,
|
|
188
|
+
showFooter: u,
|
|
189
|
+
onApply: ne,
|
|
190
|
+
onCancel: oe,
|
|
191
|
+
onClear: A,
|
|
190
192
|
captionLayout: "dropdown"
|
|
191
193
|
}
|
|
192
194
|
)
|
|
193
195
|
}
|
|
194
196
|
)
|
|
195
197
|
] }),
|
|
196
|
-
|
|
197
|
-
!
|
|
198
|
-
/* @__PURE__ */
|
|
198
|
+
v && /* @__PURE__ */ m("div", { className: N("flex items-center gap-1", R && "text-destructive"), children: [
|
|
199
|
+
!R && /* @__PURE__ */ l(ue, { size: 10, className: "shrink-0 text-muted-foreground" }),
|
|
200
|
+
/* @__PURE__ */ l(
|
|
199
201
|
"p",
|
|
200
202
|
{
|
|
201
|
-
className:
|
|
203
|
+
className: N(
|
|
202
204
|
"text-[10px] text-[#7a8294]",
|
|
203
|
-
|
|
205
|
+
R && "text-destructive"
|
|
204
206
|
),
|
|
205
|
-
children:
|
|
207
|
+
children: v
|
|
206
208
|
}
|
|
207
209
|
)
|
|
208
210
|
] })
|
|
209
211
|
] });
|
|
210
212
|
}
|
|
211
213
|
);
|
|
212
|
-
|
|
214
|
+
Ce.displayName = "DateRangePicker";
|
|
213
215
|
export {
|
|
214
|
-
|
|
216
|
+
Ce as DateRangePicker
|
|
215
217
|
};
|