UNPKG

@1771technologies/lytenyte-pro

Version:

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

20 lines (19 loc) 1.12 kB
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import { useSlot } from "@1771technologies/lytenyte-core/yinternal"; import { forwardRef } from "react"; import { useFilterRow } from "./filter-row-context.js"; function FilterCombinatorImpl({ as, ...props }, ref) { const ctx = useFilterRow(); const slot = useSlot({ props: [props], ref: ref, slot: as ?? (_jsx(_Fragment, { children: ctx.showExtender && (_jsxs("div", { ...props, ref: ref, children: [_jsxs("label", { children: ["AND", _jsx("input", { type: "radio", checked: ctx.extender === "AND", value: "AND", onChange: (e) => ctx.onExtenderChange(e.target.value) })] }), _jsxs("label", { children: ["OR", _jsx("input", { type: "radio", checked: ctx.extender === "OR", value: "OR", onChange: (e) => ctx.onExtenderChange(e.target.value) })] })] })) })), state: { onChange: ctx.onExtenderChange, shouldShow: ctx.showExtender, value: ctx.extender, }, }); return slot; } export const FilterCombinator = forwardRef(FilterCombinatorImpl);