cartodb-4.42/assets/stylesheets/common/forms/radiobutton.scss
2024-04-06 05:25:13 +00:00

169 lines
2.9 KiB
SCSS

@import '../../variables/colors';
@import '../../variables/sizes';
// New radiobutton input styled
//
// <div class="RadioButton">
// <button class="RadioButton-input"></button>
// <label class="RadioButton-label">Checkbox label</label>
// </div>
//
// --------------------------------------------------------------------------------------------------------------------
.RadioButton {
display: flex;
align-items: center;
}
.RadioButton-input {
position: relative;
width: 16px;
height: 16px;
border: 2px solid $cStructure-mainLine;
border-radius: 16px;
outline: none;
background: #FFF;
&:hover {
border-color: #AAA;
}
}
.RadioButton-input.is-checked {
&::before {
content: '';
position: absolute;
top: 1px;
left: 1px;
width: 10px;
height: 10px;
border-radius: 12px;
background: #4A90E2;
}
}
.RadioButton-input.is-disabled {
cursor: default;
&::before {
background: #DDD;
cursor: default;
}
}
.RadioButton-label {
margin-left: 8px;
color: $cTypography-secondary;
}
.RadioButton-label.dark-color {
color: $cTypography-headers;
}
.RadioButton.is-checked .RadioButton-label {
color: $cTypography-linkSelected;
}
.RadioButton.is-alert .RadioButton-label {
color: $cHighlight-alert3;
}
.RadioButton.is-alert .RadioButton-input {
border-color: $cHighlight-alert3;
&::before {
background: $cHighlight-alert3;
}
}
.RadioButton.is-warning .RadioButton-label {
color: $cHighlight-alert;
}
.RadioButton.is-warning .RadioButton-input {
border-color: $cHighlight-alert;
&::before {
background: $cHighlight-alert;
}
}
.RadioButton.is-disabled .RadioButton-input {
opacity: 0.4;
&:hover {
border-color: $cStructure-mainLine;
cursor: default;
}
&:focus {
border-color: $cStructure-mainLine;
}
}
.RadioButton.is-disabled .RadioButton-label {
opacity: 0.4;
}
// CSS-only behaviour
.RadioButtonInput {
position: absolute;
z-index: 1;
width: 20px;
height: 20px;
opacity: 0;
vertical-align: middle;
cursor: pointer;
}
.RadioButtonInput-face {
position: relative;
width: 16px;
height: 16px;
border: 2px solid $cStructure-mainLine;
border-radius: 50%;
outline: none;
background: #FFF;
cursor: pointer;
&::before {
content: '';
position: absolute;
top: 3px;
left: 3px;
width: 10px;
height: 10px;
border-radius: 50%;
}
}
.RadioButtonInput:checked + .RadioButtonInput-face {
&::before {
content: '';
position: absolute;
top: 3px;
left: 3px;
width: 10px;
height: 10px;
border-radius: 50%;
background: #4A90E2;
}
}
.RadioButtonInput:disabled + .RadioButtonInput-face {
opacity: 0.4;
&:focus {
border-color: $cStructure-mainLine;
}
&:hover {
border-color: $cStructure-mainLine;
cursor: default;
}
}
.RadioButtonInput:hover + .RadioButtonInput-face {
border-color: #AAA;
}