1 line
77 KiB
JavaScript
1 line
77 KiB
JavaScript
|
"use strict";(self.webpackChunk_npwd_nui=self.webpackChunk_npwd_nui||[]).push([[8869],{45278:function(e,t,n){var o=n(53182),r=n(46088),i=n(64640),a=n(61250);const s=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])'].join(",");function l(e){const t=[],n=[];return Array.from(e.querySelectorAll(s)).forEach(((e,o)=>{const r=function(e){const t=parseInt(e.getAttribute("tabindex")||"",10);return Number.isNaN(t)?"true"===e.contentEditable||("AUDIO"===e.nodeName||"VIDEO"===e.nodeName||"DETAILS"===e.nodeName)&&null===e.getAttribute("tabindex")?0:e.tabIndex:t}(e);-1!==r&&function(e){return!(e.disabled||"INPUT"===e.tagName&&"hidden"===e.type||function(e){if("INPUT"!==e.tagName||"radio"!==e.type)return!1;if(!e.name)return!1;const t=t=>e.ownerDocument.querySelector(`input[type="radio"]${t}`);let n=t(`[name="${e.name}"]:checked`);return n||(n=t(`[name="${e.name}"]`)),n!==e}(e))}(e)&&(0===r?t.push(e):n.push({documentOrder:o,tabIndex:r,node:e}))})),n.sort(((e,t)=>e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex)).map((e=>e.node)).concat(t)}function d(){return!0}t.Z=function(e){const{children:t,disableAutoFocus:n=!1,disableEnforceFocus:s=!1,disableRestoreFocus:u=!1,getTabbable:c=l,isEnabled:p=d,open:m}=e,f=o.useRef(!1),h=o.useRef(null),b=o.useRef(null),v=o.useRef(null),Z=o.useRef(null),g=o.useRef(!1),y=o.useRef(null),x=(0,r.Z)(t.ref,y),w=o.useRef(null);o.useEffect((()=>{m&&y.current&&(g.current=!n)}),[n,m]),o.useEffect((()=>{if(!m||!y.current)return;const e=(0,i.Z)(y.current);return y.current.contains(e.activeElement)||(y.current.hasAttribute("tabIndex")||y.current.setAttribute("tabIndex","-1"),g.current&&y.current.focus()),()=>{u||(v.current&&v.current.focus&&(f.current=!0,v.current.focus()),v.current=null)}}),[m]),o.useEffect((()=>{if(!m||!y.current)return;const e=(0,i.Z)(y.current),t=t=>{const{current:n}=y;if(null!==n)if(e.hasFocus()&&!s&&p()&&!f.current){if(!n.contains(e.activeElement)){if(t&&Z.current!==t.target||e.activeElement!==Z.current)Z.current=null;else if(null!==Z.current)return;if(!g.current)return;let i=[];if(e.activeElement!==h.current&&e.activeElement!==b.current||(i=c(y.current)),i.length>0){var o,r;const e=Boolean((null==(o=w.current)?void 0:o.shiftKey)&&"Tab"===(null==(r=w.current)?void 0:r.key)),t=i[0],n=i[i.length-1];"string"!=typeof t&&"string"!=typeof n&&(e?n.focus():t.focus())}else n.focus()}}else f.current=!1},n=t=>{w.current=t,!s&&p()&&"Tab"===t.key&&e.activeElement===y.current&&t.shiftKey&&(f.current=!0,b.current&&b.current.focus())};e.addEventListener("focusin",t),e.addEventListener("keydown",n,!0);const o=setInterval((()=>{e.activeElement&&"BODY"===e.activeElement.tagName&&t(null)}),50);return()=>{clearInterval(o),e.removeEventListener("focusin",t),e.removeEventListener("keydown",n,!0)}}),[n,s,u,p,m,c]);const S=e=>{null===v.current&&(v.current=e.relatedTarget),g.current=!0};return(0,a.jsxs)(o.Fragment,{children:[(0,a.jsx)("div",{tabIndex:m?0:-1,onFocus:S,ref:h,"data-testid":"sentinelStart"}),o.cloneElement(t,{ref:x,onFocus:e=>{null===v.current&&(v.current=e.relatedTarget),g.current=!0,Z.current=e.target;const n=t.props.onFocus;n&&n(e)}}),(0,a.jsx)("div",{tabIndex:m?0:-1,onFocus:S,ref:b,"data-testid":"sentinelEnd"})]})}},88100:function(e,t,n){n.d(t,{G:function(){return a},Z:function(){return u}});var o=n(64640),r=n(81008),i=n(43273);function a(e,t){t?e.setAttribute("aria-hidden","true"):e.removeAttribute("aria-hidden")}function s(e){return parseInt((0,r.Z)(e).getComputedStyle(e).paddingRight,10)||0}function l(e,t,n,o,r){const i=[t,n,...o];[].forEach.call(e.children,(e=>{const t=-1===i.indexOf(e),n=!function(e){const t=-1!==["TEMPLATE","SCRIPT","STYLE","LINK","MAP","META","NOSCRIPT","PICTURE","COL","COLGROUP","PARAM","SLOT","SOURCE","TRACK"].indexOf(e.tagName),n="INPUT"===e.tagName&&"hidden"===e.getAttribute("type");return t||n}(e);t&&n&&a(e,r)}))}function d(e,t){let n=-1;return e.some(((e,o)=>!!t(e)&&(n=o,!0))),n}class u{constructor(){this.containers=void 0,this.modals=void 0,this.mo
|