UNPKG

@elastic/eui

Version:

Elastic UI Component Library

77 lines (76 loc) 2.56 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["className", "type", "size", "css"]; /* * 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 React from 'react'; import classNames from 'classnames'; import { useEuiMemoizedStyles } from '../../services'; import { EuiIcon } from '../icon/icon'; import { icon as EuiIconErrorFill } from '../icon/assets/error_fill'; import { icon as EuiIconCheckCircleFill } from '../icon/assets/check_circle_fill'; import { icon as EuiIconInfoFill } from './assets/info_fill'; import { icon as EuiIconWarningStatic } from './assets/warning_static'; import { euiNotificationIconStyles } from './notification_icon.styles'; import { jsx as ___EmotionJSX } from "@emotion/react"; var TYPES = ['info', 'success', 'warning', 'error']; export var NOTIFICATION_ICONS_MAP = { info: { name: 'infoFill', icon: EuiIconInfoFill }, success: { name: 'checkCircleFill', icon: EuiIconCheckCircleFill }, warning: { name: 'warningStatic', icon: EuiIconWarningStatic }, error: { name: 'errorFill', icon: EuiIconErrorFill } }; var ICON_TYPES_MAP = { info: { icon: NOTIFICATION_ICONS_MAP.info.icon, color: 'primary' }, success: { icon: NOTIFICATION_ICONS_MAP.success.icon, color: 'success' }, warning: { icon: NOTIFICATION_ICONS_MAP.warning.icon }, error: { icon: NOTIFICATION_ICONS_MAP.error.icon, color: 'danger' } }; export var EuiNotificationIcon = function EuiNotificationIcon(_ref) { var className = _ref.className, type = _ref.type, _ref$size = _ref.size, size = _ref$size === void 0 ? 'm' : _ref$size, css = _ref.css, rest = _objectWithoutProperties(_ref, _excluded); var Icon = ICON_TYPES_MAP[type]; var classes = classNames('euiNotificationIcon', className); var styles = useEuiMemoizedStyles(euiNotificationIconStyles); var cssStyles = [styles.euiNotificationIcon, size === 'l' && styles.size[size], css]; return ___EmotionJSX(EuiIcon, _extends({}, rest, { className: classes, css: cssStyles, type: Icon.icon, color: Icon.color, "aria-hidden": "true", size: size })); };