UNPKG

@scania/tegel

Version:
133 lines (132 loc) 4.31 kB
:host { align-items: center; position: relative; box-sizing: border-box; } .tds-checkbox { box-sizing: border-box; font: var(--tds-detail-02); letter-spacing: var(--tds-detail-02-ls); color: var(--tds-checkbox-text); display: flex; align-items: center; margin-left: -4px; } .tds-checkbox * { box-sizing: border-box; } .tds-checkbox input[type=checkbox] { appearance: none; outline: none; margin: 0; border: 0; border-radius: 2px; width: 24px; height: 24px; position: relative; cursor: pointer; flex-shrink: 0; align-self: flex-start; } .tds-checkbox input[type=checkbox] + label { color: var(--tds-checkbox-color); padding-left: var(--tds-spacing-element-4); padding-top: var(--tds-spacing-element-4); padding-bottom: var(--tds-spacing-element-4); cursor: pointer; display: flex; align-items: center; } .tds-checkbox input[type=checkbox] + label::before { content: ""; position: absolute; width: 100%; height: 100%; left: 0; top: 0; } .tds-checkbox input[type=checkbox]::before, .tds-checkbox input[type=checkbox]::after { content: ""; position: absolute; box-sizing: border-box; } .tds-checkbox input[type=checkbox]::before { width: 20px; height: 20px; left: 2px; top: 2px; border-radius: 4px; } .tds-checkbox input[type=checkbox]::after { border: 1px solid var(--tds-checkbox-interaction-01); background-color: var(--tds-checkbox-interaction-02); width: 16px; height: 16px; left: 4px; top: 4px; border-radius: 2px; } .tds-checkbox input[type=checkbox]:hover::before { background-color: var(--tds-checkbox-background-hover); opacity: var(--tds-checkbox-background-opacity-hover); } .tds-checkbox input[type=checkbox]:focus-visible::before { background-color: var(--tds-checkbox-background-focus); opacity: var(--tds-checkbox-background-opacity-focus); transition: opacity 0.2s ease-in-out; } .tds-checkbox input[type=checkbox]:disabled, .tds-checkbox input[type=checkbox].disabled { cursor: not-allowed; } .tds-checkbox input[type=checkbox]:disabled::after, .tds-checkbox input[type=checkbox].disabled::after { border-color: var(--tds-checkbox-border-color-disabled-after); } .tds-checkbox input[type=checkbox]:disabled + label, .tds-checkbox input[type=checkbox].disabled + label { color: var(--tds-checkbox-disabled); cursor: not-allowed; } .tds-checkbox input[type=checkbox]:disabled:hover::before, .tds-checkbox input[type=checkbox].disabled:hover::before { display: none; } .tds-checkbox input[type=checkbox]:checked::after { background-image: var(--tds-checkbox-background-img); background-color: var(--tds-checkbox-interaction-01); background-repeat: no-repeat; background-position: center; } .tds-checkbox input[type=checkbox]:checked:hover::before { background-color: var(--tds-checkbox-background-hover); opacity: var(--tds-checkbox-background-opacity-hover); } .tds-checkbox input[type=checkbox]:checked:disabled:hover::before, .tds-checkbox input[type=checkbox]:checked:disabled::before, .tds-checkbox input[type=checkbox]:checked.disabled:hover::before, .tds-checkbox input[type=checkbox]:checked.disabled::before { display: block; width: 16px; height: 16px; left: 4px; top: 4px; border: 1px solid #b0b7c4; } .tds-checkbox input[type=checkbox]:checked:disabled::after, .tds-checkbox input[type=checkbox]:checked.disabled::after { background-image: var(--tds-checkbox-background-img-disabled); background-color: var(--tds-checkbox-interaction-02); color: var(--tds-checkbox-color-disabled-after); } .tds-checkbox input[type=checkbox]:indeterminate::after { background-image: var(--tds-checkbox-background-img-indeterminate); background-color: var(--tds-checkbox-interaction-01); background-repeat: no-repeat; background-position: center; } .tds-checkbox input[type=checkbox]:indeterminate:disabled:hover::before, .tds-checkbox input[type=checkbox]:indeterminate:disabled::before { display: block; width: 16px; height: 16px; left: 4px; top: 4px; border: 1px solid #b0b7c4; } .tds-checkbox input[type=checkbox]:indeterminate:disabled::after { background-image: var(--tds-checkbox-background-img-indeterminate-disabled); background-color: var(--tds-checkbox-interaction-02); color: var(--tds-checkbox-color-disabled-after); }