Some checks are pending
Deploy Volleyball CMS / deploy (push) Waiting to run
66 lines
1.8 KiB
JavaScript
66 lines
1.8 KiB
JavaScript
import {
|
|
useLayoutEffect2
|
|
} from "./chunk-3CC64B4R.js";
|
|
import {
|
|
require_react
|
|
} from "./chunk-2WIBB5DE.js";
|
|
import {
|
|
__toESM
|
|
} from "./chunk-DC5AMYBS.js";
|
|
|
|
// node_modules/@radix-ui/react-use-previous/dist/index.mjs
|
|
var React = __toESM(require_react(), 1);
|
|
function usePrevious(value) {
|
|
const ref = React.useRef({ value, previous: value });
|
|
return React.useMemo(() => {
|
|
if (ref.current.value !== value) {
|
|
ref.current.previous = ref.current.value;
|
|
ref.current.value = value;
|
|
}
|
|
return ref.current.previous;
|
|
}, [value]);
|
|
}
|
|
|
|
// node_modules/@radix-ui/react-use-size/dist/index.mjs
|
|
var React2 = __toESM(require_react(), 1);
|
|
function useSize(element) {
|
|
const [size, setSize] = React2.useState(void 0);
|
|
useLayoutEffect2(() => {
|
|
if (element) {
|
|
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
if (!Array.isArray(entries)) {
|
|
return;
|
|
}
|
|
if (!entries.length) {
|
|
return;
|
|
}
|
|
const entry = entries[0];
|
|
let width;
|
|
let height;
|
|
if ("borderBoxSize" in entry) {
|
|
const borderSizeEntry = entry["borderBoxSize"];
|
|
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
width = borderSize["inlineSize"];
|
|
height = borderSize["blockSize"];
|
|
} else {
|
|
width = element.offsetWidth;
|
|
height = element.offsetHeight;
|
|
}
|
|
setSize({ width, height });
|
|
});
|
|
resizeObserver.observe(element, { box: "border-box" });
|
|
return () => resizeObserver.unobserve(element);
|
|
} else {
|
|
setSize(void 0);
|
|
}
|
|
}, [element]);
|
|
return size;
|
|
}
|
|
|
|
export {
|
|
usePrevious,
|
|
useSize
|
|
};
|
|
//# sourceMappingURL=chunk-RVOPK2BC.js.map
|