UNPKG

@blossom-carousel/react

Version:

A native-scroll-first carousel component for React.

28 lines (27 loc) 685 B
import { jsx as m } from "react/jsx-runtime"; import { Blossom as f } from "@blossom-carousel/core"; import { forwardRef as n, useRef as a, useEffect as c, useImperativeHandle as i } from "react"; const d = n( ({ children: e, as: t = "div", repeat: o = !1, ...l }, u) => { const r = a(null); return c(() => { if (!r.current) return; const s = f(r.current, { repeat: o }); return s.init(), () => { s.destroy(); }; }, [o]), i( u, () => r.current ), /* @__PURE__ */ m(t, { ref: r, "blossom-carousel": "true", ...l, children: e }); } ); d.displayName = "BlossomCarousel"; export { d as BlossomCarousel };