@shopgate/pwa-ui-shared 7.31.4-beta.1 → 7.32.0-beta.1

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 (63) hide show
  1. package/ActionButton/spec.js +25 -28
  2. package/AddToCartButton/index.js +14 -14
  3. package/Availability/index.js +11 -28
  4. package/Availability/spec.js +11 -11
  5. package/Button/index.js +6 -9
  6. package/ButtonLink/spec.js +11 -7
  7. package/Card/index.js +5 -8
  8. package/CardList/components/Item/index.js +1 -2
  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/Dialog/components/HtmlContentDialog/spec.js +7 -1
  15. package/DiscountBadge/index.js +35 -32
  16. package/DiscountBadge/spec.js +5 -5
  17. package/FavoritesButton/connector.js +1 -1
  18. package/FavoritesButton/index.js +26 -23
  19. package/Form/Checkbox/index.js +1 -1
  20. package/Form/InfoField/spec.js +3 -3
  21. package/Form/Password/index.js +3 -7
  22. package/Form/RadioGroup/components/Item/index.js +1 -3
  23. package/Form/Select/index.js +4 -5
  24. package/Form/Select/spec.js +3 -3
  25. package/Form/SelectContextChoices/index.js +8 -8
  26. package/Form/SelectContextChoices/spec.js +3 -3
  27. package/Form/TextField/index.js +3 -5
  28. package/FormElement/components/ErrorText/index.js +7 -8
  29. package/FormElement/components/Label/index.js +2 -2
  30. package/FormElement/components/Placeholder/index.js +3 -3
  31. package/FormElement/components/Underline/index.js +9 -17
  32. package/Glow/index.js +1 -2
  33. package/Glow/spec.js +3 -3
  34. package/IndicatorCircle/index.js +3 -4
  35. package/LoadingIndicator/index.js +3 -3
  36. package/Manufacturer/index.js +2 -2
  37. package/NoResults/components/Icon/index.js +3 -4
  38. package/NoResults/index.js +5 -5
  39. package/Placeholder/index.js +2 -2
  40. package/PlaceholderLabel/index.js +2 -3
  41. package/Price/index.js +4 -3
  42. package/PriceInfo/index.js +3 -4
  43. package/PriceStriked/index.js +3 -4
  44. package/ProgressBar/index.js +7 -12
  45. package/RadioButton/index.js +3 -4
  46. package/RatingStars/index.js +4 -5
  47. package/Ripple/components/RippleAnimation/index.js +1 -2
  48. package/Ripple/index.js +1 -2
  49. package/ScannerOverlay/components/CameraOverlay/index.js +1 -2
  50. package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +4 -4
  51. package/ScannerOverlay/components/ScannerBar/index.js +3 -4
  52. package/Sheet/components/Header/components/SearchBar/index.js +6 -7
  53. package/Sheet/components/Header/index.js +15 -11
  54. package/Sheet/components/Header/spec.js +3 -1
  55. package/Sheet/index.js +2 -2
  56. package/TaxDisclaimer/index.js +11 -10
  57. package/TaxDisclaimer/spec.js +2 -1
  58. package/TextField/components/ErrorText/index.js +7 -7
  59. package/TextField/components/FormElement/index.js +3 -3
  60. package/TextField/components/Hint/index.js +3 -4
  61. package/TextField/components/Label/index.js +2 -2
  62. package/TextField/components/Underline/index.js +9 -17
  63. package/package.json +5 -5
@@ -1,36 +1,34 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { I18n } from '@shopgate/engage/components';
3
+ import { I18n, Typography } from '@shopgate/engage/components';
4
4
  import { i18n } from '@shopgate/engage/core/helpers';
5
5
  import { makeStyles } from '@shopgate/engage/styles';
