@pushwoosh/dumb-components 1.1.199 → 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.
@@ -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",
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"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.1.199",
3
+ "version": "1.1.201",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",