mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-15 06:08:57 +03:00
154 lines
4.1 KiB
SCSS
154 lines
4.1 KiB
SCSS
// http://www.google.com/design/spec/components/selection-controls.html#selection-controls-checkbox
|
|
.checkbox label,
|
|
label.checkbox-inline {
|
|
padding-left: $bmd-checkbox-size + $bmd-checkbox-label-padding; // absolutely positioned so add the radio size
|
|
|
|
.checkbox-decorator {
|
|
position: absolute;
|
|
left: 0;
|
|
padding: .7em;
|
|
margin: -.7em;
|
|
line-height: .7;
|
|
vertical-align: middle;
|
|
cursor: pointer;
|
|
border-radius: 100%;
|
|
|
|
.check {
|
|
position: relative;
|
|
z-index: 1;
|
|
display: inline-block;
|
|
width: $bmd-checkbox-size;
|
|
height: $bmd-checkbox-size;
|
|
overflow: hidden;
|
|
border: $bmd-checkbox-border-size solid $bmd-checkbox-border-color;
|
|
border-radius: $border-radius;
|
|
|
|
// checkbox outline
|
|
&::before {
|
|
position: absolute;
|
|
display: block;
|
|
width: 0;
|
|
height: 0;
|
|
margin-top: -4px;
|
|
margin-left: 6px;
|
|
// we need a solid color here to avoid glitches in the animation
|
|
// it will not look great on non white backgrounds, but this is the
|
|
// most common case and it's better support it
|
|
color: lighten(rgba($gray, 1), (1 - $gray-alpha) * 100);
|
|
content: "";
|
|
box-shadow: 0 0 0 0, 0 0 0 0, 0 0 0 0, 0 0 0 0, 0 0 0 0, 0 0 0 0,
|
|
0 0 0 0 inset;
|
|
transform: rotate(45deg);
|
|
animation: checkbox-off;
|
|
|
|
.is-focused & {
|
|
// Prevent checkbox animation and ripple effect on page load
|
|
animation: checkbox-off $bmd-checkbox-animation-check forwards;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
input[type=checkbox] {
|
|
// Hide native checkbox
|
|
position: absolute;
|
|
left: 0;
|
|
z-index: -1;
|
|
width: 0;
|
|
height: 0;
|
|
margin: 0;
|
|
overflow: hidden;
|
|
pointer-events: none;
|
|
opacity: 0;
|
|
|
|
&:focus + .checkbox-decorator .check::after {
|
|
opacity: 0.2;
|
|
}
|
|
|
|
&:checked {
|
|
// FIXME: once working - combine further to reduce code
|
|
+ .checkbox-decorator .check {
|
|
color: $bmd-checkbox-checked-color;
|
|
border-color: $bmd-checkbox-checked-color;
|
|
}
|
|
|
|
+ .checkbox-decorator .check::before {
|
|
color: $bmd-checkbox-checked-color;
|
|
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 032px 0 20px,
|
|
-5px 5px 0 10px, 20px -12px 0 11px;
|
|
animation: checkbox-on $bmd-checkbox-animation-check forwards;
|
|
}
|
|
}
|
|
|
|
&[disabled],
|
|
fieldset[disabled] & {
|
|
+ .checkbox-decorator .check::after,
|
|
.check::after {
|
|
background-color: $gray-dark;
|
|
transform: rotate(-45deg);
|
|
}
|
|
+ .checkbox-decorator .check,
|
|
.check {
|
|
border-color: $bmd-checkbox-border-color-disabled;
|
|
}
|
|
// No ripple on disabled checkboxes
|
|
+ .checkbox-decorator .ripple-container {
|
|
display: none;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@keyframes checkbox-on {
|
|
0% {
|
|
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0 32px 0 20px,
|
|
-5px 5px 0 10px, 15px 2px 0 11px;
|
|
}
|
|
50% {
|
|
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0 32px 0 20px,
|
|
-5px 5px 0 10px, 20px 2px 0 11px;
|
|
}
|
|
100% {
|
|
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0 32px 0 20px,
|
|
-5px 5px 0 10px, 20px -12px 0 11px;
|
|
}
|
|
}
|
|
|
|
@keyframes checkbox-off {
|
|
0% {
|
|
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0 32px 0 20px,
|
|
-5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset;
|
|
}
|
|
25% {
|
|
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0 32px 0 20px,
|
|
-5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset;
|
|
}
|
|
50% {
|
|
width: 0;
|
|
height: 0;
|
|
margin-top: -4px;
|
|
margin-left: 6px;
|
|
box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0 32px 0 20px,
|
|
-5px 5px 0 10px, 15px 2px 0 11px, 0 0 0 0 inset;
|
|
transform: rotate(45deg);
|
|
}
|
|
51% {
|
|
width: 20px;
|
|
height: 20px;
|
|
margin-top: -2px;
|
|
margin-left: -2px;
|
|
box-shadow: 0 0 0 0, 0 0 0 0, 0 0 0 0, 0 0 0 0, 0 0 0 0, 0 0 0 0,
|
|
0 0 0 10px inset;
|
|
transform: rotate(0deg);
|
|
}
|
|
100% {
|
|
width: 20px;
|
|
height: 20px;
|
|
margin-top: -2px;
|
|
margin-left: -2px;
|
|
box-shadow: 0 0 0 0, 0 0 0 0, 0 0 0 0, 0 0 0 0, 0 0 0 0, 0 0 0 0,
|
|
0 0 0 0 inset;
|
|
transform: rotate(0deg);
|
|
}
|
|
}
|