1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import withStyles from '../styles/withStyles';
|
7 | import capitalize from '../utils/capitalize';
|
8 | export const styles = theme => ({
|
9 |
|
10 | root: {
|
11 | userSelect: 'none',
|
12 | width: '1em',
|
13 | height: '1em',
|
14 | display: 'inline-block',
|
15 | fill: 'currentColor',
|
16 | flexShrink: 0,
|
17 | fontSize: theme.typography.pxToRem(24),
|
18 | transition: theme.transitions.create('fill', {
|
19 | duration: theme.transitions.duration.shorter
|
20 | })
|
21 | },
|
22 |
|
23 |
|
24 | colorPrimary: {
|
25 | color: theme.palette.primary.main
|
26 | },
|
27 |
|
28 |
|
29 | colorSecondary: {
|
30 | color: theme.palette.secondary.main
|
31 | },
|
32 |
|
33 |
|
34 | colorAction: {
|
35 | color: theme.palette.action.active
|
36 | },
|
37 |
|
38 |
|
39 | colorError: {
|
40 | color: theme.palette.error.main
|
41 | },
|
42 |
|
43 |
|
44 | colorDisabled: {
|
45 | color: theme.palette.action.disabled
|
46 | },
|
47 |
|
48 |
|
49 | fontSizeInherit: {
|
50 | fontSize: 'inherit'
|
51 | },
|
52 |
|
53 |
|
54 | fontSizeSmall: {
|
55 | fontSize: theme.typography.pxToRem(20)
|
56 | },
|
57 |
|
58 |
|
59 | fontSizeLarge: {
|
60 | fontSize: theme.typography.pxToRem(35)
|
61 | }
|
62 | });
|
63 | const SvgIcon = React.forwardRef(function SvgIcon(props, ref) {
|
64 | const {
|
65 | children,
|
66 | classes,
|
67 | className,
|
68 | color = 'inherit',
|
69 | component: Component = 'svg',
|
70 | fontSize = 'default',
|
71 | htmlColor,
|
72 | titleAccess,
|
73 | viewBox = '0 0 24 24'
|
74 | } = props,
|
75 | other = _objectWithoutPropertiesLoose(props, ["children", "classes", "className", "color", "component", "fontSize", "htmlColor", "titleAccess", "viewBox"]);
|
76 |
|
77 | return React.createElement(Component, _extends({
|
78 | className: clsx(classes.root, className, color !== 'inherit' && classes[`color${capitalize(color)}`], fontSize !== 'default' && classes[`fontSize${capitalize(fontSize)}`]),
|
79 | focusable: "false",
|
80 | viewBox: viewBox,
|
81 | color: htmlColor,
|
82 | "aria-hidden": titleAccess ? undefined : true,
|
83 | role: titleAccess ? 'img' : undefined,
|
84 | ref: ref
|
85 | }, other), children, titleAccess ? React.createElement("title", null, titleAccess) : null);
|
86 | });
|
87 | process.env.NODE_ENV !== "production" ? SvgIcon.propTypes = {
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | |
94 |
|
95 |
|
96 | children: PropTypes.node,
|
97 |
|
98 | |
99 |
|
100 |
|
101 |
|
102 | classes: PropTypes.object,
|
103 |
|
104 | |
105 |
|
106 |
|
107 | className: PropTypes.string,
|
108 |
|
109 | |
110 |
|
111 |
|
112 |
|
113 | color: PropTypes.oneOf(['action', 'disabled', 'error', 'inherit', 'primary', 'secondary']),
|
114 |
|
115 | |
116 |
|
117 |
|
118 |
|
119 | component: PropTypes
|
120 |
|
121 | .elementType,
|
122 |
|
123 | |
124 |
|
125 |
|
126 | fontSize: PropTypes.oneOf(['default', 'inherit', 'large', 'small']),
|
127 |
|
128 | |
129 |
|
130 |
|
131 | htmlColor: PropTypes.string,
|
132 |
|
133 | |
134 |
|
135 |
|
136 |
|
137 |
|
138 | shapeRendering: PropTypes.string,
|
139 |
|
140 | |
141 |
|
142 |
|
143 |
|
144 | titleAccess: PropTypes.string,
|
145 |
|
146 | |
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 | viewBox: PropTypes.string
|
154 | } : void 0;
|
155 | SvgIcon.muiName = 'SvgIcon';
|
156 | export default withStyles(styles, {
|
157 | name: 'MuiSvgIcon'
|
158 | })(SvgIcon); |
\ | No newline at end of file |