6
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
8
- const badgeBase = {
9
- background: 'var(--color-primary)',
10
- borderRadius: 2,
11
- color: 'var(--color-primary-contrast)',
12
- padding: 5,
13
- width: '100%',
14
- fontWeight: 700,
15
- textAlign: 'center',
16
- display: 'flex',
17
- justifyContent: 'center',
18
- alignItems: 'center',
19
- lineHeight: 1,
20
- whiteSpace: 'nowrap',
21
- ...themeConfig.variables.discountBadgeBase
22
- };
23
- const useStyles = makeStyles()(() => ({
24
- small: {
25
- ...badgeBase
26
- },
27
- big: {
28
- ...badgeBase,
29
- paddingTop: 5,
30
- paddingLeft: 5,
31
- paddingRight: 5
32
- }
33
- }));
7
+ const useStyles = makeStyles()(theme => {
8
+ const badgeBase = {
9
+ background: theme.components.discountBadge.background,
10
+ borderRadius: 2,
11
+ color: theme.contrastColor(theme.components.discountBadge.background),
12
+ padding: 5,
13
+ width: '100%',
14
+ display: 'flex',
15
+ justifyContent: 'center',
16
+ alignItems: 'center',
17
+ lineHeight: 1,
18
+ whiteSpace: 'nowrap'
19
+ };
20
+ return {
21
+ small: {
22
+ ...badgeBase
23
+ },
24
+ big: {
25
+ ...badgeBase,
26
+ paddingTop: 5,
27
+ paddingLeft: 5,
28
+ paddingRight: 5
29
+ }
30
+ };
31
+ });
34
32
  /**
35
33
  * The discount badge component.
36
34
  * @param {Object} props The component props
@@ -54,11 +52,16 @@ const DiscountBadge = ({
54
52
  className: "ui-shared__discount-badge",
55
53
  "aria-label": `${i18n.text('cart.discount')}: ${text}`,
56
54
  tabIndex: -1,
57
- children: /*#__PURE__*/_jsx(I18n.Text, {
55
+ children: /*#__PURE__*/_jsx(Typography, {
56
+ variant: "caption",
57
+ align: "center",
58
+ fontWeight: "bold",
58
59
  className: cx(displayClass, className, 'theme__discount-badge'),
59
- string: text,
60
- params: [discount],
61
- "aria-hidden": true
60
+ "aria-hidden": true,
61
+ children: /*#__PURE__*/_jsx(I18n.Text, {
62
+ string: text,
63
+ params: [discount]
64
+ })
62
65
  })
63
66
  });
64
67
  };
@@ -1,20 +1,20 @@
1
1
  import React from 'react';
2
- import { shallow } from 'enzyme';
2
+ import { render } from '@testing-library/react';
3
3
  import DiscountBadge from "./index";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  jest.mock('@shopgate/engage/components');
