133 lines
3.5 KiB
JavaScript
133 lines
3.5 KiB
JavaScript
|
import {
|
||
|
component_styles_default
|
||
|
} from "./chunk.K23QWHWK.js";
|
||
|
import {
|
||
|
i
|
||
|
} from "./chunk.CXZZ2LVK.js";
|
||
|
|
||
|
// src/components/checkbox/checkbox.styles.ts
|
||
|
var checkbox_styles_default = i`
|
||
|
${component_styles_default}
|
||
|
|
||
|
:host {
|
||
|
display: inline-block;
|
||
|
}
|
||
|
|
||
|
.checkbox {
|
||
|
position: relative;
|
||
|
display: inline-flex;
|
||
|
align-items: flex-start;
|
||
|
font-family: var(--sl-input-font-family);
|
||
|
font-weight: var(--sl-input-font-weight);
|
||
|
color: var(--sl-input-label-color);
|
||
|
vertical-align: middle;
|
||
|
cursor: pointer;
|
||
|
}
|
||
|
|
||
|
.checkbox--small {
|
||
|
--toggle-size: var(--sl-toggle-size-small);
|
||
|
font-size: var(--sl-input-font-size-small);
|
||
|
}
|
||
|
|
||
|
.checkbox--medium {
|
||
|
--toggle-size: var(--sl-toggle-size-medium);
|
||
|
font-size: var(--sl-input-font-size-medium);
|
||
|
}
|
||
|
|
||
|
.checkbox--large {
|
||
|
--toggle-size: var(--sl-toggle-size-large);
|
||
|
font-size: var(--sl-input-font-size-large);
|
||
|
}
|
||
|
|
||
|
.checkbox__control {
|
||
|
flex: 0 0 auto;
|
||
|
position: relative;
|
||
|
display: inline-flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
width: var(--toggle-size);
|
||
|
height: var(--toggle-size);
|
||
|
border: solid var(--sl-input-border-width) var(--sl-input-border-color);
|
||
|
border-radius: 2px;
|
||
|
background-color: var(--sl-input-background-color);
|
||
|
color: var(--sl-color-neutral-0);
|
||
|
transition:
|
||
|
var(--sl-transition-fast) border-color,
|
||
|
var(--sl-transition-fast) background-color,
|
||
|
var(--sl-transition-fast) color,
|
||
|
var(--sl-transition-fast) box-shadow;
|
||
|
}
|
||
|
|
||
|
.checkbox__input {
|
||
|
position: absolute;
|
||
|
opacity: 0;
|
||
|
padding: 0;
|
||
|
margin: 0;
|
||
|
pointer-events: none;
|
||
|
}
|
||
|
|
||
|
.checkbox__checked-icon,
|
||
|
.checkbox__indeterminate-icon {
|
||
|
display: inline-flex;
|
||
|
width: var(--toggle-size);
|
||
|
height: var(--toggle-size);
|
||
|
}
|
||
|
|
||
|
/* Hover */
|
||
|
.checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover {
|
||
|
border-color: var(--sl-input-border-color-hover);
|
||
|
background-color: var(--sl-input-background-color-hover);
|
||
|
}
|
||
|
|
||
|
/* Focus */
|
||
|
.checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control {
|
||
|
outline: var(--sl-focus-ring);
|
||
|
outline-offset: var(--sl-focus-ring-offset);
|
||
|
}
|
||
|
|
||
|
/* Checked/indeterminate */
|
||
|
.checkbox--checked .checkbox__control,
|
||
|
.checkbox--indeterminate .checkbox__control {
|
||
|
border-color: var(--sl-color-primary-600);
|
||
|
background-color: var(--sl-color-primary-600);
|
||
|
}
|
||
|
|
||
|
/* Checked/indeterminate + hover */
|
||
|
.checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__control:hover,
|
||
|
.checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__control:hover {
|
||
|
border-color: var(--sl-color-primary-500);
|
||
|
background-color: var(--sl-color-primary-500);
|
||
|
}
|
||
|
|
||
|
/* Checked/indeterminate + focus */
|
||
|
.checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control,
|
||
|
.checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control {
|
||
|
outline: var(--sl-focus-ring);
|
||
|
outline-offset: var(--sl-focus-ring-offset);
|
||
|
}
|
||
|
|
||
|
/* Disabled */
|
||
|
.checkbox--disabled {
|
||
|
opacity: 0.5;
|
||
|
cursor: not-allowed;
|
||
|
}
|
||
|
|
||
|
.checkbox__label {
|
||
|
display: inline-block;
|
||
|
color: var(--sl-input-label-color);
|
||
|
line-height: var(--toggle-size);
|
||
|
margin-inline-start: 0.5em;
|
||
|
user-select: none;
|
||
|
-webkit-user-select: none;
|
||
|
}
|
||
|
|
||
|
:host([required]) .checkbox__label::after {
|
||
|
content: var(--sl-input-required-content);
|
||
|
margin-inline-start: var(--sl-input-required-content-offset);
|
||
|
}
|
||
|
`;
|
||
|
|
||
|
export {
|
||
|
checkbox_styles_default
|
||
|
};
|