@okam/stack-ui 1.32.2 → 1.32.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/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.mjs +145 -144
- package/index101.js +1 -1
- package/index101.mjs +1 -1
- package/index102.js +1 -1
- package/index102.mjs +3 -3
- package/index103.js +1 -1
- package/index103.mjs +1 -1
- package/index110.js +1 -1
- package/index110.mjs +5 -5
- package/index111.js +1 -1
- package/index111.mjs +2 -2
- package/index112.js +1 -1
- package/index112.mjs +1 -1
- package/index113.js +1 -1
- package/index113.mjs +2 -2
- package/index115.js +1 -1
- package/index115.mjs +4 -4
- package/index116.js +1 -1
- package/index116.mjs +2 -2
- package/index120.js +1 -1
- package/index120.mjs +4 -4
- package/index121.js +1 -1
- package/index121.mjs +2 -2
- package/index125.js +1 -1
- package/index125.mjs +2 -2
- package/index126.js +1 -1
- package/index126.mjs +3 -3
- package/index130.js +1 -1
- package/index130.mjs +2 -2
- package/index133.js +1 -1
- package/index133.mjs +1 -1
- package/index139.js +1 -1
- package/index139.mjs +52 -46
- package/index140.js +1 -1
- package/index140.mjs +46 -241
- package/index141.js +1 -2
- package/index141.mjs +241 -13
- package/index142.js +2 -1
- package/index142.mjs +12 -29
- package/index143.js +1 -1
- package/index143.mjs +30 -52
- package/index144.js +1 -1
- package/index144.mjs +1 -1
- package/index145.js +1 -1
- package/index145.mjs +5 -5
- package/index146.js +1 -1
- package/index146.mjs +3 -3
- package/index147.js +1 -1
- package/index147.mjs +2 -2
- package/index148.js +1 -1
- package/index148.mjs +3 -3
- package/index149.js +1 -1
- package/index149.mjs +3 -3
- package/index151.js +1 -1
- package/index151.mjs +2 -2
- package/index152.js +1 -1
- package/index152.mjs +106 -20
- package/index153.js +1 -1
- package/index153.mjs +83 -107
- package/index154.js +1 -1
- package/index154.mjs +26 -83
- package/index155.js +1 -1
- package/index155.mjs +20 -25
- package/index156.js +1 -1
- package/index156.mjs +17 -123
- package/index157.js +1 -1
- package/index157.mjs +122 -24
- package/index158.js +1 -1
- package/index158.mjs +71 -17
- package/index159.js +1 -1
- package/index159.mjs +338 -62
- package/index160.js +1 -1
- package/index160.mjs +42 -346
- package/index161.js +1 -1
- package/index161.mjs +29 -43
- package/index162.js +1 -1
- package/index162.mjs +24 -28
- package/index164.js +1 -1
- package/index164.mjs +2 -2
- package/index167.js +1 -1
- package/index167.mjs +3 -3
- package/index169.js +1 -1
- package/index169.mjs +1 -1
- package/index170.js +1 -1
- package/index170.mjs +1 -1
- package/index171.js +1 -1
- package/index171.mjs +1 -1
- package/index173.js +1 -1
- package/index173.mjs +1 -1
- package/index175.js +1 -1
- package/index175.mjs +1 -1
- package/index176.js +1 -1
- package/index176.mjs +1 -1
- package/index178.js +1 -1
- package/index178.mjs +2 -2
- package/index179.js +1 -1
- package/index179.mjs +1 -1
- package/index180.js +1 -1
- package/index180.mjs +2 -2
- package/index182.js +1 -1
- package/index182.mjs +1 -1
- package/index198.js +1 -1
- package/index198.mjs +2 -2
- package/index199.js +1 -1
- package/index199.mjs +1 -1
- package/index200.js +1 -1
- package/index200.mjs +3 -3
- package/index204.js +1 -1
- package/index204.mjs +2 -2
- package/index205.js +1 -1
- package/index205.mjs +1 -1
- package/index314.js +1 -1
- package/index314.mjs +20 -136
- package/index315.js +1 -1
- package/index315.mjs +39 -189
- package/index316.js +1 -1
- package/index316.mjs +5 -22
- package/index317.js +1 -1
- package/index317.mjs +6 -29
- package/index318.js +1 -1
- package/index318.mjs +14 -46
- package/index319.js +1 -1
- package/index319.mjs +23 -47
- package/index320.js +1 -1
- package/index320.mjs +25 -97
- package/index321.js +1 -1
- package/index321.mjs +30 -4
- package/index322.js +1 -1
- package/index322.mjs +29 -72
- package/index323.js +1 -1
- package/index323.mjs +8 -57
- package/index324.js +1 -1
- package/index324.mjs +5 -7
- package/index325.js +1 -1
- package/index325.mjs +7 -11
- package/index326.js +1 -1
- package/index326.mjs +13 -47
- package/index327.js +1 -1
- package/index327.mjs +8 -24
- package/index328.js +1 -1
- package/index328.mjs +141 -6
- package/index329.js +1 -1
- package/index329.mjs +197 -14
- package/index330.js +1 -1
- package/index330.mjs +22 -24
- package/index331.js +1 -1
- package/index331.mjs +44 -26
- package/index332.js +1 -1
- package/index332.mjs +46 -29
- package/index333.js +1 -1
- package/index333.mjs +99 -8
- package/index334.js +1 -1
- package/index334.mjs +72 -6
- package/index335.js +1 -1
- package/index335.mjs +58 -7
- package/index336.js +1 -1
- package/index336.mjs +7 -13
- package/index337.js +1 -1
- package/index337.mjs +11 -8
- package/index338.js +1 -1
- package/index338.mjs +7 -4
- package/index339.js +1 -1
- package/index339.mjs +68 -6
- package/index340.js +1 -1
- package/index340.mjs +27 -65
- package/index341.js +1 -1
- package/index341.mjs +6 -30
- package/index342.js +1 -1
- package/index342.mjs +6 -6
- package/index343.js +1 -1
- package/index343.mjs +20 -6
- package/index344.js +1 -1
- package/index344.mjs +3 -20
- package/package.json +1 -1
package/index156.mjs
CHANGED
|
@@ -1,128 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
rangeUnderflow: !1,
|
|
8
|
-
stepMismatch: !1,
|
|
9
|
-
tooLong: !1,
|
|
10
|
-
tooShort: !1,
|
|
11
|
-
typeMismatch: !1,
|
|
12
|
-
valueMissing: !1,
|
|
13
|
-
valid: !0
|
|
14
|
-
}, L = {
|
|
15
|
-
...D,
|
|
16
|
-
customError: !0,
|
|
17
|
-
valid: !1
|
|
18
|
-
}, u = {
|
|
19
|
-
isInvalid: !1,
|
|
20
|
-
validationDetails: D,
|
|
21
|
-
validationErrors: []
|
|
22
|
-
}, B = O({}), h = "__formValidationState" + Date.now();
|
|
23
|
-
function P(a) {
|
|
24
|
-
if (a[h]) {
|
|
25
|
-
let { realtimeValidation: e, displayValidation: t, updateValidation: i, resetValidation: o, commitValidation: l } = a[h];
|
|
26
|
-
return {
|
|
27
|
-
realtimeValidation: e,
|
|
28
|
-
displayValidation: t,
|
|
29
|
-
updateValidation: i,
|
|
30
|
-
resetValidation: o,
|
|
31
|
-
commitValidation: l
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return Q(a);
|
|
35
|
-
}
|
|
36
|
-
function Q(a) {
|
|
37
|
-
let { isInvalid: e, validationState: t, name: i, value: o, builtinValidation: l, validate: d, validationBehavior: n = "aria" } = a;
|
|
38
|
-
t && (e || (e = t === "invalid"));
|
|
39
|
-
let v = e !== void 0 ? {
|
|
40
|
-
isInvalid: e,
|
|
41
|
-
validationErrors: [],
|
|
42
|
-
validationDetails: L
|
|
43
|
-
} : null, V = I(() => {
|
|
44
|
-
if (!d || o == null) return null;
|
|
45
|
-
let r = Y(d, o);
|
|
46
|
-
return C(r);
|
|
47
|
-
}, [
|
|
48
|
-
d,
|
|
49
|
-
o
|
|
50
|
-
]);
|
|
51
|
-
l != null && l.validationDetails.valid && (l = void 0);
|
|
52
|
-
let s = U(B), A = I(() => i ? Array.isArray(i) ? i.flatMap((r) => S(s[r])) : S(s[i]) : [], [
|
|
53
|
-
s,
|
|
54
|
-
i
|
|
55
|
-
]), [M, _] = f(s), [x, m] = f(!1);
|
|
56
|
-
s !== M && (_(s), m(!1));
|
|
57
|
-
let $ = I(() => C(x ? [] : A), [
|
|
58
|
-
x,
|
|
59
|
-
A
|
|
60
|
-
]), g = T(u), [b, E] = f(u), c = T(u), w = () => {
|
|
61
|
-
if (!F) return;
|
|
62
|
-
p(!1);
|
|
63
|
-
let r = V || l || g.current;
|
|
64
|
-
y(r, c.current) || (c.current = r, E(r));
|
|
65
|
-
}, [F, p] = f(!1);
|
|
66
|
-
return R(w), {
|
|
67
|
-
realtimeValidation: v || $ || V || l || u,
|
|
68
|
-
displayValidation: n === "native" ? v || $ || b : v || $ || V || l || b,
|
|
69
|
-
updateValidation(r) {
|
|
70
|
-
n === "aria" && !y(b, r) ? E(r) : g.current = r;
|
|
71
|
-
},
|
|
72
|
-
resetValidation() {
|
|
73
|
-
let r = u;
|
|
74
|
-
y(r, c.current) || (c.current = r, E(r)), n === "native" && p(!1), m(!0);
|
|
75
|
-
},
|
|
76
|
-
commitValidation() {
|
|
77
|
-
n === "native" && p(!0), m(!0);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
function S(a) {
|
|
82
|
-
return a ? Array.isArray(a) ? a : [
|
|
83
|
-
a
|
|
84
|
-
] : [];
|
|
85
|
-
}
|
|
86
|
-
function Y(a, e) {
|
|
87
|
-
if (typeof a == "function") {
|
|
88
|
-
let t = a(e);
|
|
89
|
-
if (t && typeof t != "boolean") return S(t);
|
|
90
|
-
}
|
|
91
|
-
return [];
|
|
92
|
-
}
|
|
93
|
-
function C(a) {
|
|
94
|
-
return a.length ? {
|
|
95
|
-
isInvalid: !0,
|
|
96
|
-
validationErrors: a,
|
|
97
|
-
validationDetails: L
|
|
98
|
-
} : null;
|
|
99
|
-
}
|
|
100
|
-
function y(a, e) {
|
|
101
|
-
return a === e ? !0 : !!a && !!e && a.isInvalid === e.isInvalid && a.validationErrors.length === e.validationErrors.length && a.validationErrors.every((t, i) => t === e.validationErrors[i]) && Object.entries(a.validationDetails).every(([t, i]) => e.validationDetails[t] === i);
|
|
102
|
-
}
|
|
103
|
-
function k(...a) {
|
|
104
|
-
let e = /* @__PURE__ */ new Set(), t = !1, i = {
|
|
105
|
-
...D
|
|
1
|
+
import { chain as n } from "./index316.mjs";
|
|
2
|
+
import { mergeIds as s } from "./index139.mjs";
|
|
3
|
+
import { clsx as l } from "./index318.mjs";
|
|
4
|
+
function a(...r) {
|
|
5
|
+
let o = {
|
|
6
|
+
...r[0]
|
|
106
7
|
};
|
|
107
|
-
for (let
|
|
108
|
-
|
|
109
|
-
for (let
|
|
110
|
-
|
|
111
|
-
|
|
8
|
+
for (let c = 1; c < r.length; c++) {
|
|
9
|
+
let i = r[c];
|
|
10
|
+
for (let e in i) {
|
|
11
|
+
let f = o[e], t = i[e];
|
|
12
|
+
typeof f == "function" && typeof t == "function" && // This is a lot faster than a regex.
|
|
13
|
+
e[0] === "o" && e[1] === "n" && e.charCodeAt(2) >= /* 'A' */
|
|
14
|
+
65 && e.charCodeAt(2) <= /* 'Z' */
|
|
15
|
+
90 ? o[e] = n(f, t) : (e === "className" || e === "UNSAFE_className") && typeof f == "string" && typeof t == "string" ? o[e] = l(f, t) : e === "id" && f && t ? o.id = s(f, t) : o[e] = t !== void 0 ? t : f;
|
|
16
|
+
}
|
|
112
17
|
}
|
|
113
|
-
return
|
|
114
|
-
isInvalid: t,
|
|
115
|
-
validationErrors: [
|
|
116
|
-
...e
|
|
117
|
-
],
|
|
118
|
-
validationDetails: i
|
|
119
|
-
};
|
|
18
|
+
return o;
|
|
120
19
|
}
|
|
121
20
|
export {
|
|
122
|
-
|
|
123
|
-
B as FormValidationContext,
|
|
124
|
-
D as VALID_VALIDITY_STATE,
|
|
125
|
-
k as mergeValidation,
|
|
126
|
-
h as privateValidationStateProp,
|
|
127
|
-
P as useFormValidationState
|
|
21
|
+
a as mergeProps
|
|
128
22
|
};
|
package/index157.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),v={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},x={...v,customError:!0,valid:!1},c={isInvalid:!1,validationDetails:v,validationErrors:[]},h=n.createContext({}),I="__formValidationState"+Date.now();function R(e){if(e[I]){let{realtimeValidation:a,displayValidation:t,updateValidation:i,resetValidation:d,commitValidation:l}=e[I];return{realtimeValidation:a,displayValidation:t,updateValidation:i,resetValidation:d,commitValidation:l}}return w(e)}function w(e){let{isInvalid:a,validationState:t,name:i,value:d,builtinValidation:l,validate:s,validationBehavior:o="aria"}=e;t&&(a||(a=t==="invalid"));let V=a!==void 0?{isInvalid:a,validationErrors:[],validationDetails:x}:null,m=n.useMemo(()=>{if(!s||d==null)return null;let r=F(s,d);return T(r)},[s,d]);l!=null&&l.validationDetails.valid&&(l=void 0);let u=n.useContext(h),A=n.useMemo(()=>i?Array.isArray(i)?i.flatMap(r=>D(u[r])):D(u[i]):[],[u,i]),[C,L]=n.useState(u),[g,$]=n.useState(!1);u!==C&&(L(u),$(!1));let b=n.useMemo(()=>T(g?[]:A),[g,A]),M=n.useRef(c),[E,p]=n.useState(c),f=n.useRef(c),_=()=>{if(!O)return;S(!1);let r=m||l||M.current;y(r,f.current)||(f.current=r,p(r))},[O,S]=n.useState(!1);return n.useEffect(_),{realtimeValidation:V||b||m||l||c,displayValidation:o==="native"?V||b||E:V||b||m||l||E,updateValidation(r){o==="aria"&&!y(E,r)?p(r):M.current=r},resetValidation(){let r=c;y(r,f.current)||(f.current=r,p(r)),o==="native"&&S(!1),$(!0)},commitValidation(){o==="native"&&S(!0),$(!0)}}}function D(e){return e?Array.isArray(e)?e:[e]:[]}function F(e,a){if(typeof e=="function"){let t=e(a);if(t&&typeof t!="boolean")return D(t)}return[]}function T(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:x}:null}function y(e,a){return e===a?!0:!!e&&!!a&&e.isInvalid===a.isInvalid&&e.validationErrors.length===a.validationErrors.length&&e.validationErrors.every((t,i)=>t===a.validationErrors[i])&&Object.entries(e.validationDetails).every(([t,i])=>a.validationDetails[t]===i)}function U(...e){let a=new Set,t=!1,i={...v};for(let s of e){var d,l;for(let o of s.validationErrors)a.add(o);t||(t=s.isInvalid);for(let o in i)(d=i)[l=o]||(d[l]=s.validationDetails[o])}return i.valid=!t,{isInvalid:t,validationErrors:[...a],validationDetails:i}}exports.DEFAULT_VALIDATION_RESULT=c;exports.FormValidationContext=h;exports.VALID_VALIDITY_STATE=v;exports.mergeValidation=U;exports.privateValidationStateProp=I;exports.useFormValidationState=R;
|
package/index157.mjs
CHANGED
|
@@ -1,30 +1,128 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { createContext as O, useMemo as I, useContext as U, useState as f, useRef as T, useEffect as R } from "react";
|
|
2
|
+
const D = {
|
|
3
|
+
badInput: !1,
|
|
4
|
+
customError: !1,
|
|
5
|
+
patternMismatch: !1,
|
|
6
|
+
rangeOverflow: !1,
|
|
7
|
+
rangeUnderflow: !1,
|
|
8
|
+
stepMismatch: !1,
|
|
9
|
+
tooLong: !1,
|
|
10
|
+
tooShort: !1,
|
|
11
|
+
typeMismatch: !1,
|
|
12
|
+
valueMissing: !1,
|
|
13
|
+
valid: !0
|
|
14
|
+
}, L = {
|
|
15
|
+
...D,
|
|
16
|
+
customError: !0,
|
|
17
|
+
valid: !1
|
|
18
|
+
}, u = {
|
|
19
|
+
isInvalid: !1,
|
|
20
|
+
validationDetails: D,
|
|
21
|
+
validationErrors: []
|
|
22
|
+
}, B = O({}), h = "__formValidationState" + Date.now();
|
|
23
|
+
function P(a) {
|
|
24
|
+
if (a[h]) {
|
|
25
|
+
let { realtimeValidation: e, displayValidation: t, updateValidation: i, resetValidation: o, commitValidation: l } = a[h];
|
|
26
|
+
return {
|
|
27
|
+
realtimeValidation: e,
|
|
28
|
+
displayValidation: t,
|
|
29
|
+
updateValidation: i,
|
|
30
|
+
resetValidation: o,
|
|
31
|
+
commitValidation: l
|
|
13
32
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
33
|
+
}
|
|
34
|
+
return Q(a);
|
|
35
|
+
}
|
|
36
|
+
function Q(a) {
|
|
37
|
+
let { isInvalid: e, validationState: t, name: i, value: o, builtinValidation: l, validate: d, validationBehavior: n = "aria" } = a;
|
|
38
|
+
t && (e || (e = t === "invalid"));
|
|
39
|
+
let v = e !== void 0 ? {
|
|
40
|
+
isInvalid: e,
|
|
41
|
+
validationErrors: [],
|
|
42
|
+
validationDetails: L
|
|
43
|
+
} : null, V = I(() => {
|
|
44
|
+
if (!d || o == null) return null;
|
|
45
|
+
let r = Y(d, o);
|
|
46
|
+
return C(r);
|
|
18
47
|
}, [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
c
|
|
48
|
+
d,
|
|
49
|
+
o
|
|
22
50
|
]);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
51
|
+
l != null && l.validationDetails.valid && (l = void 0);
|
|
52
|
+
let s = U(B), A = I(() => i ? Array.isArray(i) ? i.flatMap((r) => S(s[r])) : S(s[i]) : [], [
|
|
53
|
+
s,
|
|
54
|
+
i
|
|
55
|
+
]), [M, _] = f(s), [x, m] = f(!1);
|
|
56
|
+
s !== M && (_(s), m(!1));
|
|
57
|
+
let $ = I(() => C(x ? [] : A), [
|
|
58
|
+
x,
|
|
59
|
+
A
|
|
60
|
+
]), g = T(u), [b, E] = f(u), c = T(u), w = () => {
|
|
61
|
+
if (!F) return;
|
|
62
|
+
p(!1);
|
|
63
|
+
let r = V || l || g.current;
|
|
64
|
+
y(r, c.current) || (c.current = r, E(r));
|
|
65
|
+
}, [F, p] = f(!1);
|
|
66
|
+
return R(w), {
|
|
67
|
+
realtimeValidation: v || $ || V || l || u,
|
|
68
|
+
displayValidation: n === "native" ? v || $ || b : v || $ || V || l || b,
|
|
69
|
+
updateValidation(r) {
|
|
70
|
+
n === "aria" && !y(b, r) ? E(r) : g.current = r;
|
|
71
|
+
},
|
|
72
|
+
resetValidation() {
|
|
73
|
+
let r = u;
|
|
74
|
+
y(r, c.current) || (c.current = r, E(r)), n === "native" && p(!1), m(!0);
|
|
75
|
+
},
|
|
76
|
+
commitValidation() {
|
|
77
|
+
n === "native" && p(!0), m(!0);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function S(a) {
|
|
82
|
+
return a ? Array.isArray(a) ? a : [
|
|
83
|
+
a
|
|
84
|
+
] : [];
|
|
85
|
+
}
|
|
86
|
+
function Y(a, e) {
|
|
87
|
+
if (typeof a == "function") {
|
|
88
|
+
let t = a(e);
|
|
89
|
+
if (t && typeof t != "boolean") return S(t);
|
|
90
|
+
}
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
function C(a) {
|
|
94
|
+
return a.length ? {
|
|
95
|
+
isInvalid: !0,
|
|
96
|
+
validationErrors: a,
|
|
97
|
+
validationDetails: L
|
|
98
|
+
} : null;
|
|
99
|
+
}
|
|
100
|
+
function y(a, e) {
|
|
101
|
+
return a === e ? !0 : !!a && !!e && a.isInvalid === e.isInvalid && a.validationErrors.length === e.validationErrors.length && a.validationErrors.every((t, i) => t === e.validationErrors[i]) && Object.entries(a.validationDetails).every(([t, i]) => e.validationDetails[t] === i);
|
|
102
|
+
}
|
|
103
|
+
function k(...a) {
|
|
104
|
+
let e = /* @__PURE__ */ new Set(), t = !1, i = {
|
|
105
|
+
...D
|
|
106
|
+
};
|
|
107
|
+
for (let d of a) {
|
|
108
|
+
var o, l;
|
|
109
|
+
for (let n of d.validationErrors) e.add(n);
|
|
110
|
+
t || (t = d.isInvalid);
|
|
111
|
+
for (let n in i) (o = i)[l = n] || (o[l] = d.validationDetails[n]);
|
|
112
|
+
}
|
|
113
|
+
return i.valid = !t, {
|
|
114
|
+
isInvalid: t,
|
|
115
|
+
validationErrors: [
|
|
116
|
+
...e
|
|
117
|
+
],
|
|
118
|
+
validationDetails: i
|
|
119
|
+
};
|
|
27
120
|
}
|
|
28
121
|
export {
|
|
29
|
-
|
|
122
|
+
u as DEFAULT_VALIDATION_RESULT,
|
|
123
|
+
B as FormValidationContext,
|
|
124
|
+
D as VALID_VALIDITY_STATE,
|
|
125
|
+
k as mergeValidation,
|
|
126
|
+
h as privateValidationStateProp,
|
|
127
|
+
P as useFormValidationState
|
|
30
128
|
};
|
package/index158.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index204.js"),f=require("react"),E=require("./index172.js"),v=require("./index326.js");function g(i,e,t){let{validationBehavior:s,focus:u}=i;E.useLayoutEffect(()=>{if(s==="native"&&(t!=null&&t.current)){let n=e.realtimeValidation.isInvalid?e.realtimeValidation.validationErrors.join(" ")||"Invalid value.":"";t.current.setCustomValidity(n),t.current.hasAttribute("title")||(t.current.title=""),e.realtimeValidation.isInvalid||e.updateValidation(h(t.current))}});let o=v.useEffectEvent(()=>{e.resetValidation()}),l=v.useEffectEvent(n=>{var a;e.displayValidation.isInvalid||e.commitValidation();let c=t==null||(a=t.current)===null||a===void 0?void 0:a.form;if(!n.defaultPrevented&&t&&c&&M(c)===t.current){var d;u?u():(d=t.current)===null||d===void 0||d.focus(),m.setInteractionModality("keyboard")}n.preventDefault()}),r=v.useEffectEvent(()=>{e.commitValidation()});f.useEffect(()=>{let n=t==null?void 0:t.current;if(!n)return;let a=n.form;return n.addEventListener("invalid",l),n.addEventListener("change",r),a==null||a.addEventListener("reset",o),()=>{n.removeEventListener("invalid",l),n.removeEventListener("change",r),a==null||a.removeEventListener("reset",o)}},[t,l,r,o,s])}function y(i){let e=i.validity;return{badInput:e.badInput,customError:e.customError,patternMismatch:e.patternMismatch,rangeOverflow:e.rangeOverflow,rangeUnderflow:e.rangeUnderflow,stepMismatch:e.stepMismatch,tooLong:e.tooLong,tooShort:e.tooShort,typeMismatch:e.typeMismatch,valueMissing:e.valueMissing,valid:e.valid}}function h(i){return{isInvalid:!i.validity.valid,validationDetails:y(i),validationErrors:i.validationMessage?[i.validationMessage]:[]}}function M(i){for(let e=0;e<i.elements.length;e++){let t=i.elements[e];if(!t.validity.valid)return t}return null}exports.useFormValidation=g;
|
package/index158.mjs
CHANGED
|
@@ -1,22 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { setInteractionModality as m } from "./index204.mjs";
|
|
2
|
+
import { useEffect as f } from "react";
|
|
3
|
+
import { useLayoutEffect as $ } from "./index172.mjs";
|
|
4
|
+
import { useEffectEvent as v } from "./index326.mjs";
|
|
5
|
+
function V(t, i, e) {
|
|
6
|
+
let { validationBehavior: s, focus: u } = t;
|
|
7
|
+
$(() => {
|
|
8
|
+
if (s === "native" && (e != null && e.current)) {
|
|
9
|
+
let a = i.realtimeValidation.isInvalid ? i.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
|
|
10
|
+
e.current.setCustomValidity(a), e.current.hasAttribute("title") || (e.current.title = ""), i.realtimeValidation.isInvalid || i.updateValidation(g(e.current));
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
let o = v(() => {
|
|
14
|
+
i.resetValidation();
|
|
15
|
+
}), l = v((a) => {
|
|
16
|
+
var n;
|
|
17
|
+
i.displayValidation.isInvalid || i.commitValidation();
|
|
18
|
+
let c = e == null || (n = e.current) === null || n === void 0 ? void 0 : n.form;
|
|
19
|
+
if (!a.defaultPrevented && e && c && h(c) === e.current) {
|
|
20
|
+
var d;
|
|
21
|
+
u ? u() : (d = e.current) === null || d === void 0 || d.focus(), m("keyboard");
|
|
16
22
|
}
|
|
23
|
+
a.preventDefault();
|
|
24
|
+
}), r = v(() => {
|
|
25
|
+
i.commitValidation();
|
|
26
|
+
});
|
|
27
|
+
f(() => {
|
|
28
|
+
let a = e == null ? void 0 : e.current;
|
|
29
|
+
if (!a) return;
|
|
30
|
+
let n = a.form;
|
|
31
|
+
return a.addEventListener("invalid", l), a.addEventListener("change", r), n == null || n.addEventListener("reset", o), () => {
|
|
32
|
+
a.removeEventListener("invalid", l), a.removeEventListener("change", r), n == null || n.removeEventListener("reset", o);
|
|
33
|
+
};
|
|
34
|
+
}, [
|
|
35
|
+
e,
|
|
36
|
+
l,
|
|
37
|
+
r,
|
|
38
|
+
o,
|
|
39
|
+
s
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
function p(t) {
|
|
43
|
+
let i = t.validity;
|
|
44
|
+
return {
|
|
45
|
+
badInput: i.badInput,
|
|
46
|
+
customError: i.customError,
|
|
47
|
+
patternMismatch: i.patternMismatch,
|
|
48
|
+
rangeOverflow: i.rangeOverflow,
|
|
49
|
+
rangeUnderflow: i.rangeUnderflow,
|
|
50
|
+
stepMismatch: i.stepMismatch,
|
|
51
|
+
tooLong: i.tooLong,
|
|
52
|
+
tooShort: i.tooShort,
|
|
53
|
+
typeMismatch: i.typeMismatch,
|
|
54
|
+
valueMissing: i.valueMissing,
|
|
55
|
+
valid: i.valid
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function g(t) {
|
|
59
|
+
return {
|
|
60
|
+
isInvalid: !t.validity.valid,
|
|
61
|
+
validationDetails: p(t),
|
|
62
|
+
validationErrors: t.validationMessage ? [
|
|
63
|
+
t.validationMessage
|
|
64
|
+
] : []
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function h(t) {
|
|
68
|
+
for (let i = 0; i < t.elements.length; i++) {
|
|
69
|
+
let e = t.elements[i];
|
|
70
|
+
if (!e.validity.valid) return e;
|
|
17
71
|
}
|
|
18
|
-
return
|
|
72
|
+
return null;
|
|
19
73
|
}
|
|
20
74
|
export {
|
|
21
|
-
|
|
75
|
+
V as useFormValidation
|
|
22
76
|
};
|
package/index159.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index204.js"),f=require("react"),E=require("./index172.js"),v=require("./index336.js");function g(i,e,t){let{validationBehavior:s,focus:u}=i;E.useLayoutEffect(()=>{if(s==="native"&&(t!=null&&t.current)){let n=e.realtimeValidation.isInvalid?e.realtimeValidation.validationErrors.join(" ")||"Invalid value.":"";t.current.setCustomValidity(n),t.current.hasAttribute("title")||(t.current.title=""),e.realtimeValidation.isInvalid||e.updateValidation(h(t.current))}});let o=v.useEffectEvent(()=>{e.resetValidation()}),l=v.useEffectEvent(n=>{var a;e.displayValidation.isInvalid||e.commitValidation();let c=t==null||(a=t.current)===null||a===void 0?void 0:a.form;if(!n.defaultPrevented&&t&&c&&M(c)===t.current){var d;u?u():(d=t.current)===null||d===void 0||d.focus(),m.setInteractionModality("keyboard")}n.preventDefault()}),r=v.useEffectEvent(()=>{e.commitValidation()});f.useEffect(()=>{let n=t==null?void 0:t.current;if(!n)return;let a=n.form;return n.addEventListener("invalid",l),n.addEventListener("change",r),a==null||a.addEventListener("reset",o),()=>{n.removeEventListener("invalid",l),n.removeEventListener("change",r),a==null||a.removeEventListener("reset",o)}},[t,l,r,o,s])}function y(i){let e=i.validity;return{badInput:e.badInput,customError:e.customError,patternMismatch:e.patternMismatch,rangeOverflow:e.rangeOverflow,rangeUnderflow:e.rangeUnderflow,stepMismatch:e.stepMismatch,tooLong:e.tooLong,tooShort:e.tooShort,typeMismatch:e.typeMismatch,valueMissing:e.valueMissing,valid:e.valid}}function h(i){return{isInvalid:!i.validity.valid,validationDetails:y(i),validationErrors:i.validationMessage?[i.validationMessage]:[]}}function M(i){for(let e=0;e<i.elements.length;e++){let t=i.elements[e];if(!t.validity.valid)return t}return null}exports.useFormValidation=g;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./index340.js"),te=require("./index338.js"),re=require("./index341.js"),ne=require("./index187.js"),H=require("./index342.js"),ie=require("./index316.js"),S=require("./index317.js"),j=require("./index156.js"),X=require("./index202.js"),G=require("./index319.js"),se=require("./index321.js"),oe=require("./index323.js"),ae=require("./index174.js"),A=require("./index327.js"),C=require("./index326.js"),I=require("react");function ue(i){let s=I.useContext(te.PressResponderContext);if(s){let{register:a,...u}=s;i=j.mergeProps(u,i),a()}return oe.useSyncRef(s,i.ref),i}var Y=new WeakMap;class _{continuePropagation(){H._(this,Y,!1)}get shouldStopPropagation(){return re._(this,Y)}constructor(s,a,u,f){ne._(this,Y,{writable:!0,value:void 0}),H._(this,Y,!0);var T;let g=(T=f==null?void 0:f.target)!==null&&T!==void 0?T:u.currentTarget;const O=g==null?void 0:g.getBoundingClientRect();let P,D=0,d,L=null;u.clientX!=null&&u.clientY!=null&&(d=u.clientX,L=u.clientY),O&&(d!=null&&L!=null?(P=d-O.left,D=L-O.top):(P=O.width/2,D=O.height/2)),this.type=s,this.pointerType=a,this.target=u.currentTarget,this.shiftKey=u.shiftKey,this.metaKey=u.metaKey,this.ctrlKey=u.ctrlKey,this.altKey=u.altKey,this.x=P,this.y=D}}const V=Symbol("linkClicked");function le(i){let{onPress:s,onPressChange:a,onPressStart:u,onPressEnd:f,onPressUp:T,isDisabled:g,isPressed:O,preventFocusOnPress:P,shouldCancelOnPointerExit:D,allowTextSelectionOnPress:d,ref:L,...Q}=ue(i),[Z,F]=I.useState(!1),b=I.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:m,removeAllGlobalListeners:M}=se.useGlobalListeners(),y=C.useEffectEvent((e,o)=>{let v=b.current;if(g||v.didFirePressStart)return!1;let n=!0;if(v.isTriggeringEvent=!0,u){let c=new _("pressstart",o,e);u(c),n=c.shouldStopPropagation}return a&&a(!0),v.isTriggeringEvent=!1,v.didFirePressStart=!0,F(!0),n}),p=C.useEffectEvent((e,o,v=!0)=>{let n=b.current;if(!n.didFirePressStart)return!1;n.ignoreClickAfterPress=!0,n.didFirePressStart=!1,n.isTriggeringEvent=!0;let c=!0;if(f){let t=new _("pressend",o,e);f(t),c=t.shouldStopPropagation}if(a&&a(!1),F(!1),s&&v&&!g){let t=new _("press",o,e);s(t),c&&(c=t.shouldStopPropagation)}return n.isTriggeringEvent=!1,c}),k=C.useEffectEvent((e,o)=>{let v=b.current;if(g)return!1;if(T){v.isTriggeringEvent=!0;let n=new _("pressup",o,e);return T(n),v.isTriggeringEvent=!1,n.shouldStopPropagation}return!0}),K=C.useEffectEvent(e=>{let o=b.current;o.isPressed&&o.target&&(o.isOverTarget&&o.pointerType!=null&&p(E(o.target,e),o.pointerType,!1),o.isPressed=!1,o.isOverTarget=!1,o.activePointerId=null,o.pointerType=null,M(),d||w.restoreTextSelection(o.target))}),q=C.useEffectEvent(e=>{D&&K(e)}),ee=I.useMemo(()=>{let e=b.current,o={onKeyDown(n){if(R(n.nativeEvent,n.currentTarget)&&n.currentTarget.contains(n.target)){var c;N(n.target,n.key)&&n.preventDefault();let t=!0;if(!e.isPressed&&!n.repeat){e.target=n.currentTarget,e.isPressed=!0,t=y(n,"keyboard");let l=n.currentTarget,r=h=>{R(h,l)&&!h.repeat&&l.contains(h.target)&&e.target&&k(E(e.target,h),"keyboard")};m(S.getOwnerDocument(n.currentTarget),"keyup",ie.chain(r,v),!0)}t&&n.stopPropagation(),n.metaKey&&ae.isMac()&&((c=e.metaKeyEvents)===null||c===void 0||c.set(n.key,n.nativeEvent))}else n.key==="Meta"&&(e.metaKeyEvents=new Map)},onClick(n){if(!(n&&!n.currentTarget.contains(n.target))&&n&&n.button===0&&!e.isTriggeringEvent&&!G.openLink.isOpening){let c=!0;if(g&&n.preventDefault(),!e.ignoreClickAfterPress&&!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType==="virtual"||A.isVirtualClick(n.nativeEvent))){!g&&!P&&X.focusWithoutScrolling(n.currentTarget);let t=y(n,"virtual"),l=k(n,"virtual"),r=p(n,"virtual");c=t&&l&&r}e.ignoreEmulatedMouseEvents=!1,e.ignoreClickAfterPress=!1,c&&n.stopPropagation()}}},v=n=>{var c;if(e.isPressed&&e.target&&R(n,e.target)){var t;N(n.target,n.key)&&n.preventDefault();let r=n.target;p(E(e.target,n),"keyboard",e.target.contains(r)),M(),n.key!=="Enter"&&W(e.target)&&e.target.contains(r)&&!n[V]&&(n[V]=!0,G.openLink(e.target,n,!1)),e.isPressed=!1,(t=e.metaKeyEvents)===null||t===void 0||t.delete(n.key)}else if(n.key==="Meta"&&(!((c=e.metaKeyEvents)===null||c===void 0)&&c.size)){var l;let r=e.metaKeyEvents;e.metaKeyEvents=void 0;for(let h of r.values())(l=e.target)===null||l===void 0||l.dispatchEvent(new KeyboardEvent("keyup",h))}};if(typeof PointerEvent<"u"){o.onPointerDown=r=>{if(r.button!==0||!r.currentTarget.contains(r.target))return;if(A.isVirtualPointerEvent(r.nativeEvent)){e.pointerType="virtual";return}U(r.currentTarget)&&r.preventDefault(),e.pointerType=r.pointerType;let h=!0;e.isPressed||(e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=r.pointerId,e.target=r.currentTarget,!g&&!P&&X.focusWithoutScrolling(r.currentTarget),d||w.disableTextSelection(e.target),h=y(r,e.pointerType),m(S.getOwnerDocument(r.currentTarget),"pointermove",n,!1),m(S.getOwnerDocument(r.currentTarget),"pointerup",c,!1),m(S.getOwnerDocument(r.currentTarget),"pointercancel",l,!1)),h&&r.stopPropagation()},o.onMouseDown=r=>{r.currentTarget.contains(r.target)&&r.button===0&&(U(r.currentTarget)&&r.preventDefault(),r.stopPropagation())},o.onPointerUp=r=>{!r.currentTarget.contains(r.target)||e.pointerType==="virtual"||r.button===0&&x(r,r.currentTarget)&&k(r,e.pointerType||r.pointerType)};let n=r=>{r.pointerId===e.activePointerId&&(e.target&&x(r,e.target)?!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,y(E(e.target,r),e.pointerType)):e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,p(E(e.target,r),e.pointerType,!1),q(r)))},c=r=>{r.pointerId===e.activePointerId&&e.isPressed&&r.button===0&&e.target&&(x(r,e.target)&&e.pointerType!=null?p(E(e.target,r),e.pointerType):e.isOverTarget&&e.pointerType!=null&&p(E(e.target,r),e.pointerType,!1),e.isPressed=!1,e.isOverTarget=!1,e.activePointerId=null,e.pointerType=null,M(),d||w.restoreTextSelection(e.target),"ontouchend"in e.target&&r.pointerType!=="mouse"&&m(e.target,"touchend",t,{once:!0}))},t=r=>{z(r.currentTarget)&&r.preventDefault()},l=r=>{K(r)};o.onDragStart=r=>{r.currentTarget.contains(r.target)&&K(r)}}else{o.onMouseDown=t=>{if(t.button!==0||!t.currentTarget.contains(t.target))return;if(U(t.currentTarget)&&t.preventDefault(),e.ignoreEmulatedMouseEvents){t.stopPropagation();return}e.isPressed=!0,e.isOverTarget=!0,e.target=t.currentTarget,e.pointerType=A.isVirtualClick(t.nativeEvent)?"virtual":"mouse",!g&&!P&&X.focusWithoutScrolling(t.currentTarget),y(t,e.pointerType)&&t.stopPropagation(),m(S.getOwnerDocument(t.currentTarget),"mouseup",n,!1)},o.onMouseEnter=t=>{if(!t.currentTarget.contains(t.target))return;let l=!0;e.isPressed&&!e.ignoreEmulatedMouseEvents&&e.pointerType!=null&&(e.isOverTarget=!0,l=y(t,e.pointerType)),l&&t.stopPropagation()},o.onMouseLeave=t=>{if(!t.currentTarget.contains(t.target))return;let l=!0;e.isPressed&&!e.ignoreEmulatedMouseEvents&&e.pointerType!=null&&(e.isOverTarget=!1,l=p(t,e.pointerType,!1),q(t)),l&&t.stopPropagation()},o.onMouseUp=t=>{t.currentTarget.contains(t.target)&&!e.ignoreEmulatedMouseEvents&&t.button===0&&k(t,e.pointerType||"mouse")};let n=t=>{if(t.button===0){if(e.isPressed=!1,M(),e.ignoreEmulatedMouseEvents){e.ignoreEmulatedMouseEvents=!1;return}e.target&&x(t,e.target)&&e.pointerType!=null?p(E(e.target,t),e.pointerType):e.target&&e.isOverTarget&&e.pointerType!=null&&p(E(e.target,t),e.pointerType,!1),e.isOverTarget=!1}};o.onTouchStart=t=>{if(!t.currentTarget.contains(t.target))return;let l=ce(t.nativeEvent);if(!l)return;e.activePointerId=l.identifier,e.ignoreEmulatedMouseEvents=!0,e.isOverTarget=!0,e.isPressed=!0,e.target=t.currentTarget,e.pointerType="touch",!g&&!P&&X.focusWithoutScrolling(t.currentTarget),d||w.disableTextSelection(e.target),y($(e.target,t),e.pointerType)&&t.stopPropagation(),m(S.getOwnerWindow(t.currentTarget),"scroll",c,!0)},o.onTouchMove=t=>{if(!t.currentTarget.contains(t.target))return;if(!e.isPressed){t.stopPropagation();return}let l=B(t.nativeEvent,e.activePointerId),r=!0;l&&x(l,t.currentTarget)?!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,r=y($(e.target,t),e.pointerType)):e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,r=p($(e.target,t),e.pointerType,!1),q($(e.target,t))),r&&t.stopPropagation()},o.onTouchEnd=t=>{if(!t.currentTarget.contains(t.target))return;if(!e.isPressed){t.stopPropagation();return}let l=B(t.nativeEvent,e.activePointerId),r=!0;l&&x(l,t.currentTarget)&&e.pointerType!=null?(k($(e.target,t),e.pointerType),r=p($(e.target,t),e.pointerType)):e.isOverTarget&&e.pointerType!=null&&(r=p($(e.target,t),e.pointerType,!1)),r&&t.stopPropagation(),e.isPressed=!1,e.activePointerId=null,e.isOverTarget=!1,e.ignoreEmulatedMouseEvents=!0,e.target&&!d&&w.restoreTextSelection(e.target),M()},o.onTouchCancel=t=>{t.currentTarget.contains(t.target)&&(t.stopPropagation(),e.isPressed&&K($(e.target,t)))};let c=t=>{e.isPressed&&t.target.contains(e.target)&&K({currentTarget:e.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};o.onDragStart=t=>{t.currentTarget.contains(t.target)&&K(t)}}return o},[m,g,P,M,d,K,q,p,y,k]);return I.useEffect(()=>()=>{var e;d||w.restoreTextSelection((e=b.current.target)!==null&&e!==void 0?e:void 0)},[d]),{isPressed:O||Z,pressProps:j.mergeProps(Q,ee)}}function W(i){return i.tagName==="A"&&i.hasAttribute("href")}function R(i,s){const{key:a,code:u}=i,f=s,T=f.getAttribute("role");return(a==="Enter"||a===" "||a==="Spacebar"||u==="Space")&&!(f instanceof S.getOwnerWindow(f).HTMLInputElement&&!J(f,a)||f instanceof S.getOwnerWindow(f).HTMLTextAreaElement||f.isContentEditable)&&!((T==="link"||!T&&W(f))&&a!=="Enter")}function ce(i){const{targetTouches:s}=i;return s.length>0?s[0]:null}function B(i,s){const a=i.changedTouches;for(let u=0;u<a.length;u++){const f=a[u];if(f.identifier===s)return f}return null}function $(i,s){let a=0,u=0;return s.targetTouches&&s.targetTouches.length===1&&(a=s.targetTouches[0].clientX,u=s.targetTouches[0].clientY),{currentTarget:i,shiftKey:s.shiftKey,ctrlKey:s.ctrlKey,metaKey:s.metaKey,altKey:s.altKey,clientX:a,clientY:u}}function E(i,s){let a=s.clientX,u=s.clientY;return{currentTarget:i,shiftKey:s.shiftKey,ctrlKey:s.ctrlKey,metaKey:s.metaKey,altKey:s.altKey,clientX:a,clientY:u}}function fe(i){let s=0,a=0;return i.width!==void 0?s=i.width/2:i.radiusX!==void 0&&(s=i.radiusX),i.height!==void 0?a=i.height/2:i.radiusY!==void 0&&(a=i.radiusY),{top:i.clientY-a,right:i.clientX+s,bottom:i.clientY+a,left:i.clientX-s}}function ge(i,s){return!(i.left>s.right||s.left>i.right||i.top>s.bottom||s.top>i.bottom)}function x(i,s){let a=s.getBoundingClientRect(),u=fe(i);return ge(a,u)}function U(i){return!(i instanceof HTMLElement)||!i.hasAttribute("draggable")}function z(i){return i instanceof HTMLInputElement?!1:i instanceof HTMLButtonElement?i.type!=="submit"&&i.type!=="reset":!W(i)}function N(i,s){return i instanceof HTMLInputElement?!J(i,s):z(i)}const pe=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function J(i,s){return i.type==="checkbox"||i.type==="radio"?s===" ":pe.has(i.type)}exports.usePress=le;
|