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