UNPKG

@momentum-ui/react-collaboration

Version:

Cisco Momentum UI Framework for React Collaboration Applications

73 lines 3.3 kB
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; }; import React from 'react'; import PropTypes from 'prop-types'; import { Icon } from '@momentum-ui/react-collaboration'; /** * @deprecated - Components in the legacy folder (/src/legacy) are deprecated. Please use a component from the components folder (/src/components) instead. Legacy components may not follow accessibility standards. **/ var IconContent = function (props) { var actionNode = props.actionNode, className = props.className, icon = props.icon, isProtected = props.isProtected, loading = props.loading, onClick = props.onClick, subtitle = props.subtitle, title = props.title, otherProps = __rest(props, ["actionNode", "className", "icon", "isProtected", "loading", "onClick", "subtitle", "title"]); var handleKeyDown = function (e) { if (e.which === 32 || e.which === 13 || e.charCode === 32 || e.charCode === 13) { onClick && onClick(e); e.preventDefault(); } }; return (React.createElement("div", null, React.createElement("div", __assign({ className: 'md-content-file' + "".concat((onClick && ' md-content-file--clickable') || '') + "".concat((className && " ".concat(className)) || ''), onClick: onClick, onKeyDown: handleKeyDown, role: "presentation" }, otherProps), !isProtected && actionNode && React.createElement("div", { className: "md-content-file__icon" }, actionNode), React.createElement("span", null, React.createElement(Icon, { name: icon }))), React.createElement("div", { className: "md-content-file__info-container" }, React.createElement("span", { className: "md-content-file__title" }, loading ? 'Loading' : title), React.createElement("span", { className: "md-content-file__subtitle" }, " ", subtitle, " ")))); }; IconContent.defaultProps = { actionNode: null, className: '', icon: '', isProtected: null, loading: false, onClick: null, subtitle: '', title: '', }; IconContent.propTypes = { actionNode: PropTypes.node, className: PropTypes.string, icon: PropTypes.string, isProtected: PropTypes.bool, loading: PropTypes.bool, onClick: PropTypes.func, subtitle: PropTypes.node, title: PropTypes.string, }; IconContent.displayName = 'IconContent'; export default IconContent; //# sourceMappingURL=index.js.map