UNPKG

@brizy/ui

Version:
55 lines (54 loc) 2.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRadius = exports.getCustomSize = exports.getDisabledWidth = exports.getColor = exports.getHoverColor = void 0; const colors_1 = require("../utils/colors"); const constants_1 = require("../constants"); const getHoverColor = (color) => { return { [`--${constants_1.BRZ_PREFIX}-btn-hover`]: (0, colors_1.getHexByColorType)(color) }; }; exports.getHoverColor = getHoverColor; const getColor = (color) => { return { [`--${constants_1.BRZ_PREFIX}-btn-color`]: (0, colors_1.getHexByColorType)(color) }; }; exports.getColor = getColor; const getDisabledWidth = (fullWidth) => { return fullWidth ? { [`--${constants_1.BRZ_PREFIX}-btn-disabled-width`]: "100%" } : {}; }; exports.getDisabledWidth = getDisabledWidth; const getCustomSize = (size) => { var _a, _b; switch (typeof size) { case "number": return { [`--${constants_1.BRZ_PREFIX}-btn-custom`]: `${size}px` }; case "object": return { [`--${constants_1.BRZ_PREFIX}-btn-custom`]: `${(_a = size["x"]) !== null && _a !== void 0 ? _a : 0}px ${(_b = size["y"]) !== null && _b !== void 0 ? _b : 0}px` }; default: return {}; } }; exports.getCustomSize = getCustomSize; const getRadius = (radius) => { if (typeof radius === "number") { return { [`--${constants_1.BRZ_PREFIX}-btn-radius`]: `${radius}px`, }; } if (typeof radius === "string") { switch (radius) { case "none": return { [`--${constants_1.BRZ_PREFIX}-btn-radius`]: "0px", }; case "round": return { [`--${constants_1.BRZ_PREFIX}-btn-radius`]: "50%", }; case "rounded": return { [`--${constants_1.BRZ_PREFIX}-btn-radius`]: "3px", }; } } return {}; }; exports.getRadius = getRadius;