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