@kakadu/components 6.14.1 → 6.16.0
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/components/avatar.d.ts +13 -0
- package/build/components/avatar.js +1 -0
- package/build/components/avatar.mjs +47 -0
- package/build/components/button-tooltip.js +1 -1
- package/build/components/button-tooltip.mjs +6 -6
- package/build/components/code.d.ts +3 -1
- package/build/components/code.js +4 -4
- package/build/components/code.mjs +367 -363
- package/build/components/input.d.ts +1 -0
- package/build/components/input.js +2 -2
- package/build/components/input.mjs +2 -1
- 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/components/theme-setter.d.ts +1 -1
- package/build/components.css +1 -1
- package/build/focus-trap-react-4An60CdH.js +9 -0
- package/build/{focus-trap-react-D4ushEjf.mjs → focus-trap-react-Df_V17Wb.mjs} +259 -261
- package/build/hooks/use-local-storage.js +1 -1
- package/build/hooks/use-local-storage.mjs +60 -70
- package/build/index.d.ts +4 -0
- package/build/index.js +1 -1
- package/build/index.mjs +271 -266
- package/build/utilities/string-to-hex-color.d.ts +3 -0
- package/build/utilities/string-to-hex-color.js +1 -0
- package/build/utilities/string-to-hex-color.mjs +24 -0
- package/package.json +10 -10
- package/build/focus-trap-react-D0ZxGVUk.js +0 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kakadu/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.16.0",
|
|
4
4
|
"description": "Kakadu components library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./build/index.js",
|
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@chromatic-com/storybook": "^4.1.4",
|
|
70
70
|
"@kuma-ui/core": "^1.6.4",
|
|
71
|
-
"@storybook/addon-a11y": "^10.6.
|
|
72
|
-
"@storybook/addon-docs": "^10.6.
|
|
73
|
-
"@storybook/addon-vitest": "^10.6.
|
|
74
|
-
"@storybook/nextjs-vite": "^10.6.
|
|
71
|
+
"@storybook/addon-a11y": "^10.6.5",
|
|
72
|
+
"@storybook/addon-docs": "^10.6.5",
|
|
73
|
+
"@storybook/addon-vitest": "^10.6.5",
|
|
74
|
+
"@storybook/nextjs-vite": "^10.6.5",
|
|
75
75
|
"@testing-library/jest-dom": "^6.9.1",
|
|
76
76
|
"@testing-library/react": "^16.3.3",
|
|
77
77
|
"@testing-library/user-event": "^14.6.8",
|
|
@@ -82,19 +82,19 @@
|
|
|
82
82
|
"@vitejs/plugin-react": "^5.2.0",
|
|
83
83
|
"@vitest/browser-playwright": "^4.0.4",
|
|
84
84
|
"@vitest/coverage-v8": "^4.0.4",
|
|
85
|
-
"chromatic": "^18.
|
|
85
|
+
"chromatic": "^18.13.3",
|
|
86
86
|
"dotenv": "^17.4.2",
|
|
87
87
|
"eslint-config-xo-react": "^0.27.0",
|
|
88
|
-
"eslint-plugin-storybook": "^10.6.
|
|
88
|
+
"eslint-plugin-storybook": "^10.6.5",
|
|
89
89
|
"jsdom": "^27.4.0",
|
|
90
|
-
"next": "^16.4.
|
|
90
|
+
"next": "^16.4.3",
|
|
91
91
|
"playwright": "^1.64.1",
|
|
92
92
|
"prettier": "^3.9.10",
|
|
93
93
|
"react": "^19.3.1",
|
|
94
94
|
"react-dom": "^19.3.1",
|
|
95
|
-
"storybook": "^10.6.
|
|
95
|
+
"storybook": "^10.6.5",
|
|
96
96
|
"typescript": "^5.9.3",
|
|
97
|
-
"vite": "^6.4.
|
|
97
|
+
"vite": "^6.4.5",
|
|
98
98
|
"vitest": "^4.0.4",
|
|
99
99
|
"xo": "^0.59.3"
|
|
100
100
|
},
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";const Fe=require("react"),be=require("./_commonjsHelpers-DGT2Y9Xa.js");var Y={exports:{}};/*!
|
|
2
|
-
* tabbable 6.5.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] *)","area[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,O=te(w,!0,o);o.flatten?s.push.apply(s,O):s.push({scopeParent:a,candidates:O})}else{var D=M.call(a,J);D&&o.filter(a)&&(t||!e.includes(a))&&s.push(a);var F=a.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(a),N=!ee(F,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(a));if(F&&N){var j=te(F===!0?a.children:F.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 O,D,F;o=Q(s),s=(O=o)===null||O===void 0?void 0:O.host,l=!!((D=s)!==null&&D!==void 0&&(F=D.ownerDocument)!==null&&F!==void 0&&F.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}var a=getComputedStyle(e),y=a.visibility;if(y==="hidden"||y==="collapse")return!0;var w=M.call(e,"details>summary:first-of-type"),O=w?e.parentElement:e;if(M.call(O,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof s=="function"){for(var D=e;e;){var F=e.parentElement,N=Q(e);if(F&&!F.shadowRoot&&s(F)===!0)return se(e);e.assignedSlot?e=e.assignedSlot:!F&&N!==e.ownerDocument?e=N.host:e=F}e=D}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),O=a?Te(s.candidates):y;w===0?a?t.push.apply(t,O):t.push(y):o.push({documentOrder:l,tabIndex:w,item:s,isScope:a,content:O})}),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]},O=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})})},D=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},F=function(){var i=D("initialFocus",{hasFallback:!0});if(i===!1)return!1;if(i===void 0||i&&!X(i,l.tabbableOptions))if(O(o.activeElement)>=0)i=o.activeElement;else{var r=a.tabbableGroups[0],c=r&&r.firstTabbableNode;i=c||D("fallbackFocus")}else i===null&&(i=D("fallbackFocus"));if(!i)throw new Error("Your focus-trap needs to have at least one focusable element");return i},N=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(R){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,C=r.indexOf(R);return C<0?A?c.slice(c.indexOf(R)+1).find(function(B){return K(B)}):c.slice(0,c.indexOf(R)).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&&!D("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(F());return}i.focus({preventScroll:!!l.preventScroll}),a.mostRecentlyFocusedNode=i,ze(i)&&i.select()}},U=function(i){var r=D("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),N();var g=null;if(a.tabbableGroups.length>0){var v=O(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 R=E===0?a.tabbableGroups.length-1:E-1,A=a.tabbableGroups[R];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=D("fallbackFocus");return g},q=function(i){var r=Z(i);if(!(O(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=O(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=O(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(R){return L(R)>0})})||(p=!1);else p=!1;p&&(h=_({target:a.mostRecentlyFocusedNode,isBackward:l.isKeyBackward(a.recentNavEvent)})),P(h||a.mostRecentlyFocusedNode||F())}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);O(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(F())}):P(F()),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,R=[];E?R=E.children:!E&&v&&(R=S.getRootNode().children,E=S.getRootNode().host,v=typeof ShadowRoot<"u"&&E.getRootNode()instanceof ShadowRoot);var A=ce(R),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(F())},T=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(u):void 0,k=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||N(),a.active=!0,a.paused=!1,a.nodeFocusedBeforeActivation=j(o),r==null||r();var S=function(){h&&N(),d(),k(),l.isolateSubtrees&&y._setSubtreeIsolation(!0),c==null||c()};if(h)return h(a.containers.concat()).then(S,S),this;S()}catch(R){if(p===I.getActiveTrap(s)&&g){var E;(E=p._setSubtreeIsolation)===null||E===void 0||E.call(p,!0)}throw R}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,k(),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&&(N(),l.isolateSubtrees&&!a.paused&&y._setSubtreeIsolation(!0)),k(),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(),k(),y._setSubtreeIsolation(!1),h==null||h()}else{var p=w(r,"onUnpause"),g=w(r,"onPostUnpause");p==null||p(),y._setSubtreeIsolation(!0),N(),d(),k(),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=D(f),y(d,O()?Reflect.construct(f,m||[],D(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 O(){try{var d=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(O=function(){return!!d})()}function D(d){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(f){return f.__proto__||Object.getPrototypeOf(f)},D(d)}function F(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&&N(d,f)}function N(d,f){return N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,u){return m.__proto__=u,m},N(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 k in T)if(Object.prototype.hasOwnProperty.call(T,k)){if(k==="returnFocusOnDeactivate"||k==="onDeactivate"||k==="onPostDeactivate"||k==="checkCanReturnFocus"||k==="clickOutsideDeactivates"){u.originalOptions[k]=T[k];continue}u.internalOptions[k]=T[k]}return u.outsideClick=null,u.focusTrapElements=m.containerElements||[],u.updatePreviousElement(),u}return F(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,k=u.active&&!this.props.active,b=!u.paused&&this.props.paused,i=u.paused&&!this.props.paused;if(T&&(this.updatePreviousElement(),this.focusTrap.activate()),k){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 k=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:k});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;
|