UNPKG

@brizy/ui

Version:
63 lines (62 loc) 2.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSpacingStyles = exports.getPixelsSize = void 0; const utils_1 = require("../utils"); const constants_1 = require("../constants"); const getPixelsSize = (space) => { if ((0, utils_1.isNumber)(space)) { return `${space}px`; } else { switch (space) { case "xxsmall": return "7.5px"; case "xsmall": return "15px"; case "small": return "26px"; case "middle": return "30px"; case "large": return "40px"; default: return "50px"; } } }; exports.getPixelsSize = getPixelsSize; const getSpacingStyles = (spacing) => { if (Array.isArray(spacing)) { if (spacing.length === 2) { return { [`--${constants_1.BRZ_PREFIX}-space-top`]: (0, exports.getPixelsSize)(spacing[0]), [`--${constants_1.BRZ_PREFIX}-space-bottom`]: (0, exports.getPixelsSize)(spacing[0]), [`--${constants_1.BRZ_PREFIX}-space-right`]: (0, exports.getPixelsSize)(spacing[1]), [`--${constants_1.BRZ_PREFIX}-space-left`]: (0, exports.getPixelsSize)(spacing[1]), }; } else if (spacing.length === 3) { return { [`--${constants_1.BRZ_PREFIX}-space-top`]: (0, exports.getPixelsSize)(spacing[0]), [`--${constants_1.BRZ_PREFIX}-space-bottom`]: (0, exports.getPixelsSize)(spacing[2]), [`--${constants_1.BRZ_PREFIX}-space-right`]: (0, exports.getPixelsSize)(spacing[1]), [`--${constants_1.BRZ_PREFIX}-space-left`]: (0, exports.getPixelsSize)(spacing[1]), }; } else { return { [`--${constants_1.BRZ_PREFIX}-space-top`]: (0, exports.getPixelsSize)(spacing[0]), [`--${constants_1.BRZ_PREFIX}-space-bottom`]: (0, exports.getPixelsSize)(spacing[2]), [`--${constants_1.BRZ_PREFIX}-space-right`]: (0, exports.getPixelsSize)(spacing[1]), [`--${constants_1.BRZ_PREFIX}-space-left`]: (0, exports.getPixelsSize)(spacing[3]), }; } } return { [`--${constants_1.BRZ_PREFIX}-space-top`]: (0, exports.getPixelsSize)(spacing), [`--${constants_1.BRZ_PREFIX}-space-bottom`]: (0, exports.getPixelsSize)(spacing), [`--${constants_1.BRZ_PREFIX}-space-right`]: (0, exports.getPixelsSize)(spacing), [`--${constants_1.BRZ_PREFIX}-space-left`]: (0, exports.getPixelsSize)(spacing), }; }; exports.getSpacingStyles = getSpacingStyles;