@shopgate/pwa-ui-shared 7.31.4-beta.1 → 7.32.0-beta.2
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 +4 -5
- package/Sheet/components/Header/components/SearchBar/index.js +6 -7
- package/Sheet/components/Header/index.js +18 -15
- package/Sheet/components/Header/spec.js +3 -1
- package/Sheet/index.js +6 -7
- 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/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/DiscountBadge/index.js
CHANGED
|
@@ -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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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(
|
|
55
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
56
|
+
variant: "caption",
|
|
57
|
+
align: "center",
|
|
58
|
+
fontWeight: "bold",
|
|
58
59
|
className: cx(displayClass, className, 'theme__discount-badge'),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
"aria-hidden": true,
|
|
61
|
+
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
62
|
+
string: text,
|
|
63
|
+
params: [discount]
|
|
64
|
+
})
|
|
62
65
|
})
|
|
63
66
|
});
|
|
64
67
|
};
|
package/DiscountBadge/spec.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
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 =
|
|
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 =
|
|
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/
|
|
3
|
+
import { getLoadWishlistOnAppStartEnabled, getWishlistItemQuantityEnabled } from '@shopgate/engage/settings/selectors/shopSettings';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Creates the mapStateToProps connector function.
|
package/FavoritesButton/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useRef, useMemo, memo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import appConfig
|
|
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
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
/**
|
package/Form/Checkbox/index.js
CHANGED
package/Form/InfoField/spec.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
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 =
|
|
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
|
});
|
package/Form/Password/index.js
CHANGED
|
@@ -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:
|
|
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:
|
|
27
|
+
color: theme.palette.primary.main
|
|
30
28
|
}
|
|
31
29
|
}));
|
|
32
30
|
|
package/Form/Select/index.js
CHANGED
|
@@ -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:
|
|
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:
|
|
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).
|
package/Form/Select/spec.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
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 =
|
|
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:
|
|
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:
|
|
27
|
-
fontWeight:
|
|
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(
|
|
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 {
|
|
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 =
|
|
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
|
});
|
package/Form/TextField/index.js
CHANGED
|
@@ -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:
|
|
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()(
|
|
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(
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
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 ${
|
|
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
|
|
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 :
|
|
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:
|
|
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 {
|
|
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 =
|
|
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
|
});
|
package/IndicatorCircle/index.js
CHANGED
|
@@ -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(--
|
|
91
|
+
color: 'var(--sg-palette-secondary-main)',
|
|
93
92
|
paused: false,
|
|
94
|
-
size:
|
|
95
|
-
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:
|
|
18
|
-
color:
|
|
17
|
+
fontSize: theme.components.icon.medium,
|
|
18
|
+
color: theme.palette.secondary.main
|
|
19
19
|
},
|
|
20
20
|
imgContainer: {
|
|
21
21
|
display: 'flex',
|
package/Manufacturer/index.js
CHANGED
|
@@ -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:
|
|
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:
|
|
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.
|