@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.
Files changed (28) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/Element/hooks/useElementDataSource.mjs +18 -14
  3. package/dist/dataSource/GlobalSources.mjs +75 -61
  4. package/dist/elements/basic/Button/Button.d.ts +10 -1
  5. package/dist/elements/basic/Button/Button.mjs +7 -5
  6. package/dist/elements/basic/Button/declaration.d.ts +2 -0
  7. package/dist/elements/basic/Button/index.d.ts +2 -0
  8. package/dist/elements/declarations/index.d.ts +8 -0
  9. package/dist/elements/form/Form/Form.d.ts +9 -1
  10. package/dist/elements/form/Form/Form.mjs +79 -78
  11. package/dist/elements/form/Form/Settings.d.ts +2 -1
  12. package/dist/elements/form/Form/Settings.mjs +12 -6
  13. package/dist/elements/form/Form/declaration.d.ts +2 -0
  14. package/dist/elements/form/Form/declaration.mjs +1 -0
  15. package/dist/elements/form/Form/index.d.ts +2 -0
  16. package/dist/elements/form/FormControl/FormControl.d.ts +9 -1
  17. package/dist/elements/form/FormControl/FormControl.mjs +1 -0
  18. package/dist/elements/form/FormControl/Settings.d.ts +6 -2
  19. package/dist/elements/form/FormControl/Settings.mjs +106 -77
  20. package/dist/elements/form/FormControl/declaration.d.ts +4 -0
  21. package/dist/elements/form/FormControl/declaration.mjs +4 -0
  22. package/dist/elements/form/FormControl/helpers/validateField.d.ts +14 -0
  23. package/dist/elements/form/FormControl/helpers/validateField.mjs +13 -7
  24. package/dist/elements/form/FormControl/hocs/withFieldValue.d.ts +5 -1
  25. package/dist/elements/form/FormControl/hocs/withFieldValue.mjs +49 -39
  26. package/dist/elements/form/FormControl/index.d.ts +4 -0
  27. package/dist/index.d.ts +8 -0
  28. package/package.json +8 -8
