@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.
- package/ActionButton/index.js +4 -0
- package/AddToCartButton/index.js +18 -15
- package/Availability/index.js +11 -28
- package/Button/index.js +16 -12
- package/ButtonLink/index.js +4 -0
- package/Card/index.js +13 -37
- package/CardList/components/Item/index.js +26 -21
- package/CardList/index.js +2 -1
- 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/DiscountBadge/index.js +35 -32
- package/FavoritesButton/connector.js +1 -1
- package/FavoritesButton/index.js +26 -23
- package/Form/Checkbox/index.js +1 -1
- 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/SelectContextChoices/index.js +8 -8
- 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 +4 -4
- 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 +6 -6
- 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 +20 -10
- package/Ripple/components/RippleAnimation/index.js +1 -2
- package/Ripple/index.js +1 -2
- package/RippleButton/index.js +5 -1
- package/ScannerOverlay/components/CameraOverlay/index.js +1 -2
- package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +4 -4
- package/ScannerOverlay/components/ScannerBar/index.js +4 -5
- package/Sheet/components/Header/components/SearchBar/index.js +6 -7
- package/Sheet/components/Header/index.js +18 -15
- package/Sheet/index.js +17 -8
- package/TaxDisclaimer/index.js +10 -10
- 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/icons/AccountBoxIcon.d.ts +1 -1
- package/icons/AccountBoxIcon.d.ts.map +1 -1
- package/icons/AddMoreIcon.d.ts +1 -1
- package/icons/AddMoreIcon.d.ts.map +1 -1
- package/icons/ArrowDropIcon.d.ts +1 -1
- package/icons/ArrowDropIcon.d.ts.map +1 -1
- package/icons/ArrowIcon.d.ts +1 -1
- package/icons/ArrowIcon.d.ts.map +1 -1
- package/icons/BarcodeScannerIcon.d.ts +1 -1
- package/icons/BarcodeScannerIcon.d.ts.map +1 -1
- package/icons/BoxIcon.d.ts +1 -1
- package/icons/BoxIcon.d.ts.map +1 -1
- package/icons/BrowseIcon.d.ts +2 -1
- package/icons/BrowseIcon.d.ts.map +1 -1
- package/icons/BurgerIcon.d.ts +1 -1
- package/icons/BurgerIcon.d.ts.map +1 -1
- package/icons/CalendarIcon.d.ts +2 -1
- package/icons/CalendarIcon.d.ts.map +1 -1
- package/icons/CartCouponIcon.d.ts +2 -1
- package/icons/CartCouponIcon.d.ts.map +1 -1
- package/icons/CartIcon.d.ts +2 -1
- package/icons/CartIcon.d.ts.map +1 -1
- package/icons/CartPlusIcon.d.ts +2 -1
- package/icons/CartPlusIcon.d.ts.map +1 -1
- package/icons/CheckIcon.d.ts +2 -1
- package/icons/CheckIcon.d.ts.map +1 -1
- package/icons/CheckedIcon.d.ts +1 -1
- package/icons/CheckedIcon.d.ts.map +1 -1
- package/icons/ChevronIcon.d.ts +2 -1
- package/icons/ChevronIcon.d.ts.map +1 -1
- package/icons/CreditCardIcon.d.ts +2 -1
- package/icons/CreditCardIcon.d.ts.map +1 -1
- package/icons/CrossIcon.d.ts +2 -1
- package/icons/CrossIcon.d.ts.map +1 -1
- package/icons/DescriptionIcon.d.ts +2 -1
- package/icons/DescriptionIcon.d.ts.map +1 -1
- package/icons/FilterIcon.d.ts +2 -1
- package/icons/FilterIcon.d.ts.map +1 -1
- package/icons/FlashDisabledIcon.d.ts +2 -1
- package/icons/FlashDisabledIcon.d.ts.map +1 -1
- package/icons/FlashEnabledIcon.d.ts +2 -1
- package/icons/FlashEnabledIcon.d.ts.map +1 -1
- package/icons/GridIcon.d.ts +2 -1
- package/icons/GridIcon.d.ts.map +1 -1
- package/icons/HeartIcon.d.ts +2 -1
- package/icons/HeartIcon.d.ts.map +1 -1
- package/icons/HeartOutlineIcon.d.ts +2 -1
- package/icons/HeartOutlineIcon.d.ts.map +1 -1
- package/icons/HeartPlusIcon.d.ts +2 -1
- package/icons/HeartPlusIcon.d.ts.map +1 -1
- package/icons/HeartPlusOutlineIcon.d.ts +2 -1
- package/icons/HeartPlusOutlineIcon.d.ts.map +1 -1
- package/icons/HomeIcon.d.ts +2 -1
- package/icons/HomeIcon.d.ts.map +1 -1
- package/icons/InfoIcon.d.ts +2 -1
- package/icons/InfoIcon.d.ts.map +1 -1
- package/icons/InfoOutlineIcon.d.ts +2 -1
- package/icons/InfoOutlineIcon.d.ts.map +1 -1
- package/icons/ListIcon.d.ts +2 -1
- package/icons/ListIcon.d.ts.map +1 -1
- package/icons/LocalShippingIcon.d.ts +2 -1
- package/icons/LocalShippingIcon.d.ts.map +1 -1
- package/icons/LocationIcon.d.ts +2 -1
- package/icons/LocationIcon.d.ts.map +1 -1
- package/icons/LocatorIcon.d.ts +2 -1
- package/icons/LocatorIcon.d.ts.map +1 -1
- package/icons/LockIcon.d.ts +2 -1
- package/icons/LockIcon.d.ts.map +1 -1
- package/icons/LogoutIcon.d.ts +2 -1
- package/icons/LogoutIcon.d.ts.map +1 -1
- package/icons/MagnifierIcon.d.ts +2 -1
- package/icons/MagnifierIcon.d.ts.map +1 -1
- package/icons/MapMarkerIcon.d.ts +2 -1
- package/icons/MapMarkerIcon.d.ts.map +1 -1
- package/icons/MoreIcon.d.ts +2 -1
- package/icons/MoreIcon.d.ts.map +1 -1
- package/icons/MoreVertIcon.d.ts +2 -1
- package/icons/MoreVertIcon.d.ts.map +1 -1
- package/icons/NotificationIcon.d.ts +2 -1
- package/icons/NotificationIcon.d.ts.map +1 -1
- package/icons/PersonIcon.d.ts +2 -1
- package/icons/PersonIcon.d.ts.map +1 -1
- package/icons/PhoneIcon.d.ts +2 -1
- package/icons/PhoneIcon.d.ts.map +1 -1
- package/icons/PlaceholderIcon.d.ts +2 -1
- package/icons/PlaceholderIcon.d.ts.map +1 -1
- package/icons/RadioCheckedIcon.d.ts +2 -1
- package/icons/RadioCheckedIcon.d.ts.map +1 -1
- package/icons/RadioUncheckedIcon.d.ts +2 -1
- package/icons/RadioUncheckedIcon.d.ts.map +1 -1
- package/icons/SecurityIcon.d.ts +2 -1
- package/icons/SecurityIcon.d.ts.map +1 -1
- package/icons/ShippingMethodIcon.d.ts +2 -1
- package/icons/ShippingMethodIcon.d.ts.map +1 -1
- package/icons/ShoppingCartIcon.d.ts +2 -1
- package/icons/ShoppingCartIcon.d.ts.map +1 -1
- package/icons/SortIcon.d.ts +2 -1
- package/icons/SortIcon.d.ts.map +1 -1
- package/icons/StarHalfIcon.d.ts +2 -1
- package/icons/StarHalfIcon.d.ts.map +1 -1
- package/icons/StarIcon.d.ts +2 -1
- package/icons/StarIcon.d.ts.map +1 -1
- package/icons/StarOutlineIcon.d.ts +2 -1
- package/icons/StarOutlineIcon.d.ts.map +1 -1
- package/icons/StopIcon.d.ts +2 -1
- package/icons/StopIcon.d.ts.map +1 -1
- package/icons/TickIcon.d.ts +2 -1
- package/icons/TickIcon.d.ts.map +1 -1
- package/icons/TimeIcon.d.ts +2 -1
- package/icons/TimeIcon.d.ts.map +1 -1
- package/icons/TrashIcon.d.ts +1 -1
- package/icons/TrashIcon.d.ts.map +1 -1
- package/icons/TrashOutlineIcon.d.ts +2 -1
- package/icons/TrashOutlineIcon.d.ts.map +1 -1
- package/icons/UncheckedIcon.d.ts +2 -1
- package/icons/UncheckedIcon.d.ts.map +1 -1
- package/icons/ViewListIcon.d.ts +2 -1
- package/icons/ViewListIcon.d.ts.map +1 -1
- package/icons/VisibilityIcon.d.ts +2 -1
- package/icons/VisibilityIcon.d.ts.map +1 -1
- package/icons/VisibilityOffIcon.d.ts +2 -1
- package/icons/VisibilityOffIcon.d.ts.map +1 -1
- package/icons/WarningIcon.d.ts +2 -1
- package/icons/WarningIcon.d.ts.map +1 -1
- package/package.json +5 -5
package/ActionButton/index.js
CHANGED
|
@@ -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
|
*/
|
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
|
},
|
|
@@ -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: -
|
|
59
|
-
marginLeft: -
|
|
60
|
+
marginTop: -32 / 2,
|
|
61
|
+
marginLeft: -32 / 2
|
|
60
62
|
},
|
|
61
63
|
buttonReady: {
|
|
62
|
-
background:
|
|
63
|
-
color:
|
|
64
|
+
background: theme.components.ctaButton.background,
|
|
65
|
+
color: theme.contrastColor(theme.components.ctaButton.background)
|
|
64
66
|
},
|
|
65
67
|
buttonSuccess: {
|
|
66
|
-
background:
|
|
67
|
-
color:
|
|
68
|
+
background: theme.contrastColor(theme.components.ctaButton.background),
|
|
69
|
+
color: theme.components.ctaButton.background
|
|
68
70
|
},
|
|
69
71
|
buttonDisabled: {
|
|
70
|
-
background:
|
|
71
|
-
color:
|
|
72
|
-
boxShadow:
|
|
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:
|
|
222
|
+
color: theme.contrastColor(theme.components.ctaButton.background),
|
|
220
223
|
strokeWidth: 5,
|
|
221
224
|
paused: !isLoading
|
|
222
225
|
})
|
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/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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
*/
|
package/ButtonLink/index.js
CHANGED
|
@@ -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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
-
*
|
|
21
|
-
* @param {Object} props The component
|
|
6
|
+
* @deprecated Use `import { Card } from '@shopgate/engage/components'` instead.
|
|
7
|
+
* @param {Object} props The component props.
|
|
22
8
|
* @returns {JSX}
|
|
23
9
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
40
|
-
className: '',
|
|
41
|
-
id: null
|
|
42
|
-
};
|
|
43
|
-
export default Card;
|
|
19
|
+
export default DeprecatedCard;
|
|
@@ -1,43 +1,48 @@
|
|
|
1
|
-
import 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()(
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
17
|
-
* @
|
|
18
|
-
* @return {JSX}
|
|
19
|
+
* The ListItem component.
|
|
20
|
+
* @returns {JSX}
|
|
19
21
|
*/
|
|
20
|
-
const
|
|
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(
|
|
33
|
-
className: cx(classes.
|
|
34
|
-
|
|
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
|
-
|
|
39
|
-
children: null,
|
|
42
|
+
ListItem.defaultProps = {
|
|
40
43
|
className: null,
|
|
41
|
-
|
|
44
|
+
children: null,
|
|
45
|
+
isSelected: false,
|
|
46
|
+
role: null
|
|
42
47
|
};
|
|
43
|
-
export default
|
|
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:
|
|
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;
|
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
|
|
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',
|