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,19 +1,19 @@
|
|
|
1
|
-
import { jsxs as y, jsx as
|
|
1
|
+
import { jsxs as y, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import * as a from "react";
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
3
|
+
import { X as j } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as v } from "../../../icons/index.js";
|
|
5
5
|
import { format as h } from "date-fns";
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
10
|
-
const q = (e,
|
|
11
|
-
const c = h(e.startDate,
|
|
6
|
+
import { cn as R } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as E } from "../input.js";
|
|
8
|
+
import { Popover as I, PopoverTrigger as L, PopoverContent as V } from "../popover.js";
|
|
9
|
+
import { Calendar as X } from "../calendar.js";
|
|
10
|
+
const q = (e, o = "MM/dd/yyyy") => {
|
|
11
|
+
const c = h(e.startDate, o), i = h(e.endDate, o);
|
|
12
12
|
return `${c} - ${i}`;
|
|
13
13
|
}, z = a.forwardRef(
|
|
14
14
|
({
|
|
15
15
|
value: e,
|
|
16
|
-
onChange:
|
|
16
|
+
onChange: o,
|
|
17
17
|
format: c = "MM/dd/yyyy",
|
|
18
18
|
placeholder: i = "Select Weeks",
|
|
19
19
|
minDate: k,
|
|
@@ -30,33 +30,33 @@ const q = (e, r = "MM/dd/yyyy") => {
|
|
|
30
30
|
disabled: d,
|
|
31
31
|
className: N,
|
|
32
32
|
...A
|
|
33
|
-
},
|
|
33
|
+
}, O) => {
|
|
34
34
|
const [p, n] = a.useState(!1), [f, s] = a.useState(e);
|
|
35
35
|
a.useEffect(() => {
|
|
36
36
|
p && s(e);
|
|
37
37
|
}, [p]);
|
|
38
|
-
const
|
|
39
|
-
s(t), l ||
|
|
40
|
-
},
|
|
41
|
-
|
|
38
|
+
const T = (t) => {
|
|
39
|
+
s(t), l || o?.(t);
|
|
40
|
+
}, D = (t) => {
|
|
41
|
+
o?.(t !== void 0 ? t : f), n(!1);
|
|
42
42
|
}, $ = () => {
|
|
43
43
|
s(e), n(!1);
|
|
44
44
|
}, m = () => {
|
|
45
|
-
s(void 0),
|
|
46
|
-
},
|
|
47
|
-
return /* @__PURE__ */ y(
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
45
|
+
s(void 0), o?.(void 0), l || n(!1);
|
|
46
|
+
}, b = e && e.length > 0 ? e.length === 1 ? q(e[0], c) : `${e.length} weeks selected` : "";
|
|
47
|
+
return /* @__PURE__ */ y(I, { open: p, onOpenChange: n, children: [
|
|
48
|
+
/* @__PURE__ */ r(L, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
49
|
+
E,
|
|
50
50
|
{
|
|
51
|
-
ref:
|
|
52
|
-
value:
|
|
51
|
+
ref: O,
|
|
52
|
+
value: b,
|
|
53
53
|
placeholder: i,
|
|
54
54
|
readOnly: !0,
|
|
55
55
|
disabled: d,
|
|
56
|
-
className:
|
|
56
|
+
className: R("cursor-pointer", N),
|
|
57
57
|
suffix: /* @__PURE__ */ y("div", { className: "flex items-center gap-1", children: [
|
|
58
|
-
e && e.length > 0 && !d && /* @__PURE__ */
|
|
59
|
-
|
|
58
|
+
e && e.length > 0 && !d && /* @__PURE__ */ r(
|
|
59
|
+
j,
|
|
60
60
|
{
|
|
61
61
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
62
62
|
onClick: (t) => {
|
|
@@ -64,26 +64,25 @@ const q = (e, r = "MM/dd/yyyy") => {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
),
|
|
67
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ r(v, { className: "h-4 w-4 text-secondary-foreground" })
|
|
68
68
|
] }),
|
|
69
69
|
...A
|
|
70
70
|
}
|
|
71
71
|
) }) }),
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
|
|
72
|
+
/* @__PURE__ */ r(
|
|
73
|
+
V,
|
|
74
74
|
{
|
|
75
75
|
className: "w-auto p-0",
|
|
76
76
|
align: "start",
|
|
77
77
|
onOpenAutoFocus: (t) => t.preventDefault(),
|
|
78
|
-
children: /* @__PURE__ */
|
|
79
|
-
|
|
78
|
+
children: /* @__PURE__ */ r(
|
|
79
|
+
X,
|
|
80
80
|
{
|
|
81
81
|
pickerType: "week",
|
|
82
82
|
weekMode: "multiple",
|
|
83
83
|
selectedWeeks: f,
|
|
84
|
-
onWeekSelect:
|
|
85
|
-
|
|
86
|
-
toDate: u,
|
|
84
|
+
onWeekSelect: T,
|
|
85
|
+
disabled: { before: k, after: u },
|
|
87
86
|
fromYear: g,
|
|
88
87
|
toYear: C,
|
|
89
88
|
showFooter: l,
|
|
@@ -93,7 +92,7 @@ const q = (e, r = "MM/dd/yyyy") => {
|
|
|
93
92
|
fiscalMonthPattern: P,
|
|
94
93
|
fiscalYearStartMonth: S,
|
|
95
94
|
weekStartsOn: W,
|
|
96
|
-
onApply:
|
|
95
|
+
onApply: D,
|
|
97
96
|
onCancel: $,
|
|
98
97
|
onClear: m,
|
|
99
98
|
captionLayout: "dropdown"
|
|
@@ -1,135 +1,141 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import {
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
10
|
-
import { resolveWeekSelection as
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
return `${
|
|
14
|
-
},
|
|
1
|
+
import { jsxs as b, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { X as U } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as Z } from "../../../icons/index.js";
|
|
5
|
+
import { isValid as y, parse as D, format as j } from "date-fns";
|
|
6
|
+
import { cn as _, padValidDateString as Y, maskDate as F } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as ee } from "../input.js";
|
|
8
|
+
import { Popover as ne, PopoverTrigger as te, PopoverContent as oe } from "../popover.js";
|
|
9
|
+
import { Calendar as se } from "../calendar.js";
|
|
10
|
+
import { resolveWeekSelection as re } from "../../../lib/fiscal-calendar.js";
|
|
11
|
+
const l = (e, s = "MM/dd/yyyy") => {
|
|
12
|
+
const t = j(e.startDate, s), h = j(e.endDate, s);
|
|
13
|
+
return `${t} - ${h}`;
|
|
14
|
+
}, ie = o.forwardRef(
|
|
15
15
|
({
|
|
16
|
-
value:
|
|
17
|
-
onChange:
|
|
18
|
-
format:
|
|
19
|
-
placeholder:
|
|
20
|
-
minDate:
|
|
21
|
-
maxDate:
|
|
22
|
-
fromYear:
|
|
23
|
-
toYear:
|
|
24
|
-
showFooter:
|
|
25
|
-
calendarType:
|
|
26
|
-
fiscalMode:
|
|
27
|
-
selectionMode:
|
|
28
|
-
fiscalMonthPattern:
|
|
29
|
-
fiscalYearStartMonth:
|
|
30
|
-
weekStartsOn:
|
|
31
|
-
disabled:
|
|
32
|
-
className:
|
|
33
|
-
...
|
|
34
|
-
},
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
16
|
+
value: e,
|
|
17
|
+
onChange: s,
|
|
18
|
+
format: t = "MM/dd/yyyy",
|
|
19
|
+
placeholder: h = "Select Week",
|
|
20
|
+
minDate: B,
|
|
21
|
+
maxDate: E,
|
|
22
|
+
fromYear: L,
|
|
23
|
+
toYear: O,
|
|
24
|
+
showFooter: f = !0,
|
|
25
|
+
calendarType: w = "calendar",
|
|
26
|
+
fiscalMode: W = "basic",
|
|
27
|
+
selectionMode: S = "week",
|
|
28
|
+
fiscalMonthPattern: x,
|
|
29
|
+
fiscalYearStartMonth: C = 1,
|
|
30
|
+
weekStartsOn: P = 1,
|
|
31
|
+
disabled: V,
|
|
32
|
+
className: $,
|
|
33
|
+
...H
|
|
34
|
+
}, X) => {
|
|
35
|
+
const I = o.useRef(null);
|
|
36
|
+
o.useRef(null), o.useImperativeHandle(X, () => I.current);
|
|
37
|
+
const [r, u] = o.useState(!1), [N, i] = o.useState(e), [d, c] = o.useState(e ? l(e, t) : ""), [q, k] = o.useState(e?.startDate || /* @__PURE__ */ new Date());
|
|
38
|
+
o.useEffect(() => {
|
|
39
|
+
!r && e && (c(l(e, t)), i(e));
|
|
40
|
+
}, [r, e, t]), o.useEffect(() => {
|
|
41
|
+
r && (i(e), k(e?.startDate || /* @__PURE__ */ new Date()), c(e ? l(e, t) : ""));
|
|
42
|
+
}, [r, e, t]);
|
|
43
|
+
const v = (n) => {
|
|
44
|
+
i(n), n && c(l(n, t)), f || (s?.(n), u(!1));
|
|
45
|
+
}, z = (n) => {
|
|
46
|
+
s?.(n !== void 0 ? n : N), u(!1);
|
|
47
|
+
}, G = () => {
|
|
48
|
+
i(e), c(e ? l(e, t) : ""), u(!1);
|
|
49
|
+
}, A = () => {
|
|
50
|
+
i(void 0), c(""), s?.(void 0), f || u(!1);
|
|
51
|
+
}, M = (n) => re(n, {
|
|
52
|
+
calendarType: w,
|
|
53
|
+
fiscalMode: W,
|
|
54
|
+
selectionMode: S,
|
|
55
|
+
fiscalMonthPattern: x,
|
|
56
|
+
fiscalYearStartMonth: C,
|
|
57
|
+
weekStartsOn: P
|
|
58
|
+
}), J = (n) => {
|
|
59
|
+
const g = n.target.value, a = F(g, t, d);
|
|
60
|
+
if (c(a), a === "") {
|
|
61
|
+
i(void 0), f || s?.(void 0);
|
|
60
62
|
return;
|
|
61
63
|
}
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
const
|
|
65
|
-
|
|
64
|
+
const m = D(a, t, /* @__PURE__ */ new Date());
|
|
65
|
+
if (y(m) && a.length === t.length) {
|
|
66
|
+
const T = M(m);
|
|
67
|
+
i(T), k(m), f || s?.(T);
|
|
66
68
|
}
|
|
67
|
-
},
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
}, K = () => {
|
|
70
|
+
if (r) return;
|
|
71
|
+
const n = Y(d, t), g = D(n, t, /* @__PURE__ */ new Date());
|
|
72
|
+
if (!y(g) || n.length !== t.length)
|
|
73
|
+
c(e ? l(e, t) : ""), i(e);
|
|
74
|
+
else if (c(n), !f) {
|
|
75
|
+
const a = M(g);
|
|
76
|
+
s?.(a);
|
|
74
77
|
}
|
|
75
|
-
},
|
|
76
|
-
return /* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
78
|
+
}, R = (e ? l(e, t) : "") !== d, Q = d.length === t.length && !y(D(d, t, /* @__PURE__ */ new Date()));
|
|
79
|
+
return /* @__PURE__ */ b(ne, { open: r, onOpenChange: u, children: [
|
|
80
|
+
/* @__PURE__ */ p(te, { asChild: !0, children: /* @__PURE__ */ p("div", { "data-component": "week-picker", "data-state": r ? "open" : "closed", "data-pending": R || void 0, children: /* @__PURE__ */ p(
|
|
81
|
+
ee,
|
|
79
82
|
{
|
|
80
|
-
ref:
|
|
81
|
-
value:
|
|
82
|
-
onChange:
|
|
83
|
-
onBlur:
|
|
84
|
-
onClick: (
|
|
85
|
-
placeholder:
|
|
86
|
-
disabled:
|
|
83
|
+
ref: I,
|
|
84
|
+
value: d,
|
|
85
|
+
onChange: J,
|
|
86
|
+
onBlur: K,
|
|
87
|
+
onClick: (n) => r && n.stopPropagation(),
|
|
88
|
+
placeholder: r ? t : h,
|
|
89
|
+
disabled: V,
|
|
87
90
|
"data-form-control": "input",
|
|
88
|
-
className:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
className: _(
|
|
92
|
+
"cursor-pointer",
|
|
93
|
+
Q ? "text-destructive" : R ? "text-muted-foreground" : "",
|
|
94
|
+
$
|
|
95
|
+
),
|
|
96
|
+
suffix: /* @__PURE__ */ b("div", { className: "flex items-center gap-1", children: [
|
|
97
|
+
e && !V && /* @__PURE__ */ p(
|
|
98
|
+
U,
|
|
92
99
|
{
|
|
93
100
|
className: "h-4 w-4 cursor-pointer hover:text-foreground",
|
|
94
|
-
onClick: (
|
|
95
|
-
|
|
101
|
+
onClick: (n) => {
|
|
102
|
+
n.stopPropagation(), A();
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
),
|
|
99
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ p(Z, { className: "h-4 w-4 text-secondary-foreground" })
|
|
100
107
|
] }),
|
|
101
|
-
...
|
|
108
|
+
...H
|
|
102
109
|
}
|
|
103
110
|
) }) }),
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
|
|
111
|
+
/* @__PURE__ */ p(
|
|
112
|
+
oe,
|
|
106
113
|
{
|
|
107
114
|
className: "w-auto p-0",
|
|
108
115
|
align: "start",
|
|
109
|
-
onOpenAutoFocus: (
|
|
110
|
-
children: /* @__PURE__ */
|
|
111
|
-
|
|
116
|
+
onOpenAutoFocus: (n) => n.preventDefault(),
|
|
117
|
+
children: /* @__PURE__ */ p(
|
|
118
|
+
se,
|
|
112
119
|
{
|
|
113
120
|
pickerType: "week",
|
|
114
121
|
weekMode: "single",
|
|
115
|
-
selectedWeeks:
|
|
116
|
-
onWeekSelect:
|
|
117
|
-
month:
|
|
118
|
-
onMonthChange:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
onClear: g,
|
|
122
|
+
selectedWeeks: N,
|
|
123
|
+
onWeekSelect: v,
|
|
124
|
+
month: q,
|
|
125
|
+
onMonthChange: k,
|
|
126
|
+
disabled: { before: B, after: E },
|
|
127
|
+
fromYear: L,
|
|
128
|
+
toYear: O,
|
|
129
|
+
showFooter: f,
|
|
130
|
+
calendarType: w,
|
|
131
|
+
fiscalMode: W,
|
|
132
|
+
selectionMode: S,
|
|
133
|
+
fiscalMonthPattern: x,
|
|
134
|
+
fiscalYearStartMonth: C,
|
|
135
|
+
weekStartsOn: P,
|
|
136
|
+
onApply: z,
|
|
137
|
+
onCancel: G,
|
|
138
|
+
onClear: A,
|
|
133
139
|
captionLayout: "dropdown"
|
|
134
140
|
}
|
|
135
141
|
)
|
|
@@ -138,7 +144,7 @@ const f = (t, r = "MM/dd/yyyy") => {
|
|
|
138
144
|
] });
|
|
139
145
|
}
|
|
140
146
|
);
|
|
141
|
-
|
|
147
|
+
ie.displayName = "WeekPicker";
|
|
142
148
|
export {
|
|
143
|
-
|
|
149
|
+
ie as WeekPicker
|
|
144
150
|
};
|