@mui/material 6.3.1 → 6.4.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/Alert/Alert.d.ts +69 -0
- package/Alert/Alert.js +53 -21
- package/Autocomplete/Autocomplete.d.ts +1 -1
- 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/ButtonBase/ButtonBase.d.ts +2 -0
- package/ButtonGroup/ButtonGroupButtonContext.js +2 -0
- package/ButtonGroup/ButtonGroupContext.js +2 -0
- package/CHANGELOG.md +91 -0
- package/CardHeader/CardHeader.d.ts +114 -1
- package/CardHeader/CardHeader.js +99 -32
- package/CircularProgress/CircularProgress.js +2 -2
- package/Dialog/Dialog.d.ts +85 -1
- package/Dialog/Dialog.js +91 -20
- package/Dialog/DialogContext.js +2 -0
- package/Drawer/Drawer.js +1 -1
- package/Drawer/drawerClasses.d.ts +32 -8
- package/Drawer/drawerClasses.js +1 -1
- package/FormControl/FormControl.js +9 -7
- package/FormControl/FormControlContext.js +2 -0
- package/Hidden/withWidth.js +2 -0
- package/IconButton/IconButton.d.ts +13 -0
- package/IconButton/IconButton.js +80 -7
- package/IconButton/iconButtonClasses.d.ts +6 -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/RadioGroup/RadioGroupContext.js +2 -0
- package/Select/Select.js +10 -1
- package/Select/SelectInput.js +1 -1
- package/Slider/useSlider.js +5 -2
- package/Step/StepContext.js +2 -0
- package/StepLabel/StepLabel.d.ts +1 -1
- package/Stepper/StepperContext.js +2 -0
- package/Table/Tablelvl2Context.js +2 -0
- package/ToggleButtonGroup/ToggleButtonGroupButtonContext.js +2 -0
- package/ToggleButtonGroup/ToggleButtonGroupContext.js +2 -0
- package/Tooltip/Tooltip.d.ts +1 -1
- package/index.js +1 -1
- package/modern/Alert/Alert.js +53 -21
- package/modern/Button/Button.js +233 -15
- package/modern/Button/buttonClasses.js +1 -1
- package/modern/ButtonGroup/ButtonGroupButtonContext.js +2 -0
- package/modern/ButtonGroup/ButtonGroupContext.js +2 -0
- package/modern/CardHeader/CardHeader.js +99 -32
- package/modern/CircularProgress/CircularProgress.js +2 -2
- package/modern/Dialog/Dialog.js +91 -20
- package/modern/Dialog/DialogContext.js +2 -0
- package/modern/Drawer/Drawer.js +1 -1
- package/modern/Drawer/drawerClasses.js +1 -1
- package/modern/FormControl/FormControl.js +9 -7
- package/modern/FormControl/FormControlContext.js +2 -0
- package/modern/Hidden/withWidth.js +2 -0
- package/modern/IconButton/IconButton.js +80 -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/RadioGroup/RadioGroupContext.js +2 -0
- package/modern/Select/Select.js +10 -1
- package/modern/Select/SelectInput.js +1 -1
- package/modern/Slider/useSlider.js +5 -2
- package/modern/Step/StepContext.js +2 -0
- package/modern/Stepper/StepperContext.js +2 -0
- package/modern/Table/Tablelvl2Context.js +2 -0
- package/modern/ToggleButtonGroup/ToggleButtonGroupButtonContext.js +2 -0
- package/modern/ToggleButtonGroup/ToggleButtonGroupContext.js +2 -0
- 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/Button/Button.js +233 -15
- package/node/Button/buttonClasses.js +1 -1
- package/node/ButtonGroup/ButtonGroupButtonContext.js +1 -0
- package/node/ButtonGroup/ButtonGroupContext.js +1 -0
- package/node/CardHeader/CardHeader.js +99 -32
- package/node/CircularProgress/CircularProgress.js +2 -2
- package/node/Dialog/Dialog.js +91 -20
- package/node/Dialog/DialogContext.js +1 -0
- package/node/Drawer/Drawer.js +1 -1
- package/node/Drawer/drawerClasses.js +1 -1
- package/node/FormControl/FormControl.js +9 -7
- package/node/FormControl/FormControlContext.js +1 -0
- package/node/Hidden/withWidth.js +1 -0
- package/node/IconButton/IconButton.js +79 -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/RadioGroup/RadioGroupContext.js +1 -0
- package/node/Select/Select.js +10 -1
- package/node/Select/SelectInput.js +1 -1
- package/node/Slider/useSlider.js +5 -2
- package/node/Step/StepContext.js +1 -0
- package/node/Stepper/StepperContext.js +1 -0
- package/node/Table/Tablelvl2Context.js +1 -0
- package/node/ToggleButtonGroup/ToggleButtonGroupButtonContext.js +1 -0
- package/node/ToggleButtonGroup/ToggleButtonGroupContext.js +1 -0
- 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 +5 -5
- 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
package/Dialog/Dialog.js
CHANGED
|
@@ -15,6 +15,7 @@ import Backdrop from "../Backdrop/index.js";
|
|
|
15
15
|
import { styled, useTheme } from "../zero-styled/index.js";
|
|
16
16
|
import memoTheme from "../utils/memoTheme.js";
|
|
17
17
|
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
18
|
+
import useSlot from "../utils/useSlot.js";
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
20
|
const DialogBackdrop = styled(Backdrop, {
|
|
20
21
|
name: 'MuiDialog',
|
|
@@ -218,6 +219,8 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(inProps, ref) {
|
|
|
218
219
|
PaperComponent = Paper,
|
|
219
220
|
PaperProps = {},
|
|
220
221
|
scroll = 'paper',
|
|
222
|
+
slots = {},
|
|
223
|
+
slotProps = {},
|
|
221
224
|
TransitionComponent = Fade,
|
|
222
225
|
transitionDuration = defaultTransitionDuration,
|
|
223
226
|
TransitionProps,
|
|
@@ -261,46 +264,89 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(inProps, ref) {
|
|
|
261
264
|
titleId: ariaLabelledby
|
|
262
265
|
};
|
|
263
266
|
}, [ariaLabelledby]);
|
|
264
|
-
|
|
267
|
+
const backwardCompatibleSlots = {
|
|
268
|
+
transition: TransitionComponent,
|
|
269
|
+
...slots
|
|
270
|
+
};
|
|
271
|
+
const backwardCompatibleSlotProps = {
|
|
272
|
+
transition: TransitionProps,
|
|
273
|
+
paper: PaperProps,
|
|
274
|
+
backdrop: BackdropProps,
|
|
275
|
+
...slotProps
|
|
276
|
+
};
|
|
277
|
+
const externalForwardedProps = {
|
|
278
|
+
slots: backwardCompatibleSlots,
|
|
279
|
+
slotProps: backwardCompatibleSlotProps
|
|
280
|
+
};
|
|
281
|
+
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
282
|
+
elementType: DialogRoot,
|
|
283
|
+
shouldForwardComponentProp: true,
|
|
284
|
+
externalForwardedProps,
|
|
285
|
+
ownerState,
|
|
265
286
|
className: clsx(classes.root, className),
|
|
287
|
+
ref
|
|
288
|
+
});
|
|
289
|
+
const [BackdropSlot, backdropSlotProps] = useSlot('backdrop', {
|
|
290
|
+
elementType: DialogBackdrop,
|
|
291
|
+
shouldForwardComponentProp: true,
|
|
292
|
+
externalForwardedProps,
|
|
293
|
+
ownerState
|
|
294
|
+
});
|
|
295
|
+
const [PaperSlot, paperSlotProps] = useSlot('paper', {
|
|
296
|
+
elementType: DialogPaper,
|
|
297
|
+
shouldForwardComponentProp: true,
|
|
298
|
+
externalForwardedProps,
|
|
299
|
+
ownerState,
|
|
300
|
+
className: clsx(classes.paper, PaperProps.className)
|
|
301
|
+
});
|
|
302
|
+
const [ContainerSlot, containerSlotProps] = useSlot('container', {
|
|
303
|
+
elementType: DialogContainer,
|
|
304
|
+
externalForwardedProps,
|
|
305
|
+
ownerState,
|
|
306
|
+
className: clsx(classes.container)
|
|
307
|
+
});
|
|
308
|
+
const [TransitionSlot, transitionSlotProps] = useSlot('transition', {
|
|
309
|
+
elementType: Fade,
|
|
310
|
+
externalForwardedProps,
|
|
311
|
+
ownerState,
|
|
312
|
+
additionalProps: {
|
|
313
|
+
appear: true,
|
|
314
|
+
in: open,
|
|
315
|
+
timeout: transitionDuration,
|
|
316
|
+
role: 'presentation'
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
return /*#__PURE__*/_jsx(RootSlot, {
|
|
266
320
|
closeAfterTransition: true,
|
|
267
|
-
|
|
268
|
-
|
|
321
|
+
slots: {
|
|
322
|
+
backdrop: BackdropSlot
|
|
269
323
|
},
|
|
270
|
-
|
|
324
|
+
slotProps: {
|
|
271
325
|
backdrop: {
|
|
272
326
|
transitionDuration,
|
|
273
327
|
as: BackdropComponent,
|
|
274
|
-
...
|
|
328
|
+
...backdropSlotProps
|
|
275
329
|
}
|
|
276
330
|
},
|
|
277
331
|
disableEscapeKeyDown: disableEscapeKeyDown,
|
|
278
332
|
onClose: onClose,
|
|
279
333
|
open: open,
|
|
280
|
-
ref: ref,
|
|
281
334
|
onClick: handleBackdropClick,
|
|
282
|
-
|
|
335
|
+
...rootSlotProps,
|
|
283
336
|
...other,
|
|
284
|
-
children: /*#__PURE__*/_jsx(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
timeout: transitionDuration,
|
|
288
|
-
role: "presentation",
|
|
289
|
-
...TransitionProps,
|
|
290
|
-
children: /*#__PURE__*/_jsx(DialogContainer, {
|
|
291
|
-
className: clsx(classes.container),
|
|
337
|
+
children: /*#__PURE__*/_jsx(TransitionSlot, {
|
|
338
|
+
...transitionSlotProps,
|
|
339
|
+
children: /*#__PURE__*/_jsx(ContainerSlot, {
|
|
292
340
|
onMouseDown: handleMouseDown,
|
|
293
|
-
|
|
294
|
-
children: /*#__PURE__*/_jsx(
|
|
341
|
+
...containerSlotProps,
|
|
342
|
+
children: /*#__PURE__*/_jsx(PaperSlot, {
|
|
295
343
|
as: PaperComponent,
|
|
296
344
|
elevation: 24,
|
|
297
345
|
role: "dialog",
|
|
298
346
|
"aria-describedby": ariaDescribedby,
|
|
299
347
|
"aria-labelledby": ariaLabelledby,
|
|
300
348
|
"aria-modal": ariaModal,
|
|
301
|
-
...
|
|
302
|
-
className: clsx(classes.paper, PaperProps.className),
|
|
303
|
-
ownerState: ownerState,
|
|
349
|
+
...paperSlotProps,
|
|
304
350
|
children: /*#__PURE__*/_jsx(DialogContext.Provider, {
|
|
305
351
|
value: dialogContextValue,
|
|
306
352
|
children: children
|
|
@@ -412,6 +458,7 @@ process.env.NODE_ENV !== "production" ? Dialog.propTypes /* remove-proptypes */
|
|
|
412
458
|
/**
|
|
413
459
|
* Props applied to the [`Paper`](https://mui.com/material-ui/api/paper/) element.
|
|
414
460
|
* @default {}
|
|
461
|
+
* @deprecated Use `slotProps.paper` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
415
462
|
*/
|
|
416
463
|
PaperProps: PropTypes.object,
|
|
417
464
|
/**
|
|
@@ -419,6 +466,28 @@ process.env.NODE_ENV !== "production" ? Dialog.propTypes /* remove-proptypes */
|
|
|
419
466
|
* @default 'paper'
|
|
420
467
|
*/
|
|
421
468
|
scroll: PropTypes.oneOf(['body', 'paper']),
|
|
469
|
+
/**
|
|
470
|
+
* The props used for each slot inside.
|
|
471
|
+
* @default {}
|
|
472
|
+
*/
|
|
473
|
+
slotProps: PropTypes.shape({
|
|
474
|
+
backdrop: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
475
|
+
container: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
476
|
+
paper: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
477
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
478
|
+
transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
479
|
+
}),
|
|
480
|
+
/**
|
|
481
|
+
* The components used for each slot inside.
|
|
482
|
+
* @default {}
|
|
483
|
+
*/
|
|
484
|
+
slots: PropTypes.shape({
|
|
485
|
+
backdrop: PropTypes.elementType,
|
|
486
|
+
container: PropTypes.elementType,
|
|
487
|
+
paper: PropTypes.elementType,
|
|
488
|
+
root: PropTypes.elementType,
|
|
489
|
+
transition: PropTypes.elementType
|
|
490
|
+
}),
|
|
422
491
|
/**
|
|
423
492
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
424
493
|
*/
|
|
@@ -427,6 +496,7 @@ process.env.NODE_ENV !== "production" ? Dialog.propTypes /* remove-proptypes */
|
|
|
427
496
|
* The component used for the transition.
|
|
428
497
|
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
429
498
|
* @default Fade
|
|
499
|
+
* @deprecated Use `slots.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
430
500
|
*/
|
|
431
501
|
TransitionComponent: PropTypes.elementType,
|
|
432
502
|
/**
|
|
@@ -445,6 +515,7 @@ process.env.NODE_ENV !== "production" ? Dialog.propTypes /* remove-proptypes */
|
|
|
445
515
|
/**
|
|
446
516
|
* Props applied to the transition element.
|
|
447
517
|
* By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
|
|
518
|
+
* @deprecated Use `slotProps.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
448
519
|
*/
|
|
449
520
|
TransitionProps: PropTypes.object
|
|
450
521
|
} : void 0;
|
package/Dialog/DialogContext.js
CHANGED
package/Drawer/Drawer.js
CHANGED
|
@@ -29,7 +29,7 @@ const useUtilityClasses = ownerState => {
|
|
|
29
29
|
variant
|
|
30
30
|
} = ownerState;
|
|
31
31
|
const slots = {
|
|
32
|
-
root: ['root'],
|
|
32
|
+
root: ['root', `anchor${capitalize(anchor)}`],
|
|
33
33
|
docked: [(variant === 'permanent' || variant === 'persistent') && 'docked'],
|
|
34
34
|
modal: ['modal'],
|
|
35
35
|
paper: ['paper', `paperAnchor${capitalize(anchor)}`, variant !== 'temporary' && `paperAnchorDocked${capitalize(anchor)}`]
|
|
@@ -5,21 +5,45 @@ export interface DrawerClasses {
|
|
|
5
5
|
docked: string;
|
|
6
6
|
/** Styles applied to the Paper component. */
|
|
7
7
|
paper: string;
|
|
8
|
-
/** Styles applied to the
|
|
8
|
+
/** Styles applied to the root element if `anchor="left"`. */
|
|
9
|
+
anchorLeft: string;
|
|
10
|
+
/** Styles applied to the root element if `anchor="right"`. */
|
|
11
|
+
anchorRight: string;
|
|
12
|
+
/** Styles applied to the root element if `anchor="top"`. */
|
|
13
|
+
anchorTop: string;
|
|
14
|
+
/** Styles applied to the root element if `anchor="bottom"`. */
|
|
15
|
+
anchorBottom: string;
|
|
16
|
+
/** Styles applied to the Paper component if `anchor="left"`.
|
|
17
|
+
* @deprecated Combine the [.MuiDrawer-anchorLeft](/material-ui/api/drawer/#drawer-classes-MuiDrawer-anchorLeft) and [.MuiDrawer-paper](/material-ui/api/drawer/#drawer-classes-MuiDrawer-paper) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
18
|
+
*/
|
|
9
19
|
paperAnchorLeft: string;
|
|
10
|
-
/** Styles applied to the Paper component if `anchor="right"`.
|
|
20
|
+
/** Styles applied to the Paper component if `anchor="right"`.
|
|
21
|
+
* @deprecated Combine the [.MuiDrawer-anchorRight](/material-ui/api/drawer/#drawer-classes-MuiDrawer-anchorRight) and [.MuiDrawer-paper](/material-ui/api/drawer/#drawer-classes-MuiDrawer-paper) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
22
|
+
*/
|
|
11
23
|
paperAnchorRight: string;
|
|
12
|
-
/** Styles applied to the Paper component if `anchor="top"`.
|
|
24
|
+
/** Styles applied to the Paper component if `anchor="top"`.
|
|
25
|
+
* @deprecated Combine the [.MuiDrawer-anchorTop](/material-ui/api/drawer/#drawer-classes-MuiDrawer-anchorTop) and [.MuiDrawer-paper](/material-ui/api/drawer/#drawer-classes-MuiDrawer-paper) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
26
|
+
*/
|
|
13
27
|
paperAnchorTop: string;
|
|
14
|
-
/** Styles applied to the Paper component if `anchor="bottom"`.
|
|
28
|
+
/** Styles applied to the Paper component if `anchor="bottom"`.
|
|
29
|
+
* @deprecated Combine the [.MuiDrawer-anchorBottom](/material-ui/api/drawer/#drawer-classes-MuiDrawer-anchorBottom) and [.MuiDrawer-paper](/material-ui/api/drawer/#drawer-classes-MuiDrawer-paper) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
30
|
+
*/
|
|
15
31
|
paperAnchorBottom: string;
|
|
16
|
-
/** Styles applied to the Paper component if `anchor="left"` and `variant` is not "temporary".
|
|
32
|
+
/** Styles applied to the Paper component if `anchor="left"` and `variant` is not "temporary".
|
|
33
|
+
* @deprecated Combine the [.MuiDrawer-anchorLeft](/material-ui/api/drawer/#drawer-classes-MuiDrawer-anchorLeft), [.MuiDrawer-docked](/material-ui/api/drawer/#drawer-classes-MuiDrawer-docked) and [.MuiDrawer-paper](/material-ui/api/drawer/#drawer-classes-MuiDrawer-paper) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
34
|
+
*/
|
|
17
35
|
paperAnchorDockedLeft: string;
|
|
18
|
-
/** Styles applied to the Paper component if `anchor="top"` and `variant` is not "temporary".
|
|
36
|
+
/** Styles applied to the Paper component if `anchor="top"` and `variant` is not "temporary".
|
|
37
|
+
* @deprecated Combine the [.MuiDrawer-anchorTop](/material-ui/api/drawer/#drawer-classes-MuiDrawer-anchorTop), [.MuiDrawer-docked](/material-ui/api/drawer/#drawer-classes-MuiDrawer-docked) and [.MuiDrawer-paper](/material-ui/api/drawer/#drawer-classes-MuiDrawer-paper) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
38
|
+
*/
|
|
19
39
|
paperAnchorDockedTop: string;
|
|
20
|
-
/** Styles applied to the Paper component if `anchor="right"` and `variant` is not "temporary".
|
|
40
|
+
/** Styles applied to the Paper component if `anchor="right"` and `variant` is not "temporary".
|
|
41
|
+
* @deprecated Combine the [.MuiDrawer-anchorRight](/material-ui/api/drawer/#drawer-classes-MuiDrawer-anchorRight), [.MuiDrawer-docked](/material-ui/api/drawer/#drawer-classes-MuiDrawer-docked) and [.MuiDrawer-paper](/material-ui/api/drawer/#drawer-classes-MuiDrawer-paper) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
42
|
+
*/
|
|
21
43
|
paperAnchorDockedRight: string;
|
|
22
|
-
/** Styles applied to the Paper component if `anchor="bottom"` and `variant` is not "temporary".
|
|
44
|
+
/** Styles applied to the Paper component if `anchor="bottom"` and `variant` is not "temporary".
|
|
45
|
+
* @deprecated Combine the [.MuiDrawer-anchorBottom](/material-ui/api/drawer/#drawer-classes-MuiDrawer-anchorBottom), [.MuiDrawer-docked](/material-ui/api/drawer/#drawer-classes-MuiDrawer-docked) and [.MuiDrawer-paper](/material-ui/api/drawer/#drawer-classes-MuiDrawer-paper) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
46
|
+
*/
|
|
23
47
|
paperAnchorDockedBottom: string;
|
|
24
48
|
/** Styles applied to the Modal component. */
|
|
25
49
|
modal: string;
|
package/Drawer/drawerClasses.js
CHANGED
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
|
3
3
|
export function getDrawerUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiDrawer', slot);
|
|
5
5
|
}
|
|
6
|
-
const drawerClasses = generateUtilityClasses('MuiDrawer', ['root', 'docked', 'paper', 'paperAnchorLeft', 'paperAnchorRight', 'paperAnchorTop', 'paperAnchorBottom', 'paperAnchorDockedLeft', 'paperAnchorDockedRight', 'paperAnchorDockedTop', 'paperAnchorDockedBottom', 'modal']);
|
|
6
|
+
const drawerClasses = generateUtilityClasses('MuiDrawer', ['root', 'docked', 'paper', 'anchorLeft', 'anchorRight', 'anchorTop', 'anchorBottom', 'paperAnchorLeft', 'paperAnchorRight', 'paperAnchorTop', 'paperAnchorBottom', 'paperAnchorDockedLeft', 'paperAnchorDockedRight', 'paperAnchorDockedTop', 'paperAnchorDockedBottom', 'modal']);
|
|
7
7
|
export default drawerClasses;
|
|
@@ -179,6 +179,12 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
179
179
|
};
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
+
const onFilled = React.useCallback(() => {
|
|
183
|
+
setFilled(true);
|
|
184
|
+
}, []);
|
|
185
|
+
const onEmpty = React.useCallback(() => {
|
|
186
|
+
setFilled(false);
|
|
187
|
+
}, []);
|
|
182
188
|
const childContext = React.useMemo(() => {
|
|
183
189
|
return {
|
|
184
190
|
adornedStart,
|
|
@@ -194,20 +200,16 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
194
200
|
onBlur: () => {
|
|
195
201
|
setFocused(false);
|
|
196
202
|
},
|
|
197
|
-
onEmpty: () => {
|
|
198
|
-
setFilled(false);
|
|
199
|
-
},
|
|
200
|
-
onFilled: () => {
|
|
201
|
-
setFilled(true);
|
|
202
|
-
},
|
|
203
203
|
onFocus: () => {
|
|
204
204
|
setFocused(true);
|
|
205
205
|
},
|
|
206
|
+
onEmpty,
|
|
207
|
+
onFilled,
|
|
206
208
|
registerEffect,
|
|
207
209
|
required,
|
|
208
210
|
variant
|
|
209
211
|
};
|
|
210
|
-
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, required, size, variant]);
|
|
212
|
+
}, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, onEmpty, onFilled, required, size, variant]);
|
|
211
213
|
return /*#__PURE__*/_jsx(FormControlContext.Provider, {
|
|
212
214
|
value: childContext,
|
|
213
215
|
children: /*#__PURE__*/_jsx(FormControlRoot, {
|
package/Hidden/withWidth.js
CHANGED
|
@@ -47,6 +47,19 @@ export interface IconButtonOwnProps {
|
|
|
47
47
|
* @default false
|
|
48
48
|
*/
|
|
49
49
|
edge?: 'start' | 'end' | false;
|
|
50
|
+
/**
|
|
51
|
+
* If `true`, the loading indicator is visible and the button is disabled.
|
|
52
|
+
* If `true | false`, the loading wrapper is always rendered before the children to prevent [Google Translation Crash](https://github.com/mui/material-ui/issues/27853).
|
|
53
|
+
* @default null
|
|
54
|
+
*/
|
|
55
|
+
loading?: boolean | null;
|
|
56
|
+
/**
|
|
57
|
+
* Element placed before the children if the button is in loading state.
|
|
58
|
+
* The node should contain an element with `role="progressbar"` with an accessible name.
|
|
59
|
+
* By default, it renders a `CircularProgress` that is labeled by the button itself.
|
|
60
|
+
* @default <CircularProgress color="inherit" size={16} />
|
|
61
|
+
*/
|
|
62
|
+
loadingIndicator?: React.ReactNode;
|
|
50
63
|
/**
|
|
51
64
|
* The size of the component.
|
|
52
65
|
* `small` is equivalent to the dense button styling.
|
package/IconButton/IconButton.js
CHANGED
|
@@ -5,25 +5,30 @@ 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'],
|
|
31
|
+
loadingWrapper: ['loadingWrapper']
|
|
27
32
|
};
|
|
28
33
|
return composeClasses(slots, getIconButtonUtilityClass, classes);
|
|
29
34
|
};
|
|
@@ -34,7 +39,7 @@ const IconButtonRoot = styled(ButtonBase, {
|
|
|
34
39
|
const {
|
|
35
40
|
ownerState
|
|
36
41
|
} = 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)}`]];
|
|
42
|
+
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
43
|
}
|
|
39
44
|
})(memoTheme(({
|
|
40
45
|
theme
|
|
@@ -137,8 +142,34 @@ const IconButtonRoot = styled(ButtonBase, {
|
|
|
137
142
|
[`&.${iconButtonClasses.disabled}`]: {
|
|
138
143
|
backgroundColor: 'transparent',
|
|
139
144
|
color: (theme.vars || theme).palette.action.disabled
|
|
145
|
+
},
|
|
146
|
+
[`&.${iconButtonClasses.loading}`]: {
|
|
147
|
+
color: 'transparent'
|
|
140
148
|
}
|
|
141
149
|
})));
|
|
150
|
+
const IconButtonLoadingIndicator = styled('span', {
|
|
151
|
+
name: 'MuiIconButton',
|
|
152
|
+
slot: 'LoadingIndicator',
|
|
153
|
+
overridesResolver: (props, styles) => styles.loadingIndicator
|
|
154
|
+
})(({
|
|
155
|
+
theme
|
|
156
|
+
}) => ({
|
|
157
|
+
display: 'none',
|
|
158
|
+
position: 'absolute',
|
|
159
|
+
visibility: 'visible',
|
|
160
|
+
top: '50%',
|
|
161
|
+
left: '50%',
|
|
162
|
+
transform: 'translate(-50%, -50%)',
|
|
163
|
+
color: (theme.vars || theme).palette.action.disabled,
|
|
164
|
+
variants: [{
|
|
165
|
+
props: {
|
|
166
|
+
loading: true
|
|
167
|
+
},
|
|
168
|
+
style: {
|
|
169
|
+
display: 'flex'
|
|
170
|
+
}
|
|
171
|
+
}]
|
|
172
|
+
}));
|
|
142
173
|
|
|
143
174
|
/**
|
|
144
175
|
* Refer to the [Icons](/material-ui/icons/) section of the documentation
|
|
@@ -157,26 +188,51 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(inProps, re
|
|
|
157
188
|
disabled = false,
|
|
158
189
|
disableFocusRipple = false,
|
|
159
190
|
size = 'medium',
|
|
191
|
+
id: idProp,
|
|
192
|
+
loading = null,
|
|
193
|
+
loadingIndicator: loadingIndicatorProp,
|
|
160
194
|
...other
|
|
161
195
|
} = props;
|
|
196
|
+
const id = useId(idProp);
|
|
197
|
+
const loadingIndicator = loadingIndicatorProp ?? /*#__PURE__*/_jsx(CircularProgress, {
|
|
198
|
+
"aria-labelledby": id,
|
|
199
|
+
color: "inherit",
|
|
200
|
+
size: 16
|
|
201
|
+
});
|
|
162
202
|
const ownerState = {
|
|
163
203
|
...props,
|
|
164
204
|
edge,
|
|
165
205
|
color,
|
|
166
206
|
disabled,
|
|
167
207
|
disableFocusRipple,
|
|
208
|
+
loading,
|
|
209
|
+
loadingIndicator,
|
|
168
210
|
size
|
|
169
211
|
};
|
|
170
212
|
const classes = useUtilityClasses(ownerState);
|
|
171
|
-
return /*#__PURE__*/
|
|
213
|
+
return /*#__PURE__*/_jsxs(IconButtonRoot, {
|
|
214
|
+
id: id,
|
|
172
215
|
className: clsx(classes.root, className),
|
|
173
216
|
centerRipple: true,
|
|
174
217
|
focusRipple: !disableFocusRipple,
|
|
175
|
-
disabled: disabled,
|
|
218
|
+
disabled: disabled || loading,
|
|
176
219
|
ref: ref,
|
|
177
220
|
...other,
|
|
178
221
|
ownerState: ownerState,
|
|
179
|
-
children:
|
|
222
|
+
children: [typeof loading === 'boolean' &&
|
|
223
|
+
/*#__PURE__*/
|
|
224
|
+
// use plain HTML span to minimize the runtime overhead
|
|
225
|
+
_jsx("span", {
|
|
226
|
+
className: classes.loadingWrapper,
|
|
227
|
+
style: {
|
|
228
|
+
display: 'contents'
|
|
229
|
+
},
|
|
230
|
+
children: /*#__PURE__*/_jsx(IconButtonLoadingIndicator, {
|
|
231
|
+
className: classes.loadingIndicator,
|
|
232
|
+
ownerState: ownerState,
|
|
233
|
+
children: loading && loadingIndicator
|
|
234
|
+
})
|
|
235
|
+
}), children]
|
|
180
236
|
});
|
|
181
237
|
});
|
|
182
238
|
process.env.NODE_ENV !== "production" ? IconButton.propTypes /* remove-proptypes */ = {
|
|
@@ -235,6 +291,23 @@ process.env.NODE_ENV !== "production" ? IconButton.propTypes /* remove-proptypes
|
|
|
235
291
|
* @default false
|
|
236
292
|
*/
|
|
237
293
|
edge: PropTypes.oneOf(['end', 'start', false]),
|
|
294
|
+
/**
|
|
295
|
+
* @ignore
|
|
296
|
+
*/
|
|
297
|
+
id: PropTypes.string,
|
|
298
|
+
/**
|
|
299
|
+
* If `true`, the loading indicator is visible and the button is disabled.
|
|
300
|
+
* If `true | false`, the loading wrapper is always rendered before the children to prevent [Google Translation Crash](https://github.com/mui/material-ui/issues/27853).
|
|
301
|
+
* @default null
|
|
302
|
+
*/
|
|
303
|
+
loading: PropTypes.bool,
|
|
304
|
+
/**
|
|
305
|
+
* Element placed before the children if the button is in loading state.
|
|
306
|
+
* The node should contain an element with `role="progressbar"` with an accessible name.
|
|
307
|
+
* By default, it renders a `CircularProgress` that is labeled by the button itself.
|
|
308
|
+
* @default <CircularProgress color="inherit" size={16} />
|
|
309
|
+
*/
|
|
310
|
+
loadingIndicator: PropTypes.node,
|
|
238
311
|
/**
|
|
239
312
|
* The size of the component.
|
|
240
313
|
* `small` is equivalent to the dense button styling.
|
|
@@ -27,6 +27,12 @@ export interface IconButtonClasses {
|
|
|
27
27
|
sizeMedium: string;
|
|
28
28
|
/** Styles applied to the root element if `size="large"`. */
|
|
29
29
|
sizeLarge: string;
|
|
30
|
+
/** Styles applied to the root element if `loading={true}`. */
|
|
31
|
+
loading: string;
|
|
32
|
+
/** Styles applied to the loadingIndicator element. */
|
|
33
|
+
loadingIndicator: string;
|
|
34
|
+
/** Styles applied to the loadingWrapper element. */
|
|
35
|
+
loadingWrapper: string;
|
|
30
36
|
}
|
|
31
37
|
export type IconButtonClassKey = keyof IconButtonClasses;
|
|
32
38
|
export declare function getIconButtonUtilityClass(slot: string): string;
|
|
@@ -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', 'loadingWrapper']);
|
|
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
|
|
@@ -15,25 +15,47 @@ export interface LinearProgressClasses {
|
|
|
15
15
|
query: string;
|
|
16
16
|
/** Styles applied to the additional bar element if `variant="buffer"`. */
|
|
17
17
|
dashed: string;
|
|
18
|
-
/** Styles applied to the additional bar element if `variant="buffer"` and `color="primary"`.
|
|
18
|
+
/** Styles applied to the additional bar element if `variant="buffer"` and `color="primary"`.
|
|
19
|
+
* @deprecated Combine the [.MuiLinearProgress-dashed](/material-ui/api/linear-progress/#linear-progress-classes-dashed) and [.MuiLinearProgress-colorPrimary](/material-ui/api/linear-progress/#linear-progress-classes-colorPrimary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
20
|
+
*/
|
|
19
21
|
dashedColorPrimary: string;
|
|
20
|
-
/** Styles applied to the additional bar element if `variant="buffer"` and `color="secondary"`.
|
|
22
|
+
/** Styles applied to the additional bar element if `variant="buffer"` and `color="secondary"`.
|
|
23
|
+
* @deprecated Combine the [.MuiLinearProgress-dashed](/material-ui/api/linear-progress/#linear-progress-classes-dashed) and [.MuiLinearProgress-colorSecondary](/material-ui/api/linear-progress/#linear-progress-classes-colorSecondary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
24
|
+
*/
|
|
21
25
|
dashedColorSecondary: string;
|
|
22
26
|
/** Styles applied to the layered bar1 and bar2 elements. */
|
|
23
27
|
bar: string;
|
|
24
|
-
/** Styles applied to the
|
|
28
|
+
/** Styles applied to the bar1 element. */
|
|
29
|
+
bar1: string;
|
|
30
|
+
/** Styles applied to the bar2 element. */
|
|
31
|
+
bar2: string;
|
|
32
|
+
/** Styles applied to the bar elements if `color="primary"`; bar2 if `variant` not "buffer".
|
|
33
|
+
* @deprecated Use the [.MuiLinearProgress-bar](/material-ui/api/linear-progress/#linear-progress-classes-bar) and [.MuiLinearProgress-colorPrimary](/material-ui/api/linear-progress/#linear-progress-classes-colorPrimary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
34
|
+
*/
|
|
25
35
|
barColorPrimary: string;
|
|
26
|
-
/** Styles applied to the bar elements if `color="secondary"`; bar2 if `variant` not "buffer".
|
|
36
|
+
/** Styles applied to the bar elements if `color="secondary"`; bar2 if `variant` not "buffer".
|
|
37
|
+
* @deprecated Use the [.MuiLinearProgress-bar](/material-ui/api/linear-progress/#linear-progress-classes-bar) and [.MuiLinearProgress-colorSecondary](/material-ui/api/linear-progress/#linear-progress-classes-colorSecondary) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
38
|
+
*/
|
|
27
39
|
barColorSecondary: string;
|
|
28
|
-
/** Styles applied to the bar1 element if `variant="indeterminate or query"`.
|
|
40
|
+
/** Styles applied to the bar1 element if `variant="indeterminate or query"`.
|
|
41
|
+
* @deprecated Use the [.MuiLinearProgress-bar1](/material-ui/api/linear-progress/#linear-progress-classes-bar1) and [.MuiLinearProgress-indeterminate](/material-ui/api/linear-progress/#linear-progress-classes-indeterminate) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
42
|
+
*/
|
|
29
43
|
bar1Indeterminate: string;
|
|
30
|
-
/** Styles applied to the bar1 element if `variant="determinate"`.
|
|
44
|
+
/** Styles applied to the bar1 element if `variant="determinate"`.
|
|
45
|
+
* @deprecated Use the [.MuiLinearProgress-bar1](/material-ui/api/linear-progress/#linear-progress-classes-bar1) and [.MuiLinearProgress-determinate](/material-ui/api/linear-progress/#linear-progress-classes-determinate) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
46
|
+
*/
|
|
31
47
|
bar1Determinate: string;
|
|
32
|
-
/** Styles applied to the bar1 element if `variant="buffer"`.
|
|
48
|
+
/** Styles applied to the bar1 element if `variant="buffer"`.
|
|
49
|
+
* @deprecated Use the [.MuiLinearProgress-bar1](/material-ui/api/linear-progress/#linear-progress-classes-bar1) and [.MuiLinearProgress-buffer](/material-ui/api/linear-progress/#linear-progress-classes-buffer) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
50
|
+
*/
|
|
33
51
|
bar1Buffer: string;
|
|
34
|
-
/** Styles applied to the bar2 element if `variant="indeterminate or query"`.
|
|
52
|
+
/** Styles applied to the bar2 element if `variant="indeterminate or query"`.
|
|
53
|
+
* @deprecated Use the [.MuiLinearProgress-bar2](/material-ui/api/linear-progress/#linear-progress-classes-bar2) and [.MuiLinearProgress-indeterminate](/material-ui/api/linear-progress/#linear-progress-classes-indeterminate) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
54
|
+
*/
|
|
35
55
|
bar2Indeterminate: string;
|
|
36
|
-
/** Styles applied to the bar2 element if `variant="buffer"`.
|
|
56
|
+
/** Styles applied to the bar2 element if `variant="buffer"`.
|
|
57
|
+
* @deprecated Use the [.MuiLinearProgress-bar2](/material-ui/api/linear-progress/#linear-progress-classes-bar2) and [.MuiLinearProgress-buffer](/material-ui/api/linear-progress/#linear-progress-classes-buffer) classes instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
58
|
+
*/
|
|
37
59
|
bar2Buffer: string;
|
|
38
60
|
}
|
|
39
61
|
export type LinearProgressClassKey = keyof LinearProgressClasses;
|
|
@@ -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
|
}
|