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.
- package/dist/components/data/data-table/column-runtime-state-guard.js +42 -42
- package/dist/components/data/data-table/data-table-column-tree-cache.d.ts +15 -0
- package/dist/components/data/data-table/data-table-column-tree-cache.js +109 -80
- package/dist/components/data/data-table/use-data-table-column-list-sync.js +65 -62
- package/dist/components/data/expandable-list-item/expandable-list-item-attributes.js +2 -3
- package/dist/components/data/expandable-list-item/expandable-list-item-metrics.js +2 -3
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.d.ts +6 -1
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +31 -23
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +2 -1
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +197 -164
- package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +3 -2
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +130 -129
- package/dist/components/data-display/calendar/calendar-fiscal-labels.js +6 -6
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.d.ts +16 -0
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +41 -0
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +20 -16
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +2 -1
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +43 -42
- package/dist/components/data-display/calendar/calendar-week-utils.d.ts +6 -0
- package/dist/components/data-display/calendar/calendar-week-utils.js +51 -47
- package/dist/components/data-display/calendar/calendar.js +102 -100
- package/dist/components/data-display/calendar/calendar.types.d.ts +2 -0
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +4 -2
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +77 -72
- package/dist/components/data-display/calendar/use-fiscal-calendar.js +16 -15
- package/dist/components/feedback/dialog/dialog.js +12 -12
- package/dist/components/feedback/sheet/sheet.js +22 -22
- package/dist/components/feedback/tooltip/tab-tooltip-render.js +2 -3
- package/dist/components/flows/command-palette/shortcut-settings.js +10 -10
- package/dist/components/flows/filter-panel/filter-panel.js +4 -4
- package/dist/components/forms/date-picker/calendar-selection-adapters.d.ts +2 -0
- package/dist/components/forms/date-picker/calendar-selection-adapters.js +36 -31
- package/dist/components/forms/date-picker/date-input-behavior.d.ts +10 -0
- package/dist/components/forms/date-picker/date-input-behavior.js +111 -90
- package/dist/components/forms/date-picker/date-picker.js +71 -69
- package/dist/components/forms/date-picker/date-picker.types.d.ts +2 -0
- package/dist/components/forms/date-picker/date-range-picker.js +146 -144
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +1 -0
- package/dist/components/forms/date-picker/fiscal-pass-through.js +1 -0
- package/dist/components/forms/date-picker/month-picker.js +82 -80
- package/dist/components/forms/date-picker/month-range-picker.js +145 -143
- package/dist/components/forms/date-picker/multi-date-picker.js +51 -49
- package/dist/components/forms/date-picker/multi-month-picker.js +49 -47
- package/dist/components/forms/date-picker/multi-quarter-picker.js +46 -44
- package/dist/components/forms/date-picker/multi-week-picker.js +53 -51
- package/dist/components/forms/date-picker/multi-year-picker.js +48 -46
- package/dist/components/forms/date-picker/picker-story-layout.d.ts +2 -0
- package/dist/components/forms/date-picker/quarter-picker.js +46 -44
- package/dist/components/forms/date-picker/quarter-range-picker.js +45 -43
- package/dist/components/forms/date-picker/week-picker.js +82 -80
- package/dist/components/forms/date-picker/week-range-picker.js +169 -164
- package/dist/components/forms/date-picker/year-picker.js +47 -45
- package/dist/components/forms/date-picker/year-range-picker.js +47 -45
- package/dist/components/forms/select/components/SelectMenuPanel.js +3 -2
- package/dist/components/forms/select/components/SelectTriggerValue.js +2 -3
- package/dist/components/forms/select/components/Submenu.js +2 -3
- package/dist/components/forms/select/select.js +1 -0
- package/dist/components/forms/smart-input/smart-input.js +106 -85
- package/dist/components/forms/smart-input/smart-input.types.d.ts +5 -0
- package/dist/components/forms/textarea/textarea.js +29 -28
- package/dist/components/forms/textarea/textarea.types.d.ts +1 -0
- package/dist/form-react/Fields/TextField.js +25 -24
- package/dist/form-react/Fields/WeekRangePicker.js +47 -48
- package/dist/form-react/types/fields.types.d.ts +8 -0
- package/dist/impact-nova.css +1 -1
- package/dist/lib/fiscal-calendar/civil-date.js +18 -18
- package/dist/lib/overlay/overlay-portal-context.js +16 -16
- package/dist/llms/rules/best-practices.js +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +1 -1
|
@@ -1,34 +1,50 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createComponent as
|
|
4
|
-
import { Input as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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:
|
|
15
|
-
maxOperator:
|
|
16
|
-
min_operator:
|
|
17
|
-
max_operator:
|
|
18
|
-
maxIntegerDigits:
|
|
19
|
-
decimalPlaces:
|
|
20
|
-
enforceDecimal:
|
|
21
|
-
allowDecimal:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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:
|
|
27
|
-
...
|
|
28
|
-
},
|
|
29
|
-
const $ =
|
|
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 (
|
|
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
|
-
},
|
|
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
|
-
},
|
|
73
|
+
}, H = (t) => {
|
|
58
74
|
let e = t;
|
|
59
75
|
if (s !== void 0) {
|
|
60
|
-
const r =
|
|
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
|
-
},
|
|
69
|
-
const e =
|
|
84
|
+
}, Q = (t) => {
|
|
85
|
+
const e = m ? /[^0-9.-]/g : /[^0-9.]/g;
|
|
70
86
|
return t.replace(e, "");
|
|
71
|
-
},
|
|
87
|
+
}, Y = (t) => {
|
|
72
88
|
const e = t.split(".");
|
|
73
89
|
return e.length > 2 ? e[0] + "." + e.slice(1).join("") : t;
|
|
74
|
-
},
|
|
75
|
-
if (!
|
|
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
|
-
},
|
|
83
|
-
if (
|
|
98
|
+
}, J = (t) => {
|
|
99
|
+
if (a === void 0 || !t.includes(".")) return t;
|
|
84
100
|
const [e, r] = t.split(".");
|
|
85
|
-
return r && r.length >
|
|
101
|
+
return r && r.length > a ? `${e}.${r.slice(0, a)}` : t;
|
|
86
102
|
}, X = (t) => {
|
|
87
|
-
if (
|
|
103
|
+
if (D === void 0) return t;
|
|
88
104
|
const [e, r] = t.split("."), n = e.replace("-", "");
|
|
89
|
-
if (n.length >
|
|
90
|
-
const
|
|
91
|
-
return r !== void 0 ? `${
|
|
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
|
-
},
|
|
95
|
-
if (!
|
|
110
|
+
}, Z = (t) => {
|
|
111
|
+
if (!l) return t;
|
|
96
112
|
let e = String(t ?? "");
|
|
97
|
-
return
|
|
98
|
-
},
|
|
99
|
-
if (
|
|
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 =
|
|
104
|
-
if (
|
|
105
|
-
e = n.toFixed(
|
|
106
|
-
else if (
|
|
107
|
-
const [
|
|
108
|
-
e = `${
|
|
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
|
-
},
|
|
132
|
+
}, L = (t) => {
|
|
113
133
|
if (!t) return !0;
|
|
114
|
-
if (
|
|
134
|
+
if (B && !B(t))
|
|
115
135
|
return p?.("Custom validation failed"), !1;
|
|
116
|
-
if (
|
|
136
|
+
if (l) {
|
|
117
137
|
const e = parseFloat(t);
|
|
118
138
|
if (isNaN(e))
|
|
119
139
|
return p?.("Invalid number"), !1;
|
|
120
|
-
if (!
|
|
121
|
-
return p?.(`Value must be ${
|
|
122
|
-
if (!
|
|
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
|
|
145
|
+
return c && t.length > c ? (p?.(`Maximum length is ${c}`), !1) : !0;
|
|
126
146
|
};
|
|
127
|
-
return /* @__PURE__ */
|
|
147
|
+
return /* @__PURE__ */ R(
|
|
128
148
|
"div",
|
|
129
149
|
{
|
|
130
150
|
"data-component": "smart-input",
|
|
131
151
|
className: "w-full",
|
|
132
|
-
"data-numeric":
|
|
133
|
-
"data-
|
|
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__ */
|
|
137
|
-
|
|
157
|
+
children: /* @__PURE__ */ R(
|
|
158
|
+
re,
|
|
138
159
|
{
|
|
139
|
-
...
|
|
140
|
-
type:
|
|
141
|
-
value:
|
|
160
|
+
...W,
|
|
161
|
+
type: C,
|
|
162
|
+
value: i,
|
|
142
163
|
onChange: (t) => {
|
|
143
|
-
if (
|
|
144
|
-
let
|
|
145
|
-
c
|
|
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 =
|
|
149
|
-
|
|
169
|
+
let e = i;
|
|
170
|
+
l && e && (e = x(e), L(e) && ($ || g(e), e !== i && I?.(e))), T?.(t);
|
|
150
171
|
},
|
|
151
|
-
onFocus:
|
|
172
|
+
onFocus: _,
|
|
152
173
|
onKeyDown: (t) => {
|
|
153
|
-
if (
|
|
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 === "-" && !
|
|
180
|
+
if (e === "-" && !m) {
|
|
160
181
|
t.preventDefault();
|
|
161
182
|
return;
|
|
162
183
|
}
|
|
163
|
-
if (e === "-" &&
|
|
184
|
+
if (e === "-" && i.includes("-")) {
|
|
164
185
|
t.preventDefault();
|
|
165
186
|
return;
|
|
166
187
|
}
|
|
167
|
-
if (e === "." && (!
|
|
188
|
+
if (e === "." && (!N || i.includes("."))) {
|
|
168
189
|
t.preventDefault();
|
|
169
190
|
return;
|
|
170
191
|
}
|
|
171
192
|
},
|
|
172
193
|
onPaste: (t) => {
|
|
173
|
-
if (
|
|
194
|
+
if (S) return;
|
|
174
195
|
t.preventDefault();
|
|
175
|
-
const e = t.clipboardData.getData("text"), r =
|
|
176
|
-
let
|
|
177
|
-
c &&
|
|
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:
|
|
180
|
-
ref:
|
|
200
|
+
disabled: S,
|
|
201
|
+
ref: j
|
|
181
202
|
}
|
|
182
203
|
)
|
|
183
204
|
}
|
|
184
205
|
);
|
|
185
206
|
});
|
|
186
207
|
export {
|
|
187
|
-
|
|
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
|
|
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:
|
|
12
|
-
helperText:
|
|
11
|
+
label: i,
|
|
12
|
+
helperText: a,
|
|
13
13
|
helperTextPosition: d = "absolute",
|
|
14
14
|
labelOrientation: u,
|
|
15
|
-
characterLimit:
|
|
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:
|
|
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,
|
|
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(
|
|
31
|
+
), F = c ? String(s ?? "").length : D, I = (f) => {
|
|
32
32
|
c || E(f.target.value.length), y?.(f);
|
|
33
|
-
},
|
|
34
|
-
label:
|
|
35
|
-
helperText:
|
|
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:
|
|
40
|
+
disabled: e,
|
|
41
41
|
id: B,
|
|
42
|
-
footer:
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
|
|
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
|
-
|
|
52
|
+
o
|
|
53
53
|
]
|
|
54
54
|
}
|
|
55
55
|
) : null
|
|
56
56
|
] }) : void 0,
|
|
57
57
|
rootClassName: "min-w-[240px]"
|
|
58
|
-
}), m = /* @__PURE__ */
|
|
58
|
+
}), m = /* @__PURE__ */ r(
|
|
59
59
|
"div",
|
|
60
60
|
{
|
|
61
61
|
className: x(
|
|
62
|
-
|
|
62
|
+
a && d === "absolute" && "relative"
|
|
63
63
|
),
|
|
64
|
-
children: /* @__PURE__ */
|
|
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: !!
|
|
71
|
+
disabled: !!e,
|
|
72
72
|
className: g
|
|
73
73
|
}),
|
|
74
74
|
"bg-canvas",
|
|
75
|
-
|
|
75
|
+
e && "bg-disabled-surface"
|
|
76
76
|
),
|
|
77
77
|
ref: q,
|
|
78
|
-
disabled: !!
|
|
79
|
-
value:
|
|
78
|
+
disabled: !!e,
|
|
79
|
+
value: s,
|
|
80
80
|
defaultValue: l,
|
|
81
81
|
onChange: I,
|
|
82
|
-
id:
|
|
82
|
+
id: n.controlId,
|
|
83
83
|
"data-component": "textarea",
|
|
84
84
|
"data-invalid": t || void 0,
|
|
85
|
-
"data-disabled":
|
|
86
|
-
"aria-invalid":
|
|
87
|
-
"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__ */
|
|
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
|
|
3
|
-
import { useWatch as
|
|
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
|
|
6
|
-
const
|
|
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
|
|
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:
|
|
14
|
+
name: o?.fieldId ?? "",
|
|
15
15
|
disabled: !l
|
|
16
|
-
}), f = !c || l &&
|
|
17
|
-
r.form.getValues(
|
|
18
|
-
|
|
19
|
-
), s =
|
|
20
|
-
return
|
|
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,
|
|
29
|
-
|
|
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
|
|
37
|
+
const a = u.validate(
|
|
38
38
|
t,
|
|
39
39
|
r.form.getValues()
|
|
40
40
|
);
|
|
41
|
-
if (
|
|
41
|
+
if (a !== !0) return a;
|
|
42
42
|
}
|
|
43
|
-
return c && l && !
|
|
44
|
-
r.form.getValues(
|
|
45
|
-
|
|
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:
|
|
50
|
-
const g = !!
|
|
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:
|
|
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 ?
|
|
64
|
+
helperText: g ? a?.error?.message : e?.helpText,
|
|
65
65
|
allowNegative: f,
|
|
66
|
-
allowDecimal:
|
|
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
|
-
|
|
75
|
+
I as TextField
|
|
75
76
|
};
|
|
@@ -1,63 +1,62 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Controller as
|
|
3
|
-
import { WeekRangePicker as
|
|
4
|
-
import { toLocalDate as
|
|
5
|
-
import { resolveWeekSelection as
|
|
6
|
-
import { resolveWeekRangeMinMax as
|
|
7
|
-
const
|
|
8
|
-
calendarKind:
|
|
9
|
-
fiscalMode:
|
|
10
|
-
granularity:
|
|
11
|
-
fiscalMonthPattern:
|
|
12
|
-
fiscalYearStartMonth:
|
|
13
|
-
weekStartsOn:
|
|
14
|
-
}),
|
|
15
|
-
field:
|
|
16
|
-
validationRules:
|
|
17
|
-
isDisabled:
|
|
18
|
-
formHelpers:
|
|
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 =
|
|
20
|
+
const t = e.fieldType === "week_range" ? e : null;
|
|
21
21
|
if (!t) return null;
|
|
22
|
-
const { minDate:
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
|
|
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:
|
|
27
|
-
control:
|
|
28
|
-
rules:
|
|
29
|
-
render: ({ field:
|
|
30
|
-
const
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
|
|
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:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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:
|
|
47
|
-
endMonth:
|
|
48
|
-
required:
|
|
49
|
-
disabled:
|
|
50
|
-
error:
|
|
51
|
-
helperText:
|
|
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:
|
|
56
|
-
maxDate:
|
|
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
|
-
|
|
68
|
+
C as WeekRangeField
|
|
70
69
|
};
|