@elastic/eui
Version:
Elastic UI Component Library
86 lines (85 loc) • 4.67 kB
JavaScript
var _templateObject;
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
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, keyframes } from '@emotion/react';
import { euiCanAnimate, euiShadow } from '@elastic/eui-theme-common';
import { logicalCSS, euiFontSize } from '../../global_styling';
import { _popoverArrowStyles } from '../../services/popover';
import { euiPanelBorderStyles } from '../panel/panel.styles';
export var euiToolTipBackgroundColor = function euiToolTipBackgroundColor(euiTheme) {
return euiTheme.components.tooltipBackground;
};
export var euiToolTipBorderColor = function euiToolTipBorderColor(euiTheme) {
return euiTheme.components.tooltipBorder;
};
var euiToolTipAnimation = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from { opacity: 0; }\n to { opacity: 1; }\n"])));
export var euiToolTipStyles = function euiToolTipStyles(euiThemeContext) {
var euiTheme = euiThemeContext.euiTheme,
highContrastMode = euiThemeContext.highContrastMode;
var hasShadow = !highContrastMode;
var arrowSize = euiTheme.size.m;
var arrowStyles = _popoverArrowStyles(euiThemeContext, arrowSize);
return {
// Base
euiToolTip: /*#__PURE__*/css(hasShadow ? euiShadow(euiThemeContext) : '', " border-radius:", euiTheme.border.radius.medium, ";background-color:", euiToolTipBackgroundColor(euiTheme), ";color:", euiTheme.colors.textGhost, ";z-index:", euiTheme.levels.toast, ";", logicalCSS('max-width', '256px'), " overflow-wrap:break-word;padding:", euiTheme.size.s, ";", euiFontSize(euiThemeContext, 'xs'), " position:absolute;pointer-events:none;", euiPanelBorderStyles(euiThemeContext), " [class*='euiHorizontalRule']{background-color:", euiToolTipBorderColor(euiTheme), ";}", euiCanAnimate, "{animation:", euiToolTipAnimation, " ", euiTheme.animation.extraFast, " ease-out ", euiTheme.animation.fast, " both;};label:euiToolTip;"),
// Positions - kept for component compatibility. Animation is in the base style.
top: /*#__PURE__*/css(";label:top;"),
bottom: /*#__PURE__*/css(";label:bottom;"),
left: /*#__PURE__*/css(";label:left;"),
right: /*#__PURE__*/css(";label:right;"),
// Arrow
euiToolTip__arrow: /*#__PURE__*/css(arrowStyles._arrowStyles, " background-color:inherit;;label:euiToolTip__arrow;"),
arrowPositions: arrowStyles.positions,
// Title
euiToolTip__title: /*#__PURE__*/css("font-weight:", euiTheme.font.weight.bold, ";", logicalCSS('border-bottom', "solid ".concat(euiTheme.border.width.thin, " ").concat(euiToolTipBorderColor(euiTheme))), " ", logicalCSS('padding-bottom', euiTheme.size.xs), " ", logicalCSS('margin-bottom', euiTheme.size.xs), ";;label:euiToolTip__title;")
};
};
var _ref = process.env.NODE_ENV === "production" ? {
name: "1cjglks-flex",
styles: "display:flex;label:flex;"
} : {
name: "1cjglks-flex",
styles: "display:flex;label:flex;",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};
var _ref2 = process.env.NODE_ENV === "production" ? {
name: "fzilnk-inlineBlock",
styles: "display:inline-block;label:inlineBlock;"
} : {
name: "fzilnk-inlineBlock",
styles: "display:inline-block;label:inlineBlock;",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};
var _ref3 = process.env.NODE_ENV === "production" ? {
name: "14aceuy-block",
styles: "display:block;label:block;"
} : {
name: "14aceuy-block",
styles: "display:block;label:block;",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};
var _ref4 = process.env.NODE_ENV === "production" ? {
name: "1s3i3p5-euiToolTipAnchor",
styles: "*[disabled]{pointer-events:none;};label:euiToolTipAnchor;"
} : {
name: "1s3i3p5-euiToolTipAnchor",
styles: "*[disabled]{pointer-events:none;};label:euiToolTipAnchor;",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};
export var euiToolTipAnchorStyles = function euiToolTipAnchorStyles() {
return {
// Elements
euiToolTipAnchor: _ref4,
// Variants
block: _ref3,
inlineBlock: _ref2,
flex: _ref
};
};