UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

1 lines 753 B
{"version":3,"file":"get-context-item-index.mjs","names":[],"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;AACA,KAAI,CAAC,KACH,QAAO;AAGT,QAAO,MAAM,KACX,oBAAoB,MAAM,eAAe,EAAE,iBAAiB,gBAAgB,IAAI,EAAE,CACnF,CAAC,WAAW,YAAY,YAAY,KAAK"}