/** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: BUSL-1.1 */ // This file defines the styles for .checkbox, .radio and .b-checkboxes. The prefix "b" comes from Bulma. // checkbox and radio styling .checkbox, .radio { cursor: pointer; display: inline-block; line-height: 1.25; position: relative; } .checkbox input, .radio input { cursor: pointer; } .checkbox:hover, .radio:hover { color: hsl(0, 0%, 21%); } .checkbox[disabled], .radio[disabled], .checkbox input[disabled], .radio input[disabled] { color: $grey; cursor: not-allowed; } // radio only styling .radio + .radio { margin-left: 0.5em; } // one-off checkbox class .checkbox-help-text { color: $ui-gray-700; font-size: $size-7; padding-left: 28px; } // b-checkbox styling .b-checkbox { display: inline; position: relative; } .b-checkbox label::before { background-color: $white; border-radius: 3px; border: 1px solid $ui-gray-300; content: ''; height: 17px; left: 0; position: absolute; top: 1px; transition: background 0.1s ease-in-out; width: 17px; } .b-checkbox input[type='checkbox']:checked + label::before { border-color: $blue; } .b-checkbox input[type='checkbox']:checked + label::after, .b-checkbox input[type='radio']:checked + label::after { font-family: $family-monospace; /*checkmark from ionicons*/ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 512 512' fill='%231563ff'%3E%3Cpath d='M461.6 109.6l-54.9-43.3c-1.7-1.4-3.8-2.4-6.2-2.4-2.4 0-4.6 1-6.3 2.5L194.5 323s-78.5-75.5-80.7-77.7c-2.2-2.2-5.1-5.9-9.5-5.9s-6.4 3.1-8.7 5.4c-1.7 1.8-29.7 31.2-43.5 45.8-.8.9-1.3 1.4-2 2.1-1.2 1.7-2 3.6-2 5.7 0 2.2.8 4 2 5.7l2.8 2.6s139.3 133.8 141.6 136.1c2.3 2.3 5.1 5.2 9.2 5.2 4 0 7.3-4.3 9.2-6.2l249.1-320c1.2-1.7 2-3.6 2-5.8 0-2.5-1-4.6-2.4-6.4z'/%3E%3C/svg%3E"); } .b-checkbox input[type='checkbox'], .b-checkbox input[type='radio'] { cursor: pointer; opacity: 0; z-index: 1; } .b-checkbox label::after { color: $ui-gray-800; font-size: 12px; height: 16px; left: 3px; position: absolute; top: 3px; width: 16px; } .b-checkbox label { display: inline; line-height: 1; margin-left: 0.5rem; padding-left: 5px; } .b-checkbox input[type='checkbox']:focus + label::before, .b-checkbox input[type='radio']:focus + label::before { outline: thin dotted; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } .b-checkbox input[type='checkbox']:disabled + label::before, .b-checkbox input[type='radio']:disabled + label::before { background-color: $ui-gray-100; cursor: not-allowed; } .b-checkbox input[type='checkbox']:disabled + label, .b-checkbox input[type='radio']:disabled + label { opacity: 0.65; } .b-checkbox > .sub-text { padding-left: 2rem; }