impact-nova 0.1.11 → 0.1.13

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,76 +1,79 @@
1
- import { jsxs as p, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as f, jsx as o } from "react/jsx-runtime";
2
2
  import * as c from "react";
3
- import { X as K } from "lucide-react";
4
- import { CalendarMonth as L, Info as Q } from "../../../icons/index.js";
5
- import { parse as C, isValid as v } from "date-fns";
3
+ import { X as L } from "lucide-react";
4
+ import { CalendarMonth as Q, Info as U } from "../../../icons/index.js";
5
+ import { parse as S, isValid as v } from "date-fns";
6
6
  import { cn as w, maskDate as D } from "../../../lib/utils.js";
7
- import { Popover as U, PopoverTrigger as W, PopoverContent as Z } from "../popover.js";
8
- import { Calendar as F } from "../calendar.js";
9
- const f = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, _ = c.forwardRef(
7
+ import { Popover as W, PopoverTrigger as Z, PopoverContent as F } from "../popover.js";
8
+ import { Calendar as _ } from "../calendar.js";
9
+ const m = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, ee = c.forwardRef(
10
10
  ({
11
11
  value: e,
12
12
  onChange: a,
13
- placeholder: ee = "Select Month Range",
13
+ placeholder: te = "Select Month Range",
14
14
  minDate: Y,
15
15
  maxDate: I,
16
16
  fromYear: V,
17
17
  toYear: A,
18
- showFooter: m = !0,
18
+ showFooter: p = !0,
19
19
  disabled: h,
20
20
  className: O,
21
21
  isError: g,
22
22
  size: R,
23
- label: k,
24
- helperText: N,
23
+ label: P,
24
+ helperText: k,
25
25
  required: j,
26
- prefix: te,
27
- prefixClick: ne,
26
+ prefix: ne,
27
+ prefixClick: oe,
28
28
  ...B
29
29
  }, E) => {
30
- const [s, u] = c.useState(!1), [d, l] = c.useState(e), [T, x] = c.useState(e?.from ? f(e.from) : ""), [$, M] = c.useState(e?.to ? f(e.to) : ""), [z, b] = c.useState(() => e?.from ? new Date(e.from.year, e.from.month, 1) : /* @__PURE__ */ new Date());
30
+ const [s, u] = c.useState(!1), [d, l] = c.useState(e), [T, y] = c.useState(e?.from ? m(e.from) : ""), [$, x] = c.useState(e?.to ? m(e.to) : ""), [z, b] = c.useState(() => e?.from ? new Date(e.from.year, e.from.month, 1) : /* @__PURE__ */ new Date());
31
31
  c.useEffect(() => {
32
- x(e?.from ? f(e.from) : ""), M(e?.to ? f(e.to) : "");
32
+ y(e?.from ? m(e.from) : ""), x(e?.to ? m(e.to) : "");
33
33
  }, [e]), c.useEffect(() => {
34
34
  console.log("[MonthRangePicker] useEffect - open:", s, "value:", e, "pendingRange:", d), s && (l(e), b(e?.from ? new Date(e.from.year, e.from.month, 1) : /* @__PURE__ */ new Date()));
35
35
  }, [s]);
36
36
  const X = (t) => {
37
- console.log("[MonthRangePicker] handleSelect called:", t), l(t), !m && t?.from && t?.to && (console.log("[MonthRangePicker] No footer - applying immediately"), a?.(t), u(!1));
37
+ console.log("[MonthRangePicker] handleSelect called:", t), l(t), !p && t?.from && t?.to && (console.log("[MonthRangePicker] No footer - applying immediately"), a?.(t), u(!1));
38
38
  }, q = (t) => {
39
+ const n = t;
40
+ y(n?.from ? m(n.from) : ""), x(n?.to ? m(n.to) : "");
41
+ }, G = (t) => {
39
42
  const n = t !== void 0 ? t : d;
40
43
  console.log("[MonthRangePicker] handleApply called, appliedRange:", t, "pendingRange:", d, "using:", n), a?.(n), u(!1);
41
- }, G = () => {
44
+ }, H = () => {
42
45
  console.log("[MonthRangePicker] handleCancel called"), l(e), u(!1);
43
- }, S = () => {
44
- console.log("[MonthRangePicker] handleClear called"), l(void 0), x(""), M(""), a?.(void 0), m || u(!1);
45
- }, H = (t) => {
46
+ }, C = () => {
47
+ console.log("[MonthRangePicker] handleClear called"), l(void 0), y(""), x(""), a?.(void 0), p || u(!1);
48
+ }, J = (t) => {
46
49
  const n = D(t.target.value, "MM/yyyy");
47
- if (x(n), n === "") {
50
+ if (y(n), n === "") {
48
51
  const i = { from: void 0, to: e?.to };
49
- l(i), m || a?.(i);
52
+ l(i), p || a?.(i);
50
53
  return;
51
54
  }
52
- const r = C(n, "MM/yyyy", /* @__PURE__ */ new Date());
55
+ const r = S(n, "MM/yyyy", /* @__PURE__ */ new Date());
53
56
  if (v(r)) {
54
- const y = { from: { month: r.getMonth(), year: r.getFullYear() }, to: e?.to };
55
- l(y), b(r), m || a?.(y);
57
+ const M = { from: { month: r.getMonth(), year: r.getFullYear() }, to: e?.to };
58
+ l(M), b(r), p || a?.(M);
56
59
  }
57
- }, J = (t) => {
60
+ }, K = (t) => {
58
61
  const n = D(t.target.value, "MM/yyyy");
59
- if (M(n), n === "") {
62
+ if (x(n), n === "") {
60
63
  const i = { from: e?.from, to: void 0 };
61
- l(i), m || a?.(i);
64
+ l(i), p || a?.(i);
62
65
  return;
63
66
  }
64
- const r = C(n, "MM/yyyy", /* @__PURE__ */ new Date());
67
+ const r = S(n, "MM/yyyy", /* @__PURE__ */ new Date());
65
68
  if (v(r)) {
66
- const i = { month: r.getMonth(), year: r.getFullYear() }, y = { from: e?.from, to: i };
67
- l(y), b(r), m || a?.(y);
69
+ const i = { month: r.getMonth(), year: r.getFullYear() }, M = { from: e?.from, to: i };
70
+ l(M), b(r), p || a?.(M);
68
71
  }
69
- }, P = () => {
70
- x(d?.from ? f(d.from) : ""), M(d?.to ? f(d.to) : "");
72
+ }, N = () => {
73
+ y(d?.from ? m(d.from) : ""), x(d?.to ? m(d.to) : "");
71
74
  };
72
- return /* @__PURE__ */ p("div", { className: "w-full space-y-1.5 min-w-[240px]", children: [
73
- k && /* @__PURE__ */ p(
75
+ return /* @__PURE__ */ f("div", { className: "w-full space-y-1.5 min-w-[240px]", children: [
76
+ P && /* @__PURE__ */ f(
74
77
  "label",
75
78
  {
76
79
  className: w(
@@ -79,14 +82,14 @@ const f = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, _ = c
79
82
  g && "text-destructive"
80
83
  ),
81
84
  children: [
82
- k,
85
+ P,
83
86
  " ",
84
87
  j && /* @__PURE__ */ o("span", { className: "text-destructive", children: "*" })
85
88
  ]
86
89
  }
87
90
  ),
88
- /* @__PURE__ */ p(U, { open: s, onOpenChange: u, children: [
89
- /* @__PURE__ */ o(W, { asChild: !0, children: /* @__PURE__ */ p(
91
+ /* @__PURE__ */ f(W, { open: s, onOpenChange: u, children: [
92
+ /* @__PURE__ */ o(Z, { asChild: !0, children: /* @__PURE__ */ f(
90
93
  "div",
91
94
  {
92
95
  className: w(
@@ -98,15 +101,15 @@ const f = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, _ = c
98
101
  O
99
102
  ),
100
103
  children: [
101
- /* @__PURE__ */ p("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
104
+ /* @__PURE__ */ f("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
102
105
  /* @__PURE__ */ o(
103
106
  "input",
104
107
  {
105
108
  ref: E,
106
109
  type: "text",
107
110
  value: T,
108
- onChange: H,
109
- onBlur: P,
111
+ onChange: J,
112
+ onBlur: N,
110
113
  onClick: (t) => s && t.stopPropagation(),
111
114
  placeholder: s ? "MM/YYYY" : "Start Month",
112
115
  disabled: !!h,
@@ -119,8 +122,8 @@ const f = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, _ = c
119
122
  {
120
123
  type: "text",
121
124
  value: $,
122
- onChange: J,
123
- onBlur: P,
125
+ onChange: K,
126
+ onBlur: N,
124
127
  onClick: (t) => s && t.stopPropagation(),
125
128
  placeholder: s ? "MM/YYYY" : "End Month",
126
129
  disabled: !!h,
@@ -128,52 +131,53 @@ const f = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, _ = c
128
131
  }
129
132
  )
130
133
  ] }),
131
- /* @__PURE__ */ p("div", { className: "flex items-center gap-1 shrink-0", children: [
134
+ /* @__PURE__ */ f("div", { className: "flex items-center gap-1 shrink-0", children: [
132
135
  e?.from && !h && /* @__PURE__ */ o(
133
- K,
136
+ L,
134
137
  {
135
138
  className: "h-4 w-4 cursor-pointer hover:text-foreground text-muted-foreground",
136
139
  onClick: (t) => {
137
- t.stopPropagation(), S();
140
+ t.stopPropagation(), C();
138
141
  }
139
142
  }
140
143
  ),
141
- /* @__PURE__ */ o(L, { className: "h-4 w-4 text-secondary-foreground" })
144
+ /* @__PURE__ */ o(Q, { className: "h-4 w-4 text-secondary-foreground" })
142
145
  ] })
143
146
  ]
144
147
  }
145
148
  ) }),
146
149
  /* @__PURE__ */ o(
147
- Z,
150
+ F,
148
151
  {
149
152
  className: "w-auto p-0",
150
153
  align: "start",
151
154
  onOpenAutoFocus: (t) => t.preventDefault(),
152
155
  onInteractOutside: (t) => t.preventDefault(),
153
156
  children: /* @__PURE__ */ o(
154
- F,
157
+ _,
155
158
  {
156
159
  pickerType: "month",
157
160
  monthMode: "range",
158
161
  selectedMonths: d,
159
162
  onMonthSelect: X,
163
+ onPendingChange: q,
160
164
  month: z,
161
165
  onMonthChange: b,
162
166
  fromDate: Y,
163
167
  toDate: I,
164
168
  fromYear: V,
165
169
  toYear: A,
166
- showFooter: m,
167
- onApply: q,
168
- onCancel: G,
169
- onClear: S
170
+ showFooter: p,
171
+ onApply: G,
172
+ onCancel: H,
173
+ onClear: C
170
174
  }
171
175
  )
172
176
  }
173
177
  )
174
178
  ] }),
175
- N && /* @__PURE__ */ p("div", { className: w("flex items-center gap-1", g && "text-destructive"), children: [
176
- !g && /* @__PURE__ */ o(Q, { size: 10, className: "shrink-0 text-muted-foreground" }),
179
+ k && /* @__PURE__ */ f("div", { className: w("flex items-center gap-1", g && "text-destructive"), children: [
180
+ !g && /* @__PURE__ */ o(U, { size: 10, className: "shrink-0 text-muted-foreground" }),
177
181
  /* @__PURE__ */ o(
178
182
  "p",
179
183
  {
@@ -181,14 +185,14 @@ const f = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, _ = c
181
185
  "text-[10px] text-[#7a8294]",
182
186
  g && "text-destructive"
183
187
  ),
184
- children: N
188
+ children: k
185
189
  }
186
190
  )
187
191
  ] })
188
192
  ] });
189
193
  }
190
194
  );
191
- _.displayName = "MonthRangePicker";
195
+ ee.displayName = "MonthRangePicker";
192
196
  export {
193
- _ as MonthRangePicker
197
+ ee as MonthRangePicker
194
198
  };
@@ -1,16 +1,16 @@
1
1
  import { jsxs as M, jsx as r } from "react/jsx-runtime";
2
2
  import * as s from "react";
3
- import { X as L } from "lucide-react";
4
- import { CalendarMonth as R } from "../../../icons/index.js";
5
- import { format as P, parse as Y, isValid as X } from "date-fns";
6
- import { cn as q, maskDate as z } from "../../../lib/utils.js";
7
- import { Input as G } from "../input.js";
8
- import { Popover as H, PopoverTrigger as J, PopoverContent as K } from "../popover.js";
9
- import { Calendar as Q } from "../calendar.js";
10
- const y = (n, a = "MM/dd/yyyy") => {
3
+ import { X as R } from "lucide-react";
4
+ import { CalendarMonth as Y } from "../../../icons/index.js";
5
+ import { format as P, parse as X, isValid as q } from "date-fns";
6
+ import { cn as z, maskDate as G } from "../../../lib/utils.js";
7
+ import { Input as H } from "../input.js";
8
+ import { Popover as J, PopoverTrigger as K, PopoverContent as Q } from "../popover.js";
9
+ import { Calendar as U } from "../calendar.js";
10
+ const h = (n, a = "MM/dd/yyyy") => {
11
11
  const o = P(n.startDate, a), k = P(n.endDate, a);
12
12
  return `${o} - ${k}`;
13
- }, U = s.forwardRef(
13
+ }, Z = s.forwardRef(
14
14
  ({
15
15
  value: n,
16
16
  onChange: a,
@@ -25,103 +25,107 @@ const y = (n, a = "MM/dd/yyyy") => {
25
25
  className: v,
26
26
  ...x
27
27
  }, I) => {
28
- const [l, d] = s.useState(!1), [c, i] = s.useState(n), [W, u] = s.useState(n ? y(n, o) : ""), [N, g] = s.useState(n?.startDate || /* @__PURE__ */ new Date());
28
+ const [c, d] = s.useState(!1), [l, i] = s.useState(n), [W, g] = s.useState(n ? h(n, o) : ""), [N, u] = s.useState(n?.startDate || /* @__PURE__ */ new Date());
29
29
  s.useEffect(() => {
30
- u(n ? y(n, o) : "");
30
+ g(n ? h(n, o) : "");
31
31
  }, [n, o]), s.useEffect(() => {
32
- console.log("[WeekPicker] useEffect - open:", l, "value:", n, "pendingWeek:", c), l && (i(n), g(n?.startDate || /* @__PURE__ */ new Date()));
33
- }, [l]);
32
+ console.log("[WeekPicker] useEffect - open:", c, "value:", n, "pendingWeek:", l), c && (i(n), u(n?.startDate || /* @__PURE__ */ new Date()));
33
+ }, [c]);
34
34
  const A = (e) => {
35
35
  console.log("[WeekPicker] handleSelect called:", e), i(e), f || (console.log("[WeekPicker] No footer - applying immediately"), a?.(e), d(!1));
36
36
  }, V = (e) => {
37
- const t = e !== void 0 ? e : c;
38
- console.log("[WeekPicker] handleApply called, appliedWeek:", e, "pendingWeek:", c, "using:", t), a?.(t), d(!1);
39
- }, $ = () => {
37
+ const t = e;
38
+ g(t ? h(t, o) : "");
39
+ }, $ = (e) => {
40
+ const t = e !== void 0 ? e : l;
41
+ console.log("[WeekPicker] handleApply called, appliedWeek:", e, "pendingWeek:", l, "using:", t), a?.(t), d(!1);
42
+ }, B = () => {
40
43
  console.log("[WeekPicker] handleCancel called"), i(n), d(!1);
41
- }, h = () => {
42
- console.log("[WeekPicker] handleClear called"), i(void 0), u(""), a?.(void 0), f || d(!1);
43
- }, B = (e) => {
44
+ }, D = () => {
45
+ console.log("[WeekPicker] handleClear called"), i(void 0), g(""), a?.(void 0), f || d(!1);
46
+ }, E = (e) => {
44
47
  const t = new Date(e);
45
48
  t.setDate(e.getDate() - e.getDay());
46
49
  const p = new Date(t);
47
50
  p.setDate(t.getDate() + 6);
48
- const E = new Date(t.getFullYear(), t.getMonth(), 1).getDay(), T = t.getDate(), j = Math.ceil((T + E) / 7);
51
+ const T = new Date(t.getFullYear(), t.getMonth(), 1).getDay(), j = t.getDate(), L = Math.ceil((j + T) / 7);
49
52
  return {
50
53
  year: t.getFullYear(),
51
54
  month: t.getMonth(),
52
- weekOfMonth: j,
55
+ weekOfMonth: L,
53
56
  startDate: t,
54
57
  endDate: p
55
58
  };
56
59
  };
57
- return /* @__PURE__ */ M(H, { open: l, onOpenChange: d, children: [
58
- /* @__PURE__ */ r(J, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
59
- G,
60
+ return /* @__PURE__ */ M(J, { open: c, onOpenChange: d, children: [
61
+ /* @__PURE__ */ r(K, { asChild: !0, children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
62
+ H,
60
63
  {
61
64
  ref: I,
62
65
  value: W,
63
66
  onChange: (e) => {
64
- const t = z(e.target.value, o);
65
- if (u(t), t === "") {
67
+ const t = G(e.target.value, o);
68
+ if (g(t), t === "") {
66
69
  i(void 0), f || a?.(void 0);
67
70
  return;
68
71
  }
69
- const p = Y(t, o, /* @__PURE__ */ new Date());
70
- if (X(p)) {
71
- const D = B(p);
72
- i(D), g(p), f || a?.(D);
72
+ const p = X(t, o, /* @__PURE__ */ new Date());
73
+ if (q(p)) {
74
+ const y = E(p);
75
+ i(y), u(p), f || a?.(y);
73
76
  }
74
77
  },
75
78
  onBlur: () => {
76
79
  if (W === "") {
77
- h();
80
+ D();
78
81
  return;
79
82
  }
80
- u(c ? y(c, o) : "");
83
+ g(l ? h(l, o) : "");
81
84
  },
82
- onClick: (e) => l && e.stopPropagation(),
83
- placeholder: l ? `${o} - ${o}` : k,
85
+ onClick: (e) => c && e.stopPropagation(),
86
+ placeholder: c ? `${o} - ${o}` : k,
84
87
  disabled: m,
85
- className: q("cursor-pointer", v),
88
+ className: z("cursor-pointer", v),
86
89
  suffix: /* @__PURE__ */ M("div", { className: "flex items-center gap-1", children: [
87
90
  n && !m && /* @__PURE__ */ r(
88
- L,
91
+ R,
89
92
  {
90
93
  className: "h-4 w-4 cursor-pointer hover:text-foreground",
91
94
  onClick: (e) => {
92
- e.stopPropagation(), h();
95
+ e.stopPropagation(), D();
93
96
  }
94
97
  }
95
98
  ),
96
- /* @__PURE__ */ r(R, { className: "h-4 w-4 text-secondary-foreground" })
99
+ /* @__PURE__ */ r(Y, { className: "h-4 w-4 text-secondary-foreground" })
97
100
  ] }),
98
101
  ...x
99
102
  }
100
103
  ) }) }),
101
104
  /* @__PURE__ */ r(
102
- K,
105
+ Q,
103
106
  {
104
107
  className: "w-auto p-0",
105
108
  align: "start",
106
109
  onOpenAutoFocus: (e) => e.preventDefault(),
107
110
  onInteractOutside: (e) => e.preventDefault(),
108
111
  children: /* @__PURE__ */ r(
109
- Q,
112
+ U,
110
113
  {
111
114
  pickerType: "week",
112
115
  weekMode: "single",
113
- selectedWeeks: c,
116
+ selectedWeeks: l,
114
117
  onWeekSelect: A,
118
+ onPendingChange: V,
115
119
  month: N,
116
- onMonthChange: g,
120
+ onMonthChange: u,
117
121
  fromDate: C,
118
122
  toDate: w,
119
123
  fromYear: S,
120
124
  toYear: O,
121
125
  showFooter: f,
122
- onApply: V,
123
- onCancel: $,
124
- onClear: h,
126
+ onApply: $,
127
+ onCancel: B,
128
+ onClear: D,
125
129
  captionLayout: "dropdown"
126
130
  }
127
131
  )
@@ -130,7 +134,7 @@ const y = (n, a = "MM/dd/yyyy") => {
130
134
  ] });
131
135
  }
132
136
  );
133
- U.displayName = "WeekPicker";
137
+ Z.displayName = "WeekPicker";
134
138
  export {
135
- U as WeekPicker
139
+ Z as WeekPicker
136
140
  };
@@ -1,12 +1,12 @@
1
1
  import { jsxs as u, jsx as s } from "react/jsx-runtime";
2
2
  import * as d from "react";
3
- import { X as Z } from "lucide-react";
4
- import { CalendarMonth as $, Info as _ } from "../../../icons/index.js";
5
- import { format as g, parse as M, isValid as S } from "date-fns";
3
+ import { X as $ } from "lucide-react";
4
+ import { CalendarMonth as _, Info as F } from "../../../icons/index.js";
5
+ import { format as f, parse as M, isValid as S } from "date-fns";
6
6
  import { cn as w, maskDate as O } from "../../../lib/utils.js";
7
- import { Popover as F, PopoverTrigger as ee, PopoverContent as te } from "../popover.js";
8
- import { Calendar as ne } from "../calendar.js";
9
- const oe = d.forwardRef(
7
+ import { Popover as ee, PopoverTrigger as te, PopoverContent as ne } from "../popover.js";
8
+ import { Calendar as oe } from "../calendar.js";
9
+ const ae = d.forwardRef(
10
10
  ({
11
11
  value: n,
12
12
  onChange: p,
@@ -15,72 +15,75 @@ const oe = d.forwardRef(
15
15
  maxDate: V,
16
16
  fromYear: A,
17
17
  toYear: j,
18
- showFooter: f = !0,
18
+ showFooter: m = !0,
19
19
  disabled: h,
20
20
  className: B,
21
21
  isError: x,
22
22
  size: v,
23
23
  label: W,
24
- helperText: R,
24
+ helperText: P,
25
25
  required: E,
26
- prefix: ae,
27
- prefixClick: re,
26
+ prefix: re,
27
+ prefixClick: se,
28
28
  ...L
29
29
  }, T) => {
30
- const [c, k] = d.useState(!1), [a, i] = d.useState(n), [Y, y] = d.useState(n?.from ? g(n.from.startDate, o) : ""), [z, D] = d.useState(n?.to ? g(n.to.endDate, o) : ""), [X, b] = d.useState(n?.from?.startDate || /* @__PURE__ */ new Date());
30
+ const [c, k] = d.useState(!1), [a, i] = d.useState(n), [Y, D] = d.useState(n?.from ? f(n.from.startDate, o) : ""), [z, y] = d.useState(n?.to ? f(n.to.endDate, o) : ""), [X, b] = d.useState(n?.from?.startDate || /* @__PURE__ */ new Date());
31
31
  d.useEffect(() => {
32
- y(n?.from ? g(n.from.startDate, o) : ""), D(n?.to ? g(n.to.endDate, o) : "");
32
+ D(n?.from ? f(n.from.startDate, o) : ""), y(n?.to ? f(n.to.endDate, o) : "");
33
33
  }, [n, o]), d.useEffect(() => {
34
34
  console.log("[WeekRangePicker] useEffect - open:", c, "value:", n, "pendingRange:", a), c && (i(n), b(n?.from?.startDate || /* @__PURE__ */ new Date()));
35
35
  }, [c]);
36
36
  const q = (e) => {
37
- console.log("[WeekRangePicker] handleSelect called:", e), i(e), !f && e?.from && e?.to && (console.log("[WeekRangePicker] No footer - applying immediately"), p?.(e), k(!1));
37
+ console.log("[WeekRangePicker] handleSelect called:", e), i(e), !m && e?.from && e?.to && (console.log("[WeekRangePicker] No footer - applying immediately"), p?.(e), k(!1));
38
38
  }, G = (e) => {
39
+ const t = e;
40
+ D(t?.from ? f(t.from.startDate, o) : ""), y(t?.to ? f(t.to.endDate, o) : "");
41
+ }, H = (e) => {
39
42
  const t = e !== void 0 ? e : a;
40
43
  console.log("[WeekRangePicker] handleApply called, appliedRange:", e, "pendingRange:", a, "using:", t), p?.(t), k(!1);
41
- }, H = () => {
44
+ }, J = () => {
42
45
  console.log("[WeekRangePicker] handleCancel called"), i(n), k(!1);
43
- }, N = () => {
44
- console.log("[WeekRangePicker] handleClear called"), i(void 0), y(""), D(""), p?.(void 0), f || k(!1);
45
- }, P = (e) => {
46
+ }, R = () => {
47
+ console.log("[WeekRangePicker] handleClear called"), i(void 0), D(""), y(""), p?.(void 0), m || k(!1);
48
+ }, C = (e) => {
46
49
  const t = new Date(e);
47
50
  t.setDate(e.getDate() - e.getDay());
48
51
  const r = new Date(t);
49
52
  r.setDate(t.getDate() + 6);
50
- const m = new Date(t.getFullYear(), t.getMonth(), 1).getDay(), Q = t.getDate(), U = Math.ceil((Q + m) / 7);
53
+ const g = new Date(t.getFullYear(), t.getMonth(), 1).getDay(), U = t.getDate(), Z = Math.ceil((U + g) / 7);
51
54
  return {
52
55
  year: t.getFullYear(),
53
56
  month: t.getMonth(),
54
- weekOfMonth: U,
57
+ weekOfMonth: Z,
55
58
  startDate: t,
56
59
  endDate: r
57
60
  };
58
- }, J = (e) => {
61
+ }, K = (e) => {
59
62
  const t = O(e.target.value, o);
60
- if (y(t), t === "") {
63
+ if (D(t), t === "") {
61
64
  const l = { from: void 0, to: a?.to };
62
- i(l), f || p?.(l);
65
+ i(l), m || p?.(l);
63
66
  return;
64
67
  }
65
68
  const r = M(t, o, /* @__PURE__ */ new Date());
66
69
  if (S(r)) {
67
- const m = { from: P(r), to: a?.to };
68
- i(m), b(r), f || p?.(m);
70
+ const g = { from: C(r), to: a?.to };
71
+ i(g), b(r), m || p?.(g);
69
72
  }
70
- }, K = (e) => {
73
+ }, Q = (e) => {
71
74
  const t = O(e.target.value, o);
72
- if (D(t), t === "") {
75
+ if (y(t), t === "") {
73
76
  const l = { from: a?.from, to: void 0 };
74
- i(l), f || p?.(l);
77
+ i(l), m || p?.(l);
75
78
  return;
76
79
  }
77
80
  const r = M(t, o, /* @__PURE__ */ new Date());
78
81
  if (S(r)) {
79
- const l = P(r), m = { from: a?.from, to: l };
80
- i(m), b(r), f || p?.(m);
82
+ const l = C(r), g = { from: a?.from, to: l };
83
+ i(g), b(r), m || p?.(g);
81
84
  }
82
- }, C = () => {
83
- y(a?.from ? g(a.from.startDate, o) : ""), D(a?.to ? g(a.to.endDate, o) : "");
85
+ }, N = () => {
86
+ D(a?.from ? f(a.from.startDate, o) : ""), y(a?.to ? f(a.to.endDate, o) : "");
84
87
  };
85
88
  return /* @__PURE__ */ u("div", { className: "w-full space-y-1.5 min-w-[240px]", children: [
86
89
  W && /* @__PURE__ */ u(
@@ -98,8 +101,8 @@ const oe = d.forwardRef(
98
101
  ]
99
102
  }
100
103
  ),
101
- /* @__PURE__ */ u(F, { open: c, onOpenChange: k, children: [
102
- /* @__PURE__ */ s(ee, { asChild: !0, children: /* @__PURE__ */ u(
104
+ /* @__PURE__ */ u(ee, { open: c, onOpenChange: k, children: [
105
+ /* @__PURE__ */ s(te, { asChild: !0, children: /* @__PURE__ */ u(
103
106
  "div",
104
107
  {
105
108
  className: w(
@@ -118,8 +121,8 @@ const oe = d.forwardRef(
118
121
  ref: T,
119
122
  type: "text",
120
123
  value: Y,
121
- onChange: J,
122
- onBlur: C,
124
+ onChange: K,
125
+ onBlur: N,
123
126
  onClick: (e) => c && e.stopPropagation(),
124
127
  placeholder: c ? o : "Start Week",
125
128
  disabled: !!h,
@@ -132,8 +135,8 @@ const oe = d.forwardRef(
132
135
  {
133
136
  type: "text",
134
137
  value: z,
135
- onChange: K,
136
- onBlur: C,
138
+ onChange: Q,
139
+ onBlur: N,
137
140
  onClick: (e) => c && e.stopPropagation(),
138
141
  placeholder: c ? o : "End Week",
139
142
  disabled: !!h,
@@ -143,51 +146,52 @@ const oe = d.forwardRef(
143
146
  ] }),
144
147
  /* @__PURE__ */ u("div", { className: "flex items-center gap-1 shrink-0", children: [
145
148
  n?.from && !h && /* @__PURE__ */ s(
146
- Z,
149
+ $,
147
150
  {
148
151
  className: "h-4 w-4 cursor-pointer hover:text-foreground text-muted-foreground",
149
152
  onClick: (e) => {
150
- e.stopPropagation(), N();
153
+ e.stopPropagation(), R();
151
154
  }
152
155
  }
153
156
  ),
154
- /* @__PURE__ */ s($, { className: "h-4 w-4 text-secondary-foreground" })
157
+ /* @__PURE__ */ s(_, { className: "h-4 w-4 text-secondary-foreground" })
155
158
  ] })
156
159
  ]
157
160
  }
158
161
  ) }),
159
162
  /* @__PURE__ */ s(
160
- te,
163
+ ne,
161
164
  {
162
165
  className: "w-auto p-0",
163
166
  align: "start",
164
167
  onOpenAutoFocus: (e) => e.preventDefault(),
165
168
  onInteractOutside: (e) => e.preventDefault(),
166
169
  children: /* @__PURE__ */ s(
167
- ne,
170
+ oe,
168
171
  {
169
172
  pickerType: "week",
170
173
  weekMode: "range",
171
174
  selectedWeeks: a,
172
175
  onWeekSelect: q,
176
+ onPendingChange: G,
173
177
  month: X,
174
178
  onMonthChange: b,
175
179
  fromDate: I,
176
180
  toDate: V,
177
181
  fromYear: A,
178
182
  toYear: j,
179
- showFooter: f,
180
- onApply: G,
181
- onCancel: H,
182
- onClear: N,
183
+ showFooter: m,
184
+ onApply: H,
185
+ onCancel: J,
186
+ onClear: R,
183
187
  captionLayout: "dropdown"
184
188
  }
185
189
  )
186
190
  }
187
191
  )
188
192
  ] }),
189
- R && /* @__PURE__ */ u("div", { className: w("flex items-center gap-1", x && "text-destructive"), children: [
190
- !x && /* @__PURE__ */ s(_, { size: 10, className: "shrink-0 text-muted-foreground" }),
193
+ P && /* @__PURE__ */ u("div", { className: w("flex items-center gap-1", x && "text-destructive"), children: [
194
+ !x && /* @__PURE__ */ s(F, { size: 10, className: "shrink-0 text-muted-foreground" }),
191
195
  /* @__PURE__ */ s(
192
196
  "p",
193
197
  {
@@ -195,14 +199,14 @@ const oe = d.forwardRef(
195
199
  "text-[10px] text-[#7a8294]",
196
200
  x && "text-destructive"
197
201
  ),
198
- children: R
202
+ children: P
199
203
  }
200
204
  )
201
205
  ] })
202
206
  ] });
203
207
  }
204
208
  );
205
- oe.displayName = "WeekRangePicker";
209
+ ae.displayName = "WeekRangePicker";
206
210
  export {
207
- oe as WeekRangePicker
211
+ ae as WeekRangePicker
208
212
  };