@elastic/eui
Version:
Elastic UI Component Library
62 lines (60 loc) • 4.9 kB
JavaScript
var _templateObject, _templateObject2;
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, euiMaxBreakpoint, euiMinBreakpoint, euiScrollBarStyles, logicalCSS, logicalCSSWithFallback, logicalSizeCSS } from '../../global_styling';
var _ref = process.env.NODE_ENV === "production" ? {
name: "ox3d1t-hasFadeOut",
styles: "opacity:0;label:hasFadeOut;"
} : {
name: "ox3d1t-hasFadeOut",
styles: "opacity:0;label:hasFadeOut;",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};
var _ref2 = process.env.NODE_ENV === "production" ? {
name: "19mjubd-content",
styles: "position:relative;label:content;"
} : {
name: "19mjubd-content",
styles: "position:relative;label:content;",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};
export var euiGlobalToastListStyles = function euiGlobalToastListStyles(euiThemeContext) {
var euiTheme = euiThemeContext.euiTheme;
var euiToastWidth = euiTheme.base * 27.5; // 440px -> results in 360px toast width
var showNotificationBadge = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from { opacity: 0; }\n to { opacity: 1; }\n "])));
return {
/**
* 1. Allow list to expand as items are added, but cap it at the screen height.
* 2. Allow some padding for shadow
*/
// Base
euiGlobalToastList: /*#__PURE__*/css(euiScrollBarStyles(euiThemeContext), " display:flex;flex-direction:column;align-items:stretch;position:fixed;z-index:", euiTheme.levels.toast, ";", logicalCSS('bottom', 0), " ", logicalCSS('width', "".concat(euiToastWidth, "px")), logicalCSS('max-height', '100vh'), logicalCSSWithFallback('overflow-y', 'auto'), "scrollbar-width:none;&::-webkit-scrollbar{", logicalSizeCSS(0, 0), ";}&:hover .euiToastDecor::before,&:focus-within .euiToastDecor::before{animation-play-state:paused;}&:not(:empty){", logicalCSS('padding-left', euiTheme.size.base), " ", logicalCSS('padding-right', euiTheme.size.base), " ", logicalCSS('padding-vertical', euiTheme.size.base), ";}", euiMaxBreakpoint(euiThemeContext, 'm'), "{&:not(:empty){", logicalCSS('left', 0), " ", logicalCSS('width', '100%'), ";}};label:euiGlobalToastList;"),
content: _ref2,
notificationBadge: {
notificationBadge: /*#__PURE__*/css("position:absolute;inset-block-start:-", euiTheme.size.s, ";inset-inline-start:-", euiTheme.size.s, ";z-index:", Number(euiTheme.levels.content) + 1, ";", euiCanAnimate, "{animation:", euiTheme.animation.normal, " ", showNotificationBadge, " ", euiTheme.animation.resistance, ";transition:opacity ", euiTheme.animation.fast, ";};label:notificationBadge;"),
hasFadeOut: _ref
},
// Variants
right: /*#__PURE__*/css("&:not(:empty){", logicalCSS('right', 0), ";", euiMinBreakpoint(euiThemeContext, 'm'), "{", logicalCSS('padding-left', "".concat(euiTheme.base * 4, "px")), ";}};label:right;"),
left: /*#__PURE__*/css("&:not(:empty){", logicalCSS('left', 0), ";", euiMinBreakpoint(euiThemeContext, 'm'), "{", logicalCSS('padding-right', "".concat(euiTheme.base * 4, "px")), ";}};label:left;"),
euiGlobalToastListDismissButton: /*#__PURE__*/css("position:sticky;", logicalCSS('bottom', '0%'), ";;label:euiGlobalToastListDismissButton;")
};
};
export var euiGlobalToastListItemStyles = function euiGlobalToastListItemStyles(_ref3) {
var euiTheme = _ref3.euiTheme;
var euiShowToast = keyframes(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n from {\n transform: translateY(", ") scale(.9);\n opacity: 0;\n }\n\n to {\n transform: translateY(0) scale(1);\n opacity: 1;\n }\n"])), euiTheme.size.l);
return {
// Base
euiGlobalToastListItem: /*#__PURE__*/css("flex-shrink:0;", logicalCSS('margin-bottom', euiTheme.size.base), " animation:", euiTheme.animation.normal, " ", euiShowToast, " ", euiTheme.animation.resistance, ";opacity:1;&:first-child{", logicalCSS('margin-top', 'auto'), ";}&:last-child{", logicalCSS('margin-bottom', 0), ";};label:euiGlobalToastListItem;"),
// States
dismissed: /*#__PURE__*/css("transition:opacity ", euiTheme.animation.normal, ";opacity:0;;label:dismissed;")
};
};