@@ -1,174 +1,203 @@
1
- import { useCallback as e, useMemo as t } from "react";
2
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
3
- import i from "@plitzi/plitzi-ui/Checkbox";
4
- import a from "@plitzi/plitzi-ui/Input";
5
- import o from "@plitzi/plitzi-ui/TextArea";
6
- import s from "@plitzi/plitzi-ui/Select";
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 c = (e) => {
9
+ var l = (e) => {
9
10
  let t = parseInt(e, 10);
10
11
  return Number.isNaN(t) || t < 0 ? 0 : t;
11
- }, l = ({ subType: l = "text", name: u = "", label: d = "Label", defaultValue: f = "", placeholder: p = "", autoComplete: m = !0, options: h, required: g = !0, minLength: _ = 0, maxLength: v = 0, pattern: y = "", patternMessage: b = "", matches: x = "", matchesMessage: S = "", readOnly: C = !1, disabled: w = !1, previewError: T = !1, onUpdate: E }) => {
12
- let D = [
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(l), O = e((e) => E?.("name", e), [E]), k = e((e) => E?.("label", e), [E]), A = e((e) => E?.("placeholder", e), [E]), j = e((e) => {
19
- E?.("subType", e), E?.("defaultValue", "");
20
- }, [E]), M = e((e) => E?.("defaultValue", e), [E]), N = e((e) => E?.("autoComplete", e.target.checked), [E]), P = e((e) => E?.("required", e.target.checked), [E]), F = e((e) => E?.("minLength", c(e)), [E]), I = e((e) => E?.("maxLength", c(e)), [E]), L = e((e) => E?.("pattern", e), [E]), R = e((e) => E?.("patternMessage", e), [E]), z = e((e) => E?.("matches", e), [E]), B = e((e) => E?.("matchesMessage", e), [E]), V = e((e) => E?.("readOnly", e.target.checked), [E]), H = e((e) => E?.("disabled", e.target.checked), [E]), U = e((e) => E?.("previewError", e.target.checked), [E]), W = e((e) => {
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
- E?.("options", []);
23
+ j?.("options", []);
23
24
  return;
24
25
  }
25
- E?.("options", e.split("\n"));
26
- }, [E]), G = t(() => Array.isArray(h) ? h.join("\n") : "", [h]);
27
- return /* @__PURE__ */ r("div", {
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__ */ n(a, {
31
- value: u,
31
+ /* @__PURE__ */ r(o, {
32
+ value: d,
32
33
  label: "Input Name",
33
- onChange: O,
34
+ onChange: N,
34
35
  size: "xs"
35
36
  }),
36
- /* @__PURE__ */ n(a, {
37
- value: d,
37
+ /* @__PURE__ */ r(o, {
38
+ value: f,
38
39
  label: "Label",
39
- onChange: k,
40
+ onChange: ee,
40
41
  size: "xs"
41
42
  }),
42
- /* @__PURE__ */ n(a, {
43
- value: p,
43
+ /* @__PURE__ */ r(o, {
44
+ value: m,
44
45
  label: "Placeholder",
45
- onChange: A,
46
+ onChange: P,
46
47
  size: "xs"
47
48
  }),
48
- /* @__PURE__ */ r(s, {
49
- value: l,
50
- onChange: j,
49
+ /* @__PURE__ */ i(c, {
50
+ value: u,
51
+ onChange: F,
51
52
  label: "Input Type",
52
53
  size: "xs",
53
54
  children: [
54
- /* @__PURE__ */ n("option", {
55
+ /* @__PURE__ */ r("option", {
55
56
  value: "text",
56
57
  children: "Text"
57
58
  }),
58
- /* @__PURE__ */ n("option", {
59
+ /* @__PURE__ */ r("option", {
59
60
  value: "number",
60
61
  children: "Number"
61
62
  }),
62
- /* @__PURE__ */ n("option", {
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__ */ n("option", {
71
+ /* @__PURE__ */ r("option", {
67
72
  value: "email",
68
73
  children: "Email"
69
74
  }),
70
- /* @__PURE__ */ n("option", {
75
+ /* @__PURE__ */ r("option", {
71
76
  value: "password",
72
77
  children: "Password"
73
78
  }),
74
- /* @__PURE__ */ n("option", {
79
+ /* @__PURE__ */ r("option", {
75
80
  value: "select",
76
81
  children: "Select"
77
82
  }),
78
- /* @__PURE__ */ n("option", {
83
+ /* @__PURE__ */ r("option", {
79
84
  value: "checkbox",
80
85
  children: "Checkbox"
81
86
  }),
82
- /* @__PURE__ */ n("option", {
87
+ /* @__PURE__ */ r("option", {
83
88
  value: "textarea",
84
89
  children: "Long Text"
85
90
  }),
86
- /* @__PURE__ */ n("option", {
91
+ /* @__PURE__ */ r("option", {
87
92
  value: "hidden",
88
93
  children: "Hidden"
89
94
  })
90
95
  ]
91
96
  }),
92
- /* @__PURE__ */ n(o, {
93
- value: f,
97
+ /* @__PURE__ */ r(s, {
98
+ value: p,
94
99
  label: "Default Value",
95
- onChange: M,
100
+ onChange: I,
96
101
  size: "xs"
97
102
  }),
98
- l === "text" && /* @__PURE__ */ n(i, {
99
- checked: m,
103
+ u === "text" && /* @__PURE__ */ r(a, {
104
+ checked: h,
100
105
  label: "Auto Complete",
101
- onChange: N,
106
+ onChange: L,
102
107
  size: "xs"
103
108
  }),
104
- D && /* @__PURE__ */ n(i, {
105
- checked: C,
109
+ M && /* @__PURE__ */ r(a, {
110
+ checked: O,
106
111
  label: "Read Only",
107
- onChange: V,
112
+ onChange: Y,
108
113
  size: "xs"
109
114
  }),
110
- l === "select" && /* @__PURE__ */ n(o, {
111
- value: G,
115
+ u === "select" && /* @__PURE__ */ r(s, {
116
+ value: $,
112
117
  label: "Options",
113
- onChange: W,
118
+ onChange: Q,
114
119
  size: "xs"
115
120
  }),
116
- /* @__PURE__ */ n(i, {
117
- checked: g,
121
+ /* @__PURE__ */ r(a, {
122
+ checked: _,
118
123
  label: "Required",
119
- onChange: P,
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
- D && /* @__PURE__ */ n(a, {
123
- value: _ ? String(_) : "",
133
+ M && /* @__PURE__ */ r(o, {
134
+ value: y ? String(y) : "",
124
135
  label: "Min Length",
125
- onChange: F,
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
- D && /* @__PURE__ */ n(a, {
129
- value: v ? String(v) : "",
145
+ M && /* @__PURE__ */ r(o, {
146
+ value: x ? String(x) : "",
130
147
  label: "Max Length",
131
- onChange: I,
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
- D && /* @__PURE__ */ n(a, {
135
- value: y,
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: L,
166
+ onChange: G,
138
167
  size: "xs"
139
168
  }),
140
- D && y && /* @__PURE__ */ n(a, {
141
- value: b,
169
+ M && w && /* @__PURE__ */ r(o, {
170
+ value: T,
142
171
  label: "Pattern Message",
143
- onChange: R,
172
+ onChange: K,
144
173
  size: "xs"
145
174
  }),
146
- D && /* @__PURE__ */ n(a, {
147
- value: x,
175
+ M && /* @__PURE__ */ r(o, {
176
+ value: E,
148
177
  label: "Must Match Field",
149
- onChange: z,
178
+ onChange: q,
150
179
  size: "xs"
151
180
  }),
152
- D && x && /* @__PURE__ */ n(a, {
153
- value: S,
181
+ M && E && /* @__PURE__ */ r(o, {
182
+ value: D,
154
183
  label: "Mismatch Message",
155
- onChange: B,
184
+ onChange: J,
156
185
  size: "xs"
157
186
  }),
158
- /* @__PURE__ */ n(i, {
159
- checked: w,
187
+ /* @__PURE__ */ r(a, {
188
+ checked: k,
160
189
  label: "Disabled",
161
- onChange: H,
190
+ onChange: X,
162
191
  size: "xs"
163
192
  }),
164
- /* @__PURE__ */ n(i, {
165
- checked: T,
193
+ /* @__PURE__ */ r(a, {
194
+ checked: A,
166
195
  label: "Preview Error Message",
167
- onChange: U,
196
+ onChange: Z,
168
197
  size: "xs"
169
198
  })
170
199
  ]
171
200
  });
172
201
  };
173
202
  //#endregion
174
- export { l as default };
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: "";
@@ -57,8 +57,12 @@ var t = {
57
57
  disabled: !1,
58
58
  options: [],
59
59
  required: !0,
60
+ requiredMessage: "",
60
61
  minLength: 0,
62
+ minLengthMessage: "",
61
63
  maxLength: 0,
64
+ maxLengthMessage: "",
65
+ formatMessage: "",
62
66
  pattern: "",
63
67
  patternMessage: "",
64
68
  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 = (e) => e == null || e === "" || e === !1, a = (e) => typeof e == "string" ? e : typeof e == "number" ? String(e) : "", o = (e, t) => {
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
- }, s = (s, c, l) => {
10
- if (i(s)) return c.required ? t : "";
11
- if (typeof s == "boolean") return "";
12
- let u = a(s), d = Array.from(u).length;
13
- return c.minLength > 0 && d < c.minLength ? `Use at least ${c.minLength} characters` : c.maxLength > 0 && d > c.maxLength ? `Use at most ${c.maxLength} characters` : c.pattern && !o(u, c.pattern) ? c.patternMessage || n : c.matches && u !== a(e(l, c.matches, "")) ? c.matchesMessage || r : "";
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, s as validateField };
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, minLength: h = 0, maxLength: g = 0, pattern: _ = "", patternMessage: v = "", matches: y = "", matchesMessage: b = "", previewError: x = !1 } = s, { settings: { previewMode: S } } = i(), { useStore: C } = o(), [w] = C("runtime.sources.form");
12
- if (!w) return /* @__PURE__ */ c(l, { ...s });
13
- let { setFieldValue: T, setFieldError: E, registerValidator: D, unregisterValidator: O, errors: k, values: A } = w, j = r(() => a(A, d, p), [
14
- A,
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
- ]), M = r(() => !S && x ? "This is an error message" : k[d], [
18
- S,
19
- x,
20
- k,
17
+ ]), I = r(() => !E && T ? "This is an error message" : N[d], [
18
+ E,
19
+ T,
20
+ N,
21
21
  d
22
- ]), N = r(() => ({
22
+ ]), L = r(() => ({
23
23
  required: m,
24
- minLength: h,
25
- maxLength: g,
26
- pattern: _,
27
- patternMessage: v,
28
- matches: y,
29
- matchesMessage: b
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
- b
42
+ f,
43
+ b,
44
+ x,
45
+ S,
46
+ C,
47
+ w
38
48
  ]);
39
49
  n(() => {
40
- if (d) return D(d, (t) => e(a(t, d, p), N, t)), () => O(d);
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
- N,
45
- D,
46
- O
54
+ L,
55
+ j,
56
+ M
47
57
  ]), n(() => {
48
- p && j && d && T(d, j);
58
+ p && F && d && k(d, F);
49
59
  }, [
50
60
  p,
51
61
  d,
52
- T,
53
- j
62
+ k,
63
+ F
54
64
  ]);
55
- let P = t((e) => {
56
- e.target.type === "radio" || e.target.type === "checkbox" || f === "switch" ? T(d, e.target.checked) : T(d, e.target.value);
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
- T,
68
+ k,
59
69
  d,
60
70
  f
61
- ]), F = t(() => E(d, e(j, N, A)), [
62
- j,
63
- N,
64
- A,
71
+ ]), z = t(() => A(d, e(F, L, P)), [
72
+ F,
73
+ L,
74
+ P,
65
75
  d,
66
- E
76
+ A
67
77
  ]);
68
78
  return r(() => /* @__PURE__ */ c(l, {
69
79
  ...s,
70
80
  ref: u,
71
- value: j,
72
- error: M,
73
- handleChange: P,
74
- handleValidate: F
81
+ value: F,
82
+ error: I,
83
+ handleChange: R,
84
+ handleValidate: z
75
85
  }), [
76
86
  s,
77
87
  u,
78
- M,
79
- j,
80
- P,
81
- F
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.1",
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.1",
990
- "@plitzi/sdk-dev-tools": "0.35.1",
991
- "@plitzi/sdk-event-bridge": "0.35.1",
992
- "@plitzi/sdk-interactions": "0.35.1",
993
- "@plitzi/sdk-navigation": "0.35.1",
994
- "@plitzi/sdk-schema": "0.35.1",
995
- "@plitzi/sdk-shared": "0.35.1",
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
  },