UNPKG

lucid-ui

Version:

A UI component library from Xandr.

110 lines 5.92 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BellIcon = exports.iconPropTypes = void 0; var lodash_1 = __importDefault(require("lodash")); var react_1 = __importDefault(require("react")); var prop_types_1 = __importDefault(require("prop-types")); var Icon_1 = __importDefault(require("../Icon")); var style_helpers_1 = require("../../../util/style-helpers"); var cx = style_helpers_1.lucidClassNames.bind('&-BellIcon'); exports.iconPropTypes = { /** Size variations of the icons. \`size\` directly effects height and width but the developer should also be conscious of the relationship with \`viewBox\`. */ size: prop_types_1.default.number, /** Size handles width and height, whereas \`width\` can manually override the width that would be set by size. */ width: prop_types_1.default.oneOfType([prop_types_1.default.number, prop_types_1.default.string]), /** Size handles width and height, whereas \`height\` can manually override the height that would be set by size. */ height: prop_types_1.default.oneOfType([prop_types_1.default.number, prop_types_1.default.string]), /** \`viewBox\` is very important for SVGs. You can think of \`viewBox\` as the "artboard" for our SVG while \`size\` is the presented height and width. */ viewBox: prop_types_1.default.string, /** Sets the color of the Icon. May not be applicable for icons that are tied to specific colors (e.g. DangerIcon). */ color: prop_types_1.default.oneOf([ 'neutral-dark', 'neutral-light', 'neutral-extra-light', 'primary', 'white', 'success', 'warning', 'secondary-one', 'secondary-two', 'secondary-three', 'secondary-five', ]), /** Any valid SVG aspect ratio. */ aspectRatio: prop_types_1.default.string, /** Adds styling that makes the icon appear clickable. */ isClickable: prop_types_1.default.bool, /** Adds styling that makes the icon appear disabled. Also forces isClickable to be false. */ isDisabled: prop_types_1.default.bool, /** Called when the user clicks the \`Icon\`. Signature: \`({event, props}) => {}\` */ onClick: prop_types_1.default.func, /** Called when the user clicks an active, clickable \`Icon\`. Signature: \`({event, props}) => {}\` */ onSelect: prop_types_1.default.func, /** Any valid React children. */ children: prop_types_1.default.element, /** Classes that are appended to the component defaults. This prop is run through the \`classnames\` library. */ className: prop_types_1.default.string, /** Show or hide a dot on the bell to indicate a notification. */ hasDot: prop_types_1.default.bool, /** Featured color of the dot */ featuredColor: prop_types_1.default.oneOf(['info', 'success', 'warning', 'danger']), }; var BellIcon = function (_a) { var className = _a.className, _b = _a.featuredColor, featuredColor = _b === void 0 ? 'info' : _b, _c = _a.hasDot, hasDot = _c === void 0 ? false : _c, passThroughs = __rest(_a, ["className", "featuredColor", "hasDot"]); var showBellDot = hasDot; return (react_1.default.createElement(Icon_1.default, __assign({}, lodash_1.default.omit(passThroughs, ['initialState']), { className: cx('&', className) }), showBellDot ? (react_1.default.createElement("g", null, react_1.default.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' }), react_1.default.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' }))) : (react_1.default.createElement("g", null, react_1.default.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' }))))); }; exports.BellIcon = BellIcon; exports.BellIcon.displayName = 'BellIcon'; exports.BellIcon.peek = { description: "Typically used for notifications. The dot indicates that there is an unread message.", categories: ['visual design', 'icons'], extend: 'Icon', madeFrom: ['Icon'], }; exports.BellIcon.propTypes = exports.iconPropTypes; exports.BellIcon.defaultProps = Icon_1.default.defaultProps; exports.default = exports.BellIcon; //# sourceMappingURL=BellIcon.js.map