@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
18 lines (16 loc) • 765 B
JavaScript
'use client';
function getPaddingValue(value, defaultPaddingValue) {
const val = parseFloat(value.replace("px", ""));
return Number.isNaN(val) ? defaultPaddingValue : val;
}
function getRootPadding(root, defaultPaddingValue) {
const computedStyle = window.getComputedStyle(root);
return {
top: getPaddingValue(computedStyle.getPropertyValue("padding-top"), defaultPaddingValue),
right: getPaddingValue(computedStyle.getPropertyValue("padding-right"), defaultPaddingValue),
bottom: getPaddingValue(computedStyle.getPropertyValue("padding-bottom"), defaultPaddingValue),
left: getPaddingValue(computedStyle.getPropertyValue("padding-left"), defaultPaddingValue)
};
}
export { getRootPadding };
//# sourceMappingURL=get-root-padding.mjs.map