@okam/stack-ui 1.42.1 → 1.42.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/CHANGELOG.md +13 -0
- package/components/ShareButton/interface.d.ts +0 -1
- package/index151.js +1 -1
- package/index151.mjs +1 -1
- package/index153.js +1 -1
- package/index153.mjs +4 -4
- package/index154.js +1 -1
- package/index154.mjs +2 -2
- package/index155.js +1 -1
- package/index155.mjs +1 -1
- package/index156.js +1 -1
- package/index156.mjs +1 -1
- package/index161.js +1 -1
- package/index161.mjs +2 -2
- package/index163.js +1 -1
- package/index163.mjs +2 -2
- package/index164.js +1 -1
- package/index164.mjs +5 -5
- package/index165.js +1 -1
- package/index165.mjs +3 -3
- package/index167.js +1 -1
- package/index167.mjs +2 -2
- package/index172.js +1 -1
- package/index172.mjs +2 -2
- package/index176.js +1 -1
- package/index176.mjs +1 -1
- package/index178.js +1 -1
- package/index178.mjs +1 -1
- package/index179.js +1 -1
- package/index179.mjs +1 -1
- package/index181.js +1 -1
- package/index181.mjs +3 -3
- package/index187.js +1 -1
- package/index187.mjs +5 -11
- package/index188.js +2 -1
- package/index188.mjs +49 -5
- package/index189.js +1 -2
- package/index189.mjs +11 -49
- package/index232.js +1 -1
- package/index232.mjs +132 -117
- package/index233.js +1 -1
- package/index233.mjs +196 -26
- package/index234.js +1 -1
- package/index234.mjs +18 -69
- package/index235.js +1 -1
- package/index235.mjs +4 -382
- package/index236.js +1 -1
- package/index236.mjs +28 -46
- package/index237.js +1 -1
- package/index237.mjs +50 -4
- package/index238.js +1 -1
- package/index238.mjs +52 -22
- package/index239.js +1 -1
- package/index239.mjs +46 -45
- package/index240.js +1 -1
- package/index240.mjs +96 -4
- package/index241.js +1 -1
- package/index241.mjs +5 -24
- package/index242.js +1 -1
- package/index242.mjs +6 -12
- package/index243.js +1 -1
- package/index243.mjs +41 -4
- package/index244.js +1 -1
- package/index244.mjs +72 -15
- package/index245.js +1 -1
- package/index245.mjs +14 -42
- package/index246.js +1 -1
- package/index246.mjs +66 -55
- package/index247.js +1 -1
- package/index247.mjs +7 -41
- package/index248.js +1 -1
- package/index248.mjs +10 -27
- package/index249.js +1 -1
- package/index249.mjs +46 -30
- package/index250.js +1 -1
- package/index250.mjs +124 -13
- package/index251.js +1 -1
- package/index251.mjs +27 -10
- package/index252.js +1 -1
- package/index252.mjs +69 -24
- package/index253.js +1 -1
- package/index253.mjs +380 -8
- package/index254.js +1 -1
- package/index254.mjs +46 -6
- package/index255.js +1 -1
- package/index255.mjs +24 -5
- package/index256.js +1 -1
- package/index256.mjs +24 -7
- package/index257.js +1 -1
- package/index257.mjs +12 -29
- package/index258.js +1 -1
- package/index258.mjs +4 -18
- package/index259.js +1 -1
- package/index259.mjs +14 -13
- package/index260.js +1 -1
- package/index260.mjs +37 -38
- package/index261.js +1 -1
- package/index261.mjs +56 -7
- package/index262.js +1 -1
- package/index262.mjs +27 -16
- package/index263.js +1 -1
- package/index263.mjs +32 -3
- package/index264.js +1 -1
- package/index264.mjs +10 -4
- package/index265.js +1 -1
- package/index265.mjs +9 -19
- package/index266.js +1 -1
- package/index266.mjs +5 -54
- package/index267.js +1 -1
- package/index267.mjs +7 -140
- package/index268.js +1 -1
- package/index268.mjs +28 -196
- package/index269.js +1 -1
- package/index269.mjs +14 -18
- package/index270.js +1 -1
- package/index270.mjs +12 -48
- package/index271.js +1 -1
- package/index271.mjs +40 -45
- package/index272.js +1 -1
- package/index272.mjs +7 -96
- package/index273.js +1 -1
- package/index273.mjs +18 -72
- package/index274.js +1 -1
- package/index274.mjs +3 -69
- package/index275.js +1 -1
- package/index275.mjs +4 -7
- package/index276.js +1 -1
- package/index276.mjs +19 -11
- package/index278.js +1 -1
- package/index278.mjs +3 -3
- package/index280.js +1 -1
- package/index280.mjs +9 -9
- package/index281.js +1 -1
- package/index281.mjs +1 -1
- package/index324.js +1 -1
- package/index324.mjs +7 -63
- package/index325.js +1 -1
- package/index325.mjs +28 -7
- package/index326.js +1 -1
- package/index326.mjs +89 -24
- package/index327.js +1 -1
- package/index327.mjs +58 -88
- package/index330.js +1 -1
- package/index330.mjs +3 -3
- package/index333.js +1 -1
- package/index333.mjs +5 -5
- package/index334.js +1 -1
- package/index334.mjs +2 -2
- package/index335.js +1 -1
- package/index335.mjs +5 -5
- package/index336.js +1 -1
- package/index336.mjs +1 -1
- package/index340.js +1 -1
- package/index340.mjs +1 -1
- package/index8.js +1 -1
- package/index8.mjs +32 -32
- package/package.json +1 -1
package/index246.mjs
CHANGED
|
@@ -1,60 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
let s = /* @__PURE__ */ new WeakMap(), i = [];
|
|
2
|
+
function v(o, l = document.body) {
|
|
3
|
+
let a = new Set(o), d = /* @__PURE__ */ new Set(), u = (t) => {
|
|
4
|
+
for (let n of t.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]")) a.add(n);
|
|
5
|
+
let r = (n) => {
|
|
6
|
+
if (a.has(n) || n.parentElement && d.has(n.parentElement) && n.parentElement.getAttribute("role") !== "row") return NodeFilter.FILTER_REJECT;
|
|
7
|
+
for (let p of a)
|
|
8
|
+
if (n.contains(p)) return NodeFilter.FILTER_SKIP;
|
|
9
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
10
|
+
}, e = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, {
|
|
11
|
+
acceptNode: r
|
|
12
|
+
}), h = r(t);
|
|
13
|
+
if (h === NodeFilter.FILTER_ACCEPT && b(t), h !== NodeFilter.FILTER_REJECT) {
|
|
14
|
+
let n = e.nextNode();
|
|
15
|
+
for (; n != null; )
|
|
16
|
+
b(n), n = e.nextNode();
|
|
17
|
+
}
|
|
18
|
+
}, b = (t) => {
|
|
19
|
+
var r;
|
|
20
|
+
let e = (r = s.get(t)) !== null && r !== void 0 ? r : 0;
|
|
21
|
+
t.getAttribute("aria-hidden") === "true" && e === 0 || (e === 0 && t.setAttribute("aria-hidden", "true"), d.add(t), s.set(t, e + 1));
|
|
22
|
+
};
|
|
23
|
+
i.length && i[i.length - 1].disconnect(), u(l);
|
|
24
|
+
let c = new MutationObserver((t) => {
|
|
25
|
+
for (let r of t)
|
|
26
|
+
if (!(r.type !== "childList" || r.addedNodes.length === 0) && ![
|
|
27
|
+
...a,
|
|
28
|
+
...d
|
|
29
|
+
].some((e) => e.contains(r.target))) {
|
|
30
|
+
for (let e of r.removedNodes) e instanceof Element && (a.delete(e), d.delete(e));
|
|
31
|
+
for (let e of r.addedNodes)
|
|
32
|
+
(e instanceof HTMLElement || e instanceof SVGElement) && (e.dataset.liveAnnouncer === "true" || e.dataset.reactAriaTopLayer === "true") ? a.add(e) : e instanceof Element && u(e);
|
|
33
|
+
}
|
|
29
34
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const a = i.useHref((t = e == null ? void 0 : e.href) !== null && t !== void 0 ? t : "");
|
|
47
|
-
return {
|
|
48
|
-
href: e != null && e.href ? a : void 0,
|
|
49
|
-
target: e == null ? void 0 : e.target,
|
|
50
|
-
rel: e == null ? void 0 : e.rel,
|
|
51
|
-
download: e == null ? void 0 : e.download,
|
|
52
|
-
ping: e == null ? void 0 : e.ping,
|
|
53
|
-
referrerPolicy: e == null ? void 0 : e.referrerPolicy
|
|
35
|
+
c.observe(l, {
|
|
36
|
+
childList: !0,
|
|
37
|
+
subtree: !0
|
|
38
|
+
});
|
|
39
|
+
let f = {
|
|
40
|
+
visibleNodes: a,
|
|
41
|
+
hiddenNodes: d,
|
|
42
|
+
observe() {
|
|
43
|
+
c.observe(l, {
|
|
44
|
+
childList: !0,
|
|
45
|
+
subtree: !0
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
disconnect() {
|
|
49
|
+
c.disconnect();
|
|
50
|
+
}
|
|
54
51
|
};
|
|
52
|
+
return i.push(f), () => {
|
|
53
|
+
c.disconnect();
|
|
54
|
+
for (let t of d) {
|
|
55
|
+
let r = s.get(t);
|
|
56
|
+
r != null && (r === 1 ? (t.removeAttribute("aria-hidden"), s.delete(t)) : s.set(t, r - 1));
|
|
57
|
+
}
|
|
58
|
+
f === i[i.length - 1] ? (i.pop(), i.length && i[i.length - 1].observe()) : i.splice(i.indexOf(f), 1);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function E(o) {
|
|
62
|
+
let l = i[i.length - 1];
|
|
63
|
+
if (l && !l.visibleNodes.has(o))
|
|
64
|
+
return l.visibleNodes.add(o), () => {
|
|
65
|
+
l.visibleNodes.delete(o);
|
|
66
|
+
};
|
|
55
67
|
}
|
|
56
68
|
export {
|
|
57
|
-
|
|
58
|
-
E as
|
|
59
|
-
m as useRouter
|
|
69
|
+
v as ariaHideOutside,
|
|
70
|
+
E as keepVisible
|
|
60
71
|
};
|
package/index247.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),o=e.createContext({});function r(){var t;return(t=e.useContext(o))!==null&&t!==void 0?t:{}}exports.PortalContext=o;exports.useUNSAFE_PortalContext=r;
|
package/index247.mjs
CHANGED
|
@@ -1,44 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { useContext as e, createContext as o } from "react";
|
|
2
|
+
const r = /* @__PURE__ */ o({});
|
|
3
|
+
function a() {
|
|
4
|
+
var t;
|
|
5
|
+
return (t = e(r)) !== null && t !== void 0 ? t : {};
|
|
4
6
|
}
|
|
5
|
-
function r(t) {
|
|
6
|
-
var e;
|
|
7
|
-
return typeof window < "u" && window.navigator != null ? t.test(((e = window.navigator.userAgentData) === null || e === void 0 ? void 0 : e.platform) || window.navigator.platform) : !1;
|
|
8
|
-
}
|
|
9
|
-
function n(t) {
|
|
10
|
-
if (process.env.NODE_ENV === "test") return t;
|
|
11
|
-
let e = null;
|
|
12
|
-
return () => (e == null && (e = t()), e);
|
|
13
|
-
}
|
|
14
|
-
const o = n(function() {
|
|
15
|
-
return r(/^Mac/i);
|
|
16
|
-
}), c = n(function() {
|
|
17
|
-
return r(/^iPhone/i);
|
|
18
|
-
}), s = n(function() {
|
|
19
|
-
return r(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
20
|
-
o() && navigator.maxTouchPoints > 1;
|
|
21
|
-
}), u = n(function() {
|
|
22
|
-
return c() || s();
|
|
23
|
-
}), d = n(function() {
|
|
24
|
-
return o() || u();
|
|
25
|
-
}), f = n(function() {
|
|
26
|
-
return a(/AppleWebKit/i) && !$();
|
|
27
|
-
}), $ = n(function() {
|
|
28
|
-
return a(/Chrome/i);
|
|
29
|
-
}), l = n(function() {
|
|
30
|
-
return a(/Android/i);
|
|
31
|
-
}), v = n(function() {
|
|
32
|
-
return a(/Firefox/i);
|
|
33
|
-
});
|
|
34
7
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
$ as isChrome,
|
|
38
|
-
v as isFirefox,
|
|
39
|
-
u as isIOS,
|
|
40
|
-
s as isIPad,
|
|
41
|
-
c as isIPhone,
|
|
42
|
-
o as isMac,
|
|
43
|
-
f as isWebKit
|
|
8
|
+
r as PortalContext,
|
|
9
|
+
a as useUNSAFE_PortalContext
|
|
44
10
|
};
|
package/index248.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index324.js"),e=require("react");function n({children:r}){let t=e.useMemo(()=>({register:()=>{}}),[]);return e.createElement(o.PressResponderContext.Provider,{value:t},r)}exports.ClearPressResponder=n;
|
package/index248.mjs
CHANGED
|
@@ -1,31 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
let d = (t) => {
|
|
8
|
-
if (!r(t) || !t.target) return;
|
|
9
|
-
let e = n.get(t.target);
|
|
10
|
-
e || (e = /* @__PURE__ */ new Set(), n.set(t.target, e), t.target.addEventListener("transitioncancel", i, {
|
|
11
|
-
once: !0
|
|
12
|
-
})), e.add(t.propertyName);
|
|
13
|
-
}, i = (t) => {
|
|
14
|
-
if (!r(t) || !t.target) return;
|
|
15
|
-
let e = n.get(t.target);
|
|
16
|
-
if (e && (e.delete(t.propertyName), e.size === 0 && (t.target.removeEventListener("transitioncancel", i), n.delete(t.target)), n.size === 0)) {
|
|
17
|
-
for (let s of a) s();
|
|
18
|
-
a.clear();
|
|
1
|
+
import { PressResponderContext as t } from "./index324.mjs";
|
|
2
|
+
import a, { useMemo as o } from "react";
|
|
3
|
+
function n({ children: e }) {
|
|
4
|
+
let r = o(() => ({
|
|
5
|
+
register: () => {
|
|
19
6
|
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function c(r) {
|
|
25
|
-
requestAnimationFrame(() => {
|
|
26
|
-
n.size === 0 ? r() : a.add(r);
|
|
27
|
-
});
|
|
7
|
+
}), []);
|
|
8
|
+
return /* @__PURE__ */ a.createElement(t.Provider, {
|
|
9
|
+
value: r
|
|
10
|
+
}, e);
|
|
28
11
|
}
|
|
29
12
|
export {
|
|
30
|
-
|
|
13
|
+
n as ClearPressResponder
|
|
31
14
|
};
|
package/index249.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 e=require("react"),c={prefix:String(Math.round(Math.random()*1e10)),current:0},d=e.createContext(c),l=e.createContext(!1);let f=!!(typeof window<"u"&&window.document&&window.document.createElement),s=new WeakMap;function v(r=!1){let t=e.useContext(d),n=e.useRef(null);if(n.current===null&&!r){var a,u;let o=(u=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||u===void 0||(a=u.ReactCurrentOwner)===null||a===void 0?void 0:a.current;if(o){let i=s.get(o);i==null?s.set(o,{id:t.current,state:o.memoizedState}):o.memoizedState!==i.state&&(t.current=i.id,s.delete(o))}n.current=++t.current}return n.current}function p(r){let t=e.useContext(d);t===c&&!f&&process.env.NODE_ENV!=="production"&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let n=v(!!r),a=t===c&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${t.prefix}`;return r||`${a}-${n}`}function S(r){let t=e.useId(),[n]=e.useState($()),a=n||process.env.NODE_ENV==="test"?"react-aria":`react-aria${c.prefix}`;return r||`${a}-${t}`}const b=typeof e.useId=="function"?S:p;function x(){return!1}function m(){return!0}function g(r){return()=>{}}function $(){return typeof e.useSyncExternalStore=="function"?e.useSyncExternalStore(g,x,m):e.useContext(l)}exports.useIsSSR=$;exports.useSSRSafeId=b;
|
package/index249.mjs
CHANGED
|
@@ -1,34 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import a, { useContext as d, useState as f, useRef as l } from "react";
|
|
2
|
+
const c = {
|
|
3
|
+
prefix: String(Math.round(Math.random() * 1e10)),
|
|
4
|
+
current: 0
|
|
5
|
+
}, $ = /* @__PURE__ */ a.createContext(c), p = /* @__PURE__ */ a.createContext(!1);
|
|
6
|
+
let v = !!(typeof window < "u" && window.document && window.document.createElement), s = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function S(t = !1) {
|
|
8
|
+
let e = d($), r = l(null);
|
|
9
|
+
if (r.current === null && !t) {
|
|
10
|
+
var n, u;
|
|
11
|
+
let o = (u = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || u === void 0 || (n = u.ReactCurrentOwner) === null || n === void 0 ? void 0 : n.current;
|
|
12
|
+
if (o) {
|
|
13
|
+
let i = s.get(o);
|
|
14
|
+
i == null ? s.set(o, {
|
|
15
|
+
id: e.current,
|
|
16
|
+
state: o.memoizedState
|
|
17
|
+
}) : o.memoizedState !== i.state && (e.current = i.id, s.delete(o));
|
|
18
|
+
}
|
|
19
|
+
r.current = ++e.current;
|
|
20
|
+
}
|
|
21
|
+
return r.current;
|
|
22
|
+
}
|
|
23
|
+
function b(t) {
|
|
24
|
+
let e = d($);
|
|
25
|
+
e === c && !v && process.env.NODE_ENV !== "production" && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
|
|
26
|
+
let r = S(!!t), n = e === c && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${e.prefix}`;
|
|
27
|
+
return t || `${n}-${r}`;
|
|
28
|
+
}
|
|
29
|
+
function x(t) {
|
|
30
|
+
let e = a.useId(), [r] = f(y()), n = r || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${c.prefix}`;
|
|
31
|
+
return t || `${n}-${e}`;
|
|
32
|
+
}
|
|
33
|
+
const C = typeof a.useId == "function" ? x : b;
|
|
34
|
+
function m() {
|
|
35
|
+
return !1;
|
|
36
|
+
}
|
|
37
|
+
function w() {
|
|
38
|
+
return !0;
|
|
39
|
+
}
|
|
40
|
+
function g(t) {
|
|
41
|
+
return () => {
|
|
30
42
|
};
|
|
31
43
|
}
|
|
44
|
+
function y() {
|
|
45
|
+
return typeof a.useSyncExternalStore == "function" ? a.useSyncExternalStore(g, m, w) : d(p);
|
|
46
|
+
}
|
|
32
47
|
export {
|
|
33
|
-
|
|
48
|
+
y as useIsSSR,
|
|
49
|
+
C as useSSRSafeId
|
|
34
50
|
};
|
package/index250.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/index250.mjs
CHANGED
|
@@ -1,17 +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
|
|
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
|
|
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
|
|
13
119
|
};
|
|
14
120
|
}
|
|
15
121
|
export {
|
|
16
|
-
|
|
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
|
|
17
128
|
};
|
package/index251.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 l=require("react");function m(o,p,s){let[b,u]=l.useState(o||p),i=l.useRef(o!==void 0),e=o!==void 0;l.useEffect(()=>{let t=i.current;t!==e&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${t?"controlled":"uncontrolled"} to ${e?"controlled":"uncontrolled"}.`),i.current=e},[e]);let n=e?o:b,S=l.useCallback((t,...f)=>{let d=(r,...c)=>{s&&(Object.is(n,r)||s(r,...c)),e||(n=r)};typeof t=="function"?(process.env.NODE_ENV!=="production"&&console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),u((c,...V)=>{let a=t(e?n:c,...V);return d(a,...f),e?c:a})):(e||u(t),d(t,...f))},[e,n,s]);return[n,S]}exports.useControlledState=m;
|
package/index251.mjs
CHANGED
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
t.current =
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { useState as V, useRef as C, useEffect as E, useCallback as N } from "react";
|
|
2
|
+
function S(n, a, l) {
|
|
3
|
+
let [p, s] = V(n || a), i = C(n !== void 0), e = n !== void 0;
|
|
4
|
+
E(() => {
|
|
5
|
+
let t = i.current;
|
|
6
|
+
t !== e && process.env.NODE_ENV !== "production" && console.warn(`WARN: A component changed from ${t ? "controlled" : "uncontrolled"} to ${e ? "controlled" : "uncontrolled"}.`), i.current = e;
|
|
7
|
+
}, [
|
|
8
|
+
e
|
|
9
|
+
]);
|
|
10
|
+
let o = e ? n : p, b = N((t, ...u) => {
|
|
11
|
+
let f = (r, ...c) => {
|
|
12
|
+
l && (Object.is(o, r) || l(r, ...c)), e || (o = r);
|
|
13
|
+
};
|
|
14
|
+
typeof t == "function" ? (process.env.NODE_ENV !== "production" && console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"), s((c, ...m) => {
|
|
15
|
+
let d = t(e ? o : c, ...m);
|
|
16
|
+
return f(d, ...u), e ? c : d;
|
|
17
|
+
})) : (e || s(t), f(t, ...u));
|
|
18
|
+
}, [
|
|
19
|
+
e,
|
|
20
|
+
o,
|
|
21
|
+
l
|
|
22
|
+
]);
|
|
23
|
+
return [
|
|
24
|
+
o,
|
|
25
|
+
b
|
|
26
|
+
];
|
|
10
27
|
}
|
|
11
28
|
export {
|
|
12
|
-
|
|
29
|
+
S as useControlledState
|
|
13
30
|
};
|
package/index252.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("./index327.js"),f=require("react"),E=require("./index235.js"),v=require("./index270.js");function g(i,e,t){let{validationBehavior:s,focus:u}=i;E.useLayoutEffect(()=>{if(s==="native"&&(t!=null&&t.current)&&!t.current.disabled){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&&b(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 b(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/index252.mjs
CHANGED
|
@@ -1,31 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { setInteractionModality as m } from "./index327.mjs";
|
|
2
|
+
import { useEffect as f } from "react";
|
|
3
|
+
import { useLayoutEffect as $ } from "./index235.mjs";
|
|
4
|
+
import { useEffectEvent as v } from "./index270.mjs";
|
|
5
|
+
function V(t, i, e) {
|
|
6
|
+
let { validationBehavior: s, focus: u } = t;
|
|
7
|
+
$(() => {
|
|
8
|
+
if (s === "native" && (e != null && e.current) && !e.current.disabled) {
|
|
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 && b(c) === e.current) {
|
|
20
|
+
var d;
|
|
21
|
+
u ? u() : (d = e.current) === null || d === void 0 || d.focus(), m("keyboard");
|
|
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
|
+
};
|
|
23
34
|
}, [
|
|
24
|
-
r,
|
|
25
35
|
e,
|
|
36
|
+
l,
|
|
37
|
+
r,
|
|
38
|
+
o,
|
|
26
39
|
s
|
|
27
40
|
]);
|
|
28
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 b(t) {
|
|
68
|
+
for (let i = 0; i < t.elements.length; i++) {
|
|
69
|
+
let e = t.elements[i];
|
|
70
|
+
if (!e.validity.valid) return e;
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
29
74
|
export {
|
|
30
|
-
|
|
75
|
+
V as useFormValidation
|
|
31
76
|
};
|