impact-nova 1.7.9 → 1.7.11

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,21 +1,21 @@
1
- import { jsxs as a, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
2
  import * as d from "react";
3
3
  import { X as pt } from "lucide-react";
4
4
  import { CalendarMonth as ht, Info as O } from "../../../icons/index.js";
5
- import { isValid as y, parse as P } from "date-fns";
5
+ import { isValid as P, parse as v } from "date-fns";
6
6
  import { cn as l, padValidDateString as T, maskDate as H } from "../../../lib/utils.js";
7
7
  import { Popover as ut, PopoverTrigger as xt, PopoverContent as gt } from "../popover.js";
8
8
  import { Calendar as Mt } from "../calendar.js";
9
9
  import { Tooltip as X, TooltipTrigger as q, TooltipContent as G } from "../tooltip.js";
10
10
  import { useImpactNovaI18n as Yt } from "../../../i18n/ImpactNovaI18nContext.js";
11
11
  const r = (t, f = "MM/YYYY") => {
12
- const v = (t.month + 1).toString().padStart(2, "0");
13
- return f === "YYYY/MM" ? `${t.year}/${v}` : `${v}/${t.year}`;
12
+ const V = (t.month + 1).toString().padStart(2, "0");
13
+ return f === "YYYY/MM" ? `${t.year}/${V}` : `${V}/${t.year}`;
14
14
  }, wt = d.forwardRef(
15
15
  ({
16
16
  value: t,
17
17
  onChange: f,
18
- placeholder: v,
18
+ placeholder: V,
19
19
  minDate: C,
20
20
  maxDate: J,
21
21
  startMonth: K,
@@ -24,10 +24,10 @@ const r = (t, f = "MM/YYYY") => {
24
24
  disabled: k,
25
25
  className: Q,
26
26
  isError: g,
27
- size: A,
28
- label: E,
27
+ size: E,
28
+ label: $,
29
29
  helperText: I,
30
- helperTextPosition: D = "absolute",
30
+ helperTextPosition: A = "absolute",
31
31
  required: U,
32
32
  prefix: bt,
33
33
  prefixClick: kt,
@@ -35,61 +35,61 @@ const r = (t, f = "MM/YYYY") => {
35
35
  ...W
36
36
  }, Z) => {
37
37
  const { t: w } = Yt();
38
- v ?? w("datePicker.selectMonthRange");
39
- const $ = d.useRef(null), _ = d.useRef(null), m = d.useMemo(
38
+ V ?? w("datePicker.selectMonthRange");
39
+ const j = d.useRef(null), _ = d.useRef(null), m = d.useMemo(
40
40
  () => n === "YYYY/MM" ? "yyyy/MM" : "MM/yyyy",
41
41
  [n]
42
42
  );
43
- d.useImperativeHandle(Z, () => $.current);
44
- const [i, R] = d.useState(!1), [j, p] = d.useState(t), [N, M] = d.useState(t?.from ? r(t.from, n) : ""), [S, Y] = d.useState(t?.to ? r(t.to, n) : ""), [F, V] = d.useState(() => t?.from ? new Date(t.from.year, t.from.month, 1) : C || /* @__PURE__ */ new Date());
43
+ d.useImperativeHandle(Z, () => j.current);
44
+ const [i, R] = d.useState(!1), [N, p] = d.useState(t), [S, M] = d.useState(t?.from ? r(t.from, n) : ""), [y, Y] = d.useState(t?.to ? r(t.to, n) : ""), [F, D] = d.useState(() => t?.from ? new Date(t.from.year, t.from.month, 1) : C || /* @__PURE__ */ new Date());
45
45
  d.useEffect(() => {
46
46
  i || (M(t?.from ? r(t.from, n) : ""), Y(t?.to ? r(t.to, n) : ""), p(t));
47
47
  }, [i, t, n]), d.useEffect(() => {
48
- i && (p(t), M(t?.from ? r(t.from, n) : ""), Y(t?.to ? r(t.to, n) : ""), V(t?.from ? new Date(t.from.year, t.from.month, 1) : C || /* @__PURE__ */ new Date()));
48
+ i && (p(t), M(t?.from ? r(t.from, n) : ""), Y(t?.to ? r(t.to, n) : ""), D(t?.from ? new Date(t.from.year, t.from.month, 1) : C || /* @__PURE__ */ new Date()));
49
49
  }, [i, t, n, C]);
50
50
  const tt = (e) => {
51
51
  p(e), e?.from && M(r(e.from, n)), e?.to && Y(r(e.to, n)), !x && e?.from && e?.to && (e.from.month !== e.to.month || e.from.year !== e.to.year) && (f?.(e), R(!1));
52
52
  }, et = (e) => {
53
- f?.(e !== void 0 ? e : j), R(!1);
53
+ f?.(e !== void 0 ? e : N), R(!1);
54
54
  }, nt = () => {
55
55
  p(t), M(t?.from ? r(t.from, n) : ""), Y(t?.to ? r(t.to, n) : ""), R(!1);
56
56
  }, z = () => {
57
57
  p(void 0), M(""), Y(""), f?.(void 0), x || R(!1);
58
58
  }, ot = (e) => {
59
- const u = e.target.value, s = H(u, m, N);
59
+ const u = e.target.value, s = H(u, m, S);
60
60
  if (M(s), s === "") {
61
- const h = { from: void 0, to: t?.to };
61
+ const h = { from: void 0, to: N?.to };
62
62
  p(h), x || f?.(h);
63
63
  return;
64
64
  }
65
- const c = P(s, m, /* @__PURE__ */ new Date());
66
- if (y(c) && s.length === 7) {
67
- const b = { from: { month: c.getMonth(), year: c.getFullYear() }, to: t?.to };
68
- p(b), V(c), x || f?.(b);
65
+ const a = v(s, m, /* @__PURE__ */ new Date());
66
+ if (P(a) && s.length === 7) {
67
+ const b = { from: { month: a.getMonth(), year: a.getFullYear() }, to: N?.to };
68
+ p(b), D(a), x || f?.(b);
69
69
  }
70
70
  }, rt = (e) => {
71
- const u = e.target.value, s = H(u, m, S);
71
+ const u = e.target.value, s = H(u, m, y);
72
72
  if (Y(s), s === "") {
73
- const h = { from: t?.from, to: void 0 };
73
+ const h = { from: N?.from, to: void 0 };
74
74
  p(h), x || f?.(h);
75
75
  return;
76
76
  }
77
- const c = P(s, m, /* @__PURE__ */ new Date());
78
- if (y(c) && s.length === 7) {
79
- const h = { month: c.getMonth(), year: c.getFullYear() }, b = { from: t?.from, to: h };
80
- p(b), V(c), x || f?.(b);
77
+ const a = v(s, m, /* @__PURE__ */ new Date());
78
+ if (P(a) && s.length === 7) {
79
+ const h = { month: a.getMonth(), year: a.getFullYear() }, b = { from: N?.from, to: h };
80
+ p(b), D(a), x || f?.(b);
81
81
  }
82
82
  }, B = () => {
83
83
  if (i) return;
84
- const e = T(N, m), u = T(S, m), s = P(e, m, /* @__PURE__ */ new Date()), c = P(u, m, /* @__PURE__ */ new Date()), h = y(s) && e.length === 7, b = y(c) && u.length === 7;
84
+ const e = T(S, m), u = T(y, m), s = v(e, m, /* @__PURE__ */ new Date()), a = v(u, m, /* @__PURE__ */ new Date()), h = P(s) && e.length === 7, b = P(a) && u.length === 7;
85
85
  !h || !b ? (M(t?.from ? r(t.from, n) : ""), Y(t?.to ? r(t.to, n) : ""), p(t)) : (M(e), Y(u), x || f?.({
86
86
  from: { month: s.getMonth(), year: s.getFullYear() },
87
- to: { month: c.getMonth(), year: c.getFullYear() }
87
+ to: { month: a.getMonth(), year: a.getFullYear() }
88
88
  }));
89
- }, st = t?.from ? r(t.from, n) : "", ct = t?.to ? r(t.to, n) : "", at = N !== st, dt = S !== ct, it = N.length === 7 && !y(P(N, m, /* @__PURE__ */ new Date())), lt = S.length === 7 && !y(P(S, m, /* @__PURE__ */ new Date())), ft = w("datePicker.startMonth"), mt = w("datePicker.endMonth");
90
- return /* @__PURE__ */ a("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "month-range-picker", "data-disabled": k || void 0, children: [
91
- /* @__PURE__ */ a("div", { className: "flex flex-col gap-[6px]", children: [
92
- E && /* @__PURE__ */ a(
89
+ }, st = t?.from ? r(t.from, n) : "", at = t?.to ? r(t.to, n) : "", ct = S !== st, dt = y !== at, it = S.length === 7 && !P(v(S, m, /* @__PURE__ */ new Date())), lt = y.length === 7 && !P(v(y, m, /* @__PURE__ */ new Date())), ft = w("datePicker.startMonth"), mt = w("datePicker.endMonth");
90
+ return /* @__PURE__ */ c("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "month-range-picker", "data-disabled": k || void 0, children: [
91
+ /* @__PURE__ */ c("div", { className: "flex flex-col gap-[6px]", children: [
92
+ $ && /* @__PURE__ */ c(
93
93
  "label",
94
94
  {
95
95
  className: l(
@@ -98,41 +98,41 @@ const r = (t, f = "MM/YYYY") => {
98
98
  g && "text-destructive"
99
99
  ),
100
100
  children: [
101
- E,
101
+ $,
102
102
  " ",
103
103
  U && /* @__PURE__ */ o("span", { className: "text-destructive", children: "*" })
104
104
  ]
105
105
  }
106
106
  ),
107
- /* @__PURE__ */ a(
107
+ /* @__PURE__ */ c(
108
108
  "div",
109
109
  {
110
110
  className: l(
111
111
  "w-full",
112
- I && D === "absolute" && "relative"
112
+ I && A === "absolute" && "relative"
113
113
  ),
114
114
  children: [
115
- /* @__PURE__ */ a(ut, { open: i, onOpenChange: R, children: [
116
- /* @__PURE__ */ o(xt, { asChild: !0, children: /* @__PURE__ */ a(
115
+ /* @__PURE__ */ c(ut, { open: i, onOpenChange: R, children: [
116
+ /* @__PURE__ */ o(xt, { asChild: !0, children: /* @__PURE__ */ c(
117
117
  "div",
118
118
  {
119
119
  "data-state": i ? "open" : "closed",
120
120
  className: l(
121
121
  "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",
122
122
  g ? "border-destructive hover:border-destructive" : "border-field",
123
- A === "sm" ? "h-6" : A === "md" ? "h-[28px]" : "h-8",
123
+ E === "sm" ? "h-6" : E === "md" ? "h-[28px]" : "h-8",
124
124
  k && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
125
125
  "cursor-pointer",
126
126
  Q
127
127
  ),
128
128
  children: [
129
- /* @__PURE__ */ a("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
129
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
130
130
  /* @__PURE__ */ o(
131
131
  "input",
132
132
  {
133
- ref: $,
133
+ ref: j,
134
134
  type: "text",
135
- value: N,
135
+ value: S,
136
136
  onChange: ot,
137
137
  onBlur: B,
138
138
  onClick: (e) => i && e.stopPropagation(),
@@ -141,7 +141,7 @@ const r = (t, f = "MM/YYYY") => {
141
141
  "data-field": "start",
142
142
  className: l(
143
143
  "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",
144
- it ? "text-destructive" : at ? "text-content-muted" : ""
144
+ it ? "text-destructive" : ct ? "text-content-muted" : ""
145
145
  ),
146
146
  ...W
147
147
  }
@@ -151,7 +151,7 @@ const r = (t, f = "MM/YYYY") => {
151
151
  {
152
152
  ref: _,
153
153
  type: "text",
154
- value: S,
154
+ value: y,
155
155
  onChange: rt,
156
156
  onBlur: B,
157
157
  onClick: (e) => i && e.stopPropagation(),
@@ -165,8 +165,8 @@ const r = (t, f = "MM/YYYY") => {
165
165
  }
166
166
  )
167
167
  ] }),
168
- /* @__PURE__ */ a("div", { className: "flex items-center gap-1 shrink-0", children: [
169
- t?.from && !k && /* @__PURE__ */ a(X, { children: [
168
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-1 shrink-0", children: [
169
+ t?.from && !k && /* @__PURE__ */ c(X, { children: [
170
170
  /* @__PURE__ */ o(q, { asChild: !0, children: /* @__PURE__ */ o(
171
171
  pt,
172
172
  {
@@ -178,7 +178,7 @@ const r = (t, f = "MM/YYYY") => {
178
178
  ) }),
179
179
  /* @__PURE__ */ o(G, { variant: "tertiary", side: "top", children: w("calendar.clear") })
180
180
  ] }),
181
- /* @__PURE__ */ a(X, { children: [
181
+ /* @__PURE__ */ c(X, { children: [
182
182
  /* @__PURE__ */ o(q, { asChild: !0, children: /* @__PURE__ */ o(ht, { className: "h-4 w-4 text-secondary-foreground" }) }),
183
183
  /* @__PURE__ */ o(G, { variant: "tertiary", side: "top", children: w("datePicker.selectMonthRange") })
184
184
  ] })
@@ -197,10 +197,10 @@ const r = (t, f = "MM/YYYY") => {
197
197
  {
198
198
  pickerType: "month",
199
199
  monthMode: "range",
200
- selectedMonths: j,
200
+ selectedMonths: N,
201
201
  onMonthSelect: tt,
202
202
  month: F,
203
- onMonthChange: V,
203
+ onMonthChange: D,
204
204
  disabled: { before: C, after: J },
205
205
  startMonth: K,
206
206
  endMonth: L,
@@ -213,7 +213,7 @@ const r = (t, f = "MM/YYYY") => {
213
213
  }
214
214
  )
215
215
  ] }),
216
- I && D === "absolute" && /* @__PURE__ */ a("div", { className: l("absolute left-0 top-full z-10 mt-1 flex min-w-0 max-w-full items-center gap-[6px]", g && "text-destructive"), children: [
216
+ I && A === "absolute" && /* @__PURE__ */ c("div", { className: l("absolute left-0 top-full z-10 mt-1 flex min-w-0 max-w-full items-center gap-[6px]", g && "text-destructive"), children: [
217
217
  /* @__PURE__ */ o(
218
218
  O,
219
219
  {
@@ -239,7 +239,7 @@ const r = (t, f = "MM/YYYY") => {
239
239
  }
240
240
  )
241
241
  ] }),
242
- I && D === "flow" && /* @__PURE__ */ a("div", { className: l("flex items-center gap-[6px]", g && "text-destructive"), children: [
242
+ I && A === "flow" && /* @__PURE__ */ c("div", { className: l("flex items-center gap-[6px]", g && "text-destructive"), children: [
243
243
  /* @__PURE__ */ o(
244
244
  O,
245
245
  {
@@ -99,7 +99,7 @@ const j = ({
99
99
  variant: "secondary",
100
100
  size: "md",
101
101
  shape: "rounded",
102
- className: "whitespace-nowrap bg-[#eceefd] text-[#4259ee] hover:bg-[#dce1fc] border-0 h-6 px-2 text-xs font-medium font-['Manrope'] cursor-pointer",
102
+ className: "whitespace-nowrap bg-[#eceefd] text-[#4259ee] hover:bg-[#dce1fc] border-0 h-5 px-2 text-xs font-medium font-['Manrope'] cursor-pointer",
103
103
  onClick: () => i?.(e.id),
104
104
  tabIndex: 0,
105
105
  role: "button",
@@ -125,7 +125,7 @@ const j = ({
125
125
  variant: "secondary",
126
126
  size: "md",
127
127
  shape: "rounded",
128
- className: "whitespace-nowrap bg-[#eceefd] text-[#4259ee] hover:bg-[#dce1fc] border-0 h-6 px-2 text-xs font-medium font-['Manrope'] cursor-pointer",
128
+ className: "whitespace-nowrap bg-[#eceefd] text-[#4259ee] hover:bg-[#dce1fc] border-0 h-5 px-2 text-xs font-medium font-['Manrope'] cursor-pointer",
129
129
  children: b
130
130
  }
131
131
  ) }) }),