impact-nova 2.0.8 → 2.0.9
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/date-picker/date-picker.js +33 -32
- package/dist/components/ui/date-picker/date-range-picker.js +1 -0
- package/dist/components/ui/date-picker/month-picker.js +48 -47
- package/dist/components/ui/date-picker/month-range-picker.js +32 -31
- package/dist/components/ui/date-picker/multi-date-picker.js +20 -19
- package/dist/components/ui/date-picker/multi-month-picker.js +80 -61
- package/dist/components/ui/date-picker/multi-week-picker.js +100 -81
- package/dist/components/ui/date-picker/week-picker.js +26 -25
- package/dist/components/ui/date-picker/week-range-picker.js +24 -23
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as f, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import * as c from "react";
|
|
3
3
|
import { Cross as Ne, CalendarMonth as Re, Info as Z } from "impact-nova-icons";
|
|
4
|
-
import { format as r, isValid as
|
|
4
|
+
import { format as r, isValid as I, parse as P } from "date-fns";
|
|
5
5
|
import { cn as m, padValidDateString as $, maskDate as Y } from "../../../lib/utils.js";
|
|
6
6
|
import { Popover as Se, PopoverAnchor as Ce, PopoverContent as Ie } from "../popover.js";
|
|
7
7
|
import { Calendar as Pe } from "../calendar.js";
|
|
@@ -31,16 +31,16 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
31
31
|
isError: D,
|
|
32
32
|
size: H,
|
|
33
33
|
label: q,
|
|
34
|
-
helperText:
|
|
34
|
+
helperText: W,
|
|
35
35
|
helperTextPosition: A = "absolute",
|
|
36
36
|
required: ce,
|
|
37
37
|
prefix: je,
|
|
38
38
|
prefixClick: ze,
|
|
39
39
|
...ae
|
|
40
40
|
}, ie) => {
|
|
41
|
-
const { locale: G, t:
|
|
41
|
+
const { locale: G, t: R } = Ee(), o = c.useMemo(() => Ve(G), [G]), J = te ?? R("datePicker.selectWeekRange"), Q = c.useRef(null), de = c.useRef(null);
|
|
42
42
|
c.useRef(null), c.useRef(null), c.useImperativeHandle(ie, () => Q.current);
|
|
43
|
-
const [s, p] = c.useState(!1), V = c.useRef(!1), [v, u] = c.useState(t), [
|
|
43
|
+
const [s, p] = c.useState(!1), V = c.useRef(!1), [v, u] = c.useState(t), [S, x] = c.useState(t?.from ? r(t.from.startDate, n, { locale: o }) : ""), [C, h] = c.useState(i(t) ? r(i(t), n, { locale: o }) : ""), [fe, j] = c.useState(t?.from?.startDate || /* @__PURE__ */ new Date());
|
|
44
44
|
c.useEffect(() => {
|
|
45
45
|
s || (x(t?.from ? r(t.from.startDate, n, { locale: o }) : ""), h(i(t) ? r(i(t), n, { locale: o }) : ""), u(t));
|
|
46
46
|
}, [t, n, s, o]), c.useEffect(() => {
|
|
@@ -62,39 +62,39 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
62
62
|
fiscalYearStartMonth: O,
|
|
63
63
|
weekStartsOn: T
|
|
64
64
|
}), ue = (e) => {
|
|
65
|
-
const w = e.target.value, d = Y(w, n,
|
|
65
|
+
const w = e.target.value, d = Y(w, n, S);
|
|
66
66
|
if (x(d), d === "") {
|
|
67
67
|
const k = { from: void 0, to: v?.to };
|
|
68
68
|
u(k), y || b?.(k);
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const g =
|
|
72
|
-
if (
|
|
71
|
+
const g = P(d, n, /* @__PURE__ */ new Date(), { locale: o });
|
|
72
|
+
if (I(g) && d.length === n.length) {
|
|
73
73
|
const N = { from: E(g), to: v?.to };
|
|
74
74
|
u(N), h(r(i(N), n, { locale: o })), y || b?.(N);
|
|
75
75
|
}
|
|
76
76
|
}, xe = (e) => {
|
|
77
|
-
const w = e.target.value, d = Y(w, n,
|
|
77
|
+
const w = e.target.value, d = Y(w, n, C);
|
|
78
78
|
if (h(d), d === "") {
|
|
79
79
|
const k = { from: v?.from, to: void 0 };
|
|
80
80
|
u(k), y || b?.(k);
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
const g =
|
|
84
|
-
if (
|
|
83
|
+
const g = P(d, n, /* @__PURE__ */ new Date(), { locale: o });
|
|
84
|
+
if (I(g) && d.length === n.length) {
|
|
85
85
|
const k = E(g), N = { from: v?.from, to: k };
|
|
86
86
|
u(N), v?.from && x(r(v.from.startDate, n, { locale: o })), g && j(g), y || b?.(N);
|
|
87
87
|
}
|
|
88
88
|
}, X = () => {
|
|
89
89
|
if (s) return;
|
|
90
|
-
const e = $(
|
|
90
|
+
const e = $(S, n), w = $(C, n), d = P(e, n, /* @__PURE__ */ new Date(), { locale: o }), g = P(w, n, /* @__PURE__ */ new Date(), { locale: o }), k = I(d) && e.length === n.length, N = I(g) && w.length === n.length;
|
|
91
91
|
if (!k || !N)
|
|
92
92
|
x(t?.from ? r(t.from.startDate, n, { locale: o }) : ""), h(i(t) ? r(i(t), n, { locale: o }) : ""), u(t);
|
|
93
93
|
else if (x(e), h(w), !y) {
|
|
94
94
|
const De = E(d), ve = E(g);
|
|
95
95
|
b?.({ from: De, to: ve });
|
|
96
96
|
}
|
|
97
|
-
}, he = t?.from ? r(t.from.startDate, n, { locale: o }) : "", ge = i(t) ? r(i(t), n, { locale: o }) : "", ke = he !==
|
|
97
|
+
}, he = t?.from ? r(t.from.startDate, n, { locale: o }) : "", ge = i(t) ? r(i(t), n, { locale: o }) : "", ke = he !== S, we = ge !== C, be = S.length === n.length && !I(P(S, n, /* @__PURE__ */ new Date(), { locale: o })), ye = C.length === n.length && !I(P(C, n, /* @__PURE__ */ new Date(), { locale: o }));
|
|
98
98
|
return /* @__PURE__ */ f("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "week-range-picker", "data-disabled": a || void 0, children: [
|
|
99
99
|
/* @__PURE__ */ f("div", { className: "flex flex-col gap-[6px]", children: [
|
|
100
100
|
q && /* @__PURE__ */ f(
|
|
@@ -117,7 +117,7 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
117
117
|
{
|
|
118
118
|
className: m(
|
|
119
119
|
"w-full",
|
|
120
|
-
|
|
120
|
+
W && A === "absolute" && "relative"
|
|
121
121
|
),
|
|
122
122
|
children: [
|
|
123
123
|
/* @__PURE__ */ f(Se, { open: a ? !1 : s, onOpenChange: (e) => {
|
|
@@ -142,7 +142,7 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
142
142
|
{
|
|
143
143
|
ref: Q,
|
|
144
144
|
type: "text",
|
|
145
|
-
value:
|
|
145
|
+
value: S,
|
|
146
146
|
onChange: ue,
|
|
147
147
|
onBlur: X,
|
|
148
148
|
onClick: () => !a && p(!0),
|
|
@@ -165,7 +165,7 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
165
165
|
{
|
|
166
166
|
ref: de,
|
|
167
167
|
type: "text",
|
|
168
|
-
value:
|
|
168
|
+
value: C,
|
|
169
169
|
onChange: xe,
|
|
170
170
|
onBlur: X,
|
|
171
171
|
onClick: () => !a && p(!0),
|
|
@@ -190,7 +190,7 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
190
190
|
{
|
|
191
191
|
type: "button",
|
|
192
192
|
tabIndex: 0,
|
|
193
|
-
"aria-label":
|
|
193
|
+
"aria-label": R("calendar.clear"),
|
|
194
194
|
onClick: (e) => {
|
|
195
195
|
e.stopPropagation(), U();
|
|
196
196
|
},
|
|
@@ -198,15 +198,15 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
198
198
|
children: /* @__PURE__ */ l(Ne, { className: "size-3 hover:text-content text-content-muted" })
|
|
199
199
|
}
|
|
200
200
|
) }),
|
|
201
|
-
/* @__PURE__ */ l(ee, { variant: "tertiary", side: "top", children:
|
|
201
|
+
/* @__PURE__ */ l(ee, { variant: "tertiary", side: "top", children: R("calendar.clear") })
|
|
202
202
|
] }),
|
|
203
203
|
/* @__PURE__ */ f(_, { children: [
|
|
204
|
-
/* @__PURE__ */ l(F, { asChild: !0, children: /* @__PURE__ */ l("button", { type: "button", tabIndex: 0, "aria-label":
|
|
204
|
+
/* @__PURE__ */ l(F, { asChild: !0, children: /* @__PURE__ */ l("button", { type: "button", tabIndex: 0, "aria-label": R("datePicker.selectWeekRange"), onClick: (e) => {
|
|
205
205
|
e.stopPropagation(), a || p(!s);
|
|
206
206
|
}, onKeyDown: (e) => {
|
|
207
207
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), a || (V.current = !0, p(!s)));
|
|
208
208
|
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ l(Re, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
|
|
209
|
-
/* @__PURE__ */ l(ee, { variant: "tertiary", side: "top", children:
|
|
209
|
+
/* @__PURE__ */ l(ee, { variant: "tertiary", side: "top", children: R("datePicker.selectWeekRange") })
|
|
210
210
|
] })
|
|
211
211
|
] })
|
|
212
212
|
]
|
|
@@ -217,6 +217,7 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
217
217
|
{
|
|
218
218
|
className: "w-auto p-0",
|
|
219
219
|
align: "start",
|
|
220
|
+
"aria-label": R("datePicker.selectWeekRange"),
|
|
220
221
|
onOpenAutoFocus: (e) => {
|
|
221
222
|
V.current || e.preventDefault(), V.current = !1;
|
|
222
223
|
},
|
|
@@ -248,7 +249,7 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
248
249
|
}
|
|
249
250
|
)
|
|
250
251
|
] }),
|
|
251
|
-
|
|
252
|
+
W && A === "absolute" && /* @__PURE__ */ f("div", { className: m("absolute left-0 top-full z-10 mt-1 flex min-w-0 max-w-full items-center gap-[6px]", D && "text-destructive"), children: [
|
|
252
253
|
/* @__PURE__ */ l(
|
|
253
254
|
Z,
|
|
254
255
|
{
|
|
@@ -266,7 +267,7 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
266
267
|
"min-w-0 text-[12px] font-medium leading-[18px] text-navigation-muted",
|
|
267
268
|
D && "text-destructive"
|
|
268
269
|
),
|
|
269
|
-
children:
|
|
270
|
+
children: W
|
|
270
271
|
}
|
|
271
272
|
)
|
|
272
273
|
] })
|
|
@@ -274,7 +275,7 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
274
275
|
}
|
|
275
276
|
)
|
|
276
277
|
] }),
|
|
277
|
-
|
|
278
|
+
W && A === "flow" && /* @__PURE__ */ f("div", { className: m("flex items-center gap-[6px]", D && "text-destructive"), children: [
|
|
278
279
|
/* @__PURE__ */ l(
|
|
279
280
|
Z,
|
|
280
281
|
{
|
|
@@ -292,7 +293,7 @@ const i = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ae = c
|
|
|
292
293
|
"text-[12px] font-medium leading-[18px] text-navigation-muted",
|
|
293
294
|
D && "text-destructive"
|
|
294
295
|
),
|
|
295
|
-
children:
|
|
296
|
+
children: W
|
|
296
297
|
}
|
|
297
298
|
)
|
|
298
299
|
] })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "impact-nova",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
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",
|