|
| 1 | +.dcx-checkbox { |
| 2 | + column-gap: token('spacing-y-formcontrol'); |
| 3 | + display: flex; |
| 4 | + align-items: center; |
| 5 | + flex-wrap: wrap; |
| 6 | + |
| 7 | + & .dcx-hint { |
| 8 | + flex-basis: 100%; |
| 9 | + font-size: token('font-formcontrol_hint-size'); |
| 10 | + line-height: token('font-formcontrol_hint-line-height'); |
| 11 | + color: token('color-text-formcontrol_hint'); |
| 12 | + padding-left: calc( |
| 13 | + token('font-formcontrol_label-line-height') + |
| 14 | + token('spacing-y-formcontrol') |
| 15 | + ); |
| 16 | + } |
| 17 | + |
| 18 | + & label { |
| 19 | + font-weight: token('font-weight-formcontrol_label'); |
| 20 | + font-size: token('font-size-formcontrol_label'); |
| 21 | + background: token('color-background-formcontrol_label'); |
| 22 | + color: token('color-text-formcontrol_label'); |
| 23 | + } |
| 24 | + |
| 25 | + & input { |
| 26 | + appearance: none; |
| 27 | + background-color: token('color-background-formcontrol'); |
| 28 | + margin: 0; |
| 29 | + color: currentColor; |
| 30 | + width: token('font-formcontrol_label-line-height'); |
| 31 | + height: token('font-formcontrol_label-line-height'); |
| 32 | + border-radius: token('border-radius-formcontrol'); |
| 33 | + border-width: token('border-width-formcontrol'); |
| 34 | + border-style: solid; |
| 35 | + border-color: token('border-color-formcontrol'); |
| 36 | + display: grid; |
| 37 | + place-content: center; |
| 38 | + cursor: pointer; |
| 39 | + |
| 40 | + &:focus { |
| 41 | + border-color: token('color-outline-formcontrol'); |
| 42 | + border-width: calc(token('border-width-formcontrol') * 2); |
| 43 | + } |
| 44 | + |
| 45 | + &:checked { |
| 46 | + border-color: token('color-outline-formcontrol'); |
| 47 | + background-color: token('color-outline-formcontrol'); |
| 48 | + } |
| 49 | + &:hover { |
| 50 | + border-color: token('color-outline-formcontrol'); |
| 51 | + border-width: calc(token('border-width-formcontrol') * 2); |
| 52 | + opacity: 0.8; |
| 53 | + } |
| 54 | + |
| 55 | + &:disabled { |
| 56 | + cursor: not-allowed; |
| 57 | + opacity: 0.5; |
| 58 | + &:hover { |
| 59 | + opacity: 0.5; |
| 60 | + border-radius: token('border-radius-formcontrol'); |
| 61 | + border-width: token('border-width-formcontrol'); |
| 62 | + border-style: solid; |
| 63 | + border-color: token('border-color-formcontrol'); |
| 64 | + } |
| 65 | + } |
| 66 | + |
| 67 | + &:disabled:hover { |
| 68 | + cursor: not-allowed; |
| 69 | + } |
| 70 | + |
| 71 | + &::before { |
| 72 | + content: ''; |
| 73 | + width: 0.8em; |
| 74 | + height: 0.8em; |
| 75 | + clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); |
| 76 | + transform: scale(0); |
| 77 | + transform-origin: bottom left; |
| 78 | + transition: 120ms transform ease-in-out; |
| 79 | + box-shadow: inset 1em 1em token('color-background-formcontrol_checkmark'); |
| 80 | + } |
| 81 | + &:checked::before { |
| 82 | + transform: scale(1); |
| 83 | + } |
| 84 | + } |
| 85 | + |
| 86 | + &.dcx-checkbox--error { |
| 87 | + & label { |
| 88 | + color: token('color-text-formcontrol_label-error'); |
| 89 | + } |
| 90 | + & input { |
| 91 | + border-color: token('color-text-formcontrol_error'); |
| 92 | + |
| 93 | + &:focus { |
| 94 | + border-color: token('color-text-formcontrol_error'); |
| 95 | + } |
| 96 | + |
| 97 | + &:checked { |
| 98 | + border-color: token('color-text-formcontrol_error'); |
| 99 | + background-color: token('color-text-formcontrol_error'); |
| 100 | + } |
| 101 | + &:hover { |
| 102 | + border-color: token('color-text-formcontrol_error'); |
| 103 | + } |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + &:has(input:disabled) { |
| 108 | + opacity: 0.5; |
| 109 | + cursor: not-allowed; |
| 110 | + } |
| 111 | +} |
0 commit comments