UNPKG

koval-ui

Version:

React components collection with minimalistic design. Supports theming, layout, and input validation.

22 lines (21 loc) 654 B
"use client"; import { useState as m, useEffect as r, useCallback as o, useMemo as C } from "react"; import { ProcessingModes as u } from "../types.js"; const k = ({ rowSelectionProp: s, onRowSelect: e, processingMode: n }) => { const l = n === u.internal, [t, i] = m(s); r(() => { i(s); }, [s]), r(() => { e(t); }, [e, t]); const c = o(() => { n === u.internal && i({}), e({}); }, [e, n]), a = C(() => l ? i : (f) => { e(typeof f == "function" ? f(t) : f); }, [l, e, t]); return { rowSelection: t, setRowSelection: a, clearSelection: c }; }; export { k as useRowSelection }; //# sourceMappingURL=useRowSelection.js.map