All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.prod.util.TabbableElements.js.map Maven / Gradle / Ivy

{
  "version": 3,
  "sources": ["../../../src/util/TabbableElements.ts"],
  "sourcesContent": ["import isElementTabbable from \"./isElementTabbable.js\";\n\n/**\n * Returns the tabbable elements within the provided HTMLElement.\n *\n * @public\n * @param { HTMLElement } el the component to operate on (component that slots or contains within its shadow root the items the user navigates among)\n * @returns { Array } the tabbable elements\n */\nconst getTabbableElements = (el: HTMLElement): Array => {\n\treturn getTabbables([...el.children]);\n};\n\n/**\n * Returns the last tabbable element within the provided HTMLElement.\n *\n * @public\n * @param { HTMLElement } el the component to operate on (component that slots or contains within its shadow root the items the user navigates among)\n * @returns { HTMLElement | null } the last tabbable element or \"null\" if not found\n */\nconst getLastTabbableElement = (el: HTMLElement): HTMLElement | null => {\n\tconst tabbables = getTabbables([...el.children]);\n\treturn tabbables.length ? tabbables[tabbables.length - 1] : null;\n};\n\nconst getTabbables = (nodes: Array, tabbables?: Array): Array => {\n\tconst tabbableElements = tabbables || [];\n\n\tif (!nodes) {\n\t\treturn tabbableElements;\n\t}\n\n\tnodes.forEach(currentNode => {\n\t\tif (currentNode.nodeType === Node.TEXT_NODE || currentNode.nodeType === Node.COMMENT_NODE) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentElement = currentNode as HTMLElement;\n\t\tif (currentElement.hasAttribute(\"data-sap-no-tab-ref\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (isElementTabbable(currentElement)) {\n\t\t\ttabbableElements.push(currentElement);\n\t\t}\n\n\t\tif (currentElement.tagName === \"SLOT\") {\n\t\t\tgetTabbables((currentElement as HTMLSlotElement).assignedNodes() as Array, tabbableElements);\n\t\t} else {\n\t\t\tconst children = currentElement.shadowRoot ? currentElement.shadowRoot.children : currentElement.children;\n\t\t\tgetTabbables([...children], tabbableElements);\n\t\t}\n\t});\n\n\treturn tabbableElements;\n};\n\nexport {\n\tgetTabbableElements,\n\tgetLastTabbableElement,\n};\n"],
  "mappings": "aAAA,OAAOA,MAAuB,yBAS9B,MAAMC,EAAuBC,GACrBC,EAAa,CAAC,GAAGD,EAAG,QAAQ,CAAC,EAU/BE,EAA0BF,GAAwC,CACvE,MAAMG,EAAYF,EAAa,CAAC,GAAGD,EAAG,QAAQ,CAAC,EAC/C,OAAOG,EAAU,OAASA,EAAUA,EAAU,OAAS,CAAC,EAAI,IAC7D,EAEMF,EAAe,CAACG,EAAoBD,IAAuD,CAChG,MAAME,EAAmBF,GAAa,CAAC,EAEvC,OAAKC,GAILA,EAAM,QAAQE,GAAe,CAC5B,GAAIA,EAAY,WAAa,KAAK,WAAaA,EAAY,WAAa,KAAK,aAC5E,OAGD,MAAMC,EAAiBD,EACvB,GAAI,CAAAC,EAAe,aAAa,qBAAqB,EAQrD,GAJIT,EAAkBS,CAAc,GACnCF,EAAiB,KAAKE,CAAc,EAGjCA,EAAe,UAAY,OAC9BN,EAAcM,EAAmC,cAAc,EAAyBF,CAAgB,MAClG,CACN,MAAMG,EAAWD,EAAe,WAAaA,EAAe,WAAW,SAAWA,EAAe,SACjGN,EAAa,CAAC,GAAGO,CAAQ,EAAGH,CAAgB,CAC7C,CACD,CAAC,EAEMA,CACR,EAEA,OACCN,KAAA,oBACAG,KAAA",
  "names": ["isElementTabbable", "getTabbableElements", "el", "getTabbables", "getLastTabbableElement", "tabbables", "nodes", "tabbableElements", "currentNode", "currentElement", "children"]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy