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

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

{"version":3,"file":"TabbableElements.js","sourceRoot":"","sources":["../../src/util/TabbableElements.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,mBAAmB,GAAG,CAAC,EAAe,EAAsB,EAAE;IACnE,OAAO,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,sBAAsB,GAAG,CAAC,EAAe,EAAsB,EAAE;IACtE,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjD,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,KAAkB,EAAE,SAA8B,EAAsB,EAAE;IAC/F,MAAM,gBAAgB,GAAG,SAAS,IAAI,EAAE,CAAC;IAEzC,IAAI,CAAC,KAAK,EAAE;QACX,OAAO,gBAAgB,CAAC;KACxB;IAED,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QAC3B,IAAI,WAAW,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,IAAI,WAAW,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY,EAAE;YAC1F,OAAO;SACP;QAED,MAAM,cAAc,GAAG,WAA0B,CAAC;QAClD,IAAI,cAAc,CAAC,YAAY,CAAC,qBAAqB,CAAC,EAAE;YACvD,OAAO;SACP;QAED,IAAI,iBAAiB,CAAC,cAAc,CAAC,EAAE;YACtC,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACtC;QAED,IAAI,cAAc,CAAC,OAAO,KAAK,MAAM,EAAE;YACtC,YAAY,CAAE,cAAkC,CAAC,aAAa,EAAwB,EAAE,gBAAgB,CAAC,CAAC;SAC1G;aAAM;YACN,MAAM,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC;YAC1G,YAAY,CAAC,CAAC,GAAG,QAAQ,CAAC,EAAE,gBAAgB,CAAC,CAAC;SAC9C;IACF,CAAC,CAAC,CAAC;IAEH,OAAO,gBAAgB,CAAC;AACzB,CAAC,CAAC;AAEF,OAAO,EACN,mBAAmB,EACnB,sBAAsB,GACtB,CAAC","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"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy