@plitzi/sdk-elements 0.35.1 → 0.35.3
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/CHANGELOG.md +67 -0
- package/dist/Element/hooks/useElementDataSource.mjs +18 -14
- package/dist/dataSource/GlobalSources.mjs +75 -61
- package/dist/elements/basic/Button/Button.d.ts +10 -1
- package/dist/elements/basic/Button/Button.mjs +7 -5
- package/dist/elements/basic/Button/declaration.d.ts +2 -0
- package/dist/elements/basic/Button/index.d.ts +2 -0
- package/dist/elements/declarations/index.d.ts +8 -0
- package/dist/elements/form/Form/Form.d.ts +9 -1
- package/dist/elements/form/Form/Form.mjs +79 -78
- package/dist/elements/form/Form/Settings.d.ts +2 -1
- package/dist/elements/form/Form/Settings.mjs +12 -6
- package/dist/elements/form/Form/declaration.d.ts +2 -0
- package/dist/elements/form/Form/declaration.mjs +1 -0
- package/dist/elements/form/Form/index.d.ts +2 -0
- package/dist/elements/form/FormControl/FormControl.d.ts +9 -1
- package/dist/elements/form/FormControl/FormControl.mjs +1 -0
- package/dist/elements/form/FormControl/Settings.d.ts +6 -2
- package/dist/elements/form/FormControl/Settings.mjs +106 -77
- package/dist/elements/form/FormControl/declaration.d.ts +4 -0
- package/dist/elements/form/FormControl/declaration.mjs +4 -0
- package/dist/elements/form/FormControl/helpers/validateField.d.ts +14 -0
- package/dist/elements/form/FormControl/helpers/validateField.mjs +13 -7
- package/dist/elements/form/FormControl/hocs/withFieldValue.d.ts +5 -1
- package/dist/elements/form/FormControl/hocs/withFieldValue.mjs +49 -39
- package/dist/elements/form/FormControl/index.d.ts +4 -0
- package/dist/index.d.ts +8 -0
- package/package.json +8 -8
|
@@ -1,174 +1,203 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import i from "
|
|
4
|
-
import a from "@plitzi/plitzi-ui/
|
|
5
|
-
import o from "@plitzi/plitzi-ui/
|
|
6
|
-
import s from "@plitzi/plitzi-ui/
|
|
1
|
+
import { hasFormat as e } from "./helpers/validateField.mjs";
|
|
2
|
+
import { useCallback as t, useMemo as n } from "react";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
import a from "@plitzi/plitzi-ui/Checkbox";
|
|
5
|
+
import o from "@plitzi/plitzi-ui/Input";
|
|
6
|
+
import s from "@plitzi/plitzi-ui/TextArea";
|
|
7
|
+
import c from "@plitzi/plitzi-ui/Select";
|
|
7
8
|
//#region src/elements/form/FormControl/Settings.tsx
|
|
8
|
-
var
|
|
9
|
+
var l = (e) => {
|
|
9
10
|
let t = parseInt(e, 10);
|
|
10
11
|
return Number.isNaN(t) || t < 0 ? 0 : t;
|
|
11
|
-
},
|
|
12
|
-
let
|
|
12
|
+
}, u = ({ subType: u = "text", name: d = "", label: f = "Label", defaultValue: p = "", placeholder: m = "", autoComplete: h = !0, options: g, required: _ = !0, requiredMessage: v = "", minLength: y = 0, minLengthMessage: b = "", maxLength: x = 0, maxLengthMessage: S = "", formatMessage: C = "", pattern: w = "", patternMessage: T = "", matches: E = "", matchesMessage: D = "", readOnly: O = !1, disabled: k = !1, previewError: A = !1, onUpdate: j }) => {
|
|
13
|
+
let M = [
|
|
13
14
|
"text",
|
|
14
15
|
"textarea",
|
|
15
16
|
"number",
|
|
16
17
|
"email",
|
|
17
18
|
"password"
|
|
18
|
-
].includes(
|
|
19
|
-
|
|
20
|
-
}, [
|
|
19
|
+
].includes(u), N = t((e) => j?.("name", e), [j]), ee = t((e) => j?.("label", e), [j]), P = t((e) => j?.("placeholder", e), [j]), F = t((e) => {
|
|
20
|
+
j?.("subType", e), j?.("defaultValue", "");
|
|
21
|
+
}, [j]), I = t((e) => j?.("defaultValue", e), [j]), L = t((e) => j?.("autoComplete", e.target.checked), [j]), R = t((e) => j?.("required", e.target.checked), [j]), z = t((e) => j?.("requiredMessage", e), [j]), B = t((e) => j?.("minLength", l(e)), [j]), V = t((e) => j?.("minLengthMessage", e), [j]), H = t((e) => j?.("maxLength", l(e)), [j]), U = t((e) => j?.("maxLengthMessage", e), [j]), W = t((e) => j?.("formatMessage", e), [j]), G = t((e) => j?.("pattern", e), [j]), K = t((e) => j?.("patternMessage", e), [j]), q = t((e) => j?.("matches", e), [j]), J = t((e) => j?.("matchesMessage", e), [j]), Y = t((e) => j?.("readOnly", e.target.checked), [j]), X = t((e) => j?.("disabled", e.target.checked), [j]), Z = t((e) => j?.("previewError", e.target.checked), [j]), Q = t((e) => {
|
|
21
22
|
if (!e) {
|
|
22
|
-
|
|
23
|
+
j?.("options", []);
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
return /* @__PURE__ */
|
|
26
|
+
j?.("options", e.split("\n"));
|
|
27
|
+
}, [j]), $ = n(() => Array.isArray(g) ? g.join("\n") : "", [g]);
|
|
28
|
+
return /* @__PURE__ */ i("div", {
|
|
28
29
|
className: "flex h-full flex-col gap-4 py-2",
|
|
29
30
|
children: [
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
value:
|
|
31
|
+
/* @__PURE__ */ r(o, {
|
|
32
|
+
value: d,
|
|
32
33
|
label: "Input Name",
|
|
33
|
-
onChange:
|
|
34
|
+
onChange: N,
|
|
34
35
|
size: "xs"
|
|
35
36
|
}),
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
value:
|
|
37
|
+
/* @__PURE__ */ r(o, {
|
|
38
|
+
value: f,
|
|
38
39
|
label: "Label",
|
|
39
|
-
onChange:
|
|
40
|
+
onChange: ee,
|
|
40
41
|
size: "xs"
|
|
41
42
|
}),
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
value:
|
|
43
|
+
/* @__PURE__ */ r(o, {
|
|
44
|
+
value: m,
|
|
44
45
|
label: "Placeholder",
|
|
45
|
-
onChange:
|
|
46
|
+
onChange: P,
|
|
46
47
|
size: "xs"
|
|
47
48
|
}),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
value:
|
|
50
|
-
onChange:
|
|
49
|
+
/* @__PURE__ */ i(c, {
|
|
50
|
+
value: u,
|
|
51
|
+
onChange: F,
|
|
51
52
|
label: "Input Type",
|
|
52
53
|
size: "xs",
|
|
53
54
|
children: [
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ r("option", {
|
|
55
56
|
value: "text",
|
|
56
57
|
children: "Text"
|
|
57
58
|
}),
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ r("option", {
|
|
59
60
|
value: "number",
|
|
60
61
|
children: "Number"
|
|
61
62
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ r("option", {
|
|
64
|
+
value: "date",
|
|
65
|
+
children: "Date"
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ r("option", {
|
|
63
68
|
value: "time",
|
|
64
69
|
children: "Time"
|
|
65
70
|
}),
|
|
66
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ r("option", {
|
|
67
72
|
value: "email",
|
|
68
73
|
children: "Email"
|
|
69
74
|
}),
|
|
70
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ r("option", {
|
|
71
76
|
value: "password",
|
|
72
77
|
children: "Password"
|
|
73
78
|
}),
|
|
74
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ r("option", {
|
|
75
80
|
value: "select",
|
|
76
81
|
children: "Select"
|
|
77
82
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ r("option", {
|
|
79
84
|
value: "checkbox",
|
|
80
85
|
children: "Checkbox"
|
|
81
86
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ r("option", {
|
|
83
88
|
value: "textarea",
|
|
84
89
|
children: "Long Text"
|
|
85
90
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ r("option", {
|
|
87
92
|
value: "hidden",
|
|
88
93
|
children: "Hidden"
|
|
89
94
|
})
|
|
90
95
|
]
|
|
91
96
|
}),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
value:
|
|
97
|
+
/* @__PURE__ */ r(s, {
|
|
98
|
+
value: p,
|
|
94
99
|
label: "Default Value",
|
|
95
|
-
onChange:
|
|
100
|
+
onChange: I,
|
|
96
101
|
size: "xs"
|
|
97
102
|
}),
|
|
98
|
-
|
|
99
|
-
checked:
|
|
103
|
+
u === "text" && /* @__PURE__ */ r(a, {
|
|
104
|
+
checked: h,
|
|
100
105
|
label: "Auto Complete",
|
|
101
|
-
onChange:
|
|
106
|
+
onChange: L,
|
|
102
107
|
size: "xs"
|
|
103
108
|
}),
|
|
104
|
-
|
|
105
|
-
checked:
|
|
109
|
+
M && /* @__PURE__ */ r(a, {
|
|
110
|
+
checked: O,
|
|
106
111
|
label: "Read Only",
|
|
107
|
-
onChange:
|
|
112
|
+
onChange: Y,
|
|
108
113
|
size: "xs"
|
|
109
114
|
}),
|
|
110
|
-
|
|
111
|
-
value:
|
|
115
|
+
u === "select" && /* @__PURE__ */ r(s, {
|
|
116
|
+
value: $,
|
|
112
117
|
label: "Options",
|
|
113
|
-
onChange:
|
|
118
|
+
onChange: Q,
|
|
114
119
|
size: "xs"
|
|
115
120
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
checked:
|
|
121
|
+
/* @__PURE__ */ r(a, {
|
|
122
|
+
checked: _,
|
|
118
123
|
label: "Required",
|
|
119
|
-
onChange:
|
|
124
|
+
onChange: R,
|
|
125
|
+
size: "xs"
|
|
126
|
+
}),
|
|
127
|
+
_ && /* @__PURE__ */ r(o, {
|
|
128
|
+
value: v,
|
|
129
|
+
label: "Required Message",
|
|
130
|
+
onChange: z,
|
|
120
131
|
size: "xs"
|
|
121
132
|
}),
|
|
122
|
-
|
|
123
|
-
value:
|
|
133
|
+
M && /* @__PURE__ */ r(o, {
|
|
134
|
+
value: y ? String(y) : "",
|
|
124
135
|
label: "Min Length",
|
|
125
|
-
onChange:
|
|
136
|
+
onChange: B,
|
|
137
|
+
size: "xs"
|
|
138
|
+
}),
|
|
139
|
+
M && y > 0 && /* @__PURE__ */ r(o, {
|
|
140
|
+
value: b,
|
|
141
|
+
label: "Min Length Message",
|
|
142
|
+
onChange: V,
|
|
126
143
|
size: "xs"
|
|
127
144
|
}),
|
|
128
|
-
|
|
129
|
-
value:
|
|
145
|
+
M && /* @__PURE__ */ r(o, {
|
|
146
|
+
value: x ? String(x) : "",
|
|
130
147
|
label: "Max Length",
|
|
131
|
-
onChange:
|
|
148
|
+
onChange: H,
|
|
149
|
+
size: "xs"
|
|
150
|
+
}),
|
|
151
|
+
M && x > 0 && /* @__PURE__ */ r(o, {
|
|
152
|
+
value: S,
|
|
153
|
+
label: "Max Length Message",
|
|
154
|
+
onChange: U,
|
|
132
155
|
size: "xs"
|
|
133
156
|
}),
|
|
134
|
-
|
|
135
|
-
value:
|
|
157
|
+
e(u) && /* @__PURE__ */ r(o, {
|
|
158
|
+
value: C,
|
|
159
|
+
label: "Invalid Format Message",
|
|
160
|
+
onChange: W,
|
|
161
|
+
size: "xs"
|
|
162
|
+
}),
|
|
163
|
+
M && /* @__PURE__ */ r(o, {
|
|
164
|
+
value: w,
|
|
136
165
|
label: "Pattern (regular expression)",
|
|
137
|
-
onChange:
|
|
166
|
+
onChange: G,
|
|
138
167
|
size: "xs"
|
|
139
168
|
}),
|
|
140
|
-
|
|
141
|
-
value:
|
|
169
|
+
M && w && /* @__PURE__ */ r(o, {
|
|
170
|
+
value: T,
|
|
142
171
|
label: "Pattern Message",
|
|
143
|
-
onChange:
|
|
172
|
+
onChange: K,
|
|
144
173
|
size: "xs"
|
|
145
174
|
}),
|
|
146
|
-
|
|
147
|
-
value:
|
|
175
|
+
M && /* @__PURE__ */ r(o, {
|
|
176
|
+
value: E,
|
|
148
177
|
label: "Must Match Field",
|
|
149
|
-
onChange:
|
|
178
|
+
onChange: q,
|
|
150
179
|
size: "xs"
|
|
151
180
|
}),
|
|
152
|
-
|
|
153
|
-
value:
|
|
181
|
+
M && E && /* @__PURE__ */ r(o, {
|
|
182
|
+
value: D,
|
|
154
183
|
label: "Mismatch Message",
|
|
155
|
-
onChange:
|
|
184
|
+
onChange: J,
|
|
156
185
|
size: "xs"
|
|
157
186
|
}),
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
checked:
|
|
187
|
+
/* @__PURE__ */ r(a, {
|
|
188
|
+
checked: k,
|
|
160
189
|
label: "Disabled",
|
|
161
|
-
onChange:
|
|
190
|
+
onChange: X,
|
|
162
191
|
size: "xs"
|
|
163
192
|
}),
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
checked:
|
|
193
|
+
/* @__PURE__ */ r(a, {
|
|
194
|
+
checked: A,
|
|
166
195
|
label: "Preview Error Message",
|
|
167
|
-
onChange:
|
|
196
|
+
onChange: Z,
|
|
168
197
|
size: "xs"
|
|
169
198
|
})
|
|
170
199
|
]
|
|
171
200
|
});
|
|
172
201
|
};
|
|
173
202
|
//#endregion
|
|
174
|
-
export {
|
|
203
|
+
export { u as default };
|
|
@@ -17,8 +17,12 @@ declare const declaration: {
|
|
|
17
17
|
readonly disabled: false;
|
|
18
18
|
readonly options: readonly [];
|
|
19
19
|
readonly required: true;
|
|
20
|
+
readonly requiredMessage: "";
|
|
20
21
|
readonly minLength: 0;
|
|
22
|
+
readonly minLengthMessage: "";
|
|
21
23
|
readonly maxLength: 0;
|
|
24
|
+
readonly maxLengthMessage: "";
|
|
25
|
+
readonly formatMessage: "";
|
|
22
26
|
readonly pattern: "";
|
|
23
27
|
readonly patternMessage: "";
|
|
24
28
|
readonly matches: "";
|
|
@@ -2,11 +2,23 @@
|
|
|
2
2
|
* What a control asks of its value before the form around it may submit.
|
|
3
3
|
*
|
|
4
4
|
* Zero and the empty string mean "no rule", so a control authored before these existed validates exactly as it did.
|
|
5
|
+
* Every rule carries the sentence it says when broken, and an empty one falls back to English: the site's language is
|
|
6
|
+
* the author's to write, never the browser's to guess.
|
|
5
7
|
*/
|
|
6
8
|
export type FieldRules = {
|
|
7
9
|
required: boolean;
|
|
10
|
+
requiredMessage: string;
|
|
8
11
|
minLength: number;
|
|
12
|
+
minLengthMessage: string;
|
|
9
13
|
maxLength: number;
|
|
14
|
+
maxLengthMessage: string;
|
|
15
|
+
/**
|
|
16
|
+
* The control's `subType`. A type whose value has a shape of its own (see `FORMATS`) is checked against it here,
|
|
17
|
+
* because a form with `noValidate` leaves nobody else to ask for it.
|
|
18
|
+
*/
|
|
19
|
+
type: string;
|
|
20
|
+
/** Said when the value does not have the shape its type asks for, whichever type that is. */
|
|
21
|
+
formatMessage: string;
|
|
10
22
|
/** A regular expression the WHOLE value must match — anchored here, so an author never has to remember `^…$`. */
|
|
11
23
|
pattern: string;
|
|
12
24
|
patternMessage: string;
|
|
@@ -15,6 +27,8 @@ export type FieldRules = {
|
|
|
15
27
|
matchesMessage: string;
|
|
16
28
|
};
|
|
17
29
|
export declare const REQUIRED_MESSAGE = "This field is required";
|
|
30
|
+
/** Whether a control of this type asks its value for a shape, and so whether a `formatMessage` can ever be said. */
|
|
31
|
+
export declare const hasFormat: (type: string) => boolean;
|
|
18
32
|
/**
|
|
19
33
|
* The first rule a value breaks, as the sentence to show under the control — or `''` when it breaks none.
|
|
20
34
|
*
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { get as e } from "@plitzi/plitzi-ui/helpers";
|
|
2
2
|
//#region src/elements/form/FormControl/helpers/validateField.ts
|
|
3
|
-
var t = "This field is required", n = "This is not in the expected format", r = "This does not match", i = (
|
|
3
|
+
var t = "This field is required", n = "This is not in the expected format", r = "This does not match", i = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, a = /* @__PURE__ */ new Map([["email", {
|
|
4
|
+
matches: (e) => i.test(e),
|
|
5
|
+
message: "Enter an email address"
|
|
6
|
+
}]]), o = (e) => a.has(e), s = (e) => e == null || e === "" || e === !1, c = (e) => typeof e == "string" ? e : typeof e == "number" ? String(e) : "", l = (e, t) => {
|
|
4
7
|
try {
|
|
5
8
|
return RegExp(`^(?:${t})$`, "u").test(e);
|
|
6
9
|
} catch {
|
|
7
10
|
return !1;
|
|
8
11
|
}
|
|
9
|
-
},
|
|
10
|
-
if (
|
|
11
|
-
if (typeof
|
|
12
|
-
let u =
|
|
13
|
-
|
|
12
|
+
}, u = (t, i, o) => {
|
|
13
|
+
if (s(t)) return i.required ? i.requiredMessage || "This field is required" : "";
|
|
14
|
+
if (typeof t == "boolean") return "";
|
|
15
|
+
let u = c(t), d = Array.from(u).length;
|
|
16
|
+
if (i.minLength > 0 && d < i.minLength) return i.minLengthMessage || `Use at least ${i.minLength} characters`;
|
|
17
|
+
if (i.maxLength > 0 && d > i.maxLength) return i.maxLengthMessage || `Use at most ${i.maxLength} characters`;
|
|
18
|
+
let f = a.get(i.type);
|
|
19
|
+
return f && !f.matches(u) ? i.formatMessage || f.message : i.pattern && !l(u, i.pattern) ? i.patternMessage || n : i.matches && u !== c(e(o, i.matches, "")) ? i.matchesMessage || r : "";
|
|
14
20
|
};
|
|
15
21
|
//#endregion
|
|
16
|
-
export { t as REQUIRED_MESSAGE,
|
|
22
|
+
export { t as REQUIRED_MESSAGE, o as hasFormat, u as validateField };
|
|
@@ -3,10 +3,14 @@ export type WithFieldValueProps<T> = {
|
|
|
3
3
|
ref: RefObject<HTMLElement>;
|
|
4
4
|
name: string;
|
|
5
5
|
defaultValue?: string;
|
|
6
|
-
subType: 'hidden' | 'text' | 'number' | 'email' | 'password' | 'select' | 'checkbox' | 'textarea' | 'color' | 'switch';
|
|
6
|
+
subType: 'hidden' | 'text' | 'number' | 'email' | 'password' | 'date' | 'time' | 'select' | 'checkbox' | 'textarea' | 'color' | 'switch';
|
|
7
7
|
required: boolean;
|
|
8
|
+
requiredMessage?: string;
|
|
8
9
|
minLength?: number;
|
|
10
|
+
minLengthMessage?: string;
|
|
9
11
|
maxLength?: number;
|
|
12
|
+
maxLengthMessage?: string;
|
|
13
|
+
formatMessage?: string;
|
|
10
14
|
pattern?: string;
|
|
11
15
|
patternMessage?: string;
|
|
12
16
|
matches?: string;
|
|
@@ -8,25 +8,30 @@ import { jsx as c } from "react/jsx-runtime";
|
|
|
8
8
|
//#region src/elements/form/FormControl/hocs/withFieldValue.tsx
|
|
9
9
|
var l = (l) => {
|
|
10
10
|
let u = (s) => {
|
|
11
|
-
let { ref: u, name: d = "", subType: f = "text", defaultValue: p = "", required: m = !0,
|
|
12
|
-
if (!
|
|
13
|
-
let { setFieldValue:
|
|
14
|
-
|
|
11
|
+
let { ref: u, name: d = "", subType: f = "text", defaultValue: p = "", required: m = !0, requiredMessage: h = "", minLength: g = 0, minLengthMessage: _ = "", maxLength: v = 0, maxLengthMessage: y = "", formatMessage: b = "", pattern: x = "", patternMessage: S = "", matches: C = "", matchesMessage: w = "", previewError: T = !1 } = s, { settings: { previewMode: E } } = i(), { useStore: D } = o(), [O] = D("runtime.sources.form");
|
|
12
|
+
if (!O) return /* @__PURE__ */ c(l, { ...s });
|
|
13
|
+
let { setFieldValue: k, setFieldError: A, registerValidator: j, unregisterValidator: M, errors: N, values: P } = O, F = r(() => a(P, d, p), [
|
|
14
|
+
P,
|
|
15
15
|
d,
|
|
16
16
|
p
|
|
17
|
-
]),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
]), I = r(() => !E && T ? "This is an error message" : N[d], [
|
|
18
|
+
E,
|
|
19
|
+
T,
|
|
20
|
+
N,
|
|
21
21
|
d
|
|
22
|
-
]),
|
|
22
|
+
]), L = r(() => ({
|
|
23
23
|
required: m,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
requiredMessage: h,
|
|
25
|
+
minLength: g,
|
|
26
|
+
minLengthMessage: _,
|
|
27
|
+
maxLength: v,
|
|
28
|
+
maxLengthMessage: y,
|
|
29
|
+
type: f,
|
|
30
|
+
formatMessage: b,
|
|
31
|
+
pattern: x,
|
|
32
|
+
patternMessage: S,
|
|
33
|
+
matches: C,
|
|
34
|
+
matchesMessage: w
|
|
30
35
|
}), [
|
|
31
36
|
m,
|
|
32
37
|
h,
|
|
@@ -34,51 +39,56 @@ var l = (l) => {
|
|
|
34
39
|
_,
|
|
35
40
|
v,
|
|
36
41
|
y,
|
|
37
|
-
|
|
42
|
+
f,
|
|
43
|
+
b,
|
|
44
|
+
x,
|
|
45
|
+
S,
|
|
46
|
+
C,
|
|
47
|
+
w
|
|
38
48
|
]);
|
|
39
49
|
n(() => {
|
|
40
|
-
if (d) return
|
|
50
|
+
if (d) return j(d, (t) => e(a(t, d, p), L, t)), () => M(d);
|
|
41
51
|
}, [
|
|
42
52
|
d,
|
|
43
53
|
p,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
L,
|
|
55
|
+
j,
|
|
56
|
+
M
|
|
47
57
|
]), n(() => {
|
|
48
|
-
p &&
|
|
58
|
+
p && F && d && k(d, F);
|
|
49
59
|
}, [
|
|
50
60
|
p,
|
|
51
61
|
d,
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
k,
|
|
63
|
+
F
|
|
54
64
|
]);
|
|
55
|
-
let
|
|
56
|
-
e.target.type === "radio" || e.target.type === "checkbox" || f === "switch" ?
|
|
65
|
+
let R = t((e) => {
|
|
66
|
+
e.target.type === "radio" || e.target.type === "checkbox" || f === "switch" ? k(d, e.target.checked) : k(d, e.target.value);
|
|
57
67
|
}, [
|
|
58
|
-
|
|
68
|
+
k,
|
|
59
69
|
d,
|
|
60
70
|
f
|
|
61
|
-
]),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
]), z = t(() => A(d, e(F, L, P)), [
|
|
72
|
+
F,
|
|
73
|
+
L,
|
|
74
|
+
P,
|
|
65
75
|
d,
|
|
66
|
-
|
|
76
|
+
A
|
|
67
77
|
]);
|
|
68
78
|
return r(() => /* @__PURE__ */ c(l, {
|
|
69
79
|
...s,
|
|
70
80
|
ref: u,
|
|
71
|
-
value:
|
|
72
|
-
error:
|
|
73
|
-
handleChange:
|
|
74
|
-
handleValidate:
|
|
81
|
+
value: F,
|
|
82
|
+
error: I,
|
|
83
|
+
handleChange: R,
|
|
84
|
+
handleValidate: z
|
|
75
85
|
}), [
|
|
76
86
|
s,
|
|
77
87
|
u,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
I,
|
|
89
|
+
F,
|
|
90
|
+
R,
|
|
91
|
+
z
|
|
82
92
|
]);
|
|
83
93
|
};
|
|
84
94
|
return u.displayName = `withFieldValue(${s(l)})`, u;
|
|
@@ -22,8 +22,12 @@ declare const FormControl: {
|
|
|
22
22
|
readonly disabled: false;
|
|
23
23
|
readonly options: readonly [];
|
|
24
24
|
readonly required: true;
|
|
25
|
+
readonly requiredMessage: "";
|
|
25
26
|
readonly minLength: 0;
|
|
27
|
+
readonly minLengthMessage: "";
|
|
26
28
|
readonly maxLength: 0;
|
|
29
|
+
readonly maxLengthMessage: "";
|
|
30
|
+
readonly formatMessage: "";
|
|
27
31
|
readonly pattern: "";
|
|
28
32
|
readonly patternMessage: "";
|
|
29
33
|
readonly matches: "";
|
package/dist/index.d.ts
CHANGED
|
@@ -1979,6 +1979,8 @@ export declare const defaultElements: {
|
|
|
1979
1979
|
disabled?: boolean | undefined;
|
|
1980
1980
|
subType?: "button" | "submit" | "reset" | undefined;
|
|
1981
1981
|
contentPlacement?: "before" | "after" | undefined;
|
|
1982
|
+
ariaExpanded?: boolean | undefined;
|
|
1983
|
+
ariaPressed?: boolean | undefined;
|
|
1982
1984
|
}>>;
|
|
1983
1985
|
paragraph: {
|
|
1984
1986
|
(props: import('./Element/hocs/withElement').WithElementProps<import('./elements/basic/Paragraph/Paragraph').ParagraphProps>): import("react").JSX.Element;
|
|
@@ -2574,6 +2576,7 @@ export declare const defaultElements: {
|
|
|
2574
2576
|
readonly method: "get";
|
|
2575
2577
|
readonly actionUrl: "";
|
|
2576
2578
|
readonly managedByInteractions: false;
|
|
2579
|
+
readonly noValidate: false;
|
|
2577
2580
|
readonly errors: {};
|
|
2578
2581
|
readonly values: {};
|
|
2579
2582
|
};
|
|
@@ -2615,6 +2618,7 @@ export declare const defaultElements: {
|
|
|
2615
2618
|
__attributes: Partial<{
|
|
2616
2619
|
values: Record<string, unknown>;
|
|
2617
2620
|
method: "get" | "post";
|
|
2621
|
+
noValidate: boolean;
|
|
2618
2622
|
actionUrl: string;
|
|
2619
2623
|
managedByInteractions: boolean;
|
|
2620
2624
|
errors: Record<string, string>;
|
|
@@ -2644,8 +2648,12 @@ export declare const defaultElements: {
|
|
|
2644
2648
|
readonly disabled: false;
|
|
2645
2649
|
readonly options: readonly [];
|
|
2646
2650
|
readonly required: true;
|
|
2651
|
+
readonly requiredMessage: "";
|
|
2647
2652
|
readonly minLength: 0;
|
|
2653
|
+
readonly minLengthMessage: "";
|
|
2648
2654
|
readonly maxLength: 0;
|
|
2655
|
+
readonly maxLengthMessage: "";
|
|
2656
|
+
readonly formatMessage: "";
|
|
2649
2657
|
readonly pattern: "";
|
|
2650
2658
|
readonly patternMessage: "";
|
|
2651
2659
|
readonly matches: "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-elements",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.3",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -986,13 +986,13 @@
|
|
|
986
986
|
"dependencies": {
|
|
987
987
|
"@plitzi/nexus": "^1.1.4",
|
|
988
988
|
"@plitzi/plitzi-ui": "^1.6.21",
|
|
989
|
-
"@plitzi/sdk-auth": "0.35.
|
|
990
|
-
"@plitzi/sdk-dev-tools": "0.35.
|
|
991
|
-
"@plitzi/sdk-event-bridge": "0.35.
|
|
992
|
-
"@plitzi/sdk-interactions": "0.35.
|
|
993
|
-
"@plitzi/sdk-navigation": "0.35.
|
|
994
|
-
"@plitzi/sdk-schema": "0.35.
|
|
995
|
-
"@plitzi/sdk-shared": "0.35.
|
|
989
|
+
"@plitzi/sdk-auth": "0.35.3",
|
|
990
|
+
"@plitzi/sdk-dev-tools": "0.35.3",
|
|
991
|
+
"@plitzi/sdk-event-bridge": "0.35.3",
|
|
992
|
+
"@plitzi/sdk-interactions": "0.35.3",
|
|
993
|
+
"@plitzi/sdk-navigation": "0.35.3",
|
|
994
|
+
"@plitzi/sdk-schema": "0.35.3",
|
|
995
|
+
"@plitzi/sdk-shared": "0.35.3",
|
|
996
996
|
"clsx": "^2.1.1",
|
|
997
997
|
"immer": "^11.1.18"
|
|
998
998
|
},
|