UNPKG

v4web-components

Version:
114 lines (98 loc) 2.92 kB
.container { display: block; position: relative; padding-left: 2.3rem; cursor: pointer; font-size: 1.375rem; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .label-text { font: var(--lab-ds-semantic-typography-body-none-decoration-p2-regular); text-overflow: ellipsis; white-space: nowrap; overflow: hidden; } .wrap-text .label-text { white-space: wrap; } .label-text.checked { font: var(--lab-ds-semantic-typography-body-none-decoration-p2-bold); } .container-label { display: flex; gap: 0.7rem; align-items: flex-start; } /* Hide the browser's default checkbox */ .container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } /* Create a custom checkbox */ .checkmark { position: absolute; top: 0; left: 0; height: 1.25rem; width: 1.25rem; border-style: solid; border-color: var(--lab-ds-semantic-color-bg-cloudy); border-radius: var(--lab-ds-semantic-selectable-border-radius-xs); border-width: var(--lab-ds-semantic-selectable-border-width-m); background-color: var(--lab-ds-semantic-color-bg-default); } .error.checkmark { border-color: var(--lab-ds-semantic-selectable-color-border-dark-error); background-color: rgba(0, 0, 0, 0); } /* On mouse-over, add a background color */ .container:hover input:not([disabled]):not(:checked) ~ .checkmark { background-color: var(--lab-ds-semantic-selectable-color-primary-hover); } .container:active input:not([disabled]) ~ .checkmark { background-color: var(--lab-ds-semantic-selectable-color-primary-press); } .container:focus:not([disabled]) { outline-style: solid; outline-color: var(--lab-ds-semantic-selectable-color-primary-focus); border-radius: var(--lab-ds-semantic-selectable-border-radius-xs); outline-width: var(--lab-ds-semantic-selectable-border-width-s); outline-offset: 0.4rem; } .container.disabled { opacity: var(--lab-ds-core-opacity-80); } /* When the checkbox is checked, add a background */ .container input:checked ~ .checkmark { background-color: rgba(0, 0, 0, 0); border-style: solid; border-color: var(--lab-ds-semantic-selectable-color-primary-default); } /* Create the checkmark/indicator (hidden when not checked) */ .checkmark:after { content: ''; position: absolute; display: none; } /* Show the checkmark when checked */ .container input:checked ~ .checkmark:after { display: block; } /* Style the checkmark/indicator */ .container .checkmark:after { left: 0.438rem; top: 0.125rem; width: 0.313rem; height: 0.625rem; border: solid var(--lab-ds-semantic-selectable-color-primary-default); border-width: 0 0.188rem 0.188rem 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); }