UNPKG

lucid-ui

Version:

A UI component library from AppNexus.

62 lines (54 loc) 4.78 kB
import _pick from "lodash/pick"; import _keys from "lodash/keys"; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } import React from 'react'; import PropTypes from 'react-peek/prop-types'; import Icon, { propTypes as iconPropTypes } from '../Icon'; import { lucidClassNames } from '../../../util/style-helpers'; import { omitProps } from '../../../util/component-types'; var cx = lucidClassNames.bind('&-BellIcon'); var oneOf = PropTypes.oneOf, bool = PropTypes.bool; export var BellIcon = function BellIcon(_ref) { var className = _ref.className, _ref$featuredColor = _ref.featuredColor, featuredColor = _ref$featuredColor === void 0 ? 'info' : _ref$featuredColor, _ref$hasDot = _ref.hasDot, hasDot = _ref$hasDot === void 0 ? false : _ref$hasDot, passThroughs = _objectWithoutProperties(_ref, ["className", "featuredColor", "hasDot"]); var showBellDot = hasDot; return /*#__PURE__*/React.createElement(Icon, _extends({}, omitProps(passThroughs, undefined, _keys(BellIcon.propTypes), false), _pick(passThroughs, _keys(iconPropTypes)), { className: cx('&', className) }), showBellDot ? /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", { strokeLinecap: "butt", d: "M5.5 12.502v.5c0 1.381 1.119 2.5 2.5 2.5s2.5-1.119 2.5-2.5l.003-.495M3.056 7.432c-.54 2.214-1.556 3.07-1.556 3.07v2h13v-2s-1.884-1.587-1.884-6.024c0-.901-.909-3.976-4.616-3.976-.279 0-.543.017-.791.05" }), /*#__PURE__*/React.createElement("path", { className: cx('&', { '&-is-info': featuredColor === 'info', '&-is-success': featuredColor === 'success', '&-is-warning': featuredColor === 'warning', '&-is-danger': featuredColor === 'danger' }, className), d: "M3.5-.148c1.737 0 3.15 1.413 3.15 3.15s-1.413 3.15-3.15 3.15S.35 4.739.35 3.002 1.763-.148 3.5-.148" })) : /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", { d: "M5.5 12.5v.5a2.5 2.5 0 1 0 5 0l.003-.495M14.5 12.5v-2s-1.884-1.587-1.884-6.024C12.616 3.575 11.707.5 8 .5S3.384 3.575 3.384 4.476C3.384 8.913 1.5 10.5 1.5 10.5v2h13z" }))); }; BellIcon.displayName = 'BellIcon'; BellIcon.peek = { description: "\n\t\tTypically used for notifications. The dot indicates that there is an unread message.\n\t", categories: ['visual design', 'icons'], extend: 'Icon', madeFrom: ['Icon'] }; BellIcon.propTypes = _objectSpread(_objectSpread({}, iconPropTypes), {}, { hasDot: bool, featuredColor: oneOf(['info', 'success', 'warning', 'danger']) }); BellIcon.defaultProps = Icon.defaultProps; export default BellIcon;