UNPKG

@1771technologies/lytenyte-pro

Version:

Blazingly fast headless React data grid with 100s of features.

15 lines (14 loc) 792 B
import { jsx as _jsx } from "react/jsx-runtime"; import { forwardRef } from "react"; import { TreeLeaf } from "../tree-view/leaf.js"; import { FilterTreeItemContext } from "./context.js"; import { useTreeItem } from "./hooks/use-tree-item.js"; export const Leaf = forwardRef(function Leaf({ item, ...props }, forwarded) { const value = useTreeItem(item); return (_jsx(FilterTreeItemContext.Provider, { value: value, children: _jsx(TreeLeaf, { ...props, itemId: item.leaf.data.id, ref: forwarded, ...item.attrs, style: { ...props.style, ...item.attrs.style }, onClick: () => value.onCheckChange(), onKeyDown: (ev) => { if (ev.key === " ") { ev.preventDefault(); value.onCheckChange(); } } }) })); });