material-icons-library
Version:
Material Icons Library converted to React components
96 lines (82 loc) • 2.98 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var SvgIcon = _react.default.forwardRef(function (props, ref) {
var children = props.children,
className = props.className,
color = props.color,
fontSize = props.fontSize,
Component = props.component,
titleAccess = props.titleAccess,
viewBox = props.viewBox,
other = (0, _objectWithoutProperties2.default)(props, ["children", "className", "color", "fontSize", "component", "titleAccess", "viewBox"]);
return _react.default.createElement(Component, (0, _extends2.default)({
"aria-hidden": titleAccess ? 'false' : 'true',
className: className,
color: color,
focusable: "false",
ref: ref,
role: titleAccess ? 'img' : 'presentation',
style: {
userSelect: 'none',
width: '1em',
height: '1em',
display: 'inline-block',
fill: 'currentColor',
flexShrink: 0,
fontSize: fontSize
},
viewBox: viewBox
}, other), children, titleAccess ? _react.default.createElement("title", null, titleAccess) : null);
});
process.env.NODE_ENV !== "production" ? SvgIcon.propTypes = {
/**
* Node passed into the SVG element.
*/
children: _propTypes.default.node.isRequired,
/**
* @ignore
*/
className: _propTypes.default.string,
/**
* Apply a color attribute to the SVG element.
*/
color: _propTypes.default.string,
/**
* The component used for the root node.
* Either a string to use a DOM element or a component.
*/
component: _propTypes.default.elementType,
/**
* The fontSize applied to the icon. Defaults to 24px, but can be configure to inherit font size.
*/
fontSize: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
/**
* 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
} : void 0;
SvgIcon.defaultProps = {
color: 'inherit',
component: 'svg',
fontSize: 24,
viewBox: '0 0 24 24'
};
var _default = SvgIcon;
exports.default = _default;