@shopgate/pwa-ui-shared 7.30.3 → 7.31.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ActionButton/index.js +66 -67
- package/AddToCartButton/index.js +217 -185
- 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/AddToCartButton/style.js +0 -148
- 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/FormElement/index.js
CHANGED
|
@@ -1,97 +1,74 @@
|
|
|
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
|
-
import
|
|
3
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
6
4
|
import Label from "./components/Label";
|
|
7
5
|
import Underline from "./components/Underline";
|
|
8
6
|
import ErrorText from "./components/ErrorText";
|
|
9
7
|
import Placeholder from "./components/Placeholder";
|
|
10
|
-
import
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const useStyles = makeStyles()(theme => ({
|
|
10
|
+
formElement: {
|
|
11
|
+
position: 'relative',
|
|
12
|
+
paddingBottom: theme.spacing(2),
|
|
13
|
+
width: '100%'
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* A component that provides a styled form element in material design.
|
|
19
|
+
* @param {Object} props Props.
|
|
20
|
+
* @returns {JSX.Element}
|
|
14
21
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
66
|
-
return _createClass(FormElement, [{
|
|
67
|
-
key: "isLabelFloating",
|
|
68
|
-
get:
|
|
69
|
-
/**
|
|
70
|
-
* @returns {boolean} Whether the label is currently floating.
|
|
71
|
-
*/
|
|
72
|
-
function () {
|
|
73
|
-
return !this.props.labelStatic && (this.props.isFocused || this.props.hasValue);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @returns {boolean} Whether the hint text is currently visible.
|
|
78
|
-
*/
|
|
79
|
-
}, {
|
|
80
|
-
key: "isPlaceholderVisible",
|
|
81
|
-
get: function () {
|
|
82
|
-
return !this.props.isFocused && !this.props.hasValue;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @returns {boolean} Whether the hint text is currently visible.
|
|
87
|
-
*/
|
|
88
|
-
}, {
|
|
89
|
-
key: "hasErrorMessage",
|
|
90
|
-
get: function () {
|
|
91
|
-
return !!this.props.errorText;
|
|
92
|
-
}
|
|
93
|
-
}]);
|
|
94
|
-
}(Component);
|
|
22
|
+
const FormElement = ({
|
|
23
|
+
children,
|
|
24
|
+
className,
|
|
25
|
+
disabled,
|
|
26
|
+
errorText,
|
|
27
|
+
hasLeftElement,
|
|
28
|
+
hasPlaceholder,
|
|
29
|
+
hasUnderline,
|
|
30
|
+
hasValue,
|
|
31
|
+
htmlFor,
|
|
32
|
+
isFocused,
|
|
33
|
+
label,
|
|
34
|
+
labelStatic,
|
|
35
|
+
placeholder,
|
|
36
|
+
showErrorText,
|
|
37
|
+
translateErrorText
|
|
38
|
+
}) => {
|
|
39
|
+
const {
|
|
40
|
+
classes,
|
|
41
|
+
cx
|
|
42
|
+
} = useStyles();
|
|
43
|
+
const isLabelFloating = !labelStatic && (isFocused || hasValue);
|
|
44
|
+
const isPlaceholderVisible = !isFocused && !hasValue;
|
|
45
|
+
const hasErrorMessage = !!errorText;
|
|
46
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
47
|
+
className: cx(classes.formElement, className, 'formElement', 'ui-shared__form-element', {
|
|
48
|
+
disabled
|
|
49
|
+
}),
|
|
50
|
+
children: [hasPlaceholder && (placeholder || label) && /*#__PURE__*/_jsx(Placeholder, {
|
|
51
|
+
visible: isPlaceholderVisible,
|
|
52
|
+
placeholder: placeholder || label,
|
|
53
|
+
hasLeftElement: hasLeftElement,
|
|
54
|
+
"aria-hidden": true
|
|
55
|
+
}), label && /*#__PURE__*/_jsx(Label, {
|
|
56
|
+
htmlFor: htmlFor,
|
|
57
|
+
label: label,
|
|
58
|
+
labelStatic: labelStatic,
|
|
59
|
+
isFocused: isFocused,
|
|
60
|
+
isFloating: isLabelFloating,
|
|
61
|
+
hasErrorMessage: hasErrorMessage
|
|
62
|
+
}), children, hasUnderline && /*#__PURE__*/_jsx(Underline, {
|
|
63
|
+
isFocused: isFocused,
|
|
64
|
+
hasErrorMessage: hasErrorMessage
|
|
65
|
+
}), errorText && showErrorText && /*#__PURE__*/_jsx(ErrorText, {
|
|
66
|
+
errorText: errorText,
|
|
67
|
+
translate: translateErrorText,
|
|
68
|
+
elementName: htmlFor
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
};
|
|
95
72
|
FormElement.defaultProps = {
|
|
96
73
|
children: null,
|
|
97
74
|
className: '',
|
package/Glow/index.js
CHANGED
|
@@ -1,95 +1,85 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { Component } from 'react';
|
|
1
|
+
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
3
|
import { withForwardedRef } from '@shopgate/engage/core';
|
|
4
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
6
5
|
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
7
|
-
import
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const useStyles = makeStyles()({
|
|
8
|
+
container: {
|
|
9
|
+
position: 'relative'
|
|
10
|
+
},
|
|
11
|
+
glow: {
|
|
12
|
+
position: 'absolute',
|
|
13
|
+
left: 0,
|
|
14
|
+
top: 0,
|
|
15
|
+
width: '100%',
|
|
16
|
+
height: '100%',
|
|
17
|
+
background: 'transparent',
|
|
18
|
+
transition: 'background 100ms cubic-bezier(0.25, 0.1, 0.25, 1)',
|
|
19
|
+
zIndex: 0
|
|
20
|
+
}
|
|
21
|
+
});
|
|
8
22
|
|
|
9
23
|
/**
|
|
10
24
|
* Renders a glowing component that is visible when the user interacts with the element.
|
|
25
|
+
* @param {Object} props Props.
|
|
26
|
+
* @returns {JSX.Element}
|
|
11
27
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
_this.timeout = null;
|
|
35
|
-
_this.state = {
|
|
36
|
-
hover: false
|
|
37
|
-
};
|
|
38
|
-
return _this;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Clears any previously set timeout.
|
|
43
|
-
*/
|
|
44
|
-
_inheritsLoose(Glow, _Component);
|
|
45
|
-
var _proto = Glow.prototype;
|
|
46
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
47
|
-
clearTimeout(this.timeout);
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Renders the component.
|
|
51
|
-
* @returns {JSX.Element}
|
|
52
|
-
*/
|
|
53
|
-
_proto.render = function render() {
|
|
54
|
-
const {
|
|
55
|
-
children,
|
|
56
|
-
styles: propStyles,
|
|
57
|
-
forwardedRef,
|
|
58
|
-
className,
|
|
59
|
-
color,
|
|
60
|
-
...rest
|
|
61
|
-
} = this.props;
|
|
62
|
-
let innerInlineStyles;
|
|
63
|
-
if (this.state.hover) {
|
|
64
|
-
innerInlineStyles = {
|
|
65
|
-
...propStyles.glow,
|
|
66
|
-
...propStyles.hover,
|
|
67
|
-
background: color
|
|
68
|
-
};
|
|
69
|
-
} else {
|
|
70
|
-
innerInlineStyles = {
|
|
71
|
-
...propStyles.glow
|
|
72
|
-
};
|
|
28
|
+
const Glow = ({
|
|
29
|
+
children,
|
|
30
|
+
className,
|
|
31
|
+
color,
|
|
32
|
+
disabled,
|
|
33
|
+
forwardedRef,
|
|
34
|
+
styles: propStyles = {
|
|
35
|
+
container: null,
|
|
36
|
+
glow: null,
|
|
37
|
+
hover: null
|
|
38
|
+
},
|
|
39
|
+
...rest
|
|
40
|
+
}) => {
|
|
41
|
+
const {
|
|
42
|
+
classes,
|
|
43
|
+
cx
|
|
44
|
+
} = useStyles();
|
|
45
|
+
const [hover, setHover] = useState(false);
|
|
46
|
+
const timeoutRef = useRef(null);
|
|
47
|
+
useEffect(() => () => {
|
|
48
|
+
if (timeoutRef.current) {
|
|
49
|
+
clearTimeout(timeoutRef.current);
|
|
73
50
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/* eslint-enable jsx-a11y/no-static-element-interactions,
|
|
89
|
-
jsx-a11y/click-events-have-key-events */
|
|
51
|
+
}, []);
|
|
52
|
+
const handleTouchTap = useCallback(() => {
|
|
53
|
+
if (disabled) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
setHover(true);
|
|
57
|
+
timeoutRef.current = setTimeout(() => setHover(false), 250);
|
|
58
|
+
}, [disabled]);
|
|
59
|
+
const innerInlineStyles = hover ? {
|
|
60
|
+
...propStyles.glow,
|
|
61
|
+
...propStyles.hover,
|
|
62
|
+
background: color
|
|
63
|
+
} : {
|
|
64
|
+
...propStyles.glow
|
|
90
65
|
};
|
|
91
|
-
|
|
92
|
-
|
|
66
|
+
|
|
67
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions,
|
|
68
|
+
jsx-a11y/click-events-have-key-events */
|
|
69
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
70
|
+
...rest,
|
|
71
|
+
className: cx(classes.container, className, 'ui-shared__glow'),
|
|
72
|
+
onClick: handleTouchTap,
|
|
73
|
+
style: propStyles.container,
|
|
74
|
+
ref: forwardedRef,
|
|
75
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
76
|
+
className: classes.glow,
|
|
77
|
+
style: innerInlineStyles
|
|
78
|
+
}), children]
|
|
79
|
+
});
|
|
80
|
+
/* eslint-enable jsx-a11y/no-static-element-interactions,
|
|
81
|
+
jsx-a11y/click-events-have-key-events */
|
|
82
|
+
};
|
|
93
83
|
Glow.defaultProps = {
|
|
94
84
|
color: themeConfig.colors.shade8,
|
|
95
85
|
className: null,
|
package/IndicatorCircle/index.js
CHANGED
|
@@ -1,7 +1,54 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
4
|
-
import
|
|
4
|
+
import { makeStyles, keyframes } from '@shopgate/engage/styles';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const rotate = keyframes({
|
|
7
|
+
'100%': {
|
|
8
|
+
transform: 'rotate(360deg)'
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const dash = keyframes({
|
|
12
|
+
'0%': {
|
|
13
|
+
strokeDasharray: '1, 200',
|
|
14
|
+
strokeDashoffset: '0'
|
|
15
|
+
},
|
|
16
|
+
'50%': {
|
|
17
|
+
strokeDasharray: '89, 200',
|
|
18
|
+
strokeDashoffset: '-35px'
|
|
19
|
+
},
|
|
20
|
+
'100%': {
|
|
21
|
+
strokeDasharray: '89, 200',
|
|
22
|
+
strokeDashoffset: '-124px'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const useStyles = makeStyles()((_theme, {
|
|
26
|
+
paused,
|
|
27
|
+
color,
|
|
28
|
+
strokeWidth
|
|
29
|
+
}) => ({
|
|
30
|
+
spinner: {
|
|
31
|
+
margin: 'auto',
|
|
32
|
+
transformOrigin: 'center center',
|
|
33
|
+
maxWidth: '100%',
|
|
34
|
+
maxHeight: '100%',
|
|
35
|
+
...(!paused ? {
|
|
36
|
+
animation: `${rotate} 1.6s linear infinite`
|
|
37
|
+
} : {})
|
|
38
|
+
},
|
|
39
|
+
circle: {
|
|
40
|
+
fill: 'none',
|
|
41
|
+
stroke: color,
|
|
42
|
+
strokeDasharray: '1, 200',
|
|
43
|
+
strokeDashoffset: 0,
|
|
44
|
+
strokeLinecap: 'round',
|
|
45
|
+
strokeMiterlimit: 10,
|
|
46
|
+
strokeWidth,
|
|
47
|
+
...(!paused ? {
|
|
48
|
+
animation: `${dash} 1.2s ease-in-out infinite`
|
|
49
|
+
} : {})
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
5
52
|
|
|
6
53
|
/**
|
|
7
54
|
* The circle indicator component.
|
|
@@ -12,28 +59,37 @@ import styles from "./style";
|
|
|
12
59
|
* @param {boolean} props.paused Animation should be paused.
|
|
13
60
|
* @returns {JSX}
|
|
14
61
|
*/
|
|
15
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
62
|
const IndicatorCircle = ({
|
|
17
63
|
size,
|
|
18
64
|
color,
|
|
19
65
|
strokeWidth,
|
|
20
66
|
paused
|
|
21
|
-
}) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
67
|
+
}) => {
|
|
68
|
+
const {
|
|
69
|
+
classes,
|
|
70
|
+
cx
|
|
71
|
+
} = useStyles({
|
|
72
|
+
paused,
|
|
73
|
+
color,
|
|
74
|
+
strokeWidth
|
|
75
|
+
});
|
|
76
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
77
|
+
className: cx(classes.spinner, 'ui-shared__indicator-circle'),
|
|
78
|
+
viewBox: "25 25 50 50",
|
|
79
|
+
width: size,
|
|
80
|
+
height: size,
|
|
81
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
82
|
+
"data-test-id": "loadingIndicator",
|
|
83
|
+
children: /*#__PURE__*/_jsx("circle", {
|
|
84
|
+
className: classes.circle,
|
|
85
|
+
cx: "50",
|
|
86
|
+
cy: "50",
|
|
87
|
+
r: "20"
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
};
|
|
35
91
|
IndicatorCircle.defaultProps = {
|
|
36
|
-
color:
|
|
92
|
+
color: 'var(--color-secondary)',
|
|
37
93
|
paused: false,
|
|
38
94
|
size: themeConfig.variables.loadingIndicator.size,
|
|
39
95
|
strokeWidth: themeConfig.variables.loadingIndicator.strokeWidth
|
package/IndicatorCircle/spec.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { shallow, mount } from 'enzyme';
|
|
3
3
|
import IndicatorCircle from "./index";
|
|
4
|
-
import styles from "./style";
|
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
5
|
describe('<IndicatorCircle />', () => {
|
|
7
6
|
it('should apply the given size', () => {
|
|
@@ -20,10 +19,8 @@ describe('<IndicatorCircle />', () => {
|
|
|
20
19
|
strokeWidth: 4
|
|
21
20
|
}));
|
|
22
21
|
expect(wrapper).toMatchSnapshot();
|
|
23
|
-
const correctCssClass = styles.circle('#fff', 4, false);
|
|
24
|
-
const wrongCssClass = styles.circle('#000', 0);
|
|
25
22
|
const circleHtml = wrapper.find('circle');
|
|
26
|
-
expect(circleHtml.html()
|
|
27
|
-
expect(circleHtml.html()
|
|
23
|
+
expect(circleHtml.html()).toMatch(/class="[^"]*"/);
|
|
24
|
+
expect(circleHtml.html()).not.toEqual('');
|
|
28
25
|
});
|
|
29
26
|
});
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
3
|
import { themeConfig } from '@shopgate/engage';
|
|
4
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
5
5
|
import IndicatorCircle from "../IndicatorCircle";
|
|
6
|
-
import { container, imgContainer } from "./style";
|
|
7
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
7
|
const {
|
|
9
8
|
loadingIndicator: {
|
|
10
9
|
imgSrc: loadingImageSrc
|
|
11
10
|
} = {}
|
|
12
11
|
} = themeConfig.variables;
|
|
12
|
+
const useStyles = makeStyles()(() => ({
|
|
13
|
+
container: {
|
|
14
|
+
display: 'block',
|
|
15
|
+
padding: '1em',
|
|
16
|
+
textAlign: 'center',
|
|
17
|
+
fontSize: '1.5em',
|
|
18
|
+
color: 'var(--color-secondary)'
|
|
19
|
+
},
|
|
20
|
+
imgContainer: {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
'& img': {
|
|
24
|
+
maxWidth: '50vw',
|
|
25
|
+
maxHeight: '50vh'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
13
29
|
|
|
14
30
|
/**
|
|
15
31
|
* Renders a loading indicator.
|
|
@@ -17,16 +33,22 @@ const {
|
|
|
17
33
|
*/
|
|
18
34
|
const LoadingIndicator = ({
|
|
19
35
|
className
|
|
20
|
-
}) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})
|
|
36
|
+
}) => {
|
|
37
|
+
const {
|
|
38
|
+
classes,
|
|
39
|
+
cx
|
|
40
|
+
} = useStyles();
|
|
41
|
+
return /*#__PURE__*/_jsx("div", {
|
|
42
|
+
className: cx(className, {
|
|
43
|
+
[classes.container]: !loadingImageSrc,
|
|
44
|
+
[classes.imgContainer]: !!loadingImageSrc
|
|
45
|
+
}, 'loading-indicator', 'ui-shared__loading-indicator'),
|
|
46
|
+
children: loadingImageSrc ? /*#__PURE__*/_jsx("img", {
|
|
47
|
+
src: loadingImageSrc,
|
|
48
|
+
alt: ""
|
|
49
|
+
}) : /*#__PURE__*/_jsx(IndicatorCircle, {})
|
|
50
|
+
});
|
|
51
|
+
};
|
|
30
52
|
LoadingIndicator.defaultProps = {
|
|
31
53
|
className: null
|
|
32
54
|
};
|
package/Manufacturer/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const useStyles = makeStyles()(() => ({
|
|
6
|
+
root: {
|
|
7
|
+
color: 'var(--color-primary)'
|
|
8
|
+
}
|
|
9
|
+
}));
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
12
|
* The manufacturer component.
|
|
@@ -9,18 +15,23 @@ import styles from "./style";
|
|
|
9
15
|
* @param {string} [props.className] CSS classes.
|
|
10
16
|
* @return {JSX}
|
|
11
17
|
*/
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
18
|
const Manufacturer = ({
|
|
14
19
|
className,
|
|
15
20
|
text
|
|
16
|
-
}) =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
}) => {
|
|
22
|
+
const {
|
|
23
|
+
classes,
|
|
24
|
+
cx
|
|
25
|
+
} = useStyles();
|
|
26
|
+
return /*#__PURE__*/_jsx("div", {
|
|
27
|
+
className: cx(classes.root, className, 'ui-shared__manufacturer'),
|
|
28
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
29
|
+
dangerouslySetInnerHTML: {
|
|
30
|
+
__html: text
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
};
|
|
24
35
|
Manufacturer.defaultProps = {
|
|
25
36
|
className: ''
|
|
26
37
|
};
|
package/MessageBar/index.js
CHANGED
|
@@ -1,45 +1,19 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { i18n } from '@shopgate/engage/core';
|
|
5
|
-
import styles from "./style";
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { logger } from '@shopgate/engage/core/helpers';
|
|
3
|
+
import { MessageBar } from '@shopgate/engage/components';
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
|
-
*
|
|
6
|
+
* @deprecated Use `import { MessageBar } from '@shopgate/engage/components'` instead.
|
|
9
7
|
* @param {Object} props The component props.
|
|
10
|
-
* @param {Array} props.messages The message content.
|
|
11
|
-
* @param {Object} props.classNames Styling.
|
|
12
8
|
* @returns {JSX}
|
|
13
|
-
* @deprecated Please import from `@shopgate/engage/components` instead.
|
|
14
9
|
*/
|
|
15
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const {
|
|
24
|
-
type = 'info',
|
|
25
|
-
message,
|
|
26
|
-
messageParams = null,
|
|
27
|
-
translated
|
|
28
|
-
} = item;
|
|
29
|
-
const messageOutput = !translated ? i18n.text(message, messageParams) : message;
|
|
30
|
-
return /*#__PURE__*/_jsx("div", {
|
|
31
|
-
className: classnames(classNames.message, styles[type]),
|
|
32
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
33
|
-
"aria-hidden": true,
|
|
34
|
-
children: messageOutput
|
|
35
|
-
})
|
|
36
|
-
}, `${type}-${message}`);
|
|
37
|
-
})
|
|
38
|
-
}));
|
|
39
|
-
MessageBar.defaultProps = {
|
|
40
|
-
classNames: {
|
|
41
|
-
container: null,
|
|
42
|
-
message: null
|
|
43
|
-
}
|
|
11
|
+
const DeprecatedMessageBar = props => {
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
logger.warn('===== MessageBar deprecated =====\n' + 'The MessageBar component ' + '(@shopgate/pwa-ui-shared/MessageBar) is deprecated.\n' + 'Please use: import { MessageBar } from \'@shopgate/engage/components\'.\n' + '===================================');
|
|
14
|
+
}, []);
|
|
15
|
+
return /*#__PURE__*/_jsx(MessageBar, {
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
44
18
|
};
|
|
45
|
-
export default
|
|
19
|
+
export default DeprecatedMessageBar;
|