Skip to content

Commit e4f5722

Browse files
committed
update components
1 parent e590744 commit e4f5722

File tree

13 files changed

+171
-188
lines changed

13 files changed

+171
-188
lines changed

packages/mui-joy/src/Button/Button.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ const Button = React.forwardRef(function Button(inProps, ref) {
165165
const {
166166
children,
167167
action,
168-
component = 'button',
169168
color: colorProp = 'primary',
170169
variant = 'solid',
171170
size = 'md',
@@ -207,7 +206,6 @@ const Button = React.forwardRef(function Button(inProps, ref) {
207206

208207
const ownerState = {
209208
...props,
210-
component,
211209
color,
212210
fullWidth,
213211
variant,
@@ -219,28 +217,27 @@ const Button = React.forwardRef(function Button(inProps, ref) {
219217
};
220218

221219
const classes = useUtilityClasses(ownerState);
222-
const externalForwardedProps = { ...other, component };
223220

224221
const [SlotRoot, rootProps] = useSlot('root', {
225222
ref,
226223
className: classes.root,
227224
elementType: ButtonRoot,
228-
externalForwardedProps,
225+
externalForwardedProps: other,
229226
getSlotProps: getRootProps,
230227
ownerState,
231228
});
232229

233230
const [SlotStartDecorator, startDecoratorProps] = useSlot('startDecorator', {
234231
className: classes.startDecorator,
235232
elementType: ButtonStartDecorator,
236-
externalForwardedProps,
233+
externalForwardedProps: other,
237234
ownerState,
238235
});
239236

240237
const [SlotEndDecorator, endDecoratorProps] = useSlot('endDecorator', {
241238
className: classes.endDecorator,
242239
elementType: ButtonEndDecorator,
243-
externalForwardedProps,
240+
externalForwardedProps: other,
244241
ownerState,
245242
});
246243

@@ -249,7 +246,7 @@ const Button = React.forwardRef(function Button(inProps, ref) {
249246
{
250247
className: classes.loadingIndicatorCenter,
251248
elementType: ButtonLoadingCenter,
252-
externalForwardedProps,
249+
externalForwardedProps: other,
253250
ownerState,
254251
},
255252
);
@@ -306,11 +303,6 @@ Button.propTypes /* remove-proptypes */ = {
306303
PropTypes.oneOf(['danger', 'info', 'neutral', 'primary', 'success', 'warning']),
307304
PropTypes.string,
308305
]),
309-
/**
310-
* The component used for the root node.
311-
* Either a string to use a HTML element or a component.
312-
*/
313-
component: PropTypes.elementType,
314306
/**
315307
* If `true`, the component is disabled.
316308
* @default false

packages/mui-joy/src/Checkbox/Checkbox.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ const Checkbox = React.forwardRef(function Checkbox(inProps, ref) {
188188
uncheckedIcon,
189189
checkedIcon = defaultCheckedIcon,
190190
label,
191-
component = 'span',
192191
defaultChecked,
193192
disabled: disabledExternalProp,
194193
disableIcon = false,
@@ -260,27 +259,26 @@ const Checkbox = React.forwardRef(function Checkbox(inProps, ref) {
260259
};
261260

262261
const classes = useUtilityClasses(ownerState);
263-
const externalForwardedProps = { ...other, component };
264262

265263
const [SlotRoot, rootProps] = useSlot('root', {
266264
ref,
267265
className: classes.root,
268266
elementType: CheckboxRoot,
269-
externalForwardedProps,
267+
externalForwardedProps: other,
270268
ownerState,
271269
});
272270

273271
const [SlotCheckbox, checkboxProps] = useSlot('checkbox', {
274272
className: classes.checkbox,
275273
elementType: CheckboxCheckbox,
276-
externalForwardedProps,
274+
externalForwardedProps: other,
277275
ownerState,
278276
});
279277

280278
const [SlotAction, actionProps] = useSlot('action', {
281279
className: classes.action,
282280
elementType: CheckboxAction,
283-
externalForwardedProps,
281+
externalForwardedProps: other,
284282
ownerState,
285283
});
286284

@@ -299,7 +297,7 @@ const Checkbox = React.forwardRef(function Checkbox(inProps, ref) {
299297
},
300298
className: classes.input,
301299
elementType: CheckboxInput,
302-
externalForwardedProps,
300+
externalForwardedProps: other,
303301
getSlotProps: getInputProps,
304302
ownerState,
305303
});
@@ -310,7 +308,7 @@ const Checkbox = React.forwardRef(function Checkbox(inProps, ref) {
310308
},
311309
className: classes.label,
312310
elementType: CheckboxLabel,
313-
externalForwardedProps,
311+
externalForwardedProps: other,
314312
ownerState,
315313
});
316314

@@ -363,11 +361,6 @@ Checkbox.propTypes /* remove-proptypes */ = {
363361
PropTypes.oneOf(['danger', 'info', 'primary', 'success', 'warning']),
364362
PropTypes.string,
365363
]),
366-
/**
367-
* The component used for the root node.
368-
* Either a string to use a HTML element or a component.
369-
*/
370-
component: PropTypes.elementType,
371364
/**
372365
* The default checked state. Use when the component is not controlled.
373366
*/

packages/mui-joy/src/Chip/Chip.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ const Chip = React.forwardRef(function Chip(inProps, ref) {
202202
children,
203203
className,
204204
color = 'primary',
205-
component = 'div',
206205
slotProps = {},
207206
onClick,
208207
disabled = false,
@@ -219,7 +218,6 @@ const Chip = React.forwardRef(function Chip(inProps, ref) {
219218
disabled,
220219
size,
221220
color,
222-
component,
223221
variant,
224222
clickable,
225223
focusVisible: false,
@@ -237,7 +235,7 @@ const Chip = React.forwardRef(function Chip(inProps, ref) {
237235
ownerState.focusVisible = focusVisible;
238236

239237
const classes = useUtilityClasses(ownerState);
240-
const externalForwardedProps = { ...other, component, slotProps };
238+
const externalForwardedProps = { ...other, slotProps };
241239

242240
const [SlotRoot, rootProps] = useSlot('root', {
243241
ref,
@@ -280,7 +278,7 @@ const Chip = React.forwardRef(function Chip(inProps, ref) {
280278
const [SlotEndDecorator, endDecoratorProps] = useSlot('endDecorator', {
281279
className: classes.endDecorator,
282280
elementType: ChipEndDecorator,
283-
externalForwardedProps: { ...other, slotProps },
281+
externalForwardedProps,
284282
ownerState,
285283
});
286284

@@ -329,11 +327,6 @@ Chip.propTypes /* remove-proptypes */ = {
329327
PropTypes.oneOf(['danger', 'info', 'neutral', 'primary', 'success', 'warning']),
330328
PropTypes.string,
331329
]),
332-
/**
333-
* The component used for the root node.
334-
* Either a string to use a HTML element or a component.
335-
*/
336-
component: PropTypes.elementType,
337330
/**
338331
* If `true`, the component is disabled.
339332
* @default false

packages/mui-joy/src/CircularProgress/CircularProgress.tsx

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { unstable_composeClasses as composeClasses } from '@mui/base';
2-
import { css, keyframes } from '@mui/system';
3-
import { OverridableComponent } from '@mui/types';
4-
import { unstable_capitalize as capitalize } from '@mui/utils';
5-
import clsx from 'clsx';
61
import PropTypes from 'prop-types';
72
import * as React from 'react';
3+
import clsx from 'clsx';
4+
import { OverridableComponent } from '@mui/types';
5+
import { unstable_capitalize as capitalize } from '@mui/utils';
6+
import { unstable_composeClasses as composeClasses } from '@mui/base';
7+
import { css, keyframes } from '@mui/system';
88
import styled from '../styles/styled';
99
import useThemeProps from '../styles/useThemeProps';
1010
import useSlot from '../utils/useSlot';
@@ -207,7 +207,6 @@ const CircularProgress = React.forwardRef(function CircularProgress(inProps, ref
207207
children,
208208
className,
209209
color = 'primary',
210-
component = 'span',
211210
size = 'md',
212211
variant = 'soft',
213212
thickness,
@@ -219,7 +218,6 @@ const CircularProgress = React.forwardRef(function CircularProgress(inProps, ref
219218
const ownerState = {
220219
...props,
221220
color,
222-
component,
223221
size,
224222
variant,
225223
thickness,
@@ -229,13 +227,12 @@ const CircularProgress = React.forwardRef(function CircularProgress(inProps, ref
229227
};
230228

231229
const classes = useUtilityClasses(ownerState);
232-
const externalForwardedProps = { ...other, component };
233230

234231
const [SlotRoot, rootProps] = useSlot('root', {
235232
ref,
236233
className: clsx(classes.root, className),
237234
elementType: CircularProgressRoot,
238-
externalForwardedProps,
235+
externalForwardedProps: other,
239236
ownerState,
240237
additionalProps: {
241238
role: 'progressbar',
@@ -256,21 +253,21 @@ const CircularProgress = React.forwardRef(function CircularProgress(inProps, ref
256253
const [SlotSvg, svgProps] = useSlot('svg', {
257254
className: classes.svg,
258255
elementType: CircularProgressSvg,
259-
externalForwardedProps,
256+
externalForwardedProps: other,
260257
ownerState,
261258
});
262259

263260
const [SlotTrack, trackProps] = useSlot('track', {
264261
className: classes.track,
265262
elementType: CircularProgressTrack,
266-
externalForwardedProps,
263+
externalForwardedProps: other,
267264
ownerState,
268265
});
269266

270267
const [SlotProgress, progressProps] = useSlot('progress', {
271268
className: classes.progress,
272269
elementType: CircularProgressProgress,
273-
externalForwardedProps,
270+
externalForwardedProps: other,
274271
ownerState,
275272
});
276273

@@ -306,11 +303,6 @@ CircularProgress.propTypes /* remove-proptypes */ = {
306303
PropTypes.oneOf(['danger', 'info', 'neutral', 'primary', 'success', 'warning']),
307304
PropTypes.string,
308305
]),
309-
/**
310-
* The component used for the root node.
311-
* Either a string to use a HTML element or a component.
312-
*/
313-
component: PropTypes.elementType,
314306
/**
315307
* The boolean to select a variant.
316308
* Use indeterminate when there is no progress value.

packages/mui-joy/src/Link/Link.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ const Link = React.forwardRef(function Link(inProps, ref) {
166166
const props = extendSxProp({ ...themeProps, color: textColor }) as LinkProps;
167167

168168
const {
169-
component = 'a',
170169
children,
171170
disabled = false,
172171
onBlur,
@@ -212,7 +211,6 @@ const Link = React.forwardRef(function Link(inProps, ref) {
212211
const ownerState = {
213212
...props,
214213
color,
215-
component,
216214
disabled,
217215
focusVisible,
218216
underline,
@@ -223,7 +221,6 @@ const Link = React.forwardRef(function Link(inProps, ref) {
223221
};
224222

225223
const classes = useUtilityClasses(ownerState);
226-
const externalForwardedProps = { ...other, component };
227224

228225
const [SlotRoot, rootProps] = useSlot('root', {
229226
additionalProps: {
@@ -233,21 +230,21 @@ const Link = React.forwardRef(function Link(inProps, ref) {
233230
ref: handleRef,
234231
className: classes.root,
235232
elementType: LinkRoot,
236-
externalForwardedProps,
233+
externalForwardedProps: other,
237234
ownerState,
238235
});
239236

240237
const [SlotStartDecorator, startDecoratorProps] = useSlot('startDecorator', {
241238
className: classes.startDecorator,
242239
elementType: StartDecorator,
243-
externalForwardedProps,
240+
externalForwardedProps: other,
244241
ownerState,
245242
});
246243

247244
const [SlotEndDecorator, endDecoratorProps] = useSlot('endDecorator', {
248245
className: classes.endDecorator,
249246
elementType: EndDecorator,
250-
externalForwardedProps,
247+
externalForwardedProps: other,
251248
ownerState,
252249
});
253250

@@ -280,11 +277,6 @@ Link.propTypes /* remove-proptypes */ = {
280277
PropTypes.oneOf(['danger', 'info', 'neutral', 'primary', 'success', 'warning']),
281278
PropTypes.string,
282279
]),
283-
/**
284-
* The component used for the root node.
285-
* Either a string to use a HTML element or a component.
286-
*/
287-
component: PropTypes.elementType,
288280
/**
289281
* If `true`, the component is disabled.
290282
* @default false

packages/mui-joy/src/Modal/Modal.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ const Modal = React.forwardRef(function ModalUnstyled(inProps, ref) {
8787

8888
const {
8989
children,
90-
component = 'div',
9190
container,
9291
disableAutoFocus = false,
9392
disableEnforceFocus = false,
@@ -227,14 +226,12 @@ const Modal = React.forwardRef(function ModalUnstyled(inProps, ref) {
227226
}
228227
};
229228

230-
const externalForwardedProps = { ...other, component };
231-
232229
const [SlotRoot, rootProps] = useSlot('root', {
233230
additionalProps: { role: 'presentation', onKeyDown: handleKeyDown },
234231
ref: handleRef,
235232
className: classes.root,
236233
elementType: ModalRoot,
237-
externalForwardedProps,
234+
externalForwardedProps: other,
238235
ownerState,
239236
});
240237

@@ -246,7 +243,7 @@ const Modal = React.forwardRef(function ModalUnstyled(inProps, ref) {
246243
},
247244
className: classes.backdrop,
248245
elementType: ModalBackdrop,
249-
externalForwardedProps,
246+
externalForwardedProps: other,
250247
ownerState,
251248
});
252249

@@ -295,11 +292,6 @@ Modal.propTypes /* remove-proptypes */ = {
295292
* A single child content element.
296293
*/
297294
children: elementAcceptingRef.isRequired,
298-
/**
299-
* The component used for the root node.
300-
* Either a string to use a HTML element or a component.
301-
*/
302-
component: PropTypes.elementType,
303295
/**
304296
* An HTML element or function that returns one.
305297
* The `container` will have the portal children appended to it.

0 commit comments

Comments
 (0)