@mui/lab 6.0.0-beta.22 → 6.0.0-beta.24
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 +91 -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/Timeline/TimelineContext.js +2 -0
- package/index.js +1 -1
- package/modern/LoadingButton/LoadingButton.js +15 -304
- package/modern/LoadingButton/index.js +1 -3
- package/modern/Timeline/TimelineContext.js +2 -0
- package/modern/index.js +1 -1
- package/node/LoadingButton/LoadingButton.js +14 -303
- package/node/LoadingButton/index.js +1 -23
- package/node/Timeline/TimelineContext.js +1 -0
- 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
|
@@ -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
|
+
});
|