@adaptui/react
Version:
Collection of headless components/hooks that are accessible, composable, customizable from low level to build your own UI & Design System powered by Reakit
36 lines (28 loc) • 1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getAutoSizeDuration = getAutoSizeDuration;
exports.getElementHeight = getElementHeight;
exports.getElementWidth = getElementWidth;
// https://github.com/mui-org/material-ui/blob/da362266f7c137bf671d7e8c44c84ad5cfc0e9e2/packages/material-ui/src/styles/transitions.js#L89-L98
function getAutoSizeDuration(size) {
if (!size || typeof size === "string") {
return 0;
}
var constant = size / 36; // https://www.wolframalpha.com/input/?i=(4+%2B+15+*+(x+%2F+36+)+**+0.25+%2B+(x+%2F+36)+%2F+5)+*+10
return Math.round((4 + 15 * Math.pow(constant, 0.25) + constant / 5) * 10);
}
function getElementHeight(el) {
if (!(el !== null && el !== void 0 && el.current)) {
return "auto";
}
return el.current.scrollHeight;
}
function getElementWidth(el) {
if (!(el !== null && el !== void 0 && el.current)) {
return "auto";
}
return el.current.scrollWidth;
}
//# sourceMappingURL=__utils.js.map