@shopgate/pwa-ui-shared 7.31.0-alpha.1 → 7.31.0-alpha.3

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.
@@ -0,0 +1,156 @@
1
+ import { css } from 'glamor';
2
+ import spring from 'css-spring';
3
+ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
4
+
5
+ /* eslint-disable max-len */
6
+ // TODO This file was brought back since some extensions import it (@shopgate-project/tablet-adjustments, @shopgate/grouped-products).
7
+ // It's not used anymore by the component. To reduce the effort of updating all shops to a new version
8
+ // of the extension, we temporarily keep this file. It should be removed in the future and the extensions should handle their styling
9
+ // on their own
10
+ /* eslint-enable max-len */
11
+
12
+ const options = {
13
+ stiffness: 381.47,
14
+ damping: 15
15
+ };
16
+ const buttonSize = 40;
17
+ const iconSize = 20;
18
+
19
+ /**
20
+ * Keyframe animations to create spring animation.
21
+ * spring(..) automatically calculates all steps for the keyframe animation.
22
+ */
23
+ const springFromTopKeyframes = css.keyframes(spring({
24
+ transform: 'translate3d(0, 300%, 0)'
25
+ }, {
26
+ transform: 'translate3d(0, -50%, 0)'
27
+ }, options));
28
+ const springFromBottomKeyframes = css.keyframes(spring({
29
+ transform: 'translate3d(0, -300%, 0)'
30
+ }, {
31
+ transform: 'translate3d(0, -50%, 0)'
32
+ }, options));
33
+ const springToTopKeyframes = css.keyframes(spring({
34
+ transform: 'translate3d(0, -50%, 0)'
35
+ }, {
36
+ transform: 'translate3d(0, 300%, 0)'
37
+ }, options));
38
+ const springToBottomKeyframes = css.keyframes(spring({
39
+ transform: 'translate3d(0, -50%, 0)'
40
+ }, {
41
+ transform: 'translate3d(0, -300%, 0)'
42
+ }, options));
43
+ const springFromBottom = css({
44
+ animation: `${springFromBottomKeyframes} 600ms`
45
+ }).toString();
46
+ const springFromTop = css({
47
+ animation: `${springFromTopKeyframes} 600ms`
48
+ }).toString();
49
+ const springToTop = css({
50
+ animation: `${springToTopKeyframes} 600ms`
51
+ }).toString();
52
+ const springToBottom = css({
53
+ animation: `${springToBottomKeyframes} 600ms`
54
+ }).toString();
55
+
56
+ /**
57
+ * Circular button and container for the icons.
58
+ * Default styles.
59
+ * @param {number} bSize Size of the button.
60
+ * @param {number} iSize Size of the icon.
61
+ * @return {string} Class name
62
+ */
63
+ const buttonWrapperDefault = (bSize, iSize) => ({
64
+ transition: 'background 450ms cubic-bezier(0.4, 0.0, 0.2, 1)',
65
+ borderRadius: '50%',
66
+ width: bSize,
67
+ height: bSize,
68
+ position: 'relative',
69
+ fontSize: iSize,
70
+ outline: 0,
71
+ paddingLeft: (bSize - iSize) / 2,
72
+ paddingRight: (bSize - iSize) / 2,
73
+ zIndex: 2,
74
+ // Prevents the icons to be visible outside of the circle
75
+ overflow: 'hidden',
76
+ flexShrink: 0
77
+ });
78
+ /**
79
+ * Circular button and container for the icons.
80
+ * @param {number} bSize Size of the button.
81
+ * @param {number} iSize Size of the icon.
82
+ * @return {string} Class name
83
+ */
84
+ const buttonWrapper = (bSize, iSize) => css({
85
+ ...buttonWrapperDefault(bSize, iSize)
86
+ }).toString();
87
+
88
+ /**
89
+ * Circular button and container for the icons.
90
+ * Without shadow.
91
+ * @param {number} bSize Size of the button.
92
+ * @param {number} iSize Size of the icon.
93
+ * @return {string} Class name
94
+ */
95
+ const buttonWrapperNoShadow = (bSize, iSize) => css({
96
+ ...buttonWrapperDefault(bSize, iSize)
97
+ }).toString();
98
+
99
+ /**
100
+ * Styling that is applied to the button when cart icon is shown.
101
+ */
102
+ const buttonReady = css({
103
+ background: `var(--color-button-cta, ${themeConfig.colors.cta})`,
104
+ color: `var(--color-button-cta-contrast, ${themeConfig.colors.ctaContrast})`
105
+ }).toString();
106
+
107
+ /**
108
+ * Styling that is applied to the button when checkmark is shown.
109
+ */
110
+ const buttonSuccess = css({
111
+ background: `var(--color-button-cta-contrast, ${themeConfig.colors.ctaContrast})`,
112
+ color: `var(--color-button-cta, ${themeConfig.colors.cta})`
113
+ }).toString();
114
+
115
+ /**
116
+ * Styling that is applied to the button when it is disabled.
117
+ */
118
+ const buttonDisabled = css({
119
+ background: themeConfig.colors.shade5,
120
+ color: `var(--color-button-cta-contrast, ${themeConfig.colors.ctaContrast})`,
121
+ boxShadow: themeConfig.shadows.buttons.disabled
122
+ }).toString();
123
+
124
+ /**
125
+ * Basic icon style that is always applied to all icons.
126
+ */
127
+ const icon = css({
128
+ transition: 'opacity 450ms cubic-bezier(0.4, 0.0, 0.2, 1)',
129
+ opacity: 1,
130
+ position: 'absolute'
131
+ }).toString();
132
+
133
+ /**
134
+ * Icon style that is applied only to the spinner icon.
135
+ */
136
+ const spinnerIcon = css({
137
+ left: '50%',
138
+ top: '50%',
139
+ marginTop: -themeConfig.variables.loadingIndicator.size / 2,
140
+ marginLeft: -themeConfig.variables.loadingIndicator.size / 2
141
+ }).toString();
142
+ export default {
143
+ buttonWrapper,
144
+ buttonWrapperNoShadow,
145
+ buttonReady,
146
+ buttonSuccess,
147
+ buttonDisabled,
148
+ buttonSize,
149
+ icon,
150
+ iconSize,
151
+ spinnerIcon,
152
+ springFromBottom,
153
+ springFromTop,
154
+ springToBottom,
155
+ springToTop
156
+ };
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-ui-shared",
3
- "version": "7.31.0-alpha.1",
3
+ "version": "7.31.0-alpha.3",
4
4
  "description": "Shopgate's shared UI components.",
5
5
  "main": "index.js",
6
6
  "license": "Apache-2.0",
7
7
  "dependencies": {
8
- "@shopgate/pwa-ui-ios": "7.31.0-alpha.1",
9
- "@shopgate/pwa-ui-material": "7.31.0-alpha.1"
8
+ "@shopgate/pwa-ui-ios": "7.31.0-alpha.3",
9
+ "@shopgate/pwa-ui-material": "7.31.0-alpha.3"
10
10
  },
11
11
  "devDependencies": {
12
- "@shopgate/pwa-common": "7.31.0-alpha.1",
13
- "@shopgate/pwa-common-commerce": "7.31.0-alpha.1",
12
+ "@shopgate/pwa-common": "7.31.0-alpha.3",
13
+ "@shopgate/pwa-common-commerce": "7.31.0-alpha.3",
14
14
  "classnames": "2.5.1",
15
15
  "react": "^17.0.2"
16
16
  },