@shopgate/pwa-ui-shared 7.30.4-beta.1 → 7.31.0-alpha.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/index.js +66 -67
- package/AddToCartButton/index.js +217 -185
- package/AddToCartButton/style.js +8 -0
- package/Availability/index.js +24 -6
- package/Button/index.js +105 -82
- package/Button/spec.js +3 -4
- package/Card/index.js +26 -7
- package/CardList/components/Item/index.js +15 -3
- package/CartTotalLine/components/Amount/index.js +13 -4
- package/CartTotalLine/components/Hint/index.js +13 -4
- package/CartTotalLine/components/Label/index.js +23 -10
- package/CartTotalLine/index.js +41 -7
- package/Checkbox/index.js +41 -17
- package/Chip/index.js +82 -7
- package/ContextMenu/components/Item/index.js +38 -20
- package/ContextMenu/components/Position/index.js +38 -56
- package/ContextMenu/index.js +64 -28
- package/Dialog/components/BasicDialog/index.js +1 -0
- package/Dialog/components/HtmlContentDialog/spec.js +39 -0
- package/Dialog/components/PipelineErrorDialog/index.js +108 -157
- package/Dialog/components/PipelineErrorDialog/spec.js +12 -18
- package/Dialog/components/TextMessageDialog/index.js +1 -1
- package/Dialog/components/VariantSelectModal/index.js +1 -1
- package/Dialog/index.js +1 -1
- package/DiscountBadge/index.js +48 -15
- package/FavoritesButton/index.js +95 -100
- package/FavoritesButton/spec.js +5 -2
- package/Form/Builder/classes/ActionListener/index.js +1 -0
- package/Form/Checkbox/index.js +64 -56
- package/Form/InfoField/index.js +18 -6
- package/Form/Password/index.js +39 -52
- package/Form/RadioGroup/components/Item/index.js +72 -56
- package/Form/RadioGroup/index.js +79 -90
- package/Form/Select/index.js +108 -130
- package/Form/SelectContextChoices/index.js +30 -8
- package/Form/TextField/index.js +106 -82
- package/Form/TextField/spec.js +4 -3
- package/FormElement/components/ErrorText/index.js +32 -14
- package/FormElement/components/Label/index.js +56 -6
- package/FormElement/components/Placeholder/index.js +44 -11
- package/FormElement/components/Underline/index.js +63 -12
- package/FormElement/index.js +62 -85
- package/Glow/index.js +73 -83
- package/IndicatorCircle/index.js +73 -17
- package/IndicatorCircle/spec.js +2 -5
- package/LoadingIndicator/index.js +34 -12
- package/Manufacturer/index.js +21 -10
- package/MessageBar/index.js +12 -38
- package/NoResults/components/Icon/index.js +30 -14
- package/NoResults/index.js +35 -7
- package/Placeholder/index.js +34 -23
- package/PlaceholderLabel/index.js +17 -3
- package/Price/index.js +34 -21
- package/PriceInfo/index.js +23 -9
- package/PriceStriked/index.js +67 -77
- package/ProgressBar/index.js +112 -77
- package/RadioButton/index.js +29 -11
- package/RatingStars/index.js +122 -137
- package/Ripple/components/RippleAnimation/index.js +13 -3
- package/Ripple/index.js +158 -212
- package/RippleButton/index.js +63 -60
- package/RippleButton/spec.js +15 -9
- package/ScannerOverlay/components/CameraOverlay/index.js +54 -10
- package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +53 -27
- package/ScannerOverlay/components/ScannerBar/index.js +50 -26
- package/Sheet/components/Header/components/SearchBar/index.js +54 -10
- package/Sheet/components/Header/index.js +96 -76
- package/Sheet/index.js +295 -157
- package/Sheet/spec.js +8 -6
- package/TaxDisclaimer/index.js +17 -4
- package/TaxDisclaimer/spec.js +16 -5
- package/TextField/components/ErrorText/index.js +35 -14
- package/TextField/components/FormElement/index.js +29 -4
- package/TextField/components/Hint/index.js +39 -10
- package/TextField/components/Label/index.js +43 -6
- package/TextField/components/Underline/index.js +64 -13
- package/TextField/index.js +157 -171
- package/TextField/spec.js +5 -3
- package/icons/AccountBoxIcon.d.ts +7 -0
- package/icons/AccountBoxIcon.d.ts.map +1 -0
- package/icons/AccountBoxIcon.js +1 -4
- package/icons/AddMoreIcon.d.ts +7 -0
- package/icons/AddMoreIcon.d.ts.map +1 -0
- package/icons/AddMoreIcon.js +0 -3
- package/icons/ArrowDropIcon.d.ts +7 -0
- package/icons/ArrowDropIcon.d.ts.map +1 -0
- package/icons/ArrowDropIcon.js +0 -3
- package/icons/ArrowIcon.d.ts +10 -0
- package/icons/ArrowIcon.d.ts.map +1 -0
- package/icons/ArrowIcon.js +2 -11
- package/icons/BarcodeScannerIcon.d.ts +7 -0
- package/icons/BarcodeScannerIcon.d.ts.map +1 -0
- package/icons/BarcodeScannerIcon.js +0 -3
- package/icons/BoxIcon.d.ts +7 -0
- package/icons/BoxIcon.d.ts.map +1 -0
- package/icons/BoxIcon.js +0 -3
- package/icons/BrowseIcon.d.ts +7 -0
- package/icons/BrowseIcon.d.ts.map +1 -0
- package/icons/BrowseIcon.js +1 -3
- package/icons/BurgerIcon.d.ts +7 -0
- package/icons/BurgerIcon.d.ts.map +1 -0
- package/icons/BurgerIcon.js +0 -3
- package/icons/CalendarIcon.d.ts +7 -0
- package/icons/CalendarIcon.d.ts.map +1 -0
- package/icons/CalendarIcon.js +0 -2
- package/icons/CartCouponIcon.d.ts +7 -0
- package/icons/CartCouponIcon.d.ts.map +1 -0
- package/icons/CartCouponIcon.js +0 -2
- package/icons/CartIcon.d.ts +7 -0
- package/icons/CartIcon.d.ts.map +1 -0
- package/icons/CartIcon.js +0 -2
- package/icons/CartPlusIcon.d.ts +7 -0
- package/icons/CartPlusIcon.d.ts.map +1 -0
- package/icons/CartPlusIcon.js +0 -2
- package/icons/CheckIcon.d.ts +7 -0
- package/icons/CheckIcon.d.ts.map +1 -0
- package/icons/CheckIcon.js +0 -2
- package/icons/CheckedIcon.d.ts +7 -0
- package/icons/CheckedIcon.d.ts.map +1 -0
- package/icons/CheckedIcon.js +0 -3
- package/icons/ChevronIcon.d.ts +7 -0
- package/icons/ChevronIcon.d.ts.map +1 -0
- package/icons/ChevronIcon.js +0 -2
- package/icons/CreditCardIcon.d.ts +7 -0
- package/icons/CreditCardIcon.d.ts.map +1 -0
- package/icons/CreditCardIcon.js +0 -2
- package/icons/CrossIcon.d.ts +7 -0
- package/icons/CrossIcon.d.ts.map +1 -0
- package/icons/CrossIcon.js +0 -2
- package/icons/DescriptionIcon.d.ts +7 -0
- package/icons/DescriptionIcon.d.ts.map +1 -0
- package/icons/DescriptionIcon.js +0 -2
- package/icons/FilterIcon.d.ts +7 -0
- package/icons/FilterIcon.d.ts.map +1 -0
- package/icons/FilterIcon.js +0 -2
- package/icons/FlashDisabledIcon.d.ts +7 -0
- package/icons/FlashDisabledIcon.d.ts.map +1 -0
- package/icons/FlashDisabledIcon.js +0 -2
- package/icons/FlashEnabledIcon.d.ts +7 -0
- package/icons/FlashEnabledIcon.d.ts.map +1 -0
- package/icons/FlashEnabledIcon.js +0 -2
- package/icons/GridIcon.d.ts +7 -0
- package/icons/GridIcon.d.ts.map +1 -0
- package/icons/GridIcon.js +1 -3
- package/icons/HeartIcon.d.ts +7 -0
- package/icons/HeartIcon.d.ts.map +1 -0
- package/icons/HeartIcon.js +0 -2
- package/icons/HeartOutlineIcon.d.ts +7 -0
- package/icons/HeartOutlineIcon.d.ts.map +1 -0
- package/icons/HeartOutlineIcon.js +1 -3
- package/icons/HeartPlusIcon.d.ts +7 -0
- package/icons/HeartPlusIcon.d.ts.map +1 -0
- package/icons/HeartPlusIcon.js +1 -3
- package/icons/HeartPlusOutlineIcon.d.ts +7 -0
- package/icons/HeartPlusOutlineIcon.d.ts.map +1 -0
- package/icons/HeartPlusOutlineIcon.js +1 -3
- package/icons/HomeIcon.d.ts +7 -0
- package/icons/HomeIcon.d.ts.map +1 -0
- package/icons/HomeIcon.js +0 -2
- package/icons/InfoIcon.d.ts +7 -0
- package/icons/InfoIcon.d.ts.map +1 -0
- package/icons/InfoIcon.js +0 -2
- package/icons/InfoOutlineIcon.d.ts +7 -0
- package/icons/InfoOutlineIcon.d.ts.map +1 -0
- package/icons/InfoOutlineIcon.js +0 -2
- package/icons/ListIcon.d.ts +7 -0
- package/icons/ListIcon.d.ts.map +1 -0
- package/icons/ListIcon.js +0 -2
- package/icons/LocalShippingIcon.d.ts +7 -0
- package/icons/LocalShippingIcon.d.ts.map +1 -0
- package/icons/LocalShippingIcon.js +0 -2
- package/icons/LocationIcon.d.ts +7 -0
- package/icons/LocationIcon.d.ts.map +1 -0
- package/icons/LocationIcon.js +1 -4
- package/icons/LocatorIcon.d.ts +7 -0
- package/icons/LocatorIcon.d.ts.map +1 -0
- package/icons/LocatorIcon.js +1 -3
- package/icons/LockIcon.d.ts +9 -0
- package/icons/LockIcon.d.ts.map +1 -0
- package/icons/LockIcon.js +1 -2
- package/icons/LogoutIcon.d.ts +7 -0
- package/icons/LogoutIcon.d.ts.map +1 -0
- package/icons/LogoutIcon.js +0 -2
- package/icons/MagnifierIcon.d.ts +7 -0
- package/icons/MagnifierIcon.d.ts.map +1 -0
- package/icons/MagnifierIcon.js +0 -2
- package/icons/MapMarkerIcon.d.ts +7 -0
- package/icons/MapMarkerIcon.d.ts.map +1 -0
- package/icons/MapMarkerIcon.js +1 -3
- package/icons/MoreIcon.d.ts +7 -0
- package/icons/MoreIcon.d.ts.map +1 -0
- package/icons/MoreIcon.js +1 -3
- package/icons/MoreVertIcon.d.ts +7 -0
- package/icons/MoreVertIcon.d.ts.map +1 -0
- package/icons/MoreVertIcon.js +1 -3
- package/icons/NotificationIcon.d.ts +7 -0
- package/icons/NotificationIcon.d.ts.map +1 -0
- package/icons/NotificationIcon.js +1 -3
- package/icons/PersonIcon.d.ts +9 -0
- package/icons/PersonIcon.d.ts.map +1 -0
- package/icons/PersonIcon.js +0 -3
- package/icons/PhoneIcon.d.ts +7 -0
- package/icons/PhoneIcon.d.ts.map +1 -0
- package/icons/PhoneIcon.js +1 -4
- package/icons/PlaceholderIcon.d.ts +7 -0
- package/icons/PlaceholderIcon.d.ts.map +1 -0
- package/icons/PlaceholderIcon.js +0 -2
- package/icons/RadioCheckedIcon.d.ts +10 -0
- package/icons/RadioCheckedIcon.d.ts.map +1 -0
- package/icons/RadioCheckedIcon.js +0 -2
- package/icons/RadioUncheckedIcon.d.ts +10 -0
- package/icons/RadioUncheckedIcon.d.ts.map +1 -0
- package/icons/RadioUncheckedIcon.js +0 -2
- package/icons/SecurityIcon.d.ts +7 -0
- package/icons/SecurityIcon.d.ts.map +1 -0
- package/icons/SecurityIcon.js +0 -2
- package/icons/ShippingMethodIcon.d.ts +7 -0
- package/icons/ShippingMethodIcon.d.ts.map +1 -0
- package/icons/ShippingMethodIcon.js +0 -2
- package/icons/ShoppingCartIcon.d.ts +7 -0
- package/icons/ShoppingCartIcon.d.ts.map +1 -0
- package/icons/ShoppingCartIcon.js +0 -2
- package/icons/SortIcon.d.ts +7 -0
- package/icons/SortIcon.d.ts.map +1 -0
- package/icons/SortIcon.js +0 -2
- package/icons/StarHalfIcon.d.ts +7 -0
- package/icons/StarHalfIcon.d.ts.map +1 -0
- package/icons/StarHalfIcon.js +0 -9
- package/icons/StarIcon.d.ts +7 -0
- package/icons/StarIcon.d.ts.map +1 -0
- package/icons/StarIcon.js +0 -9
- package/icons/StarOutlineIcon.d.ts +7 -0
- package/icons/StarOutlineIcon.d.ts.map +1 -0
- package/icons/StarOutlineIcon.js +0 -2
- package/icons/StopIcon.d.ts +7 -0
- package/icons/StopIcon.d.ts.map +1 -0
- package/icons/StopIcon.js +0 -2
- package/icons/TickIcon.d.ts +7 -0
- package/icons/TickIcon.d.ts.map +1 -0
- package/icons/TickIcon.js +0 -2
- package/icons/TimeIcon.d.ts +7 -0
- package/icons/TimeIcon.d.ts.map +1 -0
- package/icons/TimeIcon.js +0 -2
- package/icons/TrashIcon.d.ts +7 -0
- package/icons/TrashIcon.d.ts.map +1 -0
- package/icons/TrashIcon.js +0 -3
- package/icons/TrashOutlineIcon.d.ts +8 -0
- package/icons/TrashOutlineIcon.d.ts.map +1 -0
- package/icons/TrashOutlineIcon.js +0 -2
- package/icons/UncheckedIcon.d.ts +7 -0
- package/icons/UncheckedIcon.d.ts.map +1 -0
- package/icons/UncheckedIcon.js +0 -2
- package/icons/ViewListIcon.d.ts +7 -0
- package/icons/ViewListIcon.d.ts.map +1 -0
- package/icons/ViewListIcon.js +0 -2
- package/icons/VisibilityIcon.d.ts +8 -0
- package/icons/VisibilityIcon.d.ts.map +1 -0
- package/icons/VisibilityIcon.js +2 -4
- package/icons/VisibilityOffIcon.d.ts +8 -0
- package/icons/VisibilityOffIcon.d.ts.map +1 -0
- package/icons/VisibilityOffIcon.js +2 -4
- package/icons/WarningIcon.d.ts +7 -0
- package/icons/WarningIcon.d.ts.map +1 -0
- package/icons/WarningIcon.js +1 -3
- package/package.json +5 -5
- package/tsconfig.build.json +16 -0
- package/tsconfig.json +3 -0
- package/ActionButton/style.js +0 -22
- package/Availability/style.js +0 -19
- package/Button/style.js +0 -155
- package/Card/style.js +0 -11
- package/CardList/components/Item/style.js +0 -7
- package/CartTotalLine/components/Amount/style.js +0 -8
- package/CartTotalLine/components/Hint/style.js +0 -12
- package/CartTotalLine/components/Label/style.js +0 -17
- package/CartTotalLine/style.js +0 -31
- package/Checkbox/style.js +0 -18
- package/Chip/style.js +0 -78
- package/ContextMenu/components/Item/style.js +0 -34
- package/ContextMenu/components/Position/style.js +0 -11
- package/ContextMenu/style.js +0 -45
- package/DiscountBadge/style.js +0 -36
- package/FavoritesButton/style.js +0 -26
- package/Form/Checkbox/style.js +0 -25
- package/Form/InfoField/style.js +0 -11
- package/Form/Password/style.js +0 -11
- package/Form/RadioGroup/components/Item/style.js +0 -32
- package/Form/RadioGroup/style.js +0 -20
- package/Form/Select/style.js +0 -27
- package/Form/SelectContextChoices/style.js +0 -23
- package/Form/TextField/style.js +0 -70
- package/FormElement/components/ErrorText/style.js +0 -13
- package/FormElement/components/Label/style.js +0 -89
- package/FormElement/components/Placeholder/style.js +0 -56
- package/FormElement/components/Underline/style.js +0 -60
- package/FormElement/style.js +0 -14
- package/Glow/style.js +0 -18
- package/IndicatorCircle/style.js +0 -65
- package/LoadingIndicator/style.js +0 -20
- package/Manufacturer/style.js +0 -5
- package/MessageBar/spec.js +0 -80
- package/MessageBar/style.js +0 -38
- package/NoResults/components/Icon/style.js +0 -17
- package/NoResults/style.js +0 -31
- package/Placeholder/style.js +0 -11
- package/PlaceholderLabel/style.js +0 -12
- package/Price/style.js +0 -22
- package/PriceInfo/style.js +0 -5
- package/PriceStriked/style.js +0 -36
- package/ProgressBar/style.js +0 -85
- package/RadioButton/style.js +0 -21
- package/RatingStars/style.js +0 -53
- package/Ripple/style.js +0 -18
- package/ScannerOverlay/components/CameraOverlay/style.js +0 -40
- package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/style.js +0 -28
- package/ScannerOverlay/components/ScannerBar/style.js +0 -20
- package/Sheet/components/Header/components/SearchBar/style.js +0 -47
- package/Sheet/components/Header/style.js +0 -50
- package/Sheet/style.js +0 -143
- package/TaxDisclaimer/style.js +0 -9
- package/TextField/components/ErrorText/style.js +0 -27
- package/TextField/components/FormElement/style.js +0 -34
- package/TextField/components/Hint/style.js +0 -46
- package/TextField/components/Label/style.js +0 -80
- package/TextField/components/Underline/style.js +0 -60
- package/TextField/style.js +0 -35
package/Button/index.js
CHANGED
|
@@ -1,94 +1,117 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
3
|
-
import React, { Component } from 'react';
|
|
1
|
+
import React from 'react';
|
|
4
2
|
import PropTypes from 'prop-types';
|
|
5
3
|
import BaseButton from '@shopgate/pwa-common/components/Button';
|
|
6
|
-
import
|
|
4
|
+
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
5
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
7
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const {
|
|
8
|
+
colors
|
|
9
|
+
} = themeConfig;
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* @param {string} text Text color.
|
|
12
|
+
* @param {string|null} background Fill color.
|
|
13
|
+
* @returns {Object} JSS for root button.
|
|
12
14
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const baseButton = (text, background) => ({
|
|
16
|
+
position: 'relative',
|
|
17
|
+
display: 'inline-block',
|
|
18
|
+
outline: 0,
|
|
19
|
+
color: text,
|
|
20
|
+
backgroundColor: background,
|
|
21
|
+
minWidth: 64,
|
|
22
|
+
overflow: 'hidden',
|
|
23
|
+
':disabled': {
|
|
24
|
+
cursor: 'not-allowed'
|
|
25
|
+
},
|
|
26
|
+
...themeConfig.variables.buttonBase
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} textColor Text color.
|
|
31
|
+
* @param {string|null} fillColor Fill color.
|
|
32
|
+
* @param {Object} theme Theme with spacing().
|
|
33
|
+
* @returns {Object} Object with `button` and `content` style maps.
|
|
34
|
+
*/
|
|
35
|
+
const pairFromColors = (textColor, fillColor, theme) => ({
|
|
36
|
+
button: baseButton(textColor, fillColor),
|
|
37
|
+
content: {
|
|
38
|
+
padding: theme.spacing(0, 2, 0),
|
|
39
|
+
color: textColor
|
|
16
40
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}) : this.props.children;
|
|
31
|
-
return /*#__PURE__*/_jsx(BaseButton, {
|
|
32
|
-
...this.buttonProps,
|
|
33
|
-
className: `ui-shared__button ${style.button} ${this.props.className}`,
|
|
34
|
-
testId: this.props.testId,
|
|
35
|
-
children: content
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
return _createClass(Button, [{
|
|
39
|
-
key: "style",
|
|
40
|
-
get:
|
|
41
|
-
/**
|
|
42
|
-
* Getter for style depending on prop type.
|
|
43
|
-
* @returns {Object}
|
|
44
|
-
*/
|
|
45
|
-
function () {
|
|
46
|
-
const {
|
|
47
|
-
flat,
|
|
48
|
-
disabled
|
|
49
|
-
} = this.props;
|
|
50
|
-
switch (this.props.type) {
|
|
51
|
-
case 'plain':
|
|
52
|
-
return styles.plain();
|
|
53
|
-
case 'regular':
|
|
54
|
-
return styles.regular(disabled);
|
|
55
|
-
case 'simple':
|
|
56
|
-
return styles.simple(disabled);
|
|
57
|
-
default:
|
|
58
|
-
case 'primary':
|
|
59
|
-
return styles.primary(disabled, flat);
|
|
60
|
-
case 'secondary':
|
|
61
|
-
return styles.secondary(disabled, flat);
|
|
41
|
+
});
|
|
42
|
+
const useStyles = makeStyles()((theme, {
|
|
43
|
+
type,
|
|
44
|
+
flat,
|
|
45
|
+
disabled
|
|
46
|
+
}) => {
|
|
47
|
+
if (type === 'plain') {
|
|
48
|
+
return {
|
|
49
|
+
button: {
|
|
50
|
+
padding: 0,
|
|
51
|
+
outline: 0,
|
|
52
|
+
border: 0,
|
|
53
|
+
textAlign: 'left'
|
|
62
54
|
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (type === 'simple') {
|
|
58
|
+
return disabled ? pairFromColors(themeConfig.colors.shade4, themeConfig.colors.shade7, theme) : pairFromColors(themeConfig.colors.dark, themeConfig.colors.shade7, theme);
|
|
59
|
+
}
|
|
60
|
+
if (type === 'regular') {
|
|
61
|
+
return disabled ? pairFromColors(colors.shade4, null, theme) : pairFromColors(colors.dark, null, theme);
|
|
62
|
+
}
|
|
63
|
+
if (type === 'secondary') {
|
|
64
|
+
if (!flat) {
|
|
65
|
+
return disabled ? pairFromColors(colors.shade4, colors.shade7, theme) : pairFromColors('var(--color-primary-contrast)', 'var(--color-primary)', theme);
|
|
63
66
|
}
|
|
67
|
+
return disabled ? pairFromColors(colors.shade4, null, theme) : pairFromColors('var(--color-primary)', null, theme);
|
|
68
|
+
}
|
|
69
|
+
if (!flat) {
|
|
70
|
+
return disabled ? pairFromColors(colors.shade4, colors.shade7, theme) : pairFromColors('var(--color-secondary-contrast)', 'var(--color-secondary)', theme);
|
|
71
|
+
}
|
|
72
|
+
return disabled ? pairFromColors(colors.shade4, null, theme) : pairFromColors('var(--color-secondary)', null, theme);
|
|
73
|
+
});
|
|
64
74
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
75
|
+
/**
|
|
76
|
+
* The basic button component.
|
|
77
|
+
* @param {Object} props Props.
|
|
78
|
+
* @returns {JSX.Element}
|
|
79
|
+
*/
|
|
80
|
+
const Button = props => {
|
|
81
|
+
const {
|
|
82
|
+
className,
|
|
83
|
+
flat,
|
|
84
|
+
disabled,
|
|
85
|
+
testId,
|
|
86
|
+
type,
|
|
87
|
+
wrapContent,
|
|
88
|
+
children,
|
|
89
|
+
onClick,
|
|
90
|
+
...rest
|
|
91
|
+
} = props;
|
|
92
|
+
const {
|
|
93
|
+
classes,
|
|
94
|
+
cx
|
|
95
|
+
} = useStyles({
|
|
96
|
+
type,
|
|
97
|
+
flat,
|
|
98
|
+
disabled
|
|
99
|
+
});
|
|
100
|
+
const content = wrapContent ? /*#__PURE__*/_jsx("div", {
|
|
101
|
+
...(classes.content ? {
|
|
102
|
+
className: classes.content
|
|
103
|
+
} : {}),
|
|
104
|
+
children: children
|
|
105
|
+
}) : children;
|
|
106
|
+
return /*#__PURE__*/_jsx(BaseButton, {
|
|
107
|
+
...rest,
|
|
108
|
+
className: cx('ui-shared__button', classes.button, className),
|
|
109
|
+
disabled: disabled,
|
|
110
|
+
onClick: onClick,
|
|
111
|
+
testId: testId,
|
|
112
|
+
children: content
|
|
113
|
+
});
|
|
114
|
+
};
|
|
92
115
|
Button.defaultProps = {
|
|
93
116
|
...BaseButton.defaultProps,
|
|
94
117
|
className: '',
|
package/Button/spec.js
CHANGED
|
@@ -2,7 +2,6 @@ import trim from 'lodash/trim';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { shallow } from 'enzyme';
|
|
4
4
|
import Button from "./index";
|
|
5
|
-
import styles from "./style";
|
|
6
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
6
|
describe('<Button />', () => {
|
|
8
7
|
it('should render as a regular button if type is omitted', () => {
|
|
@@ -18,14 +17,14 @@ describe('<Button />', () => {
|
|
|
18
17
|
children: "Press me"
|
|
19
18
|
}));
|
|
20
19
|
expect(wrapper).toMatchSnapshot();
|
|
21
|
-
expect(trim(wrapper.prop('className'))).
|
|
20
|
+
expect(trim(wrapper.prop('className'))).toMatch(/^ui-shared__button\s+/);
|
|
22
21
|
});
|
|
23
22
|
it('should render as a primary button', () => {
|
|
24
23
|
const wrapper = shallow(/*#__PURE__*/_jsx(Button, {
|
|
25
24
|
type: "primary",
|
|
26
25
|
children: "Press me"
|
|
27
26
|
}));
|
|
28
|
-
expect(trim(wrapper.prop('className'))).
|
|
27
|
+
expect(trim(wrapper.prop('className'))).toMatch(/^ui-shared__button\s+/);
|
|
29
28
|
expect(wrapper).toMatchSnapshot();
|
|
30
29
|
});
|
|
31
30
|
it('should render as a secondary button', () => {
|
|
@@ -33,7 +32,7 @@ describe('<Button />', () => {
|
|
|
33
32
|
type: "secondary",
|
|
34
33
|
children: "Press me"
|
|
35
34
|
}));
|
|
36
|
-
expect(trim(wrapper.prop('className'))).
|
|
35
|
+
expect(trim(wrapper.prop('className'))).toMatch(/^ui-shared__button\s+/);
|
|
37
36
|
expect(wrapper).toMatchSnapshot();
|
|
38
37
|
});
|
|
39
38
|
});
|
package/Card/index.js
CHANGED
|
@@ -1,22 +1,41 @@
|
|
|
1
|
+
import "core-js/modules/es.array.includes.js";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
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
|
+
});
|
|
4
18
|
|
|
5
19
|
/**
|
|
6
20
|
* Renders the card component.
|
|
7
21
|
* @param {Object} props The component properties.
|
|
8
22
|
* @returns {JSX}
|
|
9
23
|
*/
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
24
|
const Card = ({
|
|
12
25
|
className,
|
|
13
26
|
children,
|
|
14
27
|
id
|
|
15
|
-
}) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
28
|
+
}) => {
|
|
29
|
+
const {
|
|
30
|
+
classes,
|
|
31
|
+
cx
|
|
32
|
+
} = useStyles();
|
|
33
|
+
return /*#__PURE__*/_jsx("div", {
|
|
34
|
+
className: cx('ui-shared__card', classes.root, className),
|
|
35
|
+
id: id,
|
|
36
|
+
children: children
|
|
37
|
+
});
|
|
38
|
+
};
|
|
20
39
|
Card.defaultProps = {
|
|
21
40
|
className: '',
|
|
22
41
|
id: null
|
|
@@ -1,24 +1,36 @@
|
|
|
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
|
|
4
|
+
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
5
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const useStyles = makeStyles()(theme => ({
|
|
8
|
+
root: {
|
|
9
|
+
background: themeConfig.colors.light,
|
|
10
|
+
marginBottom: theme.spacing(0.5),
|
|
11
|
+
position: 'relative'
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
5
14
|
|
|
6
15
|
/**
|
|
7
16
|
* The Card List Item component implemented as class so that ref prop is available.
|
|
8
17
|
* @param {Object} props The component props.
|
|
9
18
|
* @return {JSX}
|
|
10
19
|
*/
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
20
|
const Item = ({
|
|
13
21
|
children,
|
|
14
22
|
className,
|
|
15
23
|
isSelected
|
|
16
24
|
}) => {
|
|
25
|
+
const {
|
|
26
|
+
classes,
|
|
27
|
+
cx
|
|
28
|
+
} = useStyles();
|
|
17
29
|
if (!Children.count(children)) {
|
|
18
30
|
return null;
|
|
19
31
|
}
|
|
20
32
|
return /*#__PURE__*/_jsx(ListItem, {
|
|
21
|
-
className:
|
|
33
|
+
className: cx(classes.root, className),
|
|
22
34
|
isSelected: isSelected,
|
|
23
35
|
children: children
|
|
24
36
|
});
|
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import I18n from '@shopgate/
|
|
4
|
-
import
|
|
3
|
+
import { I18n } from '@shopgate/engage/components';
|
|
4
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
const useStyles = makeStyles()({
|
|
7
|
+
amount: {
|
|
8
|
+
textAlign: 'right',
|
|
9
|
+
order: 4
|
|
10
|
+
}
|
|
11
|
+
});
|
|
5
12
|
|
|
6
13
|
/**
|
|
7
14
|
* The Amount component.
|
|
8
15
|
* @param {Object} props The component props.
|
|
9
16
|
* @return {JSX}
|
|
10
17
|
*/
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
18
|
const Amount = ({
|
|
13
19
|
amount,
|
|
14
20
|
currency
|
|
15
21
|
}) => {
|
|
22
|
+
const {
|
|
23
|
+
classes
|
|
24
|
+
} = useStyles();
|
|
16
25
|
if (amount === null) {
|
|
17
26
|
return null;
|
|
18
27
|
}
|
|
19
28
|
return /*#__PURE__*/_jsxs("div", {
|
|
20
|
-
className:
|
|
29
|
+
className: classes.amount,
|
|
21
30
|
children: [typeof amount === 'string' && /*#__PURE__*/_jsx(I18n.Text, {
|
|
22
31
|
string: amount
|
|
23
32
|
}), typeof amount === 'number' && /*#__PURE__*/_jsx(I18n.Price, {
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import I18n from '@shopgate/
|
|
4
|
-
import
|
|
3
|
+
import { I18n } from '@shopgate/engage/components';
|
|
4
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const useStyles = makeStyles()(theme => ({
|
|
7
|
+
hint: {
|
|
8
|
+
paddingLeft: theme.spacing(1),
|
|
9
|
+
order: 5
|
|
10
|
+
}
|
|
11
|
+
}));
|
|
5
12
|
|
|
6
13
|
/**
|
|
7
14
|
* The Hint component.
|
|
8
15
|
* @param {Object} props The component props.
|
|
9
16
|
* @return {JSX|null}
|
|
10
17
|
*/
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
18
|
const Hint = ({
|
|
13
19
|
hint
|
|
14
20
|
}) => {
|
|
21
|
+
const {
|
|
22
|
+
classes
|
|
23
|
+
} = useStyles();
|
|
15
24
|
if (hint === null) {
|
|
16
25
|
return null;
|
|
17
26
|
}
|
|
18
27
|
return /*#__PURE__*/_jsx("div", {
|
|
19
|
-
className:
|
|
28
|
+
className: classes.hint,
|
|
20
29
|
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
21
30
|
string: hint
|
|
22
31
|
})
|
|
@@ -1,37 +1,50 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
3
|
import { I18n } from '@shopgate/engage/components';
|
|
5
|
-
import
|
|
4
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
const useStyles = makeStyles()(theme => ({
|
|
7
|
+
label: {
|
|
8
|
+
flexGrow: 1,
|
|
9
|
+
paddingRight: theme.spacing(1),
|
|
10
|
+
order: 3
|
|
11
|
+
},
|
|
12
|
+
labelWithSuffix: {
|
|
13
|
+
paddingRight: theme.spacing(1)
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
6
16
|
|
|
7
17
|
/**
|
|
8
18
|
* The ShippingCostsLabel component.
|
|
9
19
|
* @param {Object} props The component props.
|
|
10
20
|
* @return {JSX|null}
|
|
11
21
|
*/
|
|
12
|
-
|
|
13
|
-
function Label({
|
|
22
|
+
const Label = ({
|
|
14
23
|
label,
|
|
15
24
|
showSeparator,
|
|
16
25
|
labelParams,
|
|
17
26
|
suffix
|
|
18
|
-
}) {
|
|
27
|
+
}) => {
|
|
28
|
+
const {
|
|
29
|
+
classes,
|
|
30
|
+
cx
|
|
31
|
+
} = useStyles();
|
|
19
32
|
if (!label) {
|
|
20
33
|
return /*#__PURE__*/_jsx("div", {
|
|
21
|
-
className:
|
|
34
|
+
className: classes.label
|
|
22
35
|
});
|
|
23
36
|
}
|
|
24
37
|
return /*#__PURE__*/_jsxs("div", {
|
|
25
|
-
className:
|
|
38
|
+
className: classes.label,
|
|
26
39
|
children: [/*#__PURE__*/_jsx(I18n.Text, {
|
|
27
40
|
string: label,
|
|
28
41
|
params: labelParams,
|
|
29
|
-
className:
|
|
30
|
-
[
|
|
42
|
+
className: cx({
|
|
43
|
+
[classes.labelWithSuffix]: !!suffix
|
|
31
44
|
})
|
|
32
45
|
}), suffix, `${showSeparator ? ':' : ''}`]
|
|
33
46
|
});
|
|
34
|
-
}
|
|
47
|
+
};
|
|
35
48
|
Label.defaultProps = {
|
|
36
49
|
label: null,
|
|
37
50
|
suffix: null,
|
package/CartTotalLine/index.js
CHANGED
|
@@ -1,30 +1,64 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
4
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
5
|
import Label from "./components/Label";
|
|
5
6
|
import Amount from "./components/Amount";
|
|
6
7
|
import Hint from "./components/Hint";
|
|
7
8
|
import Spacer from "./components/Spacer";
|
|
8
|
-
import
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const {
|
|
11
|
+
colors
|
|
12
|
+
} = themeConfig;
|
|
13
|
+
const useStyles = makeStyles()({
|
|
14
|
+
line: {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
justifyContent: 'space-between',
|
|
17
|
+
fontSize: '0.875rem',
|
|
18
|
+
alignItems: 'baseline'
|
|
19
|
+
},
|
|
20
|
+
disabled: {
|
|
21
|
+
color: `${colors.shade4} !important`
|
|
22
|
+
},
|
|
23
|
+
base: {
|
|
24
|
+
color: colors.shade9
|
|
25
|
+
},
|
|
26
|
+
subTotal: {
|
|
27
|
+
color: `${colors.dark}`
|
|
28
|
+
},
|
|
29
|
+
grandTotal: {
|
|
30
|
+
color: `${colors.dark}`,
|
|
31
|
+
fontSize: '1rem !important'
|
|
32
|
+
}
|
|
33
|
+
});
|
|
9
34
|
|
|
10
35
|
/**
|
|
11
36
|
* @returns {JSX}
|
|
12
37
|
*/
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
38
|
const CartTotalLine = ({
|
|
15
39
|
children,
|
|
16
40
|
type,
|
|
17
41
|
isDisabled,
|
|
18
42
|
className
|
|
19
43
|
}) => {
|
|
44
|
+
const {
|
|
45
|
+
classes,
|
|
46
|
+
cx
|
|
47
|
+
} = useStyles();
|
|
20
48
|
if (!children) {
|
|
21
49
|
return null;
|
|
22
50
|
}
|
|
51
|
+
let typeClass = classes.base;
|
|
52
|
+
if (type === 'subTotal') {
|
|
53
|
+
typeClass = classes.subTotal;
|
|
54
|
+
} else if (type === 'grandTotal') {
|
|
55
|
+
typeClass = classes.grandTotal;
|
|
56
|
+
}
|
|
23
57
|
return /*#__PURE__*/_jsx("div", {
|
|
24
|
-
className:
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
}),
|
|
58
|
+
className: cx(`ui-shared__cart-total-line ui-shared__cart-${type}-line`, classes.line, {
|
|
59
|
+
[classes.disabled]: isDisabled,
|
|
60
|
+
[typeClass]: true
|
|
61
|
+
}, className),
|
|
28
62
|
"data-test-id": `${type}CartTotal`,
|
|
29
63
|
children: children
|
|
30
64
|
});
|
package/Checkbox/index.js
CHANGED
|
@@ -1,38 +1,62 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
|
+
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
4
5
|
import BaseCheckbox from '@shopgate/pwa-common/components/Checkbox';
|
|
5
6
|
import CheckedIcon from "../icons/CheckedIcon";
|
|
6
7
|
import UncheckedIcon from "../icons/UncheckedIcon";
|
|
7
|
-
import
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const useStyles = makeStyles()(() => ({
|
|
10
|
+
icon: {
|
|
11
|
+
width: 24,
|
|
12
|
+
height: 24,
|
|
13
|
+
flexShrink: 0
|
|
14
|
+
},
|
|
15
|
+
checkedIcon: {
|
|
16
|
+
color: 'var(--color-secondary)'
|
|
17
|
+
},
|
|
18
|
+
uncheckedIcon: {
|
|
19
|
+
color: themeConfig.colors.shade6
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
8
22
|
|
|
9
23
|
/**
|
|
10
24
|
* The checkbox template component.
|
|
11
25
|
* @param {Object} props The component props
|
|
12
26
|
* @param {string} props.className Class for the underlying Checkbox component
|
|
13
|
-
* @param {string} props.checkedClassName
|
|
14
|
-
* @param {string} props.unCheckedClassName
|
|
27
|
+
* @param {string} [props.checkedClassName] Extra class for checked icon; default: secondary color.
|
|
28
|
+
* @param {string} [props.unCheckedClassName] Extra class for unchecked icon; default: shade6.
|
|
15
29
|
* @returns {JSX.Element}
|
|
16
30
|
*/
|
|
17
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
31
|
const Checkbox = ({
|
|
19
32
|
checkedClassName,
|
|
20
33
|
unCheckedClassName,
|
|
21
34
|
className,
|
|
22
35
|
...props
|
|
23
|
-
}) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
}) => {
|
|
37
|
+
const {
|
|
38
|
+
classes,
|
|
39
|
+
cx
|
|
40
|
+
} = useStyles();
|
|
41
|
+
|
|
42
|
+
// Legacy default: theme classes for checked/unchecked unless props are passed.
|
|
43
|
+
// `??` keeps an explicit '' from restoring defaults (like old cx(icon, '', …)).
|
|
44
|
+
const checkedCls = checkedClassName ?? classes.checkedIcon;
|
|
45
|
+
const uncheckedCls = unCheckedClassName ?? classes.uncheckedIcon;
|
|
46
|
+
return /*#__PURE__*/_jsx(BaseCheckbox, {
|
|
47
|
+
...props,
|
|
48
|
+
className: cx('ui-shared__checkbox', className),
|
|
49
|
+
checkedIcon: /*#__PURE__*/_jsx(CheckedIcon, {
|
|
50
|
+
className: cx(classes.icon, checkedCls, 'checkedIcon')
|
|
51
|
+
}),
|
|
52
|
+
uncheckedIcon: /*#__PURE__*/_jsx(UncheckedIcon, {
|
|
53
|
+
className: cx(classes.icon, uncheckedCls, 'uncheckedIcon')
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
};
|
|
33
57
|
Checkbox.defaultProps = {
|
|
34
|
-
checkedClassName: styles.checkedIcon,
|
|
35
58
|
className: '',
|
|
36
|
-
|
|
59
|
+
checkedClassName: undefined,
|
|
60
|
+
unCheckedClassName: undefined
|
|
37
61
|
};
|
|
38
62
|
export default Checkbox;
|