UNPKG

koval-ui

Version:

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

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