UNPKG

6.47 kBJavaScriptView Raw
1!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("@material/dom",[],t):"object"==typeof exports?exports.dom=t():(e.mdc=e.mdc||{},e.mdc.dom=t())}(this,function(){return o={},r.m=n={179:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ponyfill=t.keyboard=t.focusTrap=t.events=void 0;var a=i(n(5));t.events=a;var s=i(n(21));t.focusTrap=s;var u=i(n(8));t.keyboard=u;var c=i(n(2));t.ponyfill=c},2:function(e,t,n){"use strict";function o(e,t){return(e.matches||e.webkitMatchesSelector||e.msMatchesSelector).call(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.estimateScrollWidth=t.matches=t.closest=void 0,t.closest=function(e,t){if(e.closest)return e.closest(t);for(var n=e;n;){if(o(n,t))return n;n=n.parentElement}return null},t.matches=o,t.estimateScrollWidth=function(e){var t=e;if(null!==t.offsetParent)return t.scrollWidth;var n=t.cloneNode(!0);n.style.setProperty("position","absolute"),n.style.setProperty("transform","translate(-9999px, -9999px)"),document.documentElement.appendChild(n);var o=n.scrollWidth;return document.documentElement.removeChild(n),o}},21:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FocusTrap=void 0;var i="mdc-dom-focus-sentinel",o=(r.prototype.trapFocus=function(){var e=this.getFocusableElements(this.root);if(0===e.length)throw new Error("FocusTrap: Element must have at least one focusable child.");this.elFocusedBeforeTrapFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this.wrapTabFocus(this.root),this.options.skipInitialFocus||this.focusInitialElement(e,this.options.initialFocusEl)},r.prototype.releaseFocus=function(){[].slice.call(this.root.querySelectorAll("."+i)).forEach(function(e){e.parentElement.removeChild(e)}),!this.options.skipRestoreFocus&&this.elFocusedBeforeTrapFocus&&this.elFocusedBeforeTrapFocus.focus()},r.prototype.wrapTabFocus=function(t){var n=this,e=this.createSentinel(),o=this.createSentinel();e.addEventListener("focus",function(){var e=n.getFocusableElements(t);0<e.length&&e[e.length-1].focus()}),o.addEventListener("focus",function(){var e=n.getFocusableElements(t);0<e.length&&e[0].focus()}),t.insertBefore(e,t.children[0]),t.appendChild(o)},r.prototype.focusInitialElement=function(e,t){var n=0;t&&(n=Math.max(e.indexOf(t),0)),e[n].focus()},r.prototype.getFocusableElements=function(e){return[].slice.call(e.querySelectorAll("[autofocus], [tabindex], a, input, textarea, select, button")).filter(function(e){var t="true"===e.getAttribute("aria-disabled")||null!=e.getAttribute("disabled")||null!=e.getAttribute("hidden")||"true"===e.getAttribute("aria-hidden"),n=0<=e.tabIndex&&0<e.getBoundingClientRect().width&&!e.classList.contains(i)&&!t,o=!1;if(n){var r=getComputedStyle(e);o="none"===r.display||"hidden"===r.visibility}return n&&!o})},r.prototype.createSentinel=function(){var e=document.createElement("div");return e.setAttribute("tabindex","0"),e.setAttribute("aria-hidden","true"),e.classList.add(i),e},r);function r(e,t){void 0===t&&(t={}),this.root=e,this.options=t,this.elFocusedBeforeTrapFocus=null}t.FocusTrap=o},5:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.applyPassive=void 0,t.applyPassive=function(e){return void 0===e&&(e=window),!!function(e){void 0===e&&(e=window);var t=!1;try{var n={get passive(){return!(t=!0)}},o=function(){};e.document.addEventListener("test",o,n),e.document.removeEventListener("test",o,n)}catch(e){t=!1}return t}(e)&&{passive:!0}}},8:function(e,o,t){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.isNavigationEvent=o.normalizeKey=o.KEY=void 0,o.KEY={UNKNOWN:"Unknown",BACKSPACE:"Backspace",ENTER:"Enter",SPACEBAR:"Spacebar",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",END:"End",HOME:"Home",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",DELETE:"Delete",ESCAPE:"Escape",TAB:"Tab"};var r=new Set;r.add(o.KEY.BACKSPACE),r.add(o.KEY.ENTER),r.add(o.KEY.SPACEBAR),r.add(o.KEY.PAGE_UP),r.add(o.KEY.PAGE_DOWN),r.add(o.KEY.END),r.add(o.KEY.HOME),r.add(o.KEY.ARROW_LEFT),r.add(o.KEY.ARROW_UP),r.add(o.KEY.ARROW_RIGHT),r.add(o.KEY.ARROW_DOWN),r.add(o.KEY.DELETE),r.add(o.KEY.ESCAPE),r.add(o.KEY.TAB);var n=8,i=13,a=32,s=33,u=34,c=35,d=36,l=37,f=38,E=39,p=40,v=46,m=27,h=9,b=new Map;b.set(n,o.KEY.BACKSPACE),b.set(i,o.KEY.ENTER),b.set(a,o.KEY.SPACEBAR),b.set(s,o.KEY.PAGE_UP),b.set(u,o.KEY.PAGE_DOWN),b.set(c,o.KEY.END),b.set(d,o.KEY.HOME),b.set(l,o.KEY.ARROW_LEFT),b.set(f,o.KEY.ARROW_UP),b.set(E,o.KEY.ARROW_RIGHT),b.set(p,o.KEY.ARROW_DOWN),b.set(v,o.KEY.DELETE),b.set(m,o.KEY.ESCAPE),b.set(h,o.KEY.TAB);var A=new Set;function y(e){var t=e.key;if(r.has(t))return t;var n=b.get(e.keyCode);return n||o.KEY.UNKNOWN}A.add(o.KEY.PAGE_UP),A.add(o.KEY.PAGE_DOWN),A.add(o.KEY.END),A.add(o.KEY.HOME),A.add(o.KEY.ARROW_LEFT),A.add(o.KEY.ARROW_UP),A.add(o.KEY.ARROW_RIGHT),A.add(o.KEY.ARROW_DOWN),o.normalizeKey=y,o.isNavigationEvent=function(e){return A.has(y(e))}}},r.c=o,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=179);function r(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}var n,o});
\No newline at end of file