impact-nova 2.5.8 → 2.5.10

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.
Files changed (73) hide show
  1. package/dist/components/data/data-table/column-runtime-state-guard.js +42 -42
  2. package/dist/components/data/data-table/data-table-column-tree-cache.d.ts +15 -0
  3. package/dist/components/data/data-table/data-table-column-tree-cache.js +109 -80
  4. package/dist/components/data/data-table/use-data-table-column-list-sync.js +65 -62
  5. package/dist/components/data/expandable-list-item/expandable-list-item-attributes.js +2 -3
  6. package/dist/components/data/expandable-list-item/expandable-list-item-metrics.js +2 -3
  7. package/dist/components/data-display/calendar/calendar-day-picker-classnames.d.ts +6 -1
  8. package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +31 -23
  9. package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +2 -1
  10. package/dist/components/data-display/calendar/calendar-day-picker-components.js +197 -164
  11. package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +3 -2
  12. package/dist/components/data-display/calendar/calendar-day-picker-view.js +130 -129
  13. package/dist/components/data-display/calendar/calendar-fiscal-labels.js +6 -6
  14. package/dist/components/data-display/calendar/calendar-fiscal-period-nav.d.ts +16 -0
  15. package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +41 -0
  16. package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +5 -1
  17. package/dist/components/data-display/calendar/calendar-padding-week.utils.js +20 -16
  18. package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +2 -1
  19. package/dist/components/data-display/calendar/calendar-week-number-cell.js +43 -42
  20. package/dist/components/data-display/calendar/calendar-week-utils.d.ts +6 -0
  21. package/dist/components/data-display/calendar/calendar-week-utils.js +51 -47
  22. package/dist/components/data-display/calendar/calendar.js +102 -100
  23. package/dist/components/data-display/calendar/calendar.types.d.ts +2 -0
  24. package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +4 -2
  25. package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +77 -72
  26. package/dist/components/data-display/calendar/use-fiscal-calendar.js +16 -15
  27. package/dist/components/feedback/dialog/dialog.js +12 -12
  28. package/dist/components/feedback/sheet/sheet.js +22 -22
  29. package/dist/components/feedback/tooltip/tab-tooltip-render.js +2 -3
  30. package/dist/components/flows/command-palette/shortcut-settings.js +10 -10
  31. package/dist/components/flows/filter-panel/filter-panel.js +4 -4
  32. package/dist/components/forms/date-picker/calendar-selection-adapters.d.ts +2 -0
  33. package/dist/components/forms/date-picker/calendar-selection-adapters.js +36 -31
  34. package/dist/components/forms/date-picker/date-input-behavior.d.ts +10 -0
  35. package/dist/components/forms/date-picker/date-input-behavior.js +111 -90
  36. package/dist/components/forms/date-picker/date-picker.js +71 -69
  37. package/dist/components/forms/date-picker/date-picker.types.d.ts +2 -0
  38. package/dist/components/forms/date-picker/date-range-picker.js +146 -144
  39. package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +1 -0
  40. package/dist/components/forms/date-picker/fiscal-pass-through.js +1 -0
  41. package/dist/components/forms/date-picker/month-picker.js +82 -80
  42. package/dist/components/forms/date-picker/month-range-picker.js +145 -143
  43. package/dist/components/forms/date-picker/multi-date-picker.js +51 -49
  44. package/dist/components/forms/date-picker/multi-month-picker.js +49 -47
  45. package/dist/components/forms/date-picker/multi-quarter-picker.js +46 -44
  46. package/dist/components/forms/date-picker/multi-week-picker.js +53 -51
  47. package/dist/components/forms/date-picker/multi-year-picker.js +48 -46
  48. package/dist/components/forms/date-picker/picker-story-layout.d.ts +2 -0
  49. package/dist/components/forms/date-picker/quarter-picker.js +46 -44
  50. package/dist/components/forms/date-picker/quarter-range-picker.js +45 -43
  51. package/dist/components/forms/date-picker/week-picker.js +82 -80
  52. package/dist/components/forms/date-picker/week-range-picker.js +169 -164
  53. package/dist/components/forms/date-picker/year-picker.js +47 -45
  54. package/dist/components/forms/date-picker/year-range-picker.js +47 -45
  55. package/dist/components/forms/select/components/SelectMenuPanel.js +3 -2
  56. package/dist/components/forms/select/components/SelectTriggerValue.js +2 -3
  57. package/dist/components/forms/select/components/Submenu.js +2 -3
  58. package/dist/components/forms/select/select.js +1 -0
  59. package/dist/components/forms/smart-input/smart-input.js +106 -85
  60. package/dist/components/forms/smart-input/smart-input.types.d.ts +5 -0
  61. package/dist/components/forms/textarea/textarea.js +29 -28
  62. package/dist/components/forms/textarea/textarea.types.d.ts +1 -0
  63. package/dist/form-react/Fields/TextField.js +25 -24
  64. package/dist/form-react/Fields/WeekRangePicker.js +47 -48
  65. package/dist/form-react/types/fields.types.d.ts +8 -0
  66. package/dist/impact-nova.css +1 -1
  67. package/dist/lib/fiscal-calendar/civil-date.js +18 -18
  68. package/dist/lib/overlay/overlay-portal-context.js +16 -16
  69. package/dist/llms/rules/best-practices.js +1 -1
  70. package/dist/llms/rules/installation.js +1 -1
  71. package/dist/llms/rules/real-world-patterns.js +1 -1
  72. package/dist/llms/rules/requirements.js +1 -1
  73. package/package.json +1 -1
