1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | const _excluded = ["children", "className", "color", "component", "fontSize", "htmlColor", "inheritViewBox", "titleAccess", "viewBox"];
|
4 | import * as React from 'react';
|
5 | import PropTypes from 'prop-types';
|
6 | import clsx from 'clsx';
|
7 | import { unstable_composeClasses as composeClasses } from '@mui/base';
|
8 | import capitalize from '../utils/capitalize';
|
9 | import useThemeProps from '../styles/useThemeProps';
|
10 | import styled from '../styles/styled';
|
11 | import { getSvgIconUtilityClass } from './svgIconClasses';
|
12 | import { jsx as _jsx } from "react/jsx-runtime";
|
13 | import { jsxs as _jsxs } from "react/jsx-runtime";
|
14 |
|
15 | const useUtilityClasses = ownerState => {
|
16 | const {
|
17 | color,
|
18 | fontSize,
|
19 | classes
|
20 | } = ownerState;
|
21 | const slots = {
|
22 | root: ['root', color !== 'inherit' && `color${capitalize(color)}`, `fontSize${capitalize(fontSize)}`]
|
23 | };
|
24 | return composeClasses(slots, getSvgIconUtilityClass, classes);
|
25 | };
|
26 |
|
27 | const SvgIconRoot = styled('svg', {
|
28 | name: 'MuiSvgIcon',
|
29 | slot: 'Root',
|
30 | overridesResolver: (props, styles) => {
|
31 | const {
|
32 | ownerState
|
33 | } = props;
|
34 | return [styles.root, ownerState.color !== 'inherit' && styles[`color${capitalize(ownerState.color)}`], styles[`fontSize${capitalize(ownerState.fontSize)}`]];
|
35 | }
|
36 | })(({
|
37 | theme,
|
38 | ownerState
|
39 | }) => ({
|
40 | userSelect: 'none',
|
41 | width: '1em',
|
42 | height: '1em',
|
43 | display: 'inline-block',
|
44 | fill: 'currentColor',
|
45 | flexShrink: 0,
|
46 | transition: theme.transitions?.create?.('fill', {
|
47 | duration: theme.transitions?.duration?.shorter
|
48 | }),
|
49 | fontSize: {
|
50 | inherit: 'inherit',
|
51 | small: theme.typography?.pxToRem?.(20) || '1.25rem',
|
52 | medium: theme.typography?.pxToRem?.(24) || '1.5rem',
|
53 | large: theme.typography?.pxToRem?.(35) || '2.1875'
|
54 | }[ownerState.fontSize],
|
55 |
|
56 | color: (theme.vars || theme).palette?.[ownerState.color]?.main ?? {
|
57 | action: (theme.vars || theme).palette?.action?.active,
|
58 | disabled: (theme.vars || theme).palette?.action?.disabled,
|
59 | inherit: undefined
|
60 | }[ownerState.color]
|
61 | }));
|
62 | const SvgIcon = React.forwardRef(function SvgIcon(inProps, ref) {
|
63 | const props = useThemeProps({
|
64 | props: inProps,
|
65 | name: 'MuiSvgIcon'
|
66 | });
|
67 |
|
68 | const {
|
69 | children,
|
70 | className,
|
71 | color = 'inherit',
|
72 | component = 'svg',
|
73 | fontSize = 'medium',
|
74 | htmlColor,
|
75 | inheritViewBox = false,
|
76 | titleAccess,
|
77 | viewBox = '0 0 24 24'
|
78 | } = props,
|
79 | other = _objectWithoutPropertiesLoose(props, _excluded);
|
80 |
|
81 | const ownerState = _extends({}, props, {
|
82 | color,
|
83 | component,
|
84 | fontSize,
|
85 | instanceFontSize: inProps.fontSize,
|
86 | inheritViewBox,
|
87 | viewBox
|
88 | });
|
89 |
|
90 | const more = {};
|
91 |
|
92 | if (!inheritViewBox) {
|
93 | more.viewBox = viewBox;
|
94 | }
|
95 |
|
96 | const classes = useUtilityClasses(ownerState);
|
97 | return _jsxs(SvgIconRoot, _extends({
|
98 | as: component,
|
99 | className: clsx(classes.root, className),
|
100 | ownerState: ownerState,
|
101 | focusable: "false",
|
102 | color: htmlColor,
|
103 | "aria-hidden": titleAccess ? undefined : true,
|
104 | role: titleAccess ? 'img' : undefined,
|
105 | ref: ref
|
106 | }, more, other, {
|
107 | children: [children, titleAccess ? _jsx("title", {
|
108 | children: titleAccess
|
109 | }) : null]
|
110 | }));
|
111 | });
|
112 | process.env.NODE_ENV !== "production" ? SvgIcon.propTypes
|
113 |
|
114 | = {
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 | |
121 |
|
122 |
|
123 | children: PropTypes.node,
|
124 |
|
125 | |
126 |
|
127 |
|
128 | classes: PropTypes.object,
|
129 |
|
130 | |
131 |
|
132 |
|
133 | className: PropTypes.string,
|
134 |
|
135 | |
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 | color: PropTypes
|
143 |
|
144 | .oneOfType([PropTypes.oneOf(['inherit', 'action', 'disabled', 'primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
145 |
|
146 | |
147 |
|
148 |
|
149 |
|
150 | component: PropTypes.elementType,
|
151 |
|
152 | |
153 |
|
154 |
|
155 |
|
156 | fontSize: PropTypes
|
157 |
|
158 | .oneOfType([PropTypes.oneOf(['inherit', 'large', 'medium', 'small']), PropTypes.string]),
|
159 |
|
160 | |
161 |
|
162 |
|
163 | htmlColor: PropTypes.string,
|
164 |
|
165 | |
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 | inheritViewBox: PropTypes.bool,
|
173 |
|
174 | |
175 |
|
176 |
|
177 |
|
178 |
|
179 | shapeRendering: PropTypes.string,
|
180 |
|
181 | |
182 |
|
183 |
|
184 | sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
185 |
|
186 | |
187 |
|
188 |
|
189 |
|
190 | titleAccess: PropTypes.string,
|
191 |
|
192 | |
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | viewBox: PropTypes.string
|
201 | } : void 0;
|
202 | SvgIcon.muiName = 'SvgIcon';
|
203 | export default SvgIcon; |
\ | No newline at end of file |