impact-nova 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/ag-grid-react/cell-renderers/date-display-renderer.js +32 -21
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.d.ts +3 -5
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +57 -55
- package/dist/components/ui/date-picker/date-picker.js +88 -84
- package/dist/components/ui/date-picker/date-range-picker.js +132 -127
- package/dist/components/ui/date-picker/month-picker.js +92 -86
- package/dist/components/ui/date-picker/month-range-picker.js +134 -127
- package/dist/components/ui/date-picker/multi-date-picker.js +28 -29
- package/dist/components/ui/date-picker/multi-month-picker.js +21 -22
- package/dist/components/ui/date-picker/multi-week-picker.js +33 -34
- package/dist/components/ui/date-picker/week-picker.js +119 -113
- package/dist/components/ui/date-picker/week-range-picker.js +163 -151
- package/dist/components/ui/dynamic-layout.d.ts +1 -1
- package/dist/lib/utils.d.ts +2 -1
- package/dist/lib/utils.js +29 -13
- package/package.json +1 -1
|
@@ -1,50 +1,61 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
if (
|
|
1
|
+
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import "lucide-react";
|
|
3
|
+
const u = (t, r) => {
|
|
4
|
+
if (t == null || t === "") return "";
|
|
5
5
|
try {
|
|
6
|
-
const
|
|
7
|
-
return isNaN(
|
|
6
|
+
const i = t instanceof Date ? t : new Date(String(t));
|
|
7
|
+
return isNaN(i.getTime()) ? String(t) : r === "time" ? i.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" }) : r === "datetime-local" ? i.toLocaleString(void 0, {
|
|
8
8
|
year: "numeric",
|
|
9
9
|
month: "short",
|
|
10
10
|
day: "numeric",
|
|
11
11
|
hour: "2-digit",
|
|
12
12
|
minute: "2-digit"
|
|
13
|
-
}) :
|
|
13
|
+
}) : i.toLocaleDateString(void 0, {
|
|
14
14
|
year: "numeric",
|
|
15
15
|
month: "short",
|
|
16
16
|
day: "numeric"
|
|
17
17
|
});
|
|
18
18
|
} catch {
|
|
19
|
-
return String(
|
|
19
|
+
return String(t);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, m = (t) => {
|
|
22
22
|
const {
|
|
23
|
-
valueFormatted:
|
|
24
|
-
value:
|
|
25
|
-
dateType:
|
|
26
|
-
placeholder:
|
|
23
|
+
valueFormatted: r,
|
|
24
|
+
value: i,
|
|
25
|
+
dateType: s = "date",
|
|
26
|
+
placeholder: h = "Select date...",
|
|
27
27
|
disabled: n,
|
|
28
|
-
colDef:
|
|
29
|
-
} =
|
|
30
|
-
return /* @__PURE__ */
|
|
28
|
+
colDef: l
|
|
29
|
+
} = t, c = !n && l?.editable === !0, a = r ?? u(i, s), d = !a;
|
|
30
|
+
return /* @__PURE__ */ e(
|
|
31
31
|
"div",
|
|
32
32
|
{
|
|
33
33
|
className: `w-full h-full flex items-center ag-cell-inner-padding ${n ? "opacity-60 cursor-not-allowed" : c ? "in-ag-editable-cell-highlight" : ""}`,
|
|
34
|
-
children: /* @__PURE__ */
|
|
34
|
+
children: /* @__PURE__ */ o(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
37
|
className: "flex w-full items-center justify-between rounded-[8px] bg-white px-1.5 h-7 cursor-pointer",
|
|
38
38
|
children: [
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
39
|
+
/* @__PURE__ */ e("span", { className: `truncate text-sm font-medium text-[#1f2b4d] ${d ? "text-[#dfe2e7]" : ""}`, children: d ? h : a }),
|
|
40
|
+
/* @__PURE__ */ e("span", { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground", children: /* @__PURE__ */ o("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
41
|
+
/* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
42
|
+
/* @__PURE__ */ e("path", { d: "M16 2v4" }),
|
|
43
|
+
/* @__PURE__ */ e("path", { d: "M8 2v4" }),
|
|
44
|
+
/* @__PURE__ */ e("path", { d: "M3 10h18" }),
|
|
45
|
+
/* @__PURE__ */ e("path", { d: "M8 14h.01" }),
|
|
46
|
+
/* @__PURE__ */ e("path", { d: "M12 14h.01" }),
|
|
47
|
+
/* @__PURE__ */ e("path", { d: "M16 14h.01" }),
|
|
48
|
+
/* @__PURE__ */ e("path", { d: "M8 18h.01" }),
|
|
49
|
+
/* @__PURE__ */ e("path", { d: "M12 18h.01" }),
|
|
50
|
+
/* @__PURE__ */ e("path", { d: "M16 18h.01" })
|
|
51
|
+
] }) })
|
|
41
52
|
]
|
|
42
53
|
}
|
|
43
54
|
)
|
|
44
55
|
}
|
|
45
56
|
);
|
|
46
57
|
};
|
|
47
|
-
|
|
58
|
+
m.displayName = "DateDisplayRenderer";
|
|
48
59
|
export {
|
|
49
|
-
|
|
60
|
+
m as DateDisplayRenderer
|
|
50
61
|
};
|
|
@@ -8,15 +8,13 @@ export interface DateCellEditorProps extends ICellEditorParams {
|
|
|
8
8
|
max?: string;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* DateCellEditor - AG Grid popup cell editor
|
|
11
|
+
* DateCellEditor - AG Grid popup cell editor using the project's Calendar component.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Opens the Calendar directly on mount so the user sees the calendar popup
|
|
14
|
+
* immediately on click — no extra interaction needed.
|
|
15
15
|
*
|
|
16
16
|
* Returns an ISO string on commit, which AG Grid stores as the cell value.
|
|
17
17
|
*
|
|
18
|
-
* Only holds a single piece of state: the current date string.
|
|
19
|
-
*
|
|
20
18
|
* Usage in colDef:
|
|
21
19
|
* ```ts
|
|
22
20
|
* {
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
1
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as M, useState as b, useImperativeHandle as y, useEffect as N, useCallback as c } from "react";
|
|
3
|
+
import { Calendar as P } from "../../../calendar.js";
|
|
4
|
+
const d = (t) => {
|
|
5
|
+
if (!(t == null || t === ""))
|
|
6
|
+
try {
|
|
7
|
+
const n = t instanceof Date ? t : new Date(String(t));
|
|
8
|
+
return isNaN(n.getTime()) ? void 0 : n;
|
|
9
|
+
} catch {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
}, I = M((t, n) => {
|
|
12
13
|
const {
|
|
13
|
-
value:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
value: l,
|
|
15
|
+
min: u,
|
|
16
|
+
max: p,
|
|
17
|
+
node: i,
|
|
18
|
+
column: m,
|
|
19
|
+
stopEditing: f
|
|
20
|
+
} = t, g = d(l), [C, h] = b(g), [v, D] = b(g || /* @__PURE__ */ new Date());
|
|
21
|
+
y(n, () => ({
|
|
20
22
|
getValue() {
|
|
21
|
-
|
|
22
|
-
if (a === "time") return o;
|
|
23
|
-
try {
|
|
24
|
-
return new Date(o).toISOString();
|
|
25
|
-
} catch {
|
|
26
|
-
return o;
|
|
27
|
-
}
|
|
23
|
+
return l;
|
|
28
24
|
},
|
|
29
25
|
isCancelBeforeStart() {
|
|
30
26
|
return !1;
|
|
@@ -34,40 +30,46 @@ const w = (e, n) => {
|
|
|
34
30
|
},
|
|
35
31
|
isPopup() {
|
|
36
32
|
return !0;
|
|
37
|
-
},
|
|
38
|
-
afterGuiAttached() {
|
|
39
|
-
if (i.current) {
|
|
40
|
-
i.current.focus();
|
|
41
|
-
try {
|
|
42
|
-
i.current.showPicker?.();
|
|
43
|
-
} catch {
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
33
|
}
|
|
47
|
-
}))
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
34
|
+
})), N(() => {
|
|
35
|
+
const e = "ag-custom-component-popup", a = (o) => {
|
|
36
|
+
o instanceof HTMLElement && o.hasAttribute("data-radix-popper-content-wrapper") && o.classList.add(e);
|
|
37
|
+
}, s = new MutationObserver((o) => {
|
|
38
|
+
for (const L of o)
|
|
39
|
+
L.addedNodes.forEach(a);
|
|
40
|
+
});
|
|
41
|
+
return s.observe(document.body, { childList: !0, subtree: !0 }), document.querySelectorAll("[data-radix-popper-content-wrapper]").forEach((o) => {
|
|
42
|
+
o.classList.add(e);
|
|
43
|
+
}), () => s.disconnect();
|
|
44
|
+
}, []);
|
|
45
|
+
const r = c((e) => {
|
|
46
|
+
const a = m?.getColId();
|
|
47
|
+
if (a && i) {
|
|
48
|
+
const s = e ? `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}` : null;
|
|
49
|
+
i.setDataValue(a, s);
|
|
50
|
+
}
|
|
51
|
+
f();
|
|
52
|
+
}, [m, i, f]), w = c((e) => {
|
|
53
|
+
h(e), r(e);
|
|
54
|
+
}, [r]), E = c(() => {
|
|
55
|
+
h(void 0), r(void 0);
|
|
56
|
+
}, [r]), A = u ? d(u) : void 0, x = p ? d(p) : void 0;
|
|
57
|
+
return /* @__PURE__ */ S("div", { className: "ag-custom-component-popup bg-white border border-input rounded-md shadow-lg", children: /* @__PURE__ */ S(
|
|
58
|
+
P,
|
|
57
59
|
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
mode: "single",
|
|
61
|
+
selected: C,
|
|
62
|
+
onSelect: w,
|
|
63
|
+
month: v,
|
|
64
|
+
onMonthChange: D,
|
|
65
|
+
disabled: { before: A, after: x },
|
|
66
|
+
showFooter: !1,
|
|
67
|
+
onClear: E,
|
|
68
|
+
captionLayout: "dropdown"
|
|
67
69
|
}
|
|
68
70
|
) });
|
|
69
71
|
});
|
|
70
|
-
|
|
72
|
+
I.displayName = "DateCellEditor";
|
|
71
73
|
export {
|
|
72
|
-
|
|
74
|
+
I as DateCellEditor
|
|
73
75
|
};
|
|
@@ -1,108 +1,112 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { X } from "lucide-react";
|
|
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 V, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { X as z } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as G } from "../../../icons/index.js";
|
|
5
|
+
import { format as a, isValid as x, parse as C } from "date-fns";
|
|
6
|
+
import { cn as J, padValidDateString as K, maskDate as Q } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as U } from "../input.js";
|
|
8
|
+
import { Popover as W, PopoverTrigger as Y, PopoverContent as Z } from "../popover.js";
|
|
9
|
+
import { Calendar as _ } from "../calendar.js";
|
|
10
|
+
const $ = o.forwardRef(
|
|
11
11
|
({
|
|
12
|
-
value:
|
|
12
|
+
value: e,
|
|
13
13
|
onChange: p,
|
|
14
|
-
format:
|
|
15
|
-
placeholder:
|
|
16
|
-
minDate:
|
|
14
|
+
format: t = "MM/dd/yyyy",
|
|
15
|
+
placeholder: k = "Select Date",
|
|
16
|
+
minDate: I,
|
|
17
17
|
maxDate: M,
|
|
18
18
|
fromYear: N,
|
|
19
|
-
toYear:
|
|
20
|
-
showFooter:
|
|
21
|
-
disabled:
|
|
22
|
-
className:
|
|
23
|
-
...
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
c(t),
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
19
|
+
toYear: A,
|
|
20
|
+
showFooter: f = !0,
|
|
21
|
+
disabled: P,
|
|
22
|
+
className: E,
|
|
23
|
+
...O
|
|
24
|
+
}, T) => {
|
|
25
|
+
const g = o.useRef(null), h = o.useRef(null);
|
|
26
|
+
o.useImperativeHandle(T, () => g.current);
|
|
27
|
+
const [r, d] = o.useState(!1), [S, s] = o.useState(e), [i, c] = o.useState(e ? a(e, t) : ""), [j, y] = o.useState(e || /* @__PURE__ */ new Date());
|
|
28
|
+
o.useEffect(() => {
|
|
29
|
+
g.current && h.current !== null && (g.current.setSelectionRange(h.current, h.current), h.current = null);
|
|
30
|
+
}, [i]), o.useEffect(() => {
|
|
31
|
+
!r && e && (c(a(e, t)), s(e));
|
|
32
|
+
}, [e, t, r]), o.useEffect(() => {
|
|
33
|
+
r && (s(e), y(e || /* @__PURE__ */ new Date()));
|
|
34
|
+
}, [r, e]);
|
|
35
|
+
const B = (n) => {
|
|
36
|
+
s(n), n && c(a(n, t)), f || (p?.(n), d(!1));
|
|
37
|
+
}, v = (n) => {
|
|
38
|
+
p?.(n !== void 0 ? n : S), d(!1);
|
|
39
|
+
}, H = () => {
|
|
40
|
+
s(e), c(e ? a(e, t) : ""), d(!1);
|
|
41
|
+
}, w = () => {
|
|
42
|
+
s(void 0), c(""), p?.(void 0), f || d(!1);
|
|
43
|
+
}, L = (n) => {
|
|
44
|
+
const u = n.target.value, m = Q(u, t, i);
|
|
45
|
+
if (c(m), m === "") {
|
|
46
|
+
s(void 0), f || p?.(void 0);
|
|
43
47
|
return;
|
|
44
48
|
}
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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,
|
|
49
|
+
const D = C(m, t, /* @__PURE__ */ new Date());
|
|
50
|
+
x(D) && m.length === t.length && (s(D), y(D), f || p?.(D));
|
|
51
|
+
}, X = () => {
|
|
52
|
+
if (r) return;
|
|
53
|
+
const n = K(i, t), u = C(n, t, /* @__PURE__ */ new Date());
|
|
54
|
+
!x(u) || n.length !== t.length ? (c(e ? a(e, t) : ""), s(e)) : (c(n), f || p?.(u));
|
|
55
|
+
}, R = (e ? a(e, t) : "") !== i, q = i.length === t.length && !x(C(i, t, /* @__PURE__ */ new Date()));
|
|
56
|
+
return /* @__PURE__ */ V(W, { open: r, onOpenChange: d, children: [
|
|
57
|
+
/* @__PURE__ */ l(Y, { asChild: !0, children: /* @__PURE__ */ l("div", { "data-component": "date-picker", "data-state": r ? "open" : "closed", "data-pending": R || void 0, children: /* @__PURE__ */ l(
|
|
58
|
+
U,
|
|
59
59
|
{
|
|
60
|
-
ref:
|
|
61
|
-
value:
|
|
62
|
-
onChange:
|
|
63
|
-
onBlur:
|
|
64
|
-
onClick: (
|
|
65
|
-
placeholder:
|
|
66
|
-
disabled:
|
|
60
|
+
ref: g,
|
|
61
|
+
value: i,
|
|
62
|
+
onChange: L,
|
|
63
|
+
onBlur: X,
|
|
64
|
+
onClick: (n) => r && n.stopPropagation(),
|
|
65
|
+
placeholder: r ? t : k,
|
|
66
|
+
disabled: P,
|
|
67
67
|
"data-form-control": "input",
|
|
68
|
-
className:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
className: J(
|
|
69
|
+
"cursor-pointer",
|
|
70
|
+
q ? "text-destructive" : R ? "text-muted-foreground" : "",
|
|
71
|
+
E
|
|
72
|
+
),
|
|
73
|
+
suffix: /* @__PURE__ */ V("div", { className: "flex items-center gap-1", children: [
|
|
74
|
+
e && !P && /* @__PURE__ */ l(
|
|
75
|
+
z,
|
|
72
76
|
{
|
|
73
77
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
74
|
-
onClick: (
|
|
75
|
-
|
|
78
|
+
onClick: (n) => {
|
|
79
|
+
n.stopPropagation(), w();
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
),
|
|
79
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ l(G, { className: "h-4 w-4 text-secondary-foreground" })
|
|
80
84
|
] }),
|
|
81
|
-
...
|
|
85
|
+
...O
|
|
82
86
|
}
|
|
83
87
|
) }) }),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
88
|
+
/* @__PURE__ */ l(
|
|
89
|
+
Z,
|
|
86
90
|
{
|
|
87
91
|
className: "w-auto p-0",
|
|
88
92
|
align: "start",
|
|
89
|
-
onOpenAutoFocus: (
|
|
90
|
-
children: /* @__PURE__ */
|
|
91
|
-
|
|
93
|
+
onOpenAutoFocus: (n) => n.preventDefault(),
|
|
94
|
+
children: /* @__PURE__ */ l(
|
|
95
|
+
_,
|
|
92
96
|
{
|
|
93
97
|
mode: "single",
|
|
94
|
-
selected:
|
|
95
|
-
onSelect:
|
|
96
|
-
month:
|
|
97
|
-
onMonthChange:
|
|
98
|
-
fromDate:
|
|
98
|
+
selected: S,
|
|
99
|
+
onSelect: B,
|
|
100
|
+
month: j,
|
|
101
|
+
onMonthChange: y,
|
|
102
|
+
fromDate: I,
|
|
99
103
|
toDate: M,
|
|
100
104
|
fromYear: N,
|
|
101
|
-
toYear:
|
|
102
|
-
showFooter:
|
|
103
|
-
onApply:
|
|
104
|
-
onCancel:
|
|
105
|
-
onClear:
|
|
105
|
+
toYear: A,
|
|
106
|
+
showFooter: f,
|
|
107
|
+
onApply: v,
|
|
108
|
+
onCancel: H,
|
|
109
|
+
onClear: w,
|
|
106
110
|
captionLayout: "dropdown"
|
|
107
111
|
}
|
|
108
112
|
)
|
|
@@ -111,7 +115,7 @@ const W = i.forwardRef(
|
|
|
111
115
|
] });
|
|
112
116
|
}
|
|
113
117
|
);
|
|
114
|
-
|
|
118
|
+
$.displayName = "DatePicker";
|
|
115
119
|
export {
|
|
116
|
-
|
|
120
|
+
$ as DatePicker
|
|
117
121
|
};
|