@mui/lab 6.0.0-beta.22 → 6.0.0-beta.23
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/CHANGELOG.md +49 -0
- package/LoadingButton/LoadingButton.d.ts +2 -80
- package/LoadingButton/LoadingButton.js +15 -304
- package/LoadingButton/index.d.ts +0 -3
- package/LoadingButton/index.js +1 -3
- package/index.js +1 -1
- package/modern/LoadingButton/LoadingButton.js +15 -304
- package/modern/LoadingButton/index.js +1 -3
- package/modern/index.js +1 -1
- package/node/LoadingButton/LoadingButton.js +14 -303
- package/node/LoadingButton/index.js +1 -23
- package/node/index.js +1 -1
- package/package.json +6 -6
- package/LoadingButton/loadingButtonClasses.d.ts +0 -24
- package/LoadingButton/loadingButtonClasses.js +0 -7
- package/modern/LoadingButton/loadingButtonClasses.js +0 -7
- package/node/LoadingButton/loadingButtonClasses.js +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 6.4.0
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.3.1..master -->
|
|
6
|
+
|
|
7
|
+
_Jan 13, 2025_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 16 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- Added [`loading` prop](https://mui.com/material-ui/react-button/#loading-2) to the `Button` and `IconButton` components (#44637) @siriwatknp
|
|
12
|
+
|
|
13
|
+
### `@mui/material@6.4.0`
|
|
14
|
+
|
|
15
|
+
- [Alert] complete `slots` and `slotProps` (#44971) @siriwatknp
|
|
16
|
+
- [Autocomplete] Sync runtime and TS types for key in grouped options (#44862) @aarongarciah
|
|
17
|
+
- [Button] Add `loading` prop (#44637) @siriwatknp
|
|
18
|
+
- [CardHeader] Deprecate `*TypographyProps` and complete `slots`, `slotProps` (#44729) @siriwatknp
|
|
19
|
+
- [CircularProgress] Improve indeterminate animation to be symmetric and smooth (#44934) @yashdev16
|
|
20
|
+
- [LinearProgress] Deprecate composed classes (#44933) @headironc
|
|
21
|
+
- [Link] Fix error for using custom palette with underline (#44927) @siriwatknp
|
|
22
|
+
- [Select] Do not set `aria-controls` when closed (#44919) @siddhantantil39
|
|
23
|
+
- [Select] Add missing root class (#44928) @sai6855
|
|
24
|
+
- [Slider] Set onChangeCommitted to receive the last argument passed to onChange (#44795) @good-jinu
|
|
25
|
+
- Add `mergeSlotProps` for extending components (#44809) @siriwatknp
|
|
26
|
+
- Update `mergeSlotProps` to merge `style` (#44959) @siriwatknp
|
|
27
|
+
- Fix slots typing for Tooltip and StepLabel (#44985) @siriwatknp
|
|
28
|
+
- Remove unnecessary blank lines (#44980) @sai6855
|
|
29
|
+
|
|
30
|
+
### Docs
|
|
31
|
+
|
|
32
|
+
- [docs] Fix Dashboard sidenav sroll (#44876) @oliviertassinari
|
|
33
|
+
- [docs] Fix broken anchor link to w3.org (c51af8e) @oliviertassinari
|
|
34
|
+
- [docs] Add details on complementary Menu components (#44957) @samuelsycamore
|
|
35
|
+
- [docs] Remove misleading messaging on MD3 support (#44953) @mnajdova
|
|
36
|
+
- [docs] Fix code copy button obscuring on small screen sizes (#44861) @ZeeshanTamboli
|
|
37
|
+
- [docs] Remove more instances of Adobe XD (#44956) @samuelsycamore
|
|
38
|
+
- [docs] Remove Adobe XD chips, links, and mentions (#44909) @samuelsycamore
|
|
39
|
+
- [docs] Fix incorrect rendering in Typography docs (#44937) @iaziz11
|
|
40
|
+
|
|
41
|
+
### Core
|
|
42
|
+
|
|
43
|
+
- [core] Remove redundant screenshots (#44877) @oliviertassinari
|
|
44
|
+
- [core] Remove Suspense and clock mocking from regressions and e2e tests (#44935) @DiegoAndai
|
|
45
|
+
- [code-infra] Allow react@18 on `@mui/internal-test-utils` (#45023) @LukasTy
|
|
46
|
+
- [code-infra] Stabilize flaky pigment progressbar tests (#44969) @Janpot
|
|
47
|
+
- [example] Update the CDN example to adapt React 19. (#44979) @IceOfSummer
|
|
48
|
+
- [figma] Clarify that Material UI Sync plugin is experimental (#44975) @oliviertassinari
|
|
49
|
+
|
|
50
|
+
All contributors of this release in alphabetical order: @aarongarciah, @DiegoAndai, @good-jinu, @headironc, @iaziz11, @IceOfSummer, @Janpot, @LukasTy, @mnajdova, @oliviertassinari, @sai6855, @samuelsycamore, @siddhantantil39, @siriwatknp, @yashdev16, @ZeeshanTamboli
|
|
51
|
+
|
|
3
52
|
## 6.3.1
|
|
4
53
|
|
|
5
54
|
<!-- generated comparing v6.3.0..master -->
|
|
@@ -1,80 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Theme } from '@mui/material/styles';
|
|
4
|
-
import { SxProps } from '@mui/system';
|
|
5
|
-
|
|
6
|
-
export interface LoadingButtonOwnProps {
|
|
7
|
-
/**
|
|
8
|
-
* Override or extend the styles applied to the component.
|
|
9
|
-
*/
|
|
10
|
-
classes?: Partial<ButtonClasses> & {
|
|
11
|
-
/** Styles applied to the root element. */
|
|
12
|
-
root?: string;
|
|
13
|
-
/** Styles applied to the span element that wraps the children. */
|
|
14
|
-
label?: string;
|
|
15
|
-
/** Styles applied to the root element if `loading={true}`. */
|
|
16
|
-
loading?: string;
|
|
17
|
-
/** Styles applied to the loadingIndicator element. */
|
|
18
|
-
loadingIndicator?: string;
|
|
19
|
-
/** Styles applied to the loadingIndicator element if `loadingPosition="center"`. */
|
|
20
|
-
loadingIndicatorCenter?: string;
|
|
21
|
-
/** Styles applied to the loadingIndicator element if `loadingPosition="start"`. */
|
|
22
|
-
loadingIndicatorStart?: string;
|
|
23
|
-
/** Styles applied to the loadingIndicator element if `loadingPosition="end"`. */
|
|
24
|
-
loadingIndicatorEnd?: string;
|
|
25
|
-
/** Styles applied to the endIcon element if `loading={true}` and `loadingPosition="end"`. */
|
|
26
|
-
endIconLoadingEnd?: string;
|
|
27
|
-
/** Styles applied to the startIcon element if `loading={true}` and `loadingPosition="start"`. */
|
|
28
|
-
startIconLoadingStart?: string;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* If `true`, the loading indicator is shown and the button becomes disabled.
|
|
32
|
-
* @default false
|
|
33
|
-
*/
|
|
34
|
-
loading?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Element placed before the children if the button is in loading state.
|
|
37
|
-
* The node should contain an element with `role="progressbar"` with an accessible name.
|
|
38
|
-
* By default we render a `CircularProgress` that is labelled by the button itself.
|
|
39
|
-
* @default <CircularProgress color="inherit" size={16} />
|
|
40
|
-
*/
|
|
41
|
-
loadingIndicator?: React.ReactNode;
|
|
42
|
-
/**
|
|
43
|
-
* The loading indicator can be positioned on the start, end, or the center of the button.
|
|
44
|
-
* @default 'center'
|
|
45
|
-
*/
|
|
46
|
-
loadingPosition?: 'start' | 'end' | 'center';
|
|
47
|
-
/**
|
|
48
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
49
|
-
*/
|
|
50
|
-
sx?: SxProps<Theme>;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type LoadingButtonTypeMap<
|
|
54
|
-
AdditionalProps = {},
|
|
55
|
-
RootComponent extends React.ElementType = 'button',
|
|
56
|
-
> = ExtendButtonTypeMap<{
|
|
57
|
-
props: AdditionalProps & LoadingButtonOwnProps;
|
|
58
|
-
defaultComponent: RootComponent;
|
|
59
|
-
}>;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* Demos:
|
|
64
|
-
*
|
|
65
|
-
* - [Button Group](https://mui.com/material-ui/react-button-group/)
|
|
66
|
-
* - [Button](https://mui.com/material-ui/react-button/)
|
|
67
|
-
*
|
|
68
|
-
* API:
|
|
69
|
-
*
|
|
70
|
-
* - [LoadingButton API](https://mui.com/material-ui/api/loading-button/)
|
|
71
|
-
* - inherits [Button API](https://mui.com/material-ui/api/button/)
|
|
72
|
-
*/
|
|
73
|
-
declare const LoadingButton: ExtendButton<LoadingButtonTypeMap>;
|
|
74
|
-
|
|
75
|
-
export type LoadingButtonProps<
|
|
76
|
-
RootComponent extends React.ElementType = LoadingButtonTypeMap['defaultComponent'],
|
|
77
|
-
AdditionalProps = {},
|
|
78
|
-
> = OverrideProps<LoadingButtonTypeMap<AdditionalProps, RootComponent>, RootComponent>;
|
|
79
|
-
|
|
80
|
-
export default LoadingButton;
|
|
1
|
+
export { default } from '@mui/material/Button';
|
|
2
|
+
export * from '@mui/material/Button';
|
|
@@ -1,312 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { chainPropTypes } from '@mui/utils';
|
|
6
|
-
import { capitalize, unstable_useId as useId, unstable_memoTheme as memoTheme } from '@mui/material/utils';
|
|
7
|
-
import { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
8
|
-
import { useDefaultProps } from '@mui/material/DefaultPropsProvider';
|
|
9
4
|
import Button from '@mui/material/Button';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
loading,
|
|
19
|
-
loadingPosition,
|
|
20
|
-
classes
|
|
21
|
-
} = ownerState;
|
|
22
|
-
const slots = {
|
|
23
|
-
root: ['root', loading && 'loading'],
|
|
24
|
-
label: ['label'],
|
|
25
|
-
startIcon: [loading && `startIconLoading${capitalize(loadingPosition)}`],
|
|
26
|
-
endIcon: [loading && `endIconLoading${capitalize(loadingPosition)}`],
|
|
27
|
-
loadingIndicator: ['loadingIndicator', loading && `loadingIndicator${capitalize(loadingPosition)}`]
|
|
28
|
-
};
|
|
29
|
-
const composedClasses = composeClasses(slots, getLoadingButtonUtilityClass, classes);
|
|
30
|
-
return {
|
|
31
|
-
...classes,
|
|
32
|
-
// forward the outlined, color, etc. classes to Button
|
|
33
|
-
...composedClasses
|
|
34
|
-
};
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
let warnedOnce = false;
|
|
7
|
+
const warn = () => {
|
|
8
|
+
if (!warnedOnce) {
|
|
9
|
+
console.warn(['MUI: The LoadingButton component functionality is now part of the Button component from Material UI.', '', "You should use `import Button from '@mui/material/Button'`", "or `import { Button } from '@mui/material'`"].join('\n'));
|
|
10
|
+
warnedOnce = true;
|
|
11
|
+
}
|
|
35
12
|
};
|
|
36
13
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
overridesResolver: (props, styles) => {
|
|
44
|
-
return [styles.root, styles.startIconLoadingStart && {
|
|
45
|
-
[`& .${loadingButtonClasses.startIconLoadingStart}`]: styles.startIconLoadingStart
|
|
46
|
-
}, styles.endIconLoadingEnd && {
|
|
47
|
-
[`& .${loadingButtonClasses.endIconLoadingEnd}`]: styles.endIconLoadingEnd
|
|
48
|
-
}];
|
|
49
|
-
}
|
|
50
|
-
})(memoTheme(({
|
|
51
|
-
theme
|
|
52
|
-
}) => ({
|
|
53
|
-
display: 'inline-flex',
|
|
54
|
-
[`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
|
|
55
|
-
transition: theme.transitions.create(['opacity'], {
|
|
56
|
-
duration: theme.transitions.duration.short
|
|
57
|
-
}),
|
|
58
|
-
opacity: 0
|
|
59
|
-
},
|
|
60
|
-
variants: [{
|
|
61
|
-
props: {
|
|
62
|
-
loadingPosition: 'center'
|
|
63
|
-
},
|
|
64
|
-
style: {
|
|
65
|
-
transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
|
|
66
|
-
duration: theme.transitions.duration.short
|
|
67
|
-
}),
|
|
68
|
-
[`&.${loadingButtonClasses.loading}`]: {
|
|
69
|
-
color: 'transparent'
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
props: ({
|
|
74
|
-
ownerState
|
|
75
|
-
}) => ownerState.loadingPosition === 'start' && ownerState.fullWidth,
|
|
76
|
-
style: {
|
|
77
|
-
[`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
|
|
78
|
-
transition: theme.transitions.create(['opacity'], {
|
|
79
|
-
duration: theme.transitions.duration.short
|
|
80
|
-
}),
|
|
81
|
-
opacity: 0,
|
|
82
|
-
marginRight: -8
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}, {
|
|
86
|
-
props: ({
|
|
87
|
-
ownerState
|
|
88
|
-
}) => ownerState.loadingPosition === 'end' && ownerState.fullWidth,
|
|
89
|
-
style: {
|
|
90
|
-
[`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
|
|
91
|
-
transition: theme.transitions.create(['opacity'], {
|
|
92
|
-
duration: theme.transitions.duration.short
|
|
93
|
-
}),
|
|
94
|
-
opacity: 0,
|
|
95
|
-
marginLeft: -8
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}]
|
|
99
|
-
})));
|
|
100
|
-
const LoadingButtonLoadingIndicator = styled('span', {
|
|
101
|
-
name: 'MuiLoadingButton',
|
|
102
|
-
slot: 'LoadingIndicator',
|
|
103
|
-
overridesResolver: (props, styles) => {
|
|
104
|
-
const {
|
|
105
|
-
ownerState
|
|
106
|
-
} = props;
|
|
107
|
-
return [styles.loadingIndicator, styles[`loadingIndicator${capitalize(ownerState.loadingPosition)}`]];
|
|
108
|
-
}
|
|
109
|
-
})(memoTheme(({
|
|
110
|
-
theme
|
|
111
|
-
}) => ({
|
|
112
|
-
position: 'absolute',
|
|
113
|
-
visibility: 'visible',
|
|
114
|
-
display: 'flex',
|
|
115
|
-
variants: [{
|
|
116
|
-
props: {
|
|
117
|
-
loadingPosition: 'start',
|
|
118
|
-
size: 'small'
|
|
119
|
-
},
|
|
120
|
-
style: {
|
|
121
|
-
left: 10
|
|
122
|
-
}
|
|
123
|
-
}, {
|
|
124
|
-
props: ({
|
|
125
|
-
loadingPosition,
|
|
126
|
-
ownerState
|
|
127
|
-
}) => loadingPosition === 'start' && ownerState.size !== 'small',
|
|
128
|
-
style: {
|
|
129
|
-
left: 14
|
|
130
|
-
}
|
|
131
|
-
}, {
|
|
132
|
-
props: {
|
|
133
|
-
variant: 'text',
|
|
134
|
-
loadingPosition: 'start'
|
|
135
|
-
},
|
|
136
|
-
style: {
|
|
137
|
-
left: 6
|
|
138
|
-
}
|
|
139
|
-
}, {
|
|
140
|
-
props: {
|
|
141
|
-
loadingPosition: 'center'
|
|
142
|
-
},
|
|
143
|
-
style: {
|
|
144
|
-
left: '50%',
|
|
145
|
-
transform: 'translate(-50%)',
|
|
146
|
-
color: (theme.vars || theme).palette.action.disabled
|
|
147
|
-
}
|
|
148
|
-
}, {
|
|
149
|
-
props: {
|
|
150
|
-
loadingPosition: 'end',
|
|
151
|
-
size: 'small'
|
|
152
|
-
},
|
|
153
|
-
style: {
|
|
154
|
-
right: 10
|
|
155
|
-
}
|
|
156
|
-
}, {
|
|
157
|
-
props: ({
|
|
158
|
-
loadingPosition,
|
|
159
|
-
ownerState
|
|
160
|
-
}) => loadingPosition === 'end' && ownerState.size !== 'small',
|
|
161
|
-
style: {
|
|
162
|
-
right: 14
|
|
163
|
-
}
|
|
164
|
-
}, {
|
|
165
|
-
props: {
|
|
166
|
-
variant: 'text',
|
|
167
|
-
loadingPosition: 'end'
|
|
168
|
-
},
|
|
169
|
-
style: {
|
|
170
|
-
right: 6
|
|
171
|
-
}
|
|
172
|
-
}, {
|
|
173
|
-
props: ({
|
|
174
|
-
ownerState
|
|
175
|
-
}) => ownerState.loadingPosition === 'start' && ownerState.fullWidth,
|
|
176
|
-
style: {
|
|
177
|
-
position: 'relative',
|
|
178
|
-
left: -10
|
|
179
|
-
}
|
|
180
|
-
}, {
|
|
181
|
-
props: ({
|
|
182
|
-
ownerState
|
|
183
|
-
}) => ownerState.loadingPosition === 'end' && ownerState.fullWidth,
|
|
184
|
-
style: {
|
|
185
|
-
position: 'relative',
|
|
186
|
-
right: -10
|
|
187
|
-
}
|
|
188
|
-
}]
|
|
189
|
-
})));
|
|
190
|
-
const LoadingButtonLabel = styled('span', {
|
|
191
|
-
name: 'MuiLoadingButton',
|
|
192
|
-
slot: 'Label',
|
|
193
|
-
overridesResolver: (props, styles) => {
|
|
194
|
-
return [styles.label];
|
|
195
|
-
}
|
|
196
|
-
})({
|
|
197
|
-
display: 'inherit',
|
|
198
|
-
alignItems: 'inherit',
|
|
199
|
-
justifyContent: 'inherit'
|
|
200
|
-
});
|
|
201
|
-
const LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton(inProps, ref) {
|
|
202
|
-
const contextProps = React.useContext(ButtonGroupContext);
|
|
203
|
-
const resolvedProps = resolveProps(contextProps, inProps);
|
|
204
|
-
const props = useDefaultProps({
|
|
205
|
-
props: resolvedProps,
|
|
206
|
-
name: 'MuiLoadingButton'
|
|
207
|
-
});
|
|
208
|
-
const {
|
|
209
|
-
children,
|
|
210
|
-
disabled = false,
|
|
211
|
-
id: idProp,
|
|
212
|
-
loading = false,
|
|
213
|
-
loadingIndicator: loadingIndicatorProp,
|
|
214
|
-
loadingPosition = 'center',
|
|
215
|
-
variant = 'text',
|
|
216
|
-
...other
|
|
217
|
-
} = props;
|
|
218
|
-
const id = useId(idProp);
|
|
219
|
-
const loadingIndicator = loadingIndicatorProp ?? /*#__PURE__*/_jsx(CircularProgress, {
|
|
220
|
-
"aria-labelledby": id,
|
|
221
|
-
color: "inherit",
|
|
222
|
-
size: 16
|
|
223
|
-
});
|
|
224
|
-
const ownerState = {
|
|
225
|
-
...props,
|
|
226
|
-
disabled,
|
|
227
|
-
loading,
|
|
228
|
-
loadingIndicator,
|
|
229
|
-
loadingPosition,
|
|
230
|
-
variant
|
|
231
|
-
};
|
|
232
|
-
const classes = useUtilityClasses(ownerState);
|
|
233
|
-
const loadingButtonLoadingIndicator = loading ? /*#__PURE__*/_jsx(LoadingButtonLoadingIndicator, {
|
|
234
|
-
className: classes.loadingIndicator,
|
|
235
|
-
ownerState: ownerState,
|
|
236
|
-
children: loadingIndicator
|
|
237
|
-
}) : null;
|
|
238
|
-
return /*#__PURE__*/_jsxs(LoadingButtonRoot, {
|
|
239
|
-
disabled: disabled || loading,
|
|
240
|
-
id: id,
|
|
14
|
+
/**
|
|
15
|
+
* @ignore - do not document.
|
|
16
|
+
*/
|
|
17
|
+
export default /*#__PURE__*/React.forwardRef(function DeprecatedLoadingButton(props, ref) {
|
|
18
|
+
warn();
|
|
19
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
241
20
|
ref: ref,
|
|
242
|
-
...
|
|
243
|
-
variant: variant,
|
|
244
|
-
classes: classes,
|
|
245
|
-
ownerState: ownerState,
|
|
246
|
-
children: [ownerState.loadingPosition === 'end' ? /*#__PURE__*/_jsx(LoadingButtonLabel, {
|
|
247
|
-
className: classes.label,
|
|
248
|
-
children: children
|
|
249
|
-
}) : loadingButtonLoadingIndicator, ownerState.loadingPosition === 'end' ? loadingButtonLoadingIndicator : /*#__PURE__*/_jsx(LoadingButtonLabel, {
|
|
250
|
-
className: classes.label,
|
|
251
|
-
children: children
|
|
252
|
-
})]
|
|
21
|
+
...props
|
|
253
22
|
});
|
|
254
|
-
});
|
|
255
|
-
process.env.NODE_ENV !== "production" ? LoadingButton.propTypes /* remove-proptypes */ = {
|
|
256
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
257
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
258
|
-
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
259
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
260
|
-
/**
|
|
261
|
-
* The content of the component.
|
|
262
|
-
*/
|
|
263
|
-
children: PropTypes.node,
|
|
264
|
-
/**
|
|
265
|
-
* Override or extend the styles applied to the component.
|
|
266
|
-
*/
|
|
267
|
-
classes: PropTypes.object,
|
|
268
|
-
/**
|
|
269
|
-
* If `true`, the component is disabled.
|
|
270
|
-
* @default false
|
|
271
|
-
*/
|
|
272
|
-
disabled: PropTypes.bool,
|
|
273
|
-
/**
|
|
274
|
-
* @ignore
|
|
275
|
-
*/
|
|
276
|
-
id: PropTypes.string,
|
|
277
|
-
/**
|
|
278
|
-
* If `true`, the loading indicator is shown and the button becomes disabled.
|
|
279
|
-
* @default false
|
|
280
|
-
*/
|
|
281
|
-
loading: PropTypes.bool,
|
|
282
|
-
/**
|
|
283
|
-
* Element placed before the children if the button is in loading state.
|
|
284
|
-
* The node should contain an element with `role="progressbar"` with an accessible name.
|
|
285
|
-
* By default we render a `CircularProgress` that is labelled by the button itself.
|
|
286
|
-
* @default <CircularProgress color="inherit" size={16} />
|
|
287
|
-
*/
|
|
288
|
-
loadingIndicator: PropTypes.node,
|
|
289
|
-
/**
|
|
290
|
-
* The loading indicator can be positioned on the start, end, or the center of the button.
|
|
291
|
-
* @default 'center'
|
|
292
|
-
*/
|
|
293
|
-
loadingPosition: chainPropTypes(PropTypes.oneOf(['start', 'end', 'center']), props => {
|
|
294
|
-
if (props.loadingPosition === 'start' && !props.startIcon) {
|
|
295
|
-
return new Error(`MUI: The loadingPosition="start" should be used in combination with startIcon.`);
|
|
296
|
-
}
|
|
297
|
-
if (props.loadingPosition === 'end' && !props.endIcon) {
|
|
298
|
-
return new Error(`MUI: The loadingPosition="end" should be used in combination with endIcon.`);
|
|
299
|
-
}
|
|
300
|
-
return null;
|
|
301
|
-
}),
|
|
302
|
-
/**
|
|
303
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
304
|
-
*/
|
|
305
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
306
|
-
/**
|
|
307
|
-
* The variant to use.
|
|
308
|
-
* @default 'text'
|
|
309
|
-
*/
|
|
310
|
-
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['contained', 'outlined', 'text']), PropTypes.string])
|
|
311
|
-
} : void 0;
|
|
312
|
-
export default LoadingButton;
|
|
23
|
+
});
|
package/LoadingButton/index.d.ts
CHANGED
package/LoadingButton/index.js
CHANGED
package/index.js
CHANGED
|
@@ -1,312 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { chainPropTypes } from '@mui/utils';
|
|
6
|
-
import { capitalize, unstable_useId as useId, unstable_memoTheme as memoTheme } from '@mui/material/utils';
|
|
7
|
-
import { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
8
|
-
import { useDefaultProps } from '@mui/material/DefaultPropsProvider';
|
|
9
4
|
import Button from '@mui/material/Button';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
loading,
|
|
19
|
-
loadingPosition,
|
|
20
|
-
classes
|
|
21
|
-
} = ownerState;
|
|
22
|
-
const slots = {
|
|
23
|
-
root: ['root', loading && 'loading'],
|
|
24
|
-
label: ['label'],
|
|
25
|
-
startIcon: [loading && `startIconLoading${capitalize(loadingPosition)}`],
|
|
26
|
-
endIcon: [loading && `endIconLoading${capitalize(loadingPosition)}`],
|
|
27
|
-
loadingIndicator: ['loadingIndicator', loading && `loadingIndicator${capitalize(loadingPosition)}`]
|
|
28
|
-
};
|
|
29
|
-
const composedClasses = composeClasses(slots, getLoadingButtonUtilityClass, classes);
|
|
30
|
-
return {
|
|
31
|
-
...classes,
|
|
32
|
-
// forward the outlined, color, etc. classes to Button
|
|
33
|
-
...composedClasses
|
|
34
|
-
};
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
let warnedOnce = false;
|
|
7
|
+
const warn = () => {
|
|
8
|
+
if (!warnedOnce) {
|
|
9
|
+
console.warn(['MUI: The LoadingButton component functionality is now part of the Button component from Material UI.', '', "You should use `import Button from '@mui/material/Button'`", "or `import { Button } from '@mui/material'`"].join('\n'));
|
|
10
|
+
warnedOnce = true;
|
|
11
|
+
}
|
|
35
12
|
};
|
|
36
13
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
overridesResolver: (props, styles) => {
|
|
44
|
-
return [styles.root, styles.startIconLoadingStart && {
|
|
45
|
-
[`& .${loadingButtonClasses.startIconLoadingStart}`]: styles.startIconLoadingStart
|
|
46
|
-
}, styles.endIconLoadingEnd && {
|
|
47
|
-
[`& .${loadingButtonClasses.endIconLoadingEnd}`]: styles.endIconLoadingEnd
|
|
48
|
-
}];
|
|
49
|
-
}
|
|
50
|
-
})(memoTheme(({
|
|
51
|
-
theme
|
|
52
|
-
}) => ({
|
|
53
|
-
display: 'inline-flex',
|
|
54
|
-
[`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
|
|
55
|
-
transition: theme.transitions.create(['opacity'], {
|
|
56
|
-
duration: theme.transitions.duration.short
|
|
57
|
-
}),
|
|
58
|
-
opacity: 0
|
|
59
|
-
},
|
|
60
|
-
variants: [{
|
|
61
|
-
props: {
|
|
62
|
-
loadingPosition: 'center'
|
|
63
|
-
},
|
|
64
|
-
style: {
|
|
65
|
-
transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
|
|
66
|
-
duration: theme.transitions.duration.short
|
|
67
|
-
}),
|
|
68
|
-
[`&.${loadingButtonClasses.loading}`]: {
|
|
69
|
-
color: 'transparent'
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
props: ({
|
|
74
|
-
ownerState
|
|
75
|
-
}) => ownerState.loadingPosition === 'start' && ownerState.fullWidth,
|
|
76
|
-
style: {
|
|
77
|
-
[`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
|
|
78
|
-
transition: theme.transitions.create(['opacity'], {
|
|
79
|
-
duration: theme.transitions.duration.short
|
|
80
|
-
}),
|
|
81
|
-
opacity: 0,
|
|
82
|
-
marginRight: -8
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}, {
|
|
86
|
-
props: ({
|
|
87
|
-
ownerState
|
|
88
|
-
}) => ownerState.loadingPosition === 'end' && ownerState.fullWidth,
|
|
89
|
-
style: {
|
|
90
|
-
[`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
|
|
91
|
-
transition: theme.transitions.create(['opacity'], {
|
|
92
|
-
duration: theme.transitions.duration.short
|
|
93
|
-
}),
|
|
94
|
-
opacity: 0,
|
|
95
|
-
marginLeft: -8
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}]
|
|
99
|
-
})));
|
|
100
|
-
const LoadingButtonLoadingIndicator = styled('span', {
|
|
101
|
-
name: 'MuiLoadingButton',
|
|
102
|
-
slot: 'LoadingIndicator',
|
|
103
|
-
overridesResolver: (props, styles) => {
|
|
104
|
-
const {
|
|
105
|
-
ownerState
|
|
106
|
-
} = props;
|
|
107
|
-
return [styles.loadingIndicator, styles[`loadingIndicator${capitalize(ownerState.loadingPosition)}`]];
|
|
108
|
-
}
|
|
109
|
-
})(memoTheme(({
|
|
110
|
-
theme
|
|
111
|
-
}) => ({
|
|
112
|
-
position: 'absolute',
|
|
113
|
-
visibility: 'visible',
|
|
114
|
-
display: 'flex',
|
|
115
|
-
variants: [{
|
|
116
|
-
props: {
|
|
117
|
-
loadingPosition: 'start',
|
|
118
|
-
size: 'small'
|
|
119
|
-
},
|
|
120
|
-
style: {
|
|
121
|
-
left: 10
|
|
122
|
-
}
|
|
123
|
-
}, {
|
|
124
|
-
props: ({
|
|
125
|
-
loadingPosition,
|
|
126
|
-
ownerState
|
|
127
|
-
}) => loadingPosition === 'start' && ownerState.size !== 'small',
|
|
128
|
-
style: {
|
|
129
|
-
left: 14
|
|
130
|
-
}
|
|
131
|
-
}, {
|
|
132
|
-
props: {
|
|
133
|
-
variant: 'text',
|
|
134
|
-
loadingPosition: 'start'
|
|
135
|
-
},
|
|
136
|
-
style: {
|
|
137
|
-
left: 6
|
|
138
|
-
}
|
|
139
|
-
}, {
|
|
140
|
-
props: {
|
|
141
|
-
loadingPosition: 'center'
|
|
142
|
-
},
|
|
143
|
-
style: {
|
|
144
|
-
left: '50%',
|
|
145
|
-
transform: 'translate(-50%)',
|
|
146
|
-
color: (theme.vars || theme).palette.action.disabled
|
|
147
|
-
}
|
|
148
|
-
}, {
|
|
149
|
-
props: {
|
|
150
|
-
loadingPosition: 'end',
|
|
151
|
-
size: 'small'
|
|
152
|
-
},
|
|
153
|
-
style: {
|
|
154
|
-
right: 10
|
|
155
|
-
}
|
|
156
|
-
}, {
|
|
157
|
-
props: ({
|
|
158
|
-
loadingPosition,
|
|
159
|
-
ownerState
|
|
160
|
-
}) => loadingPosition === 'end' && ownerState.size !== 'small',
|
|
161
|
-
style: {
|
|
162
|
-
right: 14
|
|
163
|
-
}
|
|
164
|
-
}, {
|
|
165
|
-
props: {
|
|
166
|
-
variant: 'text',
|
|
167
|
-
loadingPosition: 'end'
|
|
168
|
-
},
|
|
169
|
-
style: {
|
|
170
|
-
right: 6
|
|
171
|
-
}
|
|
172
|
-
}, {
|
|
173
|
-
props: ({
|
|
174
|
-
ownerState
|
|
175
|
-
}) => ownerState.loadingPosition === 'start' && ownerState.fullWidth,
|
|
176
|
-
style: {
|
|
177
|
-
position: 'relative',
|
|
178
|
-
left: -10
|
|
179
|
-
}
|
|
180
|
-
}, {
|
|
181
|
-
props: ({
|
|
182
|
-
ownerState
|
|
183
|
-
}) => ownerState.loadingPosition === 'end' && ownerState.fullWidth,
|
|
184
|
-
style: {
|
|
185
|
-
position: 'relative',
|
|
186
|
-
right: -10
|
|
187
|
-
}
|
|
188
|
-
}]
|
|
189
|
-
})));
|
|
190
|
-
const LoadingButtonLabel = styled('span', {
|
|
191
|
-
name: 'MuiLoadingButton',
|
|
192
|
-
slot: 'Label',
|
|
193
|
-
overridesResolver: (props, styles) => {
|
|
194
|
-
return [styles.label];
|
|
195
|
-
}
|
|
196
|
-
})({
|
|
197
|
-
display: 'inherit',
|
|
198
|
-
alignItems: 'inherit',
|
|
199
|
-
justifyContent: 'inherit'
|
|
200
|
-
});
|
|
201
|
-
const LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton(inProps, ref) {
|
|
202
|
-
const contextProps = React.useContext(ButtonGroupContext);
|
|
203
|
-
const resolvedProps = resolveProps(contextProps, inProps);
|
|
204
|
-
const props = useDefaultProps({
|
|
205
|
-
props: resolvedProps,
|
|
206
|
-
name: 'MuiLoadingButton'
|
|
207
|
-
});
|
|
208
|
-
const {
|
|
209
|
-
children,
|
|
210
|
-
disabled = false,
|
|
211
|
-
id: idProp,
|
|
212
|
-
loading = false,
|
|
213
|
-
loadingIndicator: loadingIndicatorProp,
|
|
214
|
-
loadingPosition = 'center',
|
|
215
|
-
variant = 'text',
|
|
216
|
-
...other
|
|
217
|
-
} = props;
|
|
218
|
-
const id = useId(idProp);
|
|
219
|
-
const loadingIndicator = loadingIndicatorProp ?? /*#__PURE__*/_jsx(CircularProgress, {
|
|
220
|
-
"aria-labelledby": id,
|
|
221
|
-
color: "inherit",
|
|
222
|
-
size: 16
|
|
223
|
-
});
|
|
224
|
-
const ownerState = {
|
|
225
|
-
...props,
|
|
226
|
-
disabled,
|
|
227
|
-
loading,
|
|
228
|
-
loadingIndicator,
|
|
229
|
-
loadingPosition,
|
|
230
|
-
variant
|
|
231
|
-
};
|
|
232
|
-
const classes = useUtilityClasses(ownerState);
|
|
233
|
-
const loadingButtonLoadingIndicator = loading ? /*#__PURE__*/_jsx(LoadingButtonLoadingIndicator, {
|
|
234
|
-
className: classes.loadingIndicator,
|
|
235
|
-
ownerState: ownerState,
|
|
236
|
-
children: loadingIndicator
|
|
237
|
-
}) : null;
|
|
238
|
-
return /*#__PURE__*/_jsxs(LoadingButtonRoot, {
|
|
239
|
-
disabled: disabled || loading,
|
|
240
|
-
id: id,
|
|
14
|
+
/**
|
|
15
|
+
* @ignore - do not document.
|
|
16
|
+
*/
|
|
17
|
+
export default /*#__PURE__*/React.forwardRef(function DeprecatedLoadingButton(props, ref) {
|
|
18
|
+
warn();
|
|
19
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
241
20
|
ref: ref,
|
|
242
|
-
...
|
|
243
|
-
variant: variant,
|
|
244
|
-
classes: classes,
|
|
245
|
-
ownerState: ownerState,
|
|
246
|
-
children: [ownerState.loadingPosition === 'end' ? /*#__PURE__*/_jsx(LoadingButtonLabel, {
|
|
247
|
-
className: classes.label,
|
|
248
|
-
children: children
|
|
249
|
-
}) : loadingButtonLoadingIndicator, ownerState.loadingPosition === 'end' ? loadingButtonLoadingIndicator : /*#__PURE__*/_jsx(LoadingButtonLabel, {
|
|
250
|
-
className: classes.label,
|
|
251
|
-
children: children
|
|
252
|
-
})]
|
|
21
|
+
...props
|
|
253
22
|
});
|
|
254
|
-
});
|
|
255
|
-
process.env.NODE_ENV !== "production" ? LoadingButton.propTypes /* remove-proptypes */ = {
|
|
256
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
257
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
258
|
-
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
259
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
260
|
-
/**
|
|
261
|
-
* The content of the component.
|
|
262
|
-
*/
|
|
263
|
-
children: PropTypes.node,
|
|
264
|
-
/**
|
|
265
|
-
* Override or extend the styles applied to the component.
|
|
266
|
-
*/
|
|
267
|
-
classes: PropTypes.object,
|
|
268
|
-
/**
|
|
269
|
-
* If `true`, the component is disabled.
|
|
270
|
-
* @default false
|
|
271
|
-
*/
|
|
272
|
-
disabled: PropTypes.bool,
|
|
273
|
-
/**
|
|
274
|
-
* @ignore
|
|
275
|
-
*/
|
|
276
|
-
id: PropTypes.string,
|
|
277
|
-
/**
|
|
278
|
-
* If `true`, the loading indicator is shown and the button becomes disabled.
|
|
279
|
-
* @default false
|
|
280
|
-
*/
|
|
281
|
-
loading: PropTypes.bool,
|
|
282
|
-
/**
|
|
283
|
-
* Element placed before the children if the button is in loading state.
|
|
284
|
-
* The node should contain an element with `role="progressbar"` with an accessible name.
|
|
285
|
-
* By default we render a `CircularProgress` that is labelled by the button itself.
|
|
286
|
-
* @default <CircularProgress color="inherit" size={16} />
|
|
287
|
-
*/
|
|
288
|
-
loadingIndicator: PropTypes.node,
|
|
289
|
-
/**
|
|
290
|
-
* The loading indicator can be positioned on the start, end, or the center of the button.
|
|
291
|
-
* @default 'center'
|
|
292
|
-
*/
|
|
293
|
-
loadingPosition: chainPropTypes(PropTypes.oneOf(['start', 'end', 'center']), props => {
|
|
294
|
-
if (props.loadingPosition === 'start' && !props.startIcon) {
|
|
295
|
-
return new Error(`MUI: The loadingPosition="start" should be used in combination with startIcon.`);
|
|
296
|
-
}
|
|
297
|
-
if (props.loadingPosition === 'end' && !props.endIcon) {
|
|
298
|
-
return new Error(`MUI: The loadingPosition="end" should be used in combination with endIcon.`);
|
|
299
|
-
}
|
|
300
|
-
return null;
|
|
301
|
-
}),
|
|
302
|
-
/**
|
|
303
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
304
|
-
*/
|
|
305
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
306
|
-
/**
|
|
307
|
-
* The variant to use.
|
|
308
|
-
* @default 'text'
|
|
309
|
-
*/
|
|
310
|
-
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['contained', 'outlined', 'text']), PropTypes.string])
|
|
311
|
-
} : void 0;
|
|
312
|
-
export default LoadingButton;
|
|
23
|
+
});
|
package/modern/index.js
CHANGED
|
@@ -8,312 +8,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
});
|
|
9
9
|
exports.default = void 0;
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var _utils = require("@mui/utils");
|
|
13
|
-
var _utils2 = require("@mui/material/utils");
|
|
14
|
-
var _base = require("@mui/base");
|
|
15
|
-
var _DefaultPropsProvider = require("@mui/material/DefaultPropsProvider");
|
|
16
11
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
17
|
-
var _ButtonGroup = require("@mui/material/ButtonGroup");
|
|
18
|
-
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
19
|
-
var _resolveProps = _interopRequireDefault(require("@mui/utils/resolveProps"));
|
|
20
|
-
var _zeroStyled = require("../zero-styled");
|
|
21
|
-
var _loadingButtonClasses = _interopRequireWildcard(require("./loadingButtonClasses"));
|
|
22
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
const slots = {
|
|
30
|
-
root: ['root', loading && 'loading'],
|
|
31
|
-
label: ['label'],
|
|
32
|
-
startIcon: [loading && `startIconLoading${(0, _utils2.capitalize)(loadingPosition)}`],
|
|
33
|
-
endIcon: [loading && `endIconLoading${(0, _utils2.capitalize)(loadingPosition)}`],
|
|
34
|
-
loadingIndicator: ['loadingIndicator', loading && `loadingIndicator${(0, _utils2.capitalize)(loadingPosition)}`]
|
|
35
|
-
};
|
|
36
|
-
const composedClasses = (0, _base.unstable_composeClasses)(slots, _loadingButtonClasses.getLoadingButtonUtilityClass, classes);
|
|
37
|
-
return {
|
|
38
|
-
...classes,
|
|
39
|
-
// forward the outlined, color, etc. classes to Button
|
|
40
|
-
...composedClasses
|
|
41
|
-
};
|
|
13
|
+
let warnedOnce = false;
|
|
14
|
+
const warn = () => {
|
|
15
|
+
if (!warnedOnce) {
|
|
16
|
+
console.warn(['MUI: The LoadingButton component functionality is now part of the Button component from Material UI.', '', "You should use `import Button from '@mui/material/Button'`", "or `import { Button } from '@mui/material'`"].join('\n'));
|
|
17
|
+
warnedOnce = true;
|
|
18
|
+
}
|
|
42
19
|
};
|
|
43
20
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
overridesResolver: (props, styles) => {
|
|
51
|
-
return [styles.root, styles.startIconLoadingStart && {
|
|
52
|
-
[`& .${_loadingButtonClasses.default.startIconLoadingStart}`]: styles.startIconLoadingStart
|
|
53
|
-
}, styles.endIconLoadingEnd && {
|
|
54
|
-
[`& .${_loadingButtonClasses.default.endIconLoadingEnd}`]: styles.endIconLoadingEnd
|
|
55
|
-
}];
|
|
56
|
-
}
|
|
57
|
-
})((0, _utils2.unstable_memoTheme)(({
|
|
58
|
-
theme
|
|
59
|
-
}) => ({
|
|
60
|
-
display: 'inline-flex',
|
|
61
|
-
[`& .${_loadingButtonClasses.default.startIconLoadingStart}, & .${_loadingButtonClasses.default.endIconLoadingEnd}`]: {
|
|
62
|
-
transition: theme.transitions.create(['opacity'], {
|
|
63
|
-
duration: theme.transitions.duration.short
|
|
64
|
-
}),
|
|
65
|
-
opacity: 0
|
|
66
|
-
},
|
|
67
|
-
variants: [{
|
|
68
|
-
props: {
|
|
69
|
-
loadingPosition: 'center'
|
|
70
|
-
},
|
|
71
|
-
style: {
|
|
72
|
-
transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
|
|
73
|
-
duration: theme.transitions.duration.short
|
|
74
|
-
}),
|
|
75
|
-
[`&.${_loadingButtonClasses.default.loading}`]: {
|
|
76
|
-
color: 'transparent'
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}, {
|
|
80
|
-
props: ({
|
|
81
|
-
ownerState
|
|
82
|
-
}) => ownerState.loadingPosition === 'start' && ownerState.fullWidth,
|
|
83
|
-
style: {
|
|
84
|
-
[`& .${_loadingButtonClasses.default.startIconLoadingStart}, & .${_loadingButtonClasses.default.endIconLoadingEnd}`]: {
|
|
85
|
-
transition: theme.transitions.create(['opacity'], {
|
|
86
|
-
duration: theme.transitions.duration.short
|
|
87
|
-
}),
|
|
88
|
-
opacity: 0,
|
|
89
|
-
marginRight: -8
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}, {
|
|
93
|
-
props: ({
|
|
94
|
-
ownerState
|
|
95
|
-
}) => ownerState.loadingPosition === 'end' && ownerState.fullWidth,
|
|
96
|
-
style: {
|
|
97
|
-
[`& .${_loadingButtonClasses.default.startIconLoadingStart}, & .${_loadingButtonClasses.default.endIconLoadingEnd}`]: {
|
|
98
|
-
transition: theme.transitions.create(['opacity'], {
|
|
99
|
-
duration: theme.transitions.duration.short
|
|
100
|
-
}),
|
|
101
|
-
opacity: 0,
|
|
102
|
-
marginLeft: -8
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}]
|
|
106
|
-
})));
|
|
107
|
-
const LoadingButtonLoadingIndicator = (0, _zeroStyled.styled)('span', {
|
|
108
|
-
name: 'MuiLoadingButton',
|
|
109
|
-
slot: 'LoadingIndicator',
|
|
110
|
-
overridesResolver: (props, styles) => {
|
|
111
|
-
const {
|
|
112
|
-
ownerState
|
|
113
|
-
} = props;
|
|
114
|
-
return [styles.loadingIndicator, styles[`loadingIndicator${(0, _utils2.capitalize)(ownerState.loadingPosition)}`]];
|
|
115
|
-
}
|
|
116
|
-
})((0, _utils2.unstable_memoTheme)(({
|
|
117
|
-
theme
|
|
118
|
-
}) => ({
|
|
119
|
-
position: 'absolute',
|
|
120
|
-
visibility: 'visible',
|
|
121
|
-
display: 'flex',
|
|
122
|
-
variants: [{
|
|
123
|
-
props: {
|
|
124
|
-
loadingPosition: 'start',
|
|
125
|
-
size: 'small'
|
|
126
|
-
},
|
|
127
|
-
style: {
|
|
128
|
-
left: 10
|
|
129
|
-
}
|
|
130
|
-
}, {
|
|
131
|
-
props: ({
|
|
132
|
-
loadingPosition,
|
|
133
|
-
ownerState
|
|
134
|
-
}) => loadingPosition === 'start' && ownerState.size !== 'small',
|
|
135
|
-
style: {
|
|
136
|
-
left: 14
|
|
137
|
-
}
|
|
138
|
-
}, {
|
|
139
|
-
props: {
|
|
140
|
-
variant: 'text',
|
|
141
|
-
loadingPosition: 'start'
|
|
142
|
-
},
|
|
143
|
-
style: {
|
|
144
|
-
left: 6
|
|
145
|
-
}
|
|
146
|
-
}, {
|
|
147
|
-
props: {
|
|
148
|
-
loadingPosition: 'center'
|
|
149
|
-
},
|
|
150
|
-
style: {
|
|
151
|
-
left: '50%',
|
|
152
|
-
transform: 'translate(-50%)',
|
|
153
|
-
color: (theme.vars || theme).palette.action.disabled
|
|
154
|
-
}
|
|
155
|
-
}, {
|
|
156
|
-
props: {
|
|
157
|
-
loadingPosition: 'end',
|
|
158
|
-
size: 'small'
|
|
159
|
-
},
|
|
160
|
-
style: {
|
|
161
|
-
right: 10
|
|
162
|
-
}
|
|
163
|
-
}, {
|
|
164
|
-
props: ({
|
|
165
|
-
loadingPosition,
|
|
166
|
-
ownerState
|
|
167
|
-
}) => loadingPosition === 'end' && ownerState.size !== 'small',
|
|
168
|
-
style: {
|
|
169
|
-
right: 14
|
|
170
|
-
}
|
|
171
|
-
}, {
|
|
172
|
-
props: {
|
|
173
|
-
variant: 'text',
|
|
174
|
-
loadingPosition: 'end'
|
|
175
|
-
},
|
|
176
|
-
style: {
|
|
177
|
-
right: 6
|
|
178
|
-
}
|
|
179
|
-
}, {
|
|
180
|
-
props: ({
|
|
181
|
-
ownerState
|
|
182
|
-
}) => ownerState.loadingPosition === 'start' && ownerState.fullWidth,
|
|
183
|
-
style: {
|
|
184
|
-
position: 'relative',
|
|
185
|
-
left: -10
|
|
186
|
-
}
|
|
187
|
-
}, {
|
|
188
|
-
props: ({
|
|
189
|
-
ownerState
|
|
190
|
-
}) => ownerState.loadingPosition === 'end' && ownerState.fullWidth,
|
|
191
|
-
style: {
|
|
192
|
-
position: 'relative',
|
|
193
|
-
right: -10
|
|
194
|
-
}
|
|
195
|
-
}]
|
|
196
|
-
})));
|
|
197
|
-
const LoadingButtonLabel = (0, _zeroStyled.styled)('span', {
|
|
198
|
-
name: 'MuiLoadingButton',
|
|
199
|
-
slot: 'Label',
|
|
200
|
-
overridesResolver: (props, styles) => {
|
|
201
|
-
return [styles.label];
|
|
202
|
-
}
|
|
203
|
-
})({
|
|
204
|
-
display: 'inherit',
|
|
205
|
-
alignItems: 'inherit',
|
|
206
|
-
justifyContent: 'inherit'
|
|
207
|
-
});
|
|
208
|
-
const LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton(inProps, ref) {
|
|
209
|
-
const contextProps = React.useContext(_ButtonGroup.ButtonGroupContext);
|
|
210
|
-
const resolvedProps = (0, _resolveProps.default)(contextProps, inProps);
|
|
211
|
-
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
212
|
-
props: resolvedProps,
|
|
213
|
-
name: 'MuiLoadingButton'
|
|
214
|
-
});
|
|
215
|
-
const {
|
|
216
|
-
children,
|
|
217
|
-
disabled = false,
|
|
218
|
-
id: idProp,
|
|
219
|
-
loading = false,
|
|
220
|
-
loadingIndicator: loadingIndicatorProp,
|
|
221
|
-
loadingPosition = 'center',
|
|
222
|
-
variant = 'text',
|
|
223
|
-
...other
|
|
224
|
-
} = props;
|
|
225
|
-
const id = (0, _utils2.unstable_useId)(idProp);
|
|
226
|
-
const loadingIndicator = loadingIndicatorProp ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
227
|
-
"aria-labelledby": id,
|
|
228
|
-
color: "inherit",
|
|
229
|
-
size: 16
|
|
230
|
-
});
|
|
231
|
-
const ownerState = {
|
|
232
|
-
...props,
|
|
233
|
-
disabled,
|
|
234
|
-
loading,
|
|
235
|
-
loadingIndicator,
|
|
236
|
-
loadingPosition,
|
|
237
|
-
variant
|
|
238
|
-
};
|
|
239
|
-
const classes = useUtilityClasses(ownerState);
|
|
240
|
-
const loadingButtonLoadingIndicator = loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(LoadingButtonLoadingIndicator, {
|
|
241
|
-
className: classes.loadingIndicator,
|
|
242
|
-
ownerState: ownerState,
|
|
243
|
-
children: loadingIndicator
|
|
244
|
-
}) : null;
|
|
245
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(LoadingButtonRoot, {
|
|
246
|
-
disabled: disabled || loading,
|
|
247
|
-
id: id,
|
|
21
|
+
/**
|
|
22
|
+
* @ignore - do not document.
|
|
23
|
+
*/
|
|
24
|
+
var _default = exports.default = /*#__PURE__*/React.forwardRef(function DeprecatedLoadingButton(props, ref) {
|
|
25
|
+
warn();
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
248
27
|
ref: ref,
|
|
249
|
-
...
|
|
250
|
-
variant: variant,
|
|
251
|
-
classes: classes,
|
|
252
|
-
ownerState: ownerState,
|
|
253
|
-
children: [ownerState.loadingPosition === 'end' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(LoadingButtonLabel, {
|
|
254
|
-
className: classes.label,
|
|
255
|
-
children: children
|
|
256
|
-
}) : loadingButtonLoadingIndicator, ownerState.loadingPosition === 'end' ? loadingButtonLoadingIndicator : /*#__PURE__*/(0, _jsxRuntime.jsx)(LoadingButtonLabel, {
|
|
257
|
-
className: classes.label,
|
|
258
|
-
children: children
|
|
259
|
-
})]
|
|
28
|
+
...props
|
|
260
29
|
});
|
|
261
|
-
});
|
|
262
|
-
process.env.NODE_ENV !== "production" ? LoadingButton.propTypes /* remove-proptypes */ = {
|
|
263
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
264
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
265
|
-
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
266
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
267
|
-
/**
|
|
268
|
-
* The content of the component.
|
|
269
|
-
*/
|
|
270
|
-
children: _propTypes.default.node,
|
|
271
|
-
/**
|
|
272
|
-
* Override or extend the styles applied to the component.
|
|
273
|
-
*/
|
|
274
|
-
classes: _propTypes.default.object,
|
|
275
|
-
/**
|
|
276
|
-
* If `true`, the component is disabled.
|
|
277
|
-
* @default false
|
|
278
|
-
*/
|
|
279
|
-
disabled: _propTypes.default.bool,
|
|
280
|
-
/**
|
|
281
|
-
* @ignore
|
|
282
|
-
*/
|
|
283
|
-
id: _propTypes.default.string,
|
|
284
|
-
/**
|
|
285
|
-
* If `true`, the loading indicator is shown and the button becomes disabled.
|
|
286
|
-
* @default false
|
|
287
|
-
*/
|
|
288
|
-
loading: _propTypes.default.bool,
|
|
289
|
-
/**
|
|
290
|
-
* Element placed before the children if the button is in loading state.
|
|
291
|
-
* The node should contain an element with `role="progressbar"` with an accessible name.
|
|
292
|
-
* By default we render a `CircularProgress` that is labelled by the button itself.
|
|
293
|
-
* @default <CircularProgress color="inherit" size={16} />
|
|
294
|
-
*/
|
|
295
|
-
loadingIndicator: _propTypes.default.node,
|
|
296
|
-
/**
|
|
297
|
-
* The loading indicator can be positioned on the start, end, or the center of the button.
|
|
298
|
-
* @default 'center'
|
|
299
|
-
*/
|
|
300
|
-
loadingPosition: (0, _utils.chainPropTypes)(_propTypes.default.oneOf(['start', 'end', 'center']), props => {
|
|
301
|
-
if (props.loadingPosition === 'start' && !props.startIcon) {
|
|
302
|
-
return new Error(`MUI: The loadingPosition="start" should be used in combination with startIcon.`);
|
|
303
|
-
}
|
|
304
|
-
if (props.loadingPosition === 'end' && !props.endIcon) {
|
|
305
|
-
return new Error(`MUI: The loadingPosition="end" should be used in combination with endIcon.`);
|
|
306
|
-
}
|
|
307
|
-
return null;
|
|
308
|
-
}),
|
|
309
|
-
/**
|
|
310
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
311
|
-
*/
|
|
312
|
-
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
313
|
-
/**
|
|
314
|
-
* The variant to use.
|
|
315
|
-
* @default 'text'
|
|
316
|
-
*/
|
|
317
|
-
variant: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['contained', 'outlined', 'text']), _propTypes.default.string])
|
|
318
|
-
} : void 0;
|
|
319
|
-
var _default = exports.default = LoadingButton;
|
|
30
|
+
});
|
|
@@ -1,35 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
var _exportNames = {
|
|
9
|
-
loadingButtonClasses: true
|
|
10
|
-
};
|
|
11
7
|
Object.defineProperty(exports, "default", {
|
|
12
8
|
enumerable: true,
|
|
13
9
|
get: function () {
|
|
14
10
|
return _LoadingButton.default;
|
|
15
11
|
}
|
|
16
12
|
});
|
|
17
|
-
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () {
|
|
20
|
-
return _loadingButtonClasses.default;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
var _LoadingButton = _interopRequireDefault(require("./LoadingButton"));
|
|
24
|
-
var _loadingButtonClasses = _interopRequireWildcard(require("./loadingButtonClasses"));
|
|
25
|
-
Object.keys(_loadingButtonClasses).forEach(function (key) {
|
|
26
|
-
if (key === "default" || key === "__esModule") return;
|
|
27
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
-
if (key in exports && exports[key] === _loadingButtonClasses[key]) return;
|
|
29
|
-
Object.defineProperty(exports, key, {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () {
|
|
32
|
-
return _loadingButtonClasses[key];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
13
|
+
var _LoadingButton = _interopRequireDefault(require("./LoadingButton"));
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/lab",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.23",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Laboratory for new MUI modules.",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"@babel/runtime": "^7.26.0",
|
|
32
32
|
"clsx": "^2.1.1",
|
|
33
33
|
"prop-types": "^15.8.1",
|
|
34
|
-
"@mui/base": "5.0.0-beta.68",
|
|
35
34
|
"@mui/types": "^7.2.21",
|
|
36
|
-
"@mui/system": "^6.
|
|
37
|
-
"@mui/utils": "^6.
|
|
35
|
+
"@mui/system": "^6.4.0",
|
|
36
|
+
"@mui/utils": "^6.4.0",
|
|
37
|
+
"@mui/base": "5.0.0-beta.68"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@emotion/react": "^11.5.0",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
43
43
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
44
44
|
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
45
|
-
"@mui/material": "^6.
|
|
46
|
-
"@mui/material-pigment-css": "^6.
|
|
45
|
+
"@mui/material": "^6.4.0",
|
|
46
|
+
"@mui/material-pigment-css": "^6.4.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependenciesMeta": {
|
|
49
49
|
"@types/react": {
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface LoadingButtonClasses {
|
|
2
|
-
/** Styles applied to the root element. */
|
|
3
|
-
root: string;
|
|
4
|
-
/** Styles applied to the span element that wraps the children. */
|
|
5
|
-
label: string;
|
|
6
|
-
/** Styles applied to the root element if `loading={true}`. */
|
|
7
|
-
loading: string;
|
|
8
|
-
/** Styles applied to the loadingIndicator element. */
|
|
9
|
-
loadingIndicator: string;
|
|
10
|
-
/** Styles applied to the loadingIndicator element if `loadingPosition="center"`. */
|
|
11
|
-
loadingIndicatorCenter: string;
|
|
12
|
-
/** Styles applied to the loadingIndicator element if `loadingPosition="start"`. */
|
|
13
|
-
loadingIndicatorStart: string;
|
|
14
|
-
/** Styles applied to the loadingIndicator element if `loadingPosition="end"`. */
|
|
15
|
-
loadingIndicatorEnd: string;
|
|
16
|
-
/** Styles applied to the endIcon element if `loading={true}` and `loadingPosition="end"`. */
|
|
17
|
-
endIconLoadingEnd: string;
|
|
18
|
-
/** Styles applied to the startIcon element if `loading={true}` and `loadingPosition="start"`. */
|
|
19
|
-
startIconLoadingStart: string;
|
|
20
|
-
}
|
|
21
|
-
export type LoadingButtonClassKey = keyof LoadingButtonClasses;
|
|
22
|
-
export declare function getLoadingButtonUtilityClass(slot: string): string;
|
|
23
|
-
declare const loadingButtonClasses: LoadingButtonClasses;
|
|
24
|
-
export default loadingButtonClasses;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
-
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
|
-
export function getLoadingButtonUtilityClass(slot) {
|
|
4
|
-
return generateUtilityClass('MuiLoadingButton', slot);
|
|
5
|
-
}
|
|
6
|
-
const loadingButtonClasses = generateUtilityClasses('MuiLoadingButton', ['root', 'label', 'loading', 'loadingIndicator', 'loadingIndicatorCenter', 'loadingIndicatorStart', 'loadingIndicatorEnd', 'endIconLoadingEnd', 'startIconLoadingStart']);
|
|
7
|
-
export default loadingButtonClasses;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
-
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
|
-
export function getLoadingButtonUtilityClass(slot) {
|
|
4
|
-
return generateUtilityClass('MuiLoadingButton', slot);
|
|
5
|
-
}
|
|
6
|
-
const loadingButtonClasses = generateUtilityClasses('MuiLoadingButton', ['root', 'label', 'loading', 'loadingIndicator', 'loadingIndicatorCenter', 'loadingIndicatorStart', 'loadingIndicatorEnd', 'endIconLoadingEnd', 'startIconLoadingStart']);
|
|
7
|
-
export default loadingButtonClasses;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
exports.getLoadingButtonUtilityClass = getLoadingButtonUtilityClass;
|
|
9
|
-
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
10
|
-
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
11
|
-
function getLoadingButtonUtilityClass(slot) {
|
|
12
|
-
return (0, _generateUtilityClass.default)('MuiLoadingButton', slot);
|
|
13
|
-
}
|
|
14
|
-
const loadingButtonClasses = (0, _generateUtilityClasses.default)('MuiLoadingButton', ['root', 'label', 'loading', 'loadingIndicator', 'loadingIndicatorCenter', 'loadingIndicatorStart', 'loadingIndicatorEnd', 'endIconLoadingEnd', 'startIconLoadingStart']);
|
|
15
|
-
var _default = exports.default = loadingButtonClasses;
|