| 1 |
@use '../../sass-utilities' as *; |
| 2 |
|
| 3 |
@include pf-root($check) { |
| 4 |
--#{$check}--GridGap: var(--pf-t--global--spacer--gap--group--vertical) var(--pf-t--global--spacer--gap--text-to-element--default); |
| 5 |
--#{$check}--AccentColor: var(--pf-t--global--color--brand--default); |
| 6 |
--#{$check}--m-standalone--MinHeight: calc(var(--#{$check}__label--FontSize) * var(--#{$check}__label--LineHeight)); |
| 7 |
|
| 8 |
// TODO: update to `--#{$check}--FontSize` `--#{$check}--LineHeight` |
| 9 |
--#{$check}__label--disabled--Color: var(--pf-t--global--text--color--disabled); |
| 10 |
--#{$check}__label--Color: var(--pf-t--global--text--color--regular); |
| 11 |
--#{$check}__label--FontWeight: var(--pf-t--global--font--weight--body--default); |
| 12 |
--#{$check}__label--FontSize: var(--pf-t--global--font--size--body--default); |
| 13 |
--#{$check}__label--LineHeight: var(--pf-t--global--font--line-height--body); |
| 14 |
--#{$check}__description--FontSize: var(--pf-t--global--font--size--body--sm); |
| 15 |
--#{$check}__description--Color: var(--pf-t--global--text--color--subtle); |
| 16 |
|
| 17 |
// Required checkbox |
| 18 |
--#{$check}__label-required--MarginInlineStart: var(--pf-t--global--spacer--xs); |
| 19 |
--#{$check}__label-required--FontSize: var(--pf-t--global--font--size--body--sm); |
| 20 |
--#{$check}__label-required--Color: var(--pf-t--global--color--status--danger--default); |
| 21 |
|
| 22 |
// TODO: due to subpixel rendering and this value resolving to 21px, the checkbox vertical centering is off by 1px. Mozilla rounds subpixels up while chrome rounds down. This is a temporary fix until we can find a better solution. |
| 23 |
--#{$check}__input--TranslateY: calc((var(--#{$check}__label--LineHeight) * var(--#{$check}__label--FontSize) / 2 ) - 50%); // find height of single label, divide by two, offset by 50% of own height |
| 24 |
} |
| 25 |
|
| 26 |
// - Check |
| 27 |
.#{$check} { |
| 28 |
display: grid; |
| 29 |
grid-template-columns: auto 1fr; |
| 30 |
gap: var(--#{$check}--GridGap); |
| 31 |
accent-color: var(--#{$check}--AccentColor); |
| 32 |
|
| 33 |
&.pf-m-standalone { |
| 34 |
display: inline-grid; |
| 35 |
grid-template-columns: auto; |
| 36 |
min-height: var(--#{$check}--m-standalone--MinHeight); |
| 37 |
|
| 38 |
.#{$check}__input { |
| 39 |
align-self: center; |
| 40 |
transform: none; |
| 41 |
} |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
// - Check input |
| 46 |
.#{$check}__input { |
| 47 |
align-self: start; |
| 48 |
font-size: var(--#{$check}__label--FontSize); |
| 49 |
line-height: var(--#{$check}__label--LineHeight); |
| 50 |
|
| 51 |
// find height of single label, divide by two, offset by 50% of own height |
| 52 |
transform: translateY(var(--#{$check}__input--TranslateY)); |
| 53 |
} |
| 54 |
|
| 55 |
.#{$check}__label { |
| 56 |
font-size: var(--#{$check}__label--FontSize); |
| 57 |
font-weight: var(--#{$check}__label--FontWeight); |
| 58 |
line-height: var(--#{$check}__label--LineHeight); |
| 59 |
color: var(--#{$check}__label--Color); |
| 60 |
} |
| 61 |
|
| 62 |
.#{$check}__description { |
| 63 |
grid-column: 2; |
| 64 |
font-size: var(--#{$check}__description--FontSize); |
| 65 |
color: var(--#{$check}__description--Color); |
| 66 |
} |
| 67 |
|
| 68 |
.#{$check}__body { |
| 69 |
grid-column: 2; |
| 70 |
} |
| 71 |
|
| 72 |
.#{$check}__label, |
| 73 |
.#{$check}__input { |
| 74 |
justify-self: start; |
| 75 |
|
| 76 |
@at-root label.#{$check}, |
| 77 |
& { |
| 78 |
cursor: pointer; |
| 79 |
} |
| 80 |
|
| 81 |
&:disabled, |
| 82 |
&.pf-m-disabled { |
| 83 |
--#{$check}__label--Color: var(--#{$check}__label--disabled--Color); |
| 84 |
|
| 85 |
cursor: not-allowed; |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
.#{$check}__label-required { |
| 90 |
margin-inline-start: var(--#{$check}__label-required--MarginInlineStart); |
| 91 |
font-size: var(--#{$check}__label-required--FontSize); |
| 92 |
color: var(--#{$check}__label-required--Color); |
| 93 |
} |