| 1 |
@use '../../sass-utilities' as *; |
| 2 |
|
| 3 |
@include pf-root($slider) { |
| 4 |
--#{$slider}--value: 0; // should always be set inline |
| 5 |
--#{$slider}__step--InsetInlineStart: 0; // should always be set inline |
| 6 |
|
| 7 |
// rail |
| 8 |
--#{$slider}__rail--PaddingBlockStart: var(--pf-t--global--spacer--md); |
| 9 |
--#{$slider}__rail--PaddingBlockEnd: var(--pf-t--global--spacer--md); |
| 10 |
--#{$slider}__rail-track--Height: #{pf-size-prem(4px)}; |
| 11 |
--#{$slider}__rail-track--before--base--BackgroundColor: var(--pf-t--global--color--nonstatus--gray--default); |
| 12 |
--#{$slider}__rail-track--before--fill--BackgroundColor: var(--pf-t--global--border--color--hover); |
| 13 |
--#{$slider}__rail-track--before--BorderWidth: var(--pf-t--global--border--width--high-contrast--regular); |
| 14 |
--#{$slider}__rail-track--before--BorderColor: transparent; |
| 15 |
--#{$slider}__rail-track--before--BorderRadius: var(--pf-t--global--border--radius--tiny); |
| 16 |
--#{$slider}__rail-track--before--fill--BackgroundColor--gradient-stop: var(--#{$slider}--value); |
| 17 |
|
| 18 |
// steps |
| 19 |
--#{$slider}__steps--FontSize: var(--pf-t--global--font--size--sm); |
| 20 |
--#{$slider}__steps--Height: var(--#{$slider}__steps--FontSize); |
| 21 |
|
| 22 |
// step tick |
| 23 |
--#{$slider}__step-tick--InsetBlockStart: var(--pf-t--global--spacer--md); |
| 24 |
--#{$slider}__step-tick--Width: 0.15rem; |
| 25 |
--#{$slider}__step-tick--Height: #{pf-size-prem(4px)}; |
| 26 |
--#{$slider}__step-tick--BackgroundColor: var(--pf-t--global--icon--color--nonstatus--on-gray--default); |
| 27 |
--#{$slider}__step-tick--TranslateX: -50%; |
| 28 |
--#{$slider}__step-tick--BorderWidth: var(--pf-t--global--border--width--high-contrast--regular); |
| 29 |
--#{$slider}__step-tick--BorderColor: transparent; |
| 30 |
--#{$slider}__step-tick--BorderRadius: var(--pf-t--global--border--radius--sharp); |
| 31 |
--#{$slider}__step--m-active__slider-tick--BackgroundColor: var(--pf-t--global--icon--color--on-brand--default); |
| 32 |
--#{$slider}__step--first-child__step-tick--TranslateX: 0; |
| 33 |
--#{$slider}__step--last-child__step-tick--TranslateX: -100%; |
| 34 |
|
| 35 |
// step label |
| 36 |
--#{$slider}__step-label--TranslateX: -50%; |
| 37 |
--#{$slider}__step-label--InsetBlockStart: calc(var(--pf-t--global--spacer--xl) + var(--#{$slider}__rail-track--Height)); |
| 38 |
--#{$slider}__step--first-child__step-label--TranslateX: 0; |
| 39 |
--#{$slider}__step--last-child__step-label--TranslateX: -100%; |
| 40 |
|
| 41 |
// thumb |
| 42 |
--#{$slider}__thumb--InsetBlockStart: calc(var(--#{$slider}__rail-track--Height) / 2 + var(--pf-t--global--spacer--md)); |
| 43 |
--#{$slider}__thumb--Width: #{pf-size-prem(16px)}; |
| 44 |
--#{$slider}__thumb--Height: #{pf-size-prem(16px)}; |
| 45 |
--#{$slider}__thumb--InsetInlineStart: var(--#{$slider}--value); |
| 46 |
--#{$slider}__thumb--BackgroundColor: var(--pf-t--global--color--brand--default); |
| 47 |
--#{$slider}__thumb--TranslateX: -50%; |
| 48 |
--#{$slider}__thumb--TranslateY: -50%; |
| 49 |
--#{$slider}__thumb--BorderWidth: var(--pf-t--global--border--width--high-contrast--regular); |
| 50 |
--#{$slider}__thumb--BorderColor: transparent; |
| 51 |
--#{$slider}__thumb--BorderRadius: var(--pf-t--global--border--radius--large); |
| 52 |
--#{$slider}__thumb--BoxShadow--base: |
| 53 |
0 0 0 2px var(--pf-t--global--background--color--primary--default), |
| 54 |
0 0 0 3px var(--pf-t--global--color--brand--default); |
| 55 |
--#{$slider}__thumb--hover--BoxShadow: var(--#{$slider}__thumb--BoxShadow--base); |
| 56 |
--#{$slider}__thumb--focus--BoxShadow: var(--#{$slider}__thumb--BoxShadow--base); |
| 57 |
--#{$slider}__thumb--active--BoxShadow: |
| 58 |
var(--#{$slider}__thumb--BoxShadow--base), |
| 59 |
0 0 2px 5px var(--pf-t--global--color--nonstatus--blue--clicked); |
| 60 |
--#{$slider}__thumb--before--Width: 44px; |
| 61 |
--#{$slider}__thumb--before--Height: var(--#{$slider}__thumb--before--Width); |
| 62 |
--#{$slider}__thumb--before--BorderRadius: var(--pf-t--global--border--radius--large); |
| 63 |
--#{$slider}__thumb--before--TranslateX: -50%; |
| 64 |
--#{$slider}__thumb--before--TranslateY: -50%; |
| 65 |
|
| 66 |
// value |
| 67 |
--#{$slider}__value--MarginInlineStart: var(--pf-t--global--spacer--md); |
| 68 |
--#{$slider}__value--c-form-control--width-base: calc(var(--pf-t--global--spacer--control--horizontal--default) + var(--pf-t--global--spacer--control--horizontal--default) + #{pf-size-prem(20px)}); // form control base width + number input spinner width |
| 69 |
--#{$slider}__value--c-form-control--width-chars: 3; |
| 70 |
--#{$slider}__value--c-form-control--Width: calc(var(--#{$slider}__value--c-form-control--width-base) + var(--#{$slider}__value--c-form-control--width-chars) * 1ch); |
| 71 |
--#{$slider}__value--m-floating--TranslateX: -50%; |
| 72 |
--#{$slider}__value--m-floating--TranslateY: -100%; |
| 73 |
--#{$slider}__value--m-floating--InsetInlineStart: var(--#{$slider}--value); |
| 74 |
--#{$slider}__value--m-floating--ZIndex: var(--pf-t--global--z-index--sm); |
| 75 |
|
| 76 |
// actions |
| 77 |
--#{$slider}__actions--MarginInlineEnd: var(--pf-t--global--spacer--sm); |
| 78 |
--#{$slider}__main--actions--MarginInlineStart: var(--pf-t--global--spacer--sm); |
| 79 |
|
| 80 |
// disabled |
| 81 |
--#{$slider}--m-disabled__rail-track--before--fill--BackgroundColor: var(--pf-t--global--background--color--disabled--default); |
| 82 |
--#{$slider}--m-disabled__step--m-active__slider-tick--BackgroundColor: var(--pf-t--global--icon--color--disabled); |
| 83 |
--#{$slider}--m-disabled__thumb--BackgroundColor: var(--pf-t--global--background--color--disabled--default); |
| 84 |
} |
| 85 |
|
| 86 |
.#{$slider} { |
| 87 |
@include pf-v6-bidirectional-style( |
| 88 |
$prop: --#{$slider}__rail-track--before--fill--direction, |
| 89 |
$ltr-val: right, |
| 90 |
$rtl-val: left |
| 91 |
); |
| 92 |
|
| 93 |
display: flex; |
| 94 |
|
| 95 |
&.pf-m-disabled { |
| 96 |
--#{$slider}__rail-track--before--fill--BackgroundColor: var(--#{$slider}--m-disabled__rail-track--before--fill--BackgroundColor); |
| 97 |
--#{$slider}__step--m-active__slider-tick--BackgroundColor: var(--#{$slider}--m-disabled__step--m-active__slider-tick--BackgroundColor); |
| 98 |
--#{$slider}__thumb--BackgroundColor: var(--#{$slider}--m-disabled__thumb--BackgroundColor); |
| 99 |
|
| 100 |
.#{$slider}__rail, |
| 101 |
.#{$slider}__thumb { |
| 102 |
cursor: not-allowed; |
| 103 |
} |
| 104 |
|
| 105 |
.#{$slider}__thumb { |
| 106 |
--#{$slider}__thumb--BoxShadow: none; |
| 107 |
} |
| 108 |
} |
| 109 |
} |
| 110 |
|
| 111 |
.#{$slider}__main { |
| 112 |
position: relative; |
| 113 |
flex-grow: 1; |
| 114 |
} |
| 115 |
|
| 116 |
.#{$slider}__rail { |
| 117 |
padding-block-start: var(--#{$slider}__rail--PaddingBlockStart); |
| 118 |
padding-block-end: var(--#{$slider}__rail--PaddingBlockEnd); |
| 119 |
} |
| 120 |
|
| 121 |
.#{$slider}__rail-track { |
| 122 |
position: relative; |
| 123 |
height: var(--#{$slider}__rail-track--Height); |
| 124 |
|
| 125 |
&::before { |
| 126 |
position: absolute; |
| 127 |
inset: 0; |
| 128 |
content: ""; |
| 129 |
background: |
| 130 |
linear-gradient( |
| 131 |
to var(--#{$slider}__rail-track--before--fill--direction), |
| 132 |
var(--#{$slider}__rail-track--before--fill--BackgroundColor), |
| 133 |
var(--#{$slider}__rail-track--before--fill--BackgroundColor) var(--#{$slider}__rail-track--before--fill--BackgroundColor--gradient-stop), |
| 134 |
var(--#{$slider}__rail-track--before--base--BackgroundColor) var(--#{$slider}__rail-track--before--fill--BackgroundColor--gradient-stop) |
| 135 |
); |
| 136 |
border: var(--#{$slider}__rail-track--before--BorderWidth) solid var(--#{$slider}__rail-track--before--BorderColor); |
| 137 |
border-radius: var(--#{$slider}__rail-track--before--BorderRadius); |
| 138 |
} |
| 139 |
} |
| 140 |
|
| 141 |
.#{$slider}__steps { |
| 142 |
height: var(--#{$slider}__steps--Height); |
| 143 |
font-size: var(--#{$slider}__steps--FontSize); |
| 144 |
line-height: 1; |
| 145 |
} |
| 146 |
|
| 147 |
.#{$slider}__step { |
| 148 |
position: absolute; |
| 149 |
inset-block-start: 0; |
| 150 |
inset-inline-start: var(--#{$slider}__step--InsetInlineStart); // set programmatically as an inline style |
| 151 |
content: ""; |
| 152 |
|
| 153 |
&.pf-m-active { |
| 154 |
--#{$slider}__step-tick--BackgroundColor: var(--#{$slider}__step--m-active__slider-tick--BackgroundColor); |
| 155 |
} |
| 156 |
|
| 157 |
&:first-child { |
| 158 |
--#{$slider}__step-tick--TranslateX: var(--#{$slider}__step--first-child__step-tick--TranslateX); |
| 159 |
--#{$slider}__step-label--TranslateX: var(--#{$slider}__step--first-child__step-label--TranslateX); |
| 160 |
} |
| 161 |
|
| 162 |
&:last-child { |
| 163 |
--#{$slider}__step-tick--TranslateX: var(--#{$slider}__step--last-child__step-tick--TranslateX); |
| 164 |
--#{$slider}__step-label--TranslateX: var(--#{$slider}__step--last-child__step-label--TranslateX); |
| 165 |
} |
| 166 |
} |
| 167 |
|
| 168 |
.#{$slider}__step-tick { |
| 169 |
@include pf-v6-bidirectional-style( |
| 170 |
$prop: transform, |
| 171 |
$ltr-val: translateX(var(--#{$slider}__step-tick--TranslateX)), |
| 172 |
$rtl-val: translateX(#{pf-v6-calc-inverse(var(--#{$slider}__step-tick--TranslateX))}) |
| 173 |
); |
| 174 |
|
| 175 |
position: absolute; |
| 176 |
inset-block-start: var(--#{$slider}__step-tick--InsetBlockStart); |
| 177 |
inset-inline-start: 0; |
| 178 |
width: var(--#{$slider}__step-tick--Width); |
| 179 |
height: var(--#{$slider}__step-tick--Height); |
| 180 |
background-color: var(--#{$slider}__step-tick--BackgroundColor); |
| 181 |
border: var(--#{$slider}__step-tick--BorderWidth) solid var(--#{$slider}__step-tick--BorderColor); |
| 182 |
border-radius: var(--#{$slider}__step-tick--BorderRadius); |
| 183 |
} |
| 184 |
|
| 185 |
.#{$slider}__step-label { |
| 186 |
@include pf-v6-bidirectional-style( |
| 187 |
$prop: transform, |
| 188 |
$ltr-val: translateX(var(--#{$slider}__step-label--TranslateX)), |
| 189 |
$rtl-val: translateX(#{pf-v6-calc-inverse(var(--#{$slider}__step-label--TranslateX))}) |
| 190 |
); |
| 191 |
|
| 192 |
position: absolute; |
| 193 |
inset-block-start: var(--#{$slider}__step-label--InsetBlockStart); |
| 194 |
word-break: normal; |
| 195 |
} |
| 196 |
|
| 197 |
.#{$slider}__thumb { |
| 198 |
@include pf-v6-bidirectional-style( |
| 199 |
$prop: transform, |
| 200 |
$ltr-val: translate(var(--#{$slider}__thumb--TranslateX), var(--#{$slider}__thumb--TranslateY)), |
| 201 |
$rtl-val: translate(#{pf-v6-calc-inverse(var(--#{$slider}__thumb--TranslateX))}, var(--#{$slider}__thumb--TranslateY)) |
| 202 |
); |
| 203 |
|
| 204 |
position: absolute; |
| 205 |
inset-block-start: var(--#{$slider}__thumb--InsetBlockStart); |
| 206 |
inset-inline-start: var(--#{$slider}__thumb--InsetInlineStart); |
| 207 |
width: var(--#{$slider}__thumb--Width); |
| 208 |
height: var(--#{$slider}__thumb--Height); |
| 209 |
cursor: pointer; |
| 210 |
background-color: var(--#{$slider}__thumb--BackgroundColor); |
| 211 |
border: var(--#{$slider}__thumb--BorderWidth) solid var(--#{$slider}__thumb--BorderColor); |
| 212 |
border-radius: var(--#{$slider}__thumb--BorderRadius); |
| 213 |
box-shadow: var(--#{$slider}__thumb--BoxShadow); |
| 214 |
|
| 215 |
&::before { |
| 216 |
@include pf-v6-bidirectional-style( |
| 217 |
$prop: transform, |
| 218 |
$ltr-val: translate(var(--#{$slider}__thumb--before--TranslateX), var(--#{$slider}__thumb--before--TranslateY)), |
| 219 |
$rtl-val: translate(#{pf-v6-calc-inverse(var(--#{$slider}__thumb--before--TranslateX))}, var(--#{$slider}__thumb--before--TranslateY)) |
| 220 |
); |
| 221 |
|
| 222 |
position: absolute; |
| 223 |
inset-block-start: 50%; |
| 224 |
inset-inline-start: 50%; |
| 225 |
width: var(--#{$slider}__thumb--before--Width); |
| 226 |
height: var(--#{$slider}__thumb--before--Height); |
| 227 |
content: ""; |
| 228 |
border-radius: var(--#{$slider}__thumb--before--BorderRadius); |
| 229 |
} |
| 230 |
|
| 231 |
&:hover { |
| 232 |
--#{$slider}__thumb--BoxShadow: var(--#{$slider}__thumb--hover--BoxShadow); |
| 233 |
} |
| 234 |
|
| 235 |
&:focus { |
| 236 |
--#{$slider}__thumb--BoxShadow: var(--#{$slider}__thumb--focus--BoxShadow); |
| 237 |
|
| 238 |
outline: 0; |
| 239 |
} |
| 240 |
|
| 241 |
&:active { |
| 242 |
--#{$slider}__thumb--BoxShadow: var(--#{$slider}__thumb--active--BoxShadow); |
| 243 |
} |
| 244 |
} |
| 245 |
|
| 246 |
.#{$slider}__value { |
| 247 |
margin-inline-start: var(--#{$slider}__value--MarginInlineStart); |
| 248 |
|
| 249 |
&.pf-m-floating { |
| 250 |
@include pf-v6-bidirectional-style( |
| 251 |
$prop: transform, |
| 252 |
$ltr-val: translate(var(--#{$slider}__value--m-floating--TranslateX), var(--#{$slider}__value--m-floating--TranslateY)), |
| 253 |
$rtl-val: translate(#{pf-v6-calc-inverse(var(--#{$slider}__value--m-floating--TranslateX))}, var(--#{$slider}__value--m-floating--TranslateY)), |
| 254 |
); |
| 255 |
|
| 256 |
--#{$slider}__value--MarginInlineStart: 0; |
| 257 |
|
| 258 |
position: absolute; |
| 259 |
inset-block-start: 0; |
| 260 |
inset-inline-start: var(--#{$slider}__value--m-floating--InsetInlineStart); |
| 261 |
z-index: var(--#{$slider}__value--m-floating--ZIndex); |
| 262 |
} |
| 263 |
|
| 264 |
.#{$form-control} { |
| 265 |
width: var(--#{$slider}__value--c-form-control--Width); |
| 266 |
} |
| 267 |
} |
| 268 |
|
| 269 |
.#{$slider}__actions { |
| 270 |
display: flex; |
| 271 |
margin-inline-end: var(--#{$slider}__actions--MarginInlineEnd); |
| 272 |
|
| 273 |
.#{$slider}__main ~ & { |
| 274 |
--#{$slider}__actions--MarginInlineEnd: 0; |
| 275 |
|
| 276 |
margin-inline-start: var(--#{$slider}__main--actions--MarginInlineStart); |
| 277 |
} |
| 278 |
} |