@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.
Files changed (157) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/components/ShareButton/interface.d.ts +0 -1
  3. package/index151.js +1 -1
  4. package/index151.mjs +1 -1
  5. package/index153.js +1 -1
  6. package/index153.mjs +4 -4
  7. package/index154.js +1 -1
  8. package/index154.mjs +2 -2
  9. package/index155.js +1 -1
  10. package/index155.mjs +1 -1
  11. package/index156.js +1 -1
  12. package/index156.mjs +1 -1
  13. package/index161.js +1 -1
  14. package/index161.mjs +2 -2
  15. package/index163.js +1 -1
  16. package/index163.mjs +2 -2
  17. package/index164.js +1 -1
  18. package/index164.mjs +5 -5
  19. package/index165.js +1 -1
  20. package/index165.mjs +3 -3
  21. package/index167.js +1 -1
  22. package/index167.mjs +2 -2
  23. package/index172.js +1 -1
  24. package/index172.mjs +2 -2
  25. package/index176.js +1 -1
  26. package/index176.mjs +1 -1
  27. package/index178.js +1 -1
  28. package/index178.mjs +1 -1
  29. package/index179.js +1 -1
  30. package/index179.mjs +1 -1
  31. package/index181.js +1 -1
  32. package/index181.mjs +3 -3
  33. package/index187.js +1 -1
  34. package/index187.mjs +5 -11
  35. package/index188.js +2 -1
  36. package/index188.mjs +49 -5
  37. package/index189.js +1 -2
  38. package/index189.mjs +11 -49
  39. package/index232.js +1 -1
  40. package/index232.mjs +132 -117
  41. package/index233.js +1 -1
  42. package/index233.mjs +196 -26
  43. package/index234.js +1 -1
  44. package/index234.mjs +18 -69
  45. package/index235.js +1 -1
  46. package/index235.mjs +4 -382
  47. package/index236.js +1 -1
  48. package/index236.mjs +28 -46
  49. package/index237.js +1 -1
  50. package/index237.mjs +50 -4
  51. package/index238.js +1 -1
  52. package/index238.mjs +52 -22
  53. package/index239.js +1 -1
  54. package/index239.mjs +46 -45
  55. package/index240.js +1 -1
  56. package/index240.mjs +96 -4
  57. package/index241.js +1 -1
  58. package/index241.mjs +5 -24
  59. package/index242.js +1 -1
  60. package/index242.mjs +6 -12
  61. package/index243.js +1 -1
  62. package/index243.mjs +41 -4
  63. package/index244.js +1 -1
  64. package/index244.mjs +72 -15
  65. package/index245.js +1 -1
  66. package/index245.mjs +14 -42
  67. package/index246.js +1 -1
  68. package/index246.mjs +66 -55
  69. package/index247.js +1 -1
  70. package/index247.mjs +7 -41
  71. package/index248.js +1 -1
  72. package/index248.mjs +10 -27
  73. package/index249.js +1 -1
  74. package/index249.mjs +46 -30
  75. package/index250.js +1 -1
  76. package/index250.mjs +124 -13
  77. package/index251.js +1 -1
  78. package/index251.mjs +27 -10
  79. package/index252.js +1 -1
  80. package/index252.mjs +69 -24
  81. package/index253.js +1 -1
  82. package/index253.mjs +380 -8
  83. package/index254.js +1 -1
  84. package/index254.mjs +46 -6
  85. package/index255.js +1 -1
  86. package/index255.mjs +24 -5
  87. package/index256.js +1 -1
  88. package/index256.mjs +24 -7
  89. package/index257.js +1 -1
  90. package/index257.mjs +12 -29
  91. package/index258.js +1 -1
  92. package/index258.mjs +4 -18
  93. package/index259.js +1 -1
  94. package/index259.mjs +14 -13
  95. package/index260.js +1 -1
  96. package/index260.mjs +37 -38
  97. package/index261.js +1 -1
  98. package/index261.mjs +56 -7
  99. package/index262.js +1 -1
  100. package/index262.mjs +27 -16
  101. package/index263.js +1 -1
  102. package/index263.mjs +32 -3
  103. package/index264.js +1 -1
  104. package/index264.mjs +10 -4
  105. package/index265.js +1 -1
  106. package/index265.mjs +9 -19
  107. package/index266.js +1 -1
  108. package/index266.mjs +5 -54
  109. package/index267.js +1 -1
  110. package/index267.mjs +7 -140
  111. package/index268.js +1 -1
  112. package/index268.mjs +28 -196
  113. package/index269.js +1 -1
  114. package/index269.mjs +14 -18
  115. package/index270.js +1 -1
  116. package/index270.mjs +12 -48
  117. package/index271.js +1 -1
  118. package/index271.mjs +40 -45
  119. package/index272.js +1 -1
  120. package/index272.mjs +7 -96
  121. package/index273.js +1 -1
  122. package/index273.mjs +18 -72
  123. package/index274.js +1 -1
  124. package/index274.mjs +3 -69
  125. package/index275.js +1 -1
  126. package/index275.mjs +4 -7
  127. package/index276.js +1 -1
  128. package/index276.mjs +19 -11
  129. package/index278.js +1 -1
  130. package/index278.mjs +3 -3
  131. package/index280.js +1 -1
  132. package/index280.mjs +9 -9
  133. package/index281.js +1 -1
  134. package/index281.mjs +1 -1
  135. package/index324.js +1 -1
  136. package/index324.mjs +7 -63
  137. package/index325.js +1 -1
  138. package/index325.mjs +28 -7
  139. package/index326.js +1 -1
  140. package/index326.mjs +89 -24
  141. package/index327.js +1 -1
  142. package/index327.mjs +58 -88
  143. package/index330.js +1 -1
  144. package/index330.mjs +3 -3
  145. package/index333.js +1 -1
  146. package/index333.mjs +5 -5
  147. package/index334.js +1 -1
  148. package/index334.mjs +2 -2
  149. package/index335.js +1 -1
  150. package/index335.mjs +5 -5
  151. package/index336.js +1 -1
  152. package/index336.mjs +1 -1
  153. package/index340.js +1 -1
  154. package/index340.mjs +1 -1
  155. package/index8.js +1 -1
  156. package/index8.mjs +32 -32
  157. package/package.json +1 -1
