Skip to content

Commit 67b1ac6

Browse files
committed
Initialize slots ans slotProps to avoid ?.
1 parent 4bfc582 commit 67b1ac6

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

packages/mui-material-next/src/Slider/Slider.tsx

+18-18
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ const Slider = React.forwardRef(function Slider<
543543
size = 'medium',
544544
step = 1,
545545
scale = Identity,
546-
slotProps,
547-
slots,
546+
slotProps = {},
547+
slots = {},
548548
tabIndex,
549549
track = 'normal',
550550
value: valueProp,
@@ -598,19 +598,19 @@ const Slider = React.forwardRef(function Slider<
598598

599599
const classes = useUtilityClasses(ownerState);
600600

601-
const RootSlot = slots?.root ?? SliderRoot;
602-
const RailSlot = slots?.rail ?? SliderRail;
603-
const TrackSlot = slots?.track ?? SliderTrack;
604-
const ThumbSlot = slots?.thumb ?? SliderThumb;
605-
const ValueLabelSlot = slots?.valueLabel ?? StyledSliderValueLabel;
606-
const MarkSlot = slots?.mark ?? SliderMark;
607-
const MarkLabelSlot = slots?.markLabel ?? SliderMarkLabel;
608-
const InputSlot = slots?.input ?? 'input';
601+
const RootSlot = slots.root ?? SliderRoot;
602+
const RailSlot = slots.rail ?? SliderRail;
603+
const TrackSlot = slots.track ?? SliderTrack;
604+
const ThumbSlot = slots.thumb ?? SliderThumb;
605+
const ValueLabelSlot = slots.valueLabel ?? StyledSliderValueLabel;
606+
const MarkSlot = slots.mark ?? SliderMark;
607+
const MarkLabelSlot = slots.markLabel ?? SliderMarkLabel;
608+
const InputSlot = slots.input ?? 'input';
609609

610610
const rootProps = useSlotProps({
611611
elementType: RootSlot,
612612
getSlotProps: getRootProps,
613-
externalSlotProps: slotProps?.root,
613+
externalSlotProps: slotProps.root,
614614
externalForwardedProps: other,
615615
additionalProps: {
616616
...(shouldSpreadAdditionalProps(RootSlot) && {
@@ -623,14 +623,14 @@ const Slider = React.forwardRef(function Slider<
623623

624624
const railProps = useSlotProps({
625625
elementType: RailSlot,
626-
externalSlotProps: slotProps?.rail,
626+
externalSlotProps: slotProps.rail,
627627
ownerState,
628628
className: classes.rail,
629629
});
630630

631631
const trackProps = useSlotProps({
632632
elementType: TrackSlot,
633-
externalSlotProps: slotProps?.track,
633+
externalSlotProps: slotProps.track,
634634
additionalProps: {
635635
style: {
636636
...axisProps[axis].offset(trackOffset),
@@ -644,36 +644,36 @@ const Slider = React.forwardRef(function Slider<
644644
const thumbProps = useSlotProps({
645645
elementType: ThumbSlot,
646646
getSlotProps: getThumbProps,
647-
externalSlotProps: slotProps?.thumb,
647+
externalSlotProps: slotProps.thumb,
648648
ownerState,
649649
className: classes.thumb,
650650
});
651651

652652
const valueLabelProps = useSlotProps({
653653
elementType: ValueLabelSlot,
654-
externalSlotProps: slotProps?.valueLabel,
654+
externalSlotProps: slotProps.valueLabel,
655655
ownerState,
656656
className: classes.valueLabel,
657657
});
658658

659659
const markProps = useSlotProps({
660660
elementType: MarkSlot,
661-
externalSlotProps: slotProps?.mark,
661+
externalSlotProps: slotProps.mark,
662662
ownerState,
663663
className: classes.mark,
664664
});
665665

666666
const markLabelProps = useSlotProps({
667667
elementType: MarkLabelSlot,
668-
externalSlotProps: slotProps?.markLabel,
668+
externalSlotProps: slotProps.markLabel,
669669
ownerState,
670670
className: classes.markLabel,
671671
});
672672

673673
const inputSliderProps = useSlotProps({
674674
elementType: InputSlot,
675675
getSlotProps: getHiddenInputProps,
676-
externalSlotProps: slotProps?.input,
676+
externalSlotProps: slotProps.input,
677677
ownerState,
678678
});
679679

0 commit comments

Comments
 (0)