UNPKG

@elastic/eui

Version:

Elastic UI Component Library

46 lines (45 loc) 1.98 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.appendIconComponentCache = exports.NOTIFICATION_ICONS_MAP = exports.EuiNotificationIcon = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); var _react = _interopRequireDefault(require("react")); var _react2 = require("@emotion/react"); var _excluded = ["type", "aria-label"]; /* * 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. */ var TYPES = ['info', 'success', 'warning', 'error']; var NOTIFICATION_ICONS_MAP = exports.NOTIFICATION_ICONS_MAP = { info: { name: 'infoFill' }, success: { name: 'checkCircleFill' }, warning: { name: 'warningStatic' }, error: { name: 'errorFill' } }; var EuiNotificationIcon = exports.EuiNotificationIcon = function EuiNotificationIcon(_ref) { var type = _ref.type, ariaLabel = _ref['aria-label'], rest = (0, _objectWithoutProperties2.default)(_ref, _excluded); return (0, _react2.jsx)("span", (0, _extends2.default)({ "data-euiicon-type": typeof type === 'string' ? NOTIFICATION_ICONS_MAP[type].name : type.displayName || type.name }, rest), // render aria-label as text, if it's passed in props ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : ''); }; var appendIconComponentCache = exports.appendIconComponentCache = function appendIconComponentCache(_) { // manually appending to the internal EuiIcon cache is out-of-scope of this test environment };