1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 |
|
5 | Object.defineProperty(exports, "__esModule", {
|
6 | value: true
|
7 | });
|
8 | exports.default = exports.styles = void 0;
|
9 |
|
10 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11 |
|
12 | var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
13 |
|
14 | var _react = _interopRequireDefault(require("react"));
|
15 |
|
16 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
17 |
|
18 | var _clsx = _interopRequireDefault(require("clsx"));
|
19 |
|
20 | var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
21 |
|
22 | var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
23 |
|
24 | var styles = function styles(theme) {
|
25 | return {
|
26 |
|
27 | root: {
|
28 | userSelect: 'none',
|
29 | width: '1em',
|
30 | height: '1em',
|
31 | display: 'inline-block',
|
32 | fill: 'currentColor',
|
33 | flexShrink: 0,
|
34 | fontSize: theme.typography.pxToRem(24),
|
35 | transition: theme.transitions.create('fill', {
|
36 | duration: theme.transitions.duration.shorter
|
37 | })
|
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(35)
|
78 | }
|
79 | };
|
80 | };
|
81 |
|
82 | exports.styles = styles;
|
83 |
|
84 | var SvgIcon = _react.default.forwardRef(function SvgIcon(props, ref) {
|
85 | var children = props.children,
|
86 | classes = props.classes,
|
87 | className = props.className,
|
88 | _props$color = props.color,
|
89 | color = _props$color === void 0 ? 'inherit' : _props$color,
|
90 | _props$component = props.component,
|
91 | Component = _props$component === void 0 ? 'svg' : _props$component,
|
92 | _props$fontSize = props.fontSize,
|
93 | fontSize = _props$fontSize === void 0 ? 'default' : _props$fontSize,
|
94 | htmlColor = props.htmlColor,
|
95 | titleAccess = props.titleAccess,
|
96 | _props$viewBox = props.viewBox,
|
97 | viewBox = _props$viewBox === void 0 ? '0 0 24 24' : _props$viewBox,
|
98 | other = (0, _objectWithoutProperties2.default)(props, ["children", "classes", "className", "color", "component", "fontSize", "htmlColor", "titleAccess", "viewBox"]);
|
99 | return _react.default.createElement(Component, (0, _extends2.default)({
|
100 | className: (0, _clsx.default)(classes.root, className, color !== 'inherit' && classes["color".concat((0, _capitalize.default)(color))], fontSize !== 'default' && classes["fontSize".concat((0, _capitalize.default)(fontSize))]),
|
101 | focusable: "false",
|
102 | viewBox: viewBox,
|
103 | color: htmlColor,
|
104 | "aria-hidden": titleAccess ? 'false' : 'true',
|
105 | role: titleAccess ? 'img' : 'presentation',
|
106 | ref: ref
|
107 | }, other), children, titleAccess ? _react.default.createElement("title", null, titleAccess) : null);
|
108 | });
|
109 |
|
110 | process.env.NODE_ENV !== "production" ? SvgIcon.propTypes = {
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 | |
117 |
|
118 |
|
119 | children: _propTypes.default.node,
|
120 |
|
121 | |
122 |
|
123 |
|
124 |
|
125 | classes: _propTypes.default.object,
|
126 |
|
127 | |
128 |
|
129 |
|
130 | className: _propTypes.default.string,
|
131 |
|
132 | |
133 |
|
134 |
|
135 |
|
136 | color: _propTypes.default.oneOf(['action', 'disabled', 'error', 'inherit', 'primary', 'secondary']),
|
137 |
|
138 | |
139 |
|
140 |
|
141 |
|
142 | component: _propTypes.default.elementType,
|
143 |
|
144 | |
145 |
|
146 |
|
147 | fontSize: _propTypes.default.oneOf(['default', 'inherit', 'large', 'small']),
|
148 |
|
149 | |
150 |
|
151 |
|
152 | htmlColor: _propTypes.default.string,
|
153 |
|
154 | |
155 |
|
156 |
|
157 |
|
158 |
|
159 | shapeRendering: _propTypes.default.string,
|
160 |
|
161 | |
162 |
|
163 |
|
164 |
|
165 | titleAccess: _propTypes.default.string,
|
166 |
|
167 | |
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 | viewBox: _propTypes.default.string
|
175 | } : void 0;
|
176 | SvgIcon.muiName = 'SvgIcon';
|
177 |
|
178 | var _default = (0, _withStyles.default)(styles, {
|
179 | name: 'MuiSvgIcon'
|
180 | })(SvgIcon);
|
181 |
|
182 | exports.default = _default; |
\ | No newline at end of file |