/* =========================
Checkbox
========================= */
@use "../kit-deps" as *;
.checkbox {
display: inline-flex;
align-items: center;
gap: $space-2;
cursor: pointer;
font-size: 15px;
color: $neutral-900;
input[type="checkbox"] {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
border: 0;
padding: 0;
margin: 0;
}
.checkbox-control {
width: 20px;
height: 20px;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid $neutral-400;
border-radius: $radius-sm;
background-color: $neutral-0;
transition:
border-color $motion-base $motion-ease,
background-color $motion-base $motion-ease;
&::after {
content: "";
width: 5px;
height: 9px;
border: solid $neutral-0;
border-width: 0 2px 2px 0;
transform: rotate(45deg) translateY(-1px) scale(0);
opacity: 0;
transition: opacity $motion-base $motion-ease, transform $motion-base $motion-ease;
}
}
&:hover .checkbox-control {
border-color: $mint-600;
}
input[type="checkbox"]:focus-visible + .checkbox-control {
@include focus_ring;
}
input[type="checkbox"]:checked + .checkbox-control {
background-color: $mint-600;
border-color: $mint-600;
&::after {
transform: rotate(45deg) translateY(-1px) scale(1);
opacity: 1;
}
}
input[type="checkbox"]:disabled + .checkbox-control {
background-color: $neutral-100;
border-color: $neutral-300;
cursor: not-allowed;
}
input[type="checkbox"]:checked:disabled + .checkbox-control {
background-color: $neutral-400;
border-color: $neutral-400;
}
input[type="checkbox"]:disabled ~ .checkbox-label {
color: $neutral-500;
cursor: not-allowed;
}
.checkbox-label {
font-weight: $font-weight-medium;
line-height: 1.25;
}
}