@kakadu/components 4.0.5 → 4.0.6
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/build/_commonjsHelpers-DGT2Y9Xa.js +1 -0
- package/build/_commonjsHelpers-MdHo5S7N.mjs +26 -0
- package/build/components/combobox.js +1 -1
- package/build/components/combobox.mjs +134 -140
- package/build/components/modal.js +1 -1
- package/build/components/modal.mjs +1 -1
- package/build/components/popover.js +1 -1
- package/build/components/popover.mjs +1 -1
- package/build/focus-trap-react-B7f3iC5h.js +9 -0
- package/build/{focus-trap-react-DATIi_Ob.mjs → focus-trap-react-Dr3BYLw6.mjs} +430 -453
- package/package.json +1 -1
- package/build/focus-trap-react-CkKg4ubd.js +0 -9
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";const Fe=require("react"),be=require("./_commonjsHelpers-DGT2Y9Xa.js");var Y={exports:{}};/*!
|
|
2
|
+
* tabbable 6.4.0
|
|
3
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
4
|
+
*/var pe=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],J=pe.join(","),he=typeof Element>"u",M=he?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Q=!he&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n==null?void 0:n.ownerDocument},ee=function(e,t){var o;t===void 0&&(t=!0);var s=e==null||(o=e.getAttribute)===null||o===void 0?void 0:o.call(e,"inert"),l=s===""||s==="true",a=l||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ee(e.parentNode));return a},Oe=function(e){var t,o=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return o===""||o==="true"},ye=function(e,t,o){if(ee(e))return[];var s=Array.prototype.slice.apply(e.querySelectorAll(J));return t&&M.call(e,J)&&s.unshift(e),s=s.filter(o),s},te=function(e,t,o){for(var s=[],l=Array.from(e);l.length;){var a=l.shift();if(!ee(a,!1))if(a.tagName==="SLOT"){var y=a.assignedElements(),w=y.length?y:a.children,F=te(w,!0,o);o.flatten?s.push.apply(s,F):s.push({scopeParent:a,candidates:F})}else{var k=M.call(a,J);k&&o.filter(a)&&(t||!e.includes(a))&&s.push(a);var D=a.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(a),R=!ee(D,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(a));if(D&&R){var j=te(D===!0?a.children:D.children,!0,o);o.flatten?s.push.apply(s,j):s.push({scopeParent:a,candidates:j})}else l.unshift.apply(l,a.children)}}return s},me=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},L=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Oe(e))&&!me(e)?0:e.tabIndex},ke=function(e,t){var o=L(e);return o<0&&t&&!me(e)?0:o},De=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ge=function(e){return e.tagName==="INPUT"},Ne=function(e){return ge(e)&&e.type==="hidden"},Re=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(o){return o.tagName==="SUMMARY"});return t},Pe=function(e,t){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]},Ce=function(e){if(!e.name)return!0;var t=e.form||Q(e),o=function(y){return t.querySelectorAll('input[type="radio"][name="'+y+'"]')},s;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")s=o(window.CSS.escape(e.name));else try{s=o(e.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var l=Pe(s,e.form);return!l||l===e},Ae=function(e){return ge(e)&&e.type==="radio"},Ie=function(e){return Ae(e)&&!Ce(e)},je=function(e){var t,o=e&&Q(e),s=(t=o)===null||t===void 0?void 0:t.host,l=!1;if(o&&o!==e){var a,y,w;for(l=!!((a=s)!==null&&a!==void 0&&(y=a.ownerDocument)!==null&&y!==void 0&&y.contains(s)||e!=null&&(w=e.ownerDocument)!==null&&w!==void 0&&w.contains(e));!l&&s;){var F,k,D;o=Q(s),s=(F=o)===null||F===void 0?void 0:F.host,l=!!((k=s)!==null&&k!==void 0&&(D=k.ownerDocument)!==null&&D!==void 0&&D.contains(s))}}return l},se=function(e){var t=e.getBoundingClientRect(),o=t.width,s=t.height;return o===0&&s===0},_e=function(e,t){var o=t.displayCheck,s=t.getShadowRoot;if(o==="full-native"&&"checkVisibility"in e){var l=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!l}if(getComputedStyle(e).visibility==="hidden")return!0;var a=M.call(e,"details>summary:first-of-type"),y=a?e.parentElement:e;if(M.call(y,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof s=="function"){for(var w=e;e;){var F=e.parentElement,k=Q(e);if(F&&!F.shadowRoot&&s(F)===!0)return se(e);e.assignedSlot?e=e.assignedSlot:!F&&k!==e.ownerDocument?e=k.host:e=F}e=w}if(je(e))return!e.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return se(e);return!1},xe=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var o=0;o<t.children.length;o++){var s=t.children.item(o);if(s.tagName==="LEGEND")return M.call(t,"fieldset[disabled] *")?!0:!s.contains(e)}return!0}t=t.parentElement}return!1},re=function(e,t){return!(t.disabled||Ne(t)||_e(t,e)||Re(t)||xe(t))},oe=function(e,t){return!(Ie(t)||L(t)<0||!re(e,t))},Le=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Te=function(e){var t=[],o=[];return e.forEach(function(s,l){var a=!!s.scopeParent,y=a?s.scopeParent:s,w=ke(y,a),F=a?Te(s.candidates):y;w===0?a?t.push.apply(t,F):t.push(y):o.push({documentOrder:l,tabIndex:w,item:s,isScope:a,content:F})}),o.sort(De).reduce(function(s,l){return l.isScope?s.push.apply(s,l.content):s.push(l.content),s},[]).concat(t)},we=function(e,t){t=t||{};var o;return t.getShadowRoot?o=te([e],t.includeContainer,{filter:oe.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Le}):o=ye(e,t.includeContainer,oe.bind(null,t)),Te(o)},Se=function(e,t){t=t||{};var o;return t.getShadowRoot?o=te([e],t.includeContainer,{filter:re.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):o=ye(e,t.includeContainer,re.bind(null,t)),o},K=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return M.call(e,J)===!1?!1:oe(t,e)},Be=pe.concat("iframe:not([inert]):not([inert] *)").join(","),X=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return M.call(e,Be)===!1?!1:re(t,e)};const Ke=Object.freeze(Object.defineProperty({__proto__:null,focusable:Se,getTabIndex:L,isFocusable:X,isTabbable:K,tabbable:we},Symbol.toStringTag,{value:"Module"}));/*!
|
|
5
|
+
* focus-trap 7.8.0
|
|
6
|
+
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
7
|
+
*/function ue(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,o=Array(e);t<e;t++)o[t]=n[t];return o}function Me(n){if(Array.isArray(n))return ue(n)}function ce(n,e){var t=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=Ee(n))||e){t&&(n=t);var o=0,s=function(){};return{s,n:function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}},e:function(w){throw w},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l,a=!0,y=!1;return{s:function(){t=t.call(n)},n:function(){var w=t.next();return a=w.done,w},e:function(w){y=!0,l=w},f:function(){try{a||t.return==null||t.return()}finally{if(y)throw l}}}}function qe(n,e,t){return(e=We(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ve(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function Ge(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function le(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);e&&(o=o.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,o)}return t}function fe(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?le(Object(t),!0).forEach(function(o){qe(n,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):le(Object(t)).forEach(function(o){Object.defineProperty(n,o,Object.getOwnPropertyDescriptor(t,o))})}return n}function $e(n){return Me(n)||Ve(n)||Ee(n)||Ge()}function Ue(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var o=t.call(n,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function We(n){var e=Ue(n,"string");return typeof e=="symbol"?e:e+""}function Ee(n,e){if(n){if(typeof n=="string")return ue(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ue(n,e):void 0}}var I={getActiveTrap:function(e){return(e==null?void 0:e.length)>0?e[e.length-1]:null},activateTrap:function(e,t){var o=I.getActiveTrap(e);t!==o&&I.pauseTrap(e);var s=e.indexOf(t);s===-1||e.splice(s,1),e.push(t)},deactivateTrap:function(e,t){var o=e.indexOf(t);o!==-1&&e.splice(o,1),I.unpauseTrap(e)},pauseTrap:function(e){var t=I.getActiveTrap(e);t==null||t._setPausedState(!0)},unpauseTrap:function(e){var t=I.getActiveTrap(e);t&&!t._isManuallyPaused()&&t._setPausedState(!1)}},ze=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},He=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},$=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},Ye=function(e){return $(e)&&!e.shiftKey},Ze=function(e){return $(e)&&e.shiftKey},de=function(e){return setTimeout(e,0)},G=function(e){for(var t=arguments.length,o=new Array(t>1?t-1:0),s=1;s<t;s++)o[s-1]=arguments[s];return typeof e=="function"?e.apply(void 0,o):e},Z=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},Xe=[],Je=function(e,t){var o=(t==null?void 0:t.document)||document,s=(t==null?void 0:t.trapStack)||Xe,l=fe({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isolateSubtrees:!1,isKeyForward:Ye,isKeyBackward:Ze},t),a={containers:[],containerGroups:[],tabbableGroups:[],adjacentElements:new Set,alreadySilent:new Set,nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,manuallyPaused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},y,w=function(i,r,c){return i&&i[r]!==void 0?i[r]:l[c||r]},F=function(i,r){var c=typeof(r==null?void 0:r.composedPath)=="function"?r.composedPath():void 0;return a.containerGroups.findIndex(function(h){var p=h.container,g=h.tabbableNodes;return p.contains(i)||(c==null?void 0:c.includes(p))||g.find(function(v){return v===i})})},k=function(i){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=r.hasFallback,h=c===void 0?!1:c,p=r.params,g=p===void 0?[]:p,v=l[i];if(typeof v=="function"&&(v=v.apply(void 0,$e(g))),v===!0&&(v=void 0),!v){if(v===void 0||v===!1)return v;throw new Error("`".concat(i,"` was specified but was not a node, or did not return a node"))}var S=v;if(typeof v=="string"){try{S=o.querySelector(v)}catch(E){throw new Error("`".concat(i,'` appears to be an invalid selector; error="').concat(E.message,'"'))}if(!S&&!h)throw new Error("`".concat(i,"` as selector refers to no known node"))}return S},D=function(){var i=k("initialFocus",{hasFallback:!0});if(i===!1)return!1;if(i===void 0||i&&!X(i,l.tabbableOptions))if(F(o.activeElement)>=0)i=o.activeElement;else{var r=a.tabbableGroups[0],c=r&&r.firstTabbableNode;i=c||k("fallbackFocus")}else i===null&&(i=k("fallbackFocus"));if(!i)throw new Error("Your focus-trap needs to have at least one focusable element");return i},R=function(){if(a.containerGroups=a.containers.map(function(i){var r=we(i,l.tabbableOptions),c=Se(i,l.tabbableOptions),h=r.length>0?r[0]:void 0,p=r.length>0?r[r.length-1]:void 0,g=c.find(function(E){return K(E)}),v=c.slice().reverse().find(function(E){return K(E)}),S=!!r.find(function(E){return L(E)>0});return{container:i,tabbableNodes:r,focusableNodes:c,posTabIndexesFound:S,firstTabbableNode:h,lastTabbableNode:p,firstDomTabbableNode:g,lastDomTabbableNode:v,nextTabbableNode:function(N){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,C=r.indexOf(N);return C<0?A?c.slice(c.indexOf(N)+1).find(function(B){return K(B)}):c.slice(0,c.indexOf(N)).reverse().find(function(B){return K(B)}):r[C+(A?1:-1)]}}}),a.tabbableGroups=a.containerGroups.filter(function(i){return i.tabbableNodes.length>0}),a.tabbableGroups.length<=0&&!k("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(a.containerGroups.find(function(i){return i.posTabIndexesFound})&&a.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},j=function(i){var r=i.activeElement;if(r)return r.shadowRoot&&r.shadowRoot.activeElement!==null?j(r.shadowRoot):r},P=function(i){if(i!==!1&&i!==j(document)){if(!i||!i.focus){P(D());return}i.focus({preventScroll:!!l.preventScroll}),a.mostRecentlyFocusedNode=i,ze(i)&&i.select()}},U=function(i){var r=k("setReturnFocus",{params:[i]});return r||(r===!1?!1:i)},_=function(i){var r=i.target,c=i.event,h=i.isBackward,p=h===void 0?!1:h;r=r||Z(c),R();var g=null;if(a.tabbableGroups.length>0){var v=F(r,c),S=v>=0?a.containerGroups[v]:void 0;if(v<0)p?g=a.tabbableGroups[a.tabbableGroups.length-1].lastTabbableNode:g=a.tabbableGroups[0].firstTabbableNode;else if(p){var E=a.tabbableGroups.findIndex(function(ne){var ie=ne.firstTabbableNode;return r===ie});if(E<0&&(S.container===r||X(r,l.tabbableOptions)&&!K(r,l.tabbableOptions)&&!S.nextTabbableNode(r,!1))&&(E=v),E>=0){var N=E===0?a.tabbableGroups.length-1:E-1,A=a.tabbableGroups[N];g=L(r)>=0?A.lastTabbableNode:A.lastDomTabbableNode}else $(c)||(g=S.nextTabbableNode(r,!1))}else{var C=a.tabbableGroups.findIndex(function(ne){var ie=ne.lastTabbableNode;return r===ie});if(C<0&&(S.container===r||X(r,l.tabbableOptions)&&!K(r,l.tabbableOptions)&&!S.nextTabbableNode(r))&&(C=v),C>=0){var B=C===a.tabbableGroups.length-1?0:C+1,x=a.tabbableGroups[B];g=L(r)>=0?x.firstTabbableNode:x.firstDomTabbableNode}else $(c)||(g=S.nextTabbableNode(r))}}else g=k("fallbackFocus");return g},q=function(i){var r=Z(i);if(!(F(r,i)>=0)){if(G(l.clickOutsideDeactivates,i)){y.deactivate({returnFocus:l.returnFocusOnDeactivate});return}G(l.allowOutsideClick,i)||i.preventDefault()}},W=function(i){var r=Z(i),c=F(r,i)>=0;if(c||r instanceof Document)c&&(a.mostRecentlyFocusedNode=r);else{i.stopImmediatePropagation();var h,p=!0;if(a.mostRecentlyFocusedNode)if(L(a.mostRecentlyFocusedNode)>0){var g=F(a.mostRecentlyFocusedNode),v=a.containerGroups[g].tabbableNodes;if(v.length>0){var S=v.findIndex(function(E){return E===a.mostRecentlyFocusedNode});S>=0&&(l.isKeyForward(a.recentNavEvent)?S+1<v.length&&(h=v[S+1],p=!1):S-1>=0&&(h=v[S-1],p=!1))}}else a.containerGroups.some(function(E){return E.tabbableNodes.some(function(N){return L(N)>0})})||(p=!1);else p=!1;p&&(h=_({target:a.mostRecentlyFocusedNode,isBackward:l.isKeyBackward(a.recentNavEvent)})),P(h||a.mostRecentlyFocusedNode||D())}a.recentNavEvent=void 0},ae=function(i){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;a.recentNavEvent=i;var c=_({event:i,isBackward:r});c&&($(i)&&i.preventDefault(),P(c))},z=function(i){(l.isKeyForward(i)||l.isKeyBackward(i))&&ae(i,l.isKeyBackward(i))},H=function(i){He(i)&&G(l.escapeDeactivates,i)!==!1&&(i.preventDefault(),y.deactivate())},V=function(i){var r=Z(i);F(r,i)>=0||G(l.clickOutsideDeactivates,i)||G(l.allowOutsideClick,i)||(i.preventDefault(),i.stopImmediatePropagation())},d=function(){if(a.active)return I.activateTrap(s,y),a.delayInitialFocusTimer=l.delayInitialFocus?de(function(){P(D())}):P(D()),o.addEventListener("focusin",W,!0),o.addEventListener("mousedown",q,{capture:!0,passive:!1}),o.addEventListener("touchstart",q,{capture:!0,passive:!1}),o.addEventListener("click",V,{capture:!0,passive:!1}),o.addEventListener("keydown",z,{capture:!0,passive:!1}),o.addEventListener("keydown",H),y},f=function(i){a.active&&!a.paused&&y._setSubtreeIsolation(!1),a.adjacentElements.clear(),a.alreadySilent.clear();var r=new Set,c=new Set,h=ce(i),p;try{for(h.s();!(p=h.n()).done;){var g=p.value;r.add(g);for(var v=typeof ShadowRoot<"u"&&g.getRootNode()instanceof ShadowRoot,S=g;S;){r.add(S);var E=S.parentElement,N=[];E?N=E.children:!E&&v&&(N=S.getRootNode().children,E=S.getRootNode().host,v=typeof ShadowRoot<"u"&&E.getRootNode()instanceof ShadowRoot);var A=ce(N),C;try{for(A.s();!(C=A.n()).done;){var B=C.value;c.add(B)}}catch(x){A.e(x)}finally{A.f()}S=E}}}catch(x){h.e(x)}finally{h.f()}r.forEach(function(x){c.delete(x)}),a.adjacentElements=c},m=function(){if(a.active)return o.removeEventListener("focusin",W,!0),o.removeEventListener("mousedown",q,!0),o.removeEventListener("touchstart",q,!0),o.removeEventListener("click",V,!0),o.removeEventListener("keydown",z,!0),o.removeEventListener("keydown",H),y},u=function(i){var r=i.some(function(c){var h=Array.from(c.removedNodes);return h.some(function(p){return p===a.mostRecentlyFocusedNode})});r&&P(D())},T=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(u):void 0,O=function(){T&&(T.disconnect(),a.active&&!a.paused&&a.containers.map(function(i){T.observe(i,{subtree:!0,childList:!0})}))};return y={get active(){return a.active},get paused(){return a.paused},activate:function(i){if(a.active)return this;var r=w(i,"onActivate"),c=w(i,"onPostActivate"),h=w(i,"checkCanFocusTrap"),p=I.getActiveTrap(s),g=!1;if(p&&!p.paused){var v;(v=p._setSubtreeIsolation)===null||v===void 0||v.call(p,!1),g=!0}try{h||R(),a.active=!0,a.paused=!1,a.nodeFocusedBeforeActivation=j(o),r==null||r();var S=function(){h&&R(),d(),O(),l.isolateSubtrees&&y._setSubtreeIsolation(!0),c==null||c()};if(h)return h(a.containers.concat()).then(S,S),this;S()}catch(N){if(p===I.getActiveTrap(s)&&g){var E;(E=p._setSubtreeIsolation)===null||E===void 0||E.call(p,!0)}throw N}return this},deactivate:function(i){if(!a.active)return this;var r=fe({onDeactivate:l.onDeactivate,onPostDeactivate:l.onPostDeactivate,checkCanReturnFocus:l.checkCanReturnFocus},i);clearTimeout(a.delayInitialFocusTimer),a.delayInitialFocusTimer=void 0,a.paused||y._setSubtreeIsolation(!1),a.alreadySilent.clear(),m(),a.active=!1,a.paused=!1,O(),I.deactivateTrap(s,y);var c=w(r,"onDeactivate"),h=w(r,"onPostDeactivate"),p=w(r,"checkCanReturnFocus"),g=w(r,"returnFocus","returnFocusOnDeactivate");c==null||c();var v=function(){de(function(){g&&P(U(a.nodeFocusedBeforeActivation)),h==null||h()})};return g&&p?(p(U(a.nodeFocusedBeforeActivation)).then(v,v),this):(v(),this)},pause:function(i){return a.active?(a.manuallyPaused=!0,this._setPausedState(!0,i)):this},unpause:function(i){return a.active?(a.manuallyPaused=!1,s[s.length-1]!==this?this:this._setPausedState(!1,i)):this},updateContainerElements:function(i){var r=[].concat(i).filter(Boolean);return a.containers=r.map(function(c){return typeof c=="string"?o.querySelector(c):c}),l.isolateSubtrees&&f(a.containers),a.active&&(R(),l.isolateSubtrees&&!a.paused&&y._setSubtreeIsolation(!0)),O(),this}},Object.defineProperties(y,{_isManuallyPaused:{value:function(){return a.manuallyPaused}},_setPausedState:{value:function(i,r){if(a.paused===i)return this;if(a.paused=i,i){var c=w(r,"onPause"),h=w(r,"onPostPause");c==null||c(),m(),O(),y._setSubtreeIsolation(!1),h==null||h()}else{var p=w(r,"onUnpause"),g=w(r,"onPostUnpause");p==null||p(),y._setSubtreeIsolation(!0),R(),d(),O(),g==null||g()}return this}},_setSubtreeIsolation:{value:function(i){l.isolateSubtrees&&a.adjacentElements.forEach(function(r){var c;if(i)switch(l.isolateSubtrees){case"aria-hidden":(r.ariaHidden==="true"||((c=r.getAttribute("aria-hidden"))===null||c===void 0?void 0:c.toLowerCase())==="true")&&a.alreadySilent.add(r),r.setAttribute("aria-hidden","true");break;default:(r.inert||r.hasAttribute("inert"))&&a.alreadySilent.add(r),r.setAttribute("inert",!0);break}else if(!a.alreadySilent.has(r))switch(l.isolateSubtrees){case"aria-hidden":r.removeAttribute("aria-hidden");break;default:r.removeAttribute("inert");break}})}}}),y.updateContainerElements(e),y};const Qe=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Je},Symbol.toStringTag,{value:"Module"})),et=be.getAugmentedNamespace(Qe),tt=be.getAugmentedNamespace(Ke);var ve;function rt(){if(ve)return Y.exports;ve=1;function n(d){"@babel/helpers - typeof";return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},n(d)}var e,t;function o(d,f){if(!(d instanceof f))throw new TypeError("Cannot call a class as a function")}function s(d,f){for(var m=0;m<f.length;m++){var u=f[m];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(d,P(u.key),u)}}function l(d,f,m){return f&&s(d.prototype,f),Object.defineProperty(d,"prototype",{writable:!1}),d}function a(d,f,m){return f=k(f),y(d,F()?Reflect.construct(f,m||[],k(d).constructor):f.apply(d,m))}function y(d,f){if(f&&(n(f)=="object"||typeof f=="function"))return f;if(f!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return w(d)}function w(d){if(d===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d}function F(){try{var d=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(F=function(){return!!d})()}function k(d){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(f){return f.__proto__||Object.getPrototypeOf(f)},k(d)}function D(d,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function");d.prototype=Object.create(f&&f.prototype,{constructor:{value:d,writable:!0,configurable:!0}}),Object.defineProperty(d,"prototype",{writable:!1}),f&&R(d,f)}function R(d,f){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,u){return m.__proto__=u,m},R(d,f)}function j(d,f,m){return(f=P(f))in d?Object.defineProperty(d,f,{value:m,enumerable:!0,configurable:!0,writable:!0}):d[f]=m,d}function P(d){var f=U(d,"string");return n(f)=="symbol"?f:f+""}function U(d,f){if(n(d)!="object"||!d)return d;var m=d[Symbol.toPrimitive];if(m!==void 0){var u=m.call(d,f);if(n(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(d)}var _=Fe,q=et,W=q.createFocusTrap,ae=tt,z=ae.isFocusable,H=parseInt((e=(t=/^(\d+)\./.exec(_.version))===null||t===void 0?void 0:t[1])!==null&&e!==void 0?e:0,10),V=(function(d){function f(m){var u;o(this,f),u=a(this,f,[m]),j(u,"getNodeForOption",function(b){var i,r=(i=this.internalOptions[b])!==null&&i!==void 0?i:this.originalOptions[b];if(typeof r=="function"){for(var c=arguments.length,h=new Array(c>1?c-1:0),p=1;p<c;p++)h[p-1]=arguments[p];r=r.apply(void 0,h)}if(r===!0&&(r=void 0),!r){if(r===void 0||r===!1)return r;throw new Error("`".concat(b,"` was specified but was not a node, or did not return a node"))}var g=r;if(typeof r=="string"){var v;if(g=(v=this.getDocument())===null||v===void 0?void 0:v.querySelector(r),!g)throw new Error("`".concat(b,"` as selector refers to no known node"))}return g}),u.handleDeactivate=u.handleDeactivate.bind(u),u.handlePostDeactivate=u.handlePostDeactivate.bind(u),u.handleClickOutsideDeactivates=u.handleClickOutsideDeactivates.bind(u),u.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:u.handleDeactivate,onPostDeactivate:u.handlePostDeactivate,clickOutsideDeactivates:u.handleClickOutsideDeactivates},u.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var T=m.focusTrapOptions;for(var O in T)if(Object.prototype.hasOwnProperty.call(T,O)){if(O==="returnFocusOnDeactivate"||O==="onDeactivate"||O==="onPostDeactivate"||O==="checkCanReturnFocus"||O==="clickOutsideDeactivates"){u.originalOptions[O]=T[O];continue}u.internalOptions[O]=T[O]}return u.outsideClick=null,u.focusTrapElements=m.containerElements||[],u.updatePreviousElement(),u}return D(f,d),l(f,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var u=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return u||(u===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var u=this.getDocument();u&&(this.previouslyFocusedElement=u.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(u){var T=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,u):this.originalOptions.clickOutsideDeactivates;return T&&(this.outsideClick={target:u.target,allowDeactivation:T}),T}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var u=this,T=function(){var b=u.getReturnFocusNode(),i=!!(u.originalOptions.returnFocusOnDeactivate&&b!==null&&b!==void 0&&b.focus&&(!u.outsideClick||u.outsideClick.allowDeactivation&&!z(u.outsideClick.target,u.internalOptions.tabbableOptions))),r=u.internalOptions.preventScroll,c=r===void 0?!1:r;i&&b.focus({preventScroll:c}),u.originalOptions.onPostDeactivate&&u.originalOptions.onPostDeactivate.call(null),u.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(T,T):T()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var u=this.focusTrapElements.some(Boolean);u&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(u){if(this.focusTrap){u.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var T=!u.active&&this.props.active,O=u.active&&!this.props.active,b=!u.paused&&this.props.paused,i=u.paused&&!this.props.paused;if(T&&(this.updatePreviousElement(),this.focusTrap.activate()),O){this.deactivateTrap();return}b&&this.focusTrap.pause(),i&&this.focusTrap.unpause()}else u.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var u=this,T=this.props.children?_.Children.only(this.props.children):void 0;if(T){if(T.type&&T.type===_.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var O=function(r){var c=u.props.containerElements;T&&(H>=19?typeof T.props.ref=="function"?T.props.ref(r):T.props.ref&&(T.props.ref.current=r):typeof T.ref=="function"?T.ref(r):T.ref&&(T.ref.current=r)),u.focusTrapElements=c||[r]},b=_.cloneElement(T,{ref:O});return b}return null}}])})(_.Component);return V.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:W},Y.exports=V,Y.exports.FocusTrap=V,Y.exports}var at=rt();exports.focusTrapReactExports=at;
|