impact-nova 2.0.6 → 2.0.8

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,26 +1,26 @@
1
- import { jsxs as h, jsx as d } from "react/jsx-runtime";
2
- import * as p from "react";
1
+ import { jsxs as h, jsx as i } from "react/jsx-runtime";
2
+ import * as u from "react";
3
3
  import { Cross as ht, CalendarMonth as gt, Info as J } from "impact-nova-icons";
4
- import { isValid as M, parse as Y } from "date-fns";
5
- import { cn as g, padValidDateString as R, maskDate as L } from "../../../lib/utils.js";
4
+ import { isValid as Y, parse as y } from "date-fns";
5
+ import { cn as x, padValidDateString as R, maskDate as L } from "../../../lib/utils.js";
6
6
  import { Popover as xt, PopoverAnchor as Mt, PopoverContent as Yt } from "../popover.js";
7
7
  import { Calendar as yt } from "../calendar.js";
8
8
  import { Tooltip as Q, TooltipTrigger as U, TooltipContent as W } from "../tooltip.js";
9
9
  import { useImpactNovaI18n as wt } from "../../../i18n/ImpactNovaI18nContext.js";
10
- const m = (e, i = "MM/YYYY") => {
10
+ const p = (e, s = "MM/YYYY") => {
11
11
  const A = (e.month + 1).toString().padStart(2, "0");
12
- return i === "YYYY/MM" ? `${e.year}/${A}` : `${A}/${e.year}`;
13
- }, bt = p.forwardRef(
12
+ return s === "YYYY/MM" ? `${e.year}/${A}` : `${A}/${e.year}`;
13
+ }, bt = u.forwardRef(
14
14
  ({
15
15
  value: e,
16
- onChange: i,
16
+ onChange: s,
17
17
  placeholder: A,
18
18
  minDate: I,
19
19
  maxDate: X,
20
20
  startMonth: Z,
21
21
  endMonth: _,
22
- showFooter: x = !0,
23
- disabled: u,
22
+ showFooter: M = !0,
23
+ disabled: m,
24
24
  className: F,
25
25
  isError: S,
26
26
  size: B,
@@ -33,175 +33,175 @@ const m = (e, i = "MM/YYYY") => {
33
33
  displayFormat: a = "MM/YYYY",
34
34
  ...et
35
35
  }, nt) => {
36
- const { t: y } = wt();
37
- A ?? y("datePicker.selectMonthRange");
38
- const H = p.useRef(null), ot = p.useRef(null), c = p.useMemo(
36
+ const { t: w } = wt();
37
+ A ?? w("datePicker.selectMonthRange");
38
+ const H = u.useRef(null), ot = u.useRef(null), c = u.useMemo(
39
39
  () => a === "YYYY/MM" ? "yyyy/MM" : "MM/yyyy",
40
40
  [a]
41
41
  );
42
- p.useImperativeHandle(nt, () => H.current);
43
- const [s, w] = p.useState(!1), V = p.useRef(!1), [v, b] = p.useState(e), [k, N] = p.useState(e?.from ? m(e.from, a) : ""), [D, P] = p.useState(e?.to ? m(e.to, a) : ""), [rt, j] = p.useState(() => e?.from ? new Date(e.from.year, e.from.month, 1) : I || /* @__PURE__ */ new Date());
44
- p.useEffect(() => {
45
- s || (N(e?.from ? m(e.from, a) : ""), P(e?.to ? m(e.to, a) : ""), b(e));
46
- }, [s, e, a]), p.useEffect(() => {
47
- s && (b(e), N(e?.from ? m(e.from, a) : ""), P(e?.to ? m(e.to, a) : ""), j(e?.from ? new Date(e.from.year, e.from.month, 1) : I || /* @__PURE__ */ new Date()));
48
- }, [s, e, a, I]);
42
+ u.useImperativeHandle(nt, () => H.current);
43
+ const [l, g] = u.useState(!1), V = u.useRef(!1), [P, b] = u.useState(e), [k, N] = u.useState(e?.from ? p(e.from, a) : ""), [D, v] = u.useState(e?.to ? p(e.to, a) : ""), [rt, j] = u.useState(() => e?.from ? new Date(e.from.year, e.from.month, 1) : I || /* @__PURE__ */ new Date());
44
+ u.useEffect(() => {
45
+ l || (N(e?.from ? p(e.from, a) : ""), v(e?.to ? p(e.to, a) : ""), b(e));
46
+ }, [l, e, a]), u.useEffect(() => {
47
+ l && (b(e), N(e?.from ? p(e.from, a) : ""), v(e?.to ? p(e.to, a) : ""), j(e?.from ? new Date(e.from.year, e.from.month, 1) : I || /* @__PURE__ */ new Date()));
48
+ }, [l, e, a, I]);
49
49
  const at = (t) => {
50
- b(t), t?.from && N(m(t.from, a)), t?.to && P(m(t.to, a)), !x && t?.from && t?.to && (t.from.month !== t.to.month || t.from.year !== t.to.year) && (i?.(t), w(!1));
50
+ b(t), t?.from && N(p(t.from, a)), t?.to && v(p(t.to, a)), !M && t?.from && t?.to && (t.from.month !== t.to.month || t.from.year !== t.to.year) && (s?.(t), g(!1));
51
51
  }, st = (t) => {
52
- i?.(t !== void 0 ? t : v), w(!1);
52
+ s?.(t !== void 0 ? t : P), g(!1);
53
53
  }, K = () => {
54
- b(e), N(e?.from ? m(e.from, a) : ""), P(e?.to ? m(e.to, a) : ""), w(!1);
54
+ b(e), N(e?.from ? p(e.from, a) : ""), v(e?.to ? p(e.to, a) : ""), g(!1);
55
55
  }, $ = () => {
56
- b(void 0), N(""), P(""), i?.(void 0), x || w(!1);
57
- }, it = (t) => {
56
+ b(void 0), N(""), v(""), s?.(void 0), M || g(!1);
57
+ }, ct = (t) => {
58
58
  const f = t.target.value, r = L(f, c, k);
59
59
  if (N(r), r === "") {
60
- const o = { from: void 0, to: v?.to };
61
- b(o), x || i?.(o);
60
+ const o = { from: void 0, to: P?.to };
61
+ b(o), M || s?.(o);
62
62
  return;
63
63
  }
64
- const n = Y(r, c, /* @__PURE__ */ new Date());
65
- if (M(n) && r.length === 7) {
66
- const l = { from: { month: n.getMonth(), year: n.getFullYear() }, to: v?.to };
67
- b(l), j(n), x || i?.(l);
64
+ const n = y(r, c, /* @__PURE__ */ new Date());
65
+ if (Y(n) && r.length === 7) {
66
+ const d = { from: { month: n.getMonth(), year: n.getFullYear() }, to: P?.to };
67
+ b(d), j(n), M || s?.(d);
68
68
  }
69
- }, ct = (t) => {
69
+ }, it = (t) => {
70
70
  const f = t.target.value, r = L(f, c, D);
71
- if (P(r), r === "") {
72
- const o = { from: v?.from, to: void 0 };
73
- b(o), x || i?.(o);
71
+ if (v(r), r === "") {
72
+ const o = { from: P?.from, to: void 0 };
73
+ b(o), M || s?.(o);
74
74
  return;
75
75
  }
76
- const n = Y(r, c, /* @__PURE__ */ new Date());
77
- if (M(n) && r.length === 7) {
78
- const o = { month: n.getMonth(), year: n.getFullYear() }, l = { from: v?.from, to: o };
79
- b(l), j(n), x || i?.(l);
76
+ const n = y(r, c, /* @__PURE__ */ new Date());
77
+ if (Y(n) && r.length === 7) {
78
+ const o = { month: n.getMonth(), year: n.getFullYear() }, d = { from: P?.from, to: o };
79
+ b(d), j(n), M || s?.(d);
80
80
  }
81
81
  }, T = () => {
82
- if (s) return;
83
- const t = R(k, c), f = R(D, c), r = Y(t, c, /* @__PURE__ */ new Date()), n = Y(f, c, /* @__PURE__ */ new Date()), o = M(r) && t.length === 7, l = M(n) && f.length === 7;
84
- k && !o ? N(e?.from ? m(e.from, a) : "") : o && N(t), D && !l ? P(e?.to ? m(e.to, a) : "") : l && P(f), o && l && !x ? i?.({
82
+ if (l) return;
83
+ const t = R(k, c), f = R(D, c), r = y(t, c, /* @__PURE__ */ new Date()), n = y(f, c, /* @__PURE__ */ new Date()), o = Y(r) && t.length === 7, d = Y(n) && f.length === 7;
84
+ k && !o ? N(e?.from ? p(e.from, a) : "") : o && N(t), D && !d ? v(e?.to ? p(e.to, a) : "") : d && v(f), o && d && !M ? s?.({
85
85
  from: { month: r.getMonth(), year: r.getFullYear() },
86
86
  to: { month: n.getMonth(), year: n.getFullYear() }
87
- }) : o && !x ? i?.({
87
+ }) : o && !M ? s?.({
88
88
  from: { month: r.getMonth(), year: r.getFullYear() },
89
89
  to: e?.to
90
- }) : l && !x && i?.({
90
+ }) : d && !M && s?.({
91
91
  from: e?.from,
92
92
  to: { month: n.getMonth(), year: n.getFullYear() }
93
93
  });
94
- }, dt = e?.from ? m(e.from, a) : "", lt = e?.to ? m(e.to, a) : "", ft = k !== dt, mt = D !== lt, pt = k.length === 7 && !M(Y(k, c, /* @__PURE__ */ new Date())), ut = D.length === 7 && !M(Y(D, c, /* @__PURE__ */ new Date())), q = y("datePicker.startMonth"), G = y("datePicker.endMonth");
95
- return /* @__PURE__ */ h("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "month-range-picker", "data-disabled": u || void 0, children: [
94
+ }, lt = e?.from ? p(e.from, a) : "", dt = e?.to ? p(e.to, a) : "", ft = k !== lt, mt = D !== dt, pt = k.length === 7 && !Y(y(k, c, /* @__PURE__ */ new Date())), ut = D.length === 7 && !Y(y(D, c, /* @__PURE__ */ new Date())), q = w("datePicker.startMonth"), G = w("datePicker.endMonth");
95
+ return /* @__PURE__ */ h("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "month-range-picker", "data-disabled": m || void 0, children: [
96
96
  /* @__PURE__ */ h("div", { className: "flex flex-col gap-[6px]", children: [
97
97
  O && /* @__PURE__ */ h(
98
98
  "label",
99
99
  {
100
- className: g(
100
+ className: x(
101
101
  "text-xs font-medium leading-[18px] text-content-tertiary",
102
- u && "opacity-70",
102
+ m && "opacity-70",
103
103
  S && "text-destructive"
104
104
  ),
105
105
  children: [
106
106
  O,
107
107
  " ",
108
- tt && /* @__PURE__ */ d("span", { className: "text-destructive", children: "*" })
108
+ tt && /* @__PURE__ */ i("span", { className: "text-destructive", children: "*" })
109
109
  ]
110
110
  }
111
111
  ),
112
112
  /* @__PURE__ */ h(
113
113
  "div",
114
114
  {
115
- className: g(
115
+ className: x(
116
116
  "w-full",
117
117
  E && z === "absolute" && "relative"
118
118
  ),
119
119
  children: [
120
- /* @__PURE__ */ h(xt, { open: u ? !1 : s, onOpenChange: (t) => {
121
- u || w(t);
120
+ /* @__PURE__ */ h(xt, { open: m ? !1 : l, onOpenChange: (t) => {
121
+ m || g(t);
122
122
  }, children: [
123
- /* @__PURE__ */ d(Mt, { asChild: !0, children: /* @__PURE__ */ h(
123
+ /* @__PURE__ */ i(Mt, { asChild: !0, children: /* @__PURE__ */ h(
124
124
  "div",
125
125
  {
126
- "data-state": s ? "open" : "closed",
127
- className: g(
126
+ "data-state": l ? "open" : "closed",
127
+ className: x(
128
128
  "flex w-full items-center justify-between gap-2 rounded-md border bg-canvas-elevated px-3 text-sm shadow-sm transition-colors hover:border-brand disabled:cursor-not-allowed disabled:bg-disabled-surface disabled:text-disabled-foreground disabled:border-stroke",
129
129
  S ? "border-destructive hover:border-destructive" : "border-field",
130
130
  B === "sm" ? "h-6" : B === "md" ? "h-[28px]" : "h-8",
131
- u && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
131
+ m && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
132
132
  "cursor-pointer",
133
133
  F
134
134
  ),
135
135
  children: [
136
136
  /* @__PURE__ */ h("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
137
- /* @__PURE__ */ d(
137
+ /* @__PURE__ */ i(
138
138
  "input",
139
139
  {
140
140
  ref: H,
141
141
  type: "text",
142
142
  value: k,
143
- onChange: it,
143
+ onChange: ct,
144
144
  onBlur: T,
145
- onClick: (t) => s && t.stopPropagation(),
145
+ onClick: () => !m && g(!0),
146
146
  onKeyDown: (t) => {
147
- if (t.key === "Enter" && !s) {
147
+ if (t.key === "Enter" && !l) {
148
148
  t.preventDefault();
149
- const f = R(k, c), r = R(D, c), n = Y(f, c, /* @__PURE__ */ new Date()), o = Y(r, c, /* @__PURE__ */ new Date()), l = M(n) && f.length === 7, C = M(o) && r.length === 7;
150
- l && C ? i?.({
149
+ const f = R(k, c), r = R(D, c), n = y(f, c, /* @__PURE__ */ new Date()), o = y(r, c, /* @__PURE__ */ new Date()), d = Y(n) && f.length === 7, C = Y(o) && r.length === 7;
150
+ d && C ? s?.({
151
151
  from: { month: n.getMonth(), year: n.getFullYear() },
152
152
  to: { month: o.getMonth(), year: o.getFullYear() }
153
- }) : l ? i?.({
153
+ }) : d ? s?.({
154
154
  from: { month: n.getMonth(), year: n.getFullYear() },
155
155
  to: e?.to
156
- }) : C && i?.({
156
+ }) : C && s?.({
157
157
  from: e?.from,
158
158
  to: { month: o.getMonth(), year: o.getFullYear() }
159
159
  });
160
160
  }
161
- t.key === "ArrowDown" && !s && !u && (t.preventDefault(), V.current = !0, w(!0)), t.key === "Escape" && s && (t.preventDefault(), K());
161
+ t.key === "ArrowDown" && !l && !m && (t.preventDefault(), V.current = !0, g(!0)), t.key === "Escape" && l && (t.preventDefault(), K());
162
162
  },
163
- placeholder: s ? a === "YYYY/MM" ? "YYYY/MM" : y("datePicker.monthYearFormat") : q,
164
- disabled: !!u,
163
+ placeholder: l ? a === "YYYY/MM" ? "YYYY/MM" : w("datePicker.monthYearFormat") : q,
164
+ disabled: !!m,
165
165
  "aria-label": q,
166
166
  "data-field": "start",
167
- className: g(
167
+ className: x(
168
168
  "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
169
169
  pt ? "text-destructive" : ft ? "text-content-muted" : ""
170
170
  ),
171
171
  ...et
172
172
  }
173
173
  ),
174
- /* @__PURE__ */ d(
174
+ /* @__PURE__ */ i(
175
175
  "input",
176
176
  {
177
177
  ref: ot,
178
178
  type: "text",
179
179
  value: D,
180
- onChange: ct,
180
+ onChange: it,
181
181
  onBlur: T,
182
- onClick: (t) => s && t.stopPropagation(),
182
+ onClick: () => !m && g(!0),
183
183
  onKeyDown: (t) => {
184
- if (t.key === "Enter" && !s) {
184
+ if (t.key === "Enter" && !l) {
185
185
  t.preventDefault();
186
- const f = R(k, c), r = R(D, c), n = Y(f, c, /* @__PURE__ */ new Date()), o = Y(r, c, /* @__PURE__ */ new Date()), l = M(n) && f.length === 7, C = M(o) && r.length === 7;
187
- l && C ? i?.({
186
+ const f = R(k, c), r = R(D, c), n = y(f, c, /* @__PURE__ */ new Date()), o = y(r, c, /* @__PURE__ */ new Date()), d = Y(n) && f.length === 7, C = Y(o) && r.length === 7;
187
+ d && C ? s?.({
188
188
  from: { month: n.getMonth(), year: n.getFullYear() },
189
189
  to: { month: o.getMonth(), year: o.getFullYear() }
190
- }) : l ? i?.({
190
+ }) : d ? s?.({
191
191
  from: { month: n.getMonth(), year: n.getFullYear() },
192
192
  to: e?.to
193
- }) : C && i?.({
193
+ }) : C && s?.({
194
194
  from: e?.from,
195
195
  to: { month: o.getMonth(), year: o.getFullYear() }
196
196
  });
197
197
  }
198
- t.key === "ArrowDown" && !s && !u && (t.preventDefault(), V.current = !0, w(!0)), t.key === "Escape" && s && (t.preventDefault(), K());
198
+ t.key === "ArrowDown" && !l && !m && (t.preventDefault(), V.current = !0, g(!0)), t.key === "Escape" && l && (t.preventDefault(), K());
199
199
  },
200
- placeholder: s ? a === "YYYY/MM" ? "YYYY/MM" : y("datePicker.monthYearFormat") : G,
201
- disabled: !!u,
200
+ placeholder: l ? a === "YYYY/MM" ? "YYYY/MM" : w("datePicker.monthYearFormat") : G,
201
+ disabled: !!m,
202
202
  "aria-label": G,
203
203
  "data-field": "end",
204
- className: g(
204
+ className: x(
205
205
  "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
206
206
  ut ? "text-destructive" : mt ? "text-content-muted" : ""
207
207
  )
@@ -209,13 +209,13 @@ const m = (e, i = "MM/YYYY") => {
209
209
  )
210
210
  ] }),
211
211
  /* @__PURE__ */ h("div", { className: "flex items-center gap-1 shrink-0", children: [
212
- e?.from && !u && /* @__PURE__ */ h(Q, { children: [
213
- /* @__PURE__ */ d(U, { asChild: !0, children: /* @__PURE__ */ d(
212
+ e?.from && !m && /* @__PURE__ */ h(Q, { children: [
213
+ /* @__PURE__ */ i(U, { asChild: !0, children: /* @__PURE__ */ i(
214
214
  "button",
215
215
  {
216
216
  type: "button",
217
217
  tabIndex: 0,
218
- "aria-label": y("calendar.clear"),
218
+ "aria-label": w("calendar.clear"),
219
219
  onClick: (t) => {
220
220
  t.stopPropagation(), $();
221
221
  },
@@ -223,24 +223,24 @@ const m = (e, i = "MM/YYYY") => {
223
223
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), $());
224
224
  },
225
225
  className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
226
- children: /* @__PURE__ */ d(ht, { className: "size-3 hover:text-content text-content-muted" })
226
+ children: /* @__PURE__ */ i(ht, { className: "size-3 hover:text-content text-content-muted" })
227
227
  }
228
228
  ) }),
229
- /* @__PURE__ */ d(W, { variant: "tertiary", side: "top", children: y("calendar.clear") })
229
+ /* @__PURE__ */ i(W, { variant: "tertiary", side: "top", children: w("calendar.clear") })
230
230
  ] }),
231
231
  /* @__PURE__ */ h(Q, { children: [
232
- /* @__PURE__ */ d(U, { asChild: !0, children: /* @__PURE__ */ d("button", { type: "button", tabIndex: 0, "aria-label": y("datePicker.selectMonthRange"), onClick: (t) => {
233
- t.stopPropagation(), u || w(!s);
232
+ /* @__PURE__ */ i(U, { asChild: !0, children: /* @__PURE__ */ i("button", { type: "button", tabIndex: 0, "aria-label": w("datePicker.selectMonthRange"), onClick: (t) => {
233
+ t.stopPropagation(), m || g(!l);
234
234
  }, onKeyDown: (t) => {
235
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), u || (V.current = !0, w(!s)));
236
- }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ d(gt, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
237
- /* @__PURE__ */ d(W, { variant: "tertiary", side: "top", children: y("datePicker.selectMonthRange") })
235
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), m || (V.current = !0, g(!l)));
236
+ }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ i(gt, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
237
+ /* @__PURE__ */ i(W, { variant: "tertiary", side: "top", children: w("datePicker.selectMonthRange") })
238
238
  ] })
239
239
  ] })
240
240
  ]
241
241
  }
242
242
  ) }),
243
- /* @__PURE__ */ d(
243
+ /* @__PURE__ */ i(
244
244
  Yt,
245
245
  {
246
246
  className: "w-auto p-0",
@@ -248,19 +248,19 @@ const m = (e, i = "MM/YYYY") => {
248
248
  onOpenAutoFocus: (t) => {
249
249
  V.current || t.preventDefault(), V.current = !1;
250
250
  },
251
- children: /* @__PURE__ */ d(
251
+ children: /* @__PURE__ */ i(
252
252
  yt,
253
253
  {
254
254
  pickerType: "month",
255
255
  monthMode: "range",
256
- selectedMonths: v,
256
+ selectedMonths: P,
257
257
  onMonthSelect: at,
258
258
  month: rt,
259
259
  onMonthChange: j,
260
260
  disabled: { before: I, after: X },
261
261
  startMonth: Z,
262
262
  endMonth: _,
263
- showFooter: x,
263
+ showFooter: M,
264
264
  onApply: st,
265
265
  onCancel: K,
266
266
  onClear: $
@@ -269,21 +269,21 @@ const m = (e, i = "MM/YYYY") => {
269
269
  }
270
270
  )
271
271
  ] }),
272
- E && z === "absolute" && /* @__PURE__ */ h("div", { className: g("absolute left-0 top-full z-10 mt-1 flex min-w-0 max-w-full items-center gap-[6px]", S && "text-destructive"), children: [
273
- /* @__PURE__ */ d(
272
+ E && z === "absolute" && /* @__PURE__ */ h("div", { className: x("absolute left-0 top-full z-10 mt-1 flex min-w-0 max-w-full items-center gap-[6px]", S && "text-destructive"), children: [
273
+ /* @__PURE__ */ i(
274
274
  J,
275
275
  {
276
276
  size: "xs",
277
- className: g(
277
+ className: x(
278
278
  "shrink-0",
279
279
  S ? "text-destructive" : "text-content-muted"
280
280
  )
281
281
  }
282
282
  ),
283
- /* @__PURE__ */ d(
283
+ /* @__PURE__ */ i(
284
284
  "p",
285
285
  {
286
- className: g(
286
+ className: x(
287
287
  "min-w-0 text-[12px] font-medium leading-[18px] text-navigation-muted",
288
288
  S && "text-destructive"
289
289
  ),
@@ -295,21 +295,21 @@ const m = (e, i = "MM/YYYY") => {
295
295
  }
296
296
  )
297
297
  ] }),
298
- E && z === "flow" && /* @__PURE__ */ h("div", { className: g("flex items-center gap-[6px]", S && "text-destructive"), children: [
299
- /* @__PURE__ */ d(
298
+ E && z === "flow" && /* @__PURE__ */ h("div", { className: x("flex items-center gap-[6px]", S && "text-destructive"), children: [
299
+ /* @__PURE__ */ i(
300
300
  J,
301
301
  {
302
302
  size: "xs",
303
- className: g(
303
+ className: x(
304
304
  "shrink-0",
305
305
  S ? "text-destructive" : "text-content-muted"
306
306
  )
307
307
  }
308
308
  ),
309
- /* @__PURE__ */ d(
309
+ /* @__PURE__ */ i(
310
310
  "p",
311
311
  {
312
- className: g(
312
+ className: x(
313
313
  "text-[12px] font-medium leading-[18px] text-navigation-muted",
314
314
  S && "text-destructive"
315
315
  ),
@@ -1,5 +1,5 @@
1
- import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
- import * as o from "react";
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import * as a from "react";
3
3
  import { Cross as j, CalendarMonth as w } from "impact-nova-icons";
4
4
  import { format as z } from "date-fns";
5
5
  import { cn as R } from "../../../lib/utils.js";
@@ -9,10 +9,10 @@ import { Calendar as q } from "../calendar.js";
9
9
  import { Tooltip as u, TooltipTrigger as y, TooltipContent as g } from "../tooltip.js";
10
10
  import { getDateFnsLocale as B } from "../../../i18n/getDateFnsLocale.js";
11
11
  import { useImpactNovaI18n as G } from "../../../i18n/ImpactNovaI18nContext.js";
12
- const H = o.forwardRef(
12
+ const H = a.forwardRef(
13
13
  ({
14
14
  value: t,
15
- onChange: c,
15
+ onChange: s,
16
16
  format: C = "MM/dd/yyyy",
17
17
  placeholder: x,
18
18
  minDate: P,
@@ -20,43 +20,46 @@ const H = o.forwardRef(
20
20
  startMonth: N,
21
21
  endMonth: D,
22
22
  showFooter: p = !0,
23
- disabled: n,
24
- className: A,
25
- ...T
26
- }, b) => {
27
- const { locale: d, t: a } = G(), k = o.useMemo(() => B(d), [d]), v = x ?? a("datePicker.selectMultipleDates"), [m, l] = o.useState(!1), [f, i] = o.useState(t);
28
- o.useEffect(() => {
23
+ disabled: o,
24
+ className: k,
25
+ ...A
26
+ }, T) => {
27
+ const { locale: m, t: l } = G(), b = a.useMemo(() => B(m), [m]), v = x ?? l("datePicker.selectMultipleDates"), [d, n] = a.useState(!1), [f, i] = a.useState(t);
28
+ a.useEffect(() => {
29
29
  i(t);
30
- }, [m, t]);
30
+ }, [d, t]);
31
31
  const I = (r) => {
32
- i(r), p || c?.(r);
32
+ i(r), p || s?.(r);
33
33
  }, L = (r) => {
34
- c?.(r !== void 0 ? r : f), l(!1);
34
+ s?.(r !== void 0 ? r : f), n(!1);
35
35
  }, O = () => {
36
- i(t), l(!1);
36
+ i(t), n(!1);
37
37
  }, h = () => {
38
- i(void 0), c?.(void 0), p || l(!1);
39
- }, S = t && t.length > 0 ? t.length === 1 ? z(t[0], C, { locale: k }) : `${t.length} dates selected` : "";
40
- return /* @__PURE__ */ s(F, { open: n ? !1 : m, onOpenChange: (r) => {
41
- n || l(r);
38
+ i(void 0), s?.(void 0), p || n(!1);
39
+ }, S = t && t.length > 0 ? t.length === 1 ? z(t[0], C, { locale: b }) : `${t.length} dates selected` : "";
40
+ return /* @__PURE__ */ c(F, { open: o ? !1 : d, onOpenChange: (r) => {
41
+ o || n(r);
42
42
  }, children: [
43
43
  /* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
44
44
  E,
45
45
  {
46
- ref: b,
46
+ ref: T,
47
47
  value: S,
48
48
  placeholder: v,
49
49
  readOnly: !0,
50
- disabled: n,
51
- className: R("cursor-pointer", A),
52
- suffix: /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
53
- t && t.length > 0 && !n && /* @__PURE__ */ s(u, { children: [
50
+ disabled: o,
51
+ onClick: () => {
52
+ !o && !d && n(!0);
53
+ },
54
+ className: R("cursor-pointer", k),
55
+ suffix: /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
56
+ t && t.length > 0 && !o && /* @__PURE__ */ c(u, { children: [
54
57
  /* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ e(
55
58
  "button",
56
59
  {
57
60
  type: "button",
58
61
  tabIndex: 0,
59
- "aria-label": a("calendar.clear"),
62
+ "aria-label": l("calendar.clear"),
60
63
  onClick: (r) => {
61
64
  r.stopPropagation(), h();
62
65
  },
@@ -64,14 +67,14 @@ const H = o.forwardRef(
64
67
  children: /* @__PURE__ */ e(j, { className: "size-3 hover:text-content" })
65
68
  }
66
69
  ) }),
67
- /* @__PURE__ */ e(g, { variant: "tertiary", side: "top", children: a("calendar.clear") })
70
+ /* @__PURE__ */ e(g, { variant: "tertiary", side: "top", children: l("calendar.clear") })
68
71
  ] }),
69
- /* @__PURE__ */ s(u, { children: [
72
+ /* @__PURE__ */ c(u, { children: [
70
73
  /* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ e(w, { className: "h-4 w-4 text-secondary-foreground" }) }),
71
- /* @__PURE__ */ e(g, { variant: "tertiary", side: "top", children: a("datePicker.selectMultipleDates") })
74
+ /* @__PURE__ */ e(g, { variant: "tertiary", side: "top", children: l("datePicker.selectMultipleDates") })
72
75
  ] })
73
76
  ] }),
74
- ...T
77
+ ...A
75
78
  }
76
79
  ) }) }),
77
80
  /* @__PURE__ */ e(