UNPKG

@blossom-carousel/react

Version:

A native-scroll-first carousel component for React.

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