131 lines
3.9 KiB
JavaScript
131 lines
3.9 KiB
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = exports.styles = void 0;
|
|
|
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
|
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
|
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
|
|
var _react = _interopRequireDefault(require("react"));
|
|
|
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
|
var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
|
|
|
var _helpers = require("../utils/helpers");
|
|
|
|
var styles = function styles(theme) {
|
|
return {
|
|
root: {
|
|
userSelect: 'none',
|
|
fontSize: 24,
|
|
width: '1em',
|
|
height: '1em',
|
|
display: 'inline-block',
|
|
fill: 'currentColor',
|
|
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
|
|
},
|
|
colorError: {
|
|
color: theme.palette.error.main
|
|
},
|
|
colorDisabled: {
|
|
color: theme.palette.action.disabled
|
|
}
|
|
};
|
|
};
|
|
|
|
exports.styles = styles;
|
|
|
|
function SvgIcon(props) {
|
|
var children = props.children,
|
|
classes = props.classes,
|
|
classNameProp = props.className,
|
|
color = props.color,
|
|
nativeColor = props.nativeColor,
|
|
titleAccess = props.titleAccess,
|
|
viewBox = props.viewBox,
|
|
other = (0, _objectWithoutProperties2.default)(props, ["children", "classes", "className", "color", "nativeColor", "titleAccess", "viewBox"]);
|
|
var className = (0, _classnames.default)(classes.root, (0, _defineProperty2.default)({}, classes["color".concat((0, _helpers.capitalize)(color))], color !== 'inherit'), classNameProp);
|
|
return _react.default.createElement("svg", (0, _extends2.default)({
|
|
className: className,
|
|
focusable: "false",
|
|
viewBox: viewBox,
|
|
color: nativeColor,
|
|
"aria-hidden": titleAccess ? 'false' : 'true'
|
|
}, other), titleAccess ? _react.default.createElement("title", null, titleAccess) : null, children);
|
|
}
|
|
|
|
SvgIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
/**
|
|
* Node passed into the SVG element.
|
|
*/
|
|
children: _propTypes.default.node.isRequired,
|
|
|
|
/**
|
|
* Useful to extend the style applied to components.
|
|
*/
|
|
classes: _propTypes.default.object.isRequired,
|
|
|
|
/**
|
|
* @ignore
|
|
*/
|
|
className: _propTypes.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: _propTypes.default.oneOf(['inherit', 'primary', 'secondary', 'action', 'error', 'disabled']),
|
|
|
|
/**
|
|
* Applies a color attribute to the SVG element.
|
|
*/
|
|
nativeColor: _propTypes.default.string,
|
|
|
|
/**
|
|
* Provides a human-readable title for the element that contains it.
|
|
* https://www.w3.org/TR/SVG-access/#Equivalent
|
|
*/
|
|
titleAccess: _propTypes.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: _propTypes.default.string
|
|
} : {};
|
|
SvgIcon.defaultProps = {
|
|
color: 'inherit',
|
|
viewBox: '0 0 24 24'
|
|
};
|
|
SvgIcon.muiName = 'SvgIcon';
|
|
|
|
var _default = (0, _withStyles.default)(styles, {
|
|
name: 'MuiSvgIcon'
|
|
})(SvgIcon);
|
|
|
|
exports.default = _default; |