impact-nova 2.5.8 → 2.5.9
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-display/calendar/calendar-day-picker-components.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/use-fiscal-calendar.js +16 -15
- 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/types/fields.types.d.ts +6 -0
- package/dist/lib/fiscal-calendar/civil-date.js +18 -18
- 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
|
};
|
|
@@ -287,6 +287,12 @@ export type TextField = BaseField & {
|
|
|
287
287
|
defaultValue?: string | number;
|
|
288
288
|
nonNegative?: boolean;
|
|
289
289
|
allowDecimal?: boolean;
|
|
290
|
+
/**
|
|
291
|
+
* When false (default), only letters, numbers, and spaces are kept.
|
|
292
|
+
* Set true to allow punctuation and symbols. `email` / `password` /
|
|
293
|
+
* `url` / `tel` types allow special characters unless this is false.
|
|
294
|
+
*/
|
|
295
|
+
allowSpecialCharacters?: boolean;
|
|
290
296
|
/**
|
|
291
297
|
* Reactively override `nonNegative` based on a flag on the currently
|
|
292
298
|
* selected option of another (select) field. Only meaningful when
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
const n =
|
|
1
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
2
|
+
function e(t) {
|
|
3
|
+
const n = m.exec(t);
|
|
4
4
|
if (!n)
|
|
5
5
|
throw new Error(`Invalid civil date: ${t}`);
|
|
6
6
|
const o = Number(n[1]), r = Number(n[2]), a = Number(n[3]);
|
|
@@ -12,19 +12,19 @@ function l(t, n, o) {
|
|
|
12
12
|
return `${String(t).padStart(4, "0")}-${String(n).padStart(2, "0")}-${String(o).padStart(2, "0")}`;
|
|
13
13
|
}
|
|
14
14
|
function u(t, n, o) {
|
|
15
|
-
const r = Math.floor((14 - n) / 12), a = t + 4800 - r,
|
|
16
|
-
return o + Math.floor((153 *
|
|
15
|
+
const r = Math.floor((14 - n) / 12), a = t + 4800 - r, c = n + 12 * r - 3;
|
|
16
|
+
return o + Math.floor((153 * c + 2) / 5) + 365 * a + Math.floor(a / 4) - Math.floor(a / 100) + Math.floor(a / 400) - 32045;
|
|
17
17
|
}
|
|
18
18
|
function y(t) {
|
|
19
|
-
const n = t + 32044, o = Math.floor((4 * n + 3) / 146097), r = n - Math.floor(146097 * o / 4), a = Math.floor((4 * r + 3) / 1461),
|
|
20
|
-
return { y: 100 * o + a - 4800 + Math.floor(
|
|
19
|
+
const n = t + 32044, o = Math.floor((4 * n + 3) / 146097), r = n - Math.floor(146097 * o / 4), a = Math.floor((4 * r + 3) / 1461), c = r - Math.floor(1461 * a / 4), i = Math.floor((5 * c + 2) / 153), d = c - Math.floor((153 * i + 2) / 5) + 1, h = i + 3 - 12 * Math.floor(i / 10);
|
|
20
|
+
return { y: 100 * o + a - 4800 + Math.floor(i / 10), m: h, d };
|
|
21
21
|
}
|
|
22
22
|
function M(t, n) {
|
|
23
|
-
const { y: o, m: r, d: a } =
|
|
24
|
-
return l(
|
|
23
|
+
const { y: o, m: r, d: a } = e(t), c = y(u(o, r, a) + n);
|
|
24
|
+
return l(c.y, c.m, c.d);
|
|
25
25
|
}
|
|
26
26
|
function D(t, n) {
|
|
27
|
-
const o =
|
|
27
|
+
const o = e(t), r = e(n);
|
|
28
28
|
return u(o.y, o.m, o.d) - u(r.y, r.m, r.d);
|
|
29
29
|
}
|
|
30
30
|
function s(t, n) {
|
|
@@ -37,8 +37,8 @@ function S(t, n) {
|
|
|
37
37
|
return s(t, n) >= 0 ? t : n;
|
|
38
38
|
}
|
|
39
39
|
function $(t) {
|
|
40
|
-
const { y: n, m: o, d: r } =
|
|
41
|
-
return (
|
|
40
|
+
const { y: n, m: o, d: r } = e(t), a = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4], c = o < 3 ? n - 1 : n;
|
|
41
|
+
return (c + Math.floor(c / 4) - Math.floor(c / 100) + Math.floor(c / 400) + a[o - 1] + r) % 7;
|
|
42
42
|
}
|
|
43
43
|
function C(t, n) {
|
|
44
44
|
const r = ($(t) + 7 - n) % 7;
|
|
@@ -54,10 +54,10 @@ function I(t) {
|
|
|
54
54
|
return l(t.getFullYear(), t.getMonth() + 1, t.getDate());
|
|
55
55
|
}
|
|
56
56
|
function J(t) {
|
|
57
|
-
const { y: n, m: o, d: r } =
|
|
57
|
+
const { y: n, m: o, d: r } = e(t);
|
|
58
58
|
return new Date(n, o - 1, r);
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const f = [
|
|
61
61
|
"Jan",
|
|
62
62
|
"Feb",
|
|
63
63
|
"Mar",
|
|
@@ -72,11 +72,11 @@ const i = [
|
|
|
72
72
|
"Dec"
|
|
73
73
|
];
|
|
74
74
|
function N(t, n) {
|
|
75
|
-
const o =
|
|
76
|
-
return o.y === r.y
|
|
75
|
+
const o = e(t), r = e(n);
|
|
76
|
+
return o.y === r.y ? `${f[o.m - 1]} ${o.d} – ${f[r.m - 1]} ${r.d}` : `${f[o.m - 1]} ${o.d} ${o.y} – ${f[r.m - 1]} ${r.d} ${r.y}`;
|
|
77
77
|
}
|
|
78
78
|
export {
|
|
79
|
-
|
|
79
|
+
f as MONTH_SHORT,
|
|
80
80
|
M as addDays,
|
|
81
81
|
I as civilFromLocalDate,
|
|
82
82
|
s as compareCivil,
|
|
@@ -87,7 +87,7 @@ export {
|
|
|
87
87
|
J as localDateFromCivil,
|
|
88
88
|
S as maxCivil,
|
|
89
89
|
g as minCivil,
|
|
90
|
-
|
|
90
|
+
e as parseCivilDate,
|
|
91
91
|
l as toCivilDate,
|
|
92
92
|
C as weekStart,
|
|
93
93
|
$ as weekday
|