UNPKG

@brizy/ui

Version:
27 lines (26 loc) 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getItemProperties = exports.getOverlayProperties = void 0; const colors_1 = require("../utils/colors"); const constants_1 = require("../constants"); const getOverlayProperties = (width, offset) => { const hasWidth = width !== undefined; const hasOffset = offset !== undefined; if (hasWidth || hasOffset) { return Object.assign(Object.assign({}, (hasWidth && { [`--${constants_1.BRZ_PREFIX}-dropdown-content-width`]: `${width}px`, })), (hasOffset && { [`--${constants_1.BRZ_PREFIX}-dropdown-content-offset`]: `${offset}px`, })); } }; exports.getOverlayProperties = getOverlayProperties; const getItemProperties = (color) => { const { background, hoverBackground } = color || {}; if (background || hoverBackground) { return Object.assign(Object.assign({}, (background && { [`--${constants_1.BRZ_PREFIX}-dropdown-item-background`]: (0, colors_1.getHexByColorType)(background) })), (hoverBackground && { [`--${constants_1.BRZ_PREFIX}-dropdown-item-hover-background`]: (0, colors_1.getHexByColorType)(hoverBackground), })); } }; exports.getItemProperties = getItemProperties;