1 | "use strict";
|
2 |
|
3 | var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
4 |
|
5 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
6 |
|
7 | Object.defineProperty(exports, "__esModule", {
|
8 | value: true
|
9 | });
|
10 | exports.default = exports.styles = void 0;
|
11 |
|
12 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13 |
|
14 | var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
15 |
|
16 | var React = _interopRequireWildcard(require("react"));
|
17 |
|
18 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
19 |
|
20 | var _clsx = _interopRequireDefault(require("clsx"));
|
21 |
|
22 | var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
23 |
|
24 | var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
25 |
|
26 | var styles = function styles(theme) {
|
27 | return {
|
28 |
|
29 | root: {
|
30 | userSelect: 'none',
|
31 | fontSize: theme.typography.pxToRem(24),
|
32 | width: '1em',
|
33 | height: '1em',
|
34 |
|
35 |
|
36 | overflow: 'hidden',
|
37 | flexShrink: 0
|
38 | },
|
39 |
|
40 |
|
41 | colorPrimary: {
|
42 | color: theme.palette.primary.main
|
43 | },
|
44 |
|
45 |
|
46 | colorSecondary: {
|
47 | color: theme.palette.secondary.main
|
48 | },
|
49 |
|
50 |
|
51 | colorAction: {
|
52 | color: theme.palette.action.active
|
53 | },
|
54 |
|
55 |
|
56 | colorError: {
|
57 | color: theme.palette.error.main
|
58 | },
|
59 |
|
60 |
|
61 | colorDisabled: {
|
62 | color: theme.palette.action.disabled
|
63 | },
|
64 |
|
65 |
|
66 | fontSizeInherit: {
|
67 | fontSize: 'inherit'
|
68 | },
|
69 |
|
70 |
|
71 | fontSizeSmall: {
|
72 | fontSize: theme.typography.pxToRem(20)
|
73 | },
|
74 |
|
75 |
|
76 | fontSizeLarge: {
|
77 | fontSize: theme.typography.pxToRem(36)
|
78 | }
|
79 | };
|
80 | };
|
81 |
|
82 | exports.styles = styles;
|
83 | var Icon = React.forwardRef(function Icon(props, ref) {
|
84 | var classes = props.classes,
|
85 | className = props.className,
|
86 | _props$color = props.color,
|
87 | color = _props$color === void 0 ? 'inherit' : _props$color,
|
88 | _props$component = props.component,
|
89 | Component = _props$component === void 0 ? 'span' : _props$component,
|
90 | _props$fontSize = props.fontSize,
|
91 | fontSize = _props$fontSize === void 0 ? 'default' : _props$fontSize,
|
92 | other = (0, _objectWithoutProperties2.default)(props, ["classes", "className", "color", "component", "fontSize"]);
|
93 | return React.createElement(Component, (0, _extends2.default)({
|
94 | className: (0, _clsx.default)('material-icons', classes.root, className, color !== 'inherit' && classes["color".concat((0, _capitalize.default)(color))], fontSize !== 'default' && classes["fontSize".concat((0, _capitalize.default)(fontSize))]),
|
95 | "aria-hidden": true,
|
96 | ref: ref
|
97 | }, other));
|
98 | });
|
99 | process.env.NODE_ENV !== "production" ? Icon.propTypes = {
|
100 | |
101 |
|
102 |
|
103 | children: _propTypes.default.node,
|
104 |
|
105 | |
106 |
|
107 |
|
108 |
|
109 | classes: _propTypes.default.object.isRequired,
|
110 |
|
111 | |
112 |
|
113 |
|
114 | className: _propTypes.default.string,
|
115 |
|
116 | |
117 |
|
118 |
|
119 | color: _propTypes.default.oneOf(['inherit', 'primary', 'secondary', 'action', 'error', 'disabled']),
|
120 |
|
121 | |
122 |
|
123 |
|
124 |
|
125 | component: _propTypes.default
|
126 |
|
127 | .elementType,
|
128 |
|
129 | |
130 |
|
131 |
|
132 | fontSize: _propTypes.default.oneOf(['inherit', 'default', 'small', 'large'])
|
133 | } : void 0;
|
134 | Icon.muiName = 'Icon';
|
135 |
|
136 | var _default = (0, _withStyles.default)(styles, {
|
137 | name: 'MuiIcon'
|
138 | })(Icon);
|
139 |
|
140 | exports.default = _default; |
\ | No newline at end of file |