UNPKG

koval-ui

Version:

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

28 lines (27 loc) 595 B
"use client"; import { useState as y, useCallback as o } from "react"; import { PlayModes as a } from "./types.js"; const P = ({ onPlay: p, onPause: r, embedRef: l }) => { const [s, e] = y(a.pristine), n = o( (t) => { e(a.play), p(t); }, [p] ), u = o( (t) => { e(a.pause), r(t); }, [r] ), c = o(() => { s === a.play ? (l.current?.pause(), e(a.pause)) : (l.current?.play(), e(a.play)); }, [s, l]); return { handlePlay: n, handlePause: u, handleTogglePlay: c, playMode: s }; }; export { P as usePlay }; //# sourceMappingURL=usePlay.js.map