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