6
6
  describe('<DiscountBadge />', () => {
7
7
  it('should render the text', () => {
8
- const wrapper = shallow(/*#__PURE__*/_jsx(DiscountBadge, {
8
+ const wrapper = render(/*#__PURE__*/_jsx(DiscountBadge, {
9
9
  text: "foo"
10
10
  }));
11
- expect(wrapper).toMatchSnapshot();
11
+ expect(wrapper.asFragment()).toMatchSnapshot();
12
12
  });
13
13
  it('should render the text and discount', () => {
14
- const wrapper = shallow(/*#__PURE__*/_jsx(DiscountBadge, {
14
+ const wrapper = render(/*#__PURE__*/_jsx(DiscountBadge, {
15
15
  text: "SAVE {0}%",
16
16
  discount: 20
17
17
  }));
18
- expect(wrapper).toMatchSnapshot();
18
+ expect(wrapper.asFragment()).toMatchSnapshot();
19
19
  });
20
20
  });
@@ -1,6 +1,6 @@
1
1
  import { connect } from 'react-redux';
2
2
  import { toggleFavoriteWithListChooser } from '@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';
3
- import { getLoadWishlistOnAppStartEnabled, getWishlistItemQuantityEnabled } from '@shopgate/engage/core/selectors/shopSettings';
3
+ import { getLoadWishlistOnAppStartEnabled, getWishlistItemQuantityEnabled } from '@shopgate/engage/settings/selectors/shopSettings';
4
4
 
5
5
  /**
6
6
  * Creates the mapStateToProps connector function.
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useRef, useMemo, memo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import appConfig, { themeShadows, themeColors } from '@shopgate/pwa-common/helpers/config';
3
+ import appConfig from '@shopgate/pwa-common/helpers/config';
4
4
  import { i18n } from '@shopgate/engage/core/helpers';
5
5
  import { makeStyles } from '@shopgate/engage/styles';
6
6
  import HeartIcon from "../icons/HeartIcon";
@@ -10,28 +10,31 @@ import HeartPlus from "../icons/HeartPlusIcon";
10
10
  import Ripple from "../Ripple";
11
11
  import connect from "./connector";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- const buttonProto = {
14
- display: 'block',
15
- position: 'relative',
16
- background: themeColors.light,
17
- borderRadius: '50%',
18
- padding: 0,
19
- fontSize: 20,
20
- lineHeight: 1,
21
- color: 'var(--color-secondary)',
22
- outline: 0
23
- };
24
- const useStyles = makeStyles()({
25
- buttonFlat: {
26
- ...buttonProto
27
- },
28
- button: {
29
- ...buttonProto,
30
- boxShadow: themeShadows.buttons.elevated
31
- },
32
- ripple: {
33
- padding: 6
34
- }
13
+ const useStyles = makeStyles()(theme => {
14
+ const buttonProto = {
15
+ display: 'flex',
16
+ alignItems: 'center',
17
+ justifyContent: 'center',
18
+ position: 'relative',
19
+ background: theme.palette.common.white,
20
+ borderRadius: '50%',
21
+ padding: 0,
22
+ fontSize: theme.components.icon.small,
23
+ color: theme.palette.secondary.main,
24
+ outline: 0
25
+ };
26
+ return {
27
+ buttonFlat: {
28
+ ...buttonProto
29
+ },
30
+ button: {
31
+ ...buttonProto,
32
+ boxShadow: '0 8px 13px rgba(0, 0, 0, 0.25)'
33
+ },
34
+ ripple: {
35
+ padding: 6
36
+ }
37
+ };
35
38
  });
36
39
 
37
40
  /**
@@ -20,7 +20,7 @@ const useStyles = makeStyles()(theme => ({
20
20
  marginLeft: theme.spacing(4)
21
21
  },
22
22
  checked: {
23
- color: 'var(--color-primary)'
23
+ color: theme.palette.primary.main
24
24
  }
25
25
  }));
26
26
 
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
- import { shallow } from 'enzyme';
2
+ import { render } from '@testing-library/react';
3
3
  import InfoField from "./index";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  describe('<InfoField>', () => {
6
6
  it('should render info field', () => {
7
- const wrapper = shallow(/*#__PURE__*/_jsx(InfoField, {
7
+ const wrapper = render(/*#__PURE__*/_jsx(InfoField, {
8
8
  children: "Some info text"
9
9
  }));
10
- expect(wrapper).toMatchSnapshot();
10
+ expect(wrapper.asFragment()).toMatchSnapshot();
11
11
  });
12
12
  });
@@ -1,19 +1,15 @@
1
1
  import React, { useState, useCallback } from 'react';
2
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
3
2
  import { makeStyles } from '@shopgate/engage/styles';
4
3
  import ToggleIcon from "../../ToggleIcon";
5
4
  import VisibilityIcon from "../../icons/VisibilityIcon";
6
5
  import VisibilityOffIcon from "../../icons/VisibilityOffIcon";
7
6
  import TextField from "../TextField";
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
9
- const {
10
- colors
11
- } = themeConfig;
12
- const useStyles = makeStyles()({
8
+ const useStyles = makeStyles()(theme => ({
13
9
  visOff: {
14
- color: colors.shade4
10
+ color: theme.palette.grey.medium
15
11
  }
16
- });
12
+ }));
17
13
 
18
14
  /**
19
15
  * A component that provides a password field with visibility toggle.
@@ -20,13 +20,11 @@ const useStyles = makeStyles()(theme => ({
20
20
  },
21
21
  label: {
22
22
  flex: 1,
23
- fontSize: '1rem',
24
- lineHeight: 1.5,
25
23
  marginLeft: theme.spacing(1),
26
24
  marginBottom: theme.spacing(1)
27
25
  },
28
26
  active: {
29
- color: 'var(--color-primary)'
27
+ color: theme.palette.primary.main
30
28
  }
31
29
  }));
32
30
 
@@ -4,7 +4,7 @@ import { makeStyles } from '@shopgate/engage/styles';
4
4
  import Chevron from "../../icons/ChevronIcon";
5
5
  import FormElement from "../../FormElement";
6
6
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
7
- const useStyles = makeStyles()({
7
+ const useStyles = makeStyles()(theme => ({
8
8
  select: {
9
9
  appearance: 'none',
10
10
  position: 'relative',
@@ -15,8 +15,7 @@ const useStyles = makeStyles()({
15
15
  width: '100%',
16
16
  margin: '24px 0 0 0',
17
17
  outline: 0,
18
- fontSize: 16,
19
- lineHeight: '19px',
18
+ fontSize: theme.typography.body1.fontSize,
20
19
  zIndex: 10
21
20
  },
22
21
  chevron: {
@@ -24,10 +23,10 @@ const useStyles = makeStyles()({
24
23
  top: '50%',
25
24
  right: 0,
26
25
  transform: 'translateY(-50%) rotateZ(-90deg)',
27
- fontSize: '1.3em !important',
26
+ fontSize: `${theme.components.icon.medium} !important`,
28
27
  marginTop: -3
29
28
  }
30
- });
29
+ }));
31
30
 
32
31
  /**
33
32
  * Styled select for material-style forms (native select + chevron).
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render } from '@testing-library/react';
3
3
  import Select from "./index";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  const inputProps = {
@@ -29,11 +29,11 @@ describe('<Select />', () => {
29
29
  it(test, () => {
30
30
  const testFixtures = tests[test];
31
31
  // eslint-disable-next-line extra-rules/no-single-line-objects
32
- const wrapper = mount(/*#__PURE__*/_jsx(Select, {
32
+ const wrapper = render(/*#__PURE__*/_jsx(Select, {
33
33
  ...inputProps,
34
34
  ...testFixtures
35
35
  }));
36
- expect(wrapper).toMatchSnapshot();
36
+ expect(wrapper.asFragment()).toMatchSnapshot();
37
37
  });
38
38
  });
39
39
  });
