158 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			158 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
'use strict';
 | 
						|
 | 
						|
Object.defineProperty(exports, "__esModule", {
 | 
						|
  value: true
 | 
						|
});
 | 
						|
exports.styles = undefined;
 | 
						|
 | 
						|
var _extends2 = require('babel-runtime/helpers/extends');
 | 
						|
 | 
						|
var _extends3 = _interopRequireDefault(_extends2);
 | 
						|
 | 
						|
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
 | 
						|
 | 
						|
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
 | 
						|
 | 
						|
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
 | 
						|
 | 
						|
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
 | 
						|
 | 
						|
var _react = require('react');
 | 
						|
 | 
						|
var _react2 = _interopRequireDefault(_react);
 | 
						|
 | 
						|
var _propTypes = require('prop-types');
 | 
						|
 | 
						|
var _propTypes2 = _interopRequireDefault(_propTypes);
 | 
						|
 | 
						|
var _classnames = require('classnames');
 | 
						|
 | 
						|
var _classnames2 = _interopRequireDefault(_classnames);
 | 
						|
 | 
						|
var _withStyles = require('../styles/withStyles');
 | 
						|
 | 
						|
var _withStyles2 = _interopRequireDefault(_withStyles);
 | 
						|
 | 
						|
var _helpers = require('../utils/helpers');
 | 
						|
 | 
						|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 | 
						|
 | 
						|
var styles = exports.styles = function styles(theme) {
 | 
						|
  return {
 | 
						|
    root: {
 | 
						|
      display: 'inline-block',
 | 
						|
      fill: 'currentColor',
 | 
						|
      height: 24,
 | 
						|
      width: 24,
 | 
						|
      userSelect: 'none',
 | 
						|
      flexShrink: 0,
 | 
						|
      transition: theme.transitions.create('fill', {
 | 
						|
        duration: theme.transitions.duration.shorter
 | 
						|
      })
 | 
						|
    },
 | 
						|
    colorPrimary: {
 | 
						|
      color: theme.palette.primary.main
 | 
						|
    },
 | 
						|
    colorSecondary: {
 | 
						|
      color: theme.palette.secondary.main
 | 
						|
    },
 | 
						|
    colorAction: {
 | 
						|
      color: theme.palette.action.active
 | 
						|
    },
 | 
						|
    colorDisabled: {
 | 
						|
      color: theme.palette.action.disabled
 | 
						|
    },
 | 
						|
    colorError: {
 | 
						|
      color: theme.palette.error.main
 | 
						|
    },
 | 
						|
    fontSize: {
 | 
						|
      width: '1em',
 | 
						|
      height: '1em'
 | 
						|
    }
 | 
						|
  };
 | 
						|
};
 | 
						|
 | 
						|
function SvgIcon(props) {
 | 
						|
  var _classNames;
 | 
						|
 | 
						|
  var children = props.children,
 | 
						|
      classes = props.classes,
 | 
						|
      classNameProp = props.className,
 | 
						|
      color = props.color,
 | 
						|
      fontSize = props.fontSize,
 | 
						|
      nativeColor = props.nativeColor,
 | 
						|
      titleAccess = props.titleAccess,
 | 
						|
      viewBox = props.viewBox,
 | 
						|
      other = (0, _objectWithoutProperties3.default)(props, ['children', 'classes', 'className', 'color', 'fontSize', 'nativeColor', 'titleAccess', 'viewBox']);
 | 
						|
 | 
						|
 | 
						|
  var className = (0, _classnames2.default)(classes.root, (_classNames = {}, (0, _defineProperty3.default)(_classNames, classes['color' + (0, _helpers.capitalize)(color)], color !== 'inherit'), (0, _defineProperty3.default)(_classNames, classes.fontSize, fontSize), _classNames), classNameProp);
 | 
						|
 | 
						|
  return _react2.default.createElement(
 | 
						|
    'svg',
 | 
						|
    (0, _extends3.default)({
 | 
						|
      className: className,
 | 
						|
      focusable: 'false',
 | 
						|
      viewBox: viewBox,
 | 
						|
      color: nativeColor,
 | 
						|
      'aria-hidden': titleAccess ? 'false' : 'true'
 | 
						|
    }, other),
 | 
						|
    titleAccess ? _react2.default.createElement(
 | 
						|
      'title',
 | 
						|
      null,
 | 
						|
      titleAccess
 | 
						|
    ) : null,
 | 
						|
    children
 | 
						|
  );
 | 
						|
}
 | 
						|
 | 
						|
SvgIcon.propTypes = process.env.NODE_ENV !== "production" ? {
 | 
						|
  /**
 | 
						|
   * Node passed into the SVG element.
 | 
						|
   */
 | 
						|
  children: _propTypes2.default.node.isRequired,
 | 
						|
  /**
 | 
						|
   * Useful to extend the style applied to components.
 | 
						|
   */
 | 
						|
  classes: _propTypes2.default.object.isRequired,
 | 
						|
  /**
 | 
						|
   * @ignore
 | 
						|
   */
 | 
						|
  className: _propTypes2.default.string,
 | 
						|
  /**
 | 
						|
   * The color of the component. It supports those theme colors that make sense for this component.
 | 
						|
   * You can use the `nativeColor` property to apply a color attribute to the SVG element.
 | 
						|
   */
 | 
						|
  color: _propTypes2.default.oneOf(['action', 'disabled', 'error', 'inherit', 'primary', 'secondary']),
 | 
						|
  /**
 | 
						|
   * If `true`, the icon size will be determined by the font-size.
 | 
						|
   */
 | 
						|
  fontSize: _propTypes2.default.bool,
 | 
						|
  /**
 | 
						|
   * Applies a color attribute to the SVG element.
 | 
						|
   */
 | 
						|
  nativeColor: _propTypes2.default.string,
 | 
						|
  /**
 | 
						|
   * Provides a human-readable title for the element that contains it.
 | 
						|
   * https://www.w3.org/TR/SVG-access/#Equivalent
 | 
						|
   */
 | 
						|
  titleAccess: _propTypes2.default.string,
 | 
						|
  /**
 | 
						|
   * Allows you to redefine what the coordinates without units mean inside an SVG element.
 | 
						|
   * For example, if the SVG element is 500 (width) by 200 (height),
 | 
						|
   * and you pass viewBox="0 0 50 20",
 | 
						|
   * this means that the coordinates inside the SVG will go from the top left corner (0,0)
 | 
						|
   * to bottom right (50,20) and each unit will be worth 10px.
 | 
						|
   */
 | 
						|
  viewBox: _propTypes2.default.string
 | 
						|
} : {};
 | 
						|
 | 
						|
SvgIcon.defaultProps = {
 | 
						|
  color: 'inherit',
 | 
						|
  fontSize: false,
 | 
						|
  viewBox: '0 0 24 24'
 | 
						|
};
 | 
						|
 | 
						|
SvgIcon.muiName = 'SvgIcon';
 | 
						|
 | 
						|
exports.default = (0, _withStyles2.default)(styles, { name: 'MuiSvgIcon' })(SvgIcon); |