UNPKG

koval-ui

Version:

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

19 lines (18 loc) 597 B
"use client"; import { useState as x, useCallback as i } from "react"; const n = (s, t) => s % t >= 0 ? s % t : t + s % t, f = ({ defaultVisible: s, cellsAmount: t, onRotate: r }) => { const [o, a] = x(s), c = n(o, t), C = i(() => { const e = o + 1; a(e), r(n(e, t)); }, [o, r, t]), b = i(() => { const e = o - 1; a(e), r(n(e, t)); }, [o, r, t]), u = i(() => { a(o + 1); }, [o, a]); return { visibleCellIndex: c, rotateRight: C, rotateLeft: b, rotations: o, handleRotate: u }; }; export { f as useCarouselRotation }; //# sourceMappingURL=useCarouselRotation.js.map