Skip to content

Commit cc81d88

Browse files
authored
fix(radio-checkbox): add support for ie11 (#47)
* fix(radio-checkbox): add support for ie11 * Update packages/core/src/components/radio-checkbox/_radio-checkbox.scss
1 parent aca94dd commit cc81d88

File tree

1 file changed

+69
-41
lines changed

1 file changed

+69
-41
lines changed

packages/core/src/components/radio-checkbox/_radio-checkbox.scss

Lines changed: 69 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,79 +6,104 @@
66
.#{$ray-class-prefix}checkbox {
77
@include no-select;
88
display: flex;
9+
position: relative;
910

1011
&__label {
11-
padding-left: $ray-spacing-md;
1212
line-height: $ray-field-line-height;
1313
cursor: pointer;
14-
}
15-
16-
&__input {
17-
appearance: none;
18-
background-color: $ray-color-white;
19-
border: $ray-radio-checkbox-border-width double $ray-color-black;
20-
width: $ray-radio-checkbox-width;
21-
height: $ray-radio-checkbox-width;
22-
position: relative;
23-
top: ($ray-field-line-height - $ray-field-font-size) / 2;
24-
cursor: pointer;
14+
display: flex;
2515

26-
&::after {
16+
&::before {
17+
box-sizing: border-box;
2718
content: '';
28-
width: calc(
29-
#{$ray-radio-checkbox-width} - 2 * #{$ray-radio-checkbox-border-width}
30-
);
31-
height: calc(
32-
#{$ray-radio-checkbox-width} - 2 * #{$ray-radio-checkbox-border-width}
33-
);
34-
background: $ray-color-white;
35-
display: block;
36-
transition: $ray-transition;
19+
background-color: $ray-color-white;
20+
border: $ray-radio-checkbox-border-width double $ray-color-black;
21+
width: $ray-radio-checkbox-width;
22+
height: $ray-radio-checkbox-width;
23+
position: relative;
24+
transition: box-shadow 0.15s ease;
25+
display: inline-block;
26+
margin-right: 1rem;
27+
top: 4px;
3728
}
3829

39-
&:checked {
40-
border-color: $ray-color-blue-50;
30+
&:focus {
31+
outline: none;
4132

42-
&::after {
43-
background: $ray-color-blue-50;
33+
&::before {
34+
outline: 0;
35+
box-shadow: 0 0 0 0.25rem $ray-color-blue-20;
4436
}
37+
}
38+
}
4539

46-
&:hover {
47-
border-color: $ray-color-blue-70;
40+
&__input {
41+
appearance: none;
42+
width: 0;
43+
height: 0;
44+
opacity: 0;
45+
46+
&:focus {
47+
+ .#{$ray-class-prefix}checkbox__label,
48+
+ .#{$ray-class-prefix}radio__label {
49+
&::before {
50+
outline: 0;
51+
box-shadow: 0 0 0 0.25rem $ray-color-blue-20;
52+
}
53+
}
54+
}
55+
56+
&:checked + .#{$ray-class-prefix}checkbox__label,
57+
&:checked + .#{$ray-class-prefix}radio__label {
58+
&::before {
59+
border-color: $ray-color-blue-50;
60+
background-color: $ray-color-blue-50 !important;
61+
}
4862

49-
&::after {
50-
background: $ray-color-blue-70;
63+
&:hover + .#{$ray-class-prefix}checkbox__label,
64+
&:hover + .#{$ray-class-prefix}radio__label {
65+
&::before {
66+
border-color: $ray-color-blue-70;
67+
background-color: $ray-color-blue-70;
5168
}
5269
}
5370
}
5471

5572
&:not(:checked) {
56-
&:hover {
57-
&::after {
58-
background: $ray-color-blue-10;
73+
&:hover + .#{$ray-class-prefix}checkbox__label,
74+
&:hover + .#{$ray-class-prefix}radio__label {
75+
&::before {
76+
border-color: $ray-color-blue-50;
77+
background-color: $ray-color-blue-10;
5978
}
6079
}
6180
}
6281

6382
&[disabled] {
64-
border-color: $ray-color-gray-30;
65-
66-
&:hover {
67-
&::after {
68-
background: $ray-color-white;
83+
&:hover + .#{$ray-class-prefix}checkbox__label,
84+
&:hover + .#{$ray-class-prefix}radio__label {
85+
&::before {
86+
background-color: $ray-color-white;
6987
}
7088
}
7189

7290
+ .#{$ray-class-prefix}radio__label,
7391
+ .#{$ray-class-prefix}checkbox__label {
7492
cursor: not-allowed;
7593
color: $ray-color-gray-30;
94+
95+
&::before {
96+
border-color: $ray-color-gray-30;
97+
}
7698
}
7799
}
78100
}
79101
}
80102

81-
.#{$ray-class-prefix}radio__input {
103+
/**
104+
* Radio
105+
*/
106+
.#{$ray-class-prefix}radio__label {
82107
border-radius: 50%;
83108
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
84109
transition: box-shadow 0.15s ease;
@@ -88,12 +113,15 @@
88113
box-shadow: 0 0 0 0.25rem $ray-color-blue-20;
89114
}
90115

91-
&::after {
116+
&::before {
92117
border-radius: 50%;
93118
}
94119
}
95120

96-
.#{$ray-class-prefix}checkbox__input {
121+
/**
122+
* Checkbox
123+
*/
124+
.#{$ray-class-prefix}checkbox__label::before {
97125
border-radius: $ray-border-radius;
98126
}
99127
}

0 commit comments

Comments
 (0)