@mui/material 5.15.12 → 5.15.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/Accordion.js +30 -23
- package/AccordionActions/AccordionActions.js +14 -12
- package/AccordionDetails/AccordionDetails.js +2 -2
- package/AccordionSummary/AccordionSummary.js +29 -23
- package/Alert/Alert.d.ts +2 -2
- package/Autocomplete/Autocomplete.d.ts +1 -1
- package/Autocomplete/Autocomplete.js +117 -82
- package/Autocomplete/autocompleteClasses.d.ts +3 -3
- package/CHANGELOG.md +203 -51
- package/CircularProgress/CircularProgress.d.ts +1 -1
- package/CircularProgress/CircularProgress.js +1 -1
- package/Drawer/Drawer.js +9 -3
- package/Icon/Icon.d.ts +1 -1
- package/Icon/Icon.js +1 -1
- package/LinearProgress/LinearProgress.js +4 -4
- package/Menu/Menu.js +5 -4
- package/MenuList/MenuList.js +4 -2
- package/OverridableComponent.d.ts +1 -1
- package/PaginationItem/PaginationItem.js +3 -3
- package/Popper/Popper.d.ts +3 -26
- package/README.md +2 -2
- package/Rating/Rating.js +3 -3
- package/Select/Select.d.ts +8 -20
- package/Slider/Slider.js +406 -226
- package/SvgIcon/SvgIcon.js +1 -1
- package/Switch/Switch.js +61 -41
- package/TabScrollButton/TabScrollButton.js +2 -3
- package/TablePagination/TablePaginationActions.js +14 -14
- package/Tabs/Tabs.js +3 -2
- package/Tooltip/Tooltip.js +5 -4
- package/index.js +1 -1
- package/legacy/Accordion/Accordion.js +33 -22
- package/legacy/AccordionActions/AccordionActions.js +17 -14
- package/legacy/AccordionDetails/AccordionDetails.js +2 -2
- package/legacy/AccordionSummary/AccordionSummary.js +31 -22
- package/legacy/Autocomplete/Autocomplete.js +194 -164
- package/legacy/CircularProgress/CircularProgress.js +1 -1
- package/legacy/Drawer/Drawer.js +8 -3
- package/legacy/Icon/Icon.js +1 -1
- package/legacy/LinearProgress/LinearProgress.js +4 -4
- package/legacy/Menu/Menu.js +5 -4
- package/legacy/MenuList/MenuList.js +3 -2
- package/legacy/PaginationItem/PaginationItem.js +3 -3
- package/legacy/Rating/Rating.js +3 -3
- package/legacy/Slider/Slider.js +375 -194
- package/legacy/SvgIcon/SvgIcon.js +1 -1
- package/legacy/Switch/Switch.js +88 -59
- package/legacy/TabScrollButton/TabScrollButton.js +2 -3
- package/legacy/TablePagination/TablePaginationActions.js +14 -14
- package/legacy/Tabs/Tabs.js +3 -2
- package/legacy/Tooltip/Tooltip.js +7 -3
- package/legacy/index.js +1 -1
- package/legacy/styles/experimental_extendTheme.js +4 -1
- package/legacy/styles/rootShouldForwardProp.js +5 -0
- package/legacy/styles/slotShouldForwardProp.js +5 -0
- package/legacy/styles/styled.js +4 -5
- package/legacy/usePagination/usePagination.js +1 -1
- package/modern/Accordion/Accordion.js +30 -23
- package/modern/AccordionActions/AccordionActions.js +14 -12
- package/modern/AccordionDetails/AccordionDetails.js +2 -2
- package/modern/AccordionSummary/AccordionSummary.js +29 -23
- package/modern/Autocomplete/Autocomplete.js +117 -82
- package/modern/CircularProgress/CircularProgress.js +1 -1
- package/modern/Drawer/Drawer.js +9 -3
- package/modern/Icon/Icon.js +1 -1
- package/modern/LinearProgress/LinearProgress.js +4 -4
- package/modern/Menu/Menu.js +5 -4
- package/modern/MenuList/MenuList.js +4 -2
- package/modern/PaginationItem/PaginationItem.js +3 -3
- package/modern/Rating/Rating.js +3 -3
- package/modern/Slider/Slider.js +339 -175
- package/modern/SvgIcon/SvgIcon.js +1 -1
- package/modern/Switch/Switch.js +61 -41
- package/modern/TabScrollButton/TabScrollButton.js +2 -3
- package/modern/TablePagination/TablePaginationActions.js +14 -14
- package/modern/Tabs/Tabs.js +3 -2
- package/modern/Tooltip/Tooltip.js +5 -4
- package/modern/index.js +1 -1
- package/modern/styles/experimental_extendTheme.js +4 -1
- package/modern/styles/rootShouldForwardProp.js +3 -0
- package/modern/styles/slotShouldForwardProp.js +5 -0
- package/modern/styles/styled.js +4 -3
- package/modern/usePagination/usePagination.js +1 -1
- package/node/Accordion/Accordion.js +32 -25
- package/node/AccordionActions/AccordionActions.js +16 -14
- package/node/AccordionDetails/AccordionDetails.js +4 -4
- package/node/AccordionSummary/AccordionSummary.js +33 -27
- package/node/Autocomplete/Autocomplete.js +129 -94
- package/node/CircularProgress/CircularProgress.js +1 -1
- package/node/Drawer/Drawer.js +9 -3
- package/node/Icon/Icon.js +1 -1
- package/node/LinearProgress/LinearProgress.js +4 -4
- package/node/Menu/Menu.js +5 -4
- package/node/MenuList/MenuList.js +4 -2
- package/node/PaginationItem/PaginationItem.js +3 -3
- package/node/Rating/Rating.js +3 -3
- package/node/Slider/Slider.js +416 -236
- package/node/SvgIcon/SvgIcon.js +1 -1
- package/node/Switch/Switch.js +66 -46
- package/node/TabScrollButton/TabScrollButton.js +2 -3
- package/node/TablePagination/TablePaginationActions.js +14 -14
- package/node/Tabs/Tabs.js +3 -2
- package/node/Tooltip/Tooltip.js +5 -4
- package/node/index.js +1 -1
- package/node/styles/experimental_extendTheme.js +4 -1
- package/node/styles/rootShouldForwardProp.js +10 -0
- package/node/styles/slotShouldForwardProp.js +11 -0
- package/node/styles/styled.js +17 -8
- package/node/usePagination/usePagination.js +1 -1
- package/package.json +6 -6
- package/styles/experimental_extendTheme.d.ts +1 -0
- package/styles/experimental_extendTheme.js +4 -1
- package/styles/rootShouldForwardProp.d.ts +2 -0
- package/styles/rootShouldForwardProp.js +3 -0
- package/styles/slotShouldForwardProp.d.ts +2 -0
- package/styles/slotShouldForwardProp.js +5 -0
- package/styles/styled.d.ts +2 -3
- package/styles/styled.js +4 -3
- package/umd/material-ui.development.js +1048 -738
- package/umd/material-ui.production.min.js +2 -2
- package/usePagination/usePagination.js +1 -1
package/Accordion/Accordion.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
const _excluded = ["children", "className", "defaultExpanded", "disabled", "disableGutters", "expanded", "onChange", "square", "slots", "slotProps", "TransitionComponent", "TransitionProps"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { isFragment } from 'react-is';
|
|
@@ -9,8 +9,7 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import chainPropTypes from '@mui/utils/chainPropTypes';
|
|
11
11
|
import composeClasses from '@mui/utils/composeClasses';
|
|
12
|
-
import styled from '../
|
|
13
|
-
import useThemeProps from '../styles/useThemeProps';
|
|
12
|
+
import { styled, createUseThemeProps } from '../zero-styled';
|
|
14
13
|
import Collapse from '../Collapse';
|
|
15
14
|
import Paper from '../Paper';
|
|
16
15
|
import AccordionContext from './AccordionContext';
|
|
@@ -19,6 +18,7 @@ import useSlot from '../utils/useSlot';
|
|
|
19
18
|
import accordionClasses, { getAccordionUtilityClass } from './accordionClasses';
|
|
20
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
const useThemeProps = createUseThemeProps('MuiAccordion');
|
|
22
22
|
const useUtilityClasses = ownerState => {
|
|
23
23
|
const {
|
|
24
24
|
classes,
|
|
@@ -92,27 +92,34 @@ const AccordionRoot = styled(Paper, {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
}, ({
|
|
95
|
-
theme
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
95
|
+
theme
|
|
96
|
+
}) => ({
|
|
97
|
+
variants: [{
|
|
98
|
+
props: props => !props.square,
|
|
99
|
+
style: {
|
|
100
|
+
borderRadius: 0,
|
|
101
|
+
'&:first-of-type': {
|
|
102
|
+
borderTopLeftRadius: (theme.vars || theme).shape.borderRadius,
|
|
103
|
+
borderTopRightRadius: (theme.vars || theme).shape.borderRadius
|
|
104
|
+
},
|
|
105
|
+
'&:last-of-type': {
|
|
106
|
+
borderBottomLeftRadius: (theme.vars || theme).shape.borderRadius,
|
|
107
|
+
borderBottomRightRadius: (theme.vars || theme).shape.borderRadius,
|
|
108
|
+
// Fix a rendering issue on Edge
|
|
109
|
+
'@supports (-ms-ime-align: auto)': {
|
|
110
|
+
borderBottomLeftRadius: 0,
|
|
111
|
+
borderBottomRightRadius: 0
|
|
112
|
+
}
|
|
113
|
+
}
|
|
110
114
|
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
}, {
|
|
116
|
+
props: props => !props.disableGutters,
|
|
117
|
+
style: {
|
|
118
|
+
[`&.${accordionClasses.expanded}`]: {
|
|
119
|
+
margin: '16px 0'
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}]
|
|
116
123
|
}));
|
|
117
124
|
const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref) {
|
|
118
125
|
const props = useThemeProps({
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
const _excluded = ["className", "disableSpacing"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
|
-
import styled from '../
|
|
11
|
-
import useThemeProps from '../styles/useThemeProps';
|
|
10
|
+
import { styled, createUseThemeProps } from '../zero-styled';
|
|
12
11
|
import { getAccordionActionsUtilityClass } from './accordionActionsClasses';
|
|
13
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const useThemeProps = createUseThemeProps('MuiAccordionActions');
|
|
14
14
|
const useUtilityClasses = ownerState => {
|
|
15
15
|
const {
|
|
16
16
|
classes,
|
|
@@ -30,18 +30,20 @@ const AccordionActionsRoot = styled('div', {
|
|
|
30
30
|
} = props;
|
|
31
31
|
return [styles.root, !ownerState.disableSpacing && styles.spacing];
|
|
32
32
|
}
|
|
33
|
-
})(
|
|
34
|
-
ownerState
|
|
35
|
-
}) => _extends({
|
|
33
|
+
})({
|
|
36
34
|
display: 'flex',
|
|
37
35
|
alignItems: 'center',
|
|
38
36
|
padding: 8,
|
|
39
|
-
justifyContent: 'flex-end'
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
justifyContent: 'flex-end',
|
|
38
|
+
variants: [{
|
|
39
|
+
props: props => !props.disableSpacing,
|
|
40
|
+
style: {
|
|
41
|
+
'& > :not(style) ~ :not(style)': {
|
|
42
|
+
marginLeft: 8
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}]
|
|
46
|
+
});
|
|
45
47
|
const AccordionActions = /*#__PURE__*/React.forwardRef(function AccordionActions(inProps, ref) {
|
|
46
48
|
const props = useThemeProps({
|
|
47
49
|
props: inProps,
|
|
@@ -7,10 +7,10 @@ import * as React from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
|
-
import styled from '../
|
|
11
|
-
import useThemeProps from '../styles/useThemeProps';
|
|
10
|
+
import { styled, createUseThemeProps } from '../zero-styled';
|
|
12
11
|
import { getAccordionDetailsUtilityClass } from './accordionDetailsClasses';
|
|
13
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const useThemeProps = createUseThemeProps('MuiAccordionDetails');
|
|
14
14
|
const useUtilityClasses = ownerState => {
|
|
15
15
|
const {
|
|
16
16
|
classes
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
const _excluded = ["children", "className", "expandIcon", "focusVisibleClassName", "onClick"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
|
-
import styled from '../
|
|
11
|
-
import useThemeProps from '../styles/useThemeProps';
|
|
10
|
+
import { styled, createUseThemeProps } from '../zero-styled';
|
|
12
11
|
import ButtonBase from '../ButtonBase';
|
|
13
12
|
import AccordionContext from '../Accordion/AccordionContext';
|
|
14
13
|
import accordionSummaryClasses, { getAccordionSummaryUtilityClass } from './accordionSummaryClasses';
|
|
15
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const useThemeProps = createUseThemeProps('MuiAccordionSummary');
|
|
17
17
|
const useUtilityClasses = ownerState => {
|
|
18
18
|
const {
|
|
19
19
|
classes,
|
|
@@ -34,13 +34,12 @@ const AccordionSummaryRoot = styled(ButtonBase, {
|
|
|
34
34
|
slot: 'Root',
|
|
35
35
|
overridesResolver: (props, styles) => styles.root
|
|
36
36
|
})(({
|
|
37
|
-
theme
|
|
38
|
-
ownerState
|
|
37
|
+
theme
|
|
39
38
|
}) => {
|
|
40
39
|
const transition = {
|
|
41
40
|
duration: theme.transitions.duration.shortest
|
|
42
41
|
};
|
|
43
|
-
return
|
|
42
|
+
return {
|
|
44
43
|
display: 'flex',
|
|
45
44
|
minHeight: 48,
|
|
46
45
|
padding: theme.spacing(0, 2),
|
|
@@ -53,31 +52,38 @@ const AccordionSummaryRoot = styled(ButtonBase, {
|
|
|
53
52
|
},
|
|
54
53
|
[`&:hover:not(.${accordionSummaryClasses.disabled})`]: {
|
|
55
54
|
cursor: 'pointer'
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
},
|
|
56
|
+
variants: [{
|
|
57
|
+
props: props => !props.disableGutters,
|
|
58
|
+
style: {
|
|
59
|
+
[`&.${accordionSummaryClasses.expanded}`]: {
|
|
60
|
+
minHeight: 64
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}]
|
|
64
|
+
};
|
|
62
65
|
});
|
|
63
66
|
const AccordionSummaryContent = styled('div', {
|
|
64
67
|
name: 'MuiAccordionSummary',
|
|
65
68
|
slot: 'Content',
|
|
66
69
|
overridesResolver: (props, styles) => styles.content
|
|
67
70
|
})(({
|
|
68
|
-
theme
|
|
69
|
-
|
|
70
|
-
}) => _extends({
|
|
71
|
+
theme
|
|
72
|
+
}) => ({
|
|
71
73
|
display: 'flex',
|
|
72
74
|
flexGrow: 1,
|
|
73
|
-
margin: '12px 0'
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
margin: '12px 0',
|
|
76
|
+
variants: [{
|
|
77
|
+
props: props => !props.disableGutters,
|
|
78
|
+
style: {
|
|
79
|
+
transition: theme.transitions.create(['margin'], {
|
|
80
|
+
duration: theme.transitions.duration.shortest
|
|
81
|
+
}),
|
|
82
|
+
[`&.${accordionSummaryClasses.expanded}`]: {
|
|
83
|
+
margin: '20px 0'
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}]
|
|
81
87
|
}));
|
|
82
88
|
const AccordionSummaryExpandIconWrapper = styled('div', {
|
|
83
89
|
name: 'MuiAccordionSummary',
|
package/Alert/Alert.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export type AlertSlotsAndSlotProps = CreateSlotsAndSlotProps<
|
|
|
33
33
|
}
|
|
34
34
|
>;
|
|
35
35
|
|
|
36
|
-
export interface AlertProps extends StandardProps<PaperProps, 'variant'
|
|
36
|
+
export interface AlertProps extends StandardProps<PaperProps, 'variant'>, AlertSlotsAndSlotProps {
|
|
37
37
|
/**
|
|
38
38
|
* The action to display. It renders after the message, at the end of the alert.
|
|
39
39
|
*/
|
|
@@ -133,4 +133,4 @@ export interface AlertOwnerState extends AlertProps {}
|
|
|
133
133
|
* - [Alert API](https://mui.com/material-ui/api/alert/)
|
|
134
134
|
* - inherits [Paper API](https://mui.com/material-ui/api/paper/)
|
|
135
135
|
*/
|
|
136
|
-
export default function Alert(props: AlertProps
|
|
136
|
+
export default function Alert(props: AlertProps): JSX.Element;
|
|
@@ -171,7 +171,7 @@ export interface AutocompleteProps<
|
|
|
171
171
|
};
|
|
172
172
|
/**
|
|
173
173
|
* If `true`, the component is in a loading state.
|
|
174
|
-
* This shows the `loadingText` in place of suggestions (only if there are no suggestions to show,
|
|
174
|
+
* This shows the `loadingText` in place of suggestions (only if there are no suggestions to show, for example `options` are empty).
|
|
175
175
|
* @default false
|
|
176
176
|
*/
|
|
177
177
|
loading?: boolean;
|
|
@@ -24,14 +24,14 @@ import outlinedInputClasses from '../OutlinedInput/outlinedInputClasses';
|
|
|
24
24
|
import filledInputClasses from '../FilledInput/filledInputClasses';
|
|
25
25
|
import ClearIcon from '../internal/svg-icons/Close';
|
|
26
26
|
import ArrowDropDownIcon from '../internal/svg-icons/ArrowDropDown';
|
|
27
|
-
import
|
|
28
|
-
import styled from '../styles/styled';
|
|
27
|
+
import { styled, createUseThemeProps } from '../zero-styled';
|
|
29
28
|
import autocompleteClasses, { getAutocompleteUtilityClass } from './autocompleteClasses';
|
|
30
29
|
import capitalize from '../utils/capitalize';
|
|
31
30
|
import useForkRef from '../utils/useForkRef';
|
|
32
31
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
33
32
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
34
33
|
import { createElement as _createElement } from "react";
|
|
34
|
+
const useThemeProps = createUseThemeProps('MuiAutocomplete');
|
|
35
35
|
const useUtilityClasses = ownerState => {
|
|
36
36
|
const {
|
|
37
37
|
classes,
|
|
@@ -90,9 +90,7 @@ const AutocompleteRoot = styled('div', {
|
|
|
90
90
|
[`& .${autocompleteClasses.input}`]: inputFocused && styles.inputFocused
|
|
91
91
|
}, styles.root, fullWidth && styles.fullWidth, hasPopupIcon && styles.hasPopupIcon, hasClearIcon && styles.hasClearIcon];
|
|
92
92
|
}
|
|
93
|
-
})(
|
|
94
|
-
ownerState
|
|
95
|
-
}) => _extends({
|
|
93
|
+
})({
|
|
96
94
|
[`&.${autocompleteClasses.focused} .${autocompleteClasses.clearIndicator}`]: {
|
|
97
95
|
visibility: 'visible'
|
|
98
96
|
},
|
|
@@ -101,17 +99,11 @@ const AutocompleteRoot = styled('div', {
|
|
|
101
99
|
[`&:hover .${autocompleteClasses.clearIndicator}`]: {
|
|
102
100
|
visibility: 'visible'
|
|
103
101
|
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
width: '100%'
|
|
107
|
-
}, {
|
|
108
|
-
[`& .${autocompleteClasses.tag}`]: _extends({
|
|
102
|
+
},
|
|
103
|
+
[`& .${autocompleteClasses.tag}`]: {
|
|
109
104
|
margin: 3,
|
|
110
105
|
maxWidth: 'calc(100% - 6px)'
|
|
111
|
-
},
|
|
112
|
-
margin: 2,
|
|
113
|
-
maxWidth: 'calc(100% - 4px)'
|
|
114
|
-
}),
|
|
106
|
+
},
|
|
115
107
|
[`& .${autocompleteClasses.inputRoot}`]: {
|
|
116
108
|
flexWrap: 'wrap',
|
|
117
109
|
[`.${autocompleteClasses.hasPopupIcon}&, .${autocompleteClasses.hasClearIcon}&`]: {
|
|
@@ -200,14 +192,39 @@ const AutocompleteRoot = styled('div', {
|
|
|
200
192
|
paddingBottom: 9
|
|
201
193
|
}
|
|
202
194
|
},
|
|
203
|
-
[`& .${autocompleteClasses.input}`]:
|
|
195
|
+
[`& .${autocompleteClasses.input}`]: {
|
|
204
196
|
flexGrow: 1,
|
|
205
197
|
textOverflow: 'ellipsis',
|
|
206
198
|
opacity: 0
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
199
|
+
},
|
|
200
|
+
variants: [{
|
|
201
|
+
props: {
|
|
202
|
+
fullWidth: true
|
|
203
|
+
},
|
|
204
|
+
style: {
|
|
205
|
+
width: '100%'
|
|
206
|
+
}
|
|
207
|
+
}, {
|
|
208
|
+
props: {
|
|
209
|
+
size: 'small'
|
|
210
|
+
},
|
|
211
|
+
style: {
|
|
212
|
+
[`& .${autocompleteClasses.tag}`]: {
|
|
213
|
+
margin: 2,
|
|
214
|
+
maxWidth: 'calc(100% - 4px)'
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}, {
|
|
218
|
+
props: {
|
|
219
|
+
inputFocused: true
|
|
220
|
+
},
|
|
221
|
+
style: {
|
|
222
|
+
[`& .${autocompleteClasses.input}`]: {
|
|
223
|
+
opacity: 1
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}]
|
|
227
|
+
});
|
|
211
228
|
const AutocompleteEndAdornment = styled('div', {
|
|
212
229
|
name: 'MuiAutocomplete',
|
|
213
230
|
slot: 'EndAdornment',
|
|
@@ -234,14 +251,18 @@ const AutocompletePopupIndicator = styled(IconButton, {
|
|
|
234
251
|
overridesResolver: ({
|
|
235
252
|
ownerState
|
|
236
253
|
}, styles) => _extends({}, styles.popupIndicator, ownerState.popupOpen && styles.popupIndicatorOpen)
|
|
237
|
-
})(
|
|
238
|
-
ownerState
|
|
239
|
-
}) => _extends({
|
|
254
|
+
})({
|
|
240
255
|
padding: 2,
|
|
241
|
-
marginRight: -2
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
256
|
+
marginRight: -2,
|
|
257
|
+
variants: [{
|
|
258
|
+
props: {
|
|
259
|
+
popupOpen: true
|
|
260
|
+
},
|
|
261
|
+
style: {
|
|
262
|
+
transform: 'rotate(180deg)'
|
|
263
|
+
}
|
|
264
|
+
}]
|
|
265
|
+
});
|
|
245
266
|
const AutocompletePopper = styled(Popper, {
|
|
246
267
|
name: 'MuiAutocomplete',
|
|
247
268
|
slot: 'Popper',
|
|
@@ -254,12 +275,17 @@ const AutocompletePopper = styled(Popper, {
|
|
|
254
275
|
}, styles.popper, ownerState.disablePortal && styles.popperDisablePortal];
|
|
255
276
|
}
|
|
256
277
|
})(({
|
|
257
|
-
theme
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
278
|
+
theme
|
|
279
|
+
}) => ({
|
|
280
|
+
zIndex: (theme.vars || theme).zIndex.modal,
|
|
281
|
+
variants: [{
|
|
282
|
+
props: {
|
|
283
|
+
disablePortal: true
|
|
284
|
+
},
|
|
285
|
+
style: {
|
|
286
|
+
position: 'absolute'
|
|
287
|
+
}
|
|
288
|
+
}]
|
|
263
289
|
}));
|
|
264
290
|
const AutocompletePaper = styled(Paper, {
|
|
265
291
|
name: 'MuiAutocomplete',
|
|
@@ -554,6 +580,63 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
554
580
|
const paperSlotProps = (_slotProps$paper = slotProps.paper) != null ? _slotProps$paper : componentsProps.paper;
|
|
555
581
|
const popperSlotProps = (_slotProps$popper = slotProps.popper) != null ? _slotProps$popper : componentsProps.popper;
|
|
556
582
|
const popupIndicatorSlotProps = (_slotProps$popupIndic = slotProps.popupIndicator) != null ? _slotProps$popupIndic : componentsProps.popupIndicator;
|
|
583
|
+
const renderAutocompletePopperChildren = children => /*#__PURE__*/_jsx(AutocompletePopper, _extends({
|
|
584
|
+
as: PopperComponent,
|
|
585
|
+
disablePortal: disablePortal,
|
|
586
|
+
style: {
|
|
587
|
+
width: anchorEl ? anchorEl.clientWidth : null
|
|
588
|
+
},
|
|
589
|
+
ownerState: ownerState,
|
|
590
|
+
role: "presentation",
|
|
591
|
+
anchorEl: anchorEl,
|
|
592
|
+
open: popupOpen
|
|
593
|
+
}, popperSlotProps, {
|
|
594
|
+
className: clsx(classes.popper, popperSlotProps == null ? void 0 : popperSlotProps.className),
|
|
595
|
+
children: /*#__PURE__*/_jsx(AutocompletePaper, _extends({
|
|
596
|
+
ownerState: ownerState,
|
|
597
|
+
as: PaperComponent
|
|
598
|
+
}, paperSlotProps, {
|
|
599
|
+
className: clsx(classes.paper, paperSlotProps == null ? void 0 : paperSlotProps.className),
|
|
600
|
+
children: children
|
|
601
|
+
}))
|
|
602
|
+
}));
|
|
603
|
+
let autocompletePopper = null;
|
|
604
|
+
if (!loading && groupedOptions.length > 0) {
|
|
605
|
+
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteListbox, _extends({
|
|
606
|
+
as: ListboxComponent,
|
|
607
|
+
className: classes.listbox,
|
|
608
|
+
ownerState: ownerState
|
|
609
|
+
}, otherListboxProps, ListboxProps, {
|
|
610
|
+
ref: combinedListboxRef,
|
|
611
|
+
children: groupedOptions.map((option, index) => {
|
|
612
|
+
if (groupBy) {
|
|
613
|
+
return renderGroup({
|
|
614
|
+
key: option.key,
|
|
615
|
+
group: option.group,
|
|
616
|
+
children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
return renderListOption(option, index);
|
|
620
|
+
})
|
|
621
|
+
})));
|
|
622
|
+
} else if (loading && groupedOptions.length === 0) {
|
|
623
|
+
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteLoading, {
|
|
624
|
+
className: classes.loading,
|
|
625
|
+
ownerState: ownerState,
|
|
626
|
+
children: loadingText
|
|
627
|
+
}));
|
|
628
|
+
} else if (groupedOptions.length === 0 && !freeSolo && !loading) {
|
|
629
|
+
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteNoOptions, {
|
|
630
|
+
className: classes.noOptions,
|
|
631
|
+
ownerState: ownerState,
|
|
632
|
+
role: "presentation",
|
|
633
|
+
onMouseDown: event => {
|
|
634
|
+
// Prevent input blur when interacting with the "no options" content
|
|
635
|
+
event.preventDefault();
|
|
636
|
+
},
|
|
637
|
+
children: noOptionsText
|
|
638
|
+
}));
|
|
639
|
+
}
|
|
557
640
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
558
641
|
children: [/*#__PURE__*/_jsx(AutocompleteRoot, _extends({
|
|
559
642
|
ref: ref,
|
|
@@ -603,55 +686,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
603
686
|
readOnly
|
|
604
687
|
}, getInputProps())
|
|
605
688
|
})
|
|
606
|
-
})), anchorEl ?
|
|
607
|
-
as: PopperComponent,
|
|
608
|
-
disablePortal: disablePortal,
|
|
609
|
-
style: {
|
|
610
|
-
width: anchorEl ? anchorEl.clientWidth : null
|
|
611
|
-
},
|
|
612
|
-
ownerState: ownerState,
|
|
613
|
-
role: "presentation",
|
|
614
|
-
anchorEl: anchorEl,
|
|
615
|
-
open: popupOpen
|
|
616
|
-
}, popperSlotProps, {
|
|
617
|
-
className: clsx(classes.popper, popperSlotProps == null ? void 0 : popperSlotProps.className),
|
|
618
|
-
children: /*#__PURE__*/_jsxs(AutocompletePaper, _extends({
|
|
619
|
-
ownerState: ownerState,
|
|
620
|
-
as: PaperComponent
|
|
621
|
-
}, paperSlotProps, {
|
|
622
|
-
className: clsx(classes.paper, paperSlotProps == null ? void 0 : paperSlotProps.className),
|
|
623
|
-
children: [loading && groupedOptions.length === 0 ? /*#__PURE__*/_jsx(AutocompleteLoading, {
|
|
624
|
-
className: classes.loading,
|
|
625
|
-
ownerState: ownerState,
|
|
626
|
-
children: loadingText
|
|
627
|
-
}) : null, groupedOptions.length === 0 && !freeSolo && !loading ? /*#__PURE__*/_jsx(AutocompleteNoOptions, {
|
|
628
|
-
className: classes.noOptions,
|
|
629
|
-
ownerState: ownerState,
|
|
630
|
-
role: "presentation",
|
|
631
|
-
onMouseDown: event => {
|
|
632
|
-
// Prevent input blur when interacting with the "no options" content
|
|
633
|
-
event.preventDefault();
|
|
634
|
-
},
|
|
635
|
-
children: noOptionsText
|
|
636
|
-
}) : null, groupedOptions.length > 0 ? /*#__PURE__*/_jsx(AutocompleteListbox, _extends({
|
|
637
|
-
as: ListboxComponent,
|
|
638
|
-
className: classes.listbox,
|
|
639
|
-
ownerState: ownerState
|
|
640
|
-
}, otherListboxProps, ListboxProps, {
|
|
641
|
-
ref: combinedListboxRef,
|
|
642
|
-
children: groupedOptions.map((option, index) => {
|
|
643
|
-
if (groupBy) {
|
|
644
|
-
return renderGroup({
|
|
645
|
-
key: option.key,
|
|
646
|
-
group: option.group,
|
|
647
|
-
children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
return renderListOption(option, index);
|
|
651
|
-
})
|
|
652
|
-
})) : null]
|
|
653
|
-
}))
|
|
654
|
-
})) : null]
|
|
689
|
+
})), anchorEl ? autocompletePopper : null]
|
|
655
690
|
});
|
|
656
691
|
});
|
|
657
692
|
process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptypes */ = {
|
|
@@ -903,7 +938,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
|
|
|
903
938
|
ListboxProps: PropTypes.object,
|
|
904
939
|
/**
|
|
905
940
|
* If `true`, the component is in a loading state.
|
|
906
|
-
* This shows the `loadingText` in place of suggestions (only if there are no suggestions to show,
|
|
941
|
+
* This shows the `loadingText` in place of suggestions (only if there are no suggestions to show, for example `options` are empty).
|
|
907
942
|
* @default false
|
|
908
943
|
*/
|
|
909
944
|
loading: PropTypes.bool,
|
|
@@ -9,11 +9,11 @@ export interface AutocompleteClasses {
|
|
|
9
9
|
focused: string;
|
|
10
10
|
/** Styles applied to the option elements if they are keyboard focused. */
|
|
11
11
|
focusVisible: string;
|
|
12
|
-
/** Styles applied to the tag elements,
|
|
12
|
+
/** Styles applied to the tag elements, for example the chips. */
|
|
13
13
|
tag: string;
|
|
14
|
-
/** Styles applied to the tag elements,
|
|
14
|
+
/** Styles applied to the tag elements, for example the chips if `size="small"`. */
|
|
15
15
|
tagSizeSmall: string;
|
|
16
|
-
/** Styles applied to the tag elements,
|
|
16
|
+
/** Styles applied to the tag elements, for example the chips if `size="medium"`. */
|
|
17
17
|
tagSizeMedium: string;
|
|
18
18
|
/** Styles applied when the popup icon is rendered. */
|
|
19
19
|
hasPopupIcon: string;
|