@shopgate/pwa-ui-shared 7.31.6 → 7.32.0-beta.10

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.
Files changed (180) hide show
  1. package/ActionButton/index.js +4 -0
  2. package/AddToCartButton/index.js +18 -15
  3. package/Availability/index.js +11 -28
  4. package/Button/index.js +16 -12
  5. package/ButtonLink/index.js +4 -0
  6. package/Card/index.js +13 -37
  7. package/CardList/components/Item/index.js +26 -21
  8. package/CardList/index.js +2 -1
  9. package/CartTotalLine/index.js +8 -12
  10. package/Checkbox/index.js +3 -4
  11. package/Chip/index.js +9 -10
  12. package/ContextMenu/components/Item/index.js +18 -28
  13. package/ContextMenu/index.js +3 -4
  14. package/DiscountBadge/index.js +35 -32
  15. package/FavoritesButton/connector.js +1 -1
  16. package/FavoritesButton/index.js +26 -23
  17. package/Form/Checkbox/index.js +1 -1
  18. package/Form/Password/index.js +3 -7
  19. package/Form/RadioGroup/components/Item/index.js +1 -3
  20. package/Form/Select/index.js +4 -5
  21. package/Form/SelectContextChoices/index.js +8 -8
  22. package/Form/TextField/index.js +3 -5
  23. package/FormElement/components/ErrorText/index.js +7 -8
  24. package/FormElement/components/Label/index.js +2 -2
  25. package/FormElement/components/Placeholder/index.js +3 -3
  26. package/FormElement/components/Underline/index.js +9 -17
  27. package/Glow/index.js +4 -4
  28. package/IndicatorCircle/index.js +3 -4
  29. package/LoadingIndicator/index.js +3 -3
  30. package/Manufacturer/index.js +2 -2
  31. package/NoResults/components/Icon/index.js +3 -4
  32. package/NoResults/index.js +6 -6
  33. package/Placeholder/index.js +2 -2
  34. package/PlaceholderLabel/index.js +2 -3
  35. package/Price/index.js +4 -3
  36. package/PriceInfo/index.js +3 -4
  37. package/PriceStriked/index.js +3 -4
  38. package/ProgressBar/index.js +7 -12
  39. package/RadioButton/index.js +3 -4
  40. package/RatingStars/index.js +20 -10
  41. package/Ripple/components/RippleAnimation/index.js +1 -2
  42. package/Ripple/index.js +1 -2
  43. package/RippleButton/index.js +5 -1
  44. package/ScannerOverlay/components/CameraOverlay/index.js +1 -2
  45. package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +4 -4
  46. package/ScannerOverlay/components/ScannerBar/index.js +4 -5
  47. package/Sheet/components/Header/components/SearchBar/index.js +6 -7
  48. package/Sheet/components/Header/index.js +18 -15
  49. package/Sheet/index.js +17 -8
  50. package/TaxDisclaimer/index.js +10 -10
  51. package/TextField/components/ErrorText/index.js +7 -7
  52. package/TextField/components/FormElement/index.js +3 -3
  53. package/TextField/components/Hint/index.js +3 -4
  54. package/TextField/components/Label/index.js +2 -2
  55. package/TextField/components/Underline/index.js +9 -17
  56. package/icons/AccountBoxIcon.d.ts +1 -1
  57. package/icons/AccountBoxIcon.d.ts.map +1 -1
  58. package/icons/AddMoreIcon.d.ts +1 -1
  59. package/icons/AddMoreIcon.d.ts.map +1 -1
  60. package/icons/ArrowDropIcon.d.ts +1 -1
  61. package/icons/ArrowDropIcon.d.ts.map +1 -1
  62. package/icons/ArrowIcon.d.ts +1 -1
  63. package/icons/ArrowIcon.d.ts.map +1 -1
  64. package/icons/BarcodeScannerIcon.d.ts +1 -1
  65. package/icons/BarcodeScannerIcon.d.ts.map +1 -1
  66. package/icons/BoxIcon.d.ts +1 -1
  67. package/icons/BoxIcon.d.ts.map +1 -1
  68. package/icons/BrowseIcon.d.ts +2 -1
  69. package/icons/BrowseIcon.d.ts.map +1 -1
  70. package/icons/BurgerIcon.d.ts +1 -1
  71. package/icons/BurgerIcon.d.ts.map +1 -1
  72. package/icons/CalendarIcon.d.ts +2 -1
  73. package/icons/CalendarIcon.d.ts.map +1 -1
  74. package/icons/CartCouponIcon.d.ts +2 -1
  75. package/icons/CartCouponIcon.d.ts.map +1 -1
  76. package/icons/CartIcon.d.ts +2 -1
  77. package/icons/CartIcon.d.ts.map +1 -1
  78. package/icons/CartPlusIcon.d.ts +2 -1
  79. package/icons/CartPlusIcon.d.ts.map +1 -1
  80. package/icons/CheckIcon.d.ts +2 -1
  81. package/icons/CheckIcon.d.ts.map +1 -1
  82. package/icons/CheckedIcon.d.ts +1 -1
  83. package/icons/CheckedIcon.d.ts.map +1 -1
  84. package/icons/ChevronIcon.d.ts +2 -1
  85. package/icons/ChevronIcon.d.ts.map +1 -1
  86. package/icons/CreditCardIcon.d.ts +2 -1
  87. package/icons/CreditCardIcon.d.ts.map +1 -1
  88. package/icons/CrossIcon.d.ts +2 -1
  89. package/icons/CrossIcon.d.ts.map +1 -1
  90. package/icons/DescriptionIcon.d.ts +2 -1
  91. package/icons/DescriptionIcon.d.ts.map +1 -1
  92. package/icons/FilterIcon.d.ts +2 -1
  93. package/icons/FilterIcon.d.ts.map +1 -1
  94. package/icons/FlashDisabledIcon.d.ts +2 -1
  95. package/icons/FlashDisabledIcon.d.ts.map +1 -1
  96. package/icons/FlashEnabledIcon.d.ts +2 -1
  97. package/icons/FlashEnabledIcon.d.ts.map +1 -1
  98. package/icons/GridIcon.d.ts +2 -1
  99. package/icons/GridIcon.d.ts.map +1 -1
  100. package/icons/HeartIcon.d.ts +2 -1
  101. package/icons/HeartIcon.d.ts.map +1 -1
  102. package/icons/HeartOutlineIcon.d.ts +2 -1
  103. package/icons/HeartOutlineIcon.d.ts.map +1 -1
  104. package/icons/HeartPlusIcon.d.ts +2 -1
  105. package/icons/HeartPlusIcon.d.ts.map +1 -1
  106. package/icons/HeartPlusOutlineIcon.d.ts +2 -1
  107. package/icons/HeartPlusOutlineIcon.d.ts.map +1 -1
  108. package/icons/HomeIcon.d.ts +2 -1
  109. package/icons/HomeIcon.d.ts.map +1 -1
  110. package/icons/InfoIcon.d.ts +2 -1
  111. package/icons/InfoIcon.d.ts.map +1 -1
  112. package/icons/InfoOutlineIcon.d.ts +2 -1
  113. package/icons/InfoOutlineIcon.d.ts.map +1 -1
  114. package/icons/ListIcon.d.ts +2 -1
  115. package/icons/ListIcon.d.ts.map +1 -1
  116. package/icons/LocalShippingIcon.d.ts +2 -1
  117. package/icons/LocalShippingIcon.d.ts.map +1 -1
  118. package/icons/LocationIcon.d.ts +2 -1
  119. package/icons/LocationIcon.d.ts.map +1 -1
  120. package/icons/LocatorIcon.d.ts +2 -1
  121. package/icons/LocatorIcon.d.ts.map +1 -1
  122. package/icons/LockIcon.d.ts +2 -1
  123. package/icons/LockIcon.d.ts.map +1 -1
  124. package/icons/LogoutIcon.d.ts +2 -1
  125. package/icons/LogoutIcon.d.ts.map +1 -1
  126. package/icons/MagnifierIcon.d.ts +2 -1
  127. package/icons/MagnifierIcon.d.ts.map +1 -1
  128. package/icons/MapMarkerIcon.d.ts +2 -1
  129. package/icons/MapMarkerIcon.d.ts.map +1 -1
  130. package/icons/MoreIcon.d.ts +2 -1
  131. package/icons/MoreIcon.d.ts.map +1 -1
  132. package/icons/MoreVertIcon.d.ts +2 -1
  133. package/icons/MoreVertIcon.d.ts.map +1 -1
  134. package/icons/NotificationIcon.d.ts +2 -1
  135. package/icons/NotificationIcon.d.ts.map +1 -1
  136. package/icons/PersonIcon.d.ts +2 -1
  137. package/icons/PersonIcon.d.ts.map +1 -1
  138. package/icons/PhoneIcon.d.ts +2 -1
  139. package/icons/PhoneIcon.d.ts.map +1 -1
  140. package/icons/PlaceholderIcon.d.ts +2 -1
  141. package/icons/PlaceholderIcon.d.ts.map +1 -1
  142. package/icons/RadioCheckedIcon.d.ts +2 -1
  143. package/icons/RadioCheckedIcon.d.ts.map +1 -1
  144. package/icons/RadioUncheckedIcon.d.ts +2 -1
  145. package/icons/RadioUncheckedIcon.d.ts.map +1 -1
  146. package/icons/SecurityIcon.d.ts +2 -1
  147. package/icons/SecurityIcon.d.ts.map +1 -1
  148. package/icons/ShippingMethodIcon.d.ts +2 -1
  149. package/icons/ShippingMethodIcon.d.ts.map +1 -1
  150. package/icons/ShoppingCartIcon.d.ts +2 -1
  151. package/icons/ShoppingCartIcon.d.ts.map +1 -1
  152. package/icons/SortIcon.d.ts +2 -1
  153. package/icons/SortIcon.d.ts.map +1 -1
  154. package/icons/StarHalfIcon.d.ts +2 -1
  155. package/icons/StarHalfIcon.d.ts.map +1 -1
  156. package/icons/StarIcon.d.ts +2 -1
  157. package/icons/StarIcon.d.ts.map +1 -1
  158. package/icons/StarOutlineIcon.d.ts +2 -1
  159. package/icons/StarOutlineIcon.d.ts.map +1 -1
  160. package/icons/StopIcon.d.ts +2 -1
  161. package/icons/StopIcon.d.ts.map +1 -1
  162. package/icons/TickIcon.d.ts +2 -1
  163. package/icons/TickIcon.d.ts.map +1 -1
  164. package/icons/TimeIcon.d.ts +2 -1
  165. package/icons/TimeIcon.d.ts.map +1 -1
  166. package/icons/TrashIcon.d.ts +1 -1
  167. package/icons/TrashIcon.d.ts.map +1 -1
  168. package/icons/TrashOutlineIcon.d.ts +2 -1
  169. package/icons/TrashOutlineIcon.d.ts.map +1 -1
  170. package/icons/UncheckedIcon.d.ts +2 -1
  171. package/icons/UncheckedIcon.d.ts.map +1 -1
  172. package/icons/ViewListIcon.d.ts +2 -1
  173. package/icons/ViewListIcon.d.ts.map +1 -1
  174. package/icons/VisibilityIcon.d.ts +2 -1
  175. package/icons/VisibilityIcon.d.ts.map +1 -1
  176. package/icons/VisibilityOffIcon.d.ts +2 -1
  177. package/icons/VisibilityOffIcon.d.ts.map +1 -1
  178. package/icons/WarningIcon.d.ts +2 -1
  179. package/icons/WarningIcon.d.ts.map +1 -1
  180. package/package.json +5 -5