@@ -1,34 +1,50 @@
1
- import { jsx as P } from "react/jsx-runtime";
2
- import { useState as E } from "react";
3
- import { createComponent as x } from "../../../lib/primitives/create-component.js";
4
- import { Input as L } from "../input/input.js";
5
- const le = x("SmartInput", function({
6
- value: M,
7
- type: S = "text",
8
- onChange: v,
9
- onBlur: b,
10
- onFocus: z,
11
- allowNegative: D = !0,
1
+ import { jsx as R } from "react/jsx-runtime";
2
+ import { useState as ee } from "react";
3
+ import { createComponent as te } from "../../../lib/primitives/create-component.js";
4
+ import { Input as re } from "../input/input.js";
5
+ const ne = /* @__PURE__ */ new Set([
6
+ "email",
7
+ "password",
8
+ "url",
9
+ "tel"
10
+ ]);
11
+ function se(d, v) {
12
+ return d !== void 0 ? d : ne.has(v ?? "");
13
+ }
14
+ function ue(d) {
15
+ return d.replace(/[^\p{L}\p{N}\s]/gu, "");
16
+ }
17
+ const he = te("SmartInput", function({
18
+ value: v,
19
+ type: C = "text",
20
+ onChange: I,
21
+ onBlur: T,
22
+ onFocus: _,
23
+ allowNegative: m = !0,
12
24
  min: s,
13
25
  max: u,
14
- minOperator: F,
15
- maxOperator: K,
16
- min_operator: O = ">=",
17
- max_operator: W = "<=",
18
- maxIntegerDigits: V,
19
- decimalPlaces: o,
20
- enforceDecimal: j = !1,
21
- allowDecimal: B = !0,
22
- maxLength: i,
23
- trimLeadingSpaces: y = !0,
24
- customValidator: N,
26
+ minOperator: b,
27
+ maxOperator: E,
28
+ min_operator: F = ">=",
29
+ max_operator: K = "<=",
30
+ maxIntegerDigits: D,
31
+ decimalPlaces: a,
32
+ enforceDecimal: O = !1,
33
+ allowDecimal: N = !0,
34
+ allowSpecialCharacters: U,
35
+ maxLength: c,
36
+ trimLeadingSpaces: P = !0,
37
+ customValidator: B,
25
38
  onValidationError: p,
26
- disabled: h = !1,
27
- ...k
28
- }, T) {
29
- const $ = M !== void 0, [U, m] = E(""), a = $ ? String(M ?? "") : U, c = S === "number", g = F ?? O, w = K ?? W, q = (t) => {
39
+ disabled: S = !1,
40
+ ...W
41
+ }, j) {
42
+ const $ = v !== void 0, [k, g] = ee(""), i = $ ? String(v ?? "") : k, l = C === "number", A = se(
43
+ U,
44
+ C
45
+ ), V = b ?? F, w = E ?? K, z = (t) => {
30
46
  if (s === void 0) return !0;
31
- switch (g) {
47
+ switch (V) {
32
48
  case ">":
33
49
  return t > s;
34
50
  case ">=":
@@ -40,7 +56,7 @@ const le = x("SmartInput", function({
40
56
  default:
41
57
  return !0;
42
58
  }
43
- }, A = (t) => {
59
+ }, G = (t) => {
44
60
  if (u === void 0) return !0;
45
61
  switch (w) {
46
62
  case ">":
@@ -54,10 +70,10 @@ const le = x("SmartInput", function({
54
70
  default:
55
71
  return !0;
56
72
  }
57
- }, G = (t) => {
73
+ }, H = (t) => {
58
74
  let e = t;
59
75
  if (s !== void 0) {
60
- const r = g === ">" ? s + 0.01 : s;
76
+ const r = V === ">" ? s + 0.01 : s;
61
77
  e = Math.max(e, r);
62
78
  }
63
79
  if (u !== void 0) {
@@ -65,124 +81,129 @@ const le = x("SmartInput", function({
65
81
  e = Math.min(e, r);
66
82
  }
67
83
  return e;
68
- }, H = (t) => {
69
- const e = D ? /[^0-9.-]/g : /[^0-9.]/g;
84
+ }, Q = (t) => {
85
+ const e = m ? /[^0-9.-]/g : /[^0-9.]/g;
70
86
  return t.replace(e, "");
71
- }, J = (t) => {
87
+ }, Y = (t) => {
72
88
  const e = t.split(".");
73
89
  return e.length > 2 ? e[0] + "." + e.slice(1).join("") : t;
74
- }, Q = (t, e) => {
75
- if (!D) return t;
90
+ }, q = (t, e) => {
91
+ if (!m) return t;
76
92
  if ((t.match(/-/g) || []).length > 1) {
77
93
  let n = t.replace(/-/g, "");
78
94
  return e.startsWith("-") && (n = "-" + n), n;
79
95
  } else if (t.includes("-") && !t.startsWith("-"))
80
96
  return t.replace("-", "");
81
97
  return t;
82
- }, R = (t) => {
83
- if (o === void 0 || !t.includes(".")) return t;
98
+ }, J = (t) => {
99
+ if (a === void 0 || !t.includes(".")) return t;
84
100
  const [e, r] = t.split(".");
85
- return r && r.length > o ? `${e}.${r.slice(0, o)}` : t;
101
+ return r && r.length > a ? `${e}.${r.slice(0, a)}` : t;
86
102
  }, X = (t) => {
87
- if (V === void 0) return t;
103
+ if (D === void 0) return t;
88
104
  const [e, r] = t.split("."), n = e.replace("-", "");
89
- if (n.length > V) {
90
- const f = n.slice(0, V), d = e.startsWith("-") ? "-" : "";
91
- return r !== void 0 ? `${d}${f}.${r}` : `${d}${f}`;
105
+ if (n.length > D) {
106
+ const o = n.slice(0, D), f = e.startsWith("-") ? "-" : "";
107
+ return r !== void 0 ? `${f}${o}.${r}` : `${f}${o}`;
92
108
  }
93
109
  return t;
94
- }, C = (t) => {
95
- if (!c) return t;
110
+ }, Z = (t) => {
111
+ if (!l) return t;
96
112
  let e = String(t ?? "");
97
- return y && (e = e.replace(/^\s+/, "")), e = H(e), e = J(e), e = Q(e, t), e = R(e), e = X(e), B || (e = e.replace(".", "")), e;
98
- }, Y = (t) => {
99
- if (!c || !t || t === "-") return t;
113
+ return P && (e = e.replace(/^\s+/, "")), e = Q(e), e = Y(e), e = q(e, t), e = J(e), e = X(e), N || (e = e.replace(".", "")), e;
114
+ }, y = (t) => {
115
+ if (l) return Z(t);
116
+ let e = String(t ?? "");
117
+ return P && (e = e.replace(/^\s+/, "")), A || (e = ue(e)), e;
118
+ }, x = (t) => {
119
+ if (!l || !t || t === "-") return t;
100
120
  let e = t;
101
121
  const r = parseFloat(e);
102
122
  if (isNaN(r)) return "";
103
- const n = G(r);
104
- if (j && o !== void 0)
105
- e = n.toFixed(o);
106
- else if (o !== void 0 && e.includes(".")) {
107
- const [f, d = ""] = e.split("."), I = d.padEnd(o, "0");
108
- e = `${f}.${I}`;
123
+ const n = H(r);
124
+ if (O && a !== void 0)
125
+ e = n.toFixed(a);
126
+ else if (a !== void 0 && e.includes(".")) {
127
+ const [o, f = ""] = e.split("."), M = f.padEnd(a, "0");
128
+ e = `${o}.${M}`;
109
129
  } else
110
130
  e = String(n);
111
131
  return e;
112
- }, Z = (t) => {
132
+ }, L = (t) => {
113
133
  if (!t) return !0;
114
- if (N && !N(t))
134
+ if (B && !B(t))
115
135
  return p?.("Custom validation failed"), !1;
116
- if (c) {
136
+ if (l) {
117
137
  const e = parseFloat(t);
118
138
  if (isNaN(e))
119
139
  return p?.("Invalid number"), !1;
120
- if (!q(e))
121
- return p?.(`Value must be ${g} ${s}`), !1;
122
- if (!A(e))
140
+ if (!z(e))
141
+ return p?.(`Value must be ${V} ${s}`), !1;
142
+ if (!G(e))
123
143
  return p?.(`Value must be ${w} ${u}`), !1;
124
144
  }
125
- return i && t.length > i ? (p?.(`Maximum length is ${i}`), !1) : !0;
145
+ return c && t.length > c ? (p?.(`Maximum length is ${c}`), !1) : !0;
126
146
  };
127
- return /* @__PURE__ */ P(
147
+ return /* @__PURE__ */ R(
128
148
  "div",
129
149
  {
130
150
  "data-component": "smart-input",
131
151
  className: "w-full",
132
- "data-numeric": c || void 0,
133
- "data-decimal-places": o,
152
+ "data-numeric": l || void 0,
153
+ "data-allow-special-characters": A || void 0,
154
+ "data-decimal-places": a,
134
155
  "data-min": s,
135
156
  "data-max": u,
136
- children: /* @__PURE__ */ P(
137
- L,
157
+ children: /* @__PURE__ */ R(
158
+ re,
138
159
  {
139
- ...k,
140
- type: S,
141
- value: a,
160
+ ...W,
161
+ type: C,
162
+ value: i,
142
163
  onChange: (t) => {
143
- if (h) return;
144
- let r = t.target.value;
145
- c ? r = C(r) : y && (r = r.replace(/^\s+/, "")), i && r.length > i && (r = r.slice(0, i)), $ || m(r), v?.(r, t);
164
+ if (S) return;
165
+ let e = y(t.target.value);
166
+ c && e.length > c && (e = e.slice(0, c)), $ || g(e), I?.(e, t);
146
167
  },
147
168
  onBlur: (t) => {
148
- let e = a;
149
- c && e && (e = Y(e), Z(e) && ($ || m(e), e !== a && v?.(e))), b?.(t);
169
+ let e = i;
170
+ l && e && (e = x(e), L(e) && ($ || g(e), e !== i && I?.(e))), T?.(t);
150
171
  },
151
- onFocus: z,
172
+ onFocus: _,
152
173
  onKeyDown: (t) => {
153
- if (h || !c) return;
174
+ if (S || !l) return;
154
175
  const e = t.key;
155
176
  if (e === "e" || e === "E") {
156
177
  t.preventDefault();
157
178
  return;
158
179
  }
159
- if (e === "-" && !D) {
180
+ if (e === "-" && !m) {
160
181
  t.preventDefault();
161
182
  return;
162
183
  }
163
- if (e === "-" && a.includes("-")) {
184
+ if (e === "-" && i.includes("-")) {
164
185
  t.preventDefault();
165
186
  return;
166
187
  }
167
- if (e === "." && (!B || a.includes("."))) {
188
+ if (e === "." && (!N || i.includes("."))) {
168
189
  t.preventDefault();
169
190
  return;
170
191
  }
171
192
  },
172
193
  onPaste: (t) => {
173
- if (h) return;
194
+ if (S) return;
174
195
  t.preventDefault();
175
- const e = t.clipboardData.getData("text"), r = c ? C(e) : e, n = t.target, f = n.selectionStart || 0, d = n.selectionEnd || 0, I = a.slice(0, f), _ = a.slice(d);
176
- let l = I + r + _;
177
- c && (l = C(l)), i && l.length > i && (l = l.slice(0, i)), $ || m(l), v?.(l);
196
+ const e = t.clipboardData.getData("text"), r = t.target, n = r.selectionStart || 0, o = r.selectionEnd || 0, f = i.slice(0, n), M = i.slice(o);
197
+ let h = y(f + e + M);
198
+ c && h.length > c && (h = h.slice(0, c)), $ || g(h), I?.(h);
178
199
  },
179
- disabled: h,
180
- ref: T
200
+ disabled: S,
201
+ ref: j
181
202
  }
182
203
  )
183
204
  }
184
205
  );
185
206
  });
186
207
  export {
187
- le as SmartInput
208
+ he as SmartInput
188
209
  };
@@ -21,6 +21,11 @@ export interface SmartInputProps extends Omit<InputProps, "onChange" | "value" |
21
21
  decimalPlaces?: number;
22
22
  enforceDecimal?: boolean;
23
23
  allowDecimal?: boolean;
24
+ /**
25
+ * When false (default), only letters, numbers, and spaces are kept.
26
+ * `email` / `password` / `url` / `tel` default to true.
27
+ */
28
+ allowSpecialCharacters?: boolean;
24
29
  maxLength?: number;
25
30
  trimLeadingSpaces?: boolean;
26
31
  customValidator?: (value: string) => boolean;
@@ -1,4 +1,4 @@
1
- import { jsx as n, jsxs as v } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
2
  import * as U from "react";
3
3
  import { createComponent as k } from "../../../lib/primitives/create-component.js";
4
4
  import { useFieldChrome as z } from "../../../lib/primitives/use-field-chrome.js";
@@ -8,11 +8,11 @@ const V = k(
8
8
  "Textarea",
9
9
  ({
10
10
  className: g,
11
- label: s,
12
- helperText: e,
11
+ label: i,
12
+ helperText: a,
13
13
  helperTextPosition: d = "absolute",
14
14
  labelOrientation: u,
15
- characterLimit: a,
15
+ characterLimit: o,
16
16
  required: b,
17
17
  isRequired: p,
18
18
  error: C,
@@ -20,28 +20,28 @@ const V = k(
20
20
  size: N,
21
21
  disabled: w,
22
22
  isDisabled: j,
23
- value: i,
23
+ value: s,
24
24
  onChange: y,
25
25
  defaultValue: l,
26
26
  id: B,
27
27
  ...S
28
28
  }, q) => {
29
- const A = b ?? p, t = C ?? h, o = w ?? j, R = !!(s || e || t || a), c = i !== void 0, [D, E] = U.useState(
29
+ const A = b ?? p, t = C ?? h, e = w ?? j, R = !!(i || a || t || o), c = s !== void 0, [D, E] = U.useState(
30
30
  () => String(l ?? "").length
31
- ), F = c ? String(i ?? "").length : D, I = (f) => {
31
+ ), F = c ? String(s ?? "").length : D, I = (f) => {
32
32
  c || E(f.target.value.length), y?.(f);
33
- }, r = z({
34
- label: s,
35
- helperText: e,
33
+ }, n = z({
34
+ label: i,
35
+ helperText: a,
36
36
  helperTextPosition: d,
37
37
  labelOrientation: u,
38
38
  error: t,
39
39
  required: A,
40
- disabled: o,
40
+ disabled: e,
41
41
  id: B,
42
- footer: e && d === "flow" || a ? /* @__PURE__ */ v("div", { className: "flex items-center justify-between gap-[6px]", children: [
43
- /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1" }),
44
- a ? /* @__PURE__ */ v(
42
+ footer: a && d === "flow" || o ? /* @__PURE__ */ v("div", { className: "flex items-center justify-between gap-[6px]", children: [
43
+ /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1" }),
44
+ o ? /* @__PURE__ */ v(
45
45
  "div",
46
46
  {
47
47
  className: "text-[12px] font-medium leading-[18px] text-navigation-muted text-right",
@@ -49,48 +49,49 @@ const V = k(
49
49
  children: [
50
50
  F,
51
51
  "/",
52
- a
52
+ o
53
53
  ]
54
54
  }
55
55
  ) : null
56
56
  ] }) : void 0,
57
57
  rootClassName: "min-w-[240px]"
58
- }), m = /* @__PURE__ */ n(
58
+ }), m = /* @__PURE__ */ r(
59
59
  "div",
60
60
  {
61
61
  className: x(
62
- e && d === "absolute" && "relative"
62
+ a && d === "absolute" && "relative"
63
63
  ),
64
- children: /* @__PURE__ */ n(
64
+ children: /* @__PURE__ */ r(
65
65
  "textarea",
66
66
  {
67
67
  className: x(
68
68
  G({
69
69
  error: !!t,
70
70
  size: N,
71
- disabled: !!o,
71
+ disabled: !!e,
72
72
  className: g
73
73
  }),
74
74
  "bg-canvas",
75
- o && "bg-disabled-surface"
75
+ e && "bg-disabled-surface"
76
76
  ),
77
77
  ref: q,
78
- disabled: !!o,
79
- value: i,
78
+ disabled: !!e,
79
+ value: s,
80
80
  defaultValue: l,
81
81
  onChange: I,
82
- id: r.controlId,
82
+ id: n.controlId,
83
83
  "data-component": "textarea",
84
84
  "data-invalid": t || void 0,
85
- "data-disabled": o || void 0,
86
- "aria-invalid": r.controlAria["aria-invalid"],
87
- "aria-describedby": r.controlAria["aria-describedby"],
88
- ...S
85
+ "data-disabled": e || void 0,
86
+ "aria-invalid": n.controlAria["aria-invalid"],
87
+ "aria-describedby": n.controlAria["aria-describedby"],
88
+ ...S,
89
+ maxLength: o
89
90
  }
90
91
  )
91
92
  }
92
93
  );
93
- return /* @__PURE__ */ n("div", { className: "flex w-full flex-col gap-[6px]", children: R ? r.wrapControl(m) : m });
94
+ return /* @__PURE__ */ r("div", { className: "flex w-full flex-col gap-[6px]", children: R ? n.wrapControl(m) : m });
94
95
  }
95
96
  );
96
97
  export {
@@ -4,6 +4,7 @@ export interface TextareaProps extends FieldControlProps {
4
4
  className?: string;
5
5
  value?: string;
6
6
  onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
7
+ /** Caps input length and shows a live `n/{characterLimit}` counter. */
7
8
  characterLimit?: number;
8
9
  /** @deprecated Use `required` */
9
10
  isRequired?: boolean;
@@ -1,23 +1,23 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
- import { useRef as y, useEffect as b } from "react";
3
- import { useWatch as V, Controller as w } from "react-hook-form";
2
+ import { useRef as w, useEffect as y } from "react";
3
+ import { useWatch as b, Controller as V } from "react-hook-form";
4
4
  import { SmartInput as x } from "../../components/forms/smart-input/smart-input.js";
5
- import { readOptionFlag as d } from "../utils/optionFlag.js";
6
- const T = ({
5
+ import { readOptionFlag as p } from "../utils/optionFlag.js";
6
+ const I = ({
7
7
  field: e,
8
8
  validationRules: u,
9
9
  isDisabled: i,
10
10
  formHelpers: r
11
11
  }) => {
12
- const a = e.fieldType === "text" ? e : null, n = a?.allowNegativeDependency, l = !!n, c = !!a?.nonNegative, p = V({
12
+ const n = e.fieldType === "text" ? e : null, o = n?.allowNegativeDependency, l = !!o, c = !!n?.nonNegative, d = b({
13
13
  control: r.form.control,
14
- name: n?.fieldId ?? "",
14
+ name: o?.fieldId ?? "",
15
15
  disabled: !l
16
- }), f = !c || l && d(
17
- r.form.getValues(n.fieldId),
18
- n.optionFlag
19
- ), s = y(!0);
20
- return b(() => {
16
+ }), f = !c || l && p(
17
+ r.form.getValues(o.fieldId),
18
+ o.optionFlag
19
+ ), s = w(!0);
20
+ return y(() => {
21
21
  if (!l) return;
22
22
  if (s.current) {
23
23
  s.current = !1;
@@ -25,8 +25,8 @@ const T = ({
25
25
  }
26
26
  const t = r.form.getValues(e.id);
27
27
  t != null && String(t).trim() !== "" && r.form.trigger(e.id);
28
- }, [l, p, e.id, r.form]), a ? /* @__PURE__ */ m(
29
- w,
28
+ }, [l, d, e.id, r.form]), n ? /* @__PURE__ */ m(
29
+ V,
30
30
  {
31
31
  name: e.id,
32
32
  control: r.form.control,
@@ -34,26 +34,26 @@ const T = ({
34
34
  ...u,
35
35
  validate: (t) => {
36
36
  if (typeof u.validate == "function") {
37
- const o = u.validate(
37
+ const a = u.validate(
38
38
  t,
39
39
  r.form.getValues()
40
40
  );
41
- if (o !== !0) return o;
41
+ if (a !== !0) return a;
42
42
  }
43
- return c && l && !d(
44
- r.form.getValues(n.fieldId),
45
- n.optionFlag
43
+ return c && l && !p(
44
+ r.form.getValues(o.fieldId),
45
+ o.optionFlag
46
46
  ) && typeof t == "string" && Number(t) < 0 ? `${e.label || "Value"} must be a non-negative number` : !0;
47
47
  }
48
48
  },
49
- render: ({ field: t, fieldState: o }) => {
50
- const g = !!o.error, h = t.value;
49
+ render: ({ field: t, fieldState: a }) => {
50
+ const g = !!a.error, h = t.value;
51
51
  return /* @__PURE__ */ m(
52
52
  x,
53
53
  {
54
54
  name: e.id,
55
55
  label: e.label,
56
- type: a.type,
56
+ type: n.type,
57
57
  value: h ?? void 0,
58
58
  onChange: (v) => t.onChange(v),
59
59
  onBlur: t.onBlur,
@@ -61,9 +61,10 @@ const T = ({
61
61
  required: e.isRequired && !i,
62
62
  disabled: i,
63
63
  error: g,
64
- helperText: g ? o?.error?.message : e?.helpText,
64
+ helperText: g ? a?.error?.message : e?.helpText,
65
65
  allowNegative: f,
66
- allowDecimal: a.allowDecimal ?? !0
66
+ allowDecimal: n.allowDecimal ?? !0,
67
+ allowSpecialCharacters: n.allowSpecialCharacters
67
68
  }
68
69
  );
69
70
  }
@@ -71,5 +72,5 @@ const T = ({
71
72
  ) : null;
72
73
  };
73
74
  export {
74
- T as TextField
75
+ I as TextField
75
76
  };
@@ -1,63 +1,62 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { Controller as x } from "react-hook-form";
3
- import { WeekRangePicker as Y } from "../../components/forms/date-picker/week-range-picker.js";
4
- import { toLocalDate as u } from "../utils/calendar-boundary.js";
5
- import { resolveWeekSelection as $ } from "../../lib/fiscal-calendar/week-selection.js";
6
- import { resolveWeekRangeMinMax as v } from "../utils/date.utils.js";
7
- const M = (r, e) => $(r, {
8
- calendarKind: e.calendarKind,
9
- fiscalMode: e.fiscalMode ?? "basic",
10
- granularity: e.granularity,
11
- fiscalMonthPattern: e.fiscalMonthPattern,
12
- fiscalYearStartMonth: e.fiscalYearStartMonth ?? 1,
13
- weekStartsOn: e.weekStartsOn ?? 1
14
- }), T = ({
15
- field: r,
16
- validationRules: e,
17
- isDisabled: D,
18
- formHelpers: l
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { Controller as Y } from "react-hook-form";
3
+ import { WeekRangePicker as $ } from "../../components/forms/date-picker/week-range-picker.js";
4
+ import { toLocalDate as f } from "../utils/calendar-boundary.js";
5
+ import { resolveWeekSelection as y } from "../../lib/fiscal-calendar/week-selection.js";
6
+ import { resolveWeekRangeMinMax as T } from "../utils/date.utils.js";
7
+ const S = (e, r) => y(e, {
8
+ calendarKind: r.calendarKind,
9
+ fiscalMode: r.fiscalMode ?? "basic",
10
+ granularity: r.granularity,
11
+ fiscalMonthPattern: r.fiscalMonthPattern,
12
+ fiscalYearStartMonth: r.fiscalYearStartMonth ?? 1,
13
+ weekStartsOn: r.weekStartsOn ?? 1
14
+ }), C = ({
15
+ field: e,
16
+ validationRules: r,
17
+ isDisabled: p,
18
+ formHelpers: d
19
19
  }) => {
20
- const t = r.fieldType === "week_range" ? r : null;
20
+ const t = e.fieldType === "week_range" ? e : null;
21
21
  if (!t) return null;
22
- const { minDate: s, maxDate: c, startMonth: S, endMonth: f } = v(t), g = l.form.control;
23
- return /* @__PURE__ */ n(
24
- x,
22
+ const { minDate: u, maxDate: m, startMonth: D, endMonth: k } = T(t), w = d.form.control;
23
+ return /* @__PURE__ */ c(
24
+ Y,
25
25
  {
26
- name: r.id,
27
- control: g,
28
- rules: e,
29
- render: ({ field: p, fieldState: i }) => {
30
- const d = !!i.error, o = p.value, h = o?.start ? u(o.start) ?? null : null, m = o?.end ? u(o.end) ?? null : null, k = h && m;
31
- return /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n(
32
- Y,
26
+ name: e.id,
27
+ control: w,
28
+ rules: r,
29
+ render: ({ field: v, fieldState: h }) => {
30
+ const g = !!h.error, a = v.value, s = a?.start ? f(a.start) ?? null : null, i = a?.end ? f(a.end) ?? null : null, F = !!(s && i);
31
+ return /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(
32
+ $,
33
33
  {
34
- label: r.label,
35
- ...k && {
36
- value: {
37
- from: M(h, t),
38
- to: M(m, t)
39
- }
40
- },
41
- onChange: (a) => {
42
- const w = a?.from?.startDate ? `${a.from.startDate.getFullYear()}-${String(a.from.startDate.getMonth() + 1).padStart(2, "0")}-${String(a.from.startDate.getDate()).padStart(2, "0")}` : null, F = a?.to?.endDate ? `${a.to.endDate.getFullYear()}-${String(a.to.endDate.getMonth() + 1).padStart(2, "0")}-${String(a.to.endDate.getDate()).padStart(2, "0")}` : null;
43
- l.setValue(r.id, { start: w, end: F });
34
+ label: e.label,
35
+ value: F && s && i ? {
36
+ from: S(s, t),
37
+ to: S(i, t)
38
+ } : void 0,
39
+ onChange: (o) => {
40
+ const M = o?.from ? { from: o.from, to: o.to ?? o.from } : void 0, n = M?.from?.startDate, l = M?.to?.endDate, P = n ? `${n.getFullYear()}-${String(n.getMonth() + 1).padStart(2, "0")}-${String(n.getDate()).padStart(2, "0")}` : null, x = l ? `${l.getFullYear()}-${String(l.getMonth() + 1).padStart(2, "0")}-${String(l.getDate()).padStart(2, "0")}` : null;
41
+ d.setValue(e.id, { start: P, end: x });
44
42
  },
45
43
  placeholder: t.placeholder,
46
- startMonth: s ?? S,
47
- endMonth: c ?? f,
48
- required: r.isRequired,
49
- disabled: D,
50
- error: d,
51
- helperText: d ? i.error?.message : r.helpText,
44
+ startMonth: u ?? D,
45
+ endMonth: m ?? k,
46
+ required: e.isRequired,
47
+ disabled: p,
48
+ error: g,
49
+ helperText: g ? h.error?.message : e.helpText,
52
50
  calendarKind: t.calendarKind,
53
51
  fiscalMode: t.fiscalMode,
54
52
  weekStartsOn: t.weekStartsOn,
55
- minDate: s,
56
- maxDate: c,
53
+ minDate: u,
54
+ maxDate: m,
57
55
  granularity: t.granularity,
58
56
  fiscalMonthPattern: t.fiscalMonthPattern,
59
57
  fiscalYearStartMonth: t.fiscalYearStartMonth,
60
58
  showFooter: t.showFooter,
59
+ showPeriodBoundaries: t.showPeriodBoundaries,
61
60
  format: t.dateFormat
62
61
  }
63
62
  ) });
@@ -66,5 +65,5 @@ const M = (r, e) => $(r, {
66
65
  );
67
66
  };
68
67
  export {
69
- T as WeekRangeField
68
+ C as WeekRangeField
70
69
  };