UNPKG

@1771technologies/lytenyte-pro

Version:

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

15 lines (14 loc) 740 B
import { jsx as _jsx } from "react/jsx-runtime"; import { forwardRef } from "react"; import { useTreeItemContext } from "./context.js"; import { useSlot } from "@1771technologies/lytenyte-core/yinternal"; export const InclusionCheckbox = forwardRef(function InclusionCheckbox({ as, ...props }, forwarded) { const { isChecked, onCheckChange, isIndeterminate } = useTreeItemContext(); const rendered = useSlot({ props: [props], ref: forwarded, state: { checked: isChecked, toggle: onCheckChange, indeterminate: isIndeterminate }, slot: as ?? (_jsx("input", { type: "checkbox", checked: isChecked, "aria-label": "visibility toggle", onChange: () => onCheckChange() })), }); return rendered; });