@pushwoosh/dumb-components 1.1.199 → 1.1.200
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/Spinner/styles.js +9 -4
- package/package.json +1 -1
package/Spinner/styles.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import styled, { keyframes } from 'styled-components';
|
|
2
|
-
import { Color } from '@pushwoosh/kit-constants';
|
|
1
|
+
import styled, { css, keyframes } from 'styled-components';
|
|
2
|
+
import { Color, THEME_ATTRIBUTE } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { SizeInPxBySpinnerSizeMap } from './maps';
|
|
4
4
|
const rotate = keyframes(["from{transform:rotate(0deg);}to{transform:rotate(360deg);}"]);
|
|
5
|
+
const cycleAccents = keyframes(["0%,100%{color:", ";}25%{color:", ";}50%{color:", ";}75%{color:", ";}"], Color.BRIGHT, Color.DANGER, Color.SUCCESS, Color.EXCEPTIONAL);
|
|
6
|
+
// Only when the caller left the colour to us: an explicit `color` is intent, not a default.
|
|
7
|
+
const accentCycle = css(["[", "='dark'] &{animation:", " 4s linear infinite;}@media (prefers-reduced-motion:reduce){[", "='dark'] &{animation:none;color:", ";}}"], THEME_ATTRIBUTE, cycleAccents, THEME_ATTRIBUTE, Color.BRIGHT);
|
|
5
8
|
export const SpinnerBox = styled.div.withConfig({
|
|
6
9
|
displayName: "SpinnerBox",
|
|
7
10
|
componentId: "sc-y39y31-0"
|
|
8
|
-
})(["width:", ";height:", ";color:", ";line-height:0;user-select:none;"], ({
|
|
11
|
+
})(["width:", ";height:", ";color:", ";line-height:0;user-select:none;", ""], ({
|
|
9
12
|
size
|
|
10
13
|
}) => SizeInPxBySpinnerSizeMap[size], ({
|
|
11
14
|
size
|
|
12
15
|
}) => SizeInPxBySpinnerSizeMap[size], ({
|
|
13
16
|
color
|
|
14
|
-
}) => color || Color.CURRENT
|
|
17
|
+
}) => color || Color.CURRENT, ({
|
|
18
|
+
color
|
|
19
|
+
}) => !color && accentCycle);
|
|
15
20
|
export const SpinnerAnimate = styled.div.withConfig({
|
|
16
21
|
displayName: "SpinnerAnimate",
|
|
17
22
|
componentId: "sc-y39y31-1"
|