@sps-woodland/focused-task 8.20.8 → 8.20.9
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/lib/index.cjs.js +1 -1
- package/lib/index.es.js +108 -103
- package/lib/style.css +1 -1
- package/package.json +7 -7
package/lib/index.cjs.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("@sps-woodland/core"),Ke=require("@sps-woodland/buttons"),u=require("react"),qe=require("react-dom"),pe=require("@spscommerce/utils");function ze(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const p=ze(u),E=typeof document<"u"?u.useLayoutEffect:()=>{};function I(e){const t=u.useRef(null);return E(()=>{t.current=e},[e]),u.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}function Ue(e){let[t,n]=u.useState(e),r=u.useRef(null),o=I(()=>{if(!r.current)return;let a=r.current.next();if(a.done){r.current=null;return}t===a.value?o():n(a.value)});E(()=>{r.current&&o()});let i=I(a=>{r.current=a(t),o()});return[t,i]}const K={prefix:String(Math.round(Math.random()*1e10)),current:0},ke=u.createContext(K),Ge=u.createContext(!1);let Je=!!(typeof window<"u"&&window.document&&window.document.createElement),Q=new WeakMap;function Xe(e=!1){let t=u.useContext(ke),n=u.useRef(null);if(n.current===null&&!e){var r,o;let i=(o=u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||o===void 0||(r=o.ReactCurrentOwner)===null||r===void 0?void 0:r.current;if(i){let a=Q.get(i);a==null?Q.set(i,{id:t.current,state:i.memoizedState}):i.memoizedState!==a.state&&(t.current=a.id,Q.delete(i))}n.current=++t.current}return n.current}function Ye(e){let t=u.useContext(ke);t===K&&!Je&&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=Xe(!!e),r=t===K&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${t.prefix}`;return e||`${r}-${n}`}function Qe(e){let t=u.useId(),[n]=u.useState(Se()),r=n||process.env.NODE_ENV==="test"?"react-aria":`react-aria${K.prefix}`;return e||`${r}-${t}`}const Ze=typeof u.useId=="function"?Qe:Ye;function et(){return!1}function tt(){return!0}function nt(e){return()=>{}}function Se(){return typeof u.useSyncExternalStore=="function"?u.useSyncExternalStore(nt,et,tt):u.useContext(Ge)}let rt=!!(typeof window<"u"&&window.document&&window.document.createElement),q=new Map;function xe(e){let[t,n]=u.useState(e),r=u.useRef(null),o=Ze(t),i=u.useCallback(a=>{r.current=a},[]);return rt&&q.set(o,i),E(()=>{let a=o;return()=>{q.delete(a)}},[o]),u.useEffect(()=>{let a=r.current;a&&(r.current=null,n(a))}),o}function ot(e,t){if(e===t)return e;let n=q.get(e);if(n)return n(t),t;let r=q.get(t);return r?(r(e),e):t}function at(e=[]){let t=xe(),[n,r]=Ue(t),o=u.useCallback(()=>{r(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,r]);return E(o,[t,o,...e]),n}function z(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const g=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},U=e=>e&&"window"in e&&e.window===e?e:g(e).defaultView||window;function Ne(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Ne(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function it(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Ne(e))&&(r&&(r+=" "),r+=t);return r}function lt(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let o in r){let i=t[o],a=r[o];typeof i=="function"&&typeof a=="function"&&o[0]==="o"&&o[1]==="n"&&o.charCodeAt(2)>=65&&o.charCodeAt(2)<=90?t[o]=z(i,a):(o==="className"||o==="UNSAFE_className")&&typeof i=="string"&&typeof a=="string"?t[o]=it(i,a):o==="id"&&i&&a?t.id=ot(i,a):t[o]=a!==void 0?a:i}}return t}const st=new Set(["id"]),ct=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),ut=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),dt=/^(data-.*)$/;function ft(e,t={}){let{labelable:n,isLink:r,propNames:o}=t,i={};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(st.has(a)||n&&ct.has(a)||r&&ut.has(a)||o!=null&&o.has(a)||dt.test(a))&&(i[a]=e[a]);return i}function ve(e){if(pt())e.focus({preventScroll:!0});else{let t=vt(e);e.focus(),bt(t)}}let H=null;function pt(){if(H==null){H=!1;try{document.createElement("div").focus({get preventScroll(){return H=!0,!0}})}catch{}}return H}function vt(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function bt(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function mt(e){var t;return typeof window>"u"||window.navigator==null?!1:((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands.some(n=>e.test(n.brand)))||e.test(window.navigator.userAgent)}function le(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function W(e){let t=null;return()=>(t==null&&(t=e()),t)}const Ce=W(function(){return le(/^Mac/i)}),$t=W(function(){return le(/^iPhone/i)}),ht=W(function(){return le(/^iPad/i)||Ce()&&navigator.maxTouchPoints>1}),Et=W(function(){return $t()||ht()}),gt=W(function(){return mt(/Android/i)});let L=new Map,te=new Set;function be(){if(typeof window>"u")return;function e(r){return"propertyName"in r}let t=r=>{if(!e(r)||!r.target)return;let o=L.get(r.target);o||(o=new Set,L.set(r.target,o),r.target.addEventListener("transitioncancel",n,{once:!0})),o.add(r.propertyName)},n=r=>{if(!e(r)||!r.target)return;let o=L.get(r.target);if(o&&(o.delete(r.propertyName),o.size===0&&(r.target.removeEventListener("transitioncancel",n),L.delete(r.target)),L.size===0)){for(let i of te)i();te.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?be():document.addEventListener("DOMContentLoaded",be));function wt(e){requestAnimationFrame(()=>{L.size===0?e():te.add(e)})}function me(e,t){let n=window.getComputedStyle(e),r=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return r&&t&&(r=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),r}function Fe(e,t){let n=e;for(me(n,t)&&(n=n.parentElement);n&&!me(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}function yt(e){return e.mozInputSource===0&&e.isTrusted?!0:gt()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Tt(e,t,n){let[r,o]=u.useState(e||t),i=u.useRef(e!==void 0),a=e!==void 0;u.useEffect(()=>{let l=i.current;l!==a&&console.warn(`WARN: A component changed from ${l?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}.`),i.current=a},[a]);let c=a?e:r,d=u.useCallback((l,...s)=>{let f=(v,...m)=>{n&&(Object.is(c,v)||n(v,...m)),a||(c=v)};typeof l=="function"?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),o((m,...b)=>{let S=l(a?c:m,...b);return f(S,...s),a?m:S})):(a||o(l),f(l,...s))},[a,c,n]);return[c,d]}const Pe=u.createContext({register:()=>{}});Pe.displayName="PressResponderContext";function kt({children:e}){let t=u.useMemo(()=>({register:()=>{}}),[]);return u.createElement(Pe.Provider,{value:t},e)}class St{isDefaultPrevented(){return this.nativeEvent.defaultPrevented}preventDefault(){this.defaultPrevented=!0,this.nativeEvent.preventDefault()}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPropagationStopped=()=>!0}isPropagationStopped(){return!1}persist(){}constructor(t,n){this.nativeEvent=n,this.target=n.target,this.currentTarget=n.currentTarget,this.relatedTarget=n.relatedTarget,this.bubbles=n.bubbles,this.cancelable=n.cancelable,this.defaultPrevented=n.defaultPrevented,this.eventPhase=n.eventPhase,this.isTrusted=n.isTrusted,this.timeStamp=n.timeStamp,this.type=t}}function xt(e){let t=u.useRef({isFocused:!1,observer:null});E(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=I(r=>{e==null||e(r)});return u.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,i=a=>{t.current.isFocused=!1,o.disabled&&n(new St("blur",a)),t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var a;(a=t.current.observer)===null||a===void 0||a.disconnect();let c=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let B=null,Nt=new Set,R=new Map,P=!1,ne=!1;function se(e,t){for(let n of Nt)n(e,t)}function Ct(e){return!(e.metaKey||!Ce()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function G(e){P=!0,Ct(e)&&(B="keyboard",se("keyboard",e))}function k(e){B="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(P=!0,se("pointer",e))}function Le(e){yt(e)&&(P=!0,B="virtual")}function _e(e){e.target===window||e.target===document||(!P&&!ne&&(B="virtual",se("virtual",e)),P=!1,ne=!1)}function Oe(){P=!1,ne=!0}function $e(e){if(typeof window>"u"||R.get(U(e)))return;const t=U(e),n=g(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){P=!0,r.apply(this,arguments)},n.addEventListener("keydown",G,!0),n.addEventListener("keyup",G,!0),n.addEventListener("click",Le,!0),t.addEventListener("focus",_e,!0),t.addEventListener("blur",Oe,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",k,!0),n.addEventListener("pointermove",k,!0),n.addEventListener("pointerup",k,!0)):(n.addEventListener("mousedown",k,!0),n.addEventListener("mousemove",k,!0),n.addEventListener("mouseup",k,!0)),t.addEventListener("beforeunload",()=>{Me(e)},{once:!0}),R.set(t,{focus:r})}const Me=(e,t)=>{const n=U(e),r=g(e);t&&r.removeEventListener("DOMContentLoaded",t),R.has(n)&&(n.HTMLElement.prototype.focus=R.get(n).focus,r.removeEventListener("keydown",G,!0),r.removeEventListener("keyup",G,!0),r.removeEventListener("click",Le,!0),n.removeEventListener("focus",_e,!0),n.removeEventListener("blur",Oe,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",k,!0),r.removeEventListener("pointermove",k,!0),r.removeEventListener("pointerup",k,!0)):(r.removeEventListener("mousedown",k,!0),r.removeEventListener("mousemove",k,!0),r.removeEventListener("mouseup",k,!0)),R.delete(n))};function Ft(e){const t=g(e);let n;return t.readyState!=="loading"?$e(e):(n=()=>{$e(e)},t.addEventListener("DOMContentLoaded",n)),()=>Me(e,n)}typeof document<"u"&&Ft();function Pt(){return B}function Lt(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,i=u.useRef({isFocusWithin:!1}),a=u.useCallback(l=>{i.current.isFocusWithin&&!l.currentTarget.contains(l.relatedTarget)&&(i.current.isFocusWithin=!1,n&&n(l),o&&o(!1))},[n,o,i]),c=xt(a),d=u.useCallback(l=>{!i.current.isFocusWithin&&document.activeElement===l.target&&(r&&r(l),o&&o(!0),i.current.isFocusWithin=!0,c(l))},[r,o,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:a}}}function _t(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:o}=e,i=u.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),a=I(d=>{n&&V(d,t)&&(o&&o(d),i.current.isPointerDown=!0)}),c=I(d=>{n&&n(d)});u.useEffect(()=>{let d=i.current;if(r)return;const l=t.current,s=g(l);if(typeof PointerEvent<"u"){let f=v=>{d.isPointerDown&&V(v,t)&&c(v),d.isPointerDown=!1};return s.addEventListener("pointerdown",a,!0),s.addEventListener("pointerup",f,!0),()=>{s.removeEventListener("pointerdown",a,!0),s.removeEventListener("pointerup",f,!0)}}else{let f=m=>{d.ignoreEmulatedMouseEvents?d.ignoreEmulatedMouseEvents=!1:d.isPointerDown&&V(m,t)&&c(m),d.isPointerDown=!1},v=m=>{d.ignoreEmulatedMouseEvents=!0,d.isPointerDown&&V(m,t)&&c(m),d.isPointerDown=!1};return s.addEventListener("mousedown",a,!0),s.addEventListener("mouseup",f,!0),s.addEventListener("touchstart",a,!0),s.addEventListener("touchend",v,!0),()=>{s.removeEventListener("mousedown",a,!0),s.removeEventListener("mouseup",f,!0),s.removeEventListener("touchstart",a,!0),s.removeEventListener("touchend",v,!0)}}},[t,r,a,c])}function V(e,t){if(e.button>0)return!1;if(e.target){const n=e.target.ownerDocument;if(!n||!n.documentElement.contains(e.target)||e.target.closest("[data-react-aria-top-layer]"))return!1}return t.current&&!t.current.contains(e.target)}function re(e){const t=g(e);if(Pt()==="virtual"){let n=t.activeElement;wt(()=>{t.activeElement===n&&e.isConnected&&ve(e)})}else ve(e)}function Ot(e){const t=U(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,o=n!=="none"&&r!=="hidden"&&r!=="collapse";if(o){const{getComputedStyle:i}=e.ownerDocument.defaultView;let{display:a,visibility:c}=i(e);o=a!=="none"&&c!=="hidden"&&c!=="collapse"}return o}function Mt(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function De(e,t){return e.nodeName!=="#comment"&&Ot(e)&&Mt(e,t)&&(!e.parentElement||De(e.parentElement,e))}const he=u.createContext(null),oe="react-aria-focus-scope-restore";let $=null;function Dt(e){let{children:t,contain:n,restoreFocus:r,autoFocus:o}=e,i=u.useRef(null),a=u.useRef(null),c=u.useRef([]),{parentNode:d}=u.useContext(he)||{},l=u.useMemo(()=>new ie({scopeRef:c}),[c]);E(()=>{let v=d||h.root;if(h.getTreeNode(v.scopeRef)&&$&&!X($,v.scopeRef)){let m=h.getTreeNode($);m&&(v=m)}v.addChild(l),h.addNode(l)},[l,d]),E(()=>{let v=h.getTreeNode(c);v&&(v.contain=!!n)},[n]),E(()=>{var v;let m=(v=i.current)===null||v===void 0?void 0:v.nextSibling,b=[],S=O=>O.stopPropagation();for(;m&&m!==a.current;)b.push(m),m.addEventListener(oe,S),m=m.nextSibling;return c.current=b,()=>{for(let O of b)O.removeEventListener(oe,S)}},[t]),Vt(c,r,n),Wt(c,n),Kt(c,r,n),Ht(c,o),u.useEffect(()=>{const v=g(c.current?c.current[0]:void 0).activeElement;let m=null;if(w(v,c.current)){for(let b of h.traverse())b.scopeRef&&w(v,b.scopeRef.current)&&(m=b);m===h.getTreeNode(c)&&($=m.scopeRef)}},[c]),E(()=>()=>{var v,m,b;let S=(b=(m=h.getTreeNode(c))===null||m===void 0||(v=m.parent)===null||v===void 0?void 0:v.scopeRef)!==null&&b!==void 0?b:null;(c===$||X(c,$))&&(!S||h.getTreeNode(S))&&($=S),h.removeTreeNode(c)},[c]);let s=u.useMemo(()=>At(c),[]),f=u.useMemo(()=>({focusManager:s,parentNode:l}),[l,s]);return u.createElement(he.Provider,{value:f},u.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:i}),t,u.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:a}))}function At(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:o,wrap:i,accept:a}=t,c=r||g(n[0]).activeElement,d=n[0].previousElementSibling,l=F(n),s=C(l,{tabbable:o,accept:a},n);s.currentNode=w(c,n)?c:d;let f=s.nextNode();return!f&&i&&(s.currentNode=d,f=s.nextNode()),f&&N(f,!0),f},focusPrevious(t={}){let n=e.current,{from:r,tabbable:o,wrap:i,accept:a}=t,c=r||g(n[0]).activeElement,d=n[n.length-1].nextElementSibling,l=F(n),s=C(l,{tabbable:o,accept:a},n);s.currentNode=w(c,n)?c:d;let f=s.previousNode();return!f&&i&&(s.currentNode=d,f=s.previousNode()),f&&N(f,!0),f},focusFirst(t={}){let n=e.current,{tabbable:r,accept:o}=t,i=F(n),a=C(i,{tabbable:r,accept:o},n);a.currentNode=n[0].previousElementSibling;let c=a.nextNode();return c&&N(c,!0),c},focusLast(t={}){let n=e.current,{tabbable:r,accept:o}=t,i=F(n),a=C(i,{tabbable:r,accept:o},n);a.currentNode=n[n.length-1].nextElementSibling;let c=a.previousNode();return c&&N(c,!0),c}}}const ce=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]"],Rt=ce.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";ce.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const It=ce.join(':not([hidden]):not([tabindex="-1"]),');function F(e){return e[0].parentElement}function A(e){let t=h.getTreeNode($);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function Wt(e,t){let n=u.useRef(void 0),r=u.useRef(void 0);E(()=>{let o=e.current;if(!t){r.current&&(cancelAnimationFrame(r.current),r.current=void 0);return}const i=g(o?o[0]:void 0);let a=l=>{if(l.key!=="Tab"||l.altKey||l.ctrlKey||l.metaKey||!A(e)||l.isComposing)return;let s=i.activeElement,f=e.current;if(!f||!w(s,f))return;let v=F(f),m=C(v,{tabbable:!0},f);if(!s)return;m.currentNode=s;let b=l.shiftKey?m.previousNode():m.nextNode();b||(m.currentNode=l.shiftKey?f[f.length-1].nextElementSibling:f[0].previousElementSibling,b=l.shiftKey?m.previousNode():m.nextNode()),l.preventDefault(),b&&N(b,!0)},c=l=>{(!$||X($,e))&&w(l.target,e.current)?($=e,n.current=l.target):A(e)&&!J(l.target,e)?n.current?n.current.focus():$&&$.current&&ae($.current):A(e)&&(n.current=l.target)},d=l=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{if(i.activeElement&&A(e)&&!J(i.activeElement,e))if($=e,i.body.contains(l.target)){var s;n.current=l.target,(s=n.current)===null||s===void 0||s.focus()}else $.current&&ae($.current)})};return i.addEventListener("keydown",a,!1),i.addEventListener("focusin",c,!1),o==null||o.forEach(l=>l.addEventListener("focusin",c,!1)),o==null||o.forEach(l=>l.addEventListener("focusout",d,!1)),()=>{i.removeEventListener("keydown",a,!1),i.removeEventListener("focusin",c,!1),o==null||o.forEach(l=>l.removeEventListener("focusin",c,!1)),o==null||o.forEach(l=>l.removeEventListener("focusout",d,!1))}},[e,t]),E(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function Ae(e){return J(e)}function w(e,t){return!e||!t?!1:t.some(n=>n.contains(e))}function J(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:n}of h.traverse(h.getTreeNode(t)))if(n&&w(e,n.current))return!0;return!1}function Bt(e){return J(e,$)}function X(e,t){var n;let r=(n=h.getTreeNode(t))===null||n===void 0?void 0:n.parent;for(;r;){if(r.scopeRef===e)return!0;r=r.parent}return!1}function N(e,t=!1){if(e!=null&&!t)try{re(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Re(e,t=!0){let n=e[0].previousElementSibling,r=F(e),o=C(r,{tabbable:t},e);o.currentNode=n;let i=o.nextNode();return t&&!i&&(r=F(e),o=C(r,{tabbable:!1},e),o.currentNode=n,i=o.nextNode()),i}function ae(e,t=!0){N(Re(e,t))}function Ht(e,t){const n=u.useRef(t);u.useEffect(()=>{if(n.current){$=e;const r=g(e.current?e.current[0]:void 0);!w(r.activeElement,$.current)&&e.current&&ae(e.current)}n.current=!1},[e])}function Vt(e,t,n){E(()=>{if(t||n)return;let r=e.current;const o=g(r?r[0]:void 0);let i=a=>{let c=a.target;w(c,e.current)?$=e:Ae(c)||($=null)};return o.addEventListener("focusin",i,!1),r==null||r.forEach(a=>a.addEventListener("focusin",i,!1)),()=>{o.removeEventListener("focusin",i,!1),r==null||r.forEach(a=>a.removeEventListener("focusin",i,!1))}},[e,t,n])}function jt(e){let t=h.getTreeNode($);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(t==null?void 0:t.scopeRef)===e}function Kt(e,t,n){const r=u.useRef(typeof document<"u"?g(e.current?e.current[0]:void 0).activeElement:null);E(()=>{let o=e.current;const i=g(o?o[0]:void 0);if(!t||n)return;let a=()=>{(!$||X($,e))&&w(i.activeElement,e.current)&&($=e)};return i.addEventListener("focusin",a,!1),o==null||o.forEach(c=>c.addEventListener("focusin",a,!1)),()=>{i.removeEventListener("focusin",a,!1),o==null||o.forEach(c=>c.removeEventListener("focusin",a,!1))}},[e,n]),E(()=>{const o=g(e.current?e.current[0]:void 0);if(!t)return;let i=a=>{if(a.key!=="Tab"||a.altKey||a.ctrlKey||a.metaKey||!A(e)||a.isComposing)return;let c=o.activeElement;if(!w(c,e.current))return;let d=h.getTreeNode(e);if(!d)return;let l=d.nodeToRestore,s=C(o.body,{tabbable:!0});s.currentNode=c;let f=a.shiftKey?s.previousNode():s.nextNode();if((!l||!o.body.contains(l)||l===o.body)&&(l=void 0,d.nodeToRestore=void 0),(!f||!w(f,e.current))&&l){s.currentNode=l;do f=a.shiftKey?s.previousNode():s.nextNode();while(w(f,e.current));a.preventDefault(),a.stopPropagation(),f?N(f,!0):Ae(l)?N(l,!0):c.blur()}};return n||o.addEventListener("keydown",i,!0),()=>{n||o.removeEventListener("keydown",i,!0)}},[e,t,n]),E(()=>{const o=g(e.current?e.current[0]:void 0);if(!t)return;let i=h.getTreeNode(e);if(i){var a;return i.nodeToRestore=(a=r.current)!==null&&a!==void 0?a:void 0,()=>{let c=h.getTreeNode(e);if(!c)return;let d=c.nodeToRestore;if(t&&d&&(w(o.activeElement,e.current)||o.activeElement===o.body&&jt(e))){let l=h.clone();requestAnimationFrame(()=>{if(o.activeElement===o.body){let s=l.getTreeNode(e);for(;s;){if(s.nodeToRestore&&s.nodeToRestore.isConnected){Ee(s.nodeToRestore);return}s=s.parent}for(s=l.getTreeNode(e);s;){if(s.scopeRef&&s.scopeRef.current&&h.getTreeNode(s.scopeRef)){let f=Re(s.scopeRef.current,!0);Ee(f);return}s=s.parent}}})}}}},[e,t])}function Ee(e){e.dispatchEvent(new CustomEvent(oe,{bubbles:!0,cancelable:!0}))&&N(e)}function C(e,t,n){let r=t!=null&&t.tabbable?It:Rt,o=g(e).createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(i){var a;return!(t==null||(a=t.from)===null||a===void 0)&&a.contains(i)?NodeFilter.FILTER_REJECT:i.matches(r)&&De(i)&&(!n||w(i,n))&&(!(t!=null&&t.accept)||t.accept(i))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t!=null&&t.from&&(o.currentNode=t.from),o}class ue{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,n,r){let o=this.fastMap.get(n??null);if(!o)return;let i=new ie({scopeRef:t});o.addChild(i),i.parent=o,this.fastMap.set(t,i),r&&(i.nodeToRestore=r)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(t===null)return;let n=this.fastMap.get(t);if(!n)return;let r=n.parent;for(let i of this.traverse())i!==n&&n.nodeToRestore&&i.nodeToRestore&&n.scopeRef&&n.scopeRef.current&&w(i.nodeToRestore,n.scopeRef.current)&&(i.nodeToRestore=n.nodeToRestore);let o=n.children;r&&(r.removeChild(n),o.size>0&&o.forEach(i=>r&&r.addChild(i))),this.fastMap.delete(n.scopeRef)}*traverse(t=this.root){if(t.scopeRef!=null&&(yield t),t.children.size>0)for(let n of t.children)yield*this.traverse(n)}clone(){var t;let n=new ue;var r;for(let o of this.traverse())n.addTreeNode(o.scopeRef,(r=(t=o.parent)===null||t===void 0?void 0:t.scopeRef)!==null&&r!==void 0?r:null,o.nodeToRestore);return n}constructor(){this.fastMap=new Map,this.root=new ie({scopeRef:null}),this.fastMap.set(null,this.root)}}class ie{addChild(t){this.children.add(t),t.parent=this}removeChild(t){this.children.delete(t),t.parent=void 0}constructor(t){this.children=new Set,this.contain=!1,this.scopeRef=t.scopeRef}}let h=new ue;const qt=new WeakMap,x=[];function zt(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:o,isDismissable:i=!1,isKeyboardDismissDisabled:a=!1,shouldCloseOnInteractOutside:c}=e;u.useEffect(()=>(o&&x.push(t),()=>{let b=x.indexOf(t);b>=0&&x.splice(b,1)}),[o,t]);let d=()=>{x[x.length-1]===t&&n&&n()},l=b=>{(!c||c(b.target))&&x[x.length-1]===t&&(b.stopPropagation(),b.preventDefault())},s=b=>{(!c||c(b.target))&&(x[x.length-1]===t&&(b.stopPropagation(),b.preventDefault()),d())},f=b=>{b.key==="Escape"&&!a&&!b.nativeEvent.isComposing&&(b.stopPropagation(),b.preventDefault(),d())};_t({ref:t,onInteractOutside:i&&o?s:null,onInteractOutsideStart:l});let{focusWithinProps:v}=Lt({isDisabled:!r,onBlurWithin:b=>{!b.relatedTarget||Bt(b.relatedTarget)||(!c||c(b.relatedTarget))&&n()}}),m=b=>{b.target===b.currentTarget&&b.preventDefault()};return{overlayProps:{onKeyDown:f,...v},underlayProps:{onPointerDown:m}}}function Ut(e,t,n){let{type:r}=e,{isOpen:o}=t;u.useEffect(()=>{n&&n.current&&qt.set(n.current,t.close)});let i;r==="menu"?i=!0:r==="listbox"&&(i="listbox");let a=xe();return{triggerProps:{"aria-haspopup":i,"aria-expanded":o,"aria-controls":o?a:null,onPress:t.toggle},overlayProps:{id:a}}}const Z=typeof document<"u"&&window.visualViewport,Gt=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let j=0,ee;function Jt(e={}){let{isDisabled:t}=e;E(()=>{if(!t)return j++,j===1&&(Et()?ee=Yt():ee=Xt()),()=>{j--,j===0&&ee()}},[t])}function Xt(){return z(_(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`),_(document.documentElement,"overflow","hidden"))}function Yt(){let e,t,n=l=>{e=Fe(l.target,!0),!(e===document.documentElement&&e===document.body)&&e instanceof HTMLElement&&window.getComputedStyle(e).overscrollBehavior==="auto"&&(t=_(e,"overscrollBehavior","contain"))},r=l=>{if(!e||e===document.documentElement||e===document.body){l.preventDefault();return}e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&l.preventDefault()},o=l=>{let s=l.target;we(s)&&s!==document.activeElement&&(l.preventDefault(),c(),s.style.transform="translateY(-2000px)",s.focus(),requestAnimationFrame(()=>{s.style.transform=""})),t&&t()},i=l=>{let s=l.target;we(s)&&(c(),s.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{s.style.transform="",Z&&(Z.height<window.innerHeight?requestAnimationFrame(()=>{ge(s)}):Z.addEventListener("resize",()=>ge(s),{once:!0}))}))},a=null,c=()=>{if(a)return;let l=()=>{window.scrollTo(0,0)},s=window.pageXOffset,f=window.pageYOffset;a=z(M(window,"scroll",l),_(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`),_(document.documentElement,"overflow","hidden"),_(document.body,"marginTop",`-${f}px`),()=>{window.scrollTo(s,f)}),window.scrollTo(0,0)},d=z(M(document,"touchstart",n,{passive:!1,capture:!0}),M(document,"touchmove",r,{passive:!1,capture:!0}),M(document,"touchend",o,{passive:!1,capture:!0}),M(document,"focus",i,!0));return()=>{t==null||t(),a==null||a(),d()}}function _(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function M(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function ge(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=Fe(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,o=e.getBoundingClientRect().top;o>r+e.clientHeight&&(n.scrollTop+=o-r)}e=n.parentElement}}function we(e){return e instanceof HTMLInputElement&&!Gt.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let D=new WeakMap,y=[];function Qt(e,t=document.body){let n=new Set(e),r=new Set,o=d=>{for(let v of d.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))n.add(v);let l=v=>{if(n.has(v)||r.has(v.parentElement)&&v.parentElement.getAttribute("role")!=="row")return NodeFilter.FILTER_REJECT;for(let m of n)if(v.contains(m))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},s=document.createTreeWalker(d,NodeFilter.SHOW_ELEMENT,{acceptNode:l}),f=l(d);if(f===NodeFilter.FILTER_ACCEPT&&i(d),f!==NodeFilter.FILTER_REJECT){let v=s.nextNode();for(;v!=null;)i(v),v=s.nextNode()}},i=d=>{var l;let s=(l=D.get(d))!==null&&l!==void 0?l:0;d.getAttribute("aria-hidden")==="true"&&s===0||(s===0&&d.setAttribute("aria-hidden","true"),r.add(d),D.set(d,s+1))};y.length&&y[y.length-1].disconnect(),o(t);let a=new MutationObserver(d=>{for(let l of d)if(!(l.type!=="childList"||l.addedNodes.length===0)&&![...n,...r].some(s=>s.contains(l.target))){for(let s of l.removedNodes)s instanceof Element&&(n.delete(s),r.delete(s));for(let s of l.addedNodes)(s instanceof HTMLElement||s instanceof SVGElement)&&(s.dataset.liveAnnouncer==="true"||s.dataset.reactAriaTopLayer==="true")?n.add(s):s instanceof Element&&o(s)}});a.observe(t,{childList:!0,subtree:!0});let c={observe(){a.observe(t,{childList:!0,subtree:!0})},disconnect(){a.disconnect()}};return y.push(c),()=>{a.disconnect();for(let d of r){let l=D.get(d);l===1?(d.removeAttribute("aria-hidden"),D.delete(d)):D.set(d,l-1)}c===y[y.length-1]?(y.pop(),y.length&&y[y.length-1].observe()):y.splice(y.indexOf(c),1)}}const Zt=u.createContext({});function en(){var e;return(e=u.useContext(Zt))!==null&&e!==void 0?e:{}}const Ie=u.createContext(null);function tn(e){let t=Se(),{portalContainer:n=t?null:document.body,isExiting:r}=e,[o,i]=u.useState(!1),a=u.useMemo(()=>({contain:o,setContain:i}),[o,i]),{getContainer:c}=en();if(!e.portalContainer&&c&&(n=c()),!n)return null;let d=e.children;return e.disableFocusManagement||(d=u.createElement(Dt,{restoreFocus:!0,contain:o&&!r},d)),d=u.createElement(Ie.Provider,{value:a},u.createElement(kt,null,d)),qe.createPortal(d,n)}function We(){let e=u.useContext(Ie),t=e==null?void 0:e.setContain;E(()=>{t==null||t(!0)},[t])}function nn(e,t,n){let{overlayProps:r,underlayProps:o}=zt({...e,isOpen:t.isOpen,onClose:t.close},n);return Jt({isDisabled:!t.isOpen}),We(),u.useEffect(()=>{if(t.isOpen)return Qt([n.current])},[t.isOpen,n]),{modalProps:lt(r),underlayProps:o}}function rn(e,t){let{role:n="dialog"}=e,r=at();r=e["aria-label"]?void 0:r;let o=u.useRef(!1);return u.useEffect(()=>{if(t.current&&!t.current.contains(document.activeElement)){re(t.current);let i=setTimeout(()=>{document.activeElement===t.current&&(o.current=!0,t.current&&(t.current.blur(),re(t.current)),o.current=!1)},500);return()=>{clearTimeout(i)}}},[t]),We(),{dialogProps:{...ft(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e["aria-labelledby"]||r,onBlur:i=>{o.current&&i.stopPropagation()}},titleProps:{id:r}}}function on(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Te(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ye(Object(n),!0).forEach(function(r){on(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var an=(e,t,n)=>{for(var r of Object.keys(e)){var o;if(e[r]!==((o=t[r])!==null&&o!==void 0?o:n[r]))return!1}return!0},ln=e=>t=>{var n=e.defaultClassName,r=Te(Te({},e.defaultVariants),t);for(var o in r){var i,a=(i=r[o])!==null&&i!==void 0?i:e.defaultVariants[o];if(a!=null){var c=a;typeof c=="boolean"&&(c=c===!0?"true":"false");var d=e.variantClassNames[o][c];d&&(n+=" "+d)}}for(var[l,s]of e.compoundVariants)an(l,r,e.defaultVariants)&&(n+=" "+s);return n},sn=ln({defaultClassName:"pkg_sps-woodland_focused-task__version_8_20_8__hash_1io4psq1",variantClassNames:{fullWidth:{true:"pkg_sps-woodland_focused-task__version_8_20_8__hash_1io4psq2",false:"pkg_sps-woodland_focused-task__version_8_20_8__hash_1io4psq3"}},defaultVariants:{},compoundVariants:[]}),cn="pkg_sps-woodland_focused-task__version_8_20_8__hash_1io4psq5",un="pkg_sps-woodland_focused-task__version_8_20_8__hash_1io4psq0",dn="pkg_sps-woodland_focused-task__version_8_20_8__hash_1io4psq9",fn="pkg_sps-woodland_focused-task__version_8_20_8__hash_1io4psqa",pn="pkg_sps-woodland_focused-task__version_8_20_8__hash_1io4psq8",vn="pkg_sps-woodland_focused-task__version_8_20_8__hash_1io4psq4",bn="pkg_sps-woodland_focused-task__version_8_20_8__hash_1io4psq7";function de({children:e,className:t="",...n}){return p.createElement("div",{className:T.cl(pn,t),...n},p.createElement("div",{className:T.cl(dn)},p.createElement("div",{className:T.cl(fn)},e)))}T.Metadata.set(de,{name:"FocusedTaskActions"});function mn({children:e,className:t,"data-testid":n,onBlur:r,onFocus:o,overlayProps:i,state:a,onClose:c,fullWidth:d=!1,...l}){const s=p.useRef(null),{modalProps:f,underlayProps:v}=nn({...l},a,s),{dialogProps:m,titleProps:b}=rn(l,s),S=T.combineEventHandlers(f.onFocus,m.onFocus,o),O=T.combineEventHandlers(f.onBlur,m.onBlur,r),Be=T.useChildTestIdAttrBuilder({"data-testid":n}),[Y,He]=T.selectChildren(e,[{type:de}]);function Ve(){c&&typeof c=="function"&&c(),a.close()}const je=p.createElement(Ke.Button,{"aria-label":"Close",onClick:Ve,kind:"icon",icon:"x",className:cn});return p.createElement(tn,null,p.createElement("div",{className:bn,...v,...l},p.createElement("div",{...f,...m,...i,onFocus:S,onBlur:O,...Be("dialog"),ref:s,className:T.cl(un,t)},p.createElement("div",{...b,className:vn},je),p.createElement("div",{className:sn({fullWidth:d})},T.contentOf(He,a.close)),Y&&Y.length>0&&p.createElement(p.Fragment,null,T.contentOf(Y,a.close)))))}function fe(e){return e.state.isOpen?p.createElement(mn,{...e},e.children):p.createElement(p.Fragment,null)}T.Metadata.set(fe,{name:"FocusedTask",props:{fullWidth:{type:"boolean",default:"false"},onBlur:{type:"() => void"},onClose:{type:"() => void"},onFocus:{type:"() => void"}}});function $n(e){let[t,n]=Tt(e.isOpen,e.defaultOpen||!1,e.onOpenChange);const r=u.useCallback(()=>{n(!0)},[n]),o=u.useCallback(()=>{n(!1)},[n]),i=u.useCallback(()=>{n(!t)},[n,t]);return{isOpen:t,setOpen:n,open:r,close:o,toggle:i}}function hn(e={}){const t=$n(e),n=u.useRef(null),{triggerProps:r,overlayProps:o}=Ut({type:"dialog"},t,n),{onPress:i,...a}=r;return{triggerProps:{...a,onClick:i,ref:n},focusedTaskState:t,focusedTaskProps:{overlayProps:o,state:t}}}const En={components:[fe],examples:{hooks:{label:"Using the Hook",description:()=>p.createElement(p.Fragment,null,p.createElement("p",null,"To use the focused task component, you must call the ",p.createElement("code",null,"useFocusedTask")," hook. Optional arguments for this hook include:"),p.createElement("dl",null,p.createElement("dt",null,p.createElement("code",null,"isOpen"),": boolean"),p.createElement("dd",null,"Whether the overlay is open by default (controlled)"),p.createElement("dt",null,p.createElement("code",null,"defaultOpen"),": boolean"),p.createElement("dd",null,"Whether the overlay is open by default (uncontrolled)."),p.createElement("dt",null,p.createElement("code",null,"onOpenChange"),": function"),p.createElement("dd",null,"Handler that is called when the overlay's open state changes.",p.createElement("code",null,"(isOpen: boolean) => void"))),p.createElement("h5",null,"Focused Task Props, Focused Task State, and Trigger Props"),p.createElement("p",null,"The ",p.createElement("code",null,"useFocusedTask")," returns an object with ",p.createElement("code",null,"focusedTaskProps"),","," ",p.createElement("code",null,"focusedTaskState")," and ",p.createElement("code",null,"triggerProps")),p.createElement("p",null,"The ",p.createElement("code",null,"triggerProps")," need to be spread on the element that triggers the focused task."),p.createElement("p",null,"The ",p.createElement("code",null,"focusedTaskState")," object (which is also included in ",p.createElement("code",null,"focusedTaskProps"),") allows programmatic access to the state of the focused task. This includes a read only"," ",p.createElement("code",null,"isOpen")," property, a ",p.createElement("code",null,"setOpen(isOpen: boolean)")," method which can be use to set whether the overlay is open, an ",p.createElement("code",null,"open()")," method which opens the overlay, a ",p.createElement("code",null,"close()")," method which closes the overlay and a"," ",p.createElement("code",null,"toggle()")," method that toggles the overlay's visiblity."),p.createElement("p",null,"The ",p.createElement("code",null,"focusedTaskProps")," should be spread on the actual ",p.createElement("code",null,"FocusedTask")," component."),p.createElement("p",null,"Please refer to the examples to see its implementation"))},standard:{label:"Standard",examples:{basic:{react:pe.code`
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("@sps-woodland/core"),Ke=require("@sps-woodland/buttons"),u=require("react"),qe=require("react-dom"),pe=require("@spscommerce/utils");function ze(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const p=ze(u),E=typeof document<"u"?u.useLayoutEffect:()=>{};function W(e){const t=u.useRef(null);return E(()=>{t.current=e},[e]),u.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}function Ue(e){let[t,n]=u.useState(e),r=u.useRef(null),o=W(()=>{if(!r.current)return;let a=r.current.next();if(a.done){r.current=null;return}t===a.value?o():n(a.value)});E(()=>{r.current&&o()});let i=W(a=>{r.current=a(t),o()});return[t,i]}const q={prefix:String(Math.round(Math.random()*1e10)),current:0},ke=u.createContext(q),Ge=u.createContext(!1);let Je=!!(typeof window<"u"&&window.document&&window.document.createElement),Q=new WeakMap;function Xe(e=!1){let t=u.useContext(ke),n=u.useRef(null);if(n.current===null&&!e){var r,o;let i=(o=u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||o===void 0||(r=o.ReactCurrentOwner)===null||r===void 0?void 0:r.current;if(i){let a=Q.get(i);a==null?Q.set(i,{id:t.current,state:i.memoizedState}):i.memoizedState!==a.state&&(t.current=a.id,Q.delete(i))}n.current=++t.current}return n.current}function Ye(e){let t=u.useContext(ke);t===q&&!Je&&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=Xe(!!e),r=t===q&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${t.prefix}`;return e||`${r}-${n}`}function Qe(e){let t=u.useId(),[n]=u.useState(Se()),r=n||process.env.NODE_ENV==="test"?"react-aria":`react-aria${q.prefix}`;return e||`${r}-${t}`}const Ze=typeof u.useId=="function"?Qe:Ye;function et(){return!1}function tt(){return!0}function nt(e){return()=>{}}function Se(){return typeof u.useSyncExternalStore=="function"?u.useSyncExternalStore(nt,et,tt):u.useContext(Ge)}let rt=!!(typeof window<"u"&&window.document&&window.document.createElement),C=new Map;function xe(e){let[t,n]=u.useState(e),r=u.useRef(null),o=Ze(t),i=u.useCallback(a=>{r.current=a},[]);return rt&&(C.has(o)&&!C.get(o).includes(i)?C.set(o,[...C.get(o),i]):C.set(o,[i])),E(()=>{let a=o;return()=>{C.delete(a)}},[o]),u.useEffect(()=>{let a=r.current;a&&(r.current=null,n(a))}),o}function ot(e,t){if(e===t)return e;let n=C.get(e);if(n)return n.forEach(o=>o(t)),t;let r=C.get(t);return r?(r.forEach(o=>o(e)),e):t}function at(e=[]){let t=xe(),[n,r]=Ue(t),o=u.useCallback(()=>{r(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,r]);return E(o,[t,o,...e]),n}function z(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const g=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},U=e=>e&&"window"in e&&e.window===e?e:g(e).defaultView||window;function Ne(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Ne(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function it(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Ne(e))&&(r&&(r+=" "),r+=t);return r}function lt(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let o in r){let i=t[o],a=r[o];typeof i=="function"&&typeof a=="function"&&o[0]==="o"&&o[1]==="n"&&o.charCodeAt(2)>=65&&o.charCodeAt(2)<=90?t[o]=z(i,a):(o==="className"||o==="UNSAFE_className")&&typeof i=="string"&&typeof a=="string"?t[o]=it(i,a):o==="id"&&i&&a?t.id=ot(i,a):t[o]=a!==void 0?a:i}}return t}const st=new Set(["id"]),ct=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),ut=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),dt=/^(data-.*)$/;function ft(e,t={}){let{labelable:n,isLink:r,propNames:o}=t,i={};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(st.has(a)||n&&ct.has(a)||r&&ut.has(a)||o!=null&&o.has(a)||dt.test(a))&&(i[a]=e[a]);return i}function ve(e){if(pt())e.focus({preventScroll:!0});else{let t=vt(e);e.focus(),bt(t)}}let V=null;function pt(){if(V==null){V=!1;try{document.createElement("div").focus({get preventScroll(){return V=!0,!0}})}catch{}}return V}function vt(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function bt(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function mt(e){var t;return typeof window>"u"||window.navigator==null?!1:((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands.some(n=>e.test(n.brand)))||e.test(window.navigator.userAgent)}function le(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function B(e){let t=null;return()=>(t==null&&(t=e()),t)}const Ce=B(function(){return le(/^Mac/i)}),$t=B(function(){return le(/^iPhone/i)}),ht=B(function(){return le(/^iPad/i)||Ce()&&navigator.maxTouchPoints>1}),Et=B(function(){return $t()||ht()}),gt=B(function(){return mt(/Android/i)});let _=new Map,te=new Set;function be(){if(typeof window>"u")return;function e(r){return"propertyName"in r}let t=r=>{if(!e(r)||!r.target)return;let o=_.get(r.target);o||(o=new Set,_.set(r.target,o),r.target.addEventListener("transitioncancel",n,{once:!0})),o.add(r.propertyName)},n=r=>{if(!e(r)||!r.target)return;let o=_.get(r.target);if(o&&(o.delete(r.propertyName),o.size===0&&(r.target.removeEventListener("transitioncancel",n),_.delete(r.target)),_.size===0)){for(let i of te)i();te.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?be():document.addEventListener("DOMContentLoaded",be));function wt(e){requestAnimationFrame(()=>{_.size===0?e():te.add(e)})}function me(e,t){let n=window.getComputedStyle(e),r=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return r&&t&&(r=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),r}function Fe(e,t){let n=e;for(me(n,t)&&(n=n.parentElement);n&&!me(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}function yt(e){return e.mozInputSource===0&&e.isTrusted?!0:gt()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Tt(e,t,n){let[r,o]=u.useState(e||t),i=u.useRef(e!==void 0),a=e!==void 0;u.useEffect(()=>{let l=i.current;l!==a&&console.warn(`WARN: A component changed from ${l?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}.`),i.current=a},[a]);let c=a?e:r,d=u.useCallback((l,...s)=>{let f=(v,...m)=>{n&&(Object.is(c,v)||n(v,...m)),a||(c=v)};typeof l=="function"?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),o((m,...b)=>{let S=l(a?c:m,...b);return f(S,...s),a?m:S})):(a||o(l),f(l,...s))},[a,c,n]);return[c,d]}const Pe=u.createContext({register:()=>{}});Pe.displayName="PressResponderContext";function kt({children:e}){let t=u.useMemo(()=>({register:()=>{}}),[]);return u.createElement(Pe.Provider,{value:t},e)}class St{isDefaultPrevented(){return this.nativeEvent.defaultPrevented}preventDefault(){this.defaultPrevented=!0,this.nativeEvent.preventDefault()}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPropagationStopped=()=>!0}isPropagationStopped(){return!1}persist(){}constructor(t,n){this.nativeEvent=n,this.target=n.target,this.currentTarget=n.currentTarget,this.relatedTarget=n.relatedTarget,this.bubbles=n.bubbles,this.cancelable=n.cancelable,this.defaultPrevented=n.defaultPrevented,this.eventPhase=n.eventPhase,this.isTrusted=n.isTrusted,this.timeStamp=n.timeStamp,this.type=t}}function xt(e){let t=u.useRef({isFocused:!1,observer:null});E(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=W(r=>{e==null||e(r)});return u.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,i=a=>{t.current.isFocused=!1,o.disabled&&n(new St("blur",a)),t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var a;(a=t.current.observer)===null||a===void 0||a.disconnect();let c=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let H=null,Nt=new Set,I=new Map,L=!1,ne=!1;function se(e,t){for(let n of Nt)n(e,t)}function Ct(e){return!(e.metaKey||!Ce()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function G(e){L=!0,Ct(e)&&(H="keyboard",se("keyboard",e))}function k(e){H="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(L=!0,se("pointer",e))}function Le(e){yt(e)&&(L=!0,H="virtual")}function _e(e){e.target===window||e.target===document||(!L&&!ne&&(H="virtual",se("virtual",e)),L=!1,ne=!1)}function Oe(){L=!1,ne=!0}function $e(e){if(typeof window>"u"||I.get(U(e)))return;const t=U(e),n=g(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){L=!0,r.apply(this,arguments)},n.addEventListener("keydown",G,!0),n.addEventListener("keyup",G,!0),n.addEventListener("click",Le,!0),t.addEventListener("focus",_e,!0),t.addEventListener("blur",Oe,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",k,!0),n.addEventListener("pointermove",k,!0),n.addEventListener("pointerup",k,!0)):(n.addEventListener("mousedown",k,!0),n.addEventListener("mousemove",k,!0),n.addEventListener("mouseup",k,!0)),t.addEventListener("beforeunload",()=>{Me(e)},{once:!0}),I.set(t,{focus:r})}const Me=(e,t)=>{const n=U(e),r=g(e);t&&r.removeEventListener("DOMContentLoaded",t),I.has(n)&&(n.HTMLElement.prototype.focus=I.get(n).focus,r.removeEventListener("keydown",G,!0),r.removeEventListener("keyup",G,!0),r.removeEventListener("click",Le,!0),n.removeEventListener("focus",_e,!0),n.removeEventListener("blur",Oe,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",k,!0),r.removeEventListener("pointermove",k,!0),r.removeEventListener("pointerup",k,!0)):(r.removeEventListener("mousedown",k,!0),r.removeEventListener("mousemove",k,!0),r.removeEventListener("mouseup",k,!0)),I.delete(n))};function Ft(e){const t=g(e);let n;return t.readyState!=="loading"?$e(e):(n=()=>{$e(e)},t.addEventListener("DOMContentLoaded",n)),()=>Me(e,n)}typeof document<"u"&&Ft();function Pt(){return H}function Lt(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,i=u.useRef({isFocusWithin:!1}),a=u.useCallback(l=>{i.current.isFocusWithin&&!l.currentTarget.contains(l.relatedTarget)&&(i.current.isFocusWithin=!1,n&&n(l),o&&o(!1))},[n,o,i]),c=xt(a),d=u.useCallback(l=>{!i.current.isFocusWithin&&document.activeElement===l.target&&(r&&r(l),o&&o(!0),i.current.isFocusWithin=!0,c(l))},[r,o,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:a}}}function _t(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:o}=e,i=u.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),a=W(d=>{n&&j(d,t)&&(o&&o(d),i.current.isPointerDown=!0)}),c=W(d=>{n&&n(d)});u.useEffect(()=>{let d=i.current;if(r)return;const l=t.current,s=g(l);if(typeof PointerEvent<"u"){let f=v=>{d.isPointerDown&&j(v,t)&&c(v),d.isPointerDown=!1};return s.addEventListener("pointerdown",a,!0),s.addEventListener("pointerup",f,!0),()=>{s.removeEventListener("pointerdown",a,!0),s.removeEventListener("pointerup",f,!0)}}else{let f=m=>{d.ignoreEmulatedMouseEvents?d.ignoreEmulatedMouseEvents=!1:d.isPointerDown&&j(m,t)&&c(m),d.isPointerDown=!1},v=m=>{d.ignoreEmulatedMouseEvents=!0,d.isPointerDown&&j(m,t)&&c(m),d.isPointerDown=!1};return s.addEventListener("mousedown",a,!0),s.addEventListener("mouseup",f,!0),s.addEventListener("touchstart",a,!0),s.addEventListener("touchend",v,!0),()=>{s.removeEventListener("mousedown",a,!0),s.removeEventListener("mouseup",f,!0),s.removeEventListener("touchstart",a,!0),s.removeEventListener("touchend",v,!0)}}},[t,r,a,c])}function j(e,t){if(e.button>0)return!1;if(e.target){const n=e.target.ownerDocument;if(!n||!n.documentElement.contains(e.target)||e.target.closest("[data-react-aria-top-layer]"))return!1}return t.current&&!t.current.contains(e.target)}function re(e){const t=g(e);if(Pt()==="virtual"){let n=t.activeElement;wt(()=>{t.activeElement===n&&e.isConnected&&ve(e)})}else ve(e)}function Ot(e){const t=U(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,o=n!=="none"&&r!=="hidden"&&r!=="collapse";if(o){const{getComputedStyle:i}=e.ownerDocument.defaultView;let{display:a,visibility:c}=i(e);o=a!=="none"&&c!=="hidden"&&c!=="collapse"}return o}function Mt(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function De(e,t){return e.nodeName!=="#comment"&&Ot(e)&&Mt(e,t)&&(!e.parentElement||De(e.parentElement,e))}const he=u.createContext(null),oe="react-aria-focus-scope-restore";let $=null;function Dt(e){let{children:t,contain:n,restoreFocus:r,autoFocus:o}=e,i=u.useRef(null),a=u.useRef(null),c=u.useRef([]),{parentNode:d}=u.useContext(he)||{},l=u.useMemo(()=>new ie({scopeRef:c}),[c]);E(()=>{let v=d||h.root;if(h.getTreeNode(v.scopeRef)&&$&&!X($,v.scopeRef)){let m=h.getTreeNode($);m&&(v=m)}v.addChild(l),h.addNode(l)},[l,d]),E(()=>{let v=h.getTreeNode(c);v&&(v.contain=!!n)},[n]),E(()=>{var v;let m=(v=i.current)===null||v===void 0?void 0:v.nextSibling,b=[],S=M=>M.stopPropagation();for(;m&&m!==a.current;)b.push(m),m.addEventListener(oe,S),m=m.nextSibling;return c.current=b,()=>{for(let M of b)M.removeEventListener(oe,S)}},[t]),Vt(c,r,n),Wt(c,n),Kt(c,r,n),Ht(c,o),u.useEffect(()=>{const v=g(c.current?c.current[0]:void 0).activeElement;let m=null;if(w(v,c.current)){for(let b of h.traverse())b.scopeRef&&w(v,b.scopeRef.current)&&(m=b);m===h.getTreeNode(c)&&($=m.scopeRef)}},[c]),E(()=>()=>{var v,m,b;let S=(b=(m=h.getTreeNode(c))===null||m===void 0||(v=m.parent)===null||v===void 0?void 0:v.scopeRef)!==null&&b!==void 0?b:null;(c===$||X(c,$))&&(!S||h.getTreeNode(S))&&($=S),h.removeTreeNode(c)},[c]);let s=u.useMemo(()=>At(c),[]),f=u.useMemo(()=>({focusManager:s,parentNode:l}),[l,s]);return u.createElement(he.Provider,{value:f},u.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:i}),t,u.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:a}))}function At(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:o,wrap:i,accept:a}=t,c=r||g(n[0]).activeElement,d=n[0].previousElementSibling,l=P(n),s=F(l,{tabbable:o,accept:a},n);s.currentNode=w(c,n)?c:d;let f=s.nextNode();return!f&&i&&(s.currentNode=d,f=s.nextNode()),f&&N(f,!0),f},focusPrevious(t={}){let n=e.current,{from:r,tabbable:o,wrap:i,accept:a}=t,c=r||g(n[0]).activeElement,d=n[n.length-1].nextElementSibling,l=P(n),s=F(l,{tabbable:o,accept:a},n);s.currentNode=w(c,n)?c:d;let f=s.previousNode();return!f&&i&&(s.currentNode=d,f=s.previousNode()),f&&N(f,!0),f},focusFirst(t={}){let n=e.current,{tabbable:r,accept:o}=t,i=P(n),a=F(i,{tabbable:r,accept:o},n);a.currentNode=n[0].previousElementSibling;let c=a.nextNode();return c&&N(c,!0),c},focusLast(t={}){let n=e.current,{tabbable:r,accept:o}=t,i=P(n),a=F(i,{tabbable:r,accept:o},n);a.currentNode=n[n.length-1].nextElementSibling;let c=a.previousNode();return c&&N(c,!0),c}}}const ce=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]"],Rt=ce.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";ce.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const It=ce.join(':not([hidden]):not([tabindex="-1"]),');function P(e){return e[0].parentElement}function R(e){let t=h.getTreeNode($);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function Wt(e,t){let n=u.useRef(void 0),r=u.useRef(void 0);E(()=>{let o=e.current;if(!t){r.current&&(cancelAnimationFrame(r.current),r.current=void 0);return}const i=g(o?o[0]:void 0);let a=l=>{if(l.key!=="Tab"||l.altKey||l.ctrlKey||l.metaKey||!R(e)||l.isComposing)return;let s=i.activeElement,f=e.current;if(!f||!w(s,f))return;let v=P(f),m=F(v,{tabbable:!0},f);if(!s)return;m.currentNode=s;let b=l.shiftKey?m.previousNode():m.nextNode();b||(m.currentNode=l.shiftKey?f[f.length-1].nextElementSibling:f[0].previousElementSibling,b=l.shiftKey?m.previousNode():m.nextNode()),l.preventDefault(),b&&N(b,!0)},c=l=>{(!$||X($,e))&&w(l.target,e.current)?($=e,n.current=l.target):R(e)&&!J(l.target,e)?n.current?n.current.focus():$&&$.current&&ae($.current):R(e)&&(n.current=l.target)},d=l=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{if(i.activeElement&&R(e)&&!J(i.activeElement,e))if($=e,i.body.contains(l.target)){var s;n.current=l.target,(s=n.current)===null||s===void 0||s.focus()}else $.current&&ae($.current)})};return i.addEventListener("keydown",a,!1),i.addEventListener("focusin",c,!1),o==null||o.forEach(l=>l.addEventListener("focusin",c,!1)),o==null||o.forEach(l=>l.addEventListener("focusout",d,!1)),()=>{i.removeEventListener("keydown",a,!1),i.removeEventListener("focusin",c,!1),o==null||o.forEach(l=>l.removeEventListener("focusin",c,!1)),o==null||o.forEach(l=>l.removeEventListener("focusout",d,!1))}},[e,t]),E(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function Ae(e){return J(e)}function w(e,t){return!e||!t?!1:t.some(n=>n.contains(e))}function J(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:n}of h.traverse(h.getTreeNode(t)))if(n&&w(e,n.current))return!0;return!1}function Bt(e){return J(e,$)}function X(e,t){var n;let r=(n=h.getTreeNode(t))===null||n===void 0?void 0:n.parent;for(;r;){if(r.scopeRef===e)return!0;r=r.parent}return!1}function N(e,t=!1){if(e!=null&&!t)try{re(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Re(e,t=!0){let n=e[0].previousElementSibling,r=P(e),o=F(r,{tabbable:t},e);o.currentNode=n;let i=o.nextNode();return t&&!i&&(r=P(e),o=F(r,{tabbable:!1},e),o.currentNode=n,i=o.nextNode()),i}function ae(e,t=!0){N(Re(e,t))}function Ht(e,t){const n=u.useRef(t);u.useEffect(()=>{if(n.current){$=e;const r=g(e.current?e.current[0]:void 0);!w(r.activeElement,$.current)&&e.current&&ae(e.current)}n.current=!1},[e])}function Vt(e,t,n){E(()=>{if(t||n)return;let r=e.current;const o=g(r?r[0]:void 0);let i=a=>{let c=a.target;w(c,e.current)?$=e:Ae(c)||($=null)};return o.addEventListener("focusin",i,!1),r==null||r.forEach(a=>a.addEventListener("focusin",i,!1)),()=>{o.removeEventListener("focusin",i,!1),r==null||r.forEach(a=>a.removeEventListener("focusin",i,!1))}},[e,t,n])}function jt(e){let t=h.getTreeNode($);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(t==null?void 0:t.scopeRef)===e}function Kt(e,t,n){const r=u.useRef(typeof document<"u"?g(e.current?e.current[0]:void 0).activeElement:null);E(()=>{let o=e.current;const i=g(o?o[0]:void 0);if(!t||n)return;let a=()=>{(!$||X($,e))&&w(i.activeElement,e.current)&&($=e)};return i.addEventListener("focusin",a,!1),o==null||o.forEach(c=>c.addEventListener("focusin",a,!1)),()=>{i.removeEventListener("focusin",a,!1),o==null||o.forEach(c=>c.removeEventListener("focusin",a,!1))}},[e,n]),E(()=>{const o=g(e.current?e.current[0]:void 0);if(!t)return;let i=a=>{if(a.key!=="Tab"||a.altKey||a.ctrlKey||a.metaKey||!R(e)||a.isComposing)return;let c=o.activeElement;if(!w(c,e.current))return;let d=h.getTreeNode(e);if(!d)return;let l=d.nodeToRestore,s=F(o.body,{tabbable:!0});s.currentNode=c;let f=a.shiftKey?s.previousNode():s.nextNode();if((!l||!o.body.contains(l)||l===o.body)&&(l=void 0,d.nodeToRestore=void 0),(!f||!w(f,e.current))&&l){s.currentNode=l;do f=a.shiftKey?s.previousNode():s.nextNode();while(w(f,e.current));a.preventDefault(),a.stopPropagation(),f?N(f,!0):Ae(l)?N(l,!0):c.blur()}};return n||o.addEventListener("keydown",i,!0),()=>{n||o.removeEventListener("keydown",i,!0)}},[e,t,n]),E(()=>{const o=g(e.current?e.current[0]:void 0);if(!t)return;let i=h.getTreeNode(e);if(i){var a;return i.nodeToRestore=(a=r.current)!==null&&a!==void 0?a:void 0,()=>{let c=h.getTreeNode(e);if(!c)return;let d=c.nodeToRestore;if(t&&d&&(w(o.activeElement,e.current)||o.activeElement===o.body&&jt(e))){let l=h.clone();requestAnimationFrame(()=>{if(o.activeElement===o.body){let s=l.getTreeNode(e);for(;s;){if(s.nodeToRestore&&s.nodeToRestore.isConnected){Ee(s.nodeToRestore);return}s=s.parent}for(s=l.getTreeNode(e);s;){if(s.scopeRef&&s.scopeRef.current&&h.getTreeNode(s.scopeRef)){let f=Re(s.scopeRef.current,!0);Ee(f);return}s=s.parent}}})}}}},[e,t])}function Ee(e){e.dispatchEvent(new CustomEvent(oe,{bubbles:!0,cancelable:!0}))&&N(e)}function F(e,t,n){let r=t!=null&&t.tabbable?It:Rt,o=g(e).createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(i){var a;return!(t==null||(a=t.from)===null||a===void 0)&&a.contains(i)?NodeFilter.FILTER_REJECT:i.matches(r)&&De(i)&&(!n||w(i,n))&&(!(t!=null&&t.accept)||t.accept(i))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t!=null&&t.from&&(o.currentNode=t.from),o}class ue{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,n,r){let o=this.fastMap.get(n??null);if(!o)return;let i=new ie({scopeRef:t});o.addChild(i),i.parent=o,this.fastMap.set(t,i),r&&(i.nodeToRestore=r)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(t===null)return;let n=this.fastMap.get(t);if(!n)return;let r=n.parent;for(let i of this.traverse())i!==n&&n.nodeToRestore&&i.nodeToRestore&&n.scopeRef&&n.scopeRef.current&&w(i.nodeToRestore,n.scopeRef.current)&&(i.nodeToRestore=n.nodeToRestore);let o=n.children;r&&(r.removeChild(n),o.size>0&&o.forEach(i=>r&&r.addChild(i))),this.fastMap.delete(n.scopeRef)}*traverse(t=this.root){if(t.scopeRef!=null&&(yield t),t.children.size>0)for(let n of t.children)yield*this.traverse(n)}clone(){var t;let n=new ue;var r;for(let o of this.traverse())n.addTreeNode(o.scopeRef,(r=(t=o.parent)===null||t===void 0?void 0:t.scopeRef)!==null&&r!==void 0?r:null,o.nodeToRestore);return n}constructor(){this.fastMap=new Map,this.root=new ie({scopeRef:null}),this.fastMap.set(null,this.root)}}class ie{addChild(t){this.children.add(t),t.parent=this}removeChild(t){this.children.delete(t),t.parent=void 0}constructor(t){this.children=new Set,this.contain=!1,this.scopeRef=t.scopeRef}}let h=new ue;const qt=new WeakMap,x=[];function zt(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:o,isDismissable:i=!1,isKeyboardDismissDisabled:a=!1,shouldCloseOnInteractOutside:c}=e;u.useEffect(()=>(o&&x.push(t),()=>{let b=x.indexOf(t);b>=0&&x.splice(b,1)}),[o,t]);let d=()=>{x[x.length-1]===t&&n&&n()},l=b=>{(!c||c(b.target))&&x[x.length-1]===t&&(b.stopPropagation(),b.preventDefault())},s=b=>{(!c||c(b.target))&&(x[x.length-1]===t&&(b.stopPropagation(),b.preventDefault()),d())},f=b=>{b.key==="Escape"&&!a&&!b.nativeEvent.isComposing&&(b.stopPropagation(),b.preventDefault(),d())};_t({ref:t,onInteractOutside:i&&o?s:null,onInteractOutsideStart:l});let{focusWithinProps:v}=Lt({isDisabled:!r,onBlurWithin:b=>{!b.relatedTarget||Bt(b.relatedTarget)||(!c||c(b.relatedTarget))&&n()}}),m=b=>{b.target===b.currentTarget&&b.preventDefault()};return{overlayProps:{onKeyDown:f,...v},underlayProps:{onPointerDown:m}}}function Ut(e,t,n){let{type:r}=e,{isOpen:o}=t;u.useEffect(()=>{n&&n.current&&qt.set(n.current,t.close)});let i;r==="menu"?i=!0:r==="listbox"&&(i="listbox");let a=xe();return{triggerProps:{"aria-haspopup":i,"aria-expanded":o,"aria-controls":o?a:null,onPress:t.toggle},overlayProps:{id:a}}}const Z=typeof document<"u"&&window.visualViewport,Gt=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let K=0,ee;function Jt(e={}){let{isDisabled:t}=e;E(()=>{if(!t)return K++,K===1&&(Et()?ee=Yt():ee=Xt()),()=>{K--,K===0&&ee()}},[t])}function Xt(){return z(O(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`),O(document.documentElement,"overflow","hidden"))}function Yt(){let e,t,n=l=>{e=Fe(l.target,!0),!(e===document.documentElement&&e===document.body)&&e instanceof HTMLElement&&window.getComputedStyle(e).overscrollBehavior==="auto"&&(t=O(e,"overscrollBehavior","contain"))},r=l=>{if(!e||e===document.documentElement||e===document.body){l.preventDefault();return}e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&l.preventDefault()},o=l=>{let s=l.target;we(s)&&s!==document.activeElement&&(l.preventDefault(),c(),s.style.transform="translateY(-2000px)",s.focus(),requestAnimationFrame(()=>{s.style.transform=""})),t&&t()},i=l=>{let s=l.target;we(s)&&(c(),s.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{s.style.transform="",Z&&(Z.height<window.innerHeight?requestAnimationFrame(()=>{ge(s)}):Z.addEventListener("resize",()=>ge(s),{once:!0}))}))},a=null,c=()=>{if(a)return;let l=()=>{window.scrollTo(0,0)},s=window.pageXOffset,f=window.pageYOffset;a=z(D(window,"scroll",l),O(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`),O(document.documentElement,"overflow","hidden"),O(document.body,"marginTop",`-${f}px`),()=>{window.scrollTo(s,f)}),window.scrollTo(0,0)},d=z(D(document,"touchstart",n,{passive:!1,capture:!0}),D(document,"touchmove",r,{passive:!1,capture:!0}),D(document,"touchend",o,{passive:!1,capture:!0}),D(document,"focus",i,!0));return()=>{t==null||t(),a==null||a(),d()}}function O(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function D(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function ge(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=Fe(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,o=e.getBoundingClientRect().top;o>r+e.clientHeight&&(n.scrollTop+=o-r)}e=n.parentElement}}function we(e){return e instanceof HTMLInputElement&&!Gt.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let A=new WeakMap,y=[];function Qt(e,t=document.body){let n=new Set(e),r=new Set,o=d=>{for(let v of d.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))n.add(v);let l=v=>{if(n.has(v)||r.has(v.parentElement)&&v.parentElement.getAttribute("role")!=="row")return NodeFilter.FILTER_REJECT;for(let m of n)if(v.contains(m))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},s=document.createTreeWalker(d,NodeFilter.SHOW_ELEMENT,{acceptNode:l}),f=l(d);if(f===NodeFilter.FILTER_ACCEPT&&i(d),f!==NodeFilter.FILTER_REJECT){let v=s.nextNode();for(;v!=null;)i(v),v=s.nextNode()}},i=d=>{var l;let s=(l=A.get(d))!==null&&l!==void 0?l:0;d.getAttribute("aria-hidden")==="true"&&s===0||(s===0&&d.setAttribute("aria-hidden","true"),r.add(d),A.set(d,s+1))};y.length&&y[y.length-1].disconnect(),o(t);let a=new MutationObserver(d=>{for(let l of d)if(!(l.type!=="childList"||l.addedNodes.length===0)&&![...n,...r].some(s=>s.contains(l.target))){for(let s of l.removedNodes)s instanceof Element&&(n.delete(s),r.delete(s));for(let s of l.addedNodes)(s instanceof HTMLElement||s instanceof SVGElement)&&(s.dataset.liveAnnouncer==="true"||s.dataset.reactAriaTopLayer==="true")?n.add(s):s instanceof Element&&o(s)}});a.observe(t,{childList:!0,subtree:!0});let c={observe(){a.observe(t,{childList:!0,subtree:!0})},disconnect(){a.disconnect()}};return y.push(c),()=>{a.disconnect();for(let d of r){let l=A.get(d);l===1?(d.removeAttribute("aria-hidden"),A.delete(d)):A.set(d,l-1)}c===y[y.length-1]?(y.pop(),y.length&&y[y.length-1].observe()):y.splice(y.indexOf(c),1)}}const Zt=u.createContext({});function en(){var e;return(e=u.useContext(Zt))!==null&&e!==void 0?e:{}}const Ie=u.createContext(null);function tn(e){let t=Se(),{portalContainer:n=t?null:document.body,isExiting:r}=e,[o,i]=u.useState(!1),a=u.useMemo(()=>({contain:o,setContain:i}),[o,i]),{getContainer:c}=en();if(!e.portalContainer&&c&&(n=c()),!n)return null;let d=e.children;return e.disableFocusManagement||(d=u.createElement(Dt,{restoreFocus:!0,contain:o&&!r},d)),d=u.createElement(Ie.Provider,{value:a},u.createElement(kt,null,d)),qe.createPortal(d,n)}function We(){let e=u.useContext(Ie),t=e==null?void 0:e.setContain;E(()=>{t==null||t(!0)},[t])}function nn(e,t,n){let{overlayProps:r,underlayProps:o}=zt({...e,isOpen:t.isOpen,onClose:t.close},n);return Jt({isDisabled:!t.isOpen}),We(),u.useEffect(()=>{if(t.isOpen)return Qt([n.current])},[t.isOpen,n]),{modalProps:lt(r),underlayProps:o}}function rn(e,t){let{role:n="dialog"}=e,r=at();r=e["aria-label"]?void 0:r;let o=u.useRef(!1);return u.useEffect(()=>{if(t.current&&!t.current.contains(document.activeElement)){re(t.current);let i=setTimeout(()=>{document.activeElement===t.current&&(o.current=!0,t.current&&(t.current.blur(),re(t.current)),o.current=!1)},500);return()=>{clearTimeout(i)}}},[t]),We(),{dialogProps:{...ft(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e["aria-labelledby"]||r,onBlur:i=>{o.current&&i.stopPropagation()}},titleProps:{id:r}}}function on(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Te(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ye(Object(n),!0).forEach(function(r){on(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var an=(e,t,n)=>{for(var r of Object.keys(e)){var o;if(e[r]!==((o=t[r])!==null&&o!==void 0?o:n[r]))return!1}return!0},ln=e=>t=>{var n=e.defaultClassName,r=Te(Te({},e.defaultVariants),t);for(var o in r){var i,a=(i=r[o])!==null&&i!==void 0?i:e.defaultVariants[o];if(a!=null){var c=a;typeof c=="boolean"&&(c=c===!0?"true":"false");var d=e.variantClassNames[o][c];d&&(n+=" "+d)}}for(var[l,s]of e.compoundVariants)an(l,r,e.defaultVariants)&&(n+=" "+s);return n},sn=ln({defaultClassName:"pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq1",variantClassNames:{fullWidth:{true:"pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq2",false:"pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq3"}},defaultVariants:{},compoundVariants:[]}),cn="pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq5",un="pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq0",dn="pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq9",fn="pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psqa",pn="pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq8",vn="pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq4",bn="pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq7";function de({children:e,className:t="",...n}){return p.createElement("div",{className:T.cl(pn,t),...n},p.createElement("div",{className:T.cl(dn)},p.createElement("div",{className:T.cl(fn)},e)))}T.Metadata.set(de,{name:"FocusedTaskActions"});function mn({children:e,className:t,"data-testid":n,onBlur:r,onFocus:o,overlayProps:i,state:a,onClose:c,fullWidth:d=!1,...l}){const s=p.useRef(null),{modalProps:f,underlayProps:v}=nn({...l},a,s),{dialogProps:m,titleProps:b}=rn(l,s),S=T.combineEventHandlers(f.onFocus,m.onFocus,o),M=T.combineEventHandlers(f.onBlur,m.onBlur,r),Be=T.useChildTestIdAttrBuilder({"data-testid":n}),[Y,He]=T.selectChildren(e,[{type:de}]);function Ve(){c&&typeof c=="function"&&c(),a.close()}const je=p.createElement(Ke.Button,{"aria-label":"Close",onClick:Ve,kind:"icon",icon:"x",className:cn});return p.createElement(tn,null,p.createElement("div",{className:bn,...v,...l},p.createElement("div",{...f,...m,...i,onFocus:S,onBlur:M,...Be("dialog"),ref:s,className:T.cl(un,t)},p.createElement("div",{...b,className:vn},je),p.createElement("div",{className:sn({fullWidth:d})},T.contentOf(He,a.close)),Y&&Y.length>0&&p.createElement(p.Fragment,null,T.contentOf(Y,a.close)))))}function fe(e){return e.state.isOpen?p.createElement(mn,{...e},e.children):p.createElement(p.Fragment,null)}T.Metadata.set(fe,{name:"FocusedTask",props:{fullWidth:{type:"boolean",default:"false"},onBlur:{type:"() => void"},onClose:{type:"() => void"},onFocus:{type:"() => void"}}});function $n(e){let[t,n]=Tt(e.isOpen,e.defaultOpen||!1,e.onOpenChange);const r=u.useCallback(()=>{n(!0)},[n]),o=u.useCallback(()=>{n(!1)},[n]),i=u.useCallback(()=>{n(!t)},[n,t]);return{isOpen:t,setOpen:n,open:r,close:o,toggle:i}}function hn(e={}){const t=$n(e),n=u.useRef(null),{triggerProps:r,overlayProps:o}=Ut({type:"dialog"},t,n),{onPress:i,...a}=r;return{triggerProps:{...a,onClick:i,ref:n},focusedTaskState:t,focusedTaskProps:{overlayProps:o,state:t}}}const En={components:[fe],examples:{hooks:{label:"Using the Hook",description:()=>p.createElement(p.Fragment,null,p.createElement("p",null,"To use the focused task component, you must call the ",p.createElement("code",null,"useFocusedTask")," hook. Optional arguments for this hook include:"),p.createElement("dl",null,p.createElement("dt",null,p.createElement("code",null,"isOpen"),": boolean"),p.createElement("dd",null,"Whether the overlay is open by default (controlled)"),p.createElement("dt",null,p.createElement("code",null,"defaultOpen"),": boolean"),p.createElement("dd",null,"Whether the overlay is open by default (uncontrolled)."),p.createElement("dt",null,p.createElement("code",null,"onOpenChange"),": function"),p.createElement("dd",null,"Handler that is called when the overlay's open state changes.",p.createElement("code",null,"(isOpen: boolean) => void"))),p.createElement("h5",null,"Focused Task Props, Focused Task State, and Trigger Props"),p.createElement("p",null,"The ",p.createElement("code",null,"useFocusedTask")," returns an object with ",p.createElement("code",null,"focusedTaskProps"),","," ",p.createElement("code",null,"focusedTaskState")," and ",p.createElement("code",null,"triggerProps")),p.createElement("p",null,"The ",p.createElement("code",null,"triggerProps")," need to be spread on the element that triggers the focused task."),p.createElement("p",null,"The ",p.createElement("code",null,"focusedTaskState")," object (which is also included in ",p.createElement("code",null,"focusedTaskProps"),") allows programmatic access to the state of the focused task. This includes a read only"," ",p.createElement("code",null,"isOpen")," property, a ",p.createElement("code",null,"setOpen(isOpen: boolean)")," method which can be use to set whether the overlay is open, an ",p.createElement("code",null,"open()")," method which opens the overlay, a ",p.createElement("code",null,"close()")," method which closes the overlay and a"," ",p.createElement("code",null,"toggle()")," method that toggles the overlay's visiblity."),p.createElement("p",null,"The ",p.createElement("code",null,"focusedTaskProps")," should be spread on the actual ",p.createElement("code",null,"FocusedTask")," component."),p.createElement("p",null,"Please refer to the examples to see its implementation"))},standard:{label:"Standard",examples:{basic:{react:pe.code`
|
2
2
|
import { FocusedTask, FocusedTaskActions, useFocusedTask } from "@sps-woodland/focused-task";
|
3
3
|
import { Button } from "@sps-woodland/buttons";
|
4
4
|
import { Card } from "@sps-woodland/cards";
|
package/lib/index.es.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import { Metadata as Le, cl as
|
1
|
+
import { Metadata as Le, cl as X, combineEventHandlers as $e, useChildTestIdAttrBuilder as Ze, selectChildren as et, contentOf as he } from "@sps-woodland/core";
|
2
2
|
import { Button as tt } from "@sps-woodland/buttons";
|
3
3
|
import * as f from "react";
|
4
|
-
import h, { useRef as y, useCallback as S, useState as
|
4
|
+
import h, { useRef as y, useCallback as S, useState as j, useContext as A, useEffect as P, useMemo as H, createContext as nt } from "react";
|
5
5
|
import rt from "react-dom";
|
6
6
|
import { code as Ee } from "@spscommerce/utils";
|
7
7
|
const E = typeof document < "u" ? h.useLayoutEffect : () => {
|
8
8
|
};
|
9
|
-
function
|
9
|
+
function K(e) {
|
10
10
|
const t = y(null);
|
11
11
|
return E(() => {
|
12
12
|
t.current = e;
|
@@ -18,7 +18,7 @@ function V(e) {
|
|
18
18
|
}, []);
|
19
19
|
}
|
20
20
|
function ot(e) {
|
21
|
-
let [t, n] =
|
21
|
+
let [t, n] = j(e), r = y(null), o = K(() => {
|
22
22
|
if (!r.current) return;
|
23
23
|
let a = r.current.next();
|
24
24
|
if (a.done) {
|
@@ -30,7 +30,7 @@ function ot(e) {
|
|
30
30
|
E(() => {
|
31
31
|
r.current && o();
|
32
32
|
});
|
33
|
-
let i =
|
33
|
+
let i = K((a) => {
|
34
34
|
r.current = a(t), o();
|
35
35
|
});
|
36
36
|
return [
|
@@ -38,13 +38,13 @@ function ot(e) {
|
|
38
38
|
i
|
39
39
|
];
|
40
40
|
}
|
41
|
-
const
|
41
|
+
const Y = {
|
42
42
|
prefix: String(Math.round(Math.random() * 1e10)),
|
43
43
|
current: 0
|
44
|
-
}, Ce = /* @__PURE__ */ h.createContext(
|
44
|
+
}, Ce = /* @__PURE__ */ h.createContext(Y), at = /* @__PURE__ */ h.createContext(!1);
|
45
45
|
let it = !!(typeof window < "u" && window.document && window.document.createElement), oe = /* @__PURE__ */ new WeakMap();
|
46
46
|
function lt(e = !1) {
|
47
|
-
let t =
|
47
|
+
let t = A(Ce), n = y(null);
|
48
48
|
if (n.current === null && !e) {
|
49
49
|
var r, o;
|
50
50
|
let i = (o = h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || o === void 0 || (r = o.ReactCurrentOwner) === null || r === void 0 ? void 0 : r.current;
|
@@ -60,13 +60,13 @@ function lt(e = !1) {
|
|
60
60
|
return n.current;
|
61
61
|
}
|
62
62
|
function st(e) {
|
63
|
-
let t =
|
64
|
-
t ===
|
65
|
-
let n = lt(!!e), r = t ===
|
63
|
+
let t = A(Ce);
|
64
|
+
t === Y && !it && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
|
65
|
+
let n = lt(!!e), r = t === Y && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${t.prefix}`;
|
66
66
|
return e || `${r}-${n}`;
|
67
67
|
}
|
68
68
|
function ct(e) {
|
69
|
-
let t = h.useId(), [n] =
|
69
|
+
let t = h.useId(), [n] = j(_e()), r = n || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${Y.prefix}`;
|
70
70
|
return e || `${r}-${t}`;
|
71
71
|
}
|
72
72
|
const ut = typeof h.useId == "function" ? ct : st;
|
@@ -81,17 +81,22 @@ function pt(e) {
|
|
81
81
|
};
|
82
82
|
}
|
83
83
|
function _e() {
|
84
|
-
return typeof h.useSyncExternalStore == "function" ? h.useSyncExternalStore(pt, dt, ft) :
|
84
|
+
return typeof h.useSyncExternalStore == "function" ? h.useSyncExternalStore(pt, dt, ft) : A(at);
|
85
85
|
}
|
86
|
-
let vt = !!(typeof window < "u" && window.document && window.document.createElement),
|
86
|
+
let vt = !!(typeof window < "u" && window.document && window.document.createElement), L = /* @__PURE__ */ new Map();
|
87
87
|
function Oe(e) {
|
88
|
-
let [t, n] =
|
88
|
+
let [t, n] = j(e), r = y(null), o = ut(t), i = S((a) => {
|
89
89
|
r.current = a;
|
90
90
|
}, []);
|
91
|
-
return vt &&
|
91
|
+
return vt && (L.has(o) && !L.get(o).includes(i) ? L.set(o, [
|
92
|
+
...L.get(o),
|
93
|
+
i
|
94
|
+
]) : L.set(o, [
|
95
|
+
i
|
96
|
+
])), E(() => {
|
92
97
|
let a = o;
|
93
98
|
return () => {
|
94
|
-
|
99
|
+
L.delete(a);
|
95
100
|
};
|
96
101
|
}, [
|
97
102
|
o
|
@@ -102,11 +107,11 @@ function Oe(e) {
|
|
102
107
|
}
|
103
108
|
function bt(e, t) {
|
104
109
|
if (e === t) return e;
|
105
|
-
let n =
|
110
|
+
let n = L.get(e);
|
106
111
|
if (n)
|
107
|
-
return n(t), t;
|
108
|
-
let r =
|
109
|
-
return r ? (r(e), e) : t;
|
112
|
+
return n.forEach((o) => o(t)), t;
|
113
|
+
let r = L.get(t);
|
114
|
+
return r ? (r.forEach((o) => o(e)), e) : t;
|
110
115
|
}
|
111
116
|
function mt(e = []) {
|
112
117
|
let t = Oe(), [n, r] = ot(t), o = S(() => {
|
@@ -191,20 +196,20 @@ function ge(e) {
|
|
191
196
|
e.focus(), St(t);
|
192
197
|
}
|
193
198
|
}
|
194
|
-
let
|
199
|
+
let U = null;
|
195
200
|
function xt() {
|
196
|
-
if (
|
197
|
-
|
201
|
+
if (U == null) {
|
202
|
+
U = !1;
|
198
203
|
try {
|
199
204
|
document.createElement("div").focus({
|
200
205
|
get preventScroll() {
|
201
|
-
return
|
206
|
+
return U = !0, !0;
|
202
207
|
}
|
203
208
|
});
|
204
209
|
} catch {
|
205
210
|
}
|
206
211
|
}
|
207
|
-
return
|
212
|
+
return U;
|
208
213
|
}
|
209
214
|
function kt(e) {
|
210
215
|
let t = e.parentNode, n = [], r = document.scrollingElement || document.documentElement;
|
@@ -232,23 +237,23 @@ function pe(e) {
|
|
232
237
|
var t;
|
233
238
|
return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
|
234
239
|
}
|
235
|
-
function
|
240
|
+
function q(e) {
|
236
241
|
let t = null;
|
237
242
|
return () => (t == null && (t = e()), t);
|
238
243
|
}
|
239
|
-
const De =
|
244
|
+
const De = q(function() {
|
240
245
|
return pe(/^Mac/i);
|
241
|
-
}), Ft =
|
246
|
+
}), Ft = q(function() {
|
242
247
|
return pe(/^iPhone/i);
|
243
|
-
}), Pt =
|
248
|
+
}), Pt = q(function() {
|
244
249
|
return pe(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
245
250
|
De() && navigator.maxTouchPoints > 1;
|
246
|
-
}), Lt =
|
251
|
+
}), Lt = q(function() {
|
247
252
|
return Ft() || Pt();
|
248
|
-
}), Ct =
|
253
|
+
}), Ct = q(function() {
|
249
254
|
return Nt(/Android/i);
|
250
255
|
});
|
251
|
-
let
|
256
|
+
let M = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new Set();
|
252
257
|
function we() {
|
253
258
|
if (typeof window > "u") return;
|
254
259
|
function e(r) {
|
@@ -256,14 +261,14 @@ function we() {
|
|
256
261
|
}
|
257
262
|
let t = (r) => {
|
258
263
|
if (!e(r) || !r.target) return;
|
259
|
-
let o =
|
260
|
-
o || (o = /* @__PURE__ */ new Set(),
|
264
|
+
let o = M.get(r.target);
|
265
|
+
o || (o = /* @__PURE__ */ new Set(), M.set(r.target, o), r.target.addEventListener("transitioncancel", n, {
|
261
266
|
once: !0
|
262
267
|
})), o.add(r.propertyName);
|
263
268
|
}, n = (r) => {
|
264
269
|
if (!e(r) || !r.target) return;
|
265
|
-
let o =
|
266
|
-
if (o && (o.delete(r.propertyName), o.size === 0 && (r.target.removeEventListener("transitioncancel", n),
|
270
|
+
let o = M.get(r.target);
|
271
|
+
if (o && (o.delete(r.propertyName), o.size === 0 && (r.target.removeEventListener("transitioncancel", n), M.delete(r.target)), M.size === 0)) {
|
267
272
|
for (let i of le) i();
|
268
273
|
le.clear();
|
269
274
|
}
|
@@ -273,7 +278,7 @@ function we() {
|
|
273
278
|
typeof document < "u" && (document.readyState !== "loading" ? we() : document.addEventListener("DOMContentLoaded", we));
|
274
279
|
function _t(e) {
|
275
280
|
requestAnimationFrame(() => {
|
276
|
-
|
281
|
+
M.size === 0 ? e() : le.add(e);
|
277
282
|
});
|
278
283
|
}
|
279
284
|
function ye(e, t) {
|
@@ -289,7 +294,7 @@ function Ot(e) {
|
|
289
294
|
return e.mozInputSource === 0 && e.isTrusted ? !0 : Ct() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
|
290
295
|
}
|
291
296
|
function Mt(e, t, n) {
|
292
|
-
let [r, o] =
|
297
|
+
let [r, o] = j(e || t), i = y(e !== void 0), a = e !== void 0;
|
293
298
|
P(() => {
|
294
299
|
let l = i.current;
|
295
300
|
l !== a && console.warn(`WARN: A component changed from ${l ? "controlled" : "uncontrolled"} to ${a ? "controlled" : "uncontrolled"}.`), i.current = a;
|
@@ -320,7 +325,7 @@ const We = h.createContext({
|
|
320
325
|
});
|
321
326
|
We.displayName = "PressResponderContext";
|
322
327
|
function Dt({ children: e }) {
|
323
|
-
let t =
|
328
|
+
let t = H(() => ({
|
324
329
|
register: () => {
|
325
330
|
}
|
326
331
|
}), []);
|
@@ -358,7 +363,7 @@ function Wt(e) {
|
|
358
363
|
r.observer && (r.observer.disconnect(), r.observer = null);
|
359
364
|
};
|
360
365
|
}, []);
|
361
|
-
let n =
|
366
|
+
let n = K((r) => {
|
362
367
|
e == null || e(r);
|
363
368
|
});
|
364
369
|
return S((r) => {
|
@@ -392,7 +397,7 @@ function Wt(e) {
|
|
392
397
|
n
|
393
398
|
]);
|
394
399
|
}
|
395
|
-
let
|
400
|
+
let z = null, It = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Map(), O = !1, se = !1;
|
396
401
|
function ve(e, t) {
|
397
402
|
for (let n of It) n(e, t);
|
398
403
|
}
|
@@ -400,37 +405,37 @@ function Bt(e) {
|
|
400
405
|
return !(e.metaKey || !De() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
401
406
|
}
|
402
407
|
function ee(e) {
|
403
|
-
|
408
|
+
O = !0, Bt(e) && (z = "keyboard", ve("keyboard", e));
|
404
409
|
}
|
405
410
|
function x(e) {
|
406
|
-
|
411
|
+
z = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (O = !0, ve("pointer", e));
|
407
412
|
}
|
408
413
|
function Ie(e) {
|
409
|
-
Ot(e) && (
|
414
|
+
Ot(e) && (O = !0, z = "virtual");
|
410
415
|
}
|
411
416
|
function Be(e) {
|
412
|
-
e.target === window || e.target === document || (!
|
417
|
+
e.target === window || e.target === document || (!O && !se && (z = "virtual", ve("virtual", e)), O = !1, se = !1);
|
413
418
|
}
|
414
419
|
function Re() {
|
415
|
-
|
420
|
+
O = !1, se = !0;
|
416
421
|
}
|
417
422
|
function Te(e) {
|
418
|
-
if (typeof window > "u" ||
|
423
|
+
if (typeof window > "u" || V.get(Z(e))) return;
|
419
424
|
const t = Z(e), n = g(e);
|
420
425
|
let r = t.HTMLElement.prototype.focus;
|
421
426
|
t.HTMLElement.prototype.focus = function() {
|
422
|
-
|
427
|
+
O = !0, r.apply(this, arguments);
|
423
428
|
}, n.addEventListener("keydown", ee, !0), n.addEventListener("keyup", ee, !0), n.addEventListener("click", Ie, !0), t.addEventListener("focus", Be, !0), t.addEventListener("blur", Re, !1), typeof PointerEvent < "u" ? (n.addEventListener("pointerdown", x, !0), n.addEventListener("pointermove", x, !0), n.addEventListener("pointerup", x, !0)) : (n.addEventListener("mousedown", x, !0), n.addEventListener("mousemove", x, !0), n.addEventListener("mouseup", x, !0)), t.addEventListener("beforeunload", () => {
|
424
429
|
He(e);
|
425
430
|
}, {
|
426
431
|
once: !0
|
427
|
-
}),
|
432
|
+
}), V.set(t, {
|
428
433
|
focus: r
|
429
434
|
});
|
430
435
|
}
|
431
436
|
const He = (e, t) => {
|
432
437
|
const n = Z(e), r = g(e);
|
433
|
-
t && r.removeEventListener("DOMContentLoaded", t),
|
438
|
+
t && r.removeEventListener("DOMContentLoaded", t), V.has(n) && (n.HTMLElement.prototype.focus = V.get(n).focus, r.removeEventListener("keydown", ee, !0), r.removeEventListener("keyup", ee, !0), r.removeEventListener("click", Ie, !0), n.removeEventListener("focus", Be, !0), n.removeEventListener("blur", Re, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", x, !0), r.removeEventListener("pointermove", x, !0), r.removeEventListener("pointerup", x, !0)) : (r.removeEventListener("mousedown", x, !0), r.removeEventListener("mousemove", x, !0), r.removeEventListener("mouseup", x, !0)), V.delete(n));
|
434
439
|
};
|
435
440
|
function Rt(e) {
|
436
441
|
const t = g(e);
|
@@ -441,7 +446,7 @@ function Rt(e) {
|
|
441
446
|
}
|
442
447
|
typeof document < "u" && Rt();
|
443
448
|
function Ht() {
|
444
|
-
return
|
449
|
+
return z;
|
445
450
|
}
|
446
451
|
function Vt(e) {
|
447
452
|
let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: o } = e, i = y({
|
@@ -476,9 +481,9 @@ function Kt(e) {
|
|
476
481
|
let { ref: t, onInteractOutside: n, isDisabled: r, onInteractOutsideStart: o } = e, i = y({
|
477
482
|
isPointerDown: !1,
|
478
483
|
ignoreEmulatedMouseEvents: !1
|
479
|
-
}), a =
|
480
|
-
n &&
|
481
|
-
}), c =
|
484
|
+
}), a = K((u) => {
|
485
|
+
n && G(u, t) && (o && o(u), i.current.isPointerDown = !0);
|
486
|
+
}), c = K((u) => {
|
482
487
|
n && n(u);
|
483
488
|
});
|
484
489
|
P(() => {
|
@@ -487,16 +492,16 @@ function Kt(e) {
|
|
487
492
|
const l = t.current, s = g(l);
|
488
493
|
if (typeof PointerEvent < "u") {
|
489
494
|
let d = (p) => {
|
490
|
-
u.isPointerDown &&
|
495
|
+
u.isPointerDown && G(p, t) && c(p), u.isPointerDown = !1;
|
491
496
|
};
|
492
497
|
return s.addEventListener("pointerdown", a, !0), s.addEventListener("pointerup", d, !0), () => {
|
493
498
|
s.removeEventListener("pointerdown", a, !0), s.removeEventListener("pointerup", d, !0);
|
494
499
|
};
|
495
500
|
} else {
|
496
501
|
let d = (b) => {
|
497
|
-
u.ignoreEmulatedMouseEvents ? u.ignoreEmulatedMouseEvents = !1 : u.isPointerDown &&
|
502
|
+
u.ignoreEmulatedMouseEvents ? u.ignoreEmulatedMouseEvents = !1 : u.isPointerDown && G(b, t) && c(b), u.isPointerDown = !1;
|
498
503
|
}, p = (b) => {
|
499
|
-
u.ignoreEmulatedMouseEvents = !0, u.isPointerDown &&
|
504
|
+
u.ignoreEmulatedMouseEvents = !0, u.isPointerDown && G(b, t) && c(b), u.isPointerDown = !1;
|
500
505
|
};
|
501
506
|
return s.addEventListener("mousedown", a, !0), s.addEventListener("mouseup", d, !0), s.addEventListener("touchstart", a, !0), s.addEventListener("touchend", p, !0), () => {
|
502
507
|
s.removeEventListener("mousedown", a, !0), s.removeEventListener("mouseup", d, !0), s.removeEventListener("touchstart", a, !0), s.removeEventListener("touchend", p, !0);
|
@@ -509,7 +514,7 @@ function Kt(e) {
|
|
509
514
|
c
|
510
515
|
]);
|
511
516
|
}
|
512
|
-
function
|
517
|
+
function G(e, t) {
|
513
518
|
if (e.button > 0) return !1;
|
514
519
|
if (e.target) {
|
515
520
|
const n = e.target.ownerDocument;
|
@@ -547,7 +552,7 @@ function Ve(e, t) {
|
|
547
552
|
const xe = /* @__PURE__ */ h.createContext(null), ue = "react-aria-focus-scope-restore";
|
548
553
|
let m = null;
|
549
554
|
function zt(e) {
|
550
|
-
let { children: t, contain: n, restoreFocus: r, autoFocus: o } = e, i = y(null), a = y(null), c = y([]), { parentNode: u } =
|
555
|
+
let { children: t, contain: n, restoreFocus: r, autoFocus: o } = e, i = y(null), a = y(null), c = y([]), { parentNode: u } = A(xe) || {}, l = H(() => new fe({
|
551
556
|
scopeRef: c
|
552
557
|
}), [
|
553
558
|
c
|
@@ -569,11 +574,11 @@ function zt(e) {
|
|
569
574
|
n
|
570
575
|
]), E(() => {
|
571
576
|
var p;
|
572
|
-
let b = (p = i.current) === null || p === void 0 ? void 0 : p.nextSibling, v = [], k = (
|
577
|
+
let b = (p = i.current) === null || p === void 0 ? void 0 : p.nextSibling, v = [], k = (W) => W.stopPropagation();
|
573
578
|
for (; b && b !== a.current; )
|
574
579
|
v.push(b), b.addEventListener(ue, k), b = b.nextSibling;
|
575
580
|
return c.current = v, () => {
|
576
|
-
for (let
|
581
|
+
for (let W of v) W.removeEventListener(ue, k);
|
577
582
|
};
|
578
583
|
}, [
|
579
584
|
t
|
@@ -593,7 +598,7 @@ function zt(e) {
|
|
593
598
|
}, [
|
594
599
|
c
|
595
600
|
]);
|
596
|
-
let s =
|
601
|
+
let s = H(() => Ut(c), []), d = H(() => ({
|
597
602
|
focusManager: s,
|
598
603
|
parentNode: l
|
599
604
|
}), [
|
@@ -615,7 +620,7 @@ function zt(e) {
|
|
615
620
|
function Ut(e) {
|
616
621
|
return {
|
617
622
|
focusNext(t = {}) {
|
618
|
-
let n = e.current, { from: r, tabbable: o, wrap: i, accept: a } = t, c = r || g(n[0]).activeElement, u = n[0].previousElementSibling, l =
|
623
|
+
let n = e.current, { from: r, tabbable: o, wrap: i, accept: a } = t, c = r || g(n[0]).activeElement, u = n[0].previousElementSibling, l = _(n), s = C(l, {
|
619
624
|
tabbable: o,
|
620
625
|
accept: a
|
621
626
|
}, n);
|
@@ -624,7 +629,7 @@ function Ut(e) {
|
|
624
629
|
return !d && i && (s.currentNode = u, d = s.nextNode()), d && F(d, !0), d;
|
625
630
|
},
|
626
631
|
focusPrevious(t = {}) {
|
627
|
-
let n = e.current, { from: r, tabbable: o, wrap: i, accept: a } = t, c = r || g(n[0]).activeElement, u = n[n.length - 1].nextElementSibling, l =
|
632
|
+
let n = e.current, { from: r, tabbable: o, wrap: i, accept: a } = t, c = r || g(n[0]).activeElement, u = n[n.length - 1].nextElementSibling, l = _(n), s = C(l, {
|
628
633
|
tabbable: o,
|
629
634
|
accept: a
|
630
635
|
}, n);
|
@@ -633,7 +638,7 @@ function Ut(e) {
|
|
633
638
|
return !d && i && (s.currentNode = u, d = s.previousNode()), d && F(d, !0), d;
|
634
639
|
},
|
635
640
|
focusFirst(t = {}) {
|
636
|
-
let n = e.current, { tabbable: r, accept: o } = t, i =
|
641
|
+
let n = e.current, { tabbable: r, accept: o } = t, i = _(n), a = C(i, {
|
637
642
|
tabbable: r,
|
638
643
|
accept: o
|
639
644
|
}, n);
|
@@ -642,7 +647,7 @@ function Ut(e) {
|
|
642
647
|
return c && F(c, !0), c;
|
643
648
|
},
|
644
649
|
focusLast(t = {}) {
|
645
|
-
let n = e.current, { tabbable: r, accept: o } = t, i =
|
650
|
+
let n = e.current, { tabbable: r, accept: o } = t, i = _(n), a = C(i, {
|
646
651
|
tabbable: r,
|
647
652
|
accept: o
|
648
653
|
}, n);
|
@@ -669,10 +674,10 @@ const be = [
|
|
669
674
|
], Gt = be.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
|
670
675
|
be.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
|
671
676
|
const Jt = be.join(':not([hidden]):not([tabindex="-1"]),');
|
672
|
-
function
|
677
|
+
function _(e) {
|
673
678
|
return e[0].parentElement;
|
674
679
|
}
|
675
|
-
function
|
680
|
+
function R(e) {
|
676
681
|
let t = $.getTreeNode(m);
|
677
682
|
for (; t && t.scopeRef !== e; ) {
|
678
683
|
if (t.contain) return !1;
|
@@ -690,10 +695,10 @@ function Xt(e, t) {
|
|
690
695
|
}
|
691
696
|
const i = g(o ? o[0] : void 0);
|
692
697
|
let a = (l) => {
|
693
|
-
if (l.key !== "Tab" || l.altKey || l.ctrlKey || l.metaKey || !
|
698
|
+
if (l.key !== "Tab" || l.altKey || l.ctrlKey || l.metaKey || !R(e) || l.isComposing) return;
|
694
699
|
let s = i.activeElement, d = e.current;
|
695
700
|
if (!d || !w(s, d)) return;
|
696
|
-
let p =
|
701
|
+
let p = _(d), b = C(p, {
|
697
702
|
tabbable: !0
|
698
703
|
}, d);
|
699
704
|
if (!s) return;
|
@@ -701,10 +706,10 @@ function Xt(e, t) {
|
|
701
706
|
let v = l.shiftKey ? b.previousNode() : b.nextNode();
|
702
707
|
v || (b.currentNode = l.shiftKey ? d[d.length - 1].nextElementSibling : d[0].previousElementSibling, v = l.shiftKey ? b.previousNode() : b.nextNode()), l.preventDefault(), v && F(v, !0);
|
703
708
|
}, c = (l) => {
|
704
|
-
(!m || ne(m, e)) && w(l.target, e.current) ? (m = e, n.current = l.target) :
|
709
|
+
(!m || ne(m, e)) && w(l.target, e.current) ? (m = e, n.current = l.target) : R(e) && !te(l.target, e) ? n.current ? n.current.focus() : m && m.current && de(m.current) : R(e) && (n.current = l.target);
|
705
710
|
}, u = (l) => {
|
706
711
|
r.current && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
|
707
|
-
if (i.activeElement &&
|
712
|
+
if (i.activeElement && R(e) && !te(i.activeElement, e))
|
708
713
|
if (m = e, i.body.contains(l.target)) {
|
709
714
|
var s;
|
710
715
|
n.current = l.target, (s = n.current) === null || s === void 0 || s.focus();
|
@@ -758,12 +763,12 @@ function F(e, t = !1) {
|
|
758
763
|
}
|
759
764
|
}
|
760
765
|
function je(e, t = !0) {
|
761
|
-
let n = e[0].previousElementSibling, r =
|
766
|
+
let n = e[0].previousElementSibling, r = _(e), o = C(r, {
|
762
767
|
tabbable: t
|
763
768
|
}, e);
|
764
769
|
o.currentNode = n;
|
765
770
|
let i = o.nextNode();
|
766
|
-
return t && !i && (r =
|
771
|
+
return t && !i && (r = _(e), o = C(r, {
|
767
772
|
tabbable: !1
|
768
773
|
}, e), o.currentNode = n, i = o.nextNode()), i;
|
769
774
|
}
|
@@ -828,12 +833,12 @@ function tn(e, t, n) {
|
|
828
833
|
const o = g(e.current ? e.current[0] : void 0);
|
829
834
|
if (!t) return;
|
830
835
|
let i = (a) => {
|
831
|
-
if (a.key !== "Tab" || a.altKey || a.ctrlKey || a.metaKey || !
|
836
|
+
if (a.key !== "Tab" || a.altKey || a.ctrlKey || a.metaKey || !R(e) || a.isComposing) return;
|
832
837
|
let c = o.activeElement;
|
833
838
|
if (!w(c, e.current)) return;
|
834
839
|
let u = $.getTreeNode(e);
|
835
840
|
if (!u) return;
|
836
|
-
let l = u.nodeToRestore, s =
|
841
|
+
let l = u.nodeToRestore, s = C(o.body, {
|
837
842
|
tabbable: !0
|
838
843
|
});
|
839
844
|
s.currentNode = c;
|
@@ -900,7 +905,7 @@ function ke(e) {
|
|
900
905
|
cancelable: !0
|
901
906
|
})) && F(e);
|
902
907
|
}
|
903
|
-
function
|
908
|
+
function C(e, t, n) {
|
904
909
|
let r = t != null && t.tabbable ? Jt : Gt, o = g(e).createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
905
910
|
acceptNode(i) {
|
906
911
|
var a;
|
@@ -1038,24 +1043,24 @@ const ae = typeof document < "u" && window.visualViewport, an = /* @__PURE__ */
|
|
1038
1043
|
"submit",
|
1039
1044
|
"reset"
|
1040
1045
|
]);
|
1041
|
-
let
|
1046
|
+
let J = 0, ie;
|
1042
1047
|
function ln(e = {}) {
|
1043
1048
|
let { isDisabled: t } = e;
|
1044
1049
|
E(() => {
|
1045
1050
|
if (!t)
|
1046
|
-
return
|
1047
|
-
|
1051
|
+
return J++, J === 1 && (Lt() ? ie = cn() : ie = sn()), () => {
|
1052
|
+
J--, J === 0 && ie();
|
1048
1053
|
};
|
1049
1054
|
}, [
|
1050
1055
|
t
|
1051
1056
|
]);
|
1052
1057
|
}
|
1053
1058
|
function sn() {
|
1054
|
-
return Q(
|
1059
|
+
return Q(D(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), D(document.documentElement, "overflow", "hidden"));
|
1055
1060
|
}
|
1056
1061
|
function cn() {
|
1057
1062
|
let e, t, n = (l) => {
|
1058
|
-
e = Ae(l.target, !0), !(e === document.documentElement && e === document.body) && e instanceof HTMLElement && window.getComputedStyle(e).overscrollBehavior === "auto" && (t =
|
1063
|
+
e = Ae(l.target, !0), !(e === document.documentElement && e === document.body) && e instanceof HTMLElement && window.getComputedStyle(e).overscrollBehavior === "auto" && (t = D(e, "overscrollBehavior", "contain"));
|
1059
1064
|
}, r = (l) => {
|
1060
1065
|
if (!e || e === document.documentElement || e === document.body) {
|
1061
1066
|
l.preventDefault();
|
@@ -1081,30 +1086,30 @@ function cn() {
|
|
1081
1086
|
let l = () => {
|
1082
1087
|
window.scrollTo(0, 0);
|
1083
1088
|
}, s = window.pageXOffset, d = window.pageYOffset;
|
1084
|
-
a = Q(
|
1089
|
+
a = Q(I(window, "scroll", l), D(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), D(document.documentElement, "overflow", "hidden"), D(document.body, "marginTop", `-${d}px`), () => {
|
1085
1090
|
window.scrollTo(s, d);
|
1086
1091
|
}), window.scrollTo(0, 0);
|
1087
|
-
}, u = Q(
|
1092
|
+
}, u = Q(I(document, "touchstart", n, {
|
1088
1093
|
passive: !1,
|
1089
1094
|
capture: !0
|
1090
|
-
}),
|
1095
|
+
}), I(document, "touchmove", r, {
|
1091
1096
|
passive: !1,
|
1092
1097
|
capture: !0
|
1093
|
-
}),
|
1098
|
+
}), I(document, "touchend", o, {
|
1094
1099
|
passive: !1,
|
1095
1100
|
capture: !0
|
1096
|
-
}),
|
1101
|
+
}), I(document, "focus", i, !0));
|
1097
1102
|
return () => {
|
1098
1103
|
t == null || t(), a == null || a(), u();
|
1099
1104
|
};
|
1100
1105
|
}
|
1101
|
-
function
|
1106
|
+
function D(e, t, n) {
|
1102
1107
|
let r = e.style[t];
|
1103
1108
|
return e.style[t] = n, () => {
|
1104
1109
|
e.style[t] = r;
|
1105
1110
|
};
|
1106
1111
|
}
|
1107
|
-
function
|
1112
|
+
function I(e, t, n, r) {
|
1108
1113
|
return e.addEventListener(t, n, r), () => {
|
1109
1114
|
e.removeEventListener(t, n, r);
|
1110
1115
|
};
|
@@ -1123,7 +1128,7 @@ function Se(e) {
|
|
1123
1128
|
function Ne(e) {
|
1124
1129
|
return e instanceof HTMLInputElement && !an.has(e.type) || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
|
1125
1130
|
}
|
1126
|
-
let
|
1131
|
+
let B = /* @__PURE__ */ new WeakMap(), T = [];
|
1127
1132
|
function un(e, t = document.body) {
|
1128
1133
|
let n = new Set(e), r = /* @__PURE__ */ new Set(), o = (u) => {
|
1129
1134
|
for (let p of u.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]")) n.add(p);
|
@@ -1142,8 +1147,8 @@ function un(e, t = document.body) {
|
|
1142
1147
|
}
|
1143
1148
|
}, i = (u) => {
|
1144
1149
|
var l;
|
1145
|
-
let s = (l =
|
1146
|
-
u.getAttribute("aria-hidden") === "true" && s === 0 || (s === 0 && u.setAttribute("aria-hidden", "true"), r.add(u),
|
1150
|
+
let s = (l = B.get(u)) !== null && l !== void 0 ? l : 0;
|
1151
|
+
u.getAttribute("aria-hidden") === "true" && s === 0 || (s === 0 && u.setAttribute("aria-hidden", "true"), r.add(u), B.set(u, s + 1));
|
1147
1152
|
};
|
1148
1153
|
T.length && T[T.length - 1].disconnect(), o(t);
|
1149
1154
|
let a = new MutationObserver((u) => {
|
@@ -1175,8 +1180,8 @@ function un(e, t = document.body) {
|
|
1175
1180
|
return T.push(c), () => {
|
1176
1181
|
a.disconnect();
|
1177
1182
|
for (let u of r) {
|
1178
|
-
let l =
|
1179
|
-
l === 1 ? (u.removeAttribute("aria-hidden"),
|
1183
|
+
let l = B.get(u);
|
1184
|
+
l === 1 ? (u.removeAttribute("aria-hidden"), B.delete(u)) : B.set(u, l - 1);
|
1180
1185
|
}
|
1181
1186
|
c === T[T.length - 1] ? (T.pop(), T.length && T[T.length - 1].observe()) : T.splice(T.indexOf(c), 1);
|
1182
1187
|
};
|
@@ -1184,11 +1189,11 @@ function un(e, t = document.body) {
|
|
1184
1189
|
const dn = /* @__PURE__ */ nt({});
|
1185
1190
|
function fn() {
|
1186
1191
|
var e;
|
1187
|
-
return (e =
|
1192
|
+
return (e = A(dn)) !== null && e !== void 0 ? e : {};
|
1188
1193
|
}
|
1189
1194
|
const qe = /* @__PURE__ */ h.createContext(null);
|
1190
1195
|
function pn(e) {
|
1191
|
-
let t = _e(), { portalContainer: n = t ? null : document.body, isExiting: r } = e, [o, i] =
|
1196
|
+
let t = _e(), { portalContainer: n = t ? null : document.body, isExiting: r } = e, [o, i] = j(!1), a = H(() => ({
|
1192
1197
|
contain: o,
|
1193
1198
|
setContain: i
|
1194
1199
|
}), [
|
@@ -1205,7 +1210,7 @@ function pn(e) {
|
|
1205
1210
|
}, /* @__PURE__ */ h.createElement(Dt, null, u)), /* @__PURE__ */ rt.createPortal(u, n);
|
1206
1211
|
}
|
1207
1212
|
function ze() {
|
1208
|
-
let e =
|
1213
|
+
let e = A(qe), t = e == null ? void 0 : e.setContain;
|
1209
1214
|
E(() => {
|
1210
1215
|
t == null || t(!0);
|
1211
1216
|
}, [
|
@@ -1321,13 +1326,13 @@ var $n = (e, t, n) => {
|
|
1321
1326
|
for (var [l, s] of e.compoundVariants)
|
1322
1327
|
$n(l, r, e.defaultVariants) && (n += " " + s);
|
1323
1328
|
return n;
|
1324
|
-
}, En = hn({ defaultClassName: "pkg_sps-woodland_focused-
|
1329
|
+
}, En = hn({ defaultClassName: "pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq1", variantClassNames: { fullWidth: { true: "pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq2", false: "pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq3" } }, defaultVariants: {}, compoundVariants: [] }), gn = "pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq5", wn = "pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq0", yn = "pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq9", Tn = "pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psqa", xn = "pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq8", kn = "pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq4", Sn = "pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq7";
|
1325
1330
|
function Ue({
|
1326
1331
|
children: e,
|
1327
1332
|
className: t = "",
|
1328
1333
|
...n
|
1329
1334
|
}) {
|
1330
|
-
return /* @__PURE__ */ f.createElement("div", { className:
|
1335
|
+
return /* @__PURE__ */ f.createElement("div", { className: X(xn, t), ...n }, /* @__PURE__ */ f.createElement("div", { className: X(yn) }, /* @__PURE__ */ f.createElement("div", { className: X(Tn) }, e)));
|
1331
1336
|
}
|
1332
1337
|
Le.set(Ue, { name: "FocusedTaskActions" });
|
1333
1338
|
function Nn({
|
@@ -1346,7 +1351,7 @@ function Nn({
|
|
1346
1351
|
{ ...l },
|
1347
1352
|
a,
|
1348
1353
|
s
|
1349
|
-
), { dialogProps: b, titleProps: v } = bn(l, s), k = $e(d.onFocus, b.onFocus, o),
|
1354
|
+
), { dialogProps: b, titleProps: v } = bn(l, s), k = $e(d.onFocus, b.onFocus, o), W = $e(d.onBlur, b.onBlur, r), Je = Ze({ "data-testid": n }), [re, Xe] = et(e, [{ type: Ue }]);
|
1350
1355
|
function Ye() {
|
1351
1356
|
c && typeof c == "function" && c(), a.close();
|
1352
1357
|
}
|
@@ -1367,10 +1372,10 @@ function Nn({
|
|
1367
1372
|
...b,
|
1368
1373
|
...i,
|
1369
1374
|
onFocus: k,
|
1370
|
-
onBlur:
|
1375
|
+
onBlur: W,
|
1371
1376
|
...Je("dialog"),
|
1372
1377
|
ref: s,
|
1373
|
-
className:
|
1378
|
+
className: X(wn, t)
|
1374
1379
|
},
|
1375
1380
|
/* @__PURE__ */ f.createElement("div", { ...v, className: kn }, Qe),
|
1376
1381
|
/* @__PURE__ */ f.createElement("div", { className: En({ fullWidth: u }) }, he(Xe, a.close)),
|
package/lib/style.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.pkg_sps-woodland_focused-
|
1
|
+
.pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq0{background-color:#f3f4f4;height:100%;left:0;overflow-x:hidden;overflow-y:auto;position:fixed;text-align:center;transition:top .3s ease;width:100%;padding-bottom:2rem}.pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq1{margin:0 auto;max-width:1280px;padding:0 1rem 1rem}.pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq2{max-width:100%}.pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq4{margin:1rem auto .5rem;max-width:1280px;min-width:0;padding:0 1rem;text-align:right}.pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq5{color:#4b5356;border-width:0;right:.5rem}.pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq6{padding:0 .25rem}.pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq7{position:fixed;z-index:1000;top:0;left:0;bottom:0;right:0;background:#f3f4f4;display:flex;align-items:center;justify-content:center;padding:1rem}.pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq8{align-items:center;background-color:#fff;bottom:0;box-shadow:0 -.0625rem .125rem #00000026;display:flex;height:3.125rem;justify-content:center;left:0;padding:.5rem;position:fixed;right:0}.pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psq9{display:flex;max-width:1180px;width:100%}.pkg_sps-woodland_focused-task__version_8_20_9__hash_1io4psqa{align-items:center;display:flex;flex:1;white-space:nowrap;justify-content:center}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sps-woodland/focused-task",
|
3
3
|
"description": "SPS Woodland Design System focused task component",
|
4
|
-
"version": "8.20.
|
4
|
+
"version": "8.20.9",
|
5
5
|
"author": "SPS Commerce",
|
6
6
|
"license": "UNLICENSED",
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/focused-task",
|
@@ -29,9 +29,9 @@
|
|
29
29
|
"@spscommerce/utils": "^7.0.0",
|
30
30
|
"react": "^16.9.0",
|
31
31
|
"react-dom": "^16.9.0",
|
32
|
-
"@sps-woodland/buttons": "8.20.
|
33
|
-
"@sps-woodland/core": "8.20.
|
34
|
-
"@sps-woodland/tokens": "8.20.
|
32
|
+
"@sps-woodland/buttons": "8.20.9",
|
33
|
+
"@sps-woodland/core": "8.20.9",
|
34
|
+
"@sps-woodland/tokens": "8.20.9"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
37
|
"@spscommerce/utils": "^7.0.0",
|
@@ -42,9 +42,9 @@
|
|
42
42
|
"@vanilla-extract/vite-plugin": "^3.6.0",
|
43
43
|
"react": "^16.9.0",
|
44
44
|
"react-dom": "^16.9.0",
|
45
|
-
"@sps-woodland/buttons": "8.20.
|
46
|
-
"@sps-woodland/core": "8.20.
|
47
|
-
"@sps-woodland/tokens": "8.20.
|
45
|
+
"@sps-woodland/buttons": "8.20.9",
|
46
|
+
"@sps-woodland/core": "8.20.9",
|
47
|
+
"@sps-woodland/tokens": "8.20.9"
|
48
48
|
},
|
49
49
|
"dependencies": {
|
50
50
|
"react-aria": "^3.21.0",
|