@shopgate/pwa-ui-shared 7.31.3 → 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.
- package/ActionButton/spec.js +25 -28
- package/AddToCartButton/index.js +14 -14
- package/Availability/index.js +11 -28
- package/Availability/spec.js +11 -11
- package/Button/index.js +6 -9
- package/ButtonLink/spec.js +11 -7
- package/Card/index.js +5 -8
- package/CardList/components/Item/index.js +1 -2
- package/CartTotalLine/index.js +8 -12
- package/Checkbox/index.js +3 -4
- package/Chip/index.js +9 -10
- package/ContextMenu/components/Item/index.js +18 -28
- package/ContextMenu/index.js +3 -4
- package/Dialog/components/HtmlContentDialog/spec.js +7 -1
- package/DiscountBadge/index.js +35 -32
- package/DiscountBadge/spec.js +5 -5
- package/FavoritesButton/connector.js +1 -1
- package/FavoritesButton/index.js +26 -23
- package/Form/Checkbox/index.js +1 -1
- package/Form/InfoField/spec.js +3 -3
- package/Form/Password/index.js +3 -7
- package/Form/RadioGroup/components/Item/index.js +1 -3
- package/Form/Select/index.js +4 -5
- package/Form/Select/spec.js +3 -3
- package/Form/SelectContextChoices/index.js +8 -8
- package/Form/SelectContextChoices/spec.js +3 -3
- package/Form/TextField/index.js +3 -5
- package/FormElement/components/ErrorText/index.js +7 -8
- package/FormElement/components/Label/index.js +2 -2
- package/FormElement/components/Placeholder/index.js +3 -3
- package/FormElement/components/Underline/index.js +9 -17
- package/Glow/index.js +1 -2
- package/Glow/spec.js +3 -3
- package/IndicatorCircle/index.js +3 -4
- package/LoadingIndicator/index.js +3 -3
- package/Manufacturer/index.js +2 -2
- package/NoResults/components/Icon/index.js +3 -4
- package/NoResults/index.js +5 -5
- package/Placeholder/index.js +2 -2
- package/PlaceholderLabel/index.js +2 -3
- package/Price/index.js +4 -3
- package/PriceInfo/index.js +3 -4
- package/PriceStriked/index.js +3 -4
- package/ProgressBar/index.js +7 -12
- package/RadioButton/index.js +3 -4
- package/RatingStars/index.js +4 -5
- package/Ripple/components/RippleAnimation/index.js +1 -2
- package/Ripple/index.js +1 -2
- package/ScannerOverlay/components/CameraOverlay/index.js +1 -2
- package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +4 -4
- package/ScannerOverlay/components/ScannerBar/index.js +3 -4
- package/Sheet/components/Header/components/SearchBar/index.js +6 -7
- package/Sheet/components/Header/index.js +15 -11
- package/Sheet/components/Header/spec.js +3 -1
- package/Sheet/index.js +2 -2
- package/TaxDisclaimer/index.js +11 -10
- package/TaxDisclaimer/spec.js +2 -1
- package/TextField/components/ErrorText/index.js +7 -7
- package/TextField/components/FormElement/index.js +3 -3
- package/TextField/components/Hint/index.js +3 -4
- package/TextField/components/Label/index.js +2 -2
- package/TextField/components/Underline/index.js +9 -17
- package/package.json +5 -5
package/ActionButton/spec.js
CHANGED
|
@@ -1,57 +1,54 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import IndicatorCircle from "../IndicatorCircle";
|
|
4
|
-
import RippleButton from "../RippleButton";
|
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
5
3
|
import ActionButton from "./index";
|
|
6
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
5
|
describe('<ActionButton />', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Renders the component.
|
|
14
|
-
* @param {Object} props The component props.
|
|
15
|
-
*/
|
|
16
|
-
const renderComponent = (props = {}) => {
|
|
17
|
-
renderedElement = shallow(/*#__PURE__*/_jsx(ActionButton, {
|
|
18
|
-
...props,
|
|
19
|
-
children: "Action Button"
|
|
20
|
-
}));
|
|
21
|
-
};
|
|
6
|
+
const renderComponent = (props = {}) => render(/*#__PURE__*/_jsx(ActionButton, {
|
|
7
|
+
...props,
|
|
8
|
+
children: "Action Button"
|
|
9
|
+
}));
|
|
22
10
|
describe('Given the component was mounted to the DOM', () => {
|
|
11
|
+
let renderedElement;
|
|
12
|
+
let mockOnClick;
|
|
23
13
|
beforeEach(() => {
|
|
14
|
+
jest.useFakeTimers();
|
|
24
15
|
mockOnClick = jest.fn();
|
|
25
|
-
renderComponent({
|
|
16
|
+
renderedElement = renderComponent({
|
|
26
17
|
onClick: mockOnClick
|
|
27
18
|
});
|
|
28
19
|
});
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
jest.clearAllTimers();
|
|
22
|
+
jest.useRealTimers();
|
|
23
|
+
});
|
|
29
24
|
it('should match snapshot', () => {
|
|
30
|
-
expect(renderedElement).toMatchSnapshot();
|
|
25
|
+
expect(renderedElement.container.firstChild).toMatchSnapshot();
|
|
31
26
|
});
|
|
32
27
|
it('should not show the loading indicator by default', () => {
|
|
33
|
-
const indicator = renderedElement.
|
|
34
|
-
expect(indicator
|
|
28
|
+
const indicator = renderedElement.container.querySelector('[data-test-id="loadingIndicator"]');
|
|
29
|
+
expect(indicator).toBeNull();
|
|
35
30
|
});
|
|
36
31
|
describe('Given the loading prop is set to true', () => {
|
|
37
32
|
beforeEach(() => {
|
|
38
|
-
renderedElement.
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
renderedElement.rerender(/*#__PURE__*/_jsx(ActionButton, {
|
|
34
|
+
onClick: mockOnClick,
|
|
35
|
+
loading: true,
|
|
36
|
+
children: "Action Button"
|
|
37
|
+
}));
|
|
41
38
|
});
|
|
42
39
|
it('should match snapshot', () => {
|
|
43
|
-
expect(renderedElement).toMatchSnapshot();
|
|
40
|
+
expect(renderedElement.container.firstChild).toMatchSnapshot();
|
|
44
41
|
});
|
|
45
42
|
it('should show the loading indicator', () => {
|
|
46
|
-
const indicator = renderedElement.
|
|
47
|
-
expect(indicator
|
|
43
|
+
const indicator = renderedElement.container.querySelector('[data-test-id="loadingIndicator"]');
|
|
44
|
+
expect(indicator).toBeTruthy();
|
|
48
45
|
});
|
|
49
46
|
});
|
|
50
47
|
describe('Given the component gets clicked', () => {
|
|
51
48
|
let timeoutSpy;
|
|
52
49
|
beforeEach(() => {
|
|
53
50
|
timeoutSpy = jest.spyOn(global, 'setTimeout');
|
|
54
|
-
|
|
51
|
+
fireEvent.click(screen.getByRole('button'));
|
|
55
52
|
});
|
|
56
53
|
afterEach(() => {
|
|
57
54
|
timeoutSpy.mockRestore();
|
package/AddToCartButton/index.js
CHANGED
|
@@ -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
|
},
|
|
@@ -55,23 +54,23 @@ const useStyles = makeStyles()({
|
|
|
55
54
|
spinnerIcon: {
|
|
56
55
|
left: '50%',
|
|
57
56
|
top: '50%',
|
|
58
|
-
marginTop: -
|
|
59
|
-
marginLeft: -
|
|
57
|
+
marginTop: -32 / 2,
|
|
58
|
+
marginLeft: -32 / 2
|
|
60
59
|
},
|
|
61
60
|
buttonReady: {
|
|
62
|
-
background:
|
|
63
|
-
color:
|
|
61
|
+
background: theme.components.ctaButton.background,
|
|
62
|
+
color: theme.contrastColor(theme.components.ctaButton.background)
|
|
64
63
|
},
|
|
65
64
|
buttonSuccess: {
|
|
66
|
-
background:
|
|
67
|
-
color:
|
|
65
|
+
background: theme.contrastColor(theme.components.ctaButton.background),
|
|
66
|
+
color: theme.components.ctaButton.background
|
|
68
67
|
},
|
|
69
68
|
buttonDisabled: {
|
|
70
|
-
background:
|
|
71
|
-
color:
|
|
72
|
-
boxShadow:
|
|
69
|
+
background: theme.palette.action.disabledBackground,
|
|
70
|
+
color: theme.contrastColor(theme.palette.action.disabledBackground),
|
|
71
|
+
boxShadow: '0 3px 4px rgba(0, 0, 0, 0.13)'
|
|
73
72
|
}
|
|
74
|
-
});
|
|
73
|
+
}));
|
|
75
74
|
|
|
76
75
|
/**
|
|
77
76
|
* @param {number} bSize .
|
|
@@ -114,6 +113,7 @@ const AddToCartButton = ({
|
|
|
114
113
|
classes,
|
|
115
114
|
cx
|
|
116
115
|
} = useStyles();
|
|
116
|
+
const theme = useTheme();
|
|
117
117
|
const [showCheckmark, setShowCheckmark] = useState(null);
|
|
118
118
|
|
|
119
119
|
/**
|
|
@@ -216,7 +216,7 @@ const AddToCartButton = ({
|
|
|
216
216
|
className: cx(classes.icon, classes.spinnerIcon),
|
|
217
217
|
style: spinnerInlineStyle,
|
|
218
218
|
children: /*#__PURE__*/_jsx(IndicatorCircle, {
|
|
219
|
-
color:
|
|
219
|
+
color: theme.contrastColor(theme.components.ctaButton.background),
|
|
220
220
|
strokeWidth: 5,
|
|
221
221
|
paused: !isLoading
|
|
222
222
|
})
|
package/Availability/index.js
CHANGED
|
@@ -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 {
|
|
4
|
+
import { Typography } from '@shopgate/engage/components';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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/Availability/spec.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
import { AVAILABILITY_STATE_OK, AVAILABILITY_STATE_WARNING, AVAILABILITY_STATE_ALERT } from '@shopgate/pwa-common-commerce/product/constants';
|
|
4
4
|
import Availability from "./index";
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
describe('<Availability />', () => {
|
|
7
7
|
it('should not render when text is empty', () => {
|
|
8
|
-
const wrapper =
|
|
8
|
+
const wrapper = render(/*#__PURE__*/_jsx(Availability, {
|
|
9
9
|
text: ""
|
|
10
10
|
}));
|
|
11
|
-
expect(wrapper).toMatchSnapshot();
|
|
11
|
+
expect(wrapper.asFragment()).toMatchSnapshot();
|
|
12
12
|
});
|
|
13
13
|
it('should not render by default if state is "ok"', () => {
|
|
14
|
-
const wrapper =
|
|
14
|
+
const wrapper = render(/*#__PURE__*/_jsx(Availability, {
|
|
15
15
|
state: AVAILABILITY_STATE_OK,
|
|
16
16
|
text: "Available"
|
|
17
17
|
}));
|
|
18
|
-
expect(wrapper).toMatchSnapshot();
|
|
18
|
+
expect(wrapper.asFragment()).toMatchSnapshot();
|
|
19
19
|
});
|
|
20
20
|
it('should render if state is "ok" when "showWhenAvailable" is set', () => {
|
|
21
|
-
const wrapper =
|
|
21
|
+
const wrapper = render(/*#__PURE__*/_jsx(Availability, {
|
|
22
22
|
state: AVAILABILITY_STATE_OK,
|
|
23
23
|
text: "Available",
|
|
24
24
|
showWhenAvailable: true
|
|
25
25
|
}));
|
|
26
|
-
expect(wrapper).toMatchSnapshot();
|
|
26
|
+
expect(wrapper.asFragment()).toMatchSnapshot();
|
|
27
27
|
});
|
|
28
28
|
it('should render if state is "warning"', () => {
|
|
29
|
-
const wrapper =
|
|
29
|
+
const wrapper = render(/*#__PURE__*/_jsx(Availability, {
|
|
30
30
|
state: AVAILABILITY_STATE_WARNING,
|
|
31
31
|
text: "Only 5 left"
|
|
32
32
|
}));
|
|
33
|
-
expect(wrapper).toMatchSnapshot();
|
|
33
|
+
expect(wrapper.asFragment()).toMatchSnapshot();
|
|
34
34
|
});
|
|
35
35
|
it('should render if state is "warning"', () => {
|
|
36
|
-
const wrapper =
|
|
36
|
+
const wrapper = render(/*#__PURE__*/_jsx(Availability, {
|
|
37
37
|
state: AVAILABILITY_STATE_ALERT,
|
|
38
38
|
text: "Out of stock"
|
|
39
39
|
}));
|
|
40
|
-
expect(wrapper).toMatchSnapshot();
|
|
40
|
+
expect(wrapper.asFragment()).toMatchSnapshot();
|
|
41
41
|
});
|
|
42
42
|
});
|
package/Button/index.js
CHANGED
|
@@ -4,9 +4,6 @@ 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.
|
|
@@ -55,21 +52,21 @@ const useStyles = makeStyles()((theme, {
|
|
|
55
52
|
};
|
|
56
53
|
}
|
|
57
54
|
if (type === 'simple') {
|
|
58
|
-
return disabled ? pairFromColors(
|
|
55
|
+
return disabled ? pairFromColors(theme.palette.action.disabled, theme.palette.action.disabledBackground, theme) : pairFromColors(theme.palette.common.black, theme.palette.grey.light, theme);
|
|
59
56
|
}
|
|
60
57
|
if (type === 'regular') {
|
|
61
|
-
return disabled ? pairFromColors(
|
|
58
|
+
return disabled ? pairFromColors(theme.palette.action.disabled, null, theme) : pairFromColors(theme.palette.common.black, null, theme);
|
|
62
59
|
}
|
|
63
60
|
if (type === 'secondary') {
|
|
64
61
|
if (!flat) {
|
|
65
|
-
return disabled ? pairFromColors(
|
|
62
|
+
return disabled ? pairFromColors(theme.palette.action.disabled, theme.palette.action.disabledBackground, theme) : pairFromColors(theme.palette.primary.contrastText, theme.palette.primary.main, theme);
|
|
66
63
|
}
|
|
67
|
-
return disabled ? pairFromColors(
|
|
64
|
+
return disabled ? pairFromColors(theme.palette.action.disabled, null, theme) : pairFromColors(theme.palette.primary.main, null, theme);
|
|
68
65
|
}
|
|
69
66
|
if (!flat) {
|
|
70
|
-
return disabled ? pairFromColors(
|
|
67
|
+
return disabled ? pairFromColors(theme.palette.action.disabled, theme.palette.action.disabledBackground, theme) : pairFromColors(theme.palette.secondary.contrastText, theme.palette.secondary.main, theme);
|
|
71
68
|
}
|
|
72
|
-
return disabled ? pairFromColors(
|
|
69
|
+
return disabled ? pairFromColors(theme.palette.action.disabled, null, theme) : pairFromColors(theme.palette.secondary.main, null, theme);
|
|
73
70
|
});
|
|
74
71
|
|
|
75
72
|
/**
|
package/ButtonLink/spec.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import ActionButton from "../ActionButton";
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
4
3
|
import { UnwrappedButtonLink as ButtonLink } from "./index";
|
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
5
|
describe('<ButtonLink>', () => {
|
|
7
6
|
describe('On click action', () => {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
jest.useFakeTimers();
|
|
9
|
+
});
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
jest.runOnlyPendingTimers();
|
|
12
|
+
jest.useRealTimers();
|
|
10
13
|
});
|
|
11
14
|
it('should create component and open page on click', () => {
|
|
12
15
|
const mockedNavigate = jest.fn();
|
|
13
16
|
const link = 'https://example.com';
|
|
14
|
-
const component =
|
|
17
|
+
const component = render(/*#__PURE__*/_jsx(ButtonLink, {
|
|
15
18
|
href: link,
|
|
16
19
|
navigate: mockedNavigate,
|
|
17
20
|
children: "Text inside"
|
|
18
21
|
}));
|
|
19
|
-
expect(component).toMatchSnapshot();
|
|
20
|
-
component.
|
|
22
|
+
expect(component.container.firstChild).toMatchSnapshot();
|
|
23
|
+
fireEvent.click(component.container.querySelector('button'));
|
|
24
|
+
jest.runOnlyPendingTimers();
|
|
21
25
|
expect(mockedNavigate).toHaveBeenCalledTimes(1);
|
|
22
26
|
expect(mockedNavigate).toHaveBeenCalledWith(link);
|
|
23
27
|
});
|
package/Card/index.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import "core-js/modules/es.array.includes.js";
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { themeConfig, themeName } 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
|
|
8
|
-
const useStyles = makeStyles()({
|
|
5
|
+
const useStyles = makeStyles()(theme => ({
|
|
9
6
|
root: {
|
|
10
|
-
boxShadow:
|
|
7
|
+
boxShadow: '0 4px 8px rgba(0,0,0,0.16)',
|
|
11
8
|
margin: '5px 5px 10px',
|
|
12
|
-
borderRadius:
|
|
13
|
-
background:
|
|
9
|
+
borderRadius: 10,
|
|
10
|
+
background: theme.palette.background.surface,
|
|
14
11
|
overflow: 'hidden',
|
|
15
12
|
position: 'relative'
|
|
16
13
|
}
|
|
17
|
-
});
|
|
14
|
+
}));
|
|
18
15
|
|
|
19
16
|
/**
|
|
20
17
|
* Renders the card component.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { Children } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import ListItem from '@shopgate/pwa-common/components/List/components/Item';
|
|
4
|
-
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
5
4
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
6
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
6
|
const useStyles = makeStyles()(theme => ({
|
|
8
7
|
root: {
|
|
9
|
-
background:
|
|
8
|
+
background: theme.palette.background.surface,
|
|
10
9
|
marginBottom: theme.spacing(0.5),
|
|
11
10
|
position: 'relative'
|
|
12
11
|
}
|
package/CartTotalLine/index.js
CHANGED
|
@@ -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:
|
|
13
|
+
fontSize: theme.typography.body2.fontSize,
|
|
18
14
|
alignItems: 'baseline'
|
|
19
15
|
},
|
|
20
16
|
disabled: {
|
|
21
|
-
color: `${
|
|
17
|
+
color: `${theme.palette.action.disabled} !important`
|
|
22
18
|
},
|
|
23
19
|
base: {
|
|
24
|
-
color:
|
|
20
|
+
color: theme.palette.text.secondary
|
|
25
21
|
},
|
|
26
22
|
subTotal: {
|
|
27
|
-
color:
|
|
23
|
+
color: theme.palette.text.primary
|
|
28
24
|
},
|
|
29
25
|
grandTotal: {
|
|
30
|
-
color:
|
|
31
|
-
fontSize:
|
|
26
|
+
color: theme.palette.text.primary,
|
|
27
|
+
fontSize: `${theme.typography.body1.fontSize} !important`
|
|
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:
|
|
15
|
+
color: theme.palette.secondary.main
|
|
17
16
|
},
|
|
18
17
|
uncheckedIcon: {
|
|
19
|
-
color:
|
|
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 ?
|
|
36
|
-
color: invert ?
|
|
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 ?
|
|
39
|
-
color: invert ?
|
|
40
|
-
'--color-text-high-emphasis': invert ?
|
|
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:
|
|
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:
|
|
59
|
-
fontWeight:
|
|
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:
|
|
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
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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.
|
package/ContextMenu/index.js
CHANGED
|
@@ -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:
|
|
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:
|
|
41
|
+
background: theme.palette.background.surface,
|
|
43
42
|
borderRadius: 2,
|
|
44
|
-
boxShadow:
|
|
43
|
+
boxShadow: '0 2px 6px rgba(0, 0, 0, .4)'
|
|
45
44
|
},
|
|
46
45
|
scrollable: {
|
|
47
46
|
maxHeight: '30vh',
|
|
@@ -38,10 +38,16 @@ jest.mock('@shopgate/engage/components', () => {
|
|
|
38
38
|
className
|
|
39
39
|
}, children);
|
|
40
40
|
}
|
|
41
|
+
function Typography({
|
|
42
|
+
children
|
|
43
|
+
}) {
|
|
44
|
+
return mockReact.createElement('span', null, children);
|
|
45
|
+
}
|
|
41
46
|
return {
|
|
42
47
|
I18n,
|
|
43
48
|
Ellipsis,
|
|
44
|
-
Button
|
|
49
|
+
Button,
|
|
50
|
+
Typography
|
|
45
51
|
};
|
|
46
52
|
});
|
|
47
53
|
describe('<HtmlContentDialog />', () => {
|