@pushwoosh/dumb-components 1.1.200 → 1.1.202
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
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",
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import { Color, Shadow, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
2
|
+
import { Color, FontWeight, Shadow, ShapeRadius, THEME_ATTRIBUTE } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { H4 } from '@pushwoosh/kit-typography';
|
|
4
4
|
const tabBodyHover = css(["&:hover{color:", ";background-color:", ";}"], Color.PRIMARY_HOVER, Color.BRIGHT_LIGHT);
|
|
5
|
+
// A drop shadow is what marks the active tab in light; on a dark bar it falls on
|
|
6
|
+
// an already dark track, so the surface is lifted and outlined instead.
|
|
7
|
+
const darkActiveTab = css(["[", "='dark'] &&{background-color:", ";box-shadow:inset 0 0 0 1px ", ";}"], THEME_ATTRIBUTE, Color.FORM, Color.PHANTOM);
|
|
5
8
|
export const TabBody = styled.div.withConfig({
|
|
6
9
|
displayName: "TabBody",
|
|
7
10
|
componentId: "sc-133yrgu-0"
|
|
8
|
-
})(["display:flex;justify-content:center;align-items:center;position:relative;padding:6px ", " 6px 16px;background-color:", ";border-radius:", ";box-shadow:", ";cursor:", ";user-select:none;white-space:nowrap;color:", ";", ""], ({
|
|
11
|
+
})(["display:flex;justify-content:center;align-items:center;position:relative;padding:6px ", " 6px 16px;background-color:", ";border-radius:", ";box-shadow:", ";cursor:", ";user-select:none;white-space:nowrap;color:", ";", " ", ""], ({
|
|
9
12
|
$hasIcon
|
|
10
13
|
}) => $hasIcon ? '12px' : '16px', ({
|
|
11
14
|
$isActive
|
|
@@ -24,7 +27,10 @@ export const TabBody = styled.div.withConfig({
|
|
|
24
27
|
}) => $isDisabled ? Color.LOCKED : Color.MAIN, ({
|
|
25
28
|
$isActive,
|
|
26
29
|
$isDisabled
|
|
27
|
-
}) => !$isActive && !$isDisabled && tabBodyHover
|
|
30
|
+
}) => !$isActive && !$isDisabled && tabBodyHover, ({
|
|
31
|
+
$isActive,
|
|
32
|
+
$isDisabled
|
|
33
|
+
}) => $isActive && !$isDisabled && darkActiveTab);
|
|
28
34
|
export const TabRedDot = styled.div.withConfig({
|
|
29
35
|
displayName: "TabRedDot",
|
|
30
36
|
componentId: "sc-133yrgu-1"
|
|
@@ -32,9 +38,11 @@ export const TabRedDot = styled.div.withConfig({
|
|
|
32
38
|
export const TabButtonLabel = styled(H4).withConfig({
|
|
33
39
|
displayName: "TabButtonLabel",
|
|
34
40
|
componentId: "sc-133yrgu-2"
|
|
35
|
-
})(["opacity:", ";"], ({
|
|
41
|
+
})(["opacity:", ";[", "='dark'] &&{font-weight:", ";}"], ({
|
|
42
|
+
$isActive
|
|
43
|
+
}) => $isActive ? 1 : 0.8, THEME_ATTRIBUTE, ({
|
|
36
44
|
$isActive
|
|
37
|
-
}) => $isActive ?
|
|
45
|
+
}) => $isActive ? FontWeight.MEDIUM : FontWeight.REGULAR);
|
|
38
46
|
export const TabIconBox = styled.div.withConfig({
|
|
39
47
|
displayName: "TabIconBox",
|
|
40
48
|
componentId: "sc-133yrgu-3"
|