impact-nova 1.6.0 → 1.6.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/dist/components/ui/calendar.js +354 -350
- package/dist/components/ui/command-palette/command-palette.js +53 -50
- package/dist/components/ui/command-palette/shortcut-settings.js +130 -123
- package/dist/components/ui/date-picker/multi-week-picker.js +30 -30
- package/dist/components/ui/date-picker/week-picker.js +45 -45
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
1
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import { X } from "lucide-react";
|
|
4
4
|
import { CalendarMonth as q } from "../../../icons/index.js";
|
|
@@ -11,97 +11,97 @@ import { Tooltip as C, TooltipTrigger as M, TooltipContent as P } from "../toolt
|
|
|
11
11
|
import { getDateFnsLocale as K } from "../../../i18n/getDateFnsLocale.js";
|
|
12
12
|
import { useImpactNovaI18n as Q } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
13
13
|
const U = (e, o = "MM/dd/yyyy", n) => {
|
|
14
|
-
const l = g(e.startDate, o, n ? { locale: n } : {}),
|
|
15
|
-
return `${l} - ${
|
|
14
|
+
const l = g(e.startDate, o, n ? { locale: n } : {}), p = g(e.endDate, o, n ? { locale: n } : {});
|
|
15
|
+
return `${l} - ${p}`;
|
|
16
16
|
}, Y = s.forwardRef(
|
|
17
17
|
({
|
|
18
18
|
value: e,
|
|
19
19
|
onChange: o,
|
|
20
20
|
format: n = "MM/dd/yyyy",
|
|
21
21
|
placeholder: l,
|
|
22
|
-
minDate:
|
|
22
|
+
minDate: p,
|
|
23
23
|
maxDate: T,
|
|
24
24
|
startMonth: W,
|
|
25
25
|
endMonth: w,
|
|
26
|
-
showFooter:
|
|
26
|
+
showFooter: d = !0,
|
|
27
27
|
calendarType: x = "calendar",
|
|
28
28
|
fiscalMode: N = "basic",
|
|
29
29
|
selectionMode: S = "week",
|
|
30
30
|
fiscalMonthPattern: A,
|
|
31
31
|
fiscalYearStartMonth: v = 1,
|
|
32
32
|
weekStartsOn: D = 1,
|
|
33
|
-
disabled:
|
|
33
|
+
disabled: m,
|
|
34
34
|
className: L,
|
|
35
35
|
...O
|
|
36
36
|
}, I) => {
|
|
37
|
-
const { locale: h, t:
|
|
37
|
+
const { locale: h, t: f } = Q(), $ = s.useMemo(() => K(h), [h]), j = l ?? f("datePicker.selectWeeks"), [y, a] = s.useState(!1), [k, i] = s.useState(e);
|
|
38
38
|
s.useEffect(() => {
|
|
39
39
|
i(e);
|
|
40
40
|
}, [y, e]);
|
|
41
|
-
const
|
|
42
|
-
i(
|
|
43
|
-
},
|
|
44
|
-
o?.(
|
|
41
|
+
const R = (t) => {
|
|
42
|
+
i(t), d || o?.(t);
|
|
43
|
+
}, b = (t) => {
|
|
44
|
+
o?.(t !== void 0 ? t : k), a(!1);
|
|
45
45
|
}, E = () => {
|
|
46
46
|
i(e), a(!1);
|
|
47
47
|
}, u = () => {
|
|
48
|
-
i(void 0), o?.(void 0),
|
|
48
|
+
i(void 0), o?.(void 0), d || a(!1);
|
|
49
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__ */
|
|
50
|
+
return /* @__PURE__ */ c(F, { open: y, onOpenChange: (t) => !m && a(t), children: [
|
|
51
|
+
/* @__PURE__ */ r(G, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
52
52
|
B,
|
|
53
53
|
{
|
|
54
54
|
ref: I,
|
|
55
55
|
value: V,
|
|
56
|
-
placeholder:
|
|
56
|
+
placeholder: j,
|
|
57
57
|
readOnly: !0,
|
|
58
|
-
disabled:
|
|
58
|
+
disabled: m,
|
|
59
59
|
className: z("cursor-pointer", L),
|
|
60
60
|
suffix: /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
|
|
61
|
-
e && e.length > 0 && !
|
|
62
|
-
/* @__PURE__ */
|
|
61
|
+
e && e.length > 0 && !m && /* @__PURE__ */ c(C, { children: [
|
|
62
|
+
/* @__PURE__ */ r(M, { asChild: !0, children: /* @__PURE__ */ r(
|
|
63
63
|
X,
|
|
64
64
|
{
|
|
65
65
|
className: "h-4 w-4 cursor-pointer hover:text-content",
|
|
66
|
-
onClick: (
|
|
67
|
-
|
|
66
|
+
onClick: (t) => {
|
|
67
|
+
t.stopPropagation(), u();
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
) }),
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ r(P, { variant: "tertiary", side: "top", children: f("calendar.clear") })
|
|
72
72
|
] }),
|
|
73
73
|
/* @__PURE__ */ c(C, { children: [
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ r(M, { asChild: !0, children: /* @__PURE__ */ r(q, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
75
|
+
/* @__PURE__ */ r(P, { variant: "tertiary", side: "top", children: f("datePicker.selectWeeks") })
|
|
76
76
|
] })
|
|
77
77
|
] }),
|
|
78
78
|
...O
|
|
79
79
|
}
|
|
80
80
|
) }) }),
|
|
81
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ r(
|
|
82
82
|
H,
|
|
83
83
|
{
|
|
84
84
|
className: "w-auto p-0",
|
|
85
85
|
align: "start",
|
|
86
|
-
onOpenAutoFocus: (
|
|
87
|
-
children: /* @__PURE__ */
|
|
86
|
+
onOpenAutoFocus: (t) => t.preventDefault(),
|
|
87
|
+
children: /* @__PURE__ */ r(
|
|
88
88
|
J,
|
|
89
89
|
{
|
|
90
90
|
pickerType: "week",
|
|
91
91
|
weekMode: "multiple",
|
|
92
92
|
selectedWeeks: k,
|
|
93
|
-
onWeekSelect:
|
|
94
|
-
disabled: { before:
|
|
93
|
+
onWeekSelect: R,
|
|
94
|
+
disabled: { before: p, after: T },
|
|
95
95
|
startMonth: W,
|
|
96
96
|
endMonth: w,
|
|
97
|
-
showFooter:
|
|
97
|
+
showFooter: d,
|
|
98
98
|
calendarType: x,
|
|
99
99
|
fiscalMode: N,
|
|
100
100
|
selectionMode: S,
|
|
101
101
|
fiscalMonthPattern: A,
|
|
102
102
|
fiscalYearStartMonth: v,
|
|
103
103
|
weekStartsOn: D,
|
|
104
|
-
onApply:
|
|
104
|
+
onApply: b,
|
|
105
105
|
onCancel: E,
|
|
106
106
|
onClear: u,
|
|
107
107
|
captionLayout: "dropdown"
|
|
@@ -2,17 +2,17 @@ import { jsxs as g, jsx as r } from "react/jsx-runtime";
|
|
|
2
2
|
import * as i from "react";
|
|
3
3
|
import { X as te } from "lucide-react";
|
|
4
4
|
import { CalendarMonth as oe } from "../../../icons/index.js";
|
|
5
|
-
import { isValid as
|
|
5
|
+
import { isValid as P, parse as x, format as O } from "date-fns";
|
|
6
6
|
import { cn as re, padValidDateString as ie, maskDate as se } from "../../../lib/utils.js";
|
|
7
7
|
import { Input as ce } from "../input.js";
|
|
8
8
|
import { Popover as le, PopoverTrigger as pe, PopoverContent as ae } from "../popover.js";
|
|
9
9
|
import { Calendar as de } from "../calendar.js";
|
|
10
|
-
import { Tooltip as
|
|
10
|
+
import { Tooltip as $, TooltipTrigger as b, TooltipContent as H } from "../tooltip.js";
|
|
11
11
|
import { resolveWeekSelection as fe } from "../../../lib/fiscal-calendar.js";
|
|
12
12
|
import { getDateFnsLocale as he } from "../../../i18n/getDateFnsLocale.js";
|
|
13
13
|
import { useImpactNovaI18n as ue } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
14
14
|
const a = (e, s = "MM/dd/yyyy", n) => {
|
|
15
|
-
const k =
|
|
15
|
+
const k = O(e.startDate, s, n ? { locale: n } : {}), y = O(e.endDate, s, n ? { locale: n } : {});
|
|
16
16
|
return `${k} - ${y}`;
|
|
17
17
|
}, me = i.forwardRef(
|
|
18
18
|
({
|
|
@@ -25,23 +25,23 @@ const a = (e, s = "MM/dd/yyyy", n) => {
|
|
|
25
25
|
startMonth: q,
|
|
26
26
|
endMonth: z,
|
|
27
27
|
showFooter: d = !0,
|
|
28
|
-
calendarType:
|
|
29
|
-
fiscalMode:
|
|
30
|
-
selectionMode:
|
|
31
|
-
fiscalMonthPattern:
|
|
32
|
-
fiscalYearStartMonth:
|
|
33
|
-
weekStartsOn:
|
|
34
|
-
disabled:
|
|
28
|
+
calendarType: S = "calendar",
|
|
29
|
+
fiscalMode: I = "basic",
|
|
30
|
+
selectionMode: N = "week",
|
|
31
|
+
fiscalMonthPattern: T,
|
|
32
|
+
fiscalYearStartMonth: V = 1,
|
|
33
|
+
weekStartsOn: M = 1,
|
|
34
|
+
disabled: D,
|
|
35
35
|
className: G,
|
|
36
36
|
...J
|
|
37
37
|
}, K) => {
|
|
38
|
-
const { locale: A, t:
|
|
38
|
+
const { locale: A, t: C } = ue(), o = i.useMemo(() => he(A), [A]), Q = k ?? C("datePicker.selectWeek"), L = i.useRef(null);
|
|
39
39
|
i.useRef(null), i.useImperativeHandle(K, () => L.current);
|
|
40
|
-
const [c, u] = i.useState(!1), [R, l] = i.useState(e), [f, p] = i.useState(e ? a(e, n, o) : ""), [U,
|
|
40
|
+
const [c, u] = i.useState(!1), [R, l] = i.useState(e), [f, p] = i.useState(e ? a(e, n, o) : ""), [U, W] = i.useState(e?.startDate || /* @__PURE__ */ new Date());
|
|
41
41
|
i.useEffect(() => {
|
|
42
42
|
c || (p(e ? a(e, n, o) : ""), l(e));
|
|
43
43
|
}, [c, e, n, o]), i.useEffect(() => {
|
|
44
|
-
c && (l(e),
|
|
44
|
+
c && (l(e), W(e?.startDate || /* @__PURE__ */ new Date()), p(e ? a(e, n, o) : ""));
|
|
45
45
|
}, [c, e, n, o]);
|
|
46
46
|
const Z = (t) => {
|
|
47
47
|
l(t), t && p(a(t, n, o)), d || (s?.(t), u(!1));
|
|
@@ -51,36 +51,36 @@ const a = (e, s = "MM/dd/yyyy", n) => {
|
|
|
51
51
|
l(e), p(e ? a(e, n, o) : ""), u(!1);
|
|
52
52
|
}, v = () => {
|
|
53
53
|
l(void 0), p(""), s?.(void 0), d || u(!1);
|
|
54
|
-
},
|
|
55
|
-
calendarType:
|
|
56
|
-
fiscalMode:
|
|
57
|
-
selectionMode:
|
|
58
|
-
fiscalMonthPattern:
|
|
59
|
-
fiscalYearStartMonth:
|
|
60
|
-
weekStartsOn:
|
|
54
|
+
}, j = (t) => fe(t, {
|
|
55
|
+
calendarType: S,
|
|
56
|
+
fiscalMode: I,
|
|
57
|
+
selectionMode: N,
|
|
58
|
+
fiscalMonthPattern: T,
|
|
59
|
+
fiscalYearStartMonth: V,
|
|
60
|
+
weekStartsOn: M
|
|
61
61
|
}), F = (t) => {
|
|
62
62
|
const m = t.target.value, h = se(m, n, f);
|
|
63
63
|
if (p(h), h === "") {
|
|
64
64
|
l(void 0), d || s?.(void 0);
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
const
|
|
68
|
-
if (w
|
|
69
|
-
const
|
|
70
|
-
l(
|
|
67
|
+
const w = x(h, n, /* @__PURE__ */ new Date(), { locale: o });
|
|
68
|
+
if (P(w) && h.length === n.length) {
|
|
69
|
+
const E = j(w);
|
|
70
|
+
l(E), W(w), d || s?.(E);
|
|
71
71
|
}
|
|
72
72
|
}, ee = () => {
|
|
73
73
|
if (c) return;
|
|
74
|
-
const t = ie(f, n), m =
|
|
75
|
-
if (!
|
|
74
|
+
const t = ie(f, n), m = x(t, n, /* @__PURE__ */ new Date(), { locale: o });
|
|
75
|
+
if (!P(m) || t.length !== n.length)
|
|
76
76
|
p(e ? a(e, n, o) : ""), l(e);
|
|
77
77
|
else if (p(t), !d) {
|
|
78
|
-
const h =
|
|
78
|
+
const h = j(m);
|
|
79
79
|
s?.(h);
|
|
80
80
|
}
|
|
81
|
-
},
|
|
82
|
-
return /* @__PURE__ */ g(le, { open: c, onOpenChange: u, children: [
|
|
83
|
-
/* @__PURE__ */ r(pe, { asChild: !0, children: /* @__PURE__ */ r("div", { "data-component": "week-picker", "data-state": c ? "open" : "closed", "data-pending":
|
|
81
|
+
}, B = (e ? a(e, n, o) : "") !== f, ne = f.length === n.length && !P(x(f, n, /* @__PURE__ */ new Date(), { locale: o }));
|
|
82
|
+
return /* @__PURE__ */ g(le, { open: c, onOpenChange: (t) => !D && u(t), children: [
|
|
83
|
+
/* @__PURE__ */ r(pe, { asChild: !0, children: /* @__PURE__ */ r("div", { "data-component": "week-picker", "data-state": c ? "open" : "closed", "data-pending": B || void 0, children: /* @__PURE__ */ r(
|
|
84
84
|
ce,
|
|
85
85
|
{
|
|
86
86
|
ref: L,
|
|
@@ -89,16 +89,16 @@ const a = (e, s = "MM/dd/yyyy", n) => {
|
|
|
89
89
|
onBlur: ee,
|
|
90
90
|
onClick: (t) => c && t.stopPropagation(),
|
|
91
91
|
placeholder: c ? n : Q,
|
|
92
|
-
disabled:
|
|
92
|
+
disabled: D,
|
|
93
93
|
"data-form-control": "input",
|
|
94
94
|
className: re(
|
|
95
95
|
"cursor-pointer",
|
|
96
|
-
ne ? "text-destructive" :
|
|
96
|
+
ne ? "text-destructive" : B ? "text-content-muted" : "",
|
|
97
97
|
G
|
|
98
98
|
),
|
|
99
99
|
suffix: /* @__PURE__ */ g("div", { className: "flex items-center gap-1", children: [
|
|
100
|
-
e && !
|
|
101
|
-
/* @__PURE__ */ r(
|
|
100
|
+
e && !D && /* @__PURE__ */ g($, { children: [
|
|
101
|
+
/* @__PURE__ */ r(b, { asChild: !0, children: /* @__PURE__ */ r(
|
|
102
102
|
te,
|
|
103
103
|
{
|
|
104
104
|
className: "h-4 w-4 cursor-pointer hover:text-content",
|
|
@@ -107,11 +107,11 @@ const a = (e, s = "MM/dd/yyyy", n) => {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
) }),
|
|
110
|
-
/* @__PURE__ */ r(H, { variant: "tertiary", side: "top", children:
|
|
110
|
+
/* @__PURE__ */ r(H, { variant: "tertiary", side: "top", children: C("calendar.clear") })
|
|
111
111
|
] }),
|
|
112
|
-
/* @__PURE__ */ g(
|
|
113
|
-
/* @__PURE__ */ r(
|
|
114
|
-
/* @__PURE__ */ r(H, { variant: "tertiary", side: "top", children:
|
|
112
|
+
/* @__PURE__ */ g($, { children: [
|
|
113
|
+
/* @__PURE__ */ r(b, { asChild: !0, children: /* @__PURE__ */ r(oe, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
114
|
+
/* @__PURE__ */ r(H, { variant: "tertiary", side: "top", children: C("datePicker.selectWeek") })
|
|
115
115
|
] })
|
|
116
116
|
] }),
|
|
117
117
|
...J
|
|
@@ -131,17 +131,17 @@ const a = (e, s = "MM/dd/yyyy", n) => {
|
|
|
131
131
|
selectedWeeks: R,
|
|
132
132
|
onWeekSelect: Z,
|
|
133
133
|
month: U,
|
|
134
|
-
onMonthChange:
|
|
134
|
+
onMonthChange: W,
|
|
135
135
|
disabled: { before: y, after: X },
|
|
136
136
|
startMonth: q,
|
|
137
137
|
endMonth: z,
|
|
138
138
|
showFooter: d,
|
|
139
|
-
calendarType:
|
|
140
|
-
fiscalMode:
|
|
141
|
-
selectionMode:
|
|
142
|
-
fiscalMonthPattern:
|
|
143
|
-
fiscalYearStartMonth:
|
|
144
|
-
weekStartsOn:
|
|
139
|
+
calendarType: S,
|
|
140
|
+
fiscalMode: I,
|
|
141
|
+
selectionMode: N,
|
|
142
|
+
fiscalMonthPattern: T,
|
|
143
|
+
fiscalYearStartMonth: V,
|
|
144
|
+
weekStartsOn: M,
|
|
145
145
|
onApply: _,
|
|
146
146
|
onCancel: Y,
|
|
147
147
|
onClear: v,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "impact-nova",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "Enterprise-grade React design system built with React 19, Vite, Tailwind CSS, and Radix UI. Built-in internationalization (i18n) and comprehensive UI component library for scalable, accessible, and performant applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|