@pushwoosh/dumb-components 1.1.200 → 1.1.201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Skeleton/styles.js +8 -3
- package/package.json +1 -1
package/Skeleton/styles.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import styled, { keyframes, css } from 'styled-components';
|
|
2
|
-
import { Color } from '@pushwoosh/kit-constants';
|
|
2
|
+
import { Color, THEME_ATTRIBUTE } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { toCssValue } from '@pushwoosh/kit-helpers';
|
|
4
4
|
const pulseKeyframe = keyframes(["0%{opacity:1;}50%{opacity:0.4;}100%{opacity:1;}"]);
|
|
5
|
+
const accentKeyframe = keyframes(["0%,100%{background-color:", ";}33%{background-color:", ";}66%{background-color:", ";}"], Color.BRIGHT, Color.SUCCESS, Color.EXCEPTIONAL);
|
|
6
|
+
// Only when the caller left the colour to us: an explicit `color` is intent, not a default.
|
|
7
|
+
const accentCycleCss = css(["[", "='dark'] &{animation:", " 1.5s ease-in-out 0.5s infinite,", " 3s linear infinite;}@media (prefers-reduced-motion:reduce){[", "='dark'] &{animation:", " 1.5s ease-in-out 0.5s infinite;background-color:", ";}}"], THEME_ATTRIBUTE, pulseKeyframe, accentKeyframe, THEME_ATTRIBUTE, pulseKeyframe, Color.BRIGHT);
|
|
5
8
|
const borderRadiusCss = css(["border-radius:", ";"], ({
|
|
6
9
|
borderRadius
|
|
7
10
|
}) => typeof borderRadius === 'undefined' ? 'initial' : toCssValue(borderRadius));
|
|
8
|
-
const skeletonCommonCss = css(["background-color:", ";animation:", " 1.5s ease-in-out 0.5s infinite;"], ({
|
|
11
|
+
const skeletonCommonCss = css(["background-color:", ";animation:", " 1.5s ease-in-out 0.5s infinite;", ""], ({
|
|
9
12
|
color
|
|
10
|
-
}) => color || Color.FORM, pulseKeyframe
|
|
13
|
+
}) => color || Color.FORM, pulseKeyframe, ({
|
|
14
|
+
color
|
|
15
|
+
}) => !color && accentCycleCss);
|
|
11
16
|
/** Pulsing rectangular loading placeholder of a fixed `width`/`height`. */
|
|
12
17
|
export const RectangularSkeleton = styled.div.withConfig({
|
|
13
18
|
displayName: "RectangularSkeleton",
|