@elastic/eui
Version:
Elastic UI Component Library
89 lines (88 loc) • 6.04 kB
JavaScript
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { css } from '@emotion/react';
import { euiFontSize, logicalCSS, logicalShorthandCSS, logicalTextAlignCSS, euiTextBreakWord, euiTextTruncate, mathWithUnits } from '../../global_styling';
import { highContrastModeStyles } from '../../global_styling/functions/high_contrast';
import { transparentize } from '../../services/color';
var _colorCSS = function _colorCSS(color) {
return "\n &:focus {\n background-color: ".concat(transparentize(color, 0.1), ";\n }\n ");
};
export var euiExpressionStyles = function euiExpressionStyles(euiThemeContext) {
var euiTheme = euiThemeContext.euiTheme;
return {
euiExpression: /*#__PURE__*/css(euiTextBreakWord(), " display:inline-block;font-family:", euiTheme.font.familyCode, ";", euiFontSize(euiThemeContext, 's'), " ", logicalTextAlignCSS('left'), " ", logicalShorthandCSS('padding', "".concat(mathWithUnits(euiTheme.size.s, function (x) {
return x / 2;
}), " 0")), " color:", euiTheme.colors.textParagraph, ";&:focus{", logicalCSS('border-bottom-style', 'solid'), ";}&+.euiExpression{", logicalCSS('margin-left', euiTheme.size.s), ";};label:euiExpression;"),
// Variants
columns: /*#__PURE__*/css("display:flex;", logicalCSS('width', '100%'), " ", logicalCSS('margin-bottom', euiTheme.size.xs), " padding:", euiTheme.size.xs, ";", highContrastModeStyles(euiThemeContext, {
// Render the bottom border in high contrast mode for extra visibility
none: "\n border-radius: ".concat(euiTheme.size.xs, ";\n border-color: transparent;\n ")
}), ";;label:columns;"),
truncate: /*#__PURE__*/css(logicalCSS('max-width', '100%'), ";;label:truncate;"),
// States
isClickable: /*#__PURE__*/css("cursor:pointer;", logicalCSS('border-bottom', euiTheme.border.editable), " &[class*='-columns']{background-color:", euiTheme.colors.lightestShade, ";&:focus,&:hover:not(:disabled){[class*='euiExpression__description'],[class*='euiExpression__value']{text-decoration:underline;}}};label:isClickable;"),
isActive: {
base: /*#__PURE__*/css(logicalCSS('border-bottom-style', 'solid'), ";;label:base;"),
subdued: /*#__PURE__*/css("border-color:", euiTheme.colors.textSubdued, ";;label:subdued;"),
primary: /*#__PURE__*/css("border-color:", euiTheme.colors.primary, ";;label:primary;"),
success: /*#__PURE__*/css("border-color:", euiTheme.colors.success, ";;label:success;"),
warning: /*#__PURE__*/css("border-color:", euiTheme.colors.warning, ";;label:warning;"),
danger: /*#__PURE__*/css("border-color:", euiTheme.colors.danger, ";;label:danger;"),
accent: /*#__PURE__*/css("border-color:", euiTheme.colors.accent, ";;label:accent;")
},
subdued: /*#__PURE__*/css(_colorCSS(euiTheme.colors.textSubdued), ";label:subdued;"),
primary: /*#__PURE__*/css(_colorCSS(euiTheme.colors.textPrimary), ";label:primary;"),
success: /*#__PURE__*/css(_colorCSS(euiTheme.colors.textSuccess), ";label:success;"),
warning: /*#__PURE__*/css(_colorCSS(euiTheme.colors.textWarning), ";label:warning;"),
danger: /*#__PURE__*/css(_colorCSS(euiTheme.colors.textDanger), ";label:danger;"),
accent: /*#__PURE__*/css(_colorCSS(euiTheme.colors.textAccent), ";label:accent;")
};
};
var _ref = process.env.NODE_ENV === "production" ? {
name: "shrg0y-isUppercase",
styles: "text-transform:uppercase;label:isUppercase;"
} : {
name: "shrg0y-isUppercase",
styles: "text-transform:uppercase;label:isUppercase;",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};
export var euiExpressionDescriptionStyles = function euiExpressionDescriptionStyles(_ref2) {
var euiTheme = _ref2.euiTheme;
return {
euiExpression__description: /*#__PURE__*/css(";label:euiExpression__description;"),
truncate: /*#__PURE__*/css(euiTextTruncate(), " display:inline-block;vertical-align:bottom;;label:truncate;"),
subdued: /*#__PURE__*/css("color:", euiTheme.colors.textSubdued, ";;label:subdued;"),
primary: /*#__PURE__*/css("color:", euiTheme.colors.textPrimary, ";;label:primary;"),
success: /*#__PURE__*/css("color:", euiTheme.colors.textSuccess, ";;label:success;"),
warning: /*#__PURE__*/css("color:", euiTheme.colors.textWarning, ";;label:warning;"),
danger: /*#__PURE__*/css("color:", euiTheme.colors.textDanger, ";;label:danger;"),
accent: /*#__PURE__*/css("color:", euiTheme.colors.textAccent, ";;label:accent;"),
isUppercase: _ref,
columns: /*#__PURE__*/css(logicalTextAlignCSS('right'), " ", logicalCSS('margin-right', euiTheme.size.s), " flex-shrink:0;;label:columns;")
};
};
export var euiExpressionValueStyles = {
euiExpression__value: /*#__PURE__*/css(";label:euiExpression__value;"),
truncate: /*#__PURE__*/css(euiTextTruncate(), " display:inline-block;vertical-align:bottom;;label:truncate;"),
columns: process.env.NODE_ENV === "production" ? {
name: "29cdh2-columns",
styles: "flex-grow:1;label:columns;"
} : {
name: "29cdh2-columns",
styles: "flex-grow:1;label:columns;",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
}
};
export var euiExpressionIconStyles = function euiExpressionIconStyles(_ref3) {
var euiTheme = _ref3.euiTheme;
return {
euiExpression__icon: /*#__PURE__*/css(logicalCSS('margin-left', euiTheme.size.xs), ";;label:euiExpression__icon;"),
columns: /*#__PURE__*/css(logicalCSS('margin-top', euiTheme.size.xs), ";;label:columns;")
};
};