UNPKG

@frontify/fondue

Version:
17 lines (16 loc) 778 B
import { useContext as I } from "react"; import { TreeContext as f } from "../TreeContext.es.js"; import { convertToPartialSelectedId as m } from "../helpers/multiselect.es.js"; const h = (o) => { const { treeState: e } = I(f), t = e.nodes.find((n) => n.props.id === o), r = t ? t.props.parentId : "", d = e.nodes.find((n) => n.props.id === r), s = t ? `${r}/${t.props.id}` : null, p = d ? `${d.props.parentId}/${d.props.id}` : null, a = s ? e.selectedIds.has(s) : !1, c = p ? e.selectedIds.has(p) : !1, l = s ? e.selectedIds.has(m([s])[0]) : !1, i = e.expandedIds.has(o); return { isSelected: a, isParentSelected: c, isPartialSelected: l, isExpanded: i }; }; export { h as useMultiselectTreeItem }; //# sourceMappingURL=useMultiselectTreeItem.es.js.map