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