| 1 |
.pf-v6-c-switch { |
| 2 |
--pf-v6-c-switch--FontSize: var(--pf-t--global--font--size--sm); |
| 3 |
--pf-v6-c-switch--ColumnGap: var(--pf-t--global--spacer--sm); |
| 4 |
--pf-v6-c-switch__toggle-icon--FontSize: calc(var(--pf-v6-c-switch--FontSize) * .625); |
| 5 |
--pf-v6-c-switch__toggle-icon--Color: var(--pf-t--global--icon--color--on-brand--default); |
| 6 |
--pf-v6-c-switch__toggle-icon--InsetInlineStart: calc(var(--pf-v6-c-switch--FontSize) * .4); |
| 7 |
--pf-v6-c-switch__toggle-icon--Offset: 0.125rem; |
| 8 |
--pf-v6-c-switch__input--disabled__toggle-icon--Color: var(--pf-t--global--icon--color--disabled); |
| 9 |
--pf-v6-c-switch--LineHeight: var(--pf-t--global--font--line-height--body); |
| 10 |
--pf-v6-c-switch--Height: auto; |
| 11 |
--pf-v6-c-switch__input--checked__toggle--BackgroundColor: var(--pf-t--global--color--brand--default); |
| 12 |
--pf-v6-c-switch__input--checked__toggle--before--TranslateX: calc(100% + var(--pf-v6-c-switch__toggle-icon--Offset)); |
| 13 |
--pf-v6-c-switch__input--checked__toggle--BorderColor: transparent; |
| 14 |
--pf-v6-c-switch__input--checked__toggle--BorderWidth: var(--pf-t--global--border--width--high-contrast--regular); |
| 15 |
--pf-v6-c-switch__input--checked__label--Color: var(--pf-t--global--text--color--regular); |
| 16 |
--pf-v6-c-switch__input--not-checked__label--Color: var(--pf-t--global--text--color--subtle); |
| 17 |
--pf-v6-c-switch__input--disabled__label--Color: var(--pf-t--global--text--color--disabled); |
| 18 |
--pf-v6-c-switch__input--disabled__toggle--BackgroundColor: var(--pf-t--global--background--color--disabled--default); |
| 19 |
--pf-v6-c-switch__input--disabled__toggle--BorderColor: var(--pf-t--global--border--color--high-contrast); |
| 20 |
--pf-v6-c-switch__input--checked__toggle--before--BackgroundColor: var(--pf-t--global--icon--color--inverse); |
| 21 |
--pf-v6-c-switch__input--not-checked__toggle--before--BackgroundColor: var(--pf-t--global--icon--color--subtle); |
| 22 |
--pf-v6-c-switch__input--disabled__toggle--before--BackgroundColor: var(--pf-t--global--icon--color--on-disabled); |
| 23 |
--pf-v6-c-switch__input--focus__toggle--OutlineWidth: var(--pf-t--global--border--width--strong); |
| 24 |
--pf-v6-c-switch__input--focus__toggle--OutlineOffset: var(--pf-t--global--spacer--xs); |
| 25 |
--pf-v6-c-switch__input--focus__toggle--OutlineColor: var(--pf-t--global--color--brand--default); |
| 26 |
--pf-v6-c-switch__toggle--Height: calc(var(--pf-v6-c-switch--FontSize) * var(--pf-v6-c-switch--LineHeight)); |
| 27 |
--pf-v6-c-switch__toggle--BackgroundColor: var(--pf-t--global--background--color--control--default); |
| 28 |
--pf-v6-c-switch__toggle--BorderColor: var(--pf-t--global--border--color--control--default); |
| 29 |
--pf-v6-c-switch__toggle--BorderWidth: var(--pf-t--global--border--width--control--default); |
| 30 |
--pf-v6-c-switch__toggle--BorderRadius: var(--pf-t--global--border--radius--pill); |
| 31 |
--pf-v6-c-switch__toggle--before--Width: calc(var(--pf-v6-c-switch--FontSize) - var(--pf-v6-c-switch__toggle-icon--Offset)); |
| 32 |
--pf-v6-c-switch__toggle--before--Height: var(--pf-v6-c-switch__toggle--before--Width); |
| 33 |
--pf-v6-c-switch__toggle--before--InsetInlineStart: calc((var(--pf-v6-c-switch__toggle--Height) - var(--pf-v6-c-switch__toggle--before--Height)) / 2); |
| 34 |
--pf-v6-c-switch__toggle--before--BorderWidth: var(--pf-t--global--border--width--high-contrast--regular); |
| 35 |
--pf-v6-c-switch__toggle--before--BorderRadius: var(--pf-t--global--border--radius--large); |
| 36 |
--pf-v6-c-switch__toggle--before--TransitionTimingFunction: var(--pf-t--global--motion--timing-function--default); |
| 37 |
--pf-v6-c-switch__toggle--before--TransitionDuration: var(--pf-t--global--motion--duration--md); |
| 38 |
--pf-v6-c-switch__toggle--before--Transition: transform var(--pf-v6-c-switch__toggle--before--TransitionTimingFunction) var(--pf-v6-c-switch__toggle--before--TransitionDuration), background-color var(--pf-v6-c-switch__toggle--before--TransitionTimingFunction) var(--pf-v6-c-switch__toggle--before--TransitionDuration); |
| 39 |
--pf-v6-c-switch__toggle--Width: calc(var(--pf-v6-c-switch__toggle--Height) + var(--pf-v6-c-switch__toggle-icon--Offset) + var(--pf-v6-c-switch__toggle--before--Width)); |
| 40 |
} |
| 41 |
|
| 42 |
.pf-v6-c-switch { |
| 43 |
position: relative; |
| 44 |
display: inline-grid; |
| 45 |
grid-template-columns: auto; |
| 46 |
grid-auto-columns: 1fr; |
| 47 |
column-gap: var(--pf-v6-c-switch--ColumnGap); |
| 48 |
height: var(--pf-v6-c-switch--Height); |
| 49 |
font-size: var(--pf-v6-c-switch--FontSize); |
| 50 |
line-height: var(--pf-v6-c-switch--LineHeight); |
| 51 |
vertical-align: middle; |
| 52 |
cursor: pointer; |
| 53 |
} |
| 54 |
.pf-v6-c-switch.pf-m-reverse .pf-v6-c-switch__label, |
| 55 |
.pf-v6-c-switch.pf-m-reverse .pf-v6-c-switch__toggle { |
| 56 |
grid-row: 1; |
| 57 |
} |
| 58 |
.pf-v6-c-switch.pf-m-reverse .pf-v6-c-switch__label { |
| 59 |
grid-column: 1; |
| 60 |
} |
| 61 |
|
| 62 |
.pf-v6-c-switch__input { |
| 63 |
position: absolute; |
| 64 |
cursor: pointer; |
| 65 |
opacity: 0; |
| 66 |
} |
| 67 |
.pf-v6-c-switch__input:focus-visible ~ .pf-v6-c-switch__toggle { |
| 68 |
outline: var(--pf-v6-c-switch__input--focus__toggle--OutlineWidth) solid var(--pf-v6-c-switch__input--focus__toggle--OutlineColor); |
| 69 |
outline-offset: var(--pf-v6-c-switch__input--focus__toggle--OutlineOffset); |
| 70 |
} |
| 71 |
.pf-v6-c-switch__input:checked ~ .pf-v6-c-switch__label { |
| 72 |
color: var(--pf-v6-c-switch__input--checked__label--Color); |
| 73 |
} |
| 74 |
.pf-v6-c-switch__input:checked ~ .pf-v6-c-switch__toggle { |
| 75 |
--pf-v6-c-switch__toggle--BorderWidth: var(--pf-v6-c-switch__input--checked__toggle--BorderWidth); |
| 76 |
--pf-v6-c-switch__toggle--BorderColor: var(--pf-v6-c-switch__input--checked__toggle--BorderColor); |
| 77 |
background-color: var(--pf-v6-c-switch__input--checked__toggle--BackgroundColor); |
| 78 |
} |
| 79 |
.pf-v6-c-switch__input:checked ~ .pf-v6-c-switch__toggle::before { |
| 80 |
transform: translate(var(--pf-v6-c-switch__input--checked__toggle--before--TranslateX), -50%); |
| 81 |
} |
| 82 |
:where(.pf-v6-m-dir-rtl, [dir=rtl]) .pf-v6-c-switch__input:checked ~ .pf-v6-c-switch__toggle::before { |
| 83 |
transform: translate(calc(var(--pf-v6-c-switch__input--checked__toggle--before--TranslateX) * var(--pf-v6-global--inverse--multiplier)), -50%); |
| 84 |
} |
| 85 |
|
| 86 |
.pf-v6-c-switch__input:checked ~ .pf-v6-c-switch__toggle::before { |
| 87 |
background-color: var(--pf-v6-c-switch__input--checked__toggle--before--BackgroundColor); |
| 88 |
} |
| 89 |
.pf-v6-c-switch__input:not(:checked) ~ .pf-v6-c-switch__label { |
| 90 |
color: var(--pf-v6-c-switch__input--not-checked__label--Color); |
| 91 |
} |
| 92 |
.pf-v6-c-switch__input:not(:checked) ~ .pf-v6-c-switch__toggle .pf-v6-c-switch__toggle-icon { |
| 93 |
display: none; |
| 94 |
} |
| 95 |
.pf-v6-c-switch__input:disabled { |
| 96 |
cursor: not-allowed; |
| 97 |
} |
| 98 |
.pf-v6-c-switch__input:disabled ~ .pf-v6-c-switch__label { |
| 99 |
color: var(--pf-v6-c-switch__input--disabled__label--Color); |
| 100 |
cursor: not-allowed; |
| 101 |
} |
| 102 |
.pf-v6-c-switch__input:disabled ~ .pf-v6-c-switch__toggle { |
| 103 |
--pf-v6-c-switch__toggle-icon--Color: var(--pf-v6-c-switch__input--disabled__toggle-icon--Color); |
| 104 |
--pf-v6-c-switch__toggle--BorderColor: var(--pf-v6-c-switch__input--disabled__toggle--BorderColor); |
| 105 |
cursor: not-allowed; |
| 106 |
background-color: var(--pf-v6-c-switch__input--disabled__toggle--BackgroundColor); |
| 107 |
} |
| 108 |
.pf-v6-c-switch__input:disabled ~ .pf-v6-c-switch__toggle::before { |
| 109 |
background-color: var(--pf-v6-c-switch__input--disabled__toggle--before--BackgroundColor); |
| 110 |
} |
| 111 |
|
| 112 |
.pf-v6-c-switch__toggle { |
| 113 |
position: relative; |
| 114 |
display: inline-block; |
| 115 |
width: var(--pf-v6-c-switch__toggle--Width); |
| 116 |
height: var(--pf-v6-c-switch__toggle--Height); |
| 117 |
background-color: var(--pf-v6-c-switch__toggle--BackgroundColor); |
| 118 |
border-radius: var(--pf-v6-c-switch__toggle--BorderRadius); |
| 119 |
} |
| 120 |
.pf-v6-c-switch__toggle::before { |
| 121 |
position: absolute; |
| 122 |
inset-block-start: 50%; |
| 123 |
inset-inline-start: var(--pf-v6-c-switch__toggle--before--InsetInlineStart); |
| 124 |
display: block; |
| 125 |
width: var(--pf-v6-c-switch__toggle--before--Width); |
| 126 |
height: var(--pf-v6-c-switch__toggle--before--Height); |
| 127 |
content: ""; |
| 128 |
background-color: var(--pf-v6-c-switch__input--not-checked__toggle--before--BackgroundColor); |
| 129 |
border: var(--pf-v6-c-switch__toggle--before--BorderWidth) solid transparent; |
| 130 |
border-radius: var(--pf-v6-c-switch__toggle--before--BorderRadius); |
| 131 |
transform: translateY(-50%); |
| 132 |
transition: var(--pf-v6-c-switch__toggle--before--Transition); |
| 133 |
} |
| 134 |
.pf-v6-c-switch__toggle::after { |
| 135 |
position: absolute; |
| 136 |
inset: 0; |
| 137 |
content: ""; |
| 138 |
border: var(--pf-v6-c-switch__toggle--BorderWidth) solid var(--pf-v6-c-switch__toggle--BorderColor); |
| 139 |
border-radius: var(--pf-v6-c-switch__toggle--BorderRadius); |
| 140 |
} |
| 141 |
|
| 142 |
.pf-v6-c-switch__toggle-icon { |
| 143 |
position: absolute; |
| 144 |
inset-block-start: 0; |
| 145 |
inset-block-end: 0; |
| 146 |
inset-inline-start: var(--pf-v6-c-switch__toggle-icon--InsetInlineStart); |
| 147 |
display: flex; |
| 148 |
align-items: center; |
| 149 |
font-size: var(--pf-v6-c-switch__toggle-icon--FontSize); |
| 150 |
color: var(--pf-v6-c-switch__toggle-icon--Color); |
| 151 |
} |
| 152 |
|
| 153 |
.pf-v6-c-switch__label { |
| 154 |
display: inline-block; |
| 155 |
grid-column: 2; |
| 156 |
vertical-align: top; |
| 157 |
} |