@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
20 lines (17 loc) • 794 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)
};
}
exports.getRootPadding = getRootPadding;
//# sourceMappingURL=get-root-padding.cjs.map