@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
1 lines • 786 B
Source Map (JSON)
{"version":3,"file":"get-context-item-index.cjs","names":["findElementAncestor"],"sources":["../../../../src/core/utils/get-context-item-index/get-context-item-index.ts"],"sourcesContent":["import { findElementAncestor } from '../find-element-ancestor/find-element-ancestor';\n\nexport function getContextItemIndex(\n elementSelector: string,\n parentSelector: string,\n node: HTMLElement\n) {\n if (!node) {\n return null;\n }\n\n return Array.from(\n findElementAncestor(node, parentSelector)?.querySelectorAll(elementSelector) || []\n ).findIndex((element) => element === node);\n}\n"],"mappings":";;;AAEA,SAAgB,oBACd,iBACA,gBACA,MACA;CACA,IAAI,CAAC,MACH,OAAO;CAGT,OAAO,MAAM,KACXA,8BAAAA,oBAAoB,MAAM,cAAc,GAAG,iBAAiB,eAAe,KAAK,CAAC,CACnF,EAAE,WAAW,YAAY,YAAY,IAAI;AAC3C"}