@mui/material 6.1.10 → 6.2.1
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/Autocomplete/Autocomplete.js +6 -6
- package/AvatarGroup/AvatarGroup.js +5 -4
- package/Box/Box.d.ts +3 -1
- package/CHANGELOG.md +72 -2
- package/CardHeader/CardHeader.js +7 -5
- package/FormControl/FormControl.js +5 -8
- package/FormLabel/FormLabel.js +5 -8
- package/Grid/Grid.js +2 -2
- package/ListItemText/ListItemText.d.ts +36 -1
- package/ListItemText/ListItemText.js +46 -7
- package/PigmentGrid/PigmentGrid.js +1 -1
- package/Select/SelectInput.js +8 -0
- package/Slider/useSlider.js +64 -10
- package/TextField/TextField.d.ts +1 -0
- package/TextField/TextField.js +1 -0
- package/index.js +1 -1
- package/modern/Autocomplete/Autocomplete.js +6 -6
- package/modern/AvatarGroup/AvatarGroup.js +5 -4
- package/modern/CardHeader/CardHeader.js +7 -5
- package/modern/FormControl/FormControl.js +5 -8
- package/modern/FormLabel/FormLabel.js +5 -8
- package/modern/Grid/Grid.js +2 -2
- package/modern/ListItemText/ListItemText.js +46 -7
- package/modern/PigmentGrid/PigmentGrid.js +1 -1
- package/modern/Select/SelectInput.js +8 -0
- package/modern/Slider/useSlider.js +64 -10
- package/modern/TextField/TextField.js +1 -0
- package/modern/index.js +1 -1
- package/modern/usePagination/usePagination.js +1 -1
- package/modern/version/index.js +3 -3
- package/node/Autocomplete/Autocomplete.js +6 -6
- package/node/AvatarGroup/AvatarGroup.js +5 -4
- package/node/CardHeader/CardHeader.js +7 -5
- package/node/FormControl/FormControl.js +5 -8
- package/node/FormLabel/FormLabel.js +5 -8
- package/node/Grid/Grid.js +2 -2
- package/node/ListItemText/ListItemText.js +46 -7
- package/node/PigmentGrid/PigmentGrid.js +2 -2
- package/node/Select/SelectInput.js +8 -0
- package/node/Slider/useSlider.js +64 -10
- package/node/TextField/TextField.js +1 -0
- package/node/index.js +1 -1
- package/node/usePagination/usePagination.js +1 -1
- package/node/version/index.js +3 -3
- package/package.json +8 -8
- package/styles/useThemeProps.d.ts +27 -0
- package/useLazyRipple/useLazyRipple.d.ts +1 -1
- package/usePagination/usePagination.js +1 -1
- package/utils/memoTheme.d.ts +1 -1
- package/version/index.js +3 -3
|
@@ -32,14 +32,11 @@ const useUtilityClasses = ownerState => {
|
|
|
32
32
|
export const FormLabelRoot = styled('label', {
|
|
33
33
|
name: 'MuiFormLabel',
|
|
34
34
|
slot: 'Root',
|
|
35
|
-
overridesResolver: ({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
...(ownerState.color === 'secondary' && styles.colorSecondary),
|
|
41
|
-
...(ownerState.filled && styles.filled)
|
|
42
|
-
};
|
|
35
|
+
overridesResolver: (props, styles) => {
|
|
36
|
+
const {
|
|
37
|
+
ownerState
|
|
38
|
+
} = props;
|
|
39
|
+
return [styles.root, ownerState.color === 'secondary' && styles.colorSecondary, ownerState.filled && styles.filled];
|
|
43
40
|
}
|
|
44
41
|
})(memoTheme(({
|
|
45
42
|
theme
|
package/modern/Grid/Grid.js
CHANGED
|
@@ -167,7 +167,7 @@ export function generateRowGap({
|
|
|
167
167
|
const themeSpacing = theme.spacing(propValue);
|
|
168
168
|
if (themeSpacing !== '0px') {
|
|
169
169
|
return {
|
|
170
|
-
marginTop:
|
|
170
|
+
marginTop: `calc(-1 * ${themeSpacing})`,
|
|
171
171
|
[`& > .${gridClasses.item}`]: {
|
|
172
172
|
paddingTop: themeSpacing
|
|
173
173
|
}
|
|
@@ -212,7 +212,7 @@ export function generateColumnGap({
|
|
|
212
212
|
}, columnSpacingValues, (propValue, breakpoint) => {
|
|
213
213
|
const themeSpacing = theme.spacing(propValue);
|
|
214
214
|
if (themeSpacing !== '0px') {
|
|
215
|
-
const negativeValue =
|
|
215
|
+
const negativeValue = `calc(-1 * ${themeSpacing})`;
|
|
216
216
|
return {
|
|
217
217
|
width: `calc(100% + ${themeSpacing})`,
|
|
218
218
|
marginLeft: negativeValue,
|
|
@@ -9,6 +9,7 @@ import ListContext from "../List/ListContext.js";
|
|
|
9
9
|
import { styled } from "../zero-styled/index.js";
|
|
10
10
|
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
11
11
|
import listItemTextClasses, { getListItemTextUtilityClass } from "./listItemTextClasses.js";
|
|
12
|
+
import useSlot from "../utils/useSlot.js";
|
|
12
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
const useUtilityClasses = ownerState => {
|
|
14
15
|
const {
|
|
@@ -80,6 +81,8 @@ const ListItemText = /*#__PURE__*/React.forwardRef(function ListItemText(inProps
|
|
|
80
81
|
primaryTypographyProps,
|
|
81
82
|
secondary: secondaryProp,
|
|
82
83
|
secondaryTypographyProps,
|
|
84
|
+
slots = {},
|
|
85
|
+
slotProps = {},
|
|
83
86
|
...other
|
|
84
87
|
} = props;
|
|
85
88
|
const {
|
|
@@ -96,21 +99,39 @@ const ListItemText = /*#__PURE__*/React.forwardRef(function ListItemText(inProps
|
|
|
96
99
|
dense
|
|
97
100
|
};
|
|
98
101
|
const classes = useUtilityClasses(ownerState);
|
|
102
|
+
const externalForwardedProps = {
|
|
103
|
+
slots,
|
|
104
|
+
slotProps: {
|
|
105
|
+
primary: primaryTypographyProps,
|
|
106
|
+
secondary: secondaryTypographyProps,
|
|
107
|
+
...slotProps
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const [PrimarySlot, primarySlotProps] = useSlot('primary', {
|
|
111
|
+
className: classes.primary,
|
|
112
|
+
elementType: Typography,
|
|
113
|
+
externalForwardedProps,
|
|
114
|
+
ownerState
|
|
115
|
+
});
|
|
116
|
+
const [SecondarySlot, secondarySlotProps] = useSlot('secondary', {
|
|
117
|
+
className: classes.secondary,
|
|
118
|
+
elementType: Typography,
|
|
119
|
+
externalForwardedProps,
|
|
120
|
+
ownerState
|
|
121
|
+
});
|
|
99
122
|
if (primary != null && primary.type !== Typography && !disableTypography) {
|
|
100
|
-
primary = /*#__PURE__*/_jsx(
|
|
123
|
+
primary = /*#__PURE__*/_jsx(PrimarySlot, {
|
|
101
124
|
variant: dense ? 'body2' : 'body1',
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
...primaryTypographyProps,
|
|
125
|
+
component: primarySlotProps?.variant ? undefined : 'span',
|
|
126
|
+
...primarySlotProps,
|
|
105
127
|
children: primary
|
|
106
128
|
});
|
|
107
129
|
}
|
|
108
130
|
if (secondary != null && secondary.type !== Typography && !disableTypography) {
|
|
109
|
-
secondary = /*#__PURE__*/_jsx(
|
|
131
|
+
secondary = /*#__PURE__*/_jsx(SecondarySlot, {
|
|
110
132
|
variant: "body2",
|
|
111
|
-
className: classes.secondary,
|
|
112
133
|
color: "textSecondary",
|
|
113
|
-
...
|
|
134
|
+
...secondarySlotProps,
|
|
114
135
|
children: secondary
|
|
115
136
|
});
|
|
116
137
|
}
|
|
@@ -160,6 +181,7 @@ process.env.NODE_ENV !== "production" ? ListItemText.propTypes /* remove-proptyp
|
|
|
160
181
|
/**
|
|
161
182
|
* These props will be forwarded to the primary typography component
|
|
162
183
|
* (as long as disableTypography is not `true`).
|
|
184
|
+
* @deprecated Use `slotProps.primary` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
163
185
|
*/
|
|
164
186
|
primaryTypographyProps: PropTypes.object,
|
|
165
187
|
/**
|
|
@@ -169,8 +191,25 @@ process.env.NODE_ENV !== "production" ? ListItemText.propTypes /* remove-proptyp
|
|
|
169
191
|
/**
|
|
170
192
|
* These props will be forwarded to the secondary typography component
|
|
171
193
|
* (as long as disableTypography is not `true`).
|
|
194
|
+
* @deprecated Use `slotProps.secondary` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
172
195
|
*/
|
|
173
196
|
secondaryTypographyProps: PropTypes.object,
|
|
197
|
+
/**
|
|
198
|
+
* The props used for each slot inside.
|
|
199
|
+
* @default {}
|
|
200
|
+
*/
|
|
201
|
+
slotProps: PropTypes.shape({
|
|
202
|
+
primary: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
203
|
+
secondary: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
204
|
+
}),
|
|
205
|
+
/**
|
|
206
|
+
* The components used for each slot inside.
|
|
207
|
+
* @default {}
|
|
208
|
+
*/
|
|
209
|
+
slots: PropTypes.shape({
|
|
210
|
+
primary: PropTypes.elementType,
|
|
211
|
+
secondary: PropTypes.elementType
|
|
212
|
+
}),
|
|
174
213
|
/**
|
|
175
214
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
176
215
|
*/
|
|
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import Grid from '@mui/material-pigment-css/Grid';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
7
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
8
|
-
import { generateDirectionClasses, generateSizeClassNames, generateSpacingClassNames } from '@mui/system/Grid
|
|
8
|
+
import { unstable_generateDirectionClasses as generateDirectionClasses, unstable_generateSizeClassNames as generateSizeClassNames, unstable_generateSpacingClassNames as generateSpacingClassNames } from '@mui/system/Grid';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const useUtilityClasses = ownerState => {
|
|
11
11
|
const {
|
|
@@ -133,6 +133,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
133
133
|
open: openProp,
|
|
134
134
|
readOnly,
|
|
135
135
|
renderValue,
|
|
136
|
+
required,
|
|
136
137
|
SelectDisplayProps = {},
|
|
137
138
|
tabIndex: tabIndexProp,
|
|
138
139
|
// catching `type` from Input which makes no sense for SelectInput
|
|
@@ -449,6 +450,8 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
449
450
|
"aria-label": ariaLabel,
|
|
450
451
|
"aria-labelledby": [labelId, buttonId].filter(Boolean).join(' ') || undefined,
|
|
451
452
|
"aria-describedby": ariaDescribedby,
|
|
453
|
+
"aria-required": required ? 'true' : undefined,
|
|
454
|
+
"aria-invalid": error ? 'true' : undefined,
|
|
452
455
|
onKeyDown: handleKeyDown,
|
|
453
456
|
onMouseDown: disabled || readOnly ? null : handleMouseDown,
|
|
454
457
|
onBlur: handleBlur,
|
|
@@ -476,6 +479,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
476
479
|
disabled: disabled,
|
|
477
480
|
className: classes.nativeInput,
|
|
478
481
|
autoFocus: autoFocus,
|
|
482
|
+
required: required,
|
|
479
483
|
...other,
|
|
480
484
|
ownerState: ownerState
|
|
481
485
|
}), /*#__PURE__*/_jsx(SelectIcon, {
|
|
@@ -641,6 +645,10 @@ process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
|
|
|
641
645
|
* @returns {ReactNode}
|
|
642
646
|
*/
|
|
643
647
|
renderValue: PropTypes.func,
|
|
648
|
+
/**
|
|
649
|
+
* If `true`, the component is required.
|
|
650
|
+
*/
|
|
651
|
+
required: PropTypes.bool,
|
|
644
652
|
/**
|
|
645
653
|
* Props applied to the clickable div element.
|
|
646
654
|
*/
|
|
@@ -5,6 +5,9 @@ import { unstable_ownerDocument as ownerDocument, unstable_useControlled as useC
|
|
|
5
5
|
import extractEventHandlers from '@mui/utils/extractEventHandlers';
|
|
6
6
|
import areArraysEqual from "../utils/areArraysEqual.js";
|
|
7
7
|
const INTENTIONAL_DRAG_COUNT_THRESHOLD = 2;
|
|
8
|
+
function getNewValue(currentValue, step, direction, min, max) {
|
|
9
|
+
return direction === 1 ? Math.min(currentValue + step, max) : Math.max(currentValue - step, min);
|
|
10
|
+
}
|
|
8
11
|
function asc(a, b) {
|
|
9
12
|
return a - b;
|
|
10
13
|
}
|
|
@@ -280,20 +283,65 @@ export function useSlider(parameters) {
|
|
|
280
283
|
}
|
|
281
284
|
};
|
|
282
285
|
const createHandleHiddenInputKeyDown = otherHandlers => event => {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (step !== null) {
|
|
286
|
+
if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'PageUp', 'PageDown', 'Home', 'End'].includes(event.key)) {
|
|
287
|
+
event.preventDefault();
|
|
286
288
|
const index = Number(event.currentTarget.getAttribute('data-index'));
|
|
287
289
|
const value = values[index];
|
|
288
290
|
let newValue = null;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
// Keys actions that change the value by more than the most granular `step`
|
|
292
|
+
// value are only applied if the step not `null`.
|
|
293
|
+
// When step is `null`, the `marks` prop is used instead to define valid values.
|
|
294
|
+
if (step != null) {
|
|
295
|
+
const stepSize = event.shiftKey ? shiftStep : step;
|
|
296
|
+
switch (event.key) {
|
|
297
|
+
case 'ArrowUp':
|
|
298
|
+
newValue = getNewValue(value, stepSize, 1, min, max);
|
|
299
|
+
break;
|
|
300
|
+
case 'ArrowRight':
|
|
301
|
+
newValue = getNewValue(value, stepSize, isRtl ? -1 : 1, min, max);
|
|
302
|
+
break;
|
|
303
|
+
case 'ArrowDown':
|
|
304
|
+
newValue = getNewValue(value, stepSize, -1, min, max);
|
|
305
|
+
break;
|
|
306
|
+
case 'ArrowLeft':
|
|
307
|
+
newValue = getNewValue(value, stepSize, isRtl ? 1 : -1, min, max);
|
|
308
|
+
break;
|
|
309
|
+
case 'PageUp':
|
|
310
|
+
newValue = getNewValue(value, shiftStep, 1, min, max);
|
|
311
|
+
break;
|
|
312
|
+
case 'PageDown':
|
|
313
|
+
newValue = getNewValue(value, shiftStep, -1, min, max);
|
|
314
|
+
break;
|
|
315
|
+
case 'Home':
|
|
316
|
+
newValue = min;
|
|
317
|
+
break;
|
|
318
|
+
case 'End':
|
|
319
|
+
newValue = max;
|
|
320
|
+
break;
|
|
321
|
+
default:
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
} else if (marks) {
|
|
325
|
+
const maxMarksValue = marksValues[marksValues.length - 1];
|
|
326
|
+
const currentMarkIndex = marksValues.indexOf(value);
|
|
327
|
+
const decrementKeys = [isRtl ? 'ArrowRight' : 'ArrowLeft', 'ArrowDown', 'PageDown', 'Home'];
|
|
328
|
+
const incrementKeys = [isRtl ? 'ArrowLeft' : 'ArrowRight', 'ArrowUp', 'PageUp', 'End'];
|
|
329
|
+
if (decrementKeys.includes(event.key)) {
|
|
330
|
+
if (currentMarkIndex === 0) {
|
|
331
|
+
newValue = marksValues[0];
|
|
332
|
+
} else {
|
|
333
|
+
newValue = marksValues[currentMarkIndex - 1];
|
|
334
|
+
}
|
|
335
|
+
} else if (incrementKeys.includes(event.key)) {
|
|
336
|
+
if (currentMarkIndex === marksValues.length - 1) {
|
|
337
|
+
newValue = maxMarksValue;
|
|
338
|
+
} else {
|
|
339
|
+
newValue = marksValues[currentMarkIndex + 1];
|
|
340
|
+
}
|
|
341
|
+
}
|
|
293
342
|
}
|
|
294
|
-
if (newValue
|
|
343
|
+
if (newValue != null) {
|
|
295
344
|
changeValue(event, newValue);
|
|
296
|
-
event.preventDefault();
|
|
297
345
|
}
|
|
298
346
|
}
|
|
299
347
|
otherHandlers?.onKeyDown?.(event);
|
|
@@ -315,6 +363,7 @@ export function useSlider(parameters) {
|
|
|
315
363
|
}
|
|
316
364
|
const createHandleHiddenInputChange = otherHandlers => event => {
|
|
317
365
|
otherHandlers.onChange?.(event);
|
|
366
|
+
// this handles value change by Pointer or Touch events
|
|
318
367
|
// @ts-ignore
|
|
319
368
|
changeValue(event, event.target.valueAsNumber);
|
|
320
369
|
};
|
|
@@ -591,6 +640,10 @@ export function useSlider(parameters) {
|
|
|
591
640
|
pointerEvents: active !== -1 && active !== index ? 'none' : undefined
|
|
592
641
|
};
|
|
593
642
|
};
|
|
643
|
+
let cssWritingMode;
|
|
644
|
+
if (orientation === 'vertical') {
|
|
645
|
+
cssWritingMode = isRtl ? 'vertical-rl' : 'vertical-lr';
|
|
646
|
+
}
|
|
594
647
|
const getHiddenInputProps = (externalProps = {}) => {
|
|
595
648
|
const externalHandlers = extractEventHandlers(externalProps);
|
|
596
649
|
const ownEventHandlers = {
|
|
@@ -622,7 +675,8 @@ export function useSlider(parameters) {
|
|
|
622
675
|
direction: isRtl ? 'rtl' : 'ltr',
|
|
623
676
|
// So that VoiceOver's focus indicator matches the thumb's dimensions
|
|
624
677
|
width: '100%',
|
|
625
|
-
height: '100%'
|
|
678
|
+
height: '100%',
|
|
679
|
+
writingMode: cssWritingMode
|
|
626
680
|
}
|
|
627
681
|
};
|
|
628
682
|
};
|
|
@@ -400,6 +400,7 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
400
400
|
SelectProps: PropTypes.object,
|
|
401
401
|
/**
|
|
402
402
|
* The size of the component.
|
|
403
|
+
* @default 'medium'
|
|
403
404
|
*/
|
|
404
405
|
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
405
406
|
/**
|
package/modern/index.js
CHANGED
|
@@ -95,7 +95,7 @@ export default function usePagination(props = {}) {
|
|
|
95
95
|
page: item,
|
|
96
96
|
selected: item === page,
|
|
97
97
|
disabled,
|
|
98
|
-
'aria-current': item === page ? '
|
|
98
|
+
'aria-current': item === page ? 'page' : undefined
|
|
99
99
|
} : {
|
|
100
100
|
onClick: event => {
|
|
101
101
|
handleClick(event, buttonPage(item));
|
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.1
|
|
1
|
+
export const version = "6.2.1";
|
|
2
2
|
export const major = Number("6");
|
|
3
|
-
export const minor = Number("
|
|
4
|
-
export const patch = Number("
|
|
3
|
+
export const minor = Number("2");
|
|
4
|
+
export const patch = Number("1");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
|
@@ -264,12 +264,12 @@ const AutocompleteClearIndicator = (0, _zeroStyled.styled)(_IconButton.default,
|
|
|
264
264
|
const AutocompletePopupIndicator = (0, _zeroStyled.styled)(_IconButton.default, {
|
|
265
265
|
name: 'MuiAutocomplete',
|
|
266
266
|
slot: 'PopupIndicator',
|
|
267
|
-
overridesResolver: ({
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
267
|
+
overridesResolver: (props, styles) => {
|
|
268
|
+
const {
|
|
269
|
+
ownerState
|
|
270
|
+
} = props;
|
|
271
|
+
return [styles.popupIndicator, ownerState.popupOpen && styles.popupIndicatorOpen];
|
|
272
|
+
}
|
|
273
273
|
})({
|
|
274
274
|
padding: 2,
|
|
275
275
|
marginRight: -2,
|
|
@@ -37,10 +37,11 @@ const useUtilityClasses = ownerState => {
|
|
|
37
37
|
const AvatarGroupRoot = (0, _zeroStyled.styled)('div', {
|
|
38
38
|
name: 'MuiAvatarGroup',
|
|
39
39
|
slot: 'Root',
|
|
40
|
-
overridesResolver: (props, styles) =>
|
|
41
|
-
[
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
overridesResolver: (props, styles) => {
|
|
41
|
+
return [{
|
|
42
|
+
[`& .${_avatarGroupClasses.default.avatar}`]: styles.avatar
|
|
43
|
+
}, styles.root];
|
|
44
|
+
}
|
|
44
45
|
})((0, _memoTheme.default)(({
|
|
45
46
|
theme
|
|
46
47
|
}) => ({
|
|
@@ -33,11 +33,13 @@ const useUtilityClasses = ownerState => {
|
|
|
33
33
|
const CardHeaderRoot = (0, _zeroStyled.styled)('div', {
|
|
34
34
|
name: 'MuiCardHeader',
|
|
35
35
|
slot: 'Root',
|
|
36
|
-
overridesResolver: (props, styles) =>
|
|
37
|
-
[
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
overridesResolver: (props, styles) => {
|
|
37
|
+
return [{
|
|
38
|
+
[`& .${_cardHeaderClasses.default.title}`]: styles.title
|
|
39
|
+
}, {
|
|
40
|
+
[`& .${_cardHeaderClasses.default.subheader}`]: styles.subheader
|
|
41
|
+
}, styles.root];
|
|
42
|
+
}
|
|
41
43
|
})({
|
|
42
44
|
display: 'flex',
|
|
43
45
|
alignItems: 'center',
|
|
@@ -33,14 +33,11 @@ const useUtilityClasses = ownerState => {
|
|
|
33
33
|
const FormControlRoot = (0, _zeroStyled.styled)('div', {
|
|
34
34
|
name: 'MuiFormControl',
|
|
35
35
|
slot: 'Root',
|
|
36
|
-
overridesResolver: ({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
...styles[`margin${(0, _capitalize.default)(ownerState.margin)}`],
|
|
42
|
-
...(ownerState.fullWidth && styles.fullWidth)
|
|
43
|
-
};
|
|
36
|
+
overridesResolver: (props, styles) => {
|
|
37
|
+
const {
|
|
38
|
+
ownerState
|
|
39
|
+
} = props;
|
|
40
|
+
return [styles.root, styles[`margin${(0, _capitalize.default)(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth];
|
|
44
41
|
}
|
|
45
42
|
})({
|
|
46
43
|
display: 'inline-flex',
|
|
@@ -39,14 +39,11 @@ const useUtilityClasses = ownerState => {
|
|
|
39
39
|
const FormLabelRoot = exports.FormLabelRoot = (0, _zeroStyled.styled)('label', {
|
|
40
40
|
name: 'MuiFormLabel',
|
|
41
41
|
slot: 'Root',
|
|
42
|
-
overridesResolver: ({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
...(ownerState.color === 'secondary' && styles.colorSecondary),
|
|
48
|
-
...(ownerState.filled && styles.filled)
|
|
49
|
-
};
|
|
42
|
+
overridesResolver: (props, styles) => {
|
|
43
|
+
const {
|
|
44
|
+
ownerState
|
|
45
|
+
} = props;
|
|
46
|
+
return [styles.root, ownerState.color === 'secondary' && styles.colorSecondary, ownerState.filled && styles.filled];
|
|
50
47
|
}
|
|
51
48
|
})((0, _memoTheme.default)(({
|
|
52
49
|
theme
|
package/node/Grid/Grid.js
CHANGED
|
@@ -180,7 +180,7 @@ function generateRowGap({
|
|
|
180
180
|
const themeSpacing = theme.spacing(propValue);
|
|
181
181
|
if (themeSpacing !== '0px') {
|
|
182
182
|
return {
|
|
183
|
-
marginTop:
|
|
183
|
+
marginTop: `calc(-1 * ${themeSpacing})`,
|
|
184
184
|
[`& > .${_gridClasses.default.item}`]: {
|
|
185
185
|
paddingTop: themeSpacing
|
|
186
186
|
}
|
|
@@ -225,7 +225,7 @@ function generateColumnGap({
|
|
|
225
225
|
}, columnSpacingValues, (propValue, breakpoint) => {
|
|
226
226
|
const themeSpacing = theme.spacing(propValue);
|
|
227
227
|
if (themeSpacing !== '0px') {
|
|
228
|
-
const negativeValue =
|
|
228
|
+
const negativeValue = `calc(-1 * ${themeSpacing})`;
|
|
229
229
|
return {
|
|
230
230
|
width: `calc(100% + ${themeSpacing})`,
|
|
231
231
|
marginLeft: negativeValue,
|
|
@@ -16,6 +16,7 @@ var _ListContext = _interopRequireDefault(require("../List/ListContext"));
|
|
|
16
16
|
var _zeroStyled = require("../zero-styled");
|
|
17
17
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
18
18
|
var _listItemTextClasses = _interopRequireWildcard(require("./listItemTextClasses"));
|
|
19
|
+
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
19
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
21
|
const useUtilityClasses = ownerState => {
|
|
21
22
|
const {
|
|
@@ -87,6 +88,8 @@ const ListItemText = /*#__PURE__*/React.forwardRef(function ListItemText(inProps
|
|
|
87
88
|
primaryTypographyProps,
|
|
88
89
|
secondary: secondaryProp,
|
|
89
90
|
secondaryTypographyProps,
|
|
91
|
+
slots = {},
|
|
92
|
+
slotProps = {},
|
|
90
93
|
...other
|
|
91
94
|
} = props;
|
|
92
95
|
const {
|
|
@@ -103,21 +106,39 @@ const ListItemText = /*#__PURE__*/React.forwardRef(function ListItemText(inProps
|
|
|
103
106
|
dense
|
|
104
107
|
};
|
|
105
108
|
const classes = useUtilityClasses(ownerState);
|
|
109
|
+
const externalForwardedProps = {
|
|
110
|
+
slots,
|
|
111
|
+
slotProps: {
|
|
112
|
+
primary: primaryTypographyProps,
|
|
113
|
+
secondary: secondaryTypographyProps,
|
|
114
|
+
...slotProps
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const [PrimarySlot, primarySlotProps] = (0, _useSlot.default)('primary', {
|
|
118
|
+
className: classes.primary,
|
|
119
|
+
elementType: _Typography.default,
|
|
120
|
+
externalForwardedProps,
|
|
121
|
+
ownerState
|
|
122
|
+
});
|
|
123
|
+
const [SecondarySlot, secondarySlotProps] = (0, _useSlot.default)('secondary', {
|
|
124
|
+
className: classes.secondary,
|
|
125
|
+
elementType: _Typography.default,
|
|
126
|
+
externalForwardedProps,
|
|
127
|
+
ownerState
|
|
128
|
+
});
|
|
106
129
|
if (primary != null && primary.type !== _Typography.default && !disableTypography) {
|
|
107
|
-
primary = /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
130
|
+
primary = /*#__PURE__*/(0, _jsxRuntime.jsx)(PrimarySlot, {
|
|
108
131
|
variant: dense ? 'body2' : 'body1',
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
...primaryTypographyProps,
|
|
132
|
+
component: primarySlotProps?.variant ? undefined : 'span',
|
|
133
|
+
...primarySlotProps,
|
|
112
134
|
children: primary
|
|
113
135
|
});
|
|
114
136
|
}
|
|
115
137
|
if (secondary != null && secondary.type !== _Typography.default && !disableTypography) {
|
|
116
|
-
secondary = /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
138
|
+
secondary = /*#__PURE__*/(0, _jsxRuntime.jsx)(SecondarySlot, {
|
|
117
139
|
variant: "body2",
|
|
118
|
-
className: classes.secondary,
|
|
119
140
|
color: "textSecondary",
|
|
120
|
-
...
|
|
141
|
+
...secondarySlotProps,
|
|
121
142
|
children: secondary
|
|
122
143
|
});
|
|
123
144
|
}
|
|
@@ -167,6 +188,7 @@ process.env.NODE_ENV !== "production" ? ListItemText.propTypes /* remove-proptyp
|
|
|
167
188
|
/**
|
|
168
189
|
* These props will be forwarded to the primary typography component
|
|
169
190
|
* (as long as disableTypography is not `true`).
|
|
191
|
+
* @deprecated Use `slotProps.primary` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
170
192
|
*/
|
|
171
193
|
primaryTypographyProps: _propTypes.default.object,
|
|
172
194
|
/**
|
|
@@ -176,8 +198,25 @@ process.env.NODE_ENV !== "production" ? ListItemText.propTypes /* remove-proptyp
|
|
|
176
198
|
/**
|
|
177
199
|
* These props will be forwarded to the secondary typography component
|
|
178
200
|
* (as long as disableTypography is not `true`).
|
|
201
|
+
* @deprecated Use `slotProps.secondary` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
179
202
|
*/
|
|
180
203
|
secondaryTypographyProps: _propTypes.default.object,
|
|
204
|
+
/**
|
|
205
|
+
* The props used for each slot inside.
|
|
206
|
+
* @default {}
|
|
207
|
+
*/
|
|
208
|
+
slotProps: _propTypes.default.shape({
|
|
209
|
+
primary: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
210
|
+
secondary: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
211
|
+
}),
|
|
212
|
+
/**
|
|
213
|
+
* The components used for each slot inside.
|
|
214
|
+
* @default {}
|
|
215
|
+
*/
|
|
216
|
+
slots: _propTypes.default.shape({
|
|
217
|
+
primary: _propTypes.default.elementType,
|
|
218
|
+
secondary: _propTypes.default.elementType
|
|
219
|
+
}),
|
|
181
220
|
/**
|
|
182
221
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
183
222
|
*/
|
|
@@ -12,7 +12,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _Grid = _interopRequireDefault(require("@mui/material-pigment-css/Grid"));
|
|
13
13
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
14
14
|
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
15
|
-
var
|
|
15
|
+
var _Grid2 = require("@mui/system/Grid");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
// @ts-ignore
|
|
18
18
|
|
|
@@ -38,7 +38,7 @@ const useUtilityClasses = ownerState => {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
const slots = {
|
|
41
|
-
root: ['root', container && 'container', ...(0,
|
|
41
|
+
root: ['root', container && 'container', ...(0, _Grid2.unstable_generateDirectionClasses)(direction), ...(0, _Grid2.unstable_generateSizeClassNames)(gridSize), ...(container ? (0, _Grid2.unstable_generateSpacingClassNames)(spacing) : [])]
|
|
42
42
|
};
|
|
43
43
|
return (0, _composeClasses.default)(slots, slot => (0, _generateUtilityClass.default)('MuiGrid2', slot), {});
|
|
44
44
|
};
|
|
@@ -140,6 +140,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
140
140
|
open: openProp,
|
|
141
141
|
readOnly,
|
|
142
142
|
renderValue,
|
|
143
|
+
required,
|
|
143
144
|
SelectDisplayProps = {},
|
|
144
145
|
tabIndex: tabIndexProp,
|
|
145
146
|
// catching `type` from Input which makes no sense for SelectInput
|
|
@@ -456,6 +457,8 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
456
457
|
"aria-label": ariaLabel,
|
|
457
458
|
"aria-labelledby": [labelId, buttonId].filter(Boolean).join(' ') || undefined,
|
|
458
459
|
"aria-describedby": ariaDescribedby,
|
|
460
|
+
"aria-required": required ? 'true' : undefined,
|
|
461
|
+
"aria-invalid": error ? 'true' : undefined,
|
|
459
462
|
onKeyDown: handleKeyDown,
|
|
460
463
|
onMouseDown: disabled || readOnly ? null : handleMouseDown,
|
|
461
464
|
onBlur: handleBlur,
|
|
@@ -483,6 +486,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
483
486
|
disabled: disabled,
|
|
484
487
|
className: classes.nativeInput,
|
|
485
488
|
autoFocus: autoFocus,
|
|
489
|
+
required: required,
|
|
486
490
|
...other,
|
|
487
491
|
ownerState: ownerState
|
|
488
492
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(SelectIcon, {
|
|
@@ -648,6 +652,10 @@ process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
|
|
|
648
652
|
* @returns {ReactNode}
|
|
649
653
|
*/
|
|
650
654
|
renderValue: _propTypes.default.func,
|
|
655
|
+
/**
|
|
656
|
+
* If `true`, the component is required.
|
|
657
|
+
*/
|
|
658
|
+
required: _propTypes.default.bool,
|
|
651
659
|
/**
|
|
652
660
|
* Props applied to the clickable div element.
|
|
653
661
|
*/
|