-
Notifications
You must be signed in to change notification settings - Fork 60
/
radio.scss
138 lines (114 loc) · 3.63 KB
/
radio.scss
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
@import "./new-settings";
@import "./mixins";
@import "./functions";
/*!
.fd-radio
*/
$block: #{$fd-namespace}-radio;
%fd-radio-input-hidden {
position: absolute;
opacity: 0.0001;
}
.#{$block} {
@mixin fd-radio-state($background-color, $text-color, $border-color, $border-size) {
+ .#{$block}__label {
&::before {
background-color: $background-color;
border: $border-size solid $border-color;
color: $text-color;
}
@include fd-hover() {
@include fd-disabled() {
border-color: $border-color;
}
}
}
}
$fd-radio-inner-circle-diameter: 1.375rem;
$fd-radio-inner-circle-diameter-compact: 1rem;
$fd-radio-outer-circle-margin: 0.6875rem;
$fd-radio-outer-circle-margin-compact: 0.5rem;
@include fd-form-base();
@extend %fd-radio-input-hidden;
&__label {
@include fd-form-label();
@include action-cursor();
line-height: 1rem;
display: flex;
align-items: center;
overflow: hidden;
padding: $fd-radio-outer-circle-margin 0 $fd-radio-outer-circle-margin $fd-radio-outer-circle-margin;
&::before {
content: "";
height: $fd-radio-inner-circle-diameter;
width: $fd-radio-inner-circle-diameter;
min-width: $fd-radio-inner-circle-diameter;
font-size: 0.6875rem;
display: inline-flex;
justify-content: center;
align-items: center;
font-family: "SAP-icons";
background-color: var(--sapField_Background);
margin-right: $fd-radio-outer-circle-margin;
color: var(--sapSelectedColor);
border: var(--sapField_BorderWidth) solid var(--sapField_BorderColor);
border-radius: 50%;
}
@include fd-hover() {
&::before {
background-color: var(--sapField_Hover_Background);
border-color: var(--sapField_Hover_BorderColor);
}
}
}
&:checked + .#{$block}__label::before {
content: "\e255";
}
// states
&.is-warning,
&.is-alert {
@include fd-radio-state(var(--sapField_WarningBackground), var(--sapField_TextColor), var(--sapField_WarningColor), 0.125rem);
}
&.is-error {
@include fd-radio-state(var(--sapField_InvalidBackground), var(--sapField_InvalidColor), var(--sapField_InvalidColor), 0.125rem);
}
&.is-success {
@include fd-radio-state(var(--sapField_SuccessBackground), var(--sapField_SuccessColor), var(--sapField_SuccessColor), var(--sapField_BorderWidth));
}
&.is-information {
@include fd-radio-state(var(--sapField_InformationBackground), var(--sapField_InformationColor), var(--sapField_InformationColor), 0.125rem);
}
&[readonly],
&.is-readonly {
@include fd-radio-state(var(--sapField_ReadOnly_Background), var(--sapContent_NonInteractiveIconColor), var(--sapField_ReadOnly_BorderColor), var(--sapField_BorderWidth));
}
@include fd-focus() {
+ .#{$block}__label {
@include fd-form-radio-focus($fd-radio-outer-circle-margin);
}
}
@include fd-disabled() {
opacity: 0.0001;
+ .#{$block}__label {
pointer-events: none;
opacity: 0.4;
}
}
&--compact {
+ .#{$block}__label {
padding: $fd-radio-outer-circle-margin-compact 0 $fd-radio-outer-circle-margin-compact $fd-radio-outer-circle-margin-compact;
&::before {
font-size: 0.4375rem;
height: $fd-radio-inner-circle-diameter-compact;
width: $fd-radio-inner-circle-diameter-compact;
min-width: $fd-radio-inner-circle-diameter-compact;
margin-right: $fd-radio-outer-circle-margin-compact;
}
}
@include fd-focus() {
+ .#{$block}__label {
@include fd-form-radio-focus($fd-radio-outer-circle-margin-compact);
}
}
}
}