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 styled from '../styles/styled';
|
10 | import { useDefaultProps } from '../DefaultPropsProvider';
|
11 | import capitalize from '../utils/capitalize';
|
12 | import { getIconUtilityClass } from './iconClasses';
|
13 | import { jsx as _jsx } from "react/jsx-runtime";
|
14 | var useUtilityClasses = function useUtilityClasses(ownerState) {
|
15 | var color = ownerState.color,
|
16 | fontSize = ownerState.fontSize,
|
17 | classes = ownerState.classes;
|
18 | var slots = {
|
19 | root: ['root', color !== 'inherit' && "color".concat(capitalize(color)), "fontSize".concat(capitalize(fontSize))]
|
20 | };
|
21 | return composeClasses(slots, getIconUtilityClass, classes);
|
22 | };
|
23 | var IconRoot = styled('span', {
|
24 | name: 'MuiIcon',
|
25 | slot: 'Root',
|
26 | overridesResolver: function overridesResolver(props, styles) {
|
27 | var ownerState = props.ownerState;
|
28 | return [styles.root, ownerState.color !== 'inherit' && styles["color".concat(capitalize(ownerState.color))], styles["fontSize".concat(capitalize(ownerState.fontSize))]];
|
29 | }
|
30 | })(function (_ref) {
|
31 | var theme = _ref.theme,
|
32 | ownerState = _ref.ownerState;
|
33 | return {
|
34 | userSelect: 'none',
|
35 | width: '1em',
|
36 | height: '1em',
|
37 |
|
38 |
|
39 | overflow: 'hidden',
|
40 | display: 'inline-block',
|
41 |
|
42 | textAlign: 'center',
|
43 |
|
44 | flexShrink: 0,
|
45 | fontSize: {
|
46 | inherit: 'inherit',
|
47 | small: theme.typography.pxToRem(20),
|
48 | medium: theme.typography.pxToRem(24),
|
49 | large: theme.typography.pxToRem(36)
|
50 | }[ownerState.fontSize],
|
51 |
|
52 | color: {
|
53 | primary: (theme.vars || theme).palette.primary.main,
|
54 | secondary: (theme.vars || theme).palette.secondary.main,
|
55 | info: (theme.vars || theme).palette.info.main,
|
56 | success: (theme.vars || theme).palette.success.main,
|
57 | warning: (theme.vars || theme).palette.warning.main,
|
58 | action: (theme.vars || theme).palette.action.active,
|
59 | error: (theme.vars || theme).palette.error.main,
|
60 | disabled: (theme.vars || theme).palette.action.disabled,
|
61 | inherit: undefined
|
62 | }[ownerState.color]
|
63 | };
|
64 | });
|
65 | var Icon = React.forwardRef(function Icon(inProps, ref) {
|
66 | var props = useDefaultProps({
|
67 | props: inProps,
|
68 | name: 'MuiIcon'
|
69 | });
|
70 | var _props$baseClassName = props.baseClassName,
|
71 | baseClassName = _props$baseClassName === void 0 ? 'material-icons' : _props$baseClassName,
|
72 | className = props.className,
|
73 | _props$color = props.color,
|
74 | color = _props$color === void 0 ? 'inherit' : _props$color,
|
75 | _props$component = props.component,
|
76 | Component = _props$component === void 0 ? 'span' : _props$component,
|
77 | _props$fontSize = props.fontSize,
|
78 | fontSize = _props$fontSize === void 0 ? 'medium' : _props$fontSize,
|
79 | other = _objectWithoutProperties(props, ["baseClassName", "className", "color", "component", "fontSize"]);
|
80 | var ownerState = _extends({}, props, {
|
81 | baseClassName: baseClassName,
|
82 | color: color,
|
83 | component: Component,
|
84 | fontSize: fontSize
|
85 | });
|
86 | var classes = useUtilityClasses(ownerState);
|
87 | return _jsx(IconRoot, _extends({
|
88 | as: Component,
|
89 | className: clsx(baseClassName,
|
90 |
|
91 |
|
92 | 'notranslate', classes.root, className),
|
93 | ownerState: ownerState,
|
94 | "aria-hidden": true,
|
95 | ref: ref
|
96 | }, other));
|
97 | });
|
98 | process.env.NODE_ENV !== "production" ? Icon.propTypes = {
|
99 |
|
100 |
|
101 |
|
102 |
|
103 | |
104 |
|
105 |
|
106 |
|
107 |
|
108 | baseClassName: PropTypes.string,
|
109 | |
110 |
|
111 |
|
112 | children: PropTypes.node,
|
113 | |
114 |
|
115 |
|
116 | classes: PropTypes.object,
|
117 | |
118 |
|
119 |
|
120 | className: PropTypes.string,
|
121 | |
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 | color: PropTypes .oneOfType([PropTypes.oneOf(['inherit', 'action', 'disabled', 'primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
128 | |
129 |
|
130 |
|
131 |
|
132 | component: PropTypes.elementType,
|
133 | |
134 |
|
135 |
|
136 |
|
137 | fontSize: PropTypes .oneOfType([PropTypes.oneOf(['inherit', 'large', 'medium', 'small']), PropTypes.string]),
|
138 | |
139 |
|
140 |
|
141 | sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
142 | } : void 0;
|
143 | Icon.muiName = 'Icon';
|
144 | export default Icon; |
\ | No newline at end of file |