UNPKG

@pdf-viewer/react

Version:

A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.

22 lines (21 loc) 586 B
import { useState as a } from "react"; import d from "./useResizeObserver.js"; const S = (c) => { const [h, u] = a({ width: 0, height: 0 }); return d(c, (z) => { const e = z[0]; if (e) { const t = e.contentBoxSize; let i = 0, o = 0; if (t) { const n = Array.isArray(t) ? t : [t]; i = n.reduce((r, { inlineSize: s }) => r + s, 0), o = n.reduce((r, { blockSize: s }) => r + s, 0); } else i = e.contentRect.width, o = e.contentRect.height; u({ width: i, height: o }); } }), { size: h }; }; export { S as default };