@undp/design-system-react
Version:
React based design system for UNDP
31 lines (30 loc) • 809 B
JavaScript
import { t as e } from "./dist-BKfyhBSH.js";
import * as t from "react";
//#region node_modules/@radix-ui/react-use-size/dist/index.mjs
function n(n) {
let [r, i] = t.useState(void 0);
return e(() => {
if (n) {
i({
width: n.offsetWidth,
height: n.offsetHeight
});
let e = new ResizeObserver((e) => {
if (!Array.isArray(e) || !e.length) return;
let t = e[0], r, a;
if ("borderBoxSize" in t) {
let e = t.borderBoxSize, n = Array.isArray(e) ? e[0] : e;
r = n.inlineSize, a = n.blockSize;
} else r = n.offsetWidth, a = n.offsetHeight;
i({
width: r,
height: a
});
});
return e.observe(n, { box: "border-box" }), () => e.unobserve(n);
} else i(void 0);
}, [n]), r;
}
//#endregion
export { n as t };
//# sourceMappingURL=dist-UHnBR-XH.js.map