blob: e2268265aa0b3b36c5e8b9b832c341637b0f7f50 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001/**
2 * Copyright 2015 Google Inc. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17@import "../variables";
18@import "../mixins";
19
20.mdl-radio {
21 position: relative;
22
23 font-size: $radio-label-font-size;
24 line-height: $radio-label-height;
25
26 display: inline-block;
27
28 vertical-align: middle;
29
30 box-sizing: border-box;
31 height: $radio-label-height;
32 margin: 0;
33 padding-left: 0;
34
35 &.is-upgraded {
36 padding-left: $radio-button-size + $radio-padding;
37 }
38}
39
40.mdl-radio__button {
41 line-height: $radio-label-height;
42
43 .mdl-radio.is-upgraded & {
44 // Hide input element, while still making it respond to focus.
45 position: absolute;
46 width: 0;
47 height: 0;
48 margin: 0;
49 padding: 0;
50 opacity: 0;
51 -ms-appearance: none;
52 -moz-appearance: none;
53 -webkit-appearance: none;
54 appearance: none;
55 border: none;
56 }
57}
58
59.mdl-radio__outer-circle {
60 position: absolute;
61 top: $radio-top-offset;
62 left: 0;
63
64 display: inline-block;
65
66 box-sizing: border-box;
67 width: $radio-button-size;
68 height: $radio-button-size;
69 margin: 0;
70
71 cursor: pointer;
72
73 border: 2px solid $radio-off-color;
74 border-radius: 50%;
75
76 z-index: 2;
77
78 .mdl-radio.is-checked & {
79 border: 2px solid $radio-color;
80 }
81
82 fieldset[disabled] .mdl-radio,
83 .mdl-radio.is-disabled & {
84 border: 2px solid $radio-disabled-color;
85 cursor: auto;
86 }
87}
88
89.mdl-radio__inner-circle {
90 position: absolute;
91 z-index: 1;
92 margin: 0;
93 top: $radio-top-offset + $radio-inner-margin;
94 left: $radio-inner-margin;
95
96 box-sizing: border-box;
97 width: $radio-button-size - ($radio-inner-margin * 2);
98 height: $radio-button-size - ($radio-inner-margin * 2);
99
100 cursor: pointer;
101
102 @include material-animation-default(0.28s);
103 transition-property: transform;
104 transform: scale(0, 0);
105
106 border-radius: 50%;
107 background: $radio-color;
108
109 .mdl-radio.is-checked & {
110 transform: scale(1, 1);
111 }
112
113 fieldset[disabled] .mdl-radio &,
114 .mdl-radio.is-disabled & {
115 background: $radio-disabled-color;
116 cursor: auto;
117 }
118
119 .mdl-radio.is-focused & {
120 box-shadow: 0 0 0px 10px rgba(0, 0, 0, 0.1);
121 }
122}
123
124.mdl-radio__label {
125 cursor: pointer;
126
127 fieldset[disabled] .mdl-radio &,
128 .mdl-radio.is-disabled & {
129 color: $radio-disabled-color;
130 cursor: auto;
131 }
132}
133
134.mdl-radio__ripple-container {
135 position: absolute;
136 z-index: 2;
137 top: -(($radio-ripple-size - $radio-label-height) / 2);
138 left: -(($radio-ripple-size - $radio-button-size) / 2);
139
140 box-sizing: border-box;
141 width: $radio-ripple-size;
142 height: $radio-ripple-size;
143 border-radius: 50%;
144
145 cursor: pointer;
146
147 overflow: hidden;
148 -webkit-mask-image: -webkit-radial-gradient(circle, white, black);
149
150 & .mdl-ripple {
151 background: $radio-color;
152 }
153
154 fieldset[disabled] .mdl-radio &,
155 .mdl-radio.is-disabled & {
156 cursor: auto;
157 }
158
159 fieldset[disabled] .mdl-radio & .mdl-ripple,
160 .mdl-radio.is-disabled & .mdl-ripple {
161 background: transparent;
162 }
163}