package/index246.mjs CHANGED
@@ -1,60 +1,71 @@
1
- import { focusWithoutScrolling as b } from "./index245.mjs";
2
- import { isFirefox as v, isMac as u, isWebKit as $, isIPad as s } from "./index247.mjs";
3
- import { useContext as y, createContext as h } from "react";
4
- const K = /* @__PURE__ */ h({
5
- isNative: !0,
6
- open: x,
7
- useHref: (e) => e
8
- });
9
- function m() {
10
- return y(K);
11
- }
12
- function n(e, i, t = !0) {
13
- var a, d;
14
- let { metaKey: r, ctrlKey: l, altKey: o, shiftKey: c } = i;
15
- v() && (!((d = window.event) === null || d === void 0 || (a = d.type) === null || a === void 0) && a.startsWith("key")) && e.target === "_blank" && (u() ? r = !0 : l = !0);
16
- let f = $() && u() && !s() && process.env.NODE_ENV !== "test" ? new KeyboardEvent("keydown", {
17
- keyIdentifier: "Enter",
18
- metaKey: r,
19
- ctrlKey: l,
20
- altKey: o,
21
- shiftKey: c
22
- }) : new MouseEvent("click", {
23
- metaKey: r,
24
- ctrlKey: l,
25
- altKey: o,
26
- shiftKey: c,
27
- bubbles: !0,
28
- cancelable: !0
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
- n.isOpening = t, b(e), e.dispatchEvent(f), n.isOpening = !1;
31
- }
32
- n.isOpening = !1;
33
- function w(e, i) {
34
- if (e instanceof HTMLAnchorElement) i(e);
35
- else if (e.hasAttribute("data-href")) {
36
- let t = document.createElement("a");
37
- t.href = e.getAttribute("data-href"), e.hasAttribute("data-target") && (t.target = e.getAttribute("data-target")), e.hasAttribute("data-rel") && (t.rel = e.getAttribute("data-rel")), e.hasAttribute("data-download") && (t.download = e.getAttribute("data-download")), e.hasAttribute("data-ping") && (t.ping = e.getAttribute("data-ping")), e.hasAttribute("data-referrer-policy") && (t.referrerPolicy = e.getAttribute("data-referrer-policy")), e.appendChild(t), i(t), e.removeChild(t);
38
- }
39
- }
40
- function x(e, i) {
41
- w(e, (t) => n(t, i));
42
- }
43
- function E(e) {
44
- let i = m();
45
- var t;
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
- n as openLink,
58
- E as useLinkProps,
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"});function a(t){var e;return typeof window>"u"||window.navigator==null?!1:((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.brands.some(d=>t.test(d.brand)))||t.test(window.navigator.userAgent)}function r(t){var e;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}function n(t){if(process.env.NODE_ENV==="test")return t;let e=null;return()=>(e==null&&(e=t()),e)}const o=n(function(){return r(/^Mac/i)}),i=n(function(){return r(/^iPhone/i)}),c=n(function(){return r(/^iPad/i)||o()&&navigator.maxTouchPoints>1}),u=n(function(){return i()||c()}),$=n(function(){return o()||u()}),f=n(function(){return a(/AppleWebKit/i)&&!s()}),s=n(function(){return a(/Chrome/i)}),l=n(function(){return a(/Android/i)}),v=n(function(){return a(/Firefox/i)});exports.isAndroid=l;exports.isAppleDevice=$;exports.isChrome=s;exports.isFirefox=v;exports.isIOS=u;exports.isIPad=c;exports.isIPhone=i;exports.isMac=o;exports.isWebKit=f;
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
- function a(t) {
2
- var e;
3
- return typeof window > "u" || window.navigator == null ? !1 : ((e = window.navigator.userAgentData) === null || e === void 0 ? void 0 : e.brands.some((i) => t.test(i.brand))) || t.test(window.navigator.userAgent);
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
- l as isAndroid,
36
- d as isAppleDevice,
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"});let n=new Map,a=new Set;function o(){if(typeof window>"u")return;function r(e){return"propertyName"in e}let d=e=>{if(!r(e)||!e.target)return;let t=n.get(e.target);t||(t=new Set,n.set(e.target,t),e.target.addEventListener("transitioncancel",i,{once:!0})),t.add(e.propertyName)},i=e=>{if(!r(e)||!e.target)return;let t=n.get(e.target);if(t&&(t.delete(e.propertyName),t.size===0&&(e.target.removeEventListener("transitioncancel",i),n.delete(e.target)),n.size===0)){for(let s of a)s();a.clear()}};document.body.addEventListener("transitionrun",d),document.body.addEventListener("transitionend",i)}typeof document<"u"&&(document.readyState!=="loading"?o():document.addEventListener("DOMContentLoaded",o));function c(r){requestAnimationFrame(()=>{n.size===0?r():a.add(r)})}exports.runAfterTransition=c;
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
- let n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
2
- function o() {
3
- if (typeof window > "u") return;
4
- function r(t) {
5
- return "propertyName" in t;
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
- document.body.addEventListener("transitionrun", d), document.body.addEventListener("transitionend", i);
22
- }
23
- typeof document < "u" && (document.readyState !== "loading" ? o() : document.addEventListener("DOMContentLoaded", o));
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
- c as runAfterTransition
13
+ n as ClearPressResponder
31
14
  };
package/index249.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react");function b(){let a=o.useRef(new Map),d=o.useCallback((e,l,t,r)=>{let n=r!=null&&r.once?(...c)=>{a.current.delete(t),t(...c)}:t;a.current.set(t,{type:l,eventTarget:e,fn:n,options:r}),e.addEventListener(l,n,r)},[]),s=o.useCallback((e,l,t,r)=>{var n;let c=((n=a.current.get(t))===null||n===void 0?void 0:n.fn)||t;e.removeEventListener(l,c,r),a.current.delete(t)},[]),u=o.useCallback(()=>{a.current.forEach((e,l)=>{s(e.eventTarget,e.type,l,e.options)})},[s]);return o.useEffect(()=>u,[u]),{addGlobalListener:d,removeGlobalListener:s,removeAllGlobalListeners:u}}exports.useGlobalListeners=b;
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 { useRef as c, useCallback as f, useEffect as b } from "react";
2
- function L() {
3
- let o = c(/* @__PURE__ */ new Map()), u = f((e, l, r, t) => {
4
- let n = t != null && t.once ? (...d) => {
5
- o.current.delete(r), r(...d);
6
- } : r;
7
- o.current.set(r, {
8
- type: l,
9
- eventTarget: e,
10
- fn: n,
11
- options: t
12
- }), e.addEventListener(l, n, t);
13
- }, []), a = f((e, l, r, t) => {
14
- var n;
15
- let d = ((n = o.current.get(r)) === null || n === void 0 ? void 0 : n.fn) || r;
16
- e.removeEventListener(l, d, t), o.current.delete(r);
17
- }, []), s = f(() => {
18
- o.current.forEach((e, l) => {
19
- a(e.eventTarget, e.type, l, e.options);
20
- });
21
- }, [
22
- a
23
- ]);
24
- return b(() => s, [
25
- s
26
- ]), {
27
- addGlobalListener: u,
28
- removeGlobalListener: a,
29
- removeAllGlobalListeners: s
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
- L as useGlobalListeners
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 r=require("./index181.js");function d(a,t){let{id:i,"aria-label":l,"aria-labelledby":e}=a;return i=r.useId(i),e&&l?e=[...new Set([i,...e.trim().split(/\s+/)])].join(" "):e&&(e=e.trim().split(/\s+/).join(" ")),!l&&!e&&t&&(l=t),{id:i,"aria-label":l,"aria-labelledby":e}}exports.useLabels=d;
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 { useId as b } from "./index181.mjs";
2
- function t(r, a) {
3
- let { id: i, "aria-label": l, "aria-labelledby": e } = r;
4
- return i = b(i), e && l ? e = [
5
- .../* @__PURE__ */ new Set([
6
- i,
7
- ...e.trim().split(/\s+/)
8
- ])
9
- ].join(" ") : e && (e = e.trim().split(/\s+/).join(" ")), !l && !e && a && (l = a), {
10
- id: i,
11
- "aria-label": l,
12
- "aria-labelledby": e
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
- t as useLabels
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 r=require("./index237.js"),f=require("react");function a(c,t){const e=f.useRef(!0),u=f.useRef(null);r.useLayoutEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),r.useLayoutEffect(()=>{e.current?e.current=!1:(!u.current||t.some((s,o)=>!Object.is(s,u[o])))&&c(),u.current=t},t)}exports.useUpdateLayoutEffect=a;
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 { useLayoutEffect as f } from "./index237.mjs";
2
- import { useRef as u } from "react";
3
- function i(c, r) {
4
- const t = u(!0), e = u(null);
5
- f(() => (t.current = !0, () => {
6
- t.current = !1;
7
- }), []), f(() => {
8
- t.current ? t.current = !1 : (!e.current || r.some((a, o) => !Object.is(a, e[o]))) && c(), e.current = r;
9
- }, r);
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
- i as useUpdateLayoutEffect
29
+ S as useControlledState
13
30
  };
package/index252.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react");function u(){return typeof window.ResizeObserver<"u"}function b(i){const{ref:e,box:s,onResize:r}=i;d.useEffect(()=>{let n=e==null?void 0:e.current;if(n)if(u()){const t=new window.ResizeObserver(o=>{o.length&&r()});return t.observe(n,{box:s}),()=>{n&&t.unobserve(n)}}else return window.addEventListener("resize",r,!1),()=>{window.removeEventListener("resize",r,!1)}},[r,e,s])}exports.useResizeObserver=b;
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 { useEffect as d } from "react";
2
- function f() {
3
- return typeof window.ResizeObserver < "u";
4
- }
5
- function u(o) {
6
- const { ref: e, box: s, onResize: r } = o;
7
- d(() => {
8
- let n = e == null ? void 0 : e.current;
9
- if (n)
10
- if (f()) {
11
- const i = new window.ResizeObserver((t) => {
12
- t.length && r();
13
- });
14
- return i.observe(n, {
15
- box: s
16
- }), () => {
17
- n && i.unobserve(n);
18
- };
19
- } else
20
- return window.addEventListener("resize", r, !1), () => {
21
- window.removeEventListener("resize", r, !1);
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
- u as useResizeObserver
75
+ V as useFormValidation
31
76
  };