@mui/material 6.0.0-alpha.0 → 6.0.0-alpha.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/AppBar/AppBar.js +118 -68
- package/Badge/Badge.d.ts +2 -4
- package/Badge/Badge.js +2 -4
- package/Button/Button.js +220 -131
- package/ButtonBase/ButtonBase.js +2 -2
- package/ButtonBase/Ripple.js +1 -1
- package/ButtonBase/TouchRipple.js +3 -4
- package/ButtonGroup/ButtonGroup.js +167 -70
- package/CHANGELOG.md +129 -2
- package/Grid/Grid.js +3 -0
- package/RadioGroup/RadioGroup.d.ts +0 -2
- package/RadioGroup/RadioGroup.js +23 -2
- package/RadioGroup/index.d.ts +3 -0
- package/RadioGroup/index.js +3 -1
- package/RadioGroup/radioGroupClasses.d.ts +6 -0
- package/RadioGroup/radioGroupClasses.js +7 -0
- package/Slider/Slider.js +22 -22
- package/Table/Table.d.ts +0 -2
- package/Table/Table.js +0 -2
- package/index.js +1 -1
- package/legacy/AppBar/AppBar.js +124 -64
- package/legacy/Badge/Badge.js +2 -4
- package/legacy/Button/Button.js +218 -123
- package/legacy/ButtonBase/ButtonBase.js +2 -2
- package/legacy/ButtonBase/Ripple.js +1 -1
- package/legacy/ButtonBase/TouchRipple.js +3 -4
- package/legacy/ButtonGroup/ButtonGroup.js +163 -68
- package/legacy/Grid/Grid.js +3 -0
- package/legacy/RadioGroup/RadioGroup.js +21 -2
- package/legacy/RadioGroup/index.js +3 -1
- package/legacy/RadioGroup/radioGroupClasses.js +7 -0
- package/legacy/Slider/Slider.js +24 -24
- package/legacy/Table/Table.js +0 -2
- package/legacy/index.js +1 -1
- package/legacy/styles/experimental_extendTheme.js +24 -2
- package/legacy/zero-styled/index.js +1 -0
- package/modern/AppBar/AppBar.js +118 -68
- package/modern/Badge/Badge.js +2 -4
- package/modern/Button/Button.js +220 -131
- package/modern/ButtonBase/ButtonBase.js +2 -2
- package/modern/ButtonBase/Ripple.js +1 -1
- package/modern/ButtonBase/TouchRipple.js +3 -4
- package/modern/ButtonGroup/ButtonGroup.js +167 -70
- package/modern/Grid/Grid.js +3 -0
- package/modern/RadioGroup/RadioGroup.js +23 -2
- package/modern/RadioGroup/index.js +3 -1
- package/modern/RadioGroup/radioGroupClasses.js +7 -0
- package/modern/Slider/Slider.js +22 -22
- package/modern/Table/Table.js +0 -2
- package/modern/index.js +1 -1
- package/modern/styles/experimental_extendTheme.js +24 -2
- package/modern/zero-styled/index.js +1 -0
- package/node/AppBar/AppBar.js +125 -66
- package/node/Badge/Badge.js +2 -4
- package/node/Button/Button.js +224 -135
- package/node/ButtonBase/ButtonBase.js +4 -4
- package/node/ButtonBase/Ripple.js +1 -1
- package/node/ButtonBase/TouchRipple.js +9 -10
- package/node/ButtonGroup/ButtonGroup.js +169 -72
- package/node/Grid/Grid.js +3 -0
- package/node/RadioGroup/RadioGroup.js +23 -2
- package/node/RadioGroup/index.js +25 -1
- package/node/RadioGroup/radioGroupClasses.js +15 -0
- package/node/Slider/Slider.js +25 -25
- package/node/Table/Table.js +0 -2
- package/node/index.js +1 -1
- package/node/styles/experimental_extendTheme.js +24 -2
- package/node/zero-styled/index.js +7 -0
- package/package.json +7 -7
- package/styles/components.d.ts +5 -0
- package/styles/experimental_extendTheme.d.ts +2 -0
- package/styles/experimental_extendTheme.js +24 -2
- package/styles/overrides.d.ts +2 -0
- package/umd/material-ui.development.js +888 -593
- package/umd/material-ui.production.min.js +4 -4
- package/zero-styled/index.d.ts +1 -0
- package/zero-styled/index.js +1 -0
package/AppBar/AppBar.js
CHANGED
|
@@ -7,12 +7,12 @@ import * as React from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
|
-
import styled from '../
|
|
11
|
-
import useThemeProps from '../styles/useThemeProps';
|
|
10
|
+
import { styled, createUseThemeProps } from '../zero-styled';
|
|
12
11
|
import capitalize from '../utils/capitalize';
|
|
13
12
|
import Paper from '../Paper';
|
|
14
13
|
import { getAppBarUtilityClass } from './appBarClasses';
|
|
15
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
const useThemeProps = createUseThemeProps('MuiAppBar');
|
|
16
16
|
const useUtilityClasses = ownerState => {
|
|
17
17
|
const {
|
|
18
18
|
color,
|
|
@@ -38,75 +38,125 @@ const AppBarRoot = styled(Paper, {
|
|
|
38
38
|
return [styles.root, styles[`position${capitalize(ownerState.position)}`], styles[`color${capitalize(ownerState.color)}`]];
|
|
39
39
|
}
|
|
40
40
|
})(({
|
|
41
|
-
theme
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
theme
|
|
42
|
+
}) => ({
|
|
43
|
+
display: 'flex',
|
|
44
|
+
flexDirection: 'column',
|
|
45
|
+
width: '100%',
|
|
46
|
+
boxSizing: 'border-box',
|
|
47
|
+
// Prevent padding issue with the Modal and fixed positioned AppBar.
|
|
48
|
+
flexShrink: 0,
|
|
49
|
+
variants: [{
|
|
50
|
+
props: {
|
|
51
|
+
position: 'fixed'
|
|
52
|
+
},
|
|
53
|
+
style: {
|
|
54
|
+
position: 'fixed',
|
|
55
|
+
zIndex: (theme.vars || theme).zIndex.appBar,
|
|
56
|
+
top: 0,
|
|
57
|
+
left: 'auto',
|
|
58
|
+
right: 0,
|
|
59
|
+
'@media print': {
|
|
60
|
+
// Prevent the app bar to be visible on each printed page.
|
|
61
|
+
position: 'absolute'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
props: {
|
|
60
66
|
position: 'absolute'
|
|
67
|
+
},
|
|
68
|
+
style: {
|
|
69
|
+
position: 'absolute',
|
|
70
|
+
zIndex: (theme.vars || theme).zIndex.appBar,
|
|
71
|
+
top: 0,
|
|
72
|
+
left: 'auto',
|
|
73
|
+
right: 0
|
|
61
74
|
}
|
|
62
|
-
}, ownerState.position === 'absolute' && {
|
|
63
|
-
position: 'absolute',
|
|
64
|
-
zIndex: (theme.vars || theme).zIndex.appBar,
|
|
65
|
-
top: 0,
|
|
66
|
-
left: 'auto',
|
|
67
|
-
right: 0
|
|
68
|
-
}, ownerState.position === 'sticky' && {
|
|
69
|
-
// ⚠️ sticky is not supported by IE11.
|
|
70
|
-
position: 'sticky',
|
|
71
|
-
zIndex: (theme.vars || theme).zIndex.appBar,
|
|
72
|
-
top: 0,
|
|
73
|
-
left: 'auto',
|
|
74
|
-
right: 0
|
|
75
|
-
}, ownerState.position === 'static' && {
|
|
76
|
-
position: 'static'
|
|
77
|
-
}, ownerState.position === 'relative' && {
|
|
78
|
-
position: 'relative'
|
|
79
|
-
}, !theme.vars && _extends({}, ownerState.color === 'default' && {
|
|
80
|
-
backgroundColor: backgroundColorDefault,
|
|
81
|
-
color: theme.palette.getContrastText(backgroundColorDefault)
|
|
82
|
-
}, ownerState.color && ownerState.color !== 'default' && ownerState.color !== 'inherit' && ownerState.color !== 'transparent' && {
|
|
83
|
-
backgroundColor: theme.palette[ownerState.color].main,
|
|
84
|
-
color: theme.palette[ownerState.color].contrastText
|
|
85
|
-
}, ownerState.color === 'inherit' && {
|
|
86
|
-
color: 'inherit'
|
|
87
|
-
}, theme.palette.mode === 'dark' && !ownerState.enableColorOnDark && {
|
|
88
|
-
backgroundColor: null,
|
|
89
|
-
color: null
|
|
90
|
-
}, ownerState.color === 'transparent' && _extends({
|
|
91
|
-
backgroundColor: 'transparent',
|
|
92
|
-
color: 'inherit'
|
|
93
|
-
}, theme.palette.mode === 'dark' && {
|
|
94
|
-
backgroundImage: 'none'
|
|
95
|
-
})), theme.vars && _extends({}, ownerState.color === 'default' && {
|
|
96
|
-
'--AppBar-background': ownerState.enableColorOnDark ? theme.vars.palette.AppBar.defaultBg : joinVars(theme.vars.palette.AppBar.darkBg, theme.vars.palette.AppBar.defaultBg),
|
|
97
|
-
'--AppBar-color': ownerState.enableColorOnDark ? theme.vars.palette.text.primary : joinVars(theme.vars.palette.AppBar.darkColor, theme.vars.palette.text.primary)
|
|
98
|
-
}, ownerState.color && !ownerState.color.match(/^(default|inherit|transparent)$/) && {
|
|
99
|
-
'--AppBar-background': ownerState.enableColorOnDark ? theme.vars.palette[ownerState.color].main : joinVars(theme.vars.palette.AppBar.darkBg, theme.vars.palette[ownerState.color].main),
|
|
100
|
-
'--AppBar-color': ownerState.enableColorOnDark ? theme.vars.palette[ownerState.color].contrastText : joinVars(theme.vars.palette.AppBar.darkColor, theme.vars.palette[ownerState.color].contrastText)
|
|
101
75
|
}, {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
76
|
+
props: {
|
|
77
|
+
position: 'sticky'
|
|
78
|
+
},
|
|
79
|
+
style: {
|
|
80
|
+
// ⚠️ sticky is not supported by IE11.
|
|
81
|
+
position: 'sticky',
|
|
82
|
+
zIndex: (theme.vars || theme).zIndex.appBar,
|
|
83
|
+
top: 0,
|
|
84
|
+
left: 'auto',
|
|
85
|
+
right: 0
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
props: {
|
|
89
|
+
position: 'static'
|
|
90
|
+
},
|
|
91
|
+
style: {
|
|
92
|
+
position: 'static'
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
props: {
|
|
96
|
+
position: 'relative'
|
|
97
|
+
},
|
|
98
|
+
style: {
|
|
99
|
+
position: 'relative'
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
props: {
|
|
103
|
+
color: 'inherit'
|
|
104
|
+
},
|
|
105
|
+
style: {
|
|
106
|
+
'--AppBar-color': 'inherit'
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
109
|
+
props: {
|
|
110
|
+
color: 'default'
|
|
111
|
+
},
|
|
112
|
+
style: _extends({
|
|
113
|
+
'--AppBar-background': theme.vars ? theme.vars.palette.AppBar.defaultBg : theme.palette.grey[100],
|
|
114
|
+
'--AppBar-color': theme.vars ? theme.vars.palette.text.primary : theme.palette.getContrastText(theme.palette.grey[100])
|
|
115
|
+
}, theme.applyStyles('dark', {
|
|
116
|
+
'--AppBar-background': theme.vars ? theme.vars.palette.AppBar.defaultBg : theme.palette.grey[900],
|
|
117
|
+
'--AppBar-color': theme.vars ? theme.vars.palette.text.primary : theme.palette.getContrastText(theme.palette.grey[900])
|
|
118
|
+
}))
|
|
119
|
+
}, ...Object.keys((theme.vars ?? theme).palette).filter(key => (theme.vars ?? theme).palette[key].main && (theme.vars ?? theme).palette[key].contrastText).map(color => ({
|
|
120
|
+
props: {
|
|
121
|
+
color
|
|
122
|
+
},
|
|
123
|
+
style: {
|
|
124
|
+
'--AppBar-background': (theme.vars ?? theme).palette[color].main,
|
|
125
|
+
'--AppBar-color': (theme.vars ?? theme).palette[color].contrastText
|
|
126
|
+
}
|
|
127
|
+
})), {
|
|
128
|
+
props: {
|
|
129
|
+
enableColorOnDark: true
|
|
130
|
+
},
|
|
131
|
+
style: {
|
|
132
|
+
backgroundColor: 'var(--AppBar-background)',
|
|
133
|
+
color: 'var(--AppBar-color)'
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
136
|
+
props: {
|
|
137
|
+
enableColorOnDark: false
|
|
138
|
+
},
|
|
139
|
+
style: _extends({
|
|
140
|
+
backgroundColor: 'var(--AppBar-background)',
|
|
141
|
+
color: 'var(--AppBar-color)'
|
|
142
|
+
}, theme.applyStyles('dark', {
|
|
143
|
+
backgroundColor: theme.vars ? joinVars(theme.vars.palette.AppBar.darkBg, 'var(--AppBar-background)') : null,
|
|
144
|
+
color: theme.vars ? joinVars(theme.vars.palette.AppBar.darkColor, 'var(--AppBar-color)') : null
|
|
145
|
+
}))
|
|
146
|
+
}, {
|
|
147
|
+
props: {
|
|
148
|
+
color: 'transparent'
|
|
149
|
+
},
|
|
150
|
+
style: _extends({
|
|
151
|
+
'--AppBar-background': 'transparent',
|
|
152
|
+
'--AppBar-color': 'inherit',
|
|
153
|
+
backgroundColor: 'var(--AppBar-background)',
|
|
154
|
+
color: 'var(--AppBar-color)'
|
|
155
|
+
}, theme.applyStyles('dark', {
|
|
156
|
+
backgroundImage: 'none'
|
|
157
|
+
}))
|
|
158
|
+
}]
|
|
159
|
+
}));
|
|
110
160
|
const AppBar = /*#__PURE__*/React.forwardRef(function AppBar(inProps, ref) {
|
|
111
161
|
const props = useThemeProps({
|
|
112
162
|
props: inProps,
|
package/Badge/Badge.d.ts
CHANGED
|
@@ -72,8 +72,7 @@ export interface BadgeOwnProps {
|
|
|
72
72
|
* The extra props for the slot components.
|
|
73
73
|
* You can override the existing props or add new ones.
|
|
74
74
|
*
|
|
75
|
-
* This prop
|
|
76
|
-
* It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
|
|
75
|
+
* @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
77
76
|
*
|
|
78
77
|
* @default {}
|
|
79
78
|
*/
|
|
@@ -81,8 +80,7 @@ export interface BadgeOwnProps {
|
|
|
81
80
|
/**
|
|
82
81
|
* The components used for each slot inside.
|
|
83
82
|
*
|
|
84
|
-
* This prop
|
|
85
|
-
* It's recommended to use the `slots` prop instead.
|
|
83
|
+
* @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
86
84
|
*
|
|
87
85
|
* @default {}
|
|
88
86
|
*/
|
package/Badge/Badge.js
CHANGED
|
@@ -351,8 +351,7 @@ process.env.NODE_ENV !== "production" ? Badge.propTypes /* remove-proptypes */ =
|
|
|
351
351
|
/**
|
|
352
352
|
* The components used for each slot inside.
|
|
353
353
|
*
|
|
354
|
-
* This prop
|
|
355
|
-
* It's recommended to use the `slots` prop instead.
|
|
354
|
+
* @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
356
355
|
*
|
|
357
356
|
* @default {}
|
|
358
357
|
*/
|
|
@@ -364,8 +363,7 @@ process.env.NODE_ENV !== "production" ? Badge.propTypes /* remove-proptypes */ =
|
|
|
364
363
|
* The extra props for the slot components.
|
|
365
364
|
* You can override the existing props or add new ones.
|
|
366
365
|
*
|
|
367
|
-
* This prop
|
|
368
|
-
* It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
|
|
366
|
+
* @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
369
367
|
*
|
|
370
368
|
* @default {}
|
|
371
369
|
*/
|
package/Button/Button.js
CHANGED
|
@@ -9,14 +9,15 @@ import clsx from 'clsx';
|
|
|
9
9
|
import resolveProps from '@mui/utils/resolveProps';
|
|
10
10
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
11
|
import { alpha } from '@mui/system/colorManipulator';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import { rootShouldForwardProp } from '../styles/styled';
|
|
13
|
+
import { styled, createUseThemeProps } from '../zero-styled';
|
|
14
14
|
import ButtonBase from '../ButtonBase';
|
|
15
15
|
import capitalize from '../utils/capitalize';
|
|
16
16
|
import buttonClasses, { getButtonUtilityClass } from './buttonClasses';
|
|
17
17
|
import ButtonGroupContext from '../ButtonGroup/ButtonGroupContext';
|
|
18
18
|
import ButtonGroupButtonContext from '../ButtonGroup/ButtonGroupButtonContext';
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
const useThemeProps = createUseThemeProps('MuiButton');
|
|
20
21
|
const useUtilityClasses = ownerState => {
|
|
21
22
|
const {
|
|
22
23
|
color,
|
|
@@ -35,19 +36,34 @@ const useUtilityClasses = ownerState => {
|
|
|
35
36
|
const composedClasses = composeClasses(slots, getButtonUtilityClass, classes);
|
|
36
37
|
return _extends({}, classes, composedClasses);
|
|
37
38
|
};
|
|
38
|
-
const commonIconStyles =
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const commonIconStyles = [{
|
|
40
|
+
props: {
|
|
41
|
+
size: 'small'
|
|
42
|
+
},
|
|
43
|
+
style: {
|
|
44
|
+
'& > *:nth-of-type(1)': {
|
|
45
|
+
fontSize: 18
|
|
46
|
+
}
|
|
41
47
|
}
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
}, {
|
|
49
|
+
props: {
|
|
50
|
+
size: 'medium'
|
|
51
|
+
},
|
|
52
|
+
style: {
|
|
53
|
+
'& > *:nth-of-type(1)': {
|
|
54
|
+
fontSize: 20
|
|
55
|
+
}
|
|
45
56
|
}
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
}, {
|
|
58
|
+
props: {
|
|
59
|
+
size: 'large'
|
|
60
|
+
},
|
|
61
|
+
style: {
|
|
62
|
+
'& > *:nth-of-type(1)': {
|
|
63
|
+
fontSize: 22
|
|
64
|
+
}
|
|
49
65
|
}
|
|
50
|
-
}
|
|
66
|
+
}];
|
|
51
67
|
const ButtonRoot = styled(ButtonBase, {
|
|
52
68
|
shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
|
|
53
69
|
name: 'MuiButton',
|
|
@@ -59,127 +75,192 @@ const ButtonRoot = styled(ButtonBase, {
|
|
|
59
75
|
return [styles.root, styles[ownerState.variant], styles[`${ownerState.variant}${capitalize(ownerState.color)}`], styles[`size${capitalize(ownerState.size)}`], styles[`${ownerState.variant}Size${capitalize(ownerState.size)}`], ownerState.color === 'inherit' && styles.colorInherit, ownerState.disableElevation && styles.disableElevation, ownerState.fullWidth && styles.fullWidth];
|
|
60
76
|
}
|
|
61
77
|
})(({
|
|
62
|
-
theme
|
|
63
|
-
ownerState
|
|
78
|
+
theme
|
|
64
79
|
}) => {
|
|
65
80
|
const inheritContainedBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey[300] : theme.palette.grey[800];
|
|
66
81
|
const inheritContainedHoverBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey.A100 : theme.palette.grey[700];
|
|
67
82
|
return _extends({}, theme.typography.button, {
|
|
68
83
|
minWidth: 64,
|
|
69
84
|
padding: '6px 16px',
|
|
85
|
+
border: 0,
|
|
70
86
|
borderRadius: (theme.vars || theme).shape.borderRadius,
|
|
71
87
|
transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color', 'color'], {
|
|
72
88
|
duration: theme.transitions.duration.short
|
|
73
89
|
}),
|
|
74
|
-
'&:hover':
|
|
75
|
-
textDecoration: 'none'
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
'&:hover': {
|
|
91
|
+
textDecoration: 'none'
|
|
92
|
+
},
|
|
93
|
+
[`&.${buttonClasses.disabled}`]: {
|
|
94
|
+
color: (theme.vars || theme).palette.action.disabled
|
|
95
|
+
},
|
|
96
|
+
variants: [{
|
|
97
|
+
props: {
|
|
98
|
+
variant: 'contained'
|
|
99
|
+
},
|
|
100
|
+
style: {
|
|
101
|
+
color: `var(--variant-containedColor)`,
|
|
102
|
+
backgroundColor: `var(--variant-containedBg)`,
|
|
103
|
+
boxShadow: (theme.vars || theme).shadows[2],
|
|
104
|
+
'&:hover': {
|
|
105
|
+
boxShadow: (theme.vars || theme).shadows[4],
|
|
106
|
+
// Reset on touch devices, it doesn't add specificity
|
|
107
|
+
'@media (hover: none)': {
|
|
108
|
+
boxShadow: (theme.vars || theme).shadows[2]
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
'&:active': {
|
|
112
|
+
boxShadow: (theme.vars || theme).shadows[8]
|
|
113
|
+
},
|
|
114
|
+
[`&.${buttonClasses.focusVisible}`]: {
|
|
115
|
+
boxShadow: (theme.vars || theme).shadows[6]
|
|
116
|
+
},
|
|
117
|
+
[`&.${buttonClasses.disabled}`]: {
|
|
118
|
+
color: (theme.vars || theme).palette.action.disabled,
|
|
119
|
+
boxShadow: (theme.vars || theme).shadows[0],
|
|
120
|
+
backgroundColor: (theme.vars || theme).palette.action.disabledBackground
|
|
121
|
+
}
|
|
80
122
|
}
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
123
|
+
}, {
|
|
124
|
+
props: {
|
|
125
|
+
variant: 'outlined'
|
|
126
|
+
},
|
|
127
|
+
style: {
|
|
128
|
+
padding: '5px 15px',
|
|
129
|
+
border: '1px solid currentColor',
|
|
130
|
+
borderColor: `var(--variant-outlinedBorder, currentColor)`,
|
|
131
|
+
backgroundColor: `var(--variant-outlinedBg)`,
|
|
132
|
+
color: `var(--variant-outlinedColor)`,
|
|
133
|
+
[`&.${buttonClasses.disabled}`]: {
|
|
134
|
+
border: `1px solid ${(theme.vars || theme).palette.action.disabledBackground}`
|
|
135
|
+
}
|
|
86
136
|
}
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
137
|
+
}, {
|
|
138
|
+
props: {
|
|
139
|
+
variant: 'text'
|
|
140
|
+
},
|
|
141
|
+
style: {
|
|
142
|
+
padding: '6px 8px',
|
|
143
|
+
color: `var(--variant-textColor)`,
|
|
144
|
+
backgroundColor: `var(--variant-textBg)`
|
|
93
145
|
}
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
146
|
+
}, ...Object.entries(theme.palette).filter(([, palette]) => palette.main && palette.dark && palette.contrastText).map(([color]) => ({
|
|
147
|
+
props: {
|
|
148
|
+
color
|
|
149
|
+
},
|
|
150
|
+
style: {
|
|
151
|
+
'--variant-textColor': (theme.vars || theme).palette[color].main,
|
|
152
|
+
'--variant-outlinedColor': (theme.vars || theme).palette[color].main,
|
|
153
|
+
'--variant-outlinedBorder': theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / 0.5)` : alpha(theme.palette[color].main, 0.5),
|
|
154
|
+
'--variant-containedColor': (theme.vars || theme).palette[color].contrastText,
|
|
155
|
+
'--variant-containedBg': (theme.vars || theme).palette[color].main,
|
|
156
|
+
'@media (hover: hover)': {
|
|
157
|
+
'&:hover': {
|
|
158
|
+
'--variant-containedBg': (theme.vars || theme).palette[color].dark,
|
|
159
|
+
'--variant-textBg': theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[color].main, theme.palette.action.hoverOpacity),
|
|
160
|
+
'--variant-outlinedBorder': (theme.vars || theme).palette[color].main,
|
|
161
|
+
'--variant-outlinedBg': theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[color].main, theme.palette.action.hoverOpacity)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
101
164
|
}
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
165
|
+
})), {
|
|
166
|
+
props: {
|
|
167
|
+
color: 'inherit'
|
|
168
|
+
},
|
|
169
|
+
style: {
|
|
170
|
+
'--variant-containedColor': theme.vars ?
|
|
171
|
+
// this is safe because grey does not change between default light/dark mode
|
|
172
|
+
theme.vars.palette.text.primary : theme.palette.getContrastText?.(inheritContainedBackgroundColor),
|
|
173
|
+
'--variant-containedBg': theme.vars ? theme.vars.palette.Button.inheritContainedBg : inheritContainedBackgroundColor,
|
|
174
|
+
'@media (hover: hover)': {
|
|
175
|
+
'&:hover': {
|
|
176
|
+
'--variant-containedBg': theme.vars ? theme.vars.palette.Button.inheritContainedHoverBg : inheritContainedHoverBackgroundColor,
|
|
177
|
+
'--variant-textBg': theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity),
|
|
178
|
+
'--variant-outlinedBg': theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
107
181
|
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
182
|
+
}, {
|
|
183
|
+
props: {
|
|
184
|
+
size: 'small',
|
|
185
|
+
variant: 'text'
|
|
186
|
+
},
|
|
187
|
+
style: {
|
|
188
|
+
padding: '4px 5px',
|
|
189
|
+
fontSize: theme.typography.pxToRem(13)
|
|
190
|
+
}
|
|
191
|
+
}, {
|
|
192
|
+
props: {
|
|
193
|
+
size: 'large',
|
|
194
|
+
variant: 'text'
|
|
195
|
+
},
|
|
196
|
+
style: {
|
|
197
|
+
padding: '8px 11px',
|
|
198
|
+
fontSize: theme.typography.pxToRem(15)
|
|
199
|
+
}
|
|
200
|
+
}, {
|
|
201
|
+
props: {
|
|
202
|
+
size: 'small',
|
|
203
|
+
variant: 'outlined'
|
|
204
|
+
},
|
|
205
|
+
style: {
|
|
206
|
+
padding: '3px 9px',
|
|
207
|
+
fontSize: theme.typography.pxToRem(13)
|
|
208
|
+
}
|
|
209
|
+
}, {
|
|
210
|
+
props: {
|
|
211
|
+
size: 'large',
|
|
212
|
+
variant: 'outlined'
|
|
213
|
+
},
|
|
214
|
+
style: {
|
|
215
|
+
padding: '7px 21px',
|
|
216
|
+
fontSize: theme.typography.pxToRem(15)
|
|
217
|
+
}
|
|
218
|
+
}, {
|
|
219
|
+
props: {
|
|
220
|
+
size: 'small',
|
|
221
|
+
variant: 'contained'
|
|
222
|
+
},
|
|
223
|
+
style: {
|
|
224
|
+
padding: '4px 10px',
|
|
225
|
+
fontSize: theme.typography.pxToRem(13)
|
|
226
|
+
}
|
|
227
|
+
}, {
|
|
228
|
+
props: {
|
|
229
|
+
size: 'large',
|
|
230
|
+
variant: 'contained'
|
|
231
|
+
},
|
|
232
|
+
style: {
|
|
233
|
+
padding: '8px 22px',
|
|
234
|
+
fontSize: theme.typography.pxToRem(15)
|
|
235
|
+
}
|
|
236
|
+
}, {
|
|
237
|
+
props: {
|
|
238
|
+
disableElevation: true
|
|
239
|
+
},
|
|
240
|
+
style: {
|
|
241
|
+
boxShadow: 'none',
|
|
242
|
+
'&:hover': {
|
|
243
|
+
boxShadow: 'none'
|
|
244
|
+
},
|
|
245
|
+
[`&.${buttonClasses.focusVisible}`]: {
|
|
246
|
+
boxShadow: 'none'
|
|
247
|
+
},
|
|
248
|
+
'&:active': {
|
|
249
|
+
boxShadow: 'none'
|
|
250
|
+
},
|
|
251
|
+
[`&.${buttonClasses.disabled}`]: {
|
|
252
|
+
boxShadow: 'none'
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}, {
|
|
256
|
+
props: {
|
|
257
|
+
fullWidth: true
|
|
258
|
+
},
|
|
259
|
+
style: {
|
|
260
|
+
width: '100%'
|
|
261
|
+
}
|
|
262
|
+
}]
|
|
166
263
|
});
|
|
167
|
-
}, ({
|
|
168
|
-
ownerState
|
|
169
|
-
}) => ownerState.disableElevation && {
|
|
170
|
-
boxShadow: 'none',
|
|
171
|
-
'&:hover': {
|
|
172
|
-
boxShadow: 'none'
|
|
173
|
-
},
|
|
174
|
-
[`&.${buttonClasses.focusVisible}`]: {
|
|
175
|
-
boxShadow: 'none'
|
|
176
|
-
},
|
|
177
|
-
'&:active': {
|
|
178
|
-
boxShadow: 'none'
|
|
179
|
-
},
|
|
180
|
-
[`&.${buttonClasses.disabled}`]: {
|
|
181
|
-
boxShadow: 'none'
|
|
182
|
-
}
|
|
183
264
|
});
|
|
184
265
|
const ButtonStartIcon = styled('span', {
|
|
185
266
|
name: 'MuiButton',
|
|
@@ -190,15 +271,19 @@ const ButtonStartIcon = styled('span', {
|
|
|
190
271
|
} = props;
|
|
191
272
|
return [styles.startIcon, styles[`iconSize${capitalize(ownerState.size)}`]];
|
|
192
273
|
}
|
|
193
|
-
})(({
|
|
194
|
-
ownerState
|
|
195
|
-
}) => _extends({
|
|
274
|
+
})(() => ({
|
|
196
275
|
display: 'inherit',
|
|
197
276
|
marginRight: 8,
|
|
198
|
-
marginLeft: -4
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
277
|
+
marginLeft: -4,
|
|
278
|
+
variants: [{
|
|
279
|
+
props: {
|
|
280
|
+
size: 'small'
|
|
281
|
+
},
|
|
282
|
+
style: {
|
|
283
|
+
marginLeft: -2
|
|
284
|
+
}
|
|
285
|
+
}, ...commonIconStyles]
|
|
286
|
+
}));
|
|
202
287
|
const ButtonEndIcon = styled('span', {
|
|
203
288
|
name: 'MuiButton',
|
|
204
289
|
slot: 'EndIcon',
|
|
@@ -208,15 +293,19 @@ const ButtonEndIcon = styled('span', {
|
|
|
208
293
|
} = props;
|
|
209
294
|
return [styles.endIcon, styles[`iconSize${capitalize(ownerState.size)}`]];
|
|
210
295
|
}
|
|
211
|
-
})(({
|
|
212
|
-
ownerState
|
|
213
|
-
}) => _extends({
|
|
296
|
+
})(() => ({
|
|
214
297
|
display: 'inherit',
|
|
215
298
|
marginRight: -4,
|
|
216
|
-
marginLeft: 8
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
299
|
+
marginLeft: 8,
|
|
300
|
+
variants: [{
|
|
301
|
+
props: {
|
|
302
|
+
size: 'small'
|
|
303
|
+
},
|
|
304
|
+
style: {
|
|
305
|
+
marginRight: -2
|
|
306
|
+
}
|
|
307
|
+
}, ...commonIconStyles]
|
|
308
|
+
}));
|
|
220
309
|
const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
|
|
221
310
|
// props priority: `inProps` > `contextProps` > `themeDefaultProps`
|
|
222
311
|
const contextProps = React.useContext(ButtonGroupContext);
|