/
SliderUnstyled.spec.tsx
77 lines (68 loc) · 2.56 KB
/
SliderUnstyled.spec.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import * as React from 'react';
import SliderUnstyled, {
SliderUnstyledInputSlotProps,
SliderUnstyledMarkLabelSlotProps,
SliderUnstyledMarkSlotProps,
SliderUnstyledRailSlotProps,
SliderUnstyledRootSlotProps,
SliderUnstyledThumbSlotProps,
SliderUnstyledTrackSlotProps,
SliderUnstyledValueLabelSlotProps,
} from '@mui/base/SliderUnstyled';
const Root = React.forwardRef(function Root(
props: SliderUnstyledRootSlotProps,
ref: React.ForwardedRef<HTMLDivElement>,
) {
const { ownerState, ...other } = props;
return <div data-track={ownerState.track} {...other} ref={ref} />;
});
const Track = React.forwardRef(function Track(
props: SliderUnstyledTrackSlotProps,
ref: React.ForwardedRef<HTMLDivElement>,
) {
const { ownerState, ...other } = props;
return <div data-track={ownerState.track} {...other} ref={ref} />;
});
const Rail = React.forwardRef(function Rail(
props: SliderUnstyledRailSlotProps,
ref: React.ForwardedRef<HTMLDivElement>,
) {
const { ownerState, ...other } = props;
return <div data-track={ownerState.track} {...other} ref={ref} />;
});
const Thumb = React.forwardRef(function Thumb(
props: SliderUnstyledThumbSlotProps,
ref: React.ForwardedRef<HTMLDivElement>,
) {
const { 'data-index': index, 'data-focusvisible': focusVisible, ownerState, ...other } = props;
return <div data-track={ownerState.track} {...other} ref={ref} />;
});
const Mark = React.forwardRef(function Mark(
props: SliderUnstyledMarkSlotProps,
ref: React.ForwardedRef<HTMLDivElement>,
) {
const { 'data-index': index, ownerState, ...other } = props;
return <div data-track={ownerState.track} {...other} ref={ref} />;
});
const MarkLabel = React.forwardRef(function MarkLabel(
props: SliderUnstyledMarkLabelSlotProps,
ref: React.ForwardedRef<HTMLDivElement>,
) {
const { 'data-index': index, ownerState, ...other } = props;
return <div data-track={ownerState.track} {...other} ref={ref} />;
});
const ValueLabel = React.forwardRef(function ValueLabel(
props: SliderUnstyledValueLabelSlotProps,
ref: React.ForwardedRef<HTMLDivElement>,
) {
const { index, open, valueLabel, ownerState, ...other } = props;
return <div data-track={ownerState.track} {...other} ref={ref} />;
});
const Input = React.forwardRef(function Input(
props: SliderUnstyledInputSlotProps,
ref: React.ForwardedRef<HTMLInputElement>,
) {
const { 'data-index': index, step, ownerState, ...other } = props;
return <input data-track={ownerState.track} {...other} ref={ref} />;
});
const styledSlider = <SliderUnstyled components={{ Root, Track, Rail, Thumb, Mark, MarkLabel }} />;