UNPKG

@naturacosmeticos/natds-react

Version:
68 lines 3.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* eslint-disable max-len */ var react_jss_1 = require("react-jss"); var ThemeProvider_1 = require("../../ThemeProvider"); var getBorderStyles = function (theme) { return function (_a) { var position = _a.position, size = _a.size; var border = { center: size && theme.tag[size].borderRadius.enable, left: size && "".concat(theme.tag[size].borderRadius.disable, "px ").concat(theme.tag[size].borderRadius.enable, "px ").concat(theme.tag[size].borderRadius.enable, "px ").concat(theme.tag[size].borderRadius.disable, "px"), right: size && "".concat(theme.tag[size].borderRadius.enable, "px ").concat(theme.tag[size].borderRadius.disable, "px ").concat(theme.tag[size].borderRadius.disable, "px ").concat(theme.tag[size].borderRadius.enable, "px") }; return position && border[position]; }; }; var getThemeTag = function (theme) { return function (_a) { var brand = _a.brand, color = _a.color; var themeSelectTag = (0, ThemeProvider_1.buildTheme)(brand, 'light'); if (brand) { return color && { back: themeSelectTag.tag.color.background[color], color: themeSelectTag.tag.color.label[color] }; } return color && { back: theme.tag.color.background[color], color: theme.tag.color.label[color] }; }; }; var styles = (0, react_jss_1.createUseStyles)(function (theme) { return ({ wrapper: { display: 'flex' }, container: { display: 'flex', alignItems: 'center', gap: theme.size.micro, backgroundColor: function (_a) { var _b; var customBackgroundColor = _a.customBackgroundColor, _c = _a.color, color = _c === void 0 ? 'primary' : _c, brand = _a.brand; return (customBackgroundColor || ((_b = getThemeTag(theme)({ color: color, brand: brand })) === null || _b === void 0 ? void 0 : _b.back)); }, borderRadius: getBorderStyles(theme), height: function (_a) { var size = _a.size; return size && theme.size[size]; }, padding: [0, theme.spacing.tiny], overflow: 'hidden' }, content: { color: function (_a) { var _b; var customLabelColor = _a.customLabelColor, _c = _a.color, color = _c === void 0 ? 'primary' : _c, brand = _a.brand; return (customLabelColor || ((_b = getThemeTag(theme)({ color: color, brand: brand })) === null || _b === void 0 ? void 0 : _b.color)); }, fontFamily: [theme.tag.label.primary.fontFamily, theme.tag.label.fallback.fontFamily], fontSize: theme.tag.label.fontSize, fontWeight: theme.tag.label.primary.fontWeight, letterSpacing: theme.tag.label.letterSpacing, lineHeight: theme.tag.label.lineHeight, userSelect: 'none', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }); }); exports.default = styles; //# sourceMappingURL=Tag.styles.js.map