pico/scss/content/_form-checkbox-radio.scss
2020-09-29 08:38:35 +07:00

98 lines
2.0 KiB
SCSS

/**
* Form elements
* Checkboxes & Radios
*/
[type="checkbox"],
[type="radio"] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
display: inline-block;
width: 1.25rem;
height: 1.25rem;
margin-top: -.125rem;
margin-right: .375rem;
border-width: var(--checkbox-radio-border-width);
vertical-align: middle;
cursor: pointer;
&::-ms-check {
display: none; // unstyle IE checkboxes
}
&:checked,
&:indeterminate {
border-color: var(--input-hover-border);
background-color: var(--input-hover-border);
background-image: var(--icon-checkbox);
background-position: center;
background-repeat: no-repeat;
background-size: .75rem auto;
}
&:indeterminate {
background-image: var(--icon-minus);
}
& ~ label {
display: inline-block;
margin-right: .375rem;
margin-bottom: 0;
cursor: pointer;
}
}
// Radios
[type="radio"] {
border-radius: 50%;
&:checked {
border-width: .33rem;
border-color: var(--input-hover-border);
background-color: var(--input-inverse);
background-image: none;
}
}
// Switchs
[type="checkbox"][role="switch"] {
// Config
$switch-height: 1.25rem;
$switch-width: 2.25rem;
$switch-transition: .1s ease-in-out;
// Styles
width: $switch-width;
height: $switch-height;
border: var(--switch-border-width) solid var(--input-border);
border-radius: $switch-height;
background-color: var(--input-border);
line-height: $switch-height;
&:before {
display: block;
width: calc(#{$switch-height} - (var(--switch-border-width)*2));
height: 100%;
border-radius: 50%;
background-color: var(--input-inverse);
content: '';
@if $enable-transitions {
transition: margin $switch-transition;
}
}
&:checked {
border-color: var(--input-hover-border);
background-color: var(--input-hover-border);
background-image: none;
&::before {
margin-right: 0;
margin-left: calc(#{$switch-width/2} - var(--switch-border-width));
}
}
}