@code0-tech/pictor 0.7.1 → 0.7.2
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/assets/components/form/EditorInput.style.css +1 -1
- package/dist/assets/components/form/InputWrapper.style.css +1 -1
- package/dist/assets/components/form/SelectInput.style.css +1 -1
- package/dist/components/editor/Editor.js +1 -1
- package/dist/components/form/CheckboxInput.js +1 -1
- package/dist/components/form/EditorInput.js +1 -1
- package/dist/components/form/PinInput.js +1 -1
- package/dist/components/form/RadioGroup.js +1 -1
- package/dist/components/form/SelectInput.js +39 -39
- package/dist/components/form/useForm.d.ts +2 -2
- package/dist/components/form/useForm.js +38 -41
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.editor-input{width:100%;flex:1 1 auto;overflow:hidden;padding:.59rem 0;position:relative;align-self:stretch}.editor-input .cm-editor{height:100%;outline:none!important}.editor-input .cm-content{padding:0;position:relative}.editor-input .cm-line{align-self:stretch;padding-left:0}
|
|
1
|
+
.editor-input{width:100%;flex:1 1 auto;overflow:hidden;padding:.59rem 0;position:relative;align-self:stretch}.editor-input .cm-editor{height:100%;outline:none!important}.editor-input .cm-content{padding:0;position:relative}.editor-input .cm-line{align-self:stretch;padding-left:0}.editor-input .cm-cursor{border-width:2px;border-radius:50rem;border-color:#fff}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.input-wrapper{display:flex;z-index:1;width:100%;align-items:start;box-sizing:border-box;gap:.175rem}.input-wrapper{background:#201e2c;box-shadow:inset 0 1px 1px #ffffff1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.input-wrapper:hover{background:#bfbfbf26;box-shadow:inset 0 1px 1px #ffffff1a}.input-wrapper:active,.input-wrapper:focus,.input-wrapper[aria-selected=true],.input-wrapper[data-state=open]{background:#bfbfbf33;box-shadow:inset 0 1px 1px #ffffff1a;outline:none}.input-wrapper{font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px;border-radius:1rem}.input-wrapper:has(.input-wrapper__control:focus){background:#bfbfbf33;box-shadow:inset 0 1px 1px #ffffff1a;outline:none}.input-wrapper--not-valid{background:#1c0516;box-shadow:inset 0 1px 1px #d904291a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.input-wrapper>:first-child{padding-left:.7rem}.input-wrapper__left,.input-wrapper__right{display:flex;align-items:center;justify-content:center;min-height:30px;gap:.7rem;margin:.175rem}.input-wrapper__left
|
|
1
|
+
.input-wrapper{display:flex;z-index:1;width:100%;align-items:start;box-sizing:border-box;gap:.175rem}.input-wrapper{background:#201e2c;box-shadow:inset 0 1px 1px #ffffff1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.input-wrapper:hover{background:#bfbfbf26;box-shadow:inset 0 1px 1px #ffffff1a}.input-wrapper:active,.input-wrapper:focus,.input-wrapper[aria-selected=true],.input-wrapper[data-state=open]{background:#bfbfbf33;box-shadow:inset 0 1px 1px #ffffff1a;outline:none}.input-wrapper{font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px;border-radius:1rem}.input-wrapper:has(.input-wrapper__control:focus){background:#bfbfbf33;box-shadow:inset 0 1px 1px #ffffff1a;outline:none}.input-wrapper--not-valid{background:#1c0516;box-shadow:inset 0 1px 1px #d904291a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.input-wrapper>:first-child{padding-left:.7rem}.input-wrapper__left,.input-wrapper__right{display:flex;align-items:center;justify-content:center;min-height:30px;gap:.7rem;margin:.175rem}.input-wrapper__left--action,.input-wrapper__right--action{padding:0}.input-wrapper__left--placeholder,.input-wrapper__right--placeholder{background:#070514;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px;border-radius:.825rem;padding:.7rem;box-shadow:none}.input-wrapper__left--icon,.input-wrapper__right--icon{align-items:center}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.select-input__content{padding:.35rem;position:relative;box-sizing:border-box;z-index:999}.select-input__content{border-radius:1rem}.select-input__item{border-radius:.65rem;padding:.35rem .7rem;gap:.7rem;cursor:pointer;width:100%;display:flex;align-items:center;font-size:.8rem}.select-input__item{background:#070514;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.select-input__item:focus{outline:none}.select-input__item{font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px}.select-input__item:disabled,.select-input__item[data-disabled],.select-input__item[aria-disabled=true],.select-input__item--disabled{cursor:not-allowed;opacity:25%;pointer-events:unset}.select-input__item{box-shadow:none}.select-input__item:focus,.select-input__item[data-focus=true]{background:#191825;box-shadow:inset 0 1px 1px #ffffff1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;box-shadow:none;width:100%}.select-input__trigger{
|
|
1
|
+
.select-input__content{padding:.35rem;position:relative;box-sizing:border-box;z-index:999}.select-input__content{border-radius:1rem}.select-input__item{border-radius:.65rem;padding:.35rem .7rem;gap:.7rem;cursor:pointer;width:100%;display:flex;align-items:center;font-size:.8rem}.select-input__item{background:#070514;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.select-input__item:focus{outline:none}.select-input__item{font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px}.select-input__item:disabled,.select-input__item[data-disabled],.select-input__item[aria-disabled=true],.select-input__item--disabled{cursor:not-allowed;opacity:25%;pointer-events:unset}.select-input__item{box-shadow:none}.select-input__item:focus,.select-input__item[data-focus=true]{background:#191825;box-shadow:inset 0 1px 1px #ffffff1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;box-shadow:none;width:100%}.select-input__trigger{width:100%;position:relative;align-self:stretch;cursor:pointer}.select-input__content--primary{background:#070514;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;border:rgb(25.4,23.6,37.1) 2px solid}.select-input__content--secondary{background:#191825;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;border:rgb(25.4,23.6,37.1) 2px solid}.select-input__content--tertiary{background:#201e2c;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;border:rgb(25.4,23.6,37.1) 2px solid}.select-input__content--success{background:#0a1814;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;border:rgb(25.4,23.6,37.1) 2px solid}.select-input__content--warning{background:#201813;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;border:rgb(25.4,23.6,37.1) 2px solid}.select-input__content--error{background:#1c0516;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;border:rgb(25.4,23.6,37.1) 2px solid}.select-input__content--info{background:#121e24;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box;border:rgb(25.4,23.6,37.1) 2px solid}
|
|
@@ -26,7 +26,7 @@ const ee = (l) => {
|
|
|
26
26
|
const i = x, [t, R] = z.useState(l.initialValue ?? "indeterminate");
|
|
27
27
|
let g;
|
|
28
28
|
e[2] !== t || e[3] !== i ? (g = () => {
|
|
29
|
-
i.setValue(t);
|
|
29
|
+
i.setValue?.(t);
|
|
30
30
|
}, e[2] = t, e[3] = i, e[4] = g) : g = e[4];
|
|
31
31
|
let v;
|
|
32
32
|
e[5] !== t ? (v = [t], e[5] = t, e[6] = v) : v = e[6], z.useEffect(g, v);
|
|
@@ -56,7 +56,7 @@ const N = (i) => {
|
|
|
56
56
|
}, ...r]
|
|
57
57
|
}), [r]);
|
|
58
58
|
return /* @__PURE__ */ a(y, { title: g, description: u, right: s, left: m, rightType: l, leftType: c, formValidation: o, children: /* @__PURE__ */ a(T, { extensions: d, onChange: (n) => {
|
|
59
|
-
o?.setValue(n), f?.(n);
|
|
59
|
+
o?.setValue?.(n), f?.(n);
|
|
60
60
|
}, theme: k, ...C("editor-input", b), basicSetup: {
|
|
61
61
|
lineNumbers: !1,
|
|
62
62
|
foldGutter: !1,
|
|
@@ -29,7 +29,7 @@ const B = (n) => {
|
|
|
29
29
|
e[11] !== h ? (l = V(h, {}), e[11] = h, e[12] = l) : l = e[12], t = T, d = V("pin-input", {
|
|
30
30
|
...g,
|
|
31
31
|
onValueChange: (v) => {
|
|
32
|
-
g.onValueChange && g.onValueChange(v), i.setValue(v);
|
|
32
|
+
g.onValueChange && g.onValueChange(v), i.setValue?.(v);
|
|
33
33
|
}
|
|
34
34
|
}), e[0] = n, e[1] = t, e[2] = i, e[3] = d, e[4] = l, e[5] = o, e[6] = s;
|
|
35
35
|
} else
|
|
@@ -27,7 +27,7 @@ const y = (s) => {
|
|
|
27
27
|
} : V, e[7] !== d ? (i = d ? /* @__PURE__ */ f(G, { children: d }) : null, e[7] = d, e[8] = i) : i = e[8], e[9] !== p ? (l = p ? /* @__PURE__ */ f(I, { children: p }) : null, e[9] = p, e[10] = l) : l = e[10], o = M.RadioGroup, r = h ?? s.defaultValue, a = v("radio-group", {
|
|
28
28
|
...c,
|
|
29
29
|
onValueChange: (g) => {
|
|
30
|
-
c.onValueChange && c.onValueChange(g), t.setValue(g);
|
|
30
|
+
c.onValueChange && c.onValueChange(g), t.setValue?.(g);
|
|
31
31
|
}
|
|
32
32
|
}), e[0] = s, e[1] = o, e[2] = t, e[3] = r, e[4] = a, e[5] = i, e[6] = l;
|
|
33
33
|
} else
|
|
@@ -5,81 +5,81 @@ import "../../utils/contextStore.js";
|
|
|
5
5
|
import "react";
|
|
6
6
|
import { mergeComponentProps as f } from "../../utils/component.js";
|
|
7
7
|
import "js-md5";
|
|
8
|
-
import { InputWrapper as
|
|
8
|
+
import { InputWrapper as R } from "./InputWrapper.js";
|
|
9
9
|
import '../../assets/components/form/SelectInput.style.css';/* empty css */
|
|
10
|
-
const A = (
|
|
10
|
+
const A = (i) => {
|
|
11
11
|
const t = r.c(24);
|
|
12
|
-
let e, l,
|
|
13
|
-
if (t[0] !==
|
|
12
|
+
let e, l, n, c, m, u, a, _, g, T;
|
|
13
|
+
if (t[0] !== i) {
|
|
14
14
|
const {
|
|
15
|
-
title:
|
|
16
|
-
description:
|
|
17
|
-
left:
|
|
18
|
-
leftType:
|
|
19
|
-
rightType:
|
|
20
|
-
right:
|
|
15
|
+
title: I,
|
|
16
|
+
description: y,
|
|
17
|
+
left: C,
|
|
18
|
+
leftType: p,
|
|
19
|
+
rightType: w,
|
|
20
|
+
right: P,
|
|
21
21
|
formValidation: h,
|
|
22
22
|
...x
|
|
23
|
-
} =
|
|
24
|
-
l =
|
|
23
|
+
} = i;
|
|
24
|
+
l = R, c = I, m = y, u = C, a = p, _ = P, g = w, T = h, e = s.Root, n = f("select-input", {
|
|
25
25
|
...x,
|
|
26
26
|
onValueChange: (d) => {
|
|
27
|
-
h?.setValue(d), x.onValueChange?.(d)
|
|
27
|
+
h?.setValue?.(d), x.onValueChange?.(d);
|
|
28
28
|
}
|
|
29
|
-
}), t[0] =
|
|
29
|
+
}), t[0] = i, t[1] = e, t[2] = l, t[3] = n, t[4] = c, t[5] = m, t[6] = u, t[7] = a, t[8] = _, t[9] = g, t[10] = T;
|
|
30
30
|
} else
|
|
31
|
-
e = t[1], l = t[2],
|
|
32
|
-
const $ =
|
|
31
|
+
e = t[1], l = t[2], n = t[3], c = t[4], m = t[5], u = t[6], a = t[7], _ = t[8], g = t[9], T = t[10];
|
|
32
|
+
const $ = n;
|
|
33
33
|
let S;
|
|
34
34
|
t[11] !== e || t[12] !== $ ? (S = /* @__PURE__ */ o(e, { ...$ }), t[11] = e, t[12] = $, t[13] = S) : S = t[13];
|
|
35
35
|
let V;
|
|
36
36
|
return t[14] !== l || t[15] !== c || t[16] !== m || t[17] !== u || t[18] !== a || t[19] !== _ || t[20] !== g || t[21] !== T || t[22] !== S ? (V = /* @__PURE__ */ o(l, { title: c, description: m, left: u, leftType: a, right: _, rightType: g, formValidation: T, children: S }), t[14] = l, t[15] = c, t[16] = m, t[17] = u, t[18] = a, t[19] = _, t[20] = g, t[21] = T, t[22] = S, t[23] = V) : V = t[23], V;
|
|
37
|
-
}, B = (
|
|
37
|
+
}, B = (i) => {
|
|
38
38
|
const t = r.c(4);
|
|
39
39
|
let e;
|
|
40
|
-
t[0] !==
|
|
40
|
+
t[0] !== i ? (e = f("select-input__trigger", i), t[0] = i, t[1] = e) : e = t[1];
|
|
41
41
|
let l;
|
|
42
42
|
return t[2] !== e ? (l = /* @__PURE__ */ o(s.Trigger, { ...e }), t[2] = e, t[3] = l) : l = t[3], l;
|
|
43
|
-
}, D = (
|
|
43
|
+
}, D = (i) => {
|
|
44
44
|
const t = r.c(4);
|
|
45
45
|
let e;
|
|
46
|
-
t[0] !==
|
|
46
|
+
t[0] !== i ? (e = f("select-input__value", i), t[0] = i, t[1] = e) : e = t[1];
|
|
47
47
|
let l;
|
|
48
48
|
return t[2] !== e ? (l = /* @__PURE__ */ o(s.Value, { ...e }), t[2] = e, t[3] = l) : l = t[3], l;
|
|
49
|
-
}, F = (
|
|
50
|
-
const t = r.c(5), e = `select-input__content select-input__content--${
|
|
49
|
+
}, F = (i) => {
|
|
50
|
+
const t = r.c(5), e = `select-input__content select-input__content--${i.color ?? "primary"}`;
|
|
51
51
|
let l;
|
|
52
|
-
t[0] !==
|
|
53
|
-
const
|
|
52
|
+
t[0] !== i || t[1] !== e ? (l = f(e, i), t[0] = i, t[1] = e, t[2] = l) : l = t[2];
|
|
53
|
+
const n = l;
|
|
54
54
|
let c;
|
|
55
|
-
return t[3] !==
|
|
56
|
-
}, G = (
|
|
55
|
+
return t[3] !== n ? (c = /* @__PURE__ */ o(s.Content, { ...n }), t[3] = n, t[4] = c) : c = t[4], c;
|
|
56
|
+
}, G = (i) => {
|
|
57
57
|
const t = r.c(4);
|
|
58
58
|
let e;
|
|
59
|
-
t[0] !==
|
|
59
|
+
t[0] !== i ? (e = f("select-input__portal", i), t[0] = i, t[1] = e) : e = t[1];
|
|
60
60
|
const l = e;
|
|
61
|
-
let
|
|
62
|
-
return t[2] !== l ? (
|
|
63
|
-
}, H = (
|
|
61
|
+
let n;
|
|
62
|
+
return t[2] !== l ? (n = /* @__PURE__ */ o(s.Portal, { ...l }), t[2] = l, t[3] = n) : n = t[3], n;
|
|
63
|
+
}, H = (i) => {
|
|
64
64
|
const t = r.c(4);
|
|
65
65
|
let e;
|
|
66
|
-
t[0] !==
|
|
66
|
+
t[0] !== i ? (e = f("select-input__viewport", i), t[0] = i, t[1] = e) : e = t[1];
|
|
67
67
|
let l;
|
|
68
68
|
return t[2] !== e ? (l = /* @__PURE__ */ o(s.Viewport, { ...e }), t[2] = e, t[3] = l) : l = t[3], l;
|
|
69
|
-
}, J = (
|
|
69
|
+
}, J = (i) => {
|
|
70
70
|
const t = r.c(4);
|
|
71
71
|
let e;
|
|
72
|
-
t[0] !==
|
|
72
|
+
t[0] !== i ? (e = f("select-input__item", i), t[0] = i, t[1] = e) : e = t[1];
|
|
73
73
|
const l = e;
|
|
74
|
-
let
|
|
75
|
-
return t[2] !== l ? (
|
|
76
|
-
}, K = (
|
|
74
|
+
let n;
|
|
75
|
+
return t[2] !== l ? (n = /* @__PURE__ */ o(s.Item, { ...l }), t[2] = l, t[3] = n) : n = t[3], n;
|
|
76
|
+
}, K = (i) => {
|
|
77
77
|
const t = r.c(4);
|
|
78
78
|
let e;
|
|
79
|
-
t[0] !==
|
|
79
|
+
t[0] !== i ? (e = f("select-input__item-text", i), t[0] = i, t[1] = e) : e = t[1];
|
|
80
80
|
const l = e;
|
|
81
|
-
let
|
|
82
|
-
return t[2] !== l ? (
|
|
81
|
+
let n;
|
|
82
|
+
return t[2] !== l ? (n = /* @__PURE__ */ o(s.ItemText, { ...l }), t[2] = l, t[3] = n) : n = t[3], n;
|
|
83
83
|
};
|
|
84
84
|
export {
|
|
85
85
|
F as SelectContent,
|
|
@@ -14,7 +14,7 @@ export interface ValidationProps<Value> {
|
|
|
14
14
|
value?: Value | undefined;
|
|
15
15
|
required?: boolean;
|
|
16
16
|
formValidation?: {
|
|
17
|
-
setValue
|
|
17
|
+
setValue?: (value: any) => void;
|
|
18
18
|
valid?: boolean;
|
|
19
19
|
notValidMessage?: string | null;
|
|
20
20
|
};
|
|
@@ -22,7 +22,7 @@ export interface ValidationProps<Value> {
|
|
|
22
22
|
export type ValidationsProps<Values> = Partial<{
|
|
23
23
|
[Key in keyof Values]: ValidationProps<Values[Key]>;
|
|
24
24
|
}>;
|
|
25
|
-
export type FormValidationReturn<Values> = [IValidation<Values>, <Key extends keyof Values>(key?: Key | any) => void];
|
|
25
|
+
export type FormValidationReturn<Values> = [IValidation<Values>, <Key extends keyof Values>(key?: Key | any, submit?: boolean) => void, Values];
|
|
26
26
|
export interface IValidation<Values> {
|
|
27
27
|
getInputProps<Key extends keyof Values>(key: Key): ValidationProps<Values[Key]>;
|
|
28
28
|
isValid(): boolean;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { useState as
|
|
1
|
+
import j, { useState as g, useRef as y, useCallback as w, useEffect as P } from "react";
|
|
2
2
|
function o(i, e, t) {
|
|
3
|
-
return (e =
|
|
3
|
+
return (e = O(e)) in i ? Object.defineProperty(i, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : i[e] = t, i;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
var e =
|
|
5
|
+
function O(i) {
|
|
6
|
+
var e = F(i, "string");
|
|
7
7
|
return typeof e == "symbol" ? e : e + "";
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function F(i, e) {
|
|
10
10
|
if (typeof i != "object" || !i) return i;
|
|
11
11
|
var t = i[Symbol.toPrimitive];
|
|
12
12
|
if (t !== void 0) {
|
|
13
|
-
var
|
|
14
|
-
if (typeof
|
|
13
|
+
var n = t.call(i, e);
|
|
14
|
+
if (typeof n != "object") return n;
|
|
15
15
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
16
16
|
}
|
|
17
17
|
return (e === "string" ? String : Number)(i);
|
|
18
18
|
}
|
|
19
|
-
class
|
|
20
|
-
constructor(e, t,
|
|
21
|
-
o(this, "changeValue", void 0), o(this, "currentValues", void 0), o(this, "currentValidations", void 0), o(this, "shouldValidate", void 0), o(this, "cachedMessages", void 0), this.changeValue = e, this.currentValues = t, this.currentValidations =
|
|
19
|
+
class f {
|
|
20
|
+
constructor(e, t, n, l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map()) {
|
|
21
|
+
o(this, "changeValue", void 0), o(this, "currentValues", void 0), o(this, "currentValidations", void 0), o(this, "shouldValidate", void 0), o(this, "cachedMessages", void 0), this.changeValue = e, this.currentValues = t, this.currentValidations = n, this.shouldValidate = l, this.cachedMessages = u;
|
|
22
22
|
}
|
|
23
23
|
isValid() {
|
|
24
24
|
if (!this.currentValidations) return !0;
|
|
@@ -30,18 +30,18 @@ class v {
|
|
|
30
30
|
return !0;
|
|
31
31
|
}
|
|
32
32
|
getInputProps(e) {
|
|
33
|
-
const t = this.currentValues[e],
|
|
34
|
-
let
|
|
35
|
-
return this.shouldValidate.has(e) ? (
|
|
33
|
+
const t = this.currentValues[e], n = t ?? null, l = e, u = this.currentValidations && this.currentValidations[e] ? this.currentValidations[e] : (s) => null;
|
|
34
|
+
let a = null;
|
|
35
|
+
return this.shouldValidate.has(e) ? (a = u(t, this.currentValues), this.cachedMessages.set(e, a)) : a = this.cachedMessages.get(e) ?? null, {
|
|
36
36
|
// @ts-ignore – z.B. wenn dein Input `defaultValue` kennt
|
|
37
|
-
defaultValue:
|
|
38
|
-
initialValue:
|
|
37
|
+
defaultValue: n ?? void 0,
|
|
38
|
+
initialValue: n ?? void 0,
|
|
39
39
|
formValidation: {
|
|
40
|
-
setValue: (
|
|
41
|
-
this.changeValue(
|
|
40
|
+
setValue: (s) => {
|
|
41
|
+
this.changeValue(l, s);
|
|
42
42
|
},
|
|
43
|
-
notValidMessage:
|
|
44
|
-
valid:
|
|
43
|
+
notValidMessage: a,
|
|
44
|
+
valid: a === null
|
|
45
45
|
},
|
|
46
46
|
...this.currentValidations && this.currentValidations[e] ? {
|
|
47
47
|
required: !0
|
|
@@ -49,31 +49,28 @@ class v {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
const
|
|
52
|
+
const E = (i) => {
|
|
53
53
|
const {
|
|
54
54
|
initialValues: e,
|
|
55
55
|
validate: t = {},
|
|
56
|
-
truthyValidationBeforeSubmit:
|
|
57
|
-
useInitialValidation:
|
|
58
|
-
onSubmit:
|
|
59
|
-
} = i,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, [])
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
g(h), !new Set(Object.keys(e)).has(String(n)) && r && (!a || h.isValid()) && r(c.current);
|
|
74
|
-
}, [d, t, r, a, e]);
|
|
75
|
-
return [M, S];
|
|
56
|
+
truthyValidationBeforeSubmit: n = !0,
|
|
57
|
+
useInitialValidation: l = !0,
|
|
58
|
+
onSubmit: u
|
|
59
|
+
} = i, a = j.useMemo(() => e, []), [s, p] = g(a), d = y(/* @__PURE__ */ new Map()), c = w((r, h) => {
|
|
60
|
+
p((V) => ({
|
|
61
|
+
...V,
|
|
62
|
+
[r]: h
|
|
63
|
+
}));
|
|
64
|
+
}, []), [b, v] = g(new f(c, s, t, l ? new Map(Object.keys(a).map((r) => [r, !0])) : /* @__PURE__ */ new Map(), d.current));
|
|
65
|
+
P(() => {
|
|
66
|
+
p(a), v(new f(c, a, t, l ? new Map(Object.keys(a).map((r) => [r, !0])) : /* @__PURE__ */ new Map(), d.current));
|
|
67
|
+
}, [a]);
|
|
68
|
+
const M = w((r, h = !0) => {
|
|
69
|
+
const V = r && new Set(Object.keys(s)).has(String(r)) ? /* @__PURE__ */ new Map([[r, !0]]) : new Map(Object.keys(s).map((S) => [String(S), !0])), m = new f(c, s, t, V, d.current);
|
|
70
|
+
v(m), h && !new Set(Object.keys(s)).has(String(r)) && u && (!n || m.isValid()) && u(s);
|
|
71
|
+
}, [c, t, u, n, s]);
|
|
72
|
+
return [b, M, s];
|
|
76
73
|
};
|
|
77
74
|
export {
|
|
78
|
-
|
|
75
|
+
E as useForm
|
|
79
76
|
};
|