@mui/material 6.3.0 → 6.4.0
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/Alert/Alert.d.ts +69 -0
- package/Alert/Alert.js +53 -21
- package/AppBar/AppBar.d.ts +1 -1
- package/AppBar/AppBar.js +1 -1
- package/Autocomplete/Autocomplete.d.ts +1 -1
- package/Autocomplete/Autocomplete.js +35 -48
- package/Button/Button.d.ts +18 -0
- package/Button/Button.js +233 -15
- package/Button/buttonClasses.d.ts +14 -0
- package/Button/buttonClasses.js +1 -1
- package/CHANGELOG.md +85 -0
- package/CardHeader/CardHeader.d.ts +114 -1
- package/CardHeader/CardHeader.js +99 -32
- package/CircularProgress/CircularProgress.js +2 -2
- package/IconButton/IconButton.d.ts +12 -0
- package/IconButton/IconButton.js +69 -7
- package/IconButton/iconButtonClasses.d.ts +4 -0
- package/IconButton/iconButtonClasses.js +1 -1
- package/LinearProgress/LinearProgress.js +4 -4
- package/LinearProgress/linearProgressClasses.d.ts +31 -9
- package/LinearProgress/linearProgressClasses.js +1 -1
- package/Link/getTextDecoration.js +3 -2
- package/Select/Select.js +10 -1
- package/Select/SelectInput.js +1 -1
- package/Select/selectClasses.d.ts +9 -3
- package/Slider/useSlider.js +5 -2
- package/StepLabel/StepLabel.d.ts +1 -1
- package/TableSortLabel/TableSortLabel.d.ts +43 -1
- package/TableSortLabel/TableSortLabel.js +40 -7
- package/Tooltip/Tooltip.d.ts +1 -1
- package/Tooltip/Tooltip.js +1 -1
- package/index.js +1 -1
- package/modern/Alert/Alert.js +53 -21
- package/modern/AppBar/AppBar.js +1 -1
- package/modern/Autocomplete/Autocomplete.js +35 -48
- package/modern/Button/Button.js +233 -15
- package/modern/Button/buttonClasses.js +1 -1
- package/modern/CardHeader/CardHeader.js +99 -32
- package/modern/CircularProgress/CircularProgress.js +2 -2
- package/modern/IconButton/IconButton.js +69 -7
- package/modern/IconButton/iconButtonClasses.js +1 -1
- package/modern/LinearProgress/LinearProgress.js +4 -4
- package/modern/LinearProgress/linearProgressClasses.js +1 -1
- package/modern/Link/getTextDecoration.js +3 -2
- package/modern/Select/Select.js +10 -1
- package/modern/Select/SelectInput.js +1 -1
- package/modern/Slider/useSlider.js +5 -2
- package/modern/TableSortLabel/TableSortLabel.js +40 -7
- package/modern/Tooltip/Tooltip.js +1 -1
- package/modern/index.js +1 -1
- package/modern/utils/index.js +1 -0
- package/modern/utils/mergeSlotProps.js +43 -0
- package/modern/utils/useSlot.js +5 -1
- package/modern/version/index.js +2 -2
- package/node/Alert/Alert.js +53 -21
- package/node/AppBar/AppBar.js +1 -1
- package/node/Autocomplete/Autocomplete.js +35 -48
- package/node/Button/Button.js +233 -15
- package/node/Button/buttonClasses.js +1 -1
- package/node/CardHeader/CardHeader.js +99 -32
- package/node/CircularProgress/CircularProgress.js +2 -2
- package/node/IconButton/IconButton.js +68 -6
- package/node/IconButton/iconButtonClasses.js +1 -1
- package/node/LinearProgress/LinearProgress.js +4 -4
- package/node/LinearProgress/linearProgressClasses.js +1 -1
- package/node/Link/getTextDecoration.js +3 -2
- package/node/Select/Select.js +10 -1
- package/node/Select/SelectInput.js +1 -1
- package/node/Slider/useSlider.js +5 -2
- package/node/TableSortLabel/TableSortLabel.js +40 -7
- package/node/Tooltip/Tooltip.js +1 -1
- package/node/index.js +1 -1
- package/node/utils/index.js +7 -0
- package/node/utils/mergeSlotProps.js +50 -0
- package/node/utils/useSlot.js +5 -1
- package/node/version/index.js +2 -2
- package/package.json +6 -6
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/mergeSlotProps.d.ts +2 -0
- package/utils/mergeSlotProps.js +43 -0
- package/utils/useSlot.d.ts +8 -0
- package/utils/useSlot.js +5 -1
- package/version/index.js +2 -2
|
@@ -5,25 +5,29 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import chainPropTypes from '@mui/utils/chainPropTypes';
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import { unstable_useId as useId } from '@mui/material/utils';
|
|
8
9
|
import { alpha } from '@mui/system/colorManipulator';
|
|
9
10
|
import { styled } from "../zero-styled/index.js";
|
|
10
11
|
import memoTheme from "../utils/memoTheme.js";
|
|
11
12
|
import createSimplePaletteValueFilter from "../utils/createSimplePaletteValueFilter.js";
|
|
12
13
|
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
13
14
|
import ButtonBase from "../ButtonBase/index.js";
|
|
15
|
+
import CircularProgress from "../CircularProgress/index.js";
|
|
14
16
|
import capitalize from "../utils/capitalize.js";
|
|
15
17
|
import iconButtonClasses, { getIconButtonUtilityClass } from "./iconButtonClasses.js";
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
19
|
const useUtilityClasses = ownerState => {
|
|
18
20
|
const {
|
|
19
21
|
classes,
|
|
20
22
|
disabled,
|
|
21
23
|
color,
|
|
22
24
|
edge,
|
|
23
|
-
size
|
|
25
|
+
size,
|
|
26
|
+
loading
|
|
24
27
|
} = ownerState;
|
|
25
28
|
const slots = {
|
|
26
|
-
root: ['root', disabled && 'disabled', color !== 'default' && `color${capitalize(color)}`, edge && `edge${capitalize(edge)}`, `size${capitalize(size)}`]
|
|
29
|
+
root: ['root', loading && 'loading', disabled && 'disabled', color !== 'default' && `color${capitalize(color)}`, edge && `edge${capitalize(edge)}`, `size${capitalize(size)}`],
|
|
30
|
+
loadingIndicator: ['loadingIndicator']
|
|
27
31
|
};
|
|
28
32
|
return composeClasses(slots, getIconButtonUtilityClass, classes);
|
|
29
33
|
};
|
|
@@ -34,7 +38,7 @@ const IconButtonRoot = styled(ButtonBase, {
|
|
|
34
38
|
const {
|
|
35
39
|
ownerState
|
|
36
40
|
} = props;
|
|
37
|
-
return [styles.root, ownerState.color !== 'default' && styles[`color${capitalize(ownerState.color)}`], ownerState.edge && styles[`edge${capitalize(ownerState.edge)}`], styles[`size${capitalize(ownerState.size)}`]];
|
|
41
|
+
return [styles.root, ownerState.loading && styles.loading, ownerState.color !== 'default' && styles[`color${capitalize(ownerState.color)}`], ownerState.edge && styles[`edge${capitalize(ownerState.edge)}`], styles[`size${capitalize(ownerState.size)}`]];
|
|
38
42
|
}
|
|
39
43
|
})(memoTheme(({
|
|
40
44
|
theme
|
|
@@ -137,8 +141,34 @@ const IconButtonRoot = styled(ButtonBase, {
|
|
|
137
141
|
[`&.${iconButtonClasses.disabled}`]: {
|
|
138
142
|
backgroundColor: 'transparent',
|
|
139
143
|
color: (theme.vars || theme).palette.action.disabled
|
|
144
|
+
},
|
|
145
|
+
[`&.${iconButtonClasses.loading}`]: {
|
|
146
|
+
color: 'transparent'
|
|
140
147
|
}
|
|
141
148
|
})));
|
|
149
|
+
const IconButtonLoadingIndicator = styled('span', {
|
|
150
|
+
name: 'MuiIconButton',
|
|
151
|
+
slot: 'LoadingIndicator',
|
|
152
|
+
overridesResolver: (props, styles) => styles.loadingIndicator
|
|
153
|
+
})(({
|
|
154
|
+
theme
|
|
155
|
+
}) => ({
|
|
156
|
+
display: 'none',
|
|
157
|
+
position: 'absolute',
|
|
158
|
+
visibility: 'visible',
|
|
159
|
+
top: '50%',
|
|
160
|
+
left: '50%',
|
|
161
|
+
transform: 'translate(-50%, -50%)',
|
|
162
|
+
color: (theme.vars || theme).palette.action.disabled,
|
|
163
|
+
variants: [{
|
|
164
|
+
props: {
|
|
165
|
+
loading: true
|
|
166
|
+
},
|
|
167
|
+
style: {
|
|
168
|
+
display: 'flex'
|
|
169
|
+
}
|
|
170
|
+
}]
|
|
171
|
+
}));
|
|
142
172
|
|
|
143
173
|
/**
|
|
144
174
|
* Refer to the [Icons](/material-ui/icons/) section of the documentation
|
|
@@ -157,26 +187,42 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(inProps, re
|
|
|
157
187
|
disabled = false,
|
|
158
188
|
disableFocusRipple = false,
|
|
159
189
|
size = 'medium',
|
|
190
|
+
id: idProp,
|
|
191
|
+
loading = false,
|
|
192
|
+
loadingIndicator: loadingIndicatorProp,
|
|
160
193
|
...other
|
|
161
194
|
} = props;
|
|
195
|
+
const id = useId(idProp);
|
|
196
|
+
const loadingIndicator = loadingIndicatorProp ?? /*#__PURE__*/_jsx(CircularProgress, {
|
|
197
|
+
"aria-labelledby": id,
|
|
198
|
+
color: "inherit",
|
|
199
|
+
size: 16
|
|
200
|
+
});
|
|
162
201
|
const ownerState = {
|
|
163
202
|
...props,
|
|
164
203
|
edge,
|
|
165
204
|
color,
|
|
166
205
|
disabled,
|
|
167
206
|
disableFocusRipple,
|
|
207
|
+
loading,
|
|
208
|
+
loadingIndicator,
|
|
168
209
|
size
|
|
169
210
|
};
|
|
170
211
|
const classes = useUtilityClasses(ownerState);
|
|
171
|
-
return /*#__PURE__*/
|
|
212
|
+
return /*#__PURE__*/_jsxs(IconButtonRoot, {
|
|
213
|
+
id: id,
|
|
172
214
|
className: clsx(classes.root, className),
|
|
173
215
|
centerRipple: true,
|
|
174
216
|
focusRipple: !disableFocusRipple,
|
|
175
|
-
disabled: disabled,
|
|
217
|
+
disabled: disabled || loading,
|
|
176
218
|
ref: ref,
|
|
177
219
|
...other,
|
|
178
220
|
ownerState: ownerState,
|
|
179
|
-
children:
|
|
221
|
+
children: [/*#__PURE__*/_jsx(IconButtonLoadingIndicator, {
|
|
222
|
+
className: classes.loadingIndicator,
|
|
223
|
+
ownerState: ownerState,
|
|
224
|
+
children: loading && loadingIndicator
|
|
225
|
+
}), children]
|
|
180
226
|
});
|
|
181
227
|
});
|
|
182
228
|
process.env.NODE_ENV !== "production" ? IconButton.propTypes /* remove-proptypes */ = {
|
|
@@ -235,6 +281,22 @@ process.env.NODE_ENV !== "production" ? IconButton.propTypes /* remove-proptypes
|
|
|
235
281
|
* @default false
|
|
236
282
|
*/
|
|
237
283
|
edge: PropTypes.oneOf(['end', 'start', false]),
|
|
284
|
+
/**
|
|
285
|
+
* @ignore
|
|
286
|
+
*/
|
|
287
|
+
id: PropTypes.string,
|
|
288
|
+
/**
|
|
289
|
+
* If `true`, the loading indicator is visible and the button is disabled.
|
|
290
|
+
* @default false
|
|
291
|
+
*/
|
|
292
|
+
loading: PropTypes.bool,
|
|
293
|
+
/**
|
|
294
|
+
* Element placed before the children if the button is in loading state.
|
|
295
|
+
* The node should contain an element with `role="progressbar"` with an accessible name.
|
|
296
|
+
* By default, it renders a `CircularProgress` that is labeled by the button itself.
|
|
297
|
+
* @default <CircularProgress color="inherit" size={16} />
|
|
298
|
+
*/
|
|
299
|
+
loadingIndicator: PropTypes.node,
|
|
238
300
|
/**
|
|
239
301
|
* The size of the component.
|
|
240
302
|
* `small` is equivalent to the dense button styling.
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
|
3
3
|
export function getIconButtonUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiIconButton', slot);
|
|
5
5
|
}
|
|
6
|
-
const iconButtonClasses = generateUtilityClasses('MuiIconButton', ['root', 'disabled', 'colorInherit', 'colorPrimary', 'colorSecondary', 'colorError', 'colorInfo', 'colorSuccess', 'colorWarning', 'edgeStart', 'edgeEnd', 'sizeSmall', 'sizeMedium', 'sizeLarge']);
|
|
6
|
+
const iconButtonClasses = generateUtilityClasses('MuiIconButton', ['root', 'disabled', 'colorInherit', 'colorPrimary', 'colorSecondary', 'colorError', 'colorInfo', 'colorSuccess', 'colorWarning', 'edgeStart', 'edgeEnd', 'sizeSmall', 'sizeMedium', 'sizeLarge', 'loading', 'loadingIndicator']);
|
|
7
7
|
export default iconButtonClasses;
|
|
@@ -84,8 +84,8 @@ const useUtilityClasses = ownerState => {
|
|
|
84
84
|
const slots = {
|
|
85
85
|
root: ['root', `color${capitalize(color)}`, variant],
|
|
86
86
|
dashed: ['dashed', `dashedColor${capitalize(color)}`],
|
|
87
|
-
bar1: ['bar', `barColor${capitalize(color)}`, (variant === 'indeterminate' || variant === 'query') && 'bar1Indeterminate', variant === 'determinate' && 'bar1Determinate', variant === 'buffer' && 'bar1Buffer'],
|
|
88
|
-
bar2: ['bar', variant !== 'buffer' && `barColor${capitalize(color)}`, variant === 'buffer' && `color${capitalize(color)}`, (variant === 'indeterminate' || variant === 'query') && 'bar2Indeterminate', variant === 'buffer' && 'bar2Buffer']
|
|
87
|
+
bar1: ['bar', 'bar1', `barColor${capitalize(color)}`, (variant === 'indeterminate' || variant === 'query') && 'bar1Indeterminate', variant === 'determinate' && 'bar1Determinate', variant === 'buffer' && 'bar1Buffer'],
|
|
88
|
+
bar2: ['bar', 'bar2', variant !== 'buffer' && `barColor${capitalize(color)}`, variant === 'buffer' && `color${capitalize(color)}`, (variant === 'indeterminate' || variant === 'query') && 'bar2Indeterminate', variant === 'buffer' && 'bar2Buffer']
|
|
89
89
|
};
|
|
90
90
|
return composeClasses(slots, getLinearProgressUtilityClass, classes);
|
|
91
91
|
};
|
|
@@ -203,7 +203,7 @@ const LinearProgressBar1 = styled('span', {
|
|
|
203
203
|
const {
|
|
204
204
|
ownerState
|
|
205
205
|
} = props;
|
|
206
|
-
return [styles.bar, styles[`barColor${capitalize(ownerState.color)}`], (ownerState.variant === 'indeterminate' || ownerState.variant === 'query') && styles.bar1Indeterminate, ownerState.variant === 'determinate' && styles.bar1Determinate, ownerState.variant === 'buffer' && styles.bar1Buffer];
|
|
206
|
+
return [styles.bar, styles.bar1, styles[`barColor${capitalize(ownerState.color)}`], (ownerState.variant === 'indeterminate' || ownerState.variant === 'query') && styles.bar1Indeterminate, ownerState.variant === 'determinate' && styles.bar1Determinate, ownerState.variant === 'buffer' && styles.bar1Buffer];
|
|
207
207
|
}
|
|
208
208
|
})(memoTheme(({
|
|
209
209
|
theme
|
|
@@ -267,7 +267,7 @@ const LinearProgressBar2 = styled('span', {
|
|
|
267
267
|
const {
|
|
268
268
|
ownerState
|
|
269
269
|
} = props;
|
|
270
|
-
return [styles.bar, styles[`barColor${capitalize(ownerState.color)}`], (ownerState.variant === 'indeterminate' || ownerState.variant === 'query') && styles.bar2Indeterminate, ownerState.variant === 'buffer' && styles.bar2Buffer];
|
|
270
|
+
return [styles.bar, styles.bar2, styles[`barColor${capitalize(ownerState.color)}`], (ownerState.variant === 'indeterminate' || ownerState.variant === 'query') && styles.bar2Indeterminate, ownerState.variant === 'buffer' && styles.bar2Buffer];
|
|
271
271
|
}
|
|
272
272
|
})(memoTheme(({
|
|
273
273
|
theme
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
|
3
3
|
export function getLinearProgressUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiLinearProgress', slot);
|
|
5
5
|
}
|
|
6
|
-
const linearProgressClasses = generateUtilityClasses('MuiLinearProgress', ['root', 'colorPrimary', 'colorSecondary', 'determinate', 'indeterminate', 'buffer', 'query', 'dashed', 'dashedColorPrimary', 'dashedColorSecondary', 'bar', 'barColorPrimary', 'barColorSecondary', 'bar1Indeterminate', 'bar1Determinate', 'bar1Buffer', 'bar2Indeterminate', 'bar2Buffer']);
|
|
6
|
+
const linearProgressClasses = generateUtilityClasses('MuiLinearProgress', ['root', 'colorPrimary', 'colorSecondary', 'determinate', 'indeterminate', 'buffer', 'query', 'dashed', 'dashedColorPrimary', 'dashedColorSecondary', 'bar', 'bar1', 'bar2', 'barColorPrimary', 'barColorSecondary', 'bar1Indeterminate', 'bar1Determinate', 'bar1Buffer', 'bar2Indeterminate', 'bar2Buffer']);
|
|
7
7
|
export default linearProgressClasses;
|
|
@@ -5,8 +5,9 @@ const getTextDecoration = ({
|
|
|
5
5
|
ownerState
|
|
6
6
|
}) => {
|
|
7
7
|
const transformedColor = ownerState.color;
|
|
8
|
-
|
|
9
|
-
const
|
|
8
|
+
// check the `main` color first for a custom palette, then fallback to the color itself
|
|
9
|
+
const color = getPath(theme, `palette.${transformedColor}.main`, false) || getPath(theme, `palette.${transformedColor}`, false) || ownerState.color;
|
|
10
|
+
const channelColor = getPath(theme, `palette.${transformedColor}.mainChannel`) || getPath(theme, `palette.${transformedColor}Channel`);
|
|
10
11
|
if ('vars' in theme && channelColor) {
|
|
11
12
|
return `rgba(${channelColor} / 0.4)`;
|
|
12
13
|
}
|
package/modern/Select/Select.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import deepmerge from '@mui/utils/deepmerge';
|
|
7
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
7
8
|
import getReactElementRef from '@mui/utils/getReactElementRef';
|
|
8
9
|
import SelectInput from "./SelectInput.js";
|
|
9
10
|
import formControlState from "../FormControl/formControlState.js";
|
|
@@ -17,12 +18,20 @@ import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
|
17
18
|
import useForkRef from "../utils/useForkRef.js";
|
|
18
19
|
import { styled } from "../zero-styled/index.js";
|
|
19
20
|
import rootShouldForwardProp from "../styles/rootShouldForwardProp.js";
|
|
21
|
+
import { getSelectUtilityClasses } from "./selectClasses.js";
|
|
20
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
23
|
const useUtilityClasses = ownerState => {
|
|
22
24
|
const {
|
|
23
25
|
classes
|
|
24
26
|
} = ownerState;
|
|
25
|
-
|
|
27
|
+
const slots = {
|
|
28
|
+
root: ['root']
|
|
29
|
+
};
|
|
30
|
+
const composedClasses = composeClasses(slots, getSelectUtilityClasses, classes);
|
|
31
|
+
return {
|
|
32
|
+
...classes,
|
|
33
|
+
...composedClasses
|
|
34
|
+
};
|
|
26
35
|
};
|
|
27
36
|
const styledRootConfig = {
|
|
28
37
|
name: 'MuiSelect',
|
|
@@ -443,7 +443,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
443
443
|
ref: handleDisplayRef,
|
|
444
444
|
tabIndex: tabIndex,
|
|
445
445
|
role: "combobox",
|
|
446
|
-
"aria-controls": listboxId,
|
|
446
|
+
"aria-controls": open ? listboxId : undefined,
|
|
447
447
|
"aria-disabled": disabled ? 'true' : undefined,
|
|
448
448
|
"aria-expanded": open ? 'true' : 'false',
|
|
449
449
|
"aria-haspopup": "listbox",
|
|
@@ -188,6 +188,8 @@ export function useSlider(parameters) {
|
|
|
188
188
|
const [open, setOpen] = React.useState(-1);
|
|
189
189
|
const [dragging, setDragging] = React.useState(false);
|
|
190
190
|
const moveCount = React.useRef(0);
|
|
191
|
+
// lastChangedValue is updated whenever onChange is triggered.
|
|
192
|
+
const lastChangedValue = React.useRef(null);
|
|
191
193
|
const [valueDerived, setValueState] = useControlled({
|
|
192
194
|
controlled: valueProp,
|
|
193
195
|
default: defaultValue ?? min,
|
|
@@ -208,6 +210,7 @@ export function useSlider(parameters) {
|
|
|
208
210
|
name
|
|
209
211
|
}
|
|
210
212
|
});
|
|
213
|
+
lastChangedValue.current = value;
|
|
211
214
|
onChange(clonedEvent, value, thumbIndex);
|
|
212
215
|
});
|
|
213
216
|
const range = Array.isArray(valueDerived);
|
|
@@ -279,7 +282,7 @@ export function useSlider(parameters) {
|
|
|
279
282
|
handleChange(event, newValue, index);
|
|
280
283
|
}
|
|
281
284
|
if (onChangeCommitted) {
|
|
282
|
-
onChangeCommitted(event, newValue);
|
|
285
|
+
onChangeCommitted(event, lastChangedValue.current ?? newValue);
|
|
283
286
|
}
|
|
284
287
|
};
|
|
285
288
|
const createHandleHiddenInputKeyDown = otherHandlers => event => {
|
|
@@ -484,7 +487,7 @@ export function useSlider(parameters) {
|
|
|
484
487
|
setOpen(-1);
|
|
485
488
|
}
|
|
486
489
|
if (onChangeCommitted) {
|
|
487
|
-
onChangeCommitted(nativeEvent, newValue);
|
|
490
|
+
onChangeCommitted(nativeEvent, lastChangedValue.current ?? newValue);
|
|
488
491
|
}
|
|
489
492
|
touchId.current = undefined;
|
|
490
493
|
|
|
@@ -11,6 +11,7 @@ import memoTheme from "../utils/memoTheme.js";
|
|
|
11
11
|
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
12
12
|
import capitalize from "../utils/capitalize.js";
|
|
13
13
|
import tableSortLabelClasses, { getTableSortLabelUtilityClass } from "./tableSortLabelClasses.js";
|
|
14
|
+
import useSlot from "../utils/useSlot.js";
|
|
14
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
const useUtilityClasses = ownerState => {
|
|
16
17
|
const {
|
|
@@ -110,6 +111,8 @@ const TableSortLabel = /*#__PURE__*/React.forwardRef(function TableSortLabel(inP
|
|
|
110
111
|
direction = 'asc',
|
|
111
112
|
hideSortIcon = false,
|
|
112
113
|
IconComponent = ArrowDownwardIcon,
|
|
114
|
+
slots = {},
|
|
115
|
+
slotProps = {},
|
|
113
116
|
...other
|
|
114
117
|
} = props;
|
|
115
118
|
const ownerState = {
|
|
@@ -120,17 +123,31 @@ const TableSortLabel = /*#__PURE__*/React.forwardRef(function TableSortLabel(inP
|
|
|
120
123
|
IconComponent
|
|
121
124
|
};
|
|
122
125
|
const classes = useUtilityClasses(ownerState);
|
|
123
|
-
|
|
126
|
+
const externalForwardedProps = {
|
|
127
|
+
slots,
|
|
128
|
+
slotProps
|
|
129
|
+
};
|
|
130
|
+
const [RootSlot, rootProps] = useSlot('root', {
|
|
131
|
+
elementType: TableSortLabelRoot,
|
|
132
|
+
externalForwardedProps,
|
|
133
|
+
ownerState,
|
|
124
134
|
className: clsx(classes.root, className),
|
|
125
|
-
|
|
135
|
+
ref
|
|
136
|
+
});
|
|
137
|
+
const [IconSlot, iconProps] = useSlot('icon', {
|
|
138
|
+
elementType: TableSortLabelIcon,
|
|
139
|
+
externalForwardedProps,
|
|
140
|
+
ownerState,
|
|
141
|
+
className: classes.icon
|
|
142
|
+
});
|
|
143
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
126
144
|
disableRipple: true,
|
|
127
|
-
|
|
128
|
-
|
|
145
|
+
component: "span",
|
|
146
|
+
...rootProps,
|
|
129
147
|
...other,
|
|
130
|
-
children: [children, hideSortIcon && !active ? null : /*#__PURE__*/_jsx(
|
|
148
|
+
children: [children, hideSortIcon && !active ? null : /*#__PURE__*/_jsx(IconSlot, {
|
|
131
149
|
as: IconComponent,
|
|
132
|
-
|
|
133
|
-
ownerState: ownerState
|
|
150
|
+
...iconProps
|
|
134
151
|
})]
|
|
135
152
|
});
|
|
136
153
|
});
|
|
@@ -171,6 +188,22 @@ process.env.NODE_ENV !== "production" ? TableSortLabel.propTypes /* remove-propt
|
|
|
171
188
|
* @default ArrowDownwardIcon
|
|
172
189
|
*/
|
|
173
190
|
IconComponent: PropTypes.elementType,
|
|
191
|
+
/**
|
|
192
|
+
* The props used for each slot inside.
|
|
193
|
+
* @default {}
|
|
194
|
+
*/
|
|
195
|
+
slotProps: PropTypes.shape({
|
|
196
|
+
icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
197
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
198
|
+
}),
|
|
199
|
+
/**
|
|
200
|
+
* The components used for each slot inside.
|
|
201
|
+
* @default {}
|
|
202
|
+
*/
|
|
203
|
+
slots: PropTypes.shape({
|
|
204
|
+
icon: PropTypes.elementType,
|
|
205
|
+
root: PropTypes.elementType
|
|
206
|
+
}),
|
|
174
207
|
/**
|
|
175
208
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
176
209
|
*/
|
|
@@ -379,7 +379,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
379
379
|
// eslint-disable-next-line react-hooks/rules-of-hooks -- process.env never changes
|
|
380
380
|
React.useEffect(() => {
|
|
381
381
|
if (childNode && childNode.disabled && !isControlled && title !== '' && childNode.tagName.toLowerCase() === 'button') {
|
|
382
|
-
console.
|
|
382
|
+
console.warn(['MUI: You are providing a disabled `button` child to the Tooltip component.', 'A disabled element does not fire events.', "Tooltip needs to listen to the child element's events to display the title.", '', 'Add a simple wrapper element, such as a `span`.'].join('\n'));
|
|
383
383
|
}
|
|
384
384
|
}, [title, childNode, isControlled]);
|
|
385
385
|
}
|
package/modern/index.js
CHANGED
package/modern/utils/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export { default as unsupportedProp } from "./unsupportedProp.js";
|
|
|
18
18
|
export { default as useControlled } from "./useControlled.js";
|
|
19
19
|
export { default as useEventCallback } from "./useEventCallback.js";
|
|
20
20
|
export { default as useForkRef } from "./useForkRef.js";
|
|
21
|
+
export { default as mergeSlotProps } from "./mergeSlotProps.js";
|
|
21
22
|
// TODO: remove this export once ClassNameGenerator is stable
|
|
22
23
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
23
24
|
export const unstable_ClassNameGenerator = {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
export default function mergeSlotProps(externalSlotProps, defaultSlotProps) {
|
|
3
|
+
if (!externalSlotProps) {
|
|
4
|
+
return defaultSlotProps;
|
|
5
|
+
}
|
|
6
|
+
if (typeof externalSlotProps === 'function' || typeof defaultSlotProps === 'function') {
|
|
7
|
+
return ownerState => {
|
|
8
|
+
const defaultSlotPropsValue = typeof defaultSlotProps === 'function' ? defaultSlotProps(ownerState) : defaultSlotProps;
|
|
9
|
+
const externalSlotPropsValue = typeof externalSlotProps === 'function' ? externalSlotProps({
|
|
10
|
+
...ownerState,
|
|
11
|
+
...defaultSlotPropsValue
|
|
12
|
+
}) : externalSlotProps;
|
|
13
|
+
const className = clsx(ownerState?.className, defaultSlotPropsValue?.className, externalSlotPropsValue?.className);
|
|
14
|
+
return {
|
|
15
|
+
...defaultSlotPropsValue,
|
|
16
|
+
...externalSlotPropsValue,
|
|
17
|
+
...(!!className && {
|
|
18
|
+
className
|
|
19
|
+
}),
|
|
20
|
+
...(defaultSlotPropsValue?.style && externalSlotPropsValue?.style && {
|
|
21
|
+
style: {
|
|
22
|
+
...defaultSlotPropsValue.style,
|
|
23
|
+
...externalSlotPropsValue.style
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const className = clsx(defaultSlotProps?.className, externalSlotProps?.className);
|
|
30
|
+
return {
|
|
31
|
+
...defaultSlotProps,
|
|
32
|
+
...externalSlotProps,
|
|
33
|
+
...(!!className && {
|
|
34
|
+
className
|
|
35
|
+
}),
|
|
36
|
+
...(defaultSlotProps?.style && externalSlotProps?.style && {
|
|
37
|
+
style: {
|
|
38
|
+
...defaultSlotProps.style,
|
|
39
|
+
...externalSlotProps.style
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
};
|
|
43
|
+
}
|
package/modern/utils/useSlot.js
CHANGED
|
@@ -32,6 +32,7 @@ name, parameters) {
|
|
|
32
32
|
ownerState,
|
|
33
33
|
externalForwardedProps,
|
|
34
34
|
internalForwardedProps,
|
|
35
|
+
shouldForwardComponentProp = false,
|
|
35
36
|
...useSlotPropsParams
|
|
36
37
|
} = parameters;
|
|
37
38
|
const {
|
|
@@ -67,9 +68,12 @@ name, parameters) {
|
|
|
67
68
|
...(name === 'root' && !rootComponent && !slots[name] && internalForwardedProps),
|
|
68
69
|
...(name !== 'root' && !slots[name] && internalForwardedProps),
|
|
69
70
|
...mergedProps,
|
|
70
|
-
...(LeafComponent && {
|
|
71
|
+
...(LeafComponent && !shouldForwardComponentProp && {
|
|
71
72
|
as: LeafComponent
|
|
72
73
|
}),
|
|
74
|
+
...(LeafComponent && shouldForwardComponentProp && {
|
|
75
|
+
component: LeafComponent
|
|
76
|
+
}),
|
|
73
77
|
ref
|
|
74
78
|
}, ownerState);
|
|
75
79
|
return [elementType, props];
|
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.
|
|
1
|
+
export const version = "6.4.0";
|
|
2
2
|
export const major = Number("6");
|
|
3
|
-
export const minor = Number("
|
|
3
|
+
export const minor = Number("4");
|
|
4
4
|
export const patch = Number("0");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
package/node/Alert/Alert.js
CHANGED
|
@@ -194,6 +194,39 @@ const Alert = /*#__PURE__*/React.forwardRef(function Alert(inProps, ref) {
|
|
|
194
194
|
...slotProps
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
|
+
const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
|
|
198
|
+
ref,
|
|
199
|
+
shouldForwardComponentProp: true,
|
|
200
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
201
|
+
elementType: AlertRoot,
|
|
202
|
+
externalForwardedProps: {
|
|
203
|
+
...externalForwardedProps,
|
|
204
|
+
...other
|
|
205
|
+
},
|
|
206
|
+
ownerState,
|
|
207
|
+
additionalProps: {
|
|
208
|
+
role,
|
|
209
|
+
elevation: 0
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
const [IconSlot, iconSlotProps] = (0, _useSlot.default)('icon', {
|
|
213
|
+
className: classes.icon,
|
|
214
|
+
elementType: AlertIcon,
|
|
215
|
+
externalForwardedProps,
|
|
216
|
+
ownerState
|
|
217
|
+
});
|
|
218
|
+
const [MessageSlot, messageSlotProps] = (0, _useSlot.default)('message', {
|
|
219
|
+
className: classes.message,
|
|
220
|
+
elementType: AlertMessage,
|
|
221
|
+
externalForwardedProps,
|
|
222
|
+
ownerState
|
|
223
|
+
});
|
|
224
|
+
const [ActionSlot, actionSlotProps] = (0, _useSlot.default)('action', {
|
|
225
|
+
className: classes.action,
|
|
226
|
+
elementType: AlertAction,
|
|
227
|
+
externalForwardedProps,
|
|
228
|
+
ownerState
|
|
229
|
+
});
|
|
197
230
|
const [CloseButtonSlot, closeButtonProps] = (0, _useSlot.default)('closeButton', {
|
|
198
231
|
elementType: _IconButton.default,
|
|
199
232
|
externalForwardedProps,
|
|
@@ -204,28 +237,19 @@ const Alert = /*#__PURE__*/React.forwardRef(function Alert(inProps, ref) {
|
|
|
204
237
|
externalForwardedProps,
|
|
205
238
|
ownerState
|
|
206
239
|
});
|
|
207
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
className: (0, _clsx.default)(classes.root, className),
|
|
212
|
-
ref: ref,
|
|
213
|
-
...other,
|
|
214
|
-
children: [icon !== false ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AlertIcon, {
|
|
215
|
-
ownerState: ownerState,
|
|
216
|
-
className: classes.icon,
|
|
240
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, {
|
|
241
|
+
...rootSlotProps,
|
|
242
|
+
children: [icon !== false ? /*#__PURE__*/(0, _jsxRuntime.jsx)(IconSlot, {
|
|
243
|
+
...iconSlotProps,
|
|
217
244
|
children: icon || iconMapping[severity] || defaultIconMapping[severity]
|
|
218
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
219
|
-
|
|
220
|
-
className: classes.message,
|
|
245
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(MessageSlot, {
|
|
246
|
+
...messageSlotProps,
|
|
221
247
|
children: children
|
|
222
|
-
}), action != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
223
|
-
|
|
224
|
-
className: classes.action,
|
|
248
|
+
}), action != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionSlot, {
|
|
249
|
+
...actionSlotProps,
|
|
225
250
|
children: action
|
|
226
|
-
}) : null, action == null && onClose ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
227
|
-
|
|
228
|
-
className: classes.action,
|
|
251
|
+
}) : null, action == null && onClose ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionSlot, {
|
|
252
|
+
...actionSlotProps,
|
|
229
253
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(CloseButtonSlot, {
|
|
230
254
|
size: "small",
|
|
231
255
|
"aria-label": closeText,
|
|
@@ -337,16 +361,24 @@ process.env.NODE_ENV !== "production" ? Alert.propTypes /* remove-proptypes */ =
|
|
|
337
361
|
* @default {}
|
|
338
362
|
*/
|
|
339
363
|
slotProps: _propTypes.default.shape({
|
|
364
|
+
action: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
340
365
|
closeButton: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
341
|
-
closeIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
366
|
+
closeIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
367
|
+
icon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
368
|
+
message: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
369
|
+
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
342
370
|
}),
|
|
343
371
|
/**
|
|
344
372
|
* The components used for each slot inside.
|
|
345
373
|
* @default {}
|
|
346
374
|
*/
|
|
347
375
|
slots: _propTypes.default.shape({
|
|
376
|
+
action: _propTypes.default.elementType,
|
|
348
377
|
closeButton: _propTypes.default.elementType,
|
|
349
|
-
closeIcon: _propTypes.default.elementType
|
|
378
|
+
closeIcon: _propTypes.default.elementType,
|
|
379
|
+
icon: _propTypes.default.elementType,
|
|
380
|
+
message: _propTypes.default.elementType,
|
|
381
|
+
root: _propTypes.default.elementType
|
|
350
382
|
}),
|
|
351
383
|
/**
|
|
352
384
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
package/node/AppBar/AppBar.js
CHANGED
|
@@ -221,7 +221,7 @@ process.env.NODE_ENV !== "production" ? AppBar.propTypes /* remove-proptypes */
|
|
|
221
221
|
enableColorOnDark: _propTypes.default.bool,
|
|
222
222
|
/**
|
|
223
223
|
* The positioning type. The behavior of the different options is described
|
|
224
|
-
* [in the MDN web docs](https://developer.mozilla.org/en-US/docs/
|
|
224
|
+
* [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Web/CSS/position).
|
|
225
225
|
* Note: `sticky` is not universally supported and will fall back to `static` when unavailable.
|
|
226
226
|
* @default 'fixed'
|
|
227
227
|
*/
|