@@ -21,6 +21,10 @@ const CLICK_DELAY = 300;
21
21
 
22
22
  /**
23
23
  * The action button component.
24
+ * @deprecated Use `Button` from `@shopgate/engage/components/v2` instead. It defaults to
25
+ * `variant="contained"`, so pass `variant="text"` to match this component's `flat` default. Map
26
+ * `type="secondary"` to `color="primary"`, and `type="primary"` or the default to
27
+ * `color="secondary"`.
24
28
  * @param {Object} props Props.
25
29
  * @returns {JSX.Element}
26
30
  */
@@ -1,9 +1,8 @@
1
1
  import React, { useCallback, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import spring from 'css-spring';
4
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
5
4
  import { withForwardedRef } from '@shopgate/engage/core';
6
- import { keyframes, makeStyles } from '@shopgate/engage/styles';
5
+ import { keyframes, makeStyles, useTheme } from '@shopgate/engage/styles';
7
6
  import CartPlusIcon from "../icons/CartPlusIcon";
8
7
  import TickIcon from "../icons/TickIcon";
9
8
  import IndicatorCircle from "../IndicatorCircle";
@@ -34,7 +33,7 @@ const springToBottomKeyframes = keyframes(spring({
34
33
  }, {
35
34
  transform: 'translate3d(0, -300%, 0)'
36
35
  }, springOptions));
37
- const useStyles = makeStyles()({
36
+ const useStyles = makeStyles()(theme => ({
38
37
  springFromBottom: {
39
38
  animation: `${springFromBottomKeyframes} 600ms`
40
39
  },
@@ -50,28 +49,31 @@ const useStyles = makeStyles()({
50
49
  icon: {
51
50
  transition: 'opacity 450ms cubic-bezier(0.4, 0.0, 0.2, 1)',
52
51
  opacity: 1,
53
- position: 'absolute'
52
+ position: 'absolute',
53
+ display: 'flex',
54
+ left: '50%',
55
+ marginLeft: '-0.5em'
54
56
  },
55
57
  spinnerIcon: {
56
58
  left: '50%',
57
59
  top: '50%',
58
- marginTop: -themeConfig.variables.loadingIndicator.size / 2,
59
- marginLeft: -themeConfig.variables.loadingIndicator.size / 2
60
+ marginTop: -32 / 2,
61
+ marginLeft: -32 / 2
60
62
  },
61
63
  buttonReady: {
62
- background: `var(--color-button-cta, ${themeConfig.colors.cta})`,
63
- color: `var(--color-button-cta-contrast, ${themeConfig.colors.ctaContrast})`
64
+ background: theme.components.ctaButton.background,
65
+ color: theme.contrastColor(theme.components.ctaButton.background)
64
66
  },
65
67
  buttonSuccess: {
66
- background: `var(--color-button-cta-contrast, ${themeConfig.colors.ctaContrast})`,
67
- color: `var(--color-button-cta, ${themeConfig.colors.cta})`
68
+ background: theme.contrastColor(theme.components.ctaButton.background),
69
+ color: theme.components.ctaButton.background
68
70
  },
69
71
  buttonDisabled: {
70
- background: themeConfig.colors.shade5,
71
- color: `var(--color-button-cta-contrast, ${themeConfig.colors.ctaContrast})`,
72
- boxShadow: themeConfig.shadows.buttons.disabled
72
+ background: theme.palette.action.disabledBackground,
73
+ color: theme.contrastColor(theme.palette.action.disabledBackground),
74
+ boxShadow: '0 3px 4px rgba(0, 0, 0, 0.13)'
73
75
  }
74
- });
76
+ }));
75
77
 
76
78
  /**
77
79
  * @param {number} bSize .
@@ -114,6 +116,7 @@ const AddToCartButton = ({
114
116
  classes,
115
117
  cx
116
118
  } = useStyles();
119
+ const theme = useTheme();
117
120
  const [showCheckmark, setShowCheckmark] = useState(null);
118
121
 
119
122
  /**
@@ -216,7 +219,7 @@ const AddToCartButton = ({
216
219
  className: cx(classes.icon, classes.spinnerIcon),
217
220
  style: spinnerInlineStyle,
218
221
  children: /*#__PURE__*/_jsx(IndicatorCircle, {
219
- color: themeConfig.colors.primaryContrast,
222
+ color: theme.contrastColor(theme.components.ctaButton.background),
220
223
  strokeWidth: 5,
221
224
  paused: !isLoading
222
225
  })
@@ -1,22 +1,13 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { AVAILABILITY_STATE_OK, AVAILABILITY_STATE_WARNING, AVAILABILITY_STATE_ALERT } from '@shopgate/pwa-common-commerce/product/constants';
4
- import { makeStyles } from '@shopgate/engage/styles';
4
+ import { Typography } from '@shopgate/engage/components';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
- const useStyles = makeStyles()(theme => ({
7
- base: {
8
- fontSize: '0.875rem'
9
- },
10
- stateOk: {
11
- color: theme.palette.success.main
12
- },
13
- stateWarning: {
14
- color: theme.palette.warning.main
15
- },
16
- stateAlert: {
17
- color: theme.palette.error.main
18
- }
19
- }));
6
+ const stateColorMap = {
7
+ [AVAILABILITY_STATE_OK]: 'success',
8
+ [AVAILABILITY_STATE_WARNING]: 'warning',
9
+ [AVAILABILITY_STATE_ALERT]: 'error'
10
+ };
20
11
 
21
12
  /**
22
13
  * This component renders the availability text for a product
@@ -34,22 +25,14 @@ const Availability = ({
34
25
  showWhenAvailable = false,
35
26
  className = null
36
27
  }) => {
37
- const {
38
- classes,
39
- cx
40
- } = useStyles();
41
28
  if (!text || state === AVAILABILITY_STATE_OK && !showWhenAvailable) {
42
29
  return null;
43
30
  }
44
- let stateClass = classes.stateOk;
45
- if (state === AVAILABILITY_STATE_WARNING) {
46
- stateClass = classes.stateWarning;
47
- }
48
- if (state === AVAILABILITY_STATE_ALERT) {
49
- stateClass = classes.stateAlert;
50
- }
51
- return /*#__PURE__*/_jsx("div", {
52
- className: cx('ui-shared__availability', classes.base, stateClass, className),
31
+ return /*#__PURE__*/_jsx(Typography, {
32
+ variant: "body2",
33
+ component: "div",
34
+ color: stateColorMap[state],
35
+ className: `ui-shared__availability${className ? ` ${className}` : ''}`,
53
36
  "data-test-id": `availabilityText: ${text}`,
54
37
  children: text
55
38
  });
package/Button/index.js CHANGED
@@ -4,15 +4,13 @@ import BaseButton from '@shopgate/pwa-common/components/Button';
4
4
  import { themeConfig } from '@shopgate/pwa-common/helpers/config';
5
5
  import { makeStyles } from '@shopgate/engage/styles';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
- const {
8
- colors
9
- } = themeConfig;
10
7
  /**
11
8
  * @param {string} text Text color.
12
9
  * @param {string|null} background Fill color.
10
+ * @param {Object} theme Theme with button border radius.
13
11
  * @returns {Object} JSS for root button.
14
12
  */
15
- const baseButton = (text, background) => ({
13
+ const baseButton = (text, background, theme) => ({
16
14
  position: 'relative',
17
15
  display: 'inline-block',
18
16
  outline: 0,
@@ -23,7 +21,9 @@ const baseButton = (text, background) => ({
23
21
  ':disabled': {
24
22
  cursor: 'not-allowed'
25
23
  },
26
- ...themeConfig.variables.buttonBase
24
+ ...themeConfig.variables.buttonBase,
25
+ borderRadius: theme.components.button.borderRadius,
26
+ ...theme.typography.button
27
27
  });
28
28
 
29
29
  /**
@@ -33,7 +33,7 @@ const baseButton = (text, background) => ({
33
33
  * @returns {Object} Object with `button` and `content` style maps.
34
34
  */
35
35
  const pairFromColors = (textColor, fillColor, theme) => ({
36
- button: baseButton(textColor, fillColor),
36
+ button: baseButton(textColor, fillColor, theme),
37
37
  content: {
38
38
  padding: theme.spacing(0, 2, 0),
39
39
  color: textColor
@@ -55,25 +55,29 @@ const useStyles = makeStyles()((theme, {
55
55
  };
56
56
  }
57
57
  if (type === 'simple') {
58
- return disabled ? pairFromColors(themeConfig.colors.shade4, themeConfig.colors.shade7, theme) : pairFromColors(themeConfig.colors.dark, themeConfig.colors.shade7, theme);
58
+ return disabled ? pairFromColors(theme.palette.action.disabled, theme.palette.action.disabledBackground, theme) : pairFromColors(theme.palette.common.black, theme.palette.grey.light, theme);
59
59
  }
60
60
  if (type === 'regular') {
61
- return disabled ? pairFromColors(colors.shade4, null, theme) : pairFromColors(colors.dark, null, theme);
61
+ return disabled ? pairFromColors(theme.palette.action.disabled, null, theme) : pairFromColors(theme.palette.common.black, null, theme);
62
62
  }
63
63
  if (type === 'secondary') {
64
64
  if (!flat) {
65
- return disabled ? pairFromColors(colors.shade4, colors.shade7, theme) : pairFromColors('var(--color-primary-contrast)', 'var(--color-primary)', theme);
65
+ return disabled ? pairFromColors(theme.palette.action.disabled, theme.palette.action.disabledBackground, theme) : pairFromColors(theme.palette.primary.contrastText, theme.palette.primary.main, theme);
66
66
  }
67
- return disabled ? pairFromColors(colors.shade4, null, theme) : pairFromColors('var(--color-primary)', null, theme);
67
+ return disabled ? pairFromColors(theme.palette.action.disabled, null, theme) : pairFromColors(theme.palette.primary.main, null, theme);
68
68
  }
69
69
  if (!flat) {
70
- return disabled ? pairFromColors(colors.shade4, colors.shade7, theme) : pairFromColors('var(--color-secondary-contrast)', 'var(--color-secondary)', theme);
70
+ return disabled ? pairFromColors(theme.palette.action.disabled, theme.palette.action.disabledBackground, theme) : pairFromColors(theme.palette.secondary.contrastText, theme.palette.secondary.main, theme);
71
71
  }
72
- return disabled ? pairFromColors(colors.shade4, null, theme) : pairFromColors('var(--color-secondary)', null, theme);
72
+ return disabled ? pairFromColors(theme.palette.action.disabled, null, theme) : pairFromColors(theme.palette.secondary.main, null, theme);
73
73
  });
74
74
 
75
75
  /**
76
76
  * The basic button component.
77
+ * @deprecated Use `Button` from `@shopgate/engage/components/v2` instead. Map `flat` to
78
+ * `variant="text"` and omit it for `variant="contained"`. The colors are named differently:
79
+ * `type="secondary"` becomes `color="primary"`, while `type="primary"` and the default become
80
+ * `color="secondary"`. `type="plain"` is unstyled — use `ButtonBase` for it.
77
81
  * @param {Object} props Props.
78
82
  * @returns {JSX.Element}
79
83
  */
@@ -44,6 +44,10 @@ let ButtonLink = /*#__PURE__*/function (_Component) {
44
44
  };
45
45
  return ButtonLink;
46
46
  }(Component);
47
+ /**
48
+ * @deprecated Use `Button` from `@shopgate/engage/components/v2` with `variant="link"` and
49
+ * `color="primary"` instead. It takes the same `href` and routes through the app router itself.
50
+ */
47
51
  ButtonLink.defaultProps = {
48
52
  disabled: false,
49
53
  className: '',
package/Card/index.js CHANGED
@@ -1,43 +1,19 @@
1
- import "core-js/modules/es.array.includes.js";
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { themeConfig, themeName } from '@shopgate/pwa-common/helpers/config';
5
- import { makeStyles } from '@shopgate/engage/styles';
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- const isIOS = themeName.includes('ios');
8
- const useStyles = makeStyles()({
9
- root: {
10
- boxShadow: themeConfig.shadows.productCard,
11
- margin: '5px 5px 10px',
12
- borderRadius: isIOS ? 10 : 2,
13
- background: themeConfig.colors.light,
14
- overflow: 'hidden',
15
- position: 'relative'
16
- }
17
- });
1
+ import React, { useEffect } from 'react';
2
+ import { logger } from '@shopgate/engage/core/helpers';
3
+ import { Card } from '@shopgate/engage/components';
18
4
 
19
5
  /**
20
- * Renders the card component.
21
- * @param {Object} props The component properties.
6
+ * @deprecated Use `import { Card } from '@shopgate/engage/components'` instead.
7
+ * @param {Object} props The component props.
22
8
  * @returns {JSX}
23
9
  */
24
- const Card = ({
25
- className,
26
- children,
27
- id
28
- }) => {
29
- const {
30
- classes,
31
- cx
32
- } = useStyles();
33
- return /*#__PURE__*/_jsx("div", {
34
- className: cx('ui-shared__card', classes.root, className),
35
- id: id,
36
- children: children
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const DeprecatedCard = props => {
12
+ useEffect(() => {
13
+ logger.warn('===== Card deprecated =====\n' + 'The Card component ' + '(@shopgate/pwa-ui-shared/Card) is deprecated.\n' + 'Please use: import { Card } from \'@shopgate/engage/components\'.\n' + '===================================');
14
+ }, []);
15
+ return /*#__PURE__*/_jsx(Card, {
16
+ ...props
37
17
  });
38
18
  };
39
- Card.defaultProps = {
40
- className: '',
41
- id: null
42
- };
43
- export default Card;
19
+ export default DeprecatedCard;
@@ -1,43 +1,48 @@
1
- import React, { Children } from 'react';
1
+ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import ListItem from '@shopgate/pwa-common/components/List/components/Item';
4
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
5
3
  import { makeStyles } from '@shopgate/engage/styles';
6
4
  import { jsx as _jsx } from "react/jsx-runtime";
7
- const useStyles = makeStyles()(theme => ({
8
- root: {
9
- background: themeConfig.colors.light,
10
- marginBottom: theme.spacing(0.5),
5
+ const useStyles = makeStyles()({
6
+ item: {
7
+ display: 'block',
11
8
  position: 'relative'
9
+ },
10
+ unselected: {
11
+ zIndex: 1
12
+ },
13
+ selected: {
14
+ zIndex: 2
12
15
  }
13
- }));
16
+ });
14
17
 
15
18
  /**
16
- * The Card List Item component implemented as class so that ref prop is available.
17
- * @param {Object} props The component props.
18
- * @return {JSX}
19
+ * The ListItem component.
20
+ * @returns {JSX}
19
21
  */
20
- const Item = ({
22
+ const ListItem = ({
21
23
  children,
22
24
  className,
23
- isSelected
25
+ isSelected,
26
+ role
24
27
  }) => {
25
28
  const {
26
29
  classes,
27
30
  cx
28
31
  } = useStyles();
29
- if (!Children.count(children)) {
32
+ if (!React.Children.count(children)) {
30
33
  return null;
31
34
  }
32
- return /*#__PURE__*/_jsx(ListItem, {
33
- className: cx(classes.root, className),
34
- isSelected: isSelected,
35
+ return /*#__PURE__*/_jsx("li", {
36
+ className: cx(classes.item, className, 'common__list__list-item', isSelected ? classes.selected : classes.unselected),
37
+ "data-test-id": "listItem",
38
+ role: role,
35
39
  children: children
36
40
  });
37
41
  };
38
- Item.defaultProps = {
39
- children: null,
42
+ ListItem.defaultProps = {
40
43
  className: null,
41
- isSelected: false
44
+ children: null,
45
+ isSelected: false,
46
+ role: null
42
47
  };
43
- export default Item;
48
+ export default ListItem;
package/CardList/index.js CHANGED
@@ -2,6 +2,7 @@ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
2
  import React, { Component, Children, isValidElement } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import List from '@shopgate/pwa-common/components/List';
5
+ import { cx } from '@shopgate/engage/styles';
5
6
  import Item from "./components/Item";
6
7
 
7
8
  /**
@@ -27,7 +28,7 @@ let CardList = /*#__PURE__*/function (_Component) {
27
28
  return null;
28
29
  }
29
30
  return /*#__PURE__*/_jsx(List, {
30
- className: `ui-shared__card-list ${className}`,
31
+ className: cx('ui-shared__card-list', className),
31
32
  children: Children.map(children, child => {
32
33
  if (! /*#__PURE__*/isValidElement(child)) {
33
34
  return null;
@@ -1,36 +1,32 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
4
3
  import { makeStyles } from '@shopgate/engage/styles';
5
4
  import Label from "./components/Label";
6
5
  import Amount from "./components/Amount";
7
6
  import Hint from "./components/Hint";
8
7
  import Spacer from "./components/Spacer";
9
8
  import { jsx as _jsx } from "react/jsx-runtime";
10
- const {
11
- colors
12
- } = themeConfig;
13
- const useStyles = makeStyles()({
9
+ const useStyles = makeStyles()(theme => ({
14
10
  line: {
15
11
  display: 'flex',
16
12
  justifyContent: 'space-between',
17
- fontSize: '0.875rem',
13
+ fontSize: theme.typography.body2.fontSize,
18
14
  alignItems: 'baseline'
19
15
  },
20
16
  disabled: {
21
- color: `${colors.shade4} !important`
17
+ color: `${theme.palette.action.disabled} !important`
22
18
  },
23
19
  base: {
24
- color: colors.shade9
20
+ color: theme.palette.text.secondary
25
21
  },
26
22
  subTotal: {
27
- color: `${colors.dark}`
23
+ color: theme.palette.text.primary
28
24
  },
29
25
  grandTotal: {
30
- color: `${colors.dark}`,
31
- fontSize: '1rem !important'
26
+ color: theme.palette.text.primary,
27
+ fontSize: theme.typography.body1.fontSize
32
28
  }
33
- });
29
+ }));
34
30
 
35
31
  /**
36
32
  * @returns {JSX}
package/Checkbox/index.js CHANGED
@@ -1,22 +1,21 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { makeStyles } from '@shopgate/engage/styles';
4
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
5
4
  import BaseCheckbox from '@shopgate/pwa-common/components/Checkbox';
6
5
  import CheckedIcon from "../icons/CheckedIcon";
7
6
  import UncheckedIcon from "../icons/UncheckedIcon";
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
9
- const useStyles = makeStyles()(() => ({
8
+ const useStyles = makeStyles()(theme => ({
10
9
  icon: {
11
10
  width: 24,
12
11
  height: 24,
13
12
  flexShrink: 0
14
13
  },
15
14
  checkedIcon: {
16
- color: 'var(--color-secondary)'
15
+ color: theme.palette.secondary.main
17
16
  },
18
17
  uncheckedIcon: {
19
- color: themeConfig.colors.shade6
18
+ color: theme.palette.grey.dark
20
19
  }
21
20
  }));
22
21
 
package/Chip/index.js CHANGED
@@ -32,12 +32,12 @@ const useStyles = makeStyles()((theme, {
32
32
  chip: {
33
33
  ...chipBase(removable, theme),
34
34
  ...(hasNewServices() ? {
35
- backgroundColor: invert ? 'var(--color-primary)' : 'var(--color-primary-contrast)',
36
- color: invert ? 'var(--color-primary-contrast)' : 'var(--color-primary)'
35
+ backgroundColor: invert ? theme.palette.primary.main : theme.palette.primary.contrastText,
36
+ color: invert ? theme.palette.primary.contrastText : theme.palette.primary.main
37
37
  } : {
38
- backgroundColor: invert ? 'var(--color-secondary)' : 'var(--color-secondary-contrast)',
39
- color: invert ? 'var(--color-secondary-contrast)' : 'var(--color-secondary)',
40
- '--color-text-high-emphasis': invert ? 'var(--color-secondary-contrast)' : 'var(--color-secondary)'
38
+ backgroundColor: invert ? theme.palette.secondary.main : theme.palette.secondary.contrastText,
39
+ color: invert ? theme.palette.secondary.contrastText : theme.palette.secondary.main,
40
+ '--color-text-high-emphasis': invert ? theme.palette.secondary.contrastText : theme.palette.secondary.main
41
41
  })
42
42
  },
43
43
  removeButton: {
@@ -47,7 +47,7 @@ const useStyles = makeStyles()((theme, {
47
47
  webOnly: true
48
48
  })]: {
49
49
  padding: '0 5px',
50
- fontSize: '1.125rem'
50
+ fontSize: theme.typography.h4.fontSize
51
51
  }
52
52
  },
53
53
  name: {
@@ -55,19 +55,18 @@ const useStyles = makeStyles()((theme, {
55
55
  paddingRight: theme.spacing(0.5),
56
56
  paddingTop: 3,
57
57
  paddingBottom: 3,
58
- fontSize: 12,
59
- fontWeight: 500,
58
+ fontSize: theme.typography.caption.fontSize,
59
+ fontWeight: theme.typography.fontWeightMedium,
60
60
  textOverflow: 'ellipsis',
61
61
  maxWidth: '100%',
62
62
  whiteSpace: 'nowrap',
63
63
  overflow: 'hidden',
64
64
  display: 'block',
65
- lineHeight: '1',
66
65
  color: 'inherit',
67
66
  [responsiveMediaQuery('>xs', {
68
67
  webOnly: true
69
68
  })]: {
70
- fontSize: '0.875rem',
69
+ fontSize: theme.typography.body2.fontSize,
71
70
  lineHeight: '1.25rem',
72
71
  padding: '6px 8px 6px 0'
73
72
  }
@@ -1,41 +1,31 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import noop from 'lodash/noop';
4
- import Color from 'color';
5
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
6
- import { getCSSCustomProp, makeStyles } from '@shopgate/engage/styles';
4
+ import { makeStyles } from '@shopgate/engage/styles';
7
5
  import Glow from "../../../Glow";
8
6
  import { useContextMenu } from "../../ContextMenu.hooks";
9
7
  import { jsx as _jsx } from "react/jsx-runtime";
10
8
  const CLOSE_DELAY = 250;
11
9
  const useStyles = makeStyles()((theme, {
12
10
  disabled
13
- }) => {
14
- let background = themeConfig.colors.shade8;
15
- const customPropColor = getCSSCustomProp('--color-primary');
16
- if (customPropColor) {
17
- background = Color(customPropColor).alpha(0.04).toString();
11
+ }) => ({
12
+ root: {
13
+ position: 'relative',
14
+ whiteSpace: 'nowrap',
15
+ marginBottom: 2,
16
+ padding: theme.spacing(1.25, 2.75),
17
+ zIndex: 1,
18
+ color: disabled ? theme.palette.text.secondary : 'inherit',
19
+ ...(!disabled ? {
20
+ cursor: 'pointer',
21
+ '&:hover': {
22
+ background: theme.alpha(theme.palette.primary.main, 0.04)
23
+ }
24
+ } : {
25
+ cursor: 'default'
26
+ })
18
27
  }
19
- return {
20
- root: {
21
- position: 'relative',
22
- whiteSpace: 'nowrap',
23
- marginBottom: 2,
24
- padding: theme.spacing(1.75, 2.75),
25
- lineHeight: 1,
26
- zIndex: 1,
27
- color: disabled ? theme.palette.text.secondary : 'inherits',
28
- ...(!disabled ? {
29
- cursor: 'pointer',
30
- '&:hover': {
31
- background
32
- }
33
- } : {
34
- cursor: 'default'
35
- })
36
- }
37
- };
38
- });
28
+ }));
39
29
 
40
30
  /**
41
31
  * The Context Menu Item component.
@@ -4,7 +4,6 @@ import { ConnectedReactPortal } from '@shopgate/engage/components';
4
4
  import Backdrop from '@shopgate/pwa-common/components/Backdrop';
5
5
  import { FocusTrap } from '@shopgate/engage/a11y/components';
6
6
  import { i18n } from '@shopgate/engage/core/helpers';
7
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
8
7
  import { makeStyles } from '@shopgate/engage/styles';
9
8
  import MoreVertIcon from "../icons/MoreVertIcon";
10
9
  import Position from "./components/Position";
@@ -17,7 +16,7 @@ const useStyles = makeStyles()(theme => ({
17
16
  },
18
17
  button: {
19
18
  display: 'block',
20
- fontSize: '1.5rem',
19
+ fontSize: theme.components.icon.medium,
21
20
  outline: 0,
22
21
  padding: 0,
23
22
  color: 'inherit'
@@ -39,9 +38,9 @@ const useStyles = makeStyles()(theme => ({
39
38
  left: 0,
40
39
  padding: theme.spacing(1, 0),
41
40
  minWidth: 130,
42
- background: themeConfig.colors.light,
41
+ background: theme.palette.background.surface,
43
42
  borderRadius: 2,
44
- boxShadow: themeConfig.shadows.contextMenu
43
+ boxShadow: '0 2px 6px rgba(0, 0, 0, .4)'
45
44
  },
46
45
  scrollable: {
47
46
  maxHeight: '30vh',