@@ -3,30 +3,29 @@ import React, { useState, useCallback } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import pick from 'lodash/pick';
5
5
  import { i18n } from '@shopgate/engage/core/helpers';
6
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
7
6
  import { makeStyles } from '@shopgate/engage/styles';
7
+ import { Typography } from '@shopgate/engage/components';
8
8
  import Chevron from "../../icons/ChevronIcon";
9
9
  import InfoField from "../InfoField";
10
10
  import ContextMenu from "../../ContextMenu";
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- const useStyles = makeStyles()({
12
+ const useStyles = makeStyles()(theme => ({
13
13
  chevron: {
14
14
  position: 'absolute',
15
15
  top: '50%',
16
16
  right: 0,
17
17
  transform: 'translateY(-50%) rotateZ(-90deg)',
18
- fontSize: '1.3em !important',
18
+ fontSize: `${theme.components.icon.medium} !important`,
19
19
  marginTop: -3
20
20
  },
21
21
  toggle: {
22
- fontSize: '1rem',
23
22
  paddingRight: '2rem'
24
23
  },
25
24
  itemSelected: {
26
- backgroundColor: themeConfig.colors.shade8,
27
- fontWeight: 500
25
+ backgroundColor: theme.palette.grey.light,
26
+ fontWeight: theme.typography.fontWeightMedium
28
27
  }
29
- });
28
+ }));
30
29
 
31
30
  /**
32
31
  * @param {Object} props Props.
@@ -71,7 +70,8 @@ const SelectContextChoices = ({
71
70
  rightElement: /*#__PURE__*/_jsx(Chevron, {
72
71
  className: classes.chevron
73
72
  }),
