@shopgate/pwa-ui-shared 7.30.0-alpha.8 → 7.30.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AccordionContainer/index.js +17 -11
- package/AccordionContainer/spec.js +12 -3
- package/ActionButton/index.js +51 -32
- package/ActionButton/spec.js +13 -5
- package/AddToCartButton/index.js +44 -33
- package/AddToCartButton/mock.js +20 -8
- package/AddToCartButton/spec.js +29 -14
- package/Availability/index.js +5 -3
- package/Availability/spec.js +6 -5
- package/Button/index.js +73 -58
- package/Button/spec.js +16 -10
- package/ButtonLink/index.js +20 -12
- package/ButtonLink/spec.js +5 -3
- package/Card/index.js +5 -3
- package/CardList/components/Item/index.js +5 -3
- package/CardList/index.js +21 -12
- package/CartTotalLine/components/Amount/index.js +10 -8
- package/CartTotalLine/components/Hint/index.js +7 -5
- package/CartTotalLine/components/Label/index.js +12 -10
- package/CartTotalLine/components/Spacer/index.js +5 -3
- package/CartTotalLine/index.js +5 -3
- package/Checkbox/index.js +6 -5
- package/Chip/index.js +28 -22
- package/Chip/spec.js +9 -6
- package/ContextMenu/ContextMenuProvider.js +5 -3
- package/ContextMenu/components/Item/index.js +14 -11
- package/ContextMenu/components/Position/index.js +20 -12
- package/ContextMenu/index.js +54 -44
- package/ContextMenu/spec.js +31 -20
- package/Dialog/components/HtmlContentDialog/index.js +9 -7
- package/Dialog/components/HtmlContentDialog/spec.js +9 -6
- package/Dialog/components/PipelineErrorDialog/index.js +106 -47
- package/Dialog/components/PipelineErrorDialog/spec.js +5 -4
- package/Dialog/components/TextMessageDialog/index.js +9 -7
- package/Dialog/components/TextMessageDialog/spec.js +9 -6
- package/Dialog/components/VariantSelectModal/index.js +7 -5
- package/Dialog/components/VariantSelectModal/spec.js +6 -3
- package/Dialog/index.js +12 -8
- package/Dialog/spec.js +7 -6
- package/DiscountBadge/index.js +10 -8
- package/DiscountBadge/spec.js +3 -2
- package/FavoritesButton/index.js +40 -31
- package/FavoritesButton/spec.js +7 -3
- package/Form/Builder/classes/ActionListener/index.js +400 -401
- package/Form/Builder/components/CheckboxElement.js +13 -5
- package/Form/Builder/components/CountryElement.js +13 -5
- package/Form/Builder/components/ProvinceElement.js +13 -5
- package/Form/Builder/components/RadioElement.js +19 -11
- package/Form/Builder/components/SelectElement.js +26 -16
- package/Form/Builder/components/TextElement.js +13 -5
- package/Form/Builder/index.js +70 -60
- package/Form/Builder/spec.js +27 -18
- package/Form/Checkbox/index.js +31 -21
- package/Form/InfoField/index.js +19 -12
- package/Form/InfoField/spec.js +4 -1
- package/Form/Password/index.js +22 -15
- package/Form/Password/spec.js +10 -5
- package/Form/RadioGroup/components/Item/index.js +34 -25
- package/Form/RadioGroup/index.js +37 -28
- package/Form/RadioGroup/spec.js +45 -31
- package/Form/Select/index.js +52 -43
- package/Form/Select/spec.js +5 -2
- package/Form/SelectContextChoices/index.js +26 -22
- package/Form/SelectContextChoices/spec.js +4 -1
- package/Form/TextField/index.js +40 -27
- package/Form/TextField/spec.js +34 -21
- package/Form/index.js +23 -15
- package/FormElement/components/ErrorText/index.js +7 -5
- package/FormElement/components/Label/index.js +6 -4
- package/FormElement/components/Placeholder/index.js +7 -5
- package/FormElement/components/Underline/index.js +8 -6
- package/FormElement/index.js +62 -46
- package/FormElement/spec.js +10 -9
- package/Glow/index.js +30 -22
- package/Glow/spec.js +6 -1
- package/IndicatorCircle/index.js +10 -8
- package/IndicatorCircle/spec.js +3 -2
- package/LoadingIndicator/index.js +8 -6
- package/Manufacturer/index.js +9 -7
- package/MessageBar/index.js +20 -17
- package/MessageBar/spec.js +6 -5
- package/NoResults/components/Icon/index.js +134 -110
- package/NoResults/index.js +27 -21
- package/Placeholder/index.js +13 -5
- package/PlaceholderLabel/index.js +2 -1
- package/PlaceholderLabel/spec.js +13 -6
- package/PlaceholderParagraph/index.js +13 -12
- package/PlaceholderParagraph/spec.js +13 -6
- package/Price/index.js +46 -28
- package/PriceInfo/index.js +2 -1
- package/PriceStriked/index.js +41 -29
- package/ProductProperties/index.js +13 -10
- package/ProgressBar/index.js +28 -19
- package/ProgressBar/spec.js +2 -1
- package/RadioButton/index.js +6 -5
- package/RadioButton/spec.js +3 -2
- package/RatingNumber/index.js +2 -1
- package/RatingStars/index.js +50 -34
- package/RatingStars/spec.js +7 -6
- package/Ripple/components/RippleAnimation/index.js +48 -52
- package/Ripple/index.js +72 -62
- package/RippleButton/index.js +44 -27
- package/RippleButton/spec.js +20 -13
- package/ScannerOverlay/components/CameraOverlay/index.js +8 -5
- package/ScannerOverlay/components/CameraOverlay/style.js +0 -1
- package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +25 -21
- package/ScannerOverlay/components/ScannerBar/components/ScannerInstructions/index.js +7 -5
- package/ScannerOverlay/components/ScannerBar/index.js +17 -12
- package/ScannerOverlay/index.js +24 -15
- package/Sheet/components/Header/components/SearchBar/index.js +35 -28
- package/Sheet/components/Header/components/SearchBar/spec.js +2 -1
- package/Sheet/components/Header/index.js +47 -34
- package/Sheet/components/Header/spec.js +2 -1
- package/Sheet/index.js +80 -65
- package/Sheet/spec.js +27 -14
- package/TaxDisclaimer/index.js +13 -10
- package/TaxDisclaimer/spec.js +3 -2
- package/TextField/components/ErrorText/index.js +7 -5
- package/TextField/components/FormElement/index.js +4 -3
- package/TextField/components/Hint/index.js +7 -5
- package/TextField/components/Label/index.js +6 -4
- package/TextField/components/Underline/index.js +8 -6
- package/TextField/index.js +102 -85
- package/TextField/spec.js +37 -23
- package/ToggleIcon/index.js +23 -15
- package/ToggleIcon/spec.js +12 -8
- package/icons/AccountBoxIcon.js +5 -4
- package/icons/AddMoreIcon.js +5 -4
- package/icons/ArrowDropIcon.js +5 -4
- package/icons/ArrowIcon.js +5 -4
- package/icons/BarcodeScannerIcon.js +5 -4
- package/icons/BoxIcon.js +5 -4
- package/icons/BrowseIcon.js +5 -4
- package/icons/BurgerIcon.js +5 -4
- package/icons/CalendarIcon.js +5 -5
- package/icons/CartCouponIcon.js +5 -4
- package/icons/CartIcon.js +5 -4
- package/icons/CartPlusIcon.js +5 -4
- package/icons/CheckIcon.js +5 -4
- package/icons/CheckedIcon.js +5 -4
- package/icons/ChevronIcon.js +5 -4
- package/icons/CreditCardIcon.js +5 -4
- package/icons/CrossIcon.js +5 -4
- package/icons/DescriptionIcon.js +5 -4
- package/icons/FilterIcon.js +5 -4
- package/icons/FlashDisabledIcon.js +5 -4
- package/icons/FlashEnabledIcon.js +5 -4
- package/icons/GridIcon.js +5 -4
- package/icons/HeartIcon.js +5 -4
- package/icons/HeartOutlineIcon.js +5 -4
- package/icons/HeartPlusIcon.js +5 -4
- package/icons/HeartPlusOutlineIcon.js +5 -4
- package/icons/HomeIcon.js +5 -4
- package/icons/InfoIcon.js +5 -4
- package/icons/InfoOutlineIcon.js +5 -4
- package/icons/ListIcon.js +5 -4
- package/icons/LocalShippingIcon.js +5 -4
- package/icons/LocationIcon.js +5 -4
- package/icons/LocatorIcon.js +5 -4
- package/icons/LockIcon.js +5 -4
- package/icons/LogoutIcon.js +5 -4
- package/icons/MagnifierIcon.js +5 -4
- package/icons/MapMarkerIcon.js +5 -4
- package/icons/MoreIcon.js +5 -4
- package/icons/MoreVertIcon.js +5 -4
- package/icons/NotificationIcon.js +5 -4
- package/icons/PersonIcon.js +5 -4
- package/icons/PhoneIcon.js +5 -4
- package/icons/PlaceholderIcon.js +5 -4
- package/icons/RadioCheckedIcon.js +5 -4
- package/icons/RadioUncheckedIcon.js +5 -4
- package/icons/SecurityIcon.js +5 -4
- package/icons/ShippingMethodIcon.js +5 -4
- package/icons/ShoppingCartIcon.js +5 -4
- package/icons/SortIcon.js +5 -4
- package/icons/StarHalfIcon.js +5 -4
- package/icons/StarIcon.js +5 -4
- package/icons/StarOutlineIcon.js +5 -4
- package/icons/StopIcon.js +5 -4
- package/icons/TickIcon.js +5 -4
- package/icons/TimeIcon.js +5 -4
- package/icons/TrashIcon.js +5 -4
- package/icons/TrashOutlineIcon.js +5 -4
- package/icons/UncheckedIcon.js +5 -4
- package/icons/ViewListIcon.js +5 -4
- package/icons/VisibilityIcon.js +5 -4
- package/icons/VisibilityOffIcon.js +5 -4
- package/icons/WarningIcon.js +5 -4
- package/package.json +7 -8
package/Form/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
1
2
|
import React, { PureComponent } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
|
|
@@ -5,53 +6,60 @@ import PropTypes from 'prop-types';
|
|
|
5
6
|
* Form component that handles keyboard submit, next buttons, ...
|
|
6
7
|
* @deprecated Use `@shopgate/engage/components/Form` instead.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
let Form = /*#__PURE__*/function (_PureComponent) {
|
|
9
11
|
/**
|
|
10
12
|
* Initializes the form component.
|
|
11
13
|
* @param {Object} props The components props.
|
|
12
14
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
function Form(props) {
|
|
16
|
+
var _this;
|
|
17
|
+
_this = _PureComponent.call(this, props) || this;
|
|
15
18
|
/**
|
|
16
19
|
* Handles the form submit.
|
|
17
20
|
* @param {Object} event The event that caused the submit.
|
|
18
21
|
*/
|
|
19
|
-
|
|
22
|
+
_this.handleSubmit = event => {
|
|
20
23
|
event.preventDefault();
|
|
21
|
-
const inputFocused = [
|
|
24
|
+
const inputFocused = [].concat(_this.formElement.current.querySelectorAll('input')).some(input => document.activeElement === input);
|
|
22
25
|
if (inputFocused) {
|
|
23
26
|
document.activeElement.blur();
|
|
24
27
|
}
|
|
25
|
-
|
|
28
|
+
_this.props.onSubmit();
|
|
26
29
|
};
|
|
27
30
|
/**
|
|
28
31
|
* Handles form submits by key.
|
|
29
32
|
* @param {Object} event The event that caused the keypress.
|
|
30
33
|
*/
|
|
31
|
-
|
|
34
|
+
_this.handleKeyPress = event => {
|
|
32
35
|
// Enter key and on iOS also the "Done" button.
|
|
33
36
|
if (event.which === 13) {
|
|
34
|
-
|
|
37
|
+
_this.handleSubmit(event);
|
|
35
38
|
}
|
|
36
39
|
};
|
|
37
|
-
|
|
40
|
+
_this.formElement = /*#__PURE__*/React.createRef();
|
|
41
|
+
return _this;
|
|
38
42
|
}
|
|
43
|
+
_inheritsLoose(Form, _PureComponent);
|
|
44
|
+
var _proto = Form.prototype;
|
|
39
45
|
/**
|
|
40
46
|
* Renders the component.
|
|
41
47
|
* @returns {JSX}
|
|
42
48
|
*/
|
|
43
|
-
render() {
|
|
49
|
+
_proto.render = function render() {
|
|
44
50
|
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
45
|
-
return /*#__PURE__*/
|
|
51
|
+
return /*#__PURE__*/_jsx("form", {
|
|
46
52
|
action: "#",
|
|
47
53
|
onSubmit: this.handleSubmit,
|
|
48
54
|
onKeyPress: this.handleKeyPress,
|
|
49
55
|
ref: this.formElement,
|
|
50
|
-
className: "ui-shared__form"
|
|
51
|
-
|
|
56
|
+
className: "ui-shared__form",
|
|
57
|
+
children: this.props.children
|
|
58
|
+
});
|
|
52
59
|
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
|
|
53
|
-
}
|
|
54
|
-
|
|
60
|
+
};
|
|
61
|
+
return Form;
|
|
62
|
+
}(PureComponent);
|
|
55
63
|
Form.defaultProps = {
|
|
56
64
|
onSubmit: () => {}
|
|
57
65
|
};
|
|
@@ -9,21 +9,23 @@ import styles from "./style";
|
|
|
9
9
|
* @param {Object} props The component props.
|
|
10
10
|
* @returns {JSX.Element}
|
|
11
11
|
*/
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
13
|
const ErrorText = ({
|
|
13
14
|
className,
|
|
14
15
|
errorText,
|
|
15
16
|
translate,
|
|
16
17
|
elementName,
|
|
17
18
|
ariaHidden
|
|
18
|
-
}) => /*#__PURE__*/
|
|
19
|
+
}) => /*#__PURE__*/_jsxs("div", {
|
|
19
20
|
id: `ariaError-${elementName}`,
|
|
20
21
|
className: classNames(className, styles, 'errorText'),
|
|
21
22
|
"aria-live": "assertive",
|
|
22
23
|
"aria-atomic": "true",
|
|
23
|
-
"aria-hidden": ariaHidden
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}), !translate && errorText
|
|
24
|
+
"aria-hidden": ariaHidden,
|
|
25
|
+
children: [translate && /*#__PURE__*/_jsx(I18n.Text, {
|
|
26
|
+
string: errorText
|
|
27
|
+
}), !translate && errorText]
|
|
28
|
+
});
|
|
27
29
|
ErrorText.defaultProps = {
|
|
28
30
|
className: null,
|
|
29
31
|
errorText: null,
|
|
@@ -9,6 +9,7 @@ import styles from "./style";
|
|
|
9
9
|
* @param {Object} props The component props.
|
|
10
10
|
* @return {JSX}
|
|
11
11
|
*/
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
const Label = ({
|
|
13
14
|
hasErrorMessage,
|
|
14
15
|
htmlFor,
|
|
@@ -18,14 +19,15 @@ const Label = ({
|
|
|
18
19
|
labelStatic
|
|
19
20
|
}) => {
|
|
20
21
|
const labelStyles = styles.labelStyles(isFocused, isFloating, hasErrorMessage, labelStatic);
|
|
21
|
-
return /*#__PURE__*/ /* eslint-disable-next-line jsx-a11y/label-has-associated-control */
|
|
22
|
+
return /*#__PURE__*/ /* eslint-disable-next-line jsx-a11y/label-has-associated-control */_jsx("label", {
|
|
22
23
|
htmlFor: htmlFor,
|
|
23
24
|
className: classNames(labelStyles, 'label', {
|
|
24
25
|
floating: isFloating
|
|
26
|
+
}),
|
|
27
|
+
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
28
|
+
string: label
|
|
25
29
|
})
|
|
26
|
-
}
|
|
27
|
-
string: label
|
|
28
|
-
}));
|
|
30
|
+
});
|
|
29
31
|
};
|
|
30
32
|
Label.defaultProps = {
|
|
31
33
|
htmlFor: '',
|
|
@@ -12,17 +12,19 @@ import styles from "./style";
|
|
|
12
12
|
* @param {boolean} hasLeftElement Whether a left element is present
|
|
13
13
|
* @return {JSX.Element}
|
|
14
14
|
*/
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
const Placeholder = ({
|
|
16
17
|
placeholder,
|
|
17
18
|
visible,
|
|
18
19
|
'aria-hidden': ariaHidden,
|
|
19
20
|
hasLeftElement
|
|
20
|
-
}) => /*#__PURE__*/
|
|
21
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
21
22
|
className: classNames(styles.placeholderStyles(visible, hasLeftElement), 'placeholder'),
|
|
22
|
-
"aria-hidden": ariaHidden
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
23
|
+
"aria-hidden": ariaHidden,
|
|
24
|
+
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
25
|
+
string: placeholder
|
|
26
|
+
})
|
|
27
|
+
});
|
|
26
28
|
Placeholder.defaultProps = {
|
|
27
29
|
'aria-hidden': null,
|
|
28
30
|
hasLeftElement: false,
|
|
@@ -8,12 +8,14 @@ import styles from "./style";
|
|
|
8
8
|
* @param {Object} props The component props.
|
|
9
9
|
* @return {JSX}
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
const Underline = props => /*#__PURE__*/_jsx("div", {
|
|
13
|
+
className: classNames(styles.underlineWrapper, 'underline'),
|
|
14
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
15
|
+
className: styles.underline,
|
|
16
|
+
style: styles.underlineStyle(props.isFocused, props.hasErrorMessage)
|
|
17
|
+
})
|
|
18
|
+
});
|
|
17
19
|
Underline.defaultProps = {
|
|
18
20
|
isFocused: false,
|
|
19
21
|
hasErrorMessage: false
|
package/FormElement/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
1
3
|
import React, { Component } from 'react';
|
|
2
4
|
import PropTypes from 'prop-types';
|
|
3
5
|
import classNames from 'classnames';
|
|
@@ -10,32 +12,17 @@ import style from "./style";
|
|
|
10
12
|
/**
|
|
11
13
|
* A component that provides a styled form element in material design.
|
|
12
14
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
get isLabelFloating() {
|
|
18
|
-
return !this.props.labelStatic && (this.props.isFocused || this.props.hasValue);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @returns {boolean} Whether the hint text is currently visible.
|
|
23
|
-
*/
|
|
24
|
-
get isPlaceholderVisible() {
|
|
25
|
-
return !this.props.isFocused && !this.props.hasValue;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @returns {boolean} Whether the hint text is currently visible.
|
|
30
|
-
*/
|
|
31
|
-
get hasErrorMessage() {
|
|
32
|
-
return !!this.props.errorText;
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
let FormElement = /*#__PURE__*/function (_Component) {
|
|
17
|
+
function FormElement() {
|
|
18
|
+
return _Component.apply(this, arguments) || this;
|
|
33
19
|
}
|
|
34
|
-
|
|
20
|
+
_inheritsLoose(FormElement, _Component);
|
|
21
|
+
var _proto = FormElement.prototype;
|
|
35
22
|
/**
|
|
36
23
|
* @return {JSX.Element}
|
|
37
24
|
*/
|
|
38
|
-
render() {
|
|
25
|
+
_proto.render = function render() {
|
|
39
26
|
const {
|
|
40
27
|
isFocused,
|
|
41
28
|
errorText,
|
|
@@ -50,32 +37,61 @@ class FormElement extends Component {
|
|
|
50
37
|
labelStatic,
|
|
51
38
|
showErrorText
|
|
52
39
|
} = this.props;
|
|
53
|
-
return /*#__PURE__*/
|
|
40
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
54
41
|
className: classNames(style.formElement, className, 'formElement', 'ui-shared__form-element', {
|
|
55
42
|
disabled
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
43
|
+
}),
|
|
44
|
+
children: [hasPlaceholder && (placeholder || label) && /*#__PURE__*/_jsx(Placeholder, {
|
|
45
|
+
visible: this.isPlaceholderVisible,
|
|
46
|
+
placeholder: placeholder || label,
|
|
47
|
+
hasLeftElement: hasLeftElement,
|
|
48
|
+
"aria-hidden": true
|
|
49
|
+
}), label && /*#__PURE__*/_jsx(Label, {
|
|
50
|
+
htmlFor: htmlFor,
|
|
51
|
+
label: label,
|
|
52
|
+
labelStatic: labelStatic,
|
|
53
|
+
isFocused: isFocused,
|
|
54
|
+
isFloating: this.isLabelFloating,
|
|
55
|
+
hasErrorMessage: this.hasErrorMessage
|
|
56
|
+
}), this.props.children, this.props.hasUnderline && /*#__PURE__*/_jsx(Underline, {
|
|
57
|
+
isFocused: isFocused,
|
|
58
|
+
hasErrorMessage: this.hasErrorMessage
|
|
59
|
+
}), errorText && showErrorText && /*#__PURE__*/_jsx(ErrorText, {
|
|
60
|
+
errorText: errorText,
|
|
61
|
+
translate: translateErrorText,
|
|
62
|
+
elementName: htmlFor
|
|
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);
|
|
79
95
|
FormElement.defaultProps = {
|
|
80
96
|
children: null,
|
|
81
97
|
className: '',
|
package/FormElement/spec.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { mount } from 'enzyme';
|
|
4
3
|
import FormElement from "./index";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
const inputProps = {
|
|
6
6
|
htmlFor: 'test-input'
|
|
7
7
|
};
|
|
@@ -13,9 +13,7 @@ describe('<FormElement />', () => {
|
|
|
13
13
|
},
|
|
14
14
|
'should render a form element with 1 child': {
|
|
15
15
|
props: {
|
|
16
|
-
children: [/*#__PURE__*/
|
|
17
|
-
key: "test-key"
|
|
18
|
-
})]
|
|
16
|
+
children: [/*#__PURE__*/_jsx("input", {}, "test-key")]
|
|
19
17
|
}
|
|
20
18
|
},
|
|
21
19
|
'should render a focused form element': {
|
|
@@ -48,7 +46,10 @@ describe('<FormElement />', () => {
|
|
|
48
46
|
Object.keys(tests).forEach(test => {
|
|
49
47
|
it(test, () => {
|
|
50
48
|
const testFixtures = tests[test];
|
|
51
|
-
const wrapper = mount(/*#__PURE__*/
|
|
49
|
+
const wrapper = mount(/*#__PURE__*/_jsx(FormElement, {
|
|
50
|
+
...inputProps,
|
|
51
|
+
...testFixtures.props
|
|
52
|
+
}));
|
|
52
53
|
expect(wrapper).toMatchSnapshot();
|
|
53
54
|
if (testFixtures.find) {
|
|
54
55
|
expect(wrapper.find(testFixtures.find).find('Translate').props().string).toEqual(testFixtures.equal);
|
|
@@ -56,11 +57,11 @@ describe('<FormElement />', () => {
|
|
|
56
57
|
});
|
|
57
58
|
});
|
|
58
59
|
it('Should hide placeholder with hasValue', () => {
|
|
59
|
-
const wrapper = mount(/*#__PURE__*/
|
|
60
|
-
label: "testlabel"
|
|
61
|
-
|
|
60
|
+
const wrapper = mount(/*#__PURE__*/_jsx(FormElement, {
|
|
61
|
+
label: "testlabel",
|
|
62
|
+
...inputProps,
|
|
62
63
|
hasValue: true
|
|
63
|
-
}))
|
|
64
|
+
}));
|
|
64
65
|
expect(wrapper).toMatchSnapshot();
|
|
65
66
|
expect(wrapper.find('Placeholder').props().visible).toEqual(false);
|
|
66
67
|
});
|
package/Glow/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import classNames from 'classnames';
|
|
@@ -9,43 +9,48 @@ import styles from "./style";
|
|
|
9
9
|
/**
|
|
10
10
|
* Renders a glowing component that is visible when the user interacts with the element.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
let Glow = /*#__PURE__*/function (_Component) {
|
|
13
14
|
/**
|
|
14
15
|
* The component constructor.
|
|
15
16
|
* @param {Object} props The component props.
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
function Glow(props) {
|
|
19
|
+
var _this;
|
|
20
|
+
_this = _Component.call(this, props) || this;
|
|
21
|
+
_this.handleTouchTap = () => {
|
|
22
|
+
if (_this.props.disabled) {
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
|
-
|
|
25
|
+
_this.setState({
|
|
24
26
|
hover: true
|
|
25
27
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
_this.timeout = setTimeout(() => {
|
|
29
|
+
_this.setState({
|
|
28
30
|
hover: false
|
|
29
31
|
});
|
|
30
32
|
}, 250);
|
|
31
33
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
_this.timeout = null;
|
|
35
|
+
_this.state = {
|
|
34
36
|
hover: false
|
|
35
37
|
};
|
|
38
|
+
return _this;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
/**
|
|
39
42
|
* Clears any previously set timeout.
|
|
40
43
|
*/
|
|
41
|
-
|
|
44
|
+
_inheritsLoose(Glow, _Component);
|
|
45
|
+
var _proto = Glow.prototype;
|
|
46
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
42
47
|
clearTimeout(this.timeout);
|
|
43
|
-
}
|
|
48
|
+
};
|
|
44
49
|
/**
|
|
45
50
|
* Renders the component.
|
|
46
51
|
* @returns {JSX.Element}
|
|
47
52
|
*/
|
|
48
|
-
render() {
|
|
53
|
+
_proto.render = function render() {
|
|
49
54
|
const {
|
|
50
55
|
children,
|
|
51
56
|
styles: propStyles,
|
|
@@ -69,19 +74,22 @@ class Glow extends Component {
|
|
|
69
74
|
|
|
70
75
|
/* eslint-disable jsx-a11y/no-static-element-interactions,
|
|
71
76
|
jsx-a11y/click-events-have-key-events */
|
|
72
|
-
return /*#__PURE__*/
|
|
77
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
78
|
+
...rest,
|
|
73
79
|
className: classNames(styles.container, className, 'ui-shared__glow'),
|
|
74
80
|
onClick: this.handleTouchTap,
|
|
75
81
|
style: propStyles.container,
|
|
76
|
-
ref: forwardedRef
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
ref: forwardedRef,
|
|
83
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
84
|
+
className: styles.glow,
|
|
85
|
+
style: innerInlineStyles
|
|
86
|
+
}), children]
|
|
87
|
+
});
|
|
81
88
|
/* eslint-enable jsx-a11y/no-static-element-interactions,
|
|
82
89
|
jsx-a11y/click-events-have-key-events */
|
|
83
|
-
}
|
|
84
|
-
|
|
90
|
+
};
|
|
91
|
+
return Glow;
|
|
92
|
+
}(Component);
|
|
85
93
|
Glow.defaultProps = {
|
|
86
94
|
color: themeConfig.colors.shade8,
|
|
87
95
|
className: null,
|
package/Glow/spec.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { mount } from 'enzyme';
|
|
3
3
|
import Glow from "./index";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
5
|
describe('<Glow />', () => {
|
|
5
6
|
it('should render with a smile', () => {
|
|
6
|
-
const wrapper = mount(/*#__PURE__*/
|
|
7
|
+
const wrapper = mount(/*#__PURE__*/_jsx(Glow, {
|
|
8
|
+
children: /*#__PURE__*/_jsx("p", {
|
|
9
|
+
children: "Glowing!"
|
|
10
|
+
})
|
|
11
|
+
}));
|
|
7
12
|
expect(wrapper).toMatchSnapshot();
|
|
8
13
|
});
|
|
9
14
|
});
|
package/IndicatorCircle/index.js
CHANGED
|
@@ -12,24 +12,26 @@ import styles from "./style";
|
|
|
12
12
|
* @param {boolean} props.paused Animation should be paused.
|
|
13
13
|
* @returns {JSX}
|
|
14
14
|
*/
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
const IndicatorCircle = ({
|
|
16
17
|
size,
|
|
17
18
|
color,
|
|
18
19
|
strokeWidth,
|
|
19
20
|
paused
|
|
20
|
-
}) => /*#__PURE__*/
|
|
21
|
+
}) => /*#__PURE__*/_jsx("svg", {
|
|
21
22
|
className: `${styles.spinner(paused)} ui-shared__indicator-circle`,
|
|
22
23
|
viewBox: "25 25 50 50",
|
|
23
24
|
width: size,
|
|
24
25
|
height: size,
|
|
25
26
|
xmlns: "http://www.w3.org/2000/svg",
|
|
26
|
-
"data-test-id": "loadingIndicator"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})
|
|
27
|
+
"data-test-id": "loadingIndicator",
|
|
28
|
+
children: /*#__PURE__*/_jsx("circle", {
|
|
29
|
+
className: styles.circle(color, strokeWidth, paused),
|
|
30
|
+
cx: "50",
|
|
31
|
+
cy: "50",
|
|
32
|
+
r: "20"
|
|
33
|
+
})
|
|
34
|
+
});
|
|
33
35
|
IndicatorCircle.defaultProps = {
|
|
34
36
|
color: `var(--color-secondary, ${themeConfig.colors.accent})`,
|
|
35
37
|
paused: false,
|
package/IndicatorCircle/spec.js
CHANGED
|
@@ -2,9 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { shallow, mount } from 'enzyme';
|
|
3
3
|
import IndicatorCircle from "./index";
|
|
4
4
|
import styles from "./style";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
describe('<IndicatorCircle />', () => {
|
|
6
7
|
it('should apply the given size', () => {
|
|
7
|
-
const wrapper = shallow(/*#__PURE__*/
|
|
8
|
+
const wrapper = shallow(/*#__PURE__*/_jsx(IndicatorCircle, {
|
|
8
9
|
size: 32
|
|
9
10
|
}));
|
|
10
11
|
expect(wrapper).toMatchSnapshot();
|
|
@@ -13,7 +14,7 @@ describe('<IndicatorCircle />', () => {
|
|
|
13
14
|
expect(svg.props().height).toBe(32);
|
|
14
15
|
});
|
|
15
16
|
it('should apply the given color', () => {
|
|
16
|
-
const wrapper = mount(/*#__PURE__*/
|
|
17
|
+
const wrapper = mount(/*#__PURE__*/_jsx(IndicatorCircle, {
|
|
17
18
|
size: 32,
|
|
18
19
|
color: "#fff",
|
|
19
20
|
strokeWidth: 4
|
|
@@ -4,6 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
import { themeConfig } from '@shopgate/engage';
|
|
5
5
|
import IndicatorCircle from "../IndicatorCircle";
|
|
6
6
|
import { container, imgContainer } from "./style";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
const {
|
|
8
9
|
loadingIndicator: {
|
|
9
10
|
imgSrc: loadingImageSrc
|
|
@@ -16,15 +17,16 @@ const {
|
|
|
16
17
|
*/
|
|
17
18
|
const LoadingIndicator = ({
|
|
18
19
|
className
|
|
19
|
-
}) => /*#__PURE__*/
|
|
20
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
20
21
|
className: classNames(className, {
|
|
21
22
|
[container]: !loadingImageSrc,
|
|
22
23
|
[imgContainer]: !!loadingImageSrc
|
|
23
|
-
}, 'loading-indicator', 'ui-shared__loading-indicator')
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}) : /*#__PURE__*/
|
|
24
|
+
}, 'loading-indicator', 'ui-shared__loading-indicator'),
|
|
25
|
+
children: loadingImageSrc ? /*#__PURE__*/_jsx("img", {
|
|
26
|
+
src: loadingImageSrc,
|
|
27
|
+
alt: ""
|
|
28
|
+
}) : /*#__PURE__*/_jsx(IndicatorCircle, {})
|
|
29
|
+
});
|
|
28
30
|
LoadingIndicator.defaultProps = {
|
|
29
31
|
className: null
|
|
30
32
|
};
|
package/Manufacturer/index.js
CHANGED
|
@@ -9,16 +9,18 @@ import styles from "./style";
|
|
|
9
9
|
* @param {string} [props.className] CSS classes.
|
|
10
10
|
* @return {JSX}
|
|
11
11
|
*/
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
const Manufacturer = ({
|
|
13
14
|
className,
|
|
14
15
|
text
|
|
15
|
-
}) => /*#__PURE__*/
|
|
16
|
-
className: `${styles} ${className} ui-shared__manufacturer
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})
|
|
16
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
17
|
+
className: `${styles} ${className} ui-shared__manufacturer`,
|
|
18
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
19
|
+
dangerouslySetInnerHTML: {
|
|
20
|
+
__html: text
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
});
|
|
22
24
|
Manufacturer.defaultProps = {
|
|
23
25
|
className: ''
|
|
24
26
|
};
|
package/MessageBar/index.js
CHANGED
|
@@ -12,27 +12,30 @@ import styles from "./style";
|
|
|
12
12
|
* @returns {JSX}
|
|
13
13
|
* @deprecated Please import from `@shopgate/engage/components` instead.
|
|
14
14
|
*/
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
const MessageBar = /*#__PURE__*/memo(({
|
|
16
17
|
messages,
|
|
17
18
|
classNames
|
|
18
|
-
}) => /*#__PURE__*/
|
|
19
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
19
20
|
className: classnames(styles.container, classNames.container, 'ui-shared__message-bar'),
|
|
20
|
-
role: messages.length > 0 ? 'alert' : null
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
})
|
|
21
|
+
role: messages.length > 0 ? 'alert' : null,
|
|
22
|
+
children: messages.map(item => {
|
|
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
|
+
}));
|
|
36
39
|
MessageBar.defaultProps = {
|
|
37
40
|
classNames: {
|
|
38
41
|
container: null,
|