File tree 7 files changed +46
-6
lines changed
7 files changed +46
-6
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,11 @@ html body {
132
132
--w-scrollbar-bg : var (--w-color-primary-60 );
133
133
--w-scrollbar-fg : var (--w-color-primary-50 );
134
134
135
+ // Slider component
136
+ --w-slider-background : var (--w-color-primary-50 );
137
+ --w-slider-color : var (--w-color-primary );
138
+ --w-slider-thumb : var (--w-color-primary-50 );
139
+
135
140
// Spinner component
136
141
--w-spinner-color : var (--w-color-primary );
137
142
--w-spinner-width : 2px ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const {
11
11
max,
12
12
value,
13
13
step,
14
+ disabled,
14
15
color,
15
16
background,
16
17
thumb,
@@ -36,6 +37,7 @@ const styleVariables = classNames([
36
37
max ={ max }
37
38
value ={ value || min }
38
39
step ={ step }
40
+ disabled ={ disabled }
39
41
class:list ={ classes }
40
42
id ={ id }
41
43
style ={ styleVariables }
Original file line number Diff line number Diff line change 8
8
export let max: SvelteSliderProps [' max' ] = 100
9
9
export let value: SvelteSliderProps [' value' ] = 0
10
10
export let step: SvelteSliderProps [' step' ] = 1
11
+ export let disabled: SvelteSliderProps [' disabled' ] = false
11
12
export let color: SvelteSliderProps [' color' ] = ' '
12
13
export let background: SvelteSliderProps [' background' ] = ' '
13
14
export let thumb: SvelteSliderProps [' thumb' ] = ' '
33
34
max ={max }
34
35
value ={value || min }
35
36
step ={step }
37
+ disabled ={disabled }
36
38
class ={classes }
37
- id ={id }
38
- style ={styleVariables }
39
+ id ={id || null }
40
+ style ={styleVariables || null }
39
41
on:change ={onChange }
40
42
/>
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ const Slider = ({
9
9
max,
10
10
value,
11
11
step,
12
+ disabled,
12
13
color,
13
14
background,
14
15
thumb,
@@ -34,6 +35,7 @@ const Slider = ({
34
35
max = { max }
35
36
defaultValue = { value || min }
36
37
step = { step }
38
+ disabled = { disabled }
37
39
className = { classes }
38
40
id = { id }
39
41
style = { styleVariables }
Original file line number Diff line number Diff line change @@ -16,6 +16,26 @@ body {
16
16
-webkit-appearance : none ;
17
17
appearance : none ;
18
18
cursor : pointer ;
19
+
20
+ & [disabled ]::-webkit-slider-runnable-track {
21
+ @include background (primary- 50);
22
+ }
23
+
24
+ & [disabled ]::-moz-range-track {
25
+ @include background (primary- 50);
26
+ }
27
+
28
+ & [disabled ]::-webkit-slider-thumb {
29
+ @include background (primary- 50);
30
+ @include border (primary- 30);
31
+ box-shadow : -995px 0 0 990px var (--w-color-primary-30 );
32
+ }
33
+
34
+ & [disabled ]::-moz-range-thumb {
35
+ @include background (primary- 50);
36
+ @include border (primary- 30);
37
+ box-shadow : -995px 0 0 990px var (--w-color-primary-30 );
38
+ }
19
39
}
20
40
21
41
.slider ::-webkit-slider-runnable-track {
35
55
36
56
-webkit-appearance : none ;
37
57
appearance : none ;
38
- box-shadow : -405 px 0 0 400 px var (--w-slider-color );
58
+ box-shadow : -995 px 0 0 990 px var (--w-slider-color );
39
59
}
40
60
41
61
.slider ::-moz-range-thumb {
44
64
@include border-radius (max );
45
65
@include border (var (--w-slider-color ));
46
66
47
- box-shadow : -405 px 0 0 400 px var (--w-slider-color );
67
+ box-shadow : -995 px 0 0 990 px var (--w-slider-color );
48
68
}
Original file line number Diff line number Diff line change @@ -3,10 +3,11 @@ export type SliderProps = {
3
3
max : number
4
4
value ?: number
5
5
step ?: number
6
- id ?: string
6
+ disabled ?: boolean
7
7
color ?: string
8
8
background ?: string
9
9
thumb ?: string
10
+ id ?: string
10
11
className ?: string
11
12
}
12
13
Original file line number Diff line number Diff line change @@ -86,6 +86,15 @@ const sections = getSections({
86
86
className = " labelled1"
87
87
/>
88
88
</ComponentWrapper >
89
+
90
+ <ComponentWrapper title = " Disabled" >
91
+ <section.component
92
+ min = { 0 }
93
+ max = { 100 }
94
+ value = { 40 }
95
+ disabled = { true }
96
+ />
97
+ </ComponentWrapper >
89
98
</div >
90
99
))}
91
100
</Layout >
@@ -101,5 +110,4 @@ const sections = getSections({
101
110
slider2?.addEventListener('change', (e: any) => {
102
111
e.target.previousElementSibling.innerText = e.target.value
103
112
})
104
-
105
113
</script >
You can’t perform that action at this time.
0 commit comments