|
| 1 | +// |
| 2 | +// Material styles for check / radio / switch |
| 3 | +// |
| 4 | + |
| 5 | +.form-check { |
| 6 | + .form-check-input { |
| 7 | + margin-left: $form-check-input-margin-left * -1; |
| 8 | + |
| 9 | + &[type='radio'] { |
| 10 | + margin-left: $form-check-input-radio-margin-left * -1; |
| 11 | + } |
| 12 | + } |
| 13 | + |
| 14 | + margin-bottom: 0; |
| 15 | + min-height: auto; |
| 16 | +} |
| 17 | + |
| 18 | +.form-check-input { |
| 19 | + position: relative; |
| 20 | + width: $form-check-input-width-md; |
| 21 | + height: $form-check-input-height; |
| 22 | + background-color: $form-check-input-background-color; |
| 23 | + border: $form-check-input-border-width solid $form-check-input-border-color; |
| 24 | + |
| 25 | + &:before { |
| 26 | + content: ''; |
| 27 | + position: absolute; |
| 28 | + box-shadow: $form-check-input-before-box-shadow; |
| 29 | + border-radius: $form-check-input-before-border-radius; |
| 30 | + width: $form-check-input-before-width; |
| 31 | + height: $form-check-input-before-height; |
| 32 | + background-color: transparent; |
| 33 | + opacity: 0; |
| 34 | + pointer-events: none; |
| 35 | + transform: $form-check-input-before-transform; |
| 36 | + } |
| 37 | + |
| 38 | + &:hover { |
| 39 | + cursor: pointer; |
| 40 | + |
| 41 | + &:before { |
| 42 | + opacity: $form-check-input-hover-before-opacity; |
| 43 | + box-shadow: $form-check-input-hover-before-box-shadow; |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + &:focus { |
| 48 | + box-shadow: none; |
| 49 | + border-color: $form-check-input-focus-border-color; |
| 50 | + transition: $form-check-input-focus-transition; |
| 51 | + |
| 52 | + &:before { |
| 53 | + opacity: $form-check-input-focus-before-opacity; |
| 54 | + box-shadow: $form-check-input-focus-before-box-shadow; |
| 55 | + transform: $form-check-input-focus-before-transform; |
| 56 | + transition: $form-check-input-focus-before-transition; |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + &:checked { |
| 61 | + border-color: $form-check-input-checked-border-color; |
| 62 | + |
| 63 | + &:before { |
| 64 | + opacity: $form-check-input-checked-before-opacity; |
| 65 | + } |
| 66 | + |
| 67 | + &:after { |
| 68 | + content: ''; |
| 69 | + position: absolute; |
| 70 | + } |
| 71 | + |
| 72 | + &:focus { |
| 73 | + border-color: $form-check-input-checked-focus-border-color; |
| 74 | + |
| 75 | + &:before { |
| 76 | + box-shadow: $form-check-input-checked-focus-before-box-shadow; |
| 77 | + transform: $form-check-input-checked-focus-before-transform; |
| 78 | + transition: $form-check-input-checked-focus-before-transition; |
| 79 | + } |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + &:indeterminate { |
| 84 | + &:focus { |
| 85 | + &:before { |
| 86 | + box-shadow: $form-check-input-indeterminate-focus-before-box-shadow; |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + &[type='checkbox'] { |
| 92 | + border-radius: $form-check-input-checkbox-border-radius; |
| 93 | + |
| 94 | + &:focus { |
| 95 | + &:after { |
| 96 | + content: ''; |
| 97 | + position: absolute; |
| 98 | + width: $form-check-input-checkbox-focus-after-width; |
| 99 | + height: $form-check-input-checkbox-focus-after-height; |
| 100 | + z-index: 1; |
| 101 | + display: block; |
| 102 | + border-radius: 0; |
| 103 | + background-color: $form-check-input-checkbox-focus-after-background-color; |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + &:checked { |
| 108 | + background-image: none; |
| 109 | + background-color: $form-check-input-checkbox-checked-background-color; |
| 110 | + |
| 111 | + &:after { |
| 112 | + display: block; |
| 113 | + transform: $form-check-input-checkbox-checked-after-transform #{'/*!rtl:ignore*/'}; |
| 114 | + border-width: $form-check-input-checkbox-checked-after-border-width; |
| 115 | + border-color: $form-check-input-checkbox-checked-after-border-color; |
| 116 | + width: $form-check-input-checkbox-checked-after-width; |
| 117 | + height: $form-check-input-checkbox-checked-after-height; |
| 118 | + border-style: solid; |
| 119 | + border-top: 0; |
| 120 | + border-left: 0 #{'/*!rtl:ignore*/'}; |
| 121 | + margin-left: $form-check-input-checkbox-checked-after-margin-left; |
| 122 | + margin-top: $form-check-input-checkbox-checked-after-margin-top; |
| 123 | + background-color: transparent; |
| 124 | + } |
| 125 | + |
| 126 | + &:focus { |
| 127 | + background-color: $form-check-input-checkbox-checked-focus-background-color; |
| 128 | + } |
| 129 | + } |
| 130 | + |
| 131 | + &:indeterminate { |
| 132 | + background-image: none; |
| 133 | + background-color: transparent; |
| 134 | + border-color: $form-check-input-indeterminate-border-color; |
| 135 | + |
| 136 | + &:after { |
| 137 | + display: block; |
| 138 | + transform: $form-check-input-indeterminate-checked-after-transform #{'/*!rtl:ignore*/'}; |
| 139 | + border-width: $form-check-input-indeterminate-checked-after-border-width; |
| 140 | + border-color: $form-check-input-indeterminate-checked-after-border-color; |
| 141 | + width: $form-check-input-indeterminate-checked-after-width; |
| 142 | + height: $form-check-input-indeterminate-checked-after-height; |
| 143 | + border-style: solid; |
| 144 | + border-top: 0; |
| 145 | + border-left: 0 #{'/*!rtl:ignore*/'}; |
| 146 | + margin-left: $form-check-input-indeterminate-checked-after-margin-left; |
| 147 | + margin-top: 0; |
| 148 | + } |
| 149 | + |
| 150 | + &:focus { |
| 151 | + background-color: $form-check-input-indeterminate-focus-background-color; |
| 152 | + border-color: $form-check-input-indeterminate-focus-border-color; |
| 153 | + } |
| 154 | + } |
| 155 | + } |
| 156 | + |
| 157 | + &[type='radio'] { |
| 158 | + border-radius: $form-check-input-radio-border-radius; |
| 159 | + width: $form-check-input-radio-width; |
| 160 | + height: $form-check-input-radio-height; |
| 161 | + |
| 162 | + &:before { |
| 163 | + width: $form-check-input-radio-before-width; |
| 164 | + height: $form-check-input-radio-before-height; |
| 165 | + } |
| 166 | + |
| 167 | + &:after { |
| 168 | + content: ''; |
| 169 | + position: absolute; |
| 170 | + width: $form-check-input-radio-after-width; |
| 171 | + height: $form-check-input-radio-after-height; |
| 172 | + z-index: 1; |
| 173 | + display: block; |
| 174 | + border-radius: $form-check-input-radio-after-border-radius; |
| 175 | + background-color: $form-check-input-radio-after-background-color; |
| 176 | + } |
| 177 | + |
| 178 | + &:checked { |
| 179 | + background-image: none; |
| 180 | + background-color: $form-check-input-radio-checked-background-color; |
| 181 | + |
| 182 | + &:after { |
| 183 | + border-radius: $form-check-input-radio-checked-after-border-radius; |
| 184 | + width: $form-check-input-radio-checked-after-width; |
| 185 | + height: $form-check-input-radio-checked-after-height; |
| 186 | + border-color: $form-check-input-radio-checked-after-border-color; |
| 187 | + background-color: $form-check-input-radio-checked-after-background-color; |
| 188 | + margin-top: $form-check-input-radio-checked-after-margin-top; |
| 189 | + margin-left: $form-check-input-radio-checked-after-margin-left; |
| 190 | + transition: $form-check-input-radio-checked-after-transition; |
| 191 | + } |
| 192 | + |
| 193 | + &:focus { |
| 194 | + background-color: $form-check-input-radio-checked-focus-background-color; |
| 195 | + } |
| 196 | + } |
| 197 | + } |
| 198 | +} |
| 199 | + |
| 200 | +.form-check-label { |
| 201 | + &:hover { |
| 202 | + cursor: pointer; |
| 203 | + } |
| 204 | +} |
| 205 | + |
| 206 | +// |
| 207 | +// Switch |
| 208 | +// |
| 209 | + |
| 210 | +.form-switch { |
| 211 | + padding-left: $form-switch-padding-left; |
| 212 | + |
| 213 | + .form-check-input { |
| 214 | + background-image: none; |
| 215 | + border-width: 0; |
| 216 | + border-radius: $form-switch-form-check-input-border-radius; |
| 217 | + width: $form-switch-form-check-input-width; |
| 218 | + height: $form-switch-form-check-input-height; |
| 219 | + background-color: $form-switch-form-check-input-background-color; |
| 220 | + margin-top: $form-switch-form-check-input-margin-top; |
| 221 | + margin-right: $form-switch-form-check-input-margin-right; |
| 222 | + |
| 223 | + &:after { |
| 224 | + content: ''; |
| 225 | + position: absolute; |
| 226 | + border: none; |
| 227 | + z-index: 2; |
| 228 | + border-radius: $form-switch-form-check-input-after-border-radius; |
| 229 | + width: $form-switch-form-check-input-after-width; |
| 230 | + height: $form-switch-form-check-input-after-height; |
| 231 | + background-color: $form-switch-form-check-input-after-background-color; |
| 232 | + margin-top: $form-switch-form-check-input-after-margin-top; |
| 233 | + box-shadow: $form-switch-form-check-input-after-box-shadow; |
| 234 | + transition: $form-switch-form-check-input-after-transition; |
| 235 | + } |
| 236 | + |
| 237 | + &:focus { |
| 238 | + background-image: none; |
| 239 | + |
| 240 | + &:before { |
| 241 | + box-shadow: $form-switch-form-check-input-focus-before-box-shadow; |
| 242 | + transform: $form-switch-form-check-input-focus-before-transform; |
| 243 | + transition: $form-switch-form-check-input-focus-before-transition; |
| 244 | + } |
| 245 | + |
| 246 | + &:after { |
| 247 | + border-radius: $form-switch-form-check-input-focus-after-border-radius; |
| 248 | + width: $form-switch-form-check-input-focus-after-width; |
| 249 | + height: $form-switch-form-check-input-focus-after-height; |
| 250 | + } |
| 251 | + } |
| 252 | + |
| 253 | + &:checked { |
| 254 | + background-image: none; |
| 255 | + |
| 256 | + &:focus { |
| 257 | + background-image: none; |
| 258 | + |
| 259 | + &:before { |
| 260 | + margin-left: $form-switch-form-check-input-checked-focus-before-margin-left; |
| 261 | + box-shadow: $form-switch-form-check-input-checked-focus-before-box-shadow; |
| 262 | + transform: $form-switch-form-check-input-checked-focus-before-transform; |
| 263 | + transition: $form-switch-form-check-input-checked-focus-before-transition; |
| 264 | + } |
| 265 | + } |
| 266 | + |
| 267 | + &[type='checkbox'] { |
| 268 | + background-image: none; |
| 269 | + |
| 270 | + &:after { |
| 271 | + content: ''; |
| 272 | + position: absolute; |
| 273 | + border: none; |
| 274 | + z-index: 2; |
| 275 | + border-radius: $form-switch-form-check-input-checked-checkbox-after-border-radius; |
| 276 | + width: $form-switch-form-check-input-checked-checkbox-after-width; |
| 277 | + height: $form-switch-form-check-input-checked-checkbox-after-height; |
| 278 | + background-color: $form-switch-form-check-input-checked-checkbox-after-background-color; |
| 279 | + margin-top: $form-switch-form-check-input-checked-checkbox-after-margin-top; |
| 280 | + margin-left: $form-switch-form-check-input-checked-checkbox-after-margin-left; |
| 281 | + box-shadow: $form-switch-form-check-input-checked-checkbox-after-box-shadow; |
| 282 | + transition: $form-switch-form-check-input-checked-checkbox-after-transition; |
| 283 | + } |
| 284 | + } |
| 285 | + } |
| 286 | + } |
| 287 | +} |
0 commit comments