UNPKG

115 kBSource Map (JSON)View Raw
1{"version":3,"sources":["webpack://mdc.[name]/webpack/universalModuleDefinition","webpack://mdc.[name]/webpack/bootstrap","webpack://mdc.[name]/./packages/mdc-base/component.ts","webpack://mdc.[name]/./packages/mdc-base/foundation.ts","webpack://mdc.[name]/./packages/mdc-dom/keyboard.ts","webpack://mdc.[name]/./packages/mdc-dom/ponyfill.ts","webpack://mdc.[name]/./packages/mdc-list/adapter.ts","webpack://mdc.[name]/./packages/mdc-list/component.ts","webpack://mdc.[name]/./packages/mdc-list/constants.ts","webpack://mdc.[name]/./packages/mdc-list/events.ts","webpack://mdc.[name]/./packages/mdc-list/foundation.ts","webpack://mdc.[name]/./packages/mdc-list/index.ts","webpack://mdc.[name]/./packages/mdc-list/typeahead.ts","webpack://mdc.[name]/./packages/mdc-list/types.ts"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;;AC7DG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAA2C;AAG3C;AAW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;AAED,QAAyB,sBAAmB,oBAAsB,mBAAQ;AAE1E,QAAuB,qBAAE;AACvB,YAAmB;AACD;AACA;AACR,sBAAK;AACS;AACb,uBAAO;AACK,mCACrB;AAP4C;AAQqB;AACnE,eAAgB,UAAc,eAAS;AACxC;AAED,WAAO,CACT;AAAC;AA/DD,wBA+DC,c;;;;;;;;;;;;;AC7WE","file":"mdc.list.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"@material/list\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"list\"] = factory();\n\telse\n\t\troot[\"mdc\"] = root[\"mdc\"] || {}, root[\"mdc\"][\"list\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./packages/mdc-list/index.ts\");\n","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nimport {MDCFoundation} from './foundation';\nimport {CustomEventListener, EventType, SpecificEventListener} from './types';\n\nexport class MDCComponent<FoundationType extends MDCFoundation> {\n static attachTo(root: Element): MDCComponent<MDCFoundation<{}>> {\n // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and\n // returns an instantiated component with its root set to that element. Also note that in the cases of\n // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized\n // from getDefaultFoundation().\n return new MDCComponent(root, new MDCFoundation({}));\n }\n\n protected foundation: FoundationType;\n\n constructor(\n public root: Element, foundation?: FoundationType, ...args: unknown[]) {\n this.initialize(...args);\n // Note that we initialize foundation here and not within the constructor's\n // default param so that this.root is defined and can be used within the\n // foundation class.\n this.foundation =\n foundation === undefined ? this.getDefaultFoundation() : foundation;\n this.foundation.init();\n this.initialSyncWithDOM();\n }\n\n /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */\n initialize(..._args: Array<unknown>) {\n // Subclasses can override this to do any additional setup work that would be considered part of a\n // \"constructor\". Essentially, it is a hook into the parent constructor before the foundation is\n // initialized. Any additional arguments besides root and foundation will be passed in here.\n }\n\n getDefaultFoundation(): FoundationType {\n // Subclasses must override this method to return a properly configured foundation class for the\n // component.\n throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' +\n 'foundation class');\n }\n\n initialSyncWithDOM() {\n // Subclasses should override this method if they need to perform work to synchronize with a host DOM\n // object. An example of this would be a form control wrapper that needs to synchronize its internal state\n // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM\n // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.\n }\n\n destroy() {\n // Subclasses may implement this method to release any resources / deregister any listeners they have\n // attached. An example of this might be deregistering a resize event from the window object.\n this.foundation.destroy();\n }\n\n /**\n * Wrapper method to add an event listener to the component's root element. This is most useful when\n * listening for custom events.\n */\n listen<K extends EventType>(\n evtType: K, handler: SpecificEventListener<K>, options?: AddEventListenerOptions | boolean): void;\n listen<E extends Event>(\n evtType: string, handler: CustomEventListener<E>, options?: AddEventListenerOptions | boolean): void;\n listen(evtType: string, handler: EventListener, options?: AddEventListenerOptions | boolean) {\n this.root.addEventListener(evtType, handler, options);\n }\n\n /**\n * Wrapper method to remove an event listener to the component's root element. This is most useful when\n * unlistening for custom events.\n */\n unlisten<K extends EventType>(\n evtType: K, handler: SpecificEventListener<K>, options?: AddEventListenerOptions | boolean): void;\n unlisten<E extends Event>(\n evtType: string, handler: CustomEventListener<E>, options?: AddEventListenerOptions | boolean): void;\n unlisten(evtType: string, handler: EventListener, options?: AddEventListenerOptions | boolean) {\n this.root.removeEventListener(evtType, handler, options);\n }\n\n /**\n * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.\n */\n emit<T extends object>(evtType: string, evtData: T, shouldBubble = false) {\n let evt: CustomEvent<T>;\n if (typeof CustomEvent === 'function') {\n evt = new CustomEvent<T>(evtType, {\n bubbles: shouldBubble,\n detail: evtData,\n });\n } else {\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(evtType, shouldBubble, false, evtData);\n }\n\n this.root.dispatchEvent(evt);\n }\n}\n\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCComponent;\n","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nexport class MDCFoundation<AdapterType extends {} = {}> {\n static get cssClasses(): { [key: string]: string } {\n // Classes extending MDCFoundation should implement this method to return an object which exports every\n // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}\n return {};\n }\n\n static get strings(): { [key: string]: string } {\n // Classes extending MDCFoundation should implement this method to return an object which exports all\n // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}\n return {};\n }\n\n static get numbers(): { [key: string]: number } {\n // Classes extending MDCFoundation should implement this method to return an object which exports all\n // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}\n return {};\n }\n\n static get defaultAdapter(): {} {\n // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient\n // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter\n // validation.\n return {};\n }\n\n constructor(protected adapter: AdapterType = {} as AdapterType) {}\n\n init() {\n // Subclasses should override this method to perform initialization routines (registering events, etc.)\n }\n\n destroy() {\n // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)\n }\n}\n\n/**\n * The constructor for MDCFoundation.\n */\nexport interface MDCFoundationConstructor<AdapterType extends object = any> {\n new(adapter: AdapterType): MDCFoundation<AdapterType>;\n readonly prototype: MDCFoundation<AdapterType>;\n}\n\n/**\n * The deprecated constructor for MDCFoundation.\n */\nexport interface MDCFoundationDeprecatedConstructor<AdapterType extends object = any> {\n readonly cssClasses: Record<string, string>;\n readonly strings: Record<string, string>;\n readonly numbers: Record<string, number>;\n readonly defaultAdapter: AdapterType;\n\n new(adapter?: Partial<AdapterType>): MDCFoundation<AdapterType>;\n readonly prototype: MDCFoundation<AdapterType>;\n}\n\n/**\n * Retrieves the AdapaterType from the provided MDCFoundation generic type.\n */\nexport type MDCFoundationAdapter<T> =\n T extends MDCFoundation<infer A>? A : never;\n\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCFoundation;\n","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/**\n * KEY provides normalized string values for keys.\n */\nexport const KEY = {\n UNKNOWN: 'Unknown',\n BACKSPACE: 'Backspace',\n ENTER: 'Enter',\n SPACEBAR: 'Spacebar',\n PAGE_UP: 'PageUp',\n PAGE_DOWN: 'PageDown',\n END: 'End',\n HOME: 'Home',\n ARROW_LEFT: 'ArrowLeft',\n ARROW_UP: 'ArrowUp',\n ARROW_RIGHT: 'ArrowRight',\n ARROW_DOWN: 'ArrowDown',\n DELETE: 'Delete',\n ESCAPE: 'Escape',\n TAB: 'Tab',\n};\n\nconst normalizedKeys = new Set<string>();\n// IE11 has no support for new Map with iterable so we need to initialize this\n// by hand.\nnormalizedKeys.add(KEY.BACKSPACE);\nnormalizedKeys.add(KEY.ENTER);\nnormalizedKeys.add(KEY.SPACEBAR);\nnormalizedKeys.add(KEY.PAGE_UP);\nnormalizedKeys.add(KEY.PAGE_DOWN);\nnormalizedKeys.add(KEY.END);\nnormalizedKeys.add(KEY.HOME);\nnormalizedKeys.add(KEY.ARROW_LEFT);\nnormalizedKeys.add(KEY.ARROW_UP);\nnormalizedKeys.add(KEY.ARROW_RIGHT);\nnormalizedKeys.add(KEY.ARROW_DOWN);\nnormalizedKeys.add(KEY.DELETE);\nnormalizedKeys.add(KEY.ESCAPE);\nnormalizedKeys.add(KEY.TAB);\n\nconst KEY_CODE = {\n BACKSPACE: 8,\n ENTER: 13,\n SPACEBAR: 32,\n PAGE_UP: 33,\n PAGE_DOWN: 34,\n END: 35,\n HOME: 36,\n ARROW_LEFT: 37,\n ARROW_UP: 38,\n ARROW_RIGHT: 39,\n ARROW_DOWN: 40,\n DELETE: 46,\n ESCAPE: 27,\n TAB: 9,\n};\n\nconst mappedKeyCodes = new Map<number, string>();\n// IE11 has no support for new Map with iterable so we need to initialize this\n// by hand.\nmappedKeyCodes.set(KEY_CODE.BACKSPACE, KEY.BACKSPACE);\nmappedKeyCodes.set(KEY_CODE.ENTER, KEY.ENTER);\nmappedKeyCodes.set(KEY_CODE.SPACEBAR, KEY.SPACEBAR);\nmappedKeyCodes.set(KEY_CODE.PAGE_UP, KEY.PAGE_UP);\nmappedKeyCodes.set(KEY_CODE.PAGE_DOWN, KEY.PAGE_DOWN);\nmappedKeyCodes.set(KEY_CODE.END, KEY.END);\nmappedKeyCodes.set(KEY_CODE.HOME, KEY.HOME);\nmappedKeyCodes.set(KEY_CODE.ARROW_LEFT, KEY.ARROW_LEFT);\nmappedKeyCodes.set(KEY_CODE.ARROW_UP, KEY.ARROW_UP);\nmappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, KEY.ARROW_RIGHT);\nmappedKeyCodes.set(KEY_CODE.ARROW_DOWN, KEY.ARROW_DOWN);\nmappedKeyCodes.set(KEY_CODE.DELETE, KEY.DELETE);\nmappedKeyCodes.set(KEY_CODE.ESCAPE, KEY.ESCAPE);\nmappedKeyCodes.set(KEY_CODE.TAB, KEY.TAB);\n\nconst navigationKeys = new Set<string>();\n// IE11 has no support for new Set with iterable so we need to initialize this\n// by hand.\nnavigationKeys.add(KEY.PAGE_UP);\nnavigationKeys.add(KEY.PAGE_DOWN);\nnavigationKeys.add(KEY.END);\nnavigationKeys.add(KEY.HOME);\nnavigationKeys.add(KEY.ARROW_LEFT);\nnavigationKeys.add(KEY.ARROW_UP);\nnavigationKeys.add(KEY.ARROW_RIGHT);\nnavigationKeys.add(KEY.ARROW_DOWN);\n\n/**\n * normalizeKey returns the normalized string for a navigational action.\n */\nexport function normalizeKey(evt: KeyboardEvent): string {\n const {key} = evt;\n // If the event already has a normalized key, return it\n if (normalizedKeys.has(key)) {\n return key;\n }\n\n // tslint:disable-next-line:deprecation\n const mappedKey = mappedKeyCodes.get(evt.keyCode);\n if (mappedKey) {\n return mappedKey;\n }\n return KEY.UNKNOWN;\n}\n\n/**\n * isNavigationEvent returns whether the event is a navigation event\n */\nexport function isNavigationEvent(evt: KeyboardEvent): boolean {\n return navigationKeys.has(normalizeKey(evt));\n}\n","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/**\n * @fileoverview A \"ponyfill\" is a polyfill that doesn't modify the global prototype chain.\n * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.\n */\n\nexport function closest(element: Element, selector: string): Element | null {\n if (element.closest) {\n return element.closest(selector);\n }\n\n let el: Element | null = element;\n while (el) {\n if (matches(el, selector)) {\n return el;\n }\n el = el.parentElement;\n }\n return null;\n}\n\nexport function matches(element: Element, selector: string): boolean {\n const nativeMatches = element.matches\n || element.webkitMatchesSelector\n || (element as any).msMatchesSelector;\n return nativeMatches.call(element, selector);\n}\n\n/**\n * Used to compute the estimated scroll width of elements. When an element is\n * hidden due to display: none; being applied to a parent element, the width is\n * returned as 0. However, the element will have a true width once no longer\n * inside a display: none context. This method computes an estimated width when\n * the element is hidden or returns the true width when the element is visble.\n * @param {Element} element the element whose width to estimate\n */\nexport function estimateScrollWidth(element: Element): number {\n // Check the offsetParent. If the element inherits display: none from any\n // parent, the offsetParent property will be null (see\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).\n // This check ensures we only clone the node when necessary.\n const htmlEl = element as HTMLElement;\n if (htmlEl.offsetParent !== null) {\n return htmlEl.scrollWidth;\n }\n\n const clone = htmlEl.cloneNode(true) as HTMLElement;\n clone.style.setProperty('position', 'absolute');\n clone.style.setProperty('transform', 'translate(-9999px, -9999px)');\n document.documentElement.appendChild(clone);\n const scrollWidth = clone.scrollWidth;\n document.documentElement.removeChild(clone);\n return scrollWidth;\n}\n","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n/**\n * Defines the shape of the adapter expected by the foundation.\n * Implement this adapter for your framework of choice to delegate updates to\n * the component in your framework of choice. See architecture documentation\n * for more details.\n * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md\n */\nexport interface MDCListAdapter {\n /**\n * Returns the attribute value of list item at given `index`.\n */\n getAttributeForElementIndex(index: number, attr: string): string | null;\n\n getListItemCount(): number;\n\n getFocusedElementIndex(): number;\n\n setAttributeForElementIndex(index: number, attribute: string, value: string): void;\n\n addClassForElementIndex(index: number, className: string): void;\n\n removeClassForElementIndex(index: number, className: string): void;\n\n /**\n * Focuses list item at the index specified.\n */\n focusItemAtIndex(index: number): void;\n\n /**\n * Sets the tabindex to the value specified for all button/a element children of\n * the list item at the index specified.\n */\n setTabIndexForListItemChildren(listItemIndex: number, tabIndexValue: string): void;\n\n /**\n * @return true if radio button is present at given list item index.\n */\n hasRadioAtIndex(index: number): boolean;\n\n /**\n * @return true if checkbox is present at given list item index.\n */\n hasCheckboxAtIndex(index: number): boolean;\n\n /**\n * @return true if checkbox inside a list item is checked.\n */\n isCheckboxCheckedAtIndex(index: number): boolean;\n\n /**\n * @return true if root element is focused.\n */\n isRootFocused(): boolean;\n\n /**\n * @param index list item index.\n * @param className the name of the class whose presence is to be checked.\n * @return true if list item at `index` has class `className`.\n */\n listItemAtIndexHasClass(index: number, className: string): boolean;\n\n /**\n * Sets the checked status of checkbox or radio at given list item index.\n */\n setCheckedCheckboxOrRadioAtIndex(index: number, isChecked: boolean): void;\n\n /**\n * Notifies user action on list item.\n */\n notifyAction(index: number): void;\n\n /**\n * @return true when the current focused element is inside list root.\n */\n isFocusInsideList(): boolean;\n\n /**\n * @return the primary text content of the list item at index.\n */\n getPrimaryTextAtIndex(index: number): string;\n}\n","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nimport {MDCComponent} from '@material/base/component';\nimport {SpecificEventListener} from '@material/base/types';\nimport {closest, matches} from '@material/dom/ponyfill';\nimport {MDCListAdapter} from './adapter';\nimport {cssClasses, deprecatedClassNameMap, evolutionAttribute, evolutionClassNameMap, numbers, strings} from './constants';\nimport {MDCListFoundation} from './foundation';\nimport {MDCListActionEventDetail, MDCListIndex} from './types';\n\nexport type MDCListFactory = (el: Element, foundation?: MDCListFoundation) =>\n MDCList;\n\nexport class MDCList extends MDCComponent<MDCListFoundation> {\n set vertical(value: boolean) {\n this.foundation.setVerticalOrientation(value);\n }\n\n get listElements(): Element[] {\n return Array.from(this.root.querySelectorAll(\n `.${this.classNameMap[cssClasses.LIST_ITEM_CLASS]}`));\n }\n\n set wrapFocus(value: boolean) {\n this.foundation.setWrapFocus(value);\n }\n\n /**\n * @return Whether typeahead is currently matching a user-specified prefix.\n */\n get typeaheadInProgress(): boolean {\n return this.foundation.isTypeaheadInProgress();\n }\n\n /**\n * Sets whether typeahead functionality is enabled on the list.\n * @param hasTypeahead Whether typeahead is enabled.\n */\n set hasTypeahead(hasTypeahead: boolean) {\n this.foundation.setHasTypeahead(hasTypeahead);\n }\n\n set singleSelection(isSingleSelectionList: boolean) {\n this.foundation.setSingleSelection(isSingleSelectionList);\n }\n\n get selectedIndex(): MDCListIndex {\n return this.foundation.getSelectedIndex();\n }\n\n set selectedIndex(index: MDCListIndex) {\n this.foundation.setSelectedIndex(index);\n }\n\n static override attachTo(root: Element) {\n return new MDCList(root);\n }\n\n // The follow are assigned in initialSyncWithDOM().\n private handleKeydown!: SpecificEventListener<'keydown'>;\n private handleClick!: SpecificEventListener<'click'>;\n private focusInEventListener!: SpecificEventListener<'focus'>;\n private focusOutEventListener!: SpecificEventListener<'focus'>;\n\n // This mapping provides a layer of indirection from legacy classes to\n // evolution classes, since there are some inconsistencies between the\n // two.\n // TODO(b/176814973): remove this map when evolution is launched.\n private classNameMap!: {[className: string]: string};\n private isEvolutionEnabled!: boolean;\n private isInteractive!: boolean;\n\n override initialSyncWithDOM() {\n this.isEvolutionEnabled =\n evolutionAttribute in (this.root as HTMLElement).dataset;\n\n if (this.isEvolutionEnabled) {\n this.classNameMap = evolutionClassNameMap;\n } else if (matches(this.root, strings.DEPRECATED_SELECTOR)) {\n this.classNameMap = deprecatedClassNameMap;\n } else {\n this.classNameMap =\n Object.values(cssClasses)\n .reduce((obj: {[className: string]: string}, className) => {\n obj[className] = className;\n return obj;\n }, {});\n }\n\n this.handleClick = this.handleClickEvent.bind(this);\n this.handleKeydown = this.handleKeydownEvent.bind(this);\n this.focusInEventListener = this.handleFocusInEvent.bind(this);\n this.focusOutEventListener = this.handleFocusOutEvent.bind(this);\n this.listen('keydown', this.handleKeydown);\n this.listen('click', this.handleClick);\n this.listen('focusin', this.focusInEventListener);\n this.listen('focusout', this.focusOutEventListener);\n this.layout();\n this.initializeListType();\n this.ensureFocusable();\n }\n\n override destroy() {\n this.unlisten('keydown', this.handleKeydown);\n this.unlisten('click', this.handleClick);\n this.unlisten('focusin', this.focusInEventListener);\n this.unlisten('focusout', this.focusOutEventListener);\n }\n\n layout() {\n const direction = this.root.getAttribute(strings.ARIA_ORIENTATION);\n this.vertical = direction !== strings.ARIA_ORIENTATION_HORIZONTAL;\n\n const itemSelector =\n `.${this.classNameMap[cssClasses.LIST_ITEM_CLASS]}:not([tabindex])`;\n const childSelector = strings.FOCUSABLE_CHILD_ELEMENTS;\n\n // List items need to have at least tabindex=-1 to be focusable.\n const itemEls = this.root.querySelectorAll(itemSelector);\n if (itemEls.length) {\n Array.prototype.forEach.call(itemEls, (el: Element) => {\n el.setAttribute('tabindex', '-1');\n });\n }\n\n // Child button/a elements are not tabbable until the list item is focused.\n const focusableChildEls = this.root.querySelectorAll(childSelector);\n if (focusableChildEls.length) {\n Array.prototype.forEach.call(focusableChildEls, (el: Element) => {\n el.setAttribute('tabindex', '-1');\n });\n }\n\n if (this.isEvolutionEnabled) {\n this.foundation.setUseSelectedAttribute(true);\n }\n this.foundation.layout();\n }\n\n /**\n * Extracts the primary text from a list item.\n * @param item The list item element.\n * @return The primary text in the element.\n */\n getPrimaryText(item: Element): string {\n const primaryText = item.querySelector(\n `.${this.classNameMap[cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS]}`);\n if (this.isEvolutionEnabled || primaryText) {\n return primaryText?.textContent ?? '';\n }\n\n const singleLineText = item.querySelector(\n `.${this.classNameMap[cssClasses.LIST_ITEM_TEXT_CLASS]}`);\n return (singleLineText && singleLineText.textContent) || '';\n }\n\n /**\n * Initialize selectedIndex value based on pre-selected list items.\n */\n initializeListType() {\n this.isInteractive =\n matches(this.root, strings.ARIA_INTERACTIVE_ROLES_SELECTOR);\n\n if (this.isEvolutionEnabled && this.isInteractive) {\n const selection = Array.from(\n this.root.querySelectorAll(strings.SELECTED_ITEM_SELECTOR),\n (listItem: Element) => this.listElements.indexOf(listItem));\n\n if (matches(this.root, strings.ARIA_MULTI_SELECTABLE_SELECTOR)) {\n this.selectedIndex = selection;\n } else if (selection.length > 0) {\n this.selectedIndex = selection[0];\n }\n return;\n }\n\n const checkboxListItems =\n this.root.querySelectorAll(strings.ARIA_ROLE_CHECKBOX_SELECTOR);\n const radioSelectedListItem =\n this.root.querySelector(strings.ARIA_CHECKED_RADIO_SELECTOR);\n\n if (checkboxListItems.length) {\n const preselectedItems =\n this.root.querySelectorAll(strings.ARIA_CHECKED_CHECKBOX_SELECTOR);\n this.selectedIndex = Array.from(\n preselectedItems,\n (listItem: Element) => this.listElements.indexOf(listItem));\n } else if (radioSelectedListItem) {\n this.selectedIndex = this.listElements.indexOf(radioSelectedListItem);\n }\n }\n\n /**\n * Updates the list item at itemIndex to the desired isEnabled state.\n * @param itemIndex Index of the list item\n * @param isEnabled Sets the list item to enabled or disabled.\n */\n setEnabled(itemIndex: number, isEnabled: boolean) {\n this.foundation.setEnabled(itemIndex, isEnabled);\n }\n\n /**\n * Given the next desired character from the user, adds it to the typeahead\n * buffer. Then, attempts to find the next option matching the buffer. Wraps\n * around if at the end of options.\n *\n * @param nextChar The next character to add to the prefix buffer.\n * @param startingIndex The index from which to start matching. Defaults to\n * the currently focused index.\n * @return The index of the matched item.\n */\n typeaheadMatchItem(nextChar: string, startingIndex?: number): number {\n return this.foundation.typeaheadMatchItem(\n nextChar, startingIndex, /** skipFocus */ true);\n }\n\n override getDefaultFoundation() {\n // DO NOT INLINE this variable. For backward compatibility, foundations take\n // a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any\n // methods, we need a separate, strongly typed adapter variable.\n const adapter: MDCListAdapter = {\n addClassForElementIndex: (index, className) => {\n const element = this.listElements[index];\n if (element) {\n element.classList.add(this.classNameMap[className]);\n }\n },\n focusItemAtIndex: (index) => {\n const element = this.listElements[index] as HTMLElement | undefined;\n if (element) {\n element.focus();\n }\n },\n getAttributeForElementIndex: (index, attr) =>\n this.listElements[index].getAttribute(attr),\n getFocusedElementIndex: () =>\n this.listElements.indexOf(document.activeElement!),\n getListItemCount: () => this.listElements.length,\n getPrimaryTextAtIndex: (index) =>\n this.getPrimaryText(this.listElements[index]),\n hasCheckboxAtIndex: (index) => {\n const listItem = this.listElements[index];\n return !!listItem.querySelector(strings.CHECKBOX_SELECTOR);\n },\n hasRadioAtIndex: (index) => {\n const listItem = this.listElements[index];\n return !!listItem.querySelector(strings.RADIO_SELECTOR);\n },\n isCheckboxCheckedAtIndex: (index) => {\n const listItem = this.listElements[index];\n const toggleEl =\n listItem.querySelector<HTMLInputElement>(strings.CHECKBOX_SELECTOR);\n return toggleEl!.checked;\n },\n isFocusInsideList: () => {\n return this.root !== document.activeElement &&\n this.root.contains(document.activeElement);\n },\n isRootFocused: () => document.activeElement === this.root,\n listItemAtIndexHasClass: (index, className) =>\n this.listElements[index].classList.contains(\n this.classNameMap[className]),\n notifyAction: (index) => {\n this.emit<MDCListActionEventDetail>(\n strings.ACTION_EVENT, {index}, /** shouldBubble */ true);\n },\n removeClassForElementIndex: (index, className) => {\n const element = this.listElements[index];\n if (element) {\n element.classList.remove(this.classNameMap[className]);\n }\n },\n setAttributeForElementIndex: (index, attr, value) => {\n const element = this.listElements[index];\n if (element) {\n element.setAttribute(attr, value);\n }\n },\n setCheckedCheckboxOrRadioAtIndex: (index, isChecked) => {\n const listItem = this.listElements[index];\n const toggleEl = listItem.querySelector<HTMLInputElement>(\n strings.CHECKBOX_RADIO_SELECTOR);\n toggleEl!.checked = isChecked;\n\n const event = document.createEvent('Event');\n event.initEvent('change', true, true);\n toggleEl!.dispatchEvent(event);\n },\n setTabIndexForListItemChildren: (listItemIndex, tabIndexValue) => {\n const element = this.listElements[listItemIndex];\n const selector = strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX;\n Array.prototype.forEach.call(\n element.querySelectorAll(selector), (el: Element) => {\n el.setAttribute('tabindex', tabIndexValue);\n });\n },\n };\n return new MDCListFoundation(adapter);\n }\n\n /**\n * Ensures that at least one item is focusable if the list is interactive and\n * doesn't specify a suitable tabindex.\n */\n private ensureFocusable() {\n if (this.isEvolutionEnabled && this.isInteractive) {\n if (!this.root.querySelector(`.${\n this.classNameMap[cssClasses.LIST_ITEM_CLASS]}[tabindex=\"0\"]`)) {\n const index = this.initialFocusIndex();\n if (index !== -1) {\n (this.listElements[index] as HTMLElement).tabIndex = 0;\n }\n }\n }\n }\n\n private initialFocusIndex(): number {\n if (this.selectedIndex instanceof Array && this.selectedIndex.length > 0) {\n return this.selectedIndex[0];\n }\n if (typeof this.selectedIndex === 'number' &&\n this.selectedIndex !== numbers.UNSET_INDEX) {\n return this.selectedIndex;\n }\n const el = this.root.querySelector(\n `.${this.classNameMap[cssClasses.LIST_ITEM_CLASS]}:not(.${\n this.classNameMap[cssClasses.LIST_ITEM_DISABLED_CLASS]})`);\n if (el === null) {\n return -1;\n }\n return this.getListItemIndex(el);\n }\n\n /**\n * Used to figure out which list item this event is targetting. Or returns -1\n * if there is no list item\n */\n private getListItemIndex(el: Element) {\n const nearestParent = closest(\n el,\n `.${this.classNameMap[cssClasses.LIST_ITEM_CLASS]}, .${\n this.classNameMap[cssClasses.ROOT]}`);\n\n // Get the index of the element if it is a list item.\n if (nearestParent &&\n matches(\n nearestParent,\n `.${this.classNameMap[cssClasses.LIST_ITEM_CLASS]}`)) {\n return this.listElements.indexOf(nearestParent);\n }\n\n return -1;\n }\n\n /**\n * Used to figure out which element was clicked before sending the event to\n * the foundation.\n */\n private handleFocusInEvent(evt: FocusEvent) {\n const index = this.getListItemIndex(evt.target as Element);\n this.foundation.handleFocusIn(index);\n }\n\n /**\n * Used to figure out which element was clicked before sending the event to\n * the foundation.\n */\n private handleFocusOutEvent(evt: FocusEvent) {\n const index = this.getListItemIndex(evt.target as Element);\n this.foundation.handleFocusOut(index);\n }\n\n /**\n * Used to figure out which element was focused when keydown event occurred\n * before sending the event to the foundation.\n */\n private handleKeydownEvent(evt: KeyboardEvent) {\n const index = this.getListItemIndex(evt.target as Element);\n const target = evt.target as Element;\n this.foundation.handleKeydown(\n evt,\n target.classList.contains(\n this.classNameMap[cssClasses.LIST_ITEM_CLASS]),\n index);\n }\n\n /**\n * Used to figure out which element was clicked before sending the event to\n * the foundation.\n */\n private handleClickEvent(evt: MouseEvent) {\n const index = this.getListItemIndex(evt.target as Element);\n const target = evt.target as Element;\n // Toggle the checkbox only if it's not the target of the event, or the\n // checkbox will have 2 change events.\n const toggleCheckbox = !matches(target, strings.CHECKBOX_RADIO_SELECTOR);\n this.foundation.handleClick(index, toggleCheckbox);\n }\n}\n","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nconst cssClasses = {\n LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',\n LIST_ITEM_CLASS: 'mdc-list-item',\n LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',\n LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',\n LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text',\n LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text',\n ROOT: 'mdc-list',\n};\n\nconst evolutionClassNameMap = {\n [`${cssClasses.LIST_ITEM_ACTIVATED_CLASS}`]: 'mdc-list-item--activated',\n [`${cssClasses.LIST_ITEM_CLASS}`]: 'mdc-list-item',\n [`${cssClasses.LIST_ITEM_DISABLED_CLASS}`]: 'mdc-list-item--disabled',\n [`${cssClasses.LIST_ITEM_SELECTED_CLASS}`]: 'mdc-list-item--selected',\n [`${cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS}`]: 'mdc-list-item__primary-text',\n [`${cssClasses.ROOT}`]: 'mdc-list',\n};\n\nconst deprecatedClassNameMap = {\n [`${cssClasses.LIST_ITEM_ACTIVATED_CLASS}`]:\n 'mdc-deprecated-list-item--activated',\n [`${cssClasses.LIST_ITEM_CLASS}`]: 'mdc-deprecated-list-item',\n [`${cssClasses.LIST_ITEM_DISABLED_CLASS}`]:\n 'mdc-deprecated-list-item--disabled',\n [`${cssClasses.LIST_ITEM_SELECTED_CLASS}`]:\n 'mdc-deprecated-list-item--selected',\n [`${cssClasses.LIST_ITEM_TEXT_CLASS}`]: 'mdc-deprecated-list-item__text',\n [`${cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS}`]:\n 'mdc-deprecated-list-item__primary-text',\n [`${cssClasses.ROOT}`]: 'mdc-deprecated-list',\n};\n\nconst strings = {\n ACTION_EVENT: 'MDCList:action',\n ARIA_CHECKED: 'aria-checked',\n ARIA_CHECKED_CHECKBOX_SELECTOR: '[role=\"checkbox\"][aria-checked=\"true\"]',\n ARIA_CHECKED_RADIO_SELECTOR: '[role=\"radio\"][aria-checked=\"true\"]',\n ARIA_CURRENT: 'aria-current',\n ARIA_DISABLED: 'aria-disabled',\n ARIA_ORIENTATION: 'aria-orientation',\n ARIA_ORIENTATION_HORIZONTAL: 'horizontal',\n ARIA_ROLE_CHECKBOX_SELECTOR: '[role=\"checkbox\"]',\n ARIA_SELECTED: 'aria-selected',\n ARIA_INTERACTIVE_ROLES_SELECTOR: '[role=\"listbox\"], [role=\"menu\"]',\n ARIA_MULTI_SELECTABLE_SELECTOR: '[aria-multiselectable=\"true\"]',\n CHECKBOX_RADIO_SELECTOR: 'input[type=\"checkbox\"], input[type=\"radio\"]',\n CHECKBOX_SELECTOR: 'input[type=\"checkbox\"]',\n CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: `\n .${cssClasses.LIST_ITEM_CLASS} button:not(:disabled),\n .${cssClasses.LIST_ITEM_CLASS} a,\n .${\n deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS]} button:not(:disabled),\n .${deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS]} a\n `,\n DEPRECATED_SELECTOR: '.mdc-deprecated-list',\n FOCUSABLE_CHILD_ELEMENTS: `\n .${cssClasses.LIST_ITEM_CLASS} button:not(:disabled),\n .${cssClasses.LIST_ITEM_CLASS} a,\n .${cssClasses.LIST_ITEM_CLASS} input[type=\"radio\"]:not(:disabled),\n .${cssClasses.LIST_ITEM_CLASS} input[type=\"checkbox\"]:not(:disabled),\n .${\n deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS]} button:not(:disabled),\n .${deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS]} a,\n .${\n deprecatedClassNameMap\n [cssClasses.LIST_ITEM_CLASS]} input[type=\"radio\"]:not(:disabled),\n .${\n deprecatedClassNameMap\n [cssClasses.LIST_ITEM_CLASS]} input[type=\"checkbox\"]:not(:disabled)\n `,\n RADIO_SELECTOR: 'input[type=\"radio\"]',\n SELECTED_ITEM_SELECTOR: '[aria-selected=\"true\"], [aria-current=\"true\"]',\n};\n\nconst numbers = {\n UNSET_INDEX: -1,\n TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300\n};\n\nconst evolutionAttribute = 'evolution';\n\nexport {\n strings,\n cssClasses,\n numbers,\n deprecatedClassNameMap,\n evolutionAttribute,\n evolutionClassNameMap\n};\n","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nconst ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];\n\n/**\n * Ensures that preventDefault is only called if the containing element\n * doesn't consume the event, and it will cause an unintended scroll.\n *\n * @param evt keyboard event to be prevented.\n */\nexport const preventDefaultEvent = (evt: KeyboardEvent) => {\n const target = evt.target as Element;\n if (!target) {\n return;\n }\n const tagName = `${target.tagName}`.toLowerCase();\n if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {\n evt.preventDefault();\n }\n}\n","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nimport {MDCFoundation} from '@material/base/foundation';\nimport {normalizeKey} from '@material/dom/keyboard';\n\nimport {MDCListAdapter} from './adapter';\nimport {cssClasses, numbers, strings} from './constants';\nimport {preventDefaultEvent} from './events';\nimport * as typeahead from './typeahead';\nimport {MDCListIndex, MDCListTextAndIndex} from './types';\n\nfunction isNumberArray(selectedIndex: MDCListIndex): selectedIndex is number[] {\n return selectedIndex instanceof Array;\n}\n\nexport class MDCListFoundation extends MDCFoundation<MDCListAdapter> {\n static override get strings() {\n return strings;\n }\n\n static override get cssClasses() {\n return cssClasses;\n }\n\n static override get numbers() {\n return numbers;\n }\n\n static override get defaultAdapter(): MDCListAdapter {\n return {\n addClassForElementIndex: () => undefined,\n focusItemAtIndex: () => undefined,\n getAttributeForElementIndex: () => null,\n getFocusedElementIndex: () => 0,\n getListItemCount: () => 0,\n hasCheckboxAtIndex: () => false,\n hasRadioAtIndex: () => false,\n isCheckboxCheckedAtIndex: () => false,\n isFocusInsideList: () => false,\n isRootFocused: () => false,\n listItemAtIndexHasClass: () => false,\n notifyAction: () => undefined,\n removeClassForElementIndex: () => undefined,\n setAttributeForElementIndex: () => undefined,\n setCheckedCheckboxOrRadioAtIndex: () => undefined,\n setTabIndexForListItemChildren: () => undefined,\n getPrimaryTextAtIndex: () => '',\n };\n }\n\n private wrapFocus = false;\n private isVertical = true;\n private isSingleSelectionList = false;\n private selectedIndex: MDCListIndex = numbers.UNSET_INDEX;\n private focusedItemIndex = numbers.UNSET_INDEX;\n private useActivatedClass = false;\n private useSelectedAttr = false;\n private ariaCurrentAttrValue: string|null = null;\n private isCheckboxList = false;\n private isRadioList = false;\n\n private hasTypeahead = false;\n // Transiently holds current typeahead prefix from user.\n private readonly typeaheadState = typeahead.initState();\n private sortedIndexByFirstChar = new Map<string, MDCListTextAndIndex[]>();\n\n constructor(adapter?: Partial<MDCListAdapter>) {\n super({...MDCListFoundation.defaultAdapter, ...adapter});\n }\n\n layout() {\n if (this.adapter.getListItemCount() === 0) {\n return;\n }\n\n // TODO(b/172274142): consider all items when determining the list's type.\n if (this.adapter.hasCheckboxAtIndex(0)) {\n this.isCheckboxList = true;\n } else if (this.adapter.hasRadioAtIndex(0)) {\n this.isRadioList = true;\n } else {\n this.maybeInitializeSingleSelection();\n }\n\n if (this.hasTypeahead) {\n this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex();\n }\n }\n\n /** Returns the index of the item that was last focused. */\n getFocusedItemIndex() {\n return this.focusedItemIndex;\n }\n\n /** Toggles focus wrapping with keyboard navigation. */\n setWrapFocus(value: boolean) {\n this.wrapFocus = value;\n }\n\n /**\n * Toggles orientation direction for keyboard navigation (true for vertical,\n * false for horizontal).\n */\n setVerticalOrientation(value: boolean) {\n this.isVertical = value;\n }\n\n /** Toggles single-selection behavior. */\n setSingleSelection(value: boolean) {\n this.isSingleSelectionList = value;\n if (value) {\n this.maybeInitializeSingleSelection();\n this.selectedIndex = this.getSelectedIndexFromDOM();\n }\n }\n\n /**\n * Automatically determines whether the list is single selection list. If so,\n * initializes the internal state to match the selected item.\n */\n private maybeInitializeSingleSelection() {\n const selectedItemIndex = this.getSelectedIndexFromDOM();\n if (selectedItemIndex === numbers.UNSET_INDEX) return;\n\n const hasActivatedClass = this.adapter.listItemAtIndexHasClass(\n selectedItemIndex, cssClasses.LIST_ITEM_ACTIVATED_CLASS);\n if (hasActivatedClass) {\n this.setUseActivatedClass(true);\n }\n this.isSingleSelectionList = true;\n this.selectedIndex = selectedItemIndex;\n }\n\n /** @return Index of the first selected item based on the DOM state. */\n private getSelectedIndexFromDOM() {\n let selectedIndex = numbers.UNSET_INDEX;\n const listItemsCount = this.adapter.getListItemCount();\n for (let i = 0; i < listItemsCount; i++) {\n const hasSelectedClass = this.adapter.listItemAtIndexHasClass(\n i, cssClasses.LIST_ITEM_SELECTED_CLASS);\n const hasActivatedClass = this.adapter.listItemAtIndexHasClass(\n i, cssClasses.LIST_ITEM_ACTIVATED_CLASS);\n if (!(hasSelectedClass || hasActivatedClass)) {\n continue;\n }\n\n selectedIndex = i;\n break;\n }\n\n return selectedIndex;\n }\n\n /**\n * Sets whether typeahead is enabled on the list.\n * @param hasTypeahead Whether typeahead is enabled.\n */\n setHasTypeahead(hasTypeahead: boolean) {\n this.hasTypeahead = hasTypeahead;\n if (hasTypeahead) {\n this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex();\n }\n }\n\n /**\n * @return Whether typeahead is currently matching a user-specified prefix.\n */\n isTypeaheadInProgress(): boolean {\n return this.hasTypeahead &&\n typeahead.isTypingInProgress(this.typeaheadState);\n }\n\n /** Toggle use of the \"activated\" CSS class. */\n setUseActivatedClass(useActivated: boolean) {\n this.useActivatedClass = useActivated;\n }\n\n /**\n * Toggles use of the selected attribute (true for aria-selected, false for\n * aria-checked).\n */\n setUseSelectedAttribute(useSelected: boolean) {\n this.useSelectedAttr = useSelected;\n }\n\n getSelectedIndex(): MDCListIndex {\n return this.selectedIndex;\n }\n\n setSelectedIndex(index: MDCListIndex, {forceUpdate}: {forceUpdate?:\n boolean} = {}) {\n if (!this.isIndexValid(index)) {\n return;\n }\n\n if (this.isCheckboxList) {\n this.setCheckboxAtIndex(index as number[]);\n } else if (this.isRadioList) {\n this.setRadioAtIndex(index as number);\n } else {\n this.setSingleSelectionAtIndex(index as number, {forceUpdate});\n }\n }\n\n /**\n * Focus in handler for the list items.\n */\n handleFocusIn(listItemIndex: number) {\n if (listItemIndex >= 0) {\n this.focusedItemIndex = listItemIndex;\n this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '0');\n this.adapter.setTabIndexForListItemChildren(listItemIndex, '0');\n }\n }\n\n /**\n * Focus out handler for the list items.\n */\n handleFocusOut(listItemIndex: number) {\n if (listItemIndex >= 0) {\n this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '-1');\n this.adapter.setTabIndexForListItemChildren(listItemIndex, '-1');\n }\n\n /**\n * Between Focusout & Focusin some browsers do not have focus on any\n * element. Setting a delay to wait till the focus is moved to next element.\n */\n setTimeout(() => {\n if (!this.adapter.isFocusInsideList()) {\n this.setTabindexToFirstSelectedOrFocusedItem();\n }\n }, 0);\n }\n\n /**\n * Key handler for the list.\n */\n handleKeydown(\n event: KeyboardEvent, isRootListItem: boolean, listItemIndex: number) {\n const isArrowLeft = normalizeKey(event) === 'ArrowLeft';\n const isArrowUp = normalizeKey(event) === 'ArrowUp';\n const isArrowRight = normalizeKey(event) === 'ArrowRight';\n const isArrowDown = normalizeKey(event) === 'ArrowDown';\n const isHome = normalizeKey(event) === 'Home';\n const isEnd = normalizeKey(event) === 'End';\n const isEnter = normalizeKey(event) === 'Enter';\n const isSpace = normalizeKey(event) === 'Spacebar';\n\n // Have to check both upper and lower case, because having caps lock on\n // affects the value.\n const isLetterA = event.key === 'A' || event.key === 'a';\n\n if (this.adapter.isRootFocused()) {\n if (isArrowUp || isEnd) {\n event.preventDefault();\n this.focusLastElement();\n } else if (isArrowDown || isHome) {\n event.preventDefault();\n this.focusFirstElement();\n }\n\n if (this.hasTypeahead) {\n const handleKeydownOpts: typeahead.HandleKeydownOpts = {\n event,\n focusItemAtIndex: (index) => {\n this.focusItemAtIndex(index);\n },\n focusedItemIndex: -1,\n isTargetListItem: isRootListItem,\n sortedIndexByFirstChar: this.sortedIndexByFirstChar,\n isItemAtIndexDisabled: (index) =>\n this.adapter.listItemAtIndexHasClass(\n index, cssClasses.LIST_ITEM_DISABLED_CLASS),\n };\n\n typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState);\n }\n\n return;\n }\n\n let currentIndex = this.adapter.getFocusedElementIndex();\n if (currentIndex === -1) {\n currentIndex = listItemIndex;\n if (currentIndex < 0) {\n // If this event doesn't have a mdc-list-item ancestor from the\n // current list (not from a sublist), return early.\n return;\n }\n }\n\n if ((this.isVertical && isArrowDown) ||\n (!this.isVertical && isArrowRight)) {\n preventDefaultEvent(event);\n this.focusNextElement(currentIndex);\n } else if (\n (this.isVertical && isArrowUp) || (!this.isVertical && isArrowLeft)) {\n preventDefaultEvent(event);\n this.focusPrevElement(currentIndex);\n } else if (isHome) {\n preventDefaultEvent(event);\n this.focusFirstElement();\n } else if (isEnd) {\n preventDefaultEvent(event);\n this.focusLastElement();\n } else if (isLetterA && event.ctrlKey && this.isCheckboxList) {\n event.preventDefault();\n this.toggleAll(\n this.selectedIndex === numbers.UNSET_INDEX ?\n [] :\n this.selectedIndex as number[]);\n } else if (isEnter || isSpace) {\n if (isRootListItem) {\n // Return early if enter key is pressed on anchor element which triggers\n // synthetic MouseEvent event.\n const target = event.target as Element | null;\n if (target && target.tagName === 'A' && isEnter) {\n return;\n }\n preventDefaultEvent(event);\n\n if (this.adapter.listItemAtIndexHasClass(\n currentIndex, cssClasses.LIST_ITEM_DISABLED_CLASS)) {\n return;\n }\n\n if (!this.isTypeaheadInProgress()) {\n if (this.isSelectableList()) {\n this.setSelectedIndexOnAction(currentIndex);\n }\n this.adapter.notifyAction(currentIndex);\n }\n }\n }\n\n if (this.hasTypeahead) {\n const handleKeydownOpts: typeahead.HandleKeydownOpts = {\n event,\n focusItemAtIndex: (index) => {\n this.focusItemAtIndex(index)\n },\n focusedItemIndex: this.focusedItemIndex,\n isTargetListItem: isRootListItem,\n sortedIndexByFirstChar: this.sortedIndexByFirstChar,\n isItemAtIndexDisabled: (index) => this.adapter.listItemAtIndexHasClass(\n index, cssClasses.LIST_ITEM_DISABLED_CLASS),\n };\n\n typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState);\n }\n }\n\n /**\n * Click handler for the list.\n */\n handleClick(index: number, toggleCheckbox: boolean) {\n if (index === numbers.UNSET_INDEX) {\n return;\n }\n\n if (this.adapter.listItemAtIndexHasClass(\n index, cssClasses.LIST_ITEM_DISABLED_CLASS)) {\n return;\n }\n if (this.isSelectableList()) {\n this.setSelectedIndexOnAction(index, toggleCheckbox);\n }\n\n this.adapter.notifyAction(index);\n }\n\n /**\n * Focuses the next element on the list.\n */\n focusNextElement(index: number) {\n const count = this.adapter.getListItemCount();\n let nextIndex = index + 1;\n if (nextIndex >= count) {\n if (this.wrapFocus) {\n nextIndex = 0;\n } else {\n // Return early because last item is already focused.\n return index;\n }\n }\n this.focusItemAtIndex(nextIndex);\n\n return nextIndex;\n }\n\n /**\n * Focuses the previous element on the list.\n */\n focusPrevElement(index: number) {\n let prevIndex = index - 1;\n if (prevIndex < 0) {\n if (this.wrapFocus) {\n prevIndex = this.adapter.getListItemCount() - 1;\n } else {\n // Return early because first item is already focused.\n return index;\n }\n }\n this.focusItemAtIndex(prevIndex);\n return prevIndex;\n }\n\n focusFirstElement() {\n this.focusItemAtIndex(0);\n return 0;\n }\n\n focusLastElement() {\n const lastIndex = this.adapter.getListItemCount() - 1;\n this.focusItemAtIndex(lastIndex);\n return lastIndex;\n }\n\n focusInitialElement() {\n const initialIndex = this.getFirstSelectedOrFocusedItemIndex();\n this.focusItemAtIndex(initialIndex);\n return initialIndex;\n }\n\n /**\n * @param itemIndex Index of the list item\n * @param isEnabled Sets the list item to enabled or disabled.\n */\n setEnabled(itemIndex: number, isEnabled: boolean): void {\n if (!this.isIndexValid(itemIndex)) {\n return;\n }\n\n if (isEnabled) {\n this.adapter.removeClassForElementIndex(\n itemIndex, cssClasses.LIST_ITEM_DISABLED_CLASS);\n this.adapter.setAttributeForElementIndex(\n itemIndex, strings.ARIA_DISABLED, 'false');\n } else {\n this.adapter.addClassForElementIndex(\n itemIndex, cssClasses.LIST_ITEM_DISABLED_CLASS);\n this.adapter.setAttributeForElementIndex(\n itemIndex, strings.ARIA_DISABLED, 'true');\n }\n }\n\n private setSingleSelectionAtIndex(index: number, {forceUpdate}: {\n forceUpdate?: boolean\n } = {}) {\n if (this.selectedIndex === index && !forceUpdate) {\n return;\n }\n\n let selectedClassName = cssClasses.LIST_ITEM_SELECTED_CLASS;\n if (this.useActivatedClass) {\n selectedClassName = cssClasses.LIST_ITEM_ACTIVATED_CLASS;\n }\n\n if (this.selectedIndex !== numbers.UNSET_INDEX) {\n this.adapter.removeClassForElementIndex(\n this.selectedIndex as number, selectedClassName);\n }\n\n this.setAriaForSingleSelectionAtIndex(index);\n this.setTabindexAtIndex(index);\n if (index !== numbers.UNSET_INDEX) {\n this.adapter.addClassForElementIndex(index, selectedClassName);\n }\n\n this.selectedIndex = index;\n }\n\n /**\n * Sets aria attribute for single selection at given index.\n */\n private setAriaForSingleSelectionAtIndex(index: number) {\n // Detect the presence of aria-current and get the value only during list\n // initialization when it is in unset state.\n if (this.selectedIndex === numbers.UNSET_INDEX) {\n this.ariaCurrentAttrValue =\n this.adapter.getAttributeForElementIndex(index, strings.ARIA_CURRENT);\n }\n\n const isAriaCurrent = this.ariaCurrentAttrValue !== null;\n const ariaAttribute =\n isAriaCurrent ? strings.ARIA_CURRENT : strings.ARIA_SELECTED;\n\n if (this.selectedIndex !== numbers.UNSET_INDEX) {\n this.adapter.setAttributeForElementIndex(\n this.selectedIndex as number, ariaAttribute, 'false');\n }\n\n if (index !== numbers.UNSET_INDEX) {\n const ariaAttributeValue =\n isAriaCurrent ? this.ariaCurrentAttrValue : 'true';\n this.adapter.setAttributeForElementIndex(\n index, ariaAttribute, ariaAttributeValue as string);\n }\n }\n\n /**\n * Returns the attribute to use for indicating selection status.\n */\n private getSelectionAttribute(): string {\n return this.useSelectedAttr ? strings.ARIA_SELECTED : strings.ARIA_CHECKED;\n }\n\n /**\n * Toggles radio at give index. Radio doesn't change the checked state if it\n * is already checked.\n */\n private setRadioAtIndex(index: number) {\n const selectionAttribute = this.getSelectionAttribute();\n this.adapter.setCheckedCheckboxOrRadioAtIndex(index, true);\n\n if (this.selectedIndex !== numbers.UNSET_INDEX) {\n this.adapter.setAttributeForElementIndex(\n this.selectedIndex as number, selectionAttribute, 'false');\n }\n\n this.adapter.setAttributeForElementIndex(index, selectionAttribute, 'true');\n\n this.selectedIndex = index;\n }\n\n private setCheckboxAtIndex(index: number[]) {\n const selectionAttribute = this.getSelectionAttribute();\n for (let i = 0; i < this.adapter.getListItemCount(); i++) {\n let isChecked = false;\n if (index.indexOf(i) >= 0) {\n isChecked = true;\n }\n\n this.adapter.setCheckedCheckboxOrRadioAtIndex(i, isChecked);\n this.adapter.setAttributeForElementIndex(\n i, selectionAttribute, isChecked ? 'true' : 'false');\n }\n\n this.selectedIndex = index;\n }\n\n private setTabindexAtIndex(index: number) {\n if (this.focusedItemIndex === numbers.UNSET_INDEX && index !== 0) {\n // If some list item was selected set first list item's tabindex to -1.\n // Generally, tabindex is set to 0 on first list item of list that has no\n // preselected items.\n this.adapter.setAttributeForElementIndex(0, 'tabindex', '-1');\n } else if (this.focusedItemIndex >= 0 && this.focusedItemIndex !== index) {\n this.adapter.setAttributeForElementIndex(\n this.focusedItemIndex, 'tabindex', '-1');\n }\n\n // Set the previous selection's tabindex to -1. We need this because\n // in selection menus that are not visible, programmatically setting an\n // option will not change focus but will change where tabindex should be 0.\n if (!(this.selectedIndex instanceof Array) &&\n this.selectedIndex !== index) {\n this.adapter.setAttributeForElementIndex(\n this.selectedIndex, 'tabindex', '-1');\n }\n\n if (index !== numbers.UNSET_INDEX) {\n this.adapter.setAttributeForElementIndex(index, 'tabindex', '0');\n }\n }\n\n /**\n * @return Return true if it is single selectin list, checkbox list or radio\n * list.\n */\n private isSelectableList() {\n return this.isSingleSelectionList || this.isCheckboxList ||\n this.isRadioList;\n }\n\n private setTabindexToFirstSelectedOrFocusedItem() {\n const targetIndex = this.getFirstSelectedOrFocusedItemIndex();\n this.setTabindexAtIndex(targetIndex);\n }\n\n private getFirstSelectedOrFocusedItemIndex(): number {\n // Action lists retain focus on the most recently focused item.\n if (!this.isSelectableList()) {\n return Math.max(this.focusedItemIndex, 0);\n }\n\n // Single-selection lists focus the selected item.\n if (typeof this.selectedIndex === 'number' &&\n this.selectedIndex !== numbers.UNSET_INDEX) {\n return this.selectedIndex;\n }\n\n // Multiple-selection lists focus the first selected item.\n if (isNumberArray(this.selectedIndex) && this.selectedIndex.length > 0) {\n return this.selectedIndex.reduce(\n (minIndex, currentIndex) => Math.min(minIndex, currentIndex));\n }\n\n // Selection lists without a selection focus the first item.\n return 0;\n }\n\n private isIndexValid(index: MDCListIndex) {\n if (index instanceof Array) {\n if (!this.isCheckboxList) {\n throw new Error(\n 'MDCListFoundation: Array of index is only supported for checkbox based list');\n }\n\n if (index.length === 0) {\n return true;\n } else {\n return index.some((i) => this.isIndexInRange(i));\n }\n } else if (typeof index === 'number') {\n if (this.isCheckboxList) {\n throw new Error(\n `MDCListFoundation: Expected array of index for checkbox based list but got number: ${\n index}`);\n }\n return this.isIndexInRange(index) ||\n this.isSingleSelectionList && index === numbers.UNSET_INDEX;\n } else {\n return false;\n }\n }\n\n private isIndexInRange(index: number) {\n const listSize = this.adapter.getListItemCount();\n return index >= 0 && index < listSize;\n }\n\n /**\n * Sets selected index on user action, toggles checkbox / radio based on\n * toggleCheckbox value. User interaction should not toggle list item(s) when\n * disabled.\n */\n private setSelectedIndexOnAction(index: number, toggleCheckbox = true) {\n if (this.isCheckboxList) {\n this.toggleCheckboxAtIndex(index, toggleCheckbox);\n } else {\n this.setSelectedIndex(index);\n }\n }\n\n private toggleCheckboxAtIndex(index: number, toggleCheckbox: boolean) {\n const selectionAttribute = this.getSelectionAttribute();\n let isChecked = this.adapter.isCheckboxCheckedAtIndex(index);\n\n if (toggleCheckbox) {\n isChecked = !isChecked;\n this.adapter.setCheckedCheckboxOrRadioAtIndex(index, isChecked);\n }\n\n this.adapter.setAttributeForElementIndex(\n index, selectionAttribute, isChecked ? 'true' : 'false');\n\n // If none of the checkbox items are selected and selectedIndex is not\n // initialized then provide a default value.\n let selectedIndexes = this.selectedIndex === numbers.UNSET_INDEX ?\n [] :\n (this.selectedIndex as number[]).slice();\n\n if (isChecked) {\n selectedIndexes.push(index);\n } else {\n selectedIndexes = selectedIndexes.filter((i) => i !== index);\n }\n\n this.selectedIndex = selectedIndexes;\n }\n\n private focusItemAtIndex(index: number) {\n this.adapter.focusItemAtIndex(index);\n this.focusedItemIndex = index;\n }\n\n private toggleAll(currentlySelectedIndexes: number[]) {\n const count = this.adapter.getListItemCount();\n\n // If all items are selected, deselect everything.\n if (currentlySelectedIndexes.length === count) {\n this.setCheckboxAtIndex([]);\n } else {\n // Otherwise select all enabled options.\n const allIndexes: number[] = [];\n for (let i = 0; i < count; i++) {\n if (!this.adapter.listItemAtIndexHasClass(\n i, cssClasses.LIST_ITEM_DISABLED_CLASS) ||\n currentlySelectedIndexes.indexOf(i) > -1) {\n allIndexes.push(i);\n }\n }\n this.setCheckboxAtIndex(allIndexes);\n }\n }\n\n /**\n * Given the next desired character from the user, adds it to the typeahead\n * buffer. Then, attempts to find the next option matching the buffer. Wraps\n * around if at the end of options.\n *\n * @param nextChar The next character to add to the prefix buffer.\n * @param startingIndex The index from which to start matching. Only relevant\n * when starting a new match sequence. To start a new match sequence,\n * clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer\n * to clear after a set interval defined in list foundation. Defaults to\n * the currently focused index.\n * @return The index of the matched item, or -1 if no match.\n */\n typeaheadMatchItem(\n nextChar: string, startingIndex?: number, skipFocus = false) {\n const opts: typeahead.TypeaheadMatchItemOpts = {\n focusItemAtIndex: (index) => {\n this.focusItemAtIndex(index);\n },\n focusedItemIndex: startingIndex ? startingIndex : this.focusedItemIndex,\n nextChar,\n sortedIndexByFirstChar: this.sortedIndexByFirstChar,\n skipFocus,\n isItemAtIndexDisabled: (index) => this.adapter.listItemAtIndexHasClass(\n index, cssClasses.LIST_ITEM_DISABLED_CLASS)\n };\n return typeahead.matchItem(opts, this.typeaheadState);\n }\n\n /**\n * Initializes the MDCListTextAndIndex data structure by indexing the current\n * list items by primary text.\n *\n * @return The primary texts of all the list items sorted by first character.\n */\n private typeaheadInitSortedIndex() {\n return typeahead.initSortedIndex(\n this.adapter.getListItemCount(), this.adapter.getPrimaryTextAtIndex);\n }\n\n /**\n * Clears the typeahead buffer.\n */\n clearTypeaheadBuffer() {\n typeahead.clearBuffer(this.typeaheadState);\n }\n}\n\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCListFoundation;\n","/**\n * @license\n * Copyright 2019 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nexport * from './adapter';\nexport * from './component';\nexport * from './constants';\nexport * from './foundation';\nexport * from './types';\n","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nimport {normalizeKey} from '@material/dom/keyboard';\n\nimport {numbers} from './constants';\nimport {preventDefaultEvent} from './events';\nimport {MDCListTextAndIndex} from './types';\n\n/**\n * State of a typeahead instance.\n */\nexport interface TypeaheadState {\n typeaheadBuffer: string;\n currentFirstChar: string;\n sortedIndexCursor: number;\n bufferClearTimeout: number;\n}\n\n/**\n * Initializes a state object for typeahead. Use the same reference for calls to\n * typeahead functions.\n *\n * @return The current state of the typeahead process. Each state reference\n * represents a typeahead instance as the reference is typically mutated\n * in-place.\n */\nexport function initState(): TypeaheadState {\n const state: TypeaheadState = {\n bufferClearTimeout: 0,\n currentFirstChar: '',\n sortedIndexCursor: 0,\n typeaheadBuffer: '',\n };\n return state;\n}\n\n/**\n * Initializes typeahead state by indexing the current list items by primary\n * text into the sortedIndexByFirstChar data structure.\n *\n * @param listItemCount numer of items in the list\n * @param getPrimaryTextByItemIndex function that returns the primary text at a\n * given index\n *\n * @return Map that maps the first character of the primary text to the full\n * list text and it's index\n */\nexport function initSortedIndex(\n listItemCount: number,\n getPrimaryTextByItemIndex: (index: number) =>\n string): Map<string, MDCListTextAndIndex[]> {\n const sortedIndexByFirstChar = new Map<string, MDCListTextAndIndex[]>();\n\n // Aggregate item text to index mapping\n for (let i = 0; i < listItemCount; i++) {\n const primaryText = getPrimaryTextByItemIndex(i).trim();\n if (!primaryText) {\n continue;\n }\n\n const firstChar = primaryText[0].toLowerCase();\n if (!sortedIndexByFirstChar.has(firstChar)) {\n sortedIndexByFirstChar.set(firstChar, []);\n }\n sortedIndexByFirstChar.get(firstChar)!.push(\n {text: primaryText.toLowerCase(), index: i});\n }\n\n // Sort the mapping\n // TODO(b/157162694): Investigate replacing forEach with Map.values()\n sortedIndexByFirstChar.forEach((values) => {\n values.sort((first: MDCListTextAndIndex, second: MDCListTextAndIndex) => {\n return first.index - second.index;\n });\n });\n\n return sortedIndexByFirstChar;\n}\n\n/**\n * Arguments for matchItem\n */\nexport interface TypeaheadMatchItemOpts {\n focusItemAtIndex: (index: number) => void;\n nextChar: string;\n focusedItemIndex: number;\n sortedIndexByFirstChar: Map<string, MDCListTextAndIndex[]>;\n skipFocus: boolean;\n isItemAtIndexDisabled: (index: number) => boolean;\n}\n\n/**\n * Given the next desired character from the user, it attempts to find the next\n * list option matching the buffer. Wraps around if at the end of options.\n *\n * @param opts Options and accessors\n * - nextChar - the next character to match against items\n * - sortedIndexByFirstChar - output of `initSortedIndex(...)`\n * - focusedItemIndex - the index of the currently focused item\n * - focusItemAtIndex - function that focuses a list item at given index\n * - skipFocus - whether or not to focus the matched item\n * - isItemAtIndexDisabled - function that determines whether an item at a\n * given index is disabled\n * @param state The typeahead state instance. See `initState`.\n *\n * @return The index of the matched item, or -1 if no match.\n */\nexport function matchItem(\n opts: TypeaheadMatchItemOpts, state: TypeaheadState): number {\n const {\n nextChar,\n focusItemAtIndex,\n sortedIndexByFirstChar,\n focusedItemIndex,\n skipFocus,\n isItemAtIndexDisabled,\n } = opts;\n\n clearTimeout(state.bufferClearTimeout);\n\n state.bufferClearTimeout = setTimeout(() => {\n clearBuffer(state);\n }, numbers.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS);\n\n state.typeaheadBuffer = state.typeaheadBuffer + nextChar;\n\n let index: number;\n if (state.typeaheadBuffer.length === 1) {\n index = matchFirstChar(\n sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state);\n } else {\n index = matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state);\n }\n\n if (index !== -1 && !skipFocus) {\n focusItemAtIndex(index);\n }\n return index;\n}\n\n/**\n * Matches the user's single input character in the buffer to the\n * next option that begins with such character. Wraps around if at\n * end of options. Returns -1 if no match is found.\n */\nfunction matchFirstChar(\n sortedIndexByFirstChar: Map<string, MDCListTextAndIndex[]>,\n focusedItemIndex: number, isItemAtIndexDisabled: (index: number) => boolean,\n state: TypeaheadState): number {\n const firstChar = state.typeaheadBuffer[0];\n const itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar);\n if (!itemsMatchingFirstChar) {\n return -1;\n }\n\n // Has the same firstChar been recently matched?\n // Also, did starting index remain the same between key presses?\n // If both hold true, simply increment index.\n if (firstChar === state.currentFirstChar &&\n itemsMatchingFirstChar[state.sortedIndexCursor].index ===\n focusedItemIndex) {\n state.sortedIndexCursor =\n (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length;\n\n const newIndex = itemsMatchingFirstChar[state.sortedIndexCursor].index;\n if (!isItemAtIndexDisabled(newIndex)) {\n return newIndex;\n }\n }\n\n // If we're here, it means one of the following happened:\n // - either firstChar or startingIndex has changed, invalidating the\n // cursor.\n // - The next item of typeahead is disabled, so we have to look further.\n state.currentFirstChar = firstChar;\n\n let newCursorPosition = -1;\n let cursorPosition;\n // Find the first non-disabled item as a fallback.\n for (cursorPosition = 0; cursorPosition < itemsMatchingFirstChar.length;\n cursorPosition++) {\n if (!isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) {\n newCursorPosition = cursorPosition;\n break;\n }\n }\n\n // Advance cursor to first item matching the firstChar that is positioned\n // after starting item. Cursor is unchanged from fallback if there's no\n // such item.\n for (; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) {\n if (itemsMatchingFirstChar[cursorPosition].index > focusedItemIndex &&\n !isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) {\n newCursorPosition = cursorPosition;\n break;\n }\n }\n\n if (newCursorPosition !== -1) {\n state.sortedIndexCursor = newCursorPosition;\n return itemsMatchingFirstChar[state.sortedIndexCursor].index;\n }\n\n return -1;\n}\n\n/**\n * Attempts to find the next item that matches all of the typeahead buffer.\n * Wraps around if at end of options. Returns -1 if no match is found.\n */\nfunction matchAllChars(\n sortedIndexByFirstChar: Map<string, MDCListTextAndIndex[]>,\n isItemAtIndexDisabled: (index: number) => boolean,\n state: TypeaheadState): number {\n const firstChar = state.typeaheadBuffer[0];\n const itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar);\n if (!itemsMatchingFirstChar) {\n return -1;\n }\n\n // Do nothing if text already matches\n const startingItem = itemsMatchingFirstChar[state.sortedIndexCursor];\n if (startingItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0 &&\n !isItemAtIndexDisabled(startingItem.index)) {\n return startingItem.index;\n }\n\n // Find next item that matches completely; if no match, we'll eventually\n // loop around to same position\n let cursorPosition =\n (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length;\n let nextCursorPosition = -1;\n while (cursorPosition !== state.sortedIndexCursor) {\n const currentItem = itemsMatchingFirstChar[cursorPosition];\n\n const matches =\n currentItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0;\n const isEnabled = !isItemAtIndexDisabled(currentItem.index);\n if (matches && isEnabled) {\n nextCursorPosition = cursorPosition;\n break;\n }\n\n cursorPosition = (cursorPosition + 1) % itemsMatchingFirstChar.length;\n }\n\n if (nextCursorPosition !== -1) {\n state.sortedIndexCursor = nextCursorPosition;\n return itemsMatchingFirstChar[state.sortedIndexCursor].index;\n }\n\n return -1;\n}\n\n/**\n * Whether or not the given typeahead instaance state is currently typing.\n *\n * @param state The typeahead state instance. See `initState`.\n */\nexport function isTypingInProgress(state: TypeaheadState) {\n return state.typeaheadBuffer.length > 0;\n}\n\n/**\n * Options for handleKeydown.\n */\nexport interface HandleKeydownOpts {\n event: KeyboardEvent;\n isTargetListItem: boolean;\n focusItemAtIndex: (index: number) => void;\n focusedItemIndex: number;\n sortedIndexByFirstChar: Map<string, MDCListTextAndIndex[]>;\n isItemAtIndexDisabled: (index: number) => boolean;\n}\n\n/**\n * Clears the typeahaed buffer so that it resets item matching to the first\n * character.\n *\n * @param state The typeahead state instance. See `initState`.\n */\nexport function clearBuffer(state: TypeaheadState) {\n state.typeaheadBuffer = '';\n}\n\n/**\n * Given a keydown event, it calculates whether or not to automatically focus a\n * list item depending on what was typed mimicing the typeahead functionality of\n * a standard <select> element that is open.\n *\n * @param opts Options and accessors\n * - event - the KeyboardEvent to handle and parse\n * - sortedIndexByFirstChar - output of `initSortedIndex(...)`\n * - focusedItemIndex - the index of the currently focused item\n * - focusItemAtIndex - function that focuses a list item at given index\n * - isItemAtFocusedIndexDisabled - whether or not the currently focused item\n * is disabled\n * - isTargetListItem - whether or not the event target is a list item\n * @param state The typeahead state instance. See `initState`.\n *\n * @returns index of the item matched by the keydown. -1 if not matched.\n */\nexport function handleKeydown(opts: HandleKeydownOpts, state: TypeaheadState) {\n const {\n event,\n isTargetListItem,\n focusedItemIndex,\n focusItemAtIndex,\n sortedIndexByFirstChar,\n isItemAtIndexDisabled,\n } = opts;\n\n const isArrowLeft = normalizeKey(event) === 'ArrowLeft';\n const isArrowUp = normalizeKey(event) === 'ArrowUp';\n const isArrowRight = normalizeKey(event) === 'ArrowRight';\n const isArrowDown = normalizeKey(event) === 'ArrowDown';\n const isHome = normalizeKey(event) === 'Home';\n const isEnd = normalizeKey(event) === 'End';\n const isEnter = normalizeKey(event) === 'Enter';\n const isSpace = normalizeKey(event) === 'Spacebar';\n\n if (event.ctrlKey || event.metaKey || isArrowLeft || isArrowUp ||\n isArrowRight || isArrowDown || isHome || isEnd || isEnter) {\n return -1;\n }\n\n const isCharacterKey = !isSpace && event.key.length === 1;\n\n if (isCharacterKey) {\n preventDefaultEvent(event);\n const matchItemOpts: TypeaheadMatchItemOpts = {\n focusItemAtIndex,\n focusedItemIndex,\n nextChar: event.key.toLowerCase(),\n sortedIndexByFirstChar,\n skipFocus: false,\n isItemAtIndexDisabled,\n };\n return matchItem(matchItemOpts, state);\n }\n\n if (!isSpace) {\n return -1;\n }\n\n if (isTargetListItem) {\n preventDefaultEvent(event);\n }\n\n const typeaheadOnListItem = isTargetListItem && isTypingInProgress(state);\n\n if (typeaheadOnListItem) {\n const matchItemOpts: TypeaheadMatchItemOpts = {\n focusItemAtIndex,\n focusedItemIndex,\n nextChar: ' ',\n sortedIndexByFirstChar,\n skipFocus: false,\n isItemAtIndexDisabled,\n };\n // space participates in typeahead matching if in rapid typing mode\n return matchItem(matchItemOpts, state);\n }\n\n return -1;\n}\n","/**\n * @license\n * Copyright 2019 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nexport interface MDCListActionEventDetail {\n /**\n * Index of the list item that was activated.\n */\n index: number;\n}\n\nexport interface MDCListActionEvent extends Event {\n detail: MDCListActionEventDetail;\n}\n\nexport type MDCListIndex = number | number[];\n\n/**\n * Type used by the typeahead mechanism to keep track of the index associated\n * with list item text.\n */\nexport interface MDCListTextAndIndex {\n text: string;\n index: number;\n}\n"],"sourceRoot":""}
\No newline at end of file