| 1 |
@use '../../sass-utilities' as *; |
| 2 |
|
| 3 |
@include pf-root($skeleton) { |
| 4 |
--#{$skeleton}--BackgroundColor: var(--pf-t--global--background--color--secondary--default); |
| 5 |
--#{$skeleton}--Width: auto; |
| 6 |
--#{$skeleton}--Height: auto; |
| 7 |
--#{$skeleton}--BorderRadius: var(--pf-t--global--spacer--sm); |
| 8 |
|
| 9 |
// Before |
| 10 |
--#{$skeleton}--before--PaddingBlockEnd: 0; |
| 11 |
--#{$skeleton}--before--Height: auto; |
| 12 |
--#{$skeleton}--before--Content: "\00a0"; |
| 13 |
|
| 14 |
// After |
| 15 |
--#{$skeleton}--after--LinearGradientAngle: 90deg; |
| 16 |
--#{$skeleton}--after--LinearGradientColorStop1: var(--pf-t--global--background--color--secondary--default); |
| 17 |
--#{$skeleton}--after--LinearGradientColorStop2: var(--pf-t--global--background--color--secondary--hover); |
| 18 |
--#{$skeleton}--after--LinearGradientColorStop3: var(--pf-t--global--background--color--secondary--default); |
| 19 |
--#{$skeleton}--after--TranslateX: 0; |
| 20 |
--#{$skeleton}--after--AnimationName: #{$skeleton}-loading-reduced-motion; |
| 21 |
--#{$skeleton}--after--AnimationDuration: 3s; |
| 22 |
--#{$skeleton}--after--AnimationIterationCount: infinite; |
| 23 |
--#{$skeleton}--after--AnimationTimingFunction: linear; |
| 24 |
--#{$skeleton}--after--AnimationDelay: .5s; |
| 25 |
|
| 26 |
@media screen and (prefers-reduced-motion: no-preference) { |
| 27 |
--#{$skeleton}--after--LinearGradientColorStop1: var(--pf-t--global--background--color--secondary--default); |
| 28 |
--#{$skeleton}--after--LinearGradientColorStop2: var(--pf-t--global--background--color--secondary--hover); |
| 29 |
--#{$skeleton}--after--LinearGradientColorStop3: var(--pf-t--global--background--color--secondary--default); |
| 30 |
--#{$skeleton}--after--TranslateX: -100%; |
| 31 |
--#{$skeleton}--after--AnimationName: #{$skeleton}-loading; |
| 32 |
} |
| 33 |
|
| 34 |
// Circle |
| 35 |
--#{$skeleton}--m-circle--BorderRadius: var(--pf-t--global--border--radius--pill); |
| 36 |
--#{$skeleton}--m-circle--before--PaddingBlockEnd: 100%; |
| 37 |
|
| 38 |
// Text modifiers |
| 39 |
--#{$skeleton}--m-text-4xl--Height: calc(var(--pf-t--global--font--size--4xl) * var(--pf-t--global--font--line-height--heading)); |
| 40 |
--#{$skeleton}--m-text-3xl--Height: calc(var(--pf-t--global--font--size--3xl) * var(--pf-t--global--font--line-height--heading)); |
| 41 |
--#{$skeleton}--m-text-2xl--Height: calc(var(--pf-t--global--font--size--2xl) * var(--pf-t--global--font--line-height--heading)); |
| 42 |
--#{$skeleton}--m-text-xl--Height: calc(var(--pf-t--global--font--size--xl) * var(--pf-t--global--font--line-height--heading)); |
| 43 |
--#{$skeleton}--m-text-lg--Height: calc(var(--pf-t--global--font--size--lg) * var(--pf-t--global--font--line-height--body)); |
| 44 |
--#{$skeleton}--m-text-md--Height: calc(var(--pf-t--global--font--size--md) * var(--pf-t--global--font--line-height--body)); |
| 45 |
--#{$skeleton}--m-text-sm--Height: calc(var(--pf-t--global--font--size--sm) * var(--pf-t--global--font--line-height--body)); |
| 46 |
|
| 47 |
// Width |
| 48 |
--#{$skeleton}--m-width-sm--Width: #{pf-size-prem(100px)}; |
| 49 |
--#{$skeleton}--m-width-md--Width: #{pf-size-prem(200px)}; |
| 50 |
--#{$skeleton}--m-width-lg--Width: #{pf-size-prem(300px)}; |
| 51 |
--#{$skeleton}--m-width-25--Width: 25%; |
| 52 |
--#{$skeleton}--m-width-33--Width: calc(100% / 3); |
| 53 |
--#{$skeleton}--m-width-50--Width: 50%; |
| 54 |
--#{$skeleton}--m-width-66--Width: calc(100% / 3 * 2); |
| 55 |
--#{$skeleton}--m-width-75--Width: 75%; |
| 56 |
|
| 57 |
// Height |
| 58 |
--#{$skeleton}--m-height-sm--Height: #{pf-size-prem(100px)}; |
| 59 |
--#{$skeleton}--m-height-md--Height: #{pf-size-prem(200px)}; |
| 60 |
--#{$skeleton}--m-height-lg--Height: #{pf-size-prem(300px)}; |
| 61 |
--#{$skeleton}--m-height-25--Height: 25%; |
| 62 |
--#{$skeleton}--m-height-33--Height: calc(100% / 3); |
| 63 |
--#{$skeleton}--m-height-50--Height: 50%; |
| 64 |
--#{$skeleton}--m-height-66--Height: calc(100% / 3 * 2); |
| 65 |
--#{$skeleton}--m-height-75--Height: 75%; |
| 66 |
--#{$skeleton}--m-height-100--Height: 100%; |
| 67 |
} |
| 68 |
|
| 69 |
.#{$skeleton} { |
| 70 |
position: relative; |
| 71 |
width: var(--#{$skeleton}--Width); |
| 72 |
height: var(--#{$skeleton}--Height); |
| 73 |
overflow: hidden; |
| 74 |
background-color: var(--#{$skeleton}--BackgroundColor); |
| 75 |
border-radius: var(--#{$skeleton}--BorderRadius); |
| 76 |
transform: translate(0); // Creates stacking context necessary for safari |
| 77 |
|
| 78 |
&::before { |
| 79 |
display: block; |
| 80 |
height: var(--#{$skeleton}--before--Height); |
| 81 |
padding-block-end: var(--#{$skeleton}--before--PaddingBlockEnd); |
| 82 |
content: var(--#{$skeleton}--before--Content); |
| 83 |
} |
| 84 |
|
| 85 |
&::after { |
| 86 |
@include pf-v6-mirror-inline-on-rtl; |
| 87 |
|
| 88 |
position: absolute; |
| 89 |
inset: 0; |
| 90 |
display: block; |
| 91 |
content: ""; |
| 92 |
background: linear-gradient(var(--#{$skeleton}--after--LinearGradientAngle), var(--#{$skeleton}--after--LinearGradientColorStop1), var(--#{$skeleton}--after--LinearGradientColorStop2), var(--#{$skeleton}--after--LinearGradientColorStop3)); |
| 93 |
transform: translate3d(var(--#{$skeleton}--after--TranslateX), 0, 0); // translateZ() to force GPU acceleration |
| 94 |
animation: var(--#{$skeleton}--after--AnimationName) var(--#{$skeleton}--after--AnimationDuration) var(--#{$skeleton}--after--AnimationTimingFunction) var(--#{$skeleton}--after--AnimationDelay) var(--#{$skeleton}--after--AnimationIterationCount); |
| 95 |
} |
| 96 |
|
| 97 |
// Circle |
| 98 |
&.pf-m-circle { |
| 99 |
--#{$skeleton}--BorderRadius: var(--#{$skeleton}--m-circle--BorderRadius); |
| 100 |
} |
| 101 |
|
| 102 |
&.pf-m-square, |
| 103 |
&.pf-m-circle { |
| 104 |
--#{$skeleton}--before--Height: 0; |
| 105 |
--#{$skeleton}--before--PaddingBlockEnd: var(--#{$skeleton}--m-circle--before--PaddingBlockEnd); |
| 106 |
} |
| 107 |
|
| 108 |
// Width |
| 109 |
&.pf-m-width-sm { |
| 110 |
--#{$skeleton}--Width: var(--#{$skeleton}--m-width-sm--Width); |
| 111 |
} |
| 112 |
|
| 113 |
&.pf-m-width-md { |
| 114 |
--#{$skeleton}--Width: var(--#{$skeleton}--m-width-md--Width); |
| 115 |
} |
| 116 |
|
| 117 |
&.pf-m-width-lg { |
| 118 |
--#{$skeleton}--Width: var(--#{$skeleton}--m-width-lg--Width); |
| 119 |
} |
| 120 |
|
| 121 |
&.pf-m-width-25 { |
| 122 |
--#{$skeleton}--Width: var(--#{$skeleton}--m-width-25--Width); |
| 123 |
} |
| 124 |
|
| 125 |
&.pf-m-width-33 { |
| 126 |
--#{$skeleton}--Width: var(--#{$skeleton}--m-width-33--Width); |
| 127 |
} |
| 128 |
|
| 129 |
&.pf-m-width-50 { |
| 130 |
--#{$skeleton}--Width: var(--#{$skeleton}--m-width-50--Width); |
| 131 |
} |
| 132 |
|
| 133 |
&.pf-m-width-66 { |
| 134 |
--#{$skeleton}--Width: var(--#{$skeleton}--m-width-66--Width); |
| 135 |
} |
| 136 |
|
| 137 |
&.pf-m-width-75 { |
| 138 |
--#{$skeleton}--Width: var(--#{$skeleton}--m-width-75--Width); |
| 139 |
} |
| 140 |
|
| 141 |
// Height |
| 142 |
&.pf-m-height-sm { |
| 143 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-height-sm--Height); |
| 144 |
} |
| 145 |
|
| 146 |
&.pf-m-height-md { |
| 147 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-height-md--Height); |
| 148 |
} |
| 149 |
|
| 150 |
&.pf-m-height-lg { |
| 151 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-height-lg--Height); |
| 152 |
} |
| 153 |
|
| 154 |
&.pf-m-height-25 { |
| 155 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-height-25--Height); |
| 156 |
} |
| 157 |
|
| 158 |
&.pf-m-height-33 { |
| 159 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-height-33--Height); |
| 160 |
} |
| 161 |
|
| 162 |
&.pf-m-height-50 { |
| 163 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-height-50--Height); |
| 164 |
} |
| 165 |
|
| 166 |
&.pf-m-height-66 { |
| 167 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-height-66--Height); |
| 168 |
} |
| 169 |
|
| 170 |
&.pf-m-height-75 { |
| 171 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-height-75--Height); |
| 172 |
} |
| 173 |
|
| 174 |
&.pf-m-height-100 { |
| 175 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-height-100--Height); |
| 176 |
} |
| 177 |
|
| 178 |
&.pf-m-text-4xl { |
| 179 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-text-4xl--Height); |
| 180 |
} |
| 181 |
|
| 182 |
&.pf-m-text-3xl { |
| 183 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-text-3xl--Height); |
| 184 |
} |
| 185 |
|
| 186 |
&.pf-m-text-2xl { |
| 187 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-text-2xl--Height); |
| 188 |
} |
| 189 |
|
| 190 |
&.pf-m-text-xl { |
| 191 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-text-xl--Height); |
| 192 |
} |
| 193 |
|
| 194 |
&.pf-m-text-lg { |
| 195 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-text-lg--Height); |
| 196 |
} |
| 197 |
|
| 198 |
&.pf-m-text-md { |
| 199 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-text-md--Height); |
| 200 |
} |
| 201 |
|
| 202 |
&.pf-m-text-sm { |
| 203 |
--#{$skeleton}--Height: var(--#{$skeleton}--m-text-sm--Height); |
| 204 |
} |
| 205 |
} |
| 206 |
|
| 207 |
@keyframes #{$skeleton}-loading { |
| 208 |
0% { |
| 209 |
transform: translateX(-100%); |
| 210 |
} |
| 211 |
|
| 212 |
60% { |
| 213 |
transform: translateX(100%); |
| 214 |
} |
| 215 |
|
| 216 |
100% { |
| 217 |
transform: translateX(100%); |
| 218 |
} |
| 219 |
} |
| 220 |
|
| 221 |
@keyframes #{$skeleton}-loading-reduced-motion { |
| 222 |
0% { |
| 223 |
opacity: 0.25; |
| 224 |
} |
| 225 |
|
| 226 |
60% { |
| 227 |
opacity: 1; |
| 228 |
} |
| 229 |
|
| 230 |
100% { |
| 231 |
opacity: 0.25; |
| 232 |
} |
| 233 |
} |