74
- children: [/*#__PURE__*/_jsxs("div", {
73
+ children: [/*#__PURE__*/_jsxs(Typography, {
74
+ component: "div",
75
75
  role: "button",
76
76
  onClick: () => setOpened(true),
77
77
  "aria-hidden": true,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { shallow } from 'enzyme';
2
+ import { render } from '@testing-library/react';
3
3
  import SelectContextChoices from "./index";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  jest.mock('@shopgate/engage/a11y/components');
@@ -27,10 +27,10 @@ describe('<SelectContextChoices />', () => {
27
27
  Object.keys(tests).forEach(test => {
28
28
  it(test, () => {
29
29
  const testFixtures = tests[test];
30
- const wrapper = shallow(/*#__PURE__*/_jsx(SelectContextChoices, {
30
+ const wrapper = render(/*#__PURE__*/_jsx(SelectContextChoices, {
31
31
  ...testFixtures
32
32
  }));
33
- expect(wrapper).toMatchSnapshot();
33
+ expect(wrapper.asFragment()).toMatchSnapshot();
34
34
  });
35
35
  });
36
36
  });
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  const noop = () => {};
14
14
  const bluredDateSelector = 'input[type="date"]:in-range:not(:focus)';
15
15
  const webkitDateFields = ['::-webkit-datetime-edit-year-field', '::-webkit-datetime-edit-month-field', '::-webkit-datetime-edit-day-field', '::-webkit-datetime-edit-text'].map(suffix => `${bluredDateSelector}${suffix}`).join(', ');
16
- const useStyles = makeStyles()({
16
+ const useStyles = makeStyles()(theme => ({
17
17
  container: {
18
18
  '& input[type="date"]': {
19
19
  minHeight: '1.3rem',
@@ -32,8 +32,7 @@ const useStyles = makeStyles()({
32
32
  width: '100%',
33
33
  marginTop: 24,
34
34
  outline: 0,
35
- fontSize: 16,
36
- lineHeight: '19px'
35
+ fontSize: theme.typography.body1.fontSize
37
36
  },
38
37
  multiLine: {
39
38
  position: 'relative',
@@ -44,7 +43,6 @@ const useStyles = makeStyles()({
44
43
  outline: 0,
45
44
  height: 19,
46
45
  minHeight: 19,
47
- lineHeight: '19px',
48
46
  verticalAlign: 'top'
49
47
  },
50
48
  element: {
@@ -55,7 +53,7 @@ const useStyles = makeStyles()({
55
53
  leftOffset: {
56
54
  marginLeft: 2
57
55
  }
58
- });
56
+ }));
59
57
 
60
58
  /**
61
59
  * TextField component (form wrapper with leading/trailing elements).
@@ -1,21 +1,17 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { I18n } from '@shopgate/engage/components';
3
+ import { I18n, Typography } from '@shopgate/engage/components';
4
4
  import { makeStyles } from '@shopgate/engage/styles';
5
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
- const useStyles = makeStyles()(theme => ({
6
+ const useStyles = makeStyles()({
7
7
  root: {
8
- bottom: 2,
9
- color: theme.palette.error.main,
10
- fontSize: 12,
11
- lineHeight: '14px',
12
8
  overflow: 'hidden',
13
9
  position: 'absolute',
14
10
  textOverflow: 'ellipsis',
15
11
  whiteSpace: 'nowrap',
16
12
  width: '100%'
17
13
  }
18
- }));
14
+ });
19
15
 
20
16
  /**
21
17
  * Error message component.
@@ -33,7 +29,10 @@ const ErrorText = ({
33
29
  classes,
34
30
  cx
35
31
  } = useStyles();
36
- return /*#__PURE__*/_jsxs("div", {
32
+ return /*#__PURE__*/_jsxs(Typography, {
33
+ variant: "caption",
34
+ component: "div",
35
+ color: "error",
37
36
  id: `ariaError-${elementName}`,
38
37
  className: cx(classes.root, 'errorText', className),
39
38
  "aria-live": "assertive",
@@ -18,7 +18,7 @@ const useStyles = makeStyles()(theme => ({
18
18
  lineHeight: '19px',
19
19
  pointerEvents: 'none',
20
20
  userSelect: 'none',
21
- color: 'var(--color-text-medium-emphasis)',
21
+ color: theme.palette.text.secondary,
22
22
  transformOrigin: 'left top 0px',
23
23
  willChange: 'transform, color',
24
24
  overflow: 'visible',
@@ -30,7 +30,7 @@ const useStyles = makeStyles()(theme => ({
30
30
  lineHeight: '19px',
31
31
  pointerEvents: 'none',
32
32
  userSelect: 'none',
33
- color: 'var(--color-text-medium-emphasis)'
33
+ color: theme.palette.text.secondary
34
34
  },
35
35
  labelFloating: {
36
36
  transform: 'translate3d(0, -22px, 0) scale3d(0.75, 0.75, 0.75)',
@@ -10,12 +10,12 @@ const ellipsisLine = {
10
10
  whiteSpace: 'nowrap',
11
11
  textOverflow: 'ellipsis'
12
12
  };
13
- const useStyles = makeStyles()({
13
+ const useStyles = makeStyles()(theme => ({
14
14
  placeholder: {
15
15
  position: 'absolute',
16
16
  pointerEvents: 'none',
17
17
  top: 24,
18
- color: 'var(--color-text-medium-emphasis)',
18
+ color: theme.palette.text.secondary,
19
19
  willChange: 'transform',
20
20
  transition: `opacity ${easing}`,
21
21
  ...ellipsisLine
@@ -27,7 +27,7 @@ const useStyles = makeStyles()({
27
27
  left: 'var(--form-element-left-offset, 26px)',
28
28
  width: 'calc(100% - var(--form-element-left-offset, 26px))'
29
29
  }
30
- });
30
+ }));
31
31
 
32
32
  /**
33
33
  * The form element placeholder component.
@@ -1,18 +1,13 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import color from 'color';
4
- import { getCSSCustomProp, makeStyles, useTheme } from '@shopgate/engage/styles';
5
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
3
+ import { makeStyles, useTheme } from '@shopgate/engage/styles';
6
4
  import { jsx as _jsx } from "react/jsx-runtime";
7
- const {
8
- colors
9
- } = themeConfig;
10
5
  const easing = '450ms cubic-bezier(0.23, 1, 0.32, 1)';
11
- const useStyles = makeStyles()({
6
+ const useStyles = makeStyles()(theme => ({
12
7
  underlineWrapper: {
13
8
  position: 'relative',
14
9
  width: '100%',
15
- borderBottom: `1px solid ${colors.shade12}`,
10
+ borderBottom: `1px solid ${theme.components.border.medium}`,
16
11
  marginTop: 2,
17
12
  marginBottom: 7
18
13
  },
@@ -25,23 +20,20 @@ const useStyles = makeStyles()({
25
20
  willChange: 'transform',
26
21
  transition: `transform ${easing}`
27
22
  }
28
- });
23
+ }));
29
24
 
30
25
  /**
31
26
  * Returns the underline inline style (border color + scale).
27
+ * @param {Object} theme The theme object.
32
28
  * @param {boolean} focused Is focused set or not.
33
29
  * @param {boolean} hasError Has error set or not.
34
30
  * @param {string} errorColor Theme error main color.
35
31
  * @return {Object} style
36
32
  */
37
- const getUnderlineStyle = (focused, hasError, errorColor) => {
38
- const primaryColor = getCSSCustomProp('--color-primary') || colors.primary;
39
- let focusColor = '--color-primary';
40
- if (color(primaryColor).luminosity() >= 0.8) {
41
- focusColor = '--color-secondary';
42
- }
33
+ const getUnderlineStyle = (theme, focused, hasError, errorColor) => {
34
+ const focusColor = theme.palette.primary.main;
43
35
  return {
44
- borderBottomColor: hasError ? errorColor : `var(${focusColor}, ${colors.focus})`,
36
+ borderBottomColor: hasError ? errorColor : focusColor,
45
37
  ...(!focused && !hasError && {
46
38
  transform: 'scale3d(0,1,1)'
47
39
  })
@@ -63,7 +55,7 @@ const Underline = props => {
63
55
  className: cx(classes.underlineWrapper, 'underline'),
64
56
  children: /*#__PURE__*/_jsx("div", {
65
57
  className: classes.underline,
66
- style: getUnderlineStyle(props.isFocused, props.hasErrorMessage, theme.palette.error.main)
58
+ style: getUnderlineStyle(theme, props.isFocused, props.hasErrorMessage, theme.palette.error.main)
67
59
  })
68
60
  });
69
61
  };
package/Glow/index.js CHANGED
@@ -2,7 +2,6 @@ import React, { useState, useRef, useEffect, useCallback } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { withForwardedRef } from '@shopgate/engage/core';
4
4
  import { makeStyles } from '@shopgate/engage/styles';
5
- import { themeConfig } from '@shopgate/pwa-common/helpers/config';
6
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
6
  const useStyles = makeStyles()({
8
7
  container: {
@@ -81,7 +80,7 @@ const Glow = ({
81
80
  jsx-a11y/click-events-have-key-events */
82
81
  };
83
82
  Glow.defaultProps = {
84
- color: themeConfig.colors.shade8,
83
+ color: 'var(--sg-palette-grey-light)',
85
84
  className: null,
86
85
  forwardedRef: null,
87
86
  disabled: false,
package/Glow/spec.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render } from '@testing-library/react';
3
3
  import Glow from "./index";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  describe('<Glow />', () => {
6
6
  it('should render with a smile', () => {
7
- const wrapper = mount(/*#__PURE__*/_jsx(Glow, {
7
+ const wrapper = render(/*#__PURE__*/_jsx(Glow, {
8
8
  children: /*#__PURE__*/_jsx("p", {
9
9
  children: "Glowing!"
10
10
  })
11
11
  }));
12
- expect(wrapper).toMatchSnapshot();
12
+ expect(wrapper.asFragment()).toMatchSnapshot();
13
13
  });
14
14
  });
@@ -1,6 +1,5 @@
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, keyframes } from '@shopgate/engage/styles';
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  const rotate = keyframes({
@@ -89,9 +88,9 @@ const IndicatorCircle = ({
89
88
  });
90
89
  };
91
90
  IndicatorCircle.defaultProps = {
92
- color: 'var(--color-secondary)',
91
+ color: 'var(--sg-palette-secondary-main)',
93
92
  paused: false,
94
- size: themeConfig.variables.loadingIndicator.size,
95
- strokeWidth: themeConfig.variables.loadingIndicator.strokeWidth
93
+ size: 32,
94
+ strokeWidth: 3
96
95
  };
97
96
  export default IndicatorCircle;
@@ -9,13 +9,13 @@ const {
9
9
  imgSrc: loadingImageSrc
10
10
  } = {}
11
11
  } = themeConfig.variables;
12
- const useStyles = makeStyles()(() => ({
12
+ const useStyles = makeStyles()(theme => ({
13
13
  container: {
14
14
  display: 'block',
15
15
  padding: '1em',
16
16
  textAlign: 'center',
17
- fontSize: '1.5em',
18
- color: 'var(--color-secondary)'
17
+ fontSize: theme.components.icon.medium,
18
+ color: theme.palette.secondary.main
19
19
  },
20
20
  imgContainer: {
21
21
  display: 'flex',
@@ -2,9 +2,9 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { makeStyles } from '@shopgate/engage/styles';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
- const useStyles = makeStyles()(() => ({
5
+ const useStyles = makeStyles()(theme => ({
6
6
  root: {
7
- color: 'var(--color-primary)'
7
+ color: theme.palette.primary.main
8
8
  }
9
9
  }));
10
10
 
@@ -1,21 +1,20 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import CryptoJs from 'crypto-js';
4
- import { themeColors } from '@shopgate/pwa-common/helpers/config';
5
4
  import { makeStyles } from '@shopgate/engage/styles';
6
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
- const useStyles = makeStyles()({
6
+ const useStyles = makeStyles()(theme => ({
8
7
  magnifier: {
9
8
  fill: 'currentColor'
10
9
  },
11
10
  background: {
12
- fill: themeColors.light
11
+ fill: theme.palette.background.surface
13
12
  },
14
13
  circle: {
15
14
  fill: 'currentColor',
16
15
  opacity: 0.065
17
16
  }
18
- });
17
+ }));
19
18
 
20
19
  /**
21
20
  * The no search results icon component.