@shopgate/pwa-ui-shared 7.30.0-alpha.10 → 7.30.0-alpha.11

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.
Files changed (188) hide show
  1. package/AccordionContainer/index.js +17 -11
  2. package/AccordionContainer/spec.js +12 -3
  3. package/ActionButton/index.js +47 -33
  4. package/ActionButton/spec.js +5 -1
  5. package/AddToCartButton/index.js +44 -33
  6. package/AddToCartButton/mock.js +20 -8
  7. package/AddToCartButton/spec.js +4 -3
  8. package/Availability/index.js +5 -3
  9. package/Availability/spec.js +6 -5
  10. package/Button/index.js +73 -58
  11. package/Button/spec.js +16 -10
  12. package/ButtonLink/index.js +20 -12
  13. package/ButtonLink/spec.js +5 -3
  14. package/Card/index.js +5 -3
  15. package/CardList/components/Item/index.js +5 -3
  16. package/CardList/index.js +21 -12
  17. package/CartTotalLine/components/Amount/index.js +10 -8
  18. package/CartTotalLine/components/Hint/index.js +7 -5
  19. package/CartTotalLine/components/Label/index.js +12 -10
  20. package/CartTotalLine/components/Spacer/index.js +5 -3
  21. package/CartTotalLine/index.js +5 -3
  22. package/Checkbox/index.js +6 -5
  23. package/Chip/index.js +28 -22
  24. package/Chip/spec.js +9 -6
  25. package/ContextMenu/ContextMenuProvider.js +5 -3
  26. package/ContextMenu/components/Item/index.js +14 -11
  27. package/ContextMenu/components/Position/index.js +20 -12
  28. package/ContextMenu/index.js +54 -44
  29. package/ContextMenu/spec.js +31 -20
  30. package/Dialog/components/HtmlContentDialog/index.js +9 -7
  31. package/Dialog/components/HtmlContentDialog/spec.js +9 -6
  32. package/Dialog/components/PipelineErrorDialog/index.js +106 -47
  33. package/Dialog/components/PipelineErrorDialog/spec.js +5 -4
  34. package/Dialog/components/TextMessageDialog/index.js +9 -7
  35. package/Dialog/components/TextMessageDialog/spec.js +9 -6
  36. package/Dialog/components/VariantSelectModal/index.js +7 -5
  37. package/Dialog/components/VariantSelectModal/spec.js +6 -3
  38. package/Dialog/index.js +12 -8
  39. package/Dialog/spec.js +7 -6
  40. package/DiscountBadge/index.js +10 -8
  41. package/DiscountBadge/spec.js +3 -2
  42. package/FavoritesButton/index.js +40 -31
  43. package/FavoritesButton/spec.js +7 -3
  44. package/Form/Builder/classes/ActionListener/index.js +400 -401
  45. package/Form/Builder/components/CheckboxElement.js +13 -5
  46. package/Form/Builder/components/CountryElement.js +13 -5
  47. package/Form/Builder/components/ProvinceElement.js +13 -5
  48. package/Form/Builder/components/RadioElement.js +19 -11
  49. package/Form/Builder/components/SelectElement.js +26 -16
  50. package/Form/Builder/components/TextElement.js +13 -5
  51. package/Form/Builder/index.js +70 -60
  52. package/Form/Builder/spec.js +10 -9
  53. package/Form/Checkbox/index.js +31 -21
  54. package/Form/InfoField/index.js +19 -12
  55. package/Form/InfoField/spec.js +4 -1
  56. package/Form/Password/index.js +22 -15
  57. package/Form/Password/spec.js +10 -5
  58. package/Form/RadioGroup/components/Item/index.js +34 -25
  59. package/Form/RadioGroup/index.js +37 -28
  60. package/Form/RadioGroup/spec.js +45 -31
  61. package/Form/Select/index.js +52 -43
  62. package/Form/Select/spec.js +5 -2
  63. package/Form/SelectContextChoices/index.js +26 -22
  64. package/Form/SelectContextChoices/spec.js +4 -1
  65. package/Form/TextField/index.js +40 -27
  66. package/Form/TextField/spec.js +34 -21
  67. package/Form/index.js +23 -15
  68. package/FormElement/components/ErrorText/index.js +7 -5
  69. package/FormElement/components/Label/index.js +6 -4
  70. package/FormElement/components/Placeholder/index.js +7 -5
  71. package/FormElement/components/Underline/index.js +8 -6
  72. package/FormElement/index.js +62 -46
  73. package/FormElement/spec.js +10 -9
  74. package/Glow/index.js +30 -22
  75. package/Glow/spec.js +6 -1
  76. package/IndicatorCircle/index.js +10 -8
  77. package/IndicatorCircle/spec.js +3 -2
  78. package/LoadingIndicator/index.js +8 -6
  79. package/Manufacturer/index.js +9 -7
  80. package/MessageBar/index.js +20 -17
  81. package/MessageBar/spec.js +6 -5
  82. package/NoResults/components/Icon/index.js +134 -110
  83. package/NoResults/index.js +27 -21
  84. package/Placeholder/index.js +13 -5
  85. package/PlaceholderLabel/index.js +2 -1
  86. package/PlaceholderLabel/spec.js +13 -6
  87. package/PlaceholderParagraph/index.js +13 -12
  88. package/PlaceholderParagraph/spec.js +13 -6
  89. package/Price/index.js +46 -28
  90. package/PriceInfo/index.js +2 -1
  91. package/PriceStriked/index.js +41 -29
  92. package/ProductProperties/index.js +13 -10
  93. package/ProgressBar/index.js +28 -19
  94. package/ProgressBar/spec.js +2 -1
  95. package/RadioButton/index.js +6 -5
  96. package/RadioButton/spec.js +3 -2
  97. package/RatingNumber/index.js +2 -1
  98. package/RatingStars/index.js +50 -34
  99. package/RatingStars/spec.js +7 -6
  100. package/Ripple/components/RippleAnimation/index.js +12 -10
  101. package/Ripple/index.js +72 -62
  102. package/RippleButton/index.js +44 -27
  103. package/RippleButton/spec.js +20 -13
  104. package/ScannerOverlay/components/CameraOverlay/index.js +8 -5
  105. package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +25 -21
  106. package/ScannerOverlay/components/ScannerBar/components/ScannerInstructions/index.js +7 -5
  107. package/ScannerOverlay/components/ScannerBar/index.js +17 -12
  108. package/ScannerOverlay/index.js +24 -15
  109. package/Sheet/components/Header/components/SearchBar/index.js +35 -28
  110. package/Sheet/components/Header/components/SearchBar/spec.js +2 -1
  111. package/Sheet/components/Header/index.js +47 -34
  112. package/Sheet/components/Header/spec.js +2 -1
  113. package/Sheet/index.js +80 -65
  114. package/Sheet/spec.js +27 -14
  115. package/TaxDisclaimer/index.js +13 -10
  116. package/TaxDisclaimer/spec.js +3 -2
  117. package/TextField/components/ErrorText/index.js +7 -5
  118. package/TextField/components/FormElement/index.js +4 -3
  119. package/TextField/components/Hint/index.js +7 -5
  120. package/TextField/components/Label/index.js +6 -4
  121. package/TextField/components/Underline/index.js +8 -6
  122. package/TextField/index.js +102 -85
  123. package/TextField/spec.js +37 -23
  124. package/ToggleIcon/index.js +23 -15
  125. package/ToggleIcon/spec.js +12 -8
  126. package/icons/AccountBoxIcon.js +5 -4
  127. package/icons/AddMoreIcon.js +5 -4
  128. package/icons/ArrowDropIcon.js +5 -4
  129. package/icons/ArrowIcon.js +5 -4
  130. package/icons/BarcodeScannerIcon.js +5 -4
  131. package/icons/BoxIcon.js +5 -4
  132. package/icons/BrowseIcon.js +5 -4
  133. package/icons/BurgerIcon.js +5 -4
  134. package/icons/CalendarIcon.js +5 -5
  135. package/icons/CartCouponIcon.js +5 -4
  136. package/icons/CartIcon.js +5 -4
  137. package/icons/CartPlusIcon.js +5 -4
  138. package/icons/CheckIcon.js +5 -4
  139. package/icons/CheckedIcon.js +5 -4
  140. package/icons/ChevronIcon.js +5 -4
  141. package/icons/CreditCardIcon.js +5 -4
  142. package/icons/CrossIcon.js +5 -4
  143. package/icons/DescriptionIcon.js +5 -4
  144. package/icons/FilterIcon.js +5 -4
  145. package/icons/FlashDisabledIcon.js +5 -4
  146. package/icons/FlashEnabledIcon.js +5 -4
  147. package/icons/GridIcon.js +5 -4
  148. package/icons/HeartIcon.js +5 -4
  149. package/icons/HeartOutlineIcon.js +5 -4
  150. package/icons/HeartPlusIcon.js +5 -4
  151. package/icons/HeartPlusOutlineIcon.js +5 -4
  152. package/icons/HomeIcon.js +5 -4
  153. package/icons/InfoIcon.js +5 -4
  154. package/icons/InfoOutlineIcon.js +5 -4
  155. package/icons/ListIcon.js +5 -4
  156. package/icons/LocalShippingIcon.js +5 -4
  157. package/icons/LocationIcon.js +5 -4
  158. package/icons/LocatorIcon.js +5 -4
  159. package/icons/LockIcon.js +5 -4
  160. package/icons/LogoutIcon.js +5 -4
  161. package/icons/MagnifierIcon.js +5 -4
  162. package/icons/MapMarkerIcon.js +5 -4
  163. package/icons/MoreIcon.js +5 -4
  164. package/icons/MoreVertIcon.js +5 -4
  165. package/icons/NotificationIcon.js +5 -4
  166. package/icons/PersonIcon.js +5 -4
  167. package/icons/PhoneIcon.js +5 -4
  168. package/icons/PlaceholderIcon.js +5 -4
  169. package/icons/RadioCheckedIcon.js +5 -4
  170. package/icons/RadioUncheckedIcon.js +5 -4
  171. package/icons/SecurityIcon.js +5 -4
  172. package/icons/ShippingMethodIcon.js +5 -4
  173. package/icons/ShoppingCartIcon.js +5 -4
  174. package/icons/SortIcon.js +5 -4
  175. package/icons/StarHalfIcon.js +5 -4
  176. package/icons/StarIcon.js +5 -4
  177. package/icons/StarOutlineIcon.js +5 -4
  178. package/icons/StopIcon.js +5 -4
  179. package/icons/TickIcon.js +5 -4
  180. package/icons/TimeIcon.js +5 -4
  181. package/icons/TrashIcon.js +5 -4
  182. package/icons/TrashOutlineIcon.js +5 -4
  183. package/icons/UncheckedIcon.js +5 -4
  184. package/icons/ViewListIcon.js +5 -4
  185. package/icons/VisibilityIcon.js +5 -4
  186. package/icons/VisibilityOffIcon.js +5 -4
  187. package/icons/WarningIcon.js +5 -4
  188. package/package.json +7 -8
@@ -1,41 +1,47 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import { Component } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
 
4
5
  /**
5
6
  * The Accordion container component.
6
7
  */
7
- class AccordionContainer extends Component {
8
+ let AccordionContainer = /*#__PURE__*/function (_Component) {
8
9
  /**
9
10
  * Init
10
11
  * @param {Object} props Props
11
12
  */
12
- constructor(props) {
13
- super(props);
14
- this.open = () => {
15
- this.setState({
13
+ function AccordionContainer(props) {
14
+ var _this;
15
+ _this = _Component.call(this, props) || this;
16
+ _this.open = () => {
17
+ _this.setState({
16
18
  open: true
17
19
  });
18
20
  };
19
- this.close = () => {
20
- this.setState({
21
+ _this.close = () => {
22
+ _this.setState({
21
23
  open: false
22
24
  });
23
25
  };
24
- this.state = {
26
+ _this.state = {
25
27
  open: props.open
26
28
  };
29
+ return _this;
27
30
  }
31
+ _inheritsLoose(AccordionContainer, _Component);
32
+ var _proto = AccordionContainer.prototype;
28
33
  /**
29
34
  * @returns {JSX}
30
35
  */
31
- render() {
36
+ _proto.render = function render() {
32
37
  return this.props.children({
33
38
  handleClose: this.close,
34
39
  open: this.state.open,
35
40
  handleOpen: this.open
36
41
  });
37
- }
38
- }
42
+ };
43
+ return AccordionContainer;
44
+ }(Component);
39
45
  AccordionContainer.defaultProps = {
40
46
  open: false
41
47
  };
@@ -5,10 +5,15 @@ import AccordionContainer from "./index";
5
5
  /**
6
6
  * @returns {JSX}
7
7
  */
8
- const Child = () => /*#__PURE__*/React.createElement("div", null);
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const Child = () => /*#__PURE__*/_jsx("div", {});
9
10
  describe('<AccordionContainer />', () => {
10
11
  it('should render children with props', () => {
11
- const wrapper = shallow(/*#__PURE__*/React.createElement(AccordionContainer, null, props => /*#__PURE__*/React.createElement(Child, props)));
12
+ const wrapper = shallow(/*#__PURE__*/_jsx(AccordionContainer, {
13
+ children: props => /*#__PURE__*/_jsx(Child, {
14
+ ...props
15
+ })
16
+ }));
12
17
  const props = wrapper.find('Child').props();
13
18
  expect(wrapper).toMatchSnapshot();
14
19
  expect(props.open).toEqual(false);
@@ -16,7 +21,11 @@ describe('<AccordionContainer />', () => {
16
21
  expect(typeof props.handleClose).toEqual('function');
17
22
  });
18
23
  it('should update children props when state changes', () => {
19
- const wrapper = shallow(/*#__PURE__*/React.createElement(AccordionContainer, null, props => /*#__PURE__*/React.createElement(Child, props)));
24
+ const wrapper = shallow(/*#__PURE__*/_jsx(AccordionContainer, {
25
+ children: props => /*#__PURE__*/_jsx(Child, {
26
+ ...props
27
+ })
28
+ }));
20
29
  wrapper.setState({
21
30
  open: true
22
31
  });
@@ -1,4 +1,5 @@
1
- import _extends from "@babel/runtime/helpers/extends";
1
+ import _createClass from "@babel/runtime/helpers/createClass";
2
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
3
  import React, { Component } from 'react';
3
4
  import PropTypes from 'prop-types';
4
5
  import IndicatorCircle from "../IndicatorCircle";
@@ -8,58 +9,71 @@ import styles from "./style";
8
9
  /**
9
10
  * The action button component.
10
11
  */
11
- class ActionButton extends Component {
12
- constructor(...args) {
13
- super(...args);
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ let ActionButton = /*#__PURE__*/function (_Component) {
14
+ function ActionButton(...args) {
15
+ var _this;
16
+ _this = _Component.call.apply(_Component, [this].concat(args)) || this;
14
17
  /**
15
18
  * The click handler
16
19
  * @param {Object} event The event object for the click handler
17
20
  */
18
- this.handleClick = event => {
21
+ _this.handleClick = event => {
19
22
  const {
20
23
  clickDelay
21
- } = this.constructor;
22
- if (this.props.disableClickDelay) {
23
- this.props.onClick(event);
24
+ } = _this.constructor;
25
+ if (_this.props.disableClickDelay) {
26
+ _this.props.onClick(event);
24
27
  return;
25
28
  }
26
29
  setTimeout(() => {
27
- this.props.onClick(event);
30
+ _this.props.onClick(event);
28
31
  }, clickDelay);
29
32
  };
33
+ return _this;
30
34
  }
31
- /**
32
- * Getter for the calculated button props.
33
- * @returns {Object}
34
- */
35
- get buttonProps() {
36
- const buttonProps = {
37
- className: this.props.className,
38
- disabled: this.props.disabled,
39
- flat: this.props.flat,
40
- type: this.props.type
41
- };
42
- return buttonProps;
43
- }
35
+ _inheritsLoose(ActionButton, _Component);
36
+ var _proto = ActionButton.prototype;
44
37
  /**
45
38
  * The render function.
46
39
  * @returns {JSX}
47
40
  */
48
- render() {
41
+ _proto.render = function render() {
49
42
  const containerClass = this.props.noGap ? styles.noGapContainer : styles.container;
50
43
  if (this.props.loading) {
51
- return /*#__PURE__*/React.createElement("div", {
52
- className: styles.containerCircle
53
- }, /*#__PURE__*/React.createElement(IndicatorCircle, null));
44
+ return /*#__PURE__*/_jsx("div", {
45
+ className: styles.containerCircle,
46
+ children: /*#__PURE__*/_jsx(IndicatorCircle, {})
47
+ });
54
48
  }
55
- return /*#__PURE__*/React.createElement("div", {
49
+ return /*#__PURE__*/_jsx("div", {
56
50
  className: `ui-shared__action-button ${containerClass}`,
57
- "data-test-id": this.props.testId
58
- }, /*#__PURE__*/React.createElement(RippleButton, _extends({}, this.buttonProps, {
59
- onClick: this.handleClick
60
- }), this.props.children));
61
- }
62
- }
51
+ "data-test-id": this.props.testId,
52
+ children: /*#__PURE__*/_jsx(RippleButton, {
53
+ ...this.buttonProps,
54
+ onClick: this.handleClick,
55
+ children: this.props.children
56
+ })
57
+ });
58
+ };
59
+ return _createClass(ActionButton, [{
60
+ key: "buttonProps",
61
+ get:
62
+ /**
63
+ * Getter for the calculated button props.
64
+ * @returns {Object}
65
+ */
66
+ function () {
67
+ const buttonProps = {
68
+ className: this.props.className,
69
+ disabled: this.props.disabled,
70
+ flat: this.props.flat,
71
+ type: this.props.type
72
+ };
73
+ return buttonProps;
74
+ }
75
+ }]);
76
+ }(Component);
63
77
  ActionButton.clickDelay = 300;
64
78
  ActionButton.defaultProps = {
65
79
  ...RippleButton.defaultProps,
@@ -3,6 +3,7 @@ import { shallow } from 'enzyme';
3
3
  import IndicatorCircle from "../IndicatorCircle";
4
4
  import RippleButton from "../RippleButton";
5
5
  import ActionButton from "./index";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
6
7
  describe('<ActionButton />', () => {
7
8
  let renderedElement;
8
9
  let mockOnClick;
@@ -13,7 +14,10 @@ describe('<ActionButton />', () => {
13
14
  * @param {Object} props The component props.
14
15
  */
15
16
  const renderComponent = (props = {}) => {
16
- renderedElement = shallow(/*#__PURE__*/React.createElement(ActionButton, props, "Action Button"));
17
+ renderedElement = shallow(/*#__PURE__*/_jsx(ActionButton, {
18
+ ...props,
19
+ children: "Action Button"
20
+ }));
17
21
  };
18
22
  describe('Given the component was mounted to the DOM', () => {
19
23
  beforeEach(() => {
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import React, { Component } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { themeConfig } from '@shopgate/pwa-common/helpers/config';
@@ -10,13 +11,15 @@ import styles from "./style";
10
11
  /**
11
12
  * AddToCartButton component.
12
13
  */
13
- class AddToCartButton extends Component {
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
+ let AddToCartButton = /*#__PURE__*/function (_Component) {
14
16
  /**
15
17
  * Constructor for the AddToCartButton component.
16
18
  * @param {Object} props Props for the component.
17
19
  */
18
- constructor(props) {
19
- super(props);
20
+ function AddToCartButton(props) {
21
+ var _this;
22
+ _this = _Component.call(this, props) || this;
20
23
  /**
21
24
  * Handles the button click.
22
25
  * - Show checkmark.
@@ -25,24 +28,24 @@ class AddToCartButton extends Component {
25
28
  * - Show cart icon again.
26
29
  * @param {Event} e Event
27
30
  */
28
- this.handleClick = e => {
31
+ _this.handleClick = e => {
29
32
  // Ignore clicks when check mark or loading spinner is shown or the button is disabled.
30
- if (this.state.showCheckmark || this.props.isLoading || this.props.isDisabled) {
33
+ if (_this.state.showCheckmark || _this.props.isLoading || _this.props.isDisabled) {
31
34
  return;
32
35
  }
33
36
 
34
37
  /** */
35
38
  const handleCompletion = () => {
36
- this.setState({
39
+ _this.setState({
37
40
  showCheckmark: true
38
41
  });
39
42
  setTimeout(() => {
40
- this.setState({
43
+ _this.setState({
41
44
  showCheckmark: false
42
45
  });
43
46
  }, 900);
44
47
  };
45
- const result = this.props.onClick(e);
48
+ const result = _this.props.onClick(e);
46
49
  if (result === false) {
47
50
  // Do not trigger animation when adding to cart was aborted by the parent component (PWA-2764)
48
51
  return;
@@ -68,23 +71,26 @@ class AddToCartButton extends Component {
68
71
  * This is caused by CSS animations that get re-applied when
69
72
  * setting an element from hidden (display: none) to visible.
70
73
  */
71
- this.handleCartAnimationEnd = () => {
72
- if (this.state.showCheckmark === false) {
73
- this.setState({
74
+ _this.handleCartAnimationEnd = () => {
75
+ if (_this.state.showCheckmark === false) {
76
+ _this.setState({
74
77
  showCheckmark: null
75
78
  });
76
79
  }
77
- this.props.onReset();
80
+ _this.props.onReset();
78
81
  };
79
- this.state = {
82
+ _this.state = {
80
83
  showCheckmark: null
81
84
  };
85
+ return _this;
82
86
  }
87
+ _inheritsLoose(AddToCartButton, _Component);
88
+ var _proto = AddToCartButton.prototype;
83
89
  /**
84
90
  * Renders the component
85
91
  * @returns {JSX}
86
92
  */
87
- render() {
93
+ _proto.render = function render() {
88
94
  // Set initial base styles
89
95
  let buttonStyle = styles.buttonReady;
90
96
  let tickIconStyle = styles.icon;
@@ -162,7 +168,7 @@ class AddToCartButton extends Component {
162
168
  if (this.props.noShadow) {
163
169
  className = styles.buttonWrapperNoShadow(this.props.buttonSize, this.props.iconSize);
164
170
  }
165
- return /*#__PURE__*/React.createElement("button", {
171
+ return /*#__PURE__*/_jsxs("button", {
166
172
  "data-test-id": "addToCartButton",
167
173
  className: `ui-shared__add-to-cart-button ${this.props.className} ${className} ${buttonStyle}`,
168
174
  onClick: this.handleClick,
@@ -170,24 +176,29 @@ class AddToCartButton extends Component {
170
176
  "aria-label": this.props['aria-label'],
171
177
  "aria-disabled": this.props.isDisabled,
172
178
  ref: this.props.forwardedRef,
173
- type: "button"
174
- }, this.props.isLoading && /*#__PURE__*/React.createElement("div", {
175
- className: `${styles.icon} ${styles.spinnerIcon}`,
176
- style: spinnerInlineStyle
177
- }, /*#__PURE__*/React.createElement(IndicatorCircle, {
178
- color: themeConfig.colors.primaryContrast,
179
- strokeWidth: 5,
180
- paused: !this.props.isLoading
181
- })), /*#__PURE__*/React.createElement("div", {
182
- className: tickIconStyle,
183
- style: tickInlineStyle
184
- }, /*#__PURE__*/React.createElement(TickIcon, null)), /*#__PURE__*/React.createElement("div", {
185
- className: cartPlusIconStyle,
186
- style: cartInlineStyle,
187
- onAnimationEnd: this.handleCartAnimationEnd
188
- }, /*#__PURE__*/React.createElement(CartPlusIcon, null)));
189
- }
190
- }
179
+ type: "button",
180
+ children: [this.props.isLoading && /*#__PURE__*/_jsx("div", {
181
+ className: `${styles.icon} ${styles.spinnerIcon}`,
182
+ style: spinnerInlineStyle,
183
+ children: /*#__PURE__*/_jsx(IndicatorCircle, {
184
+ color: themeConfig.colors.primaryContrast,
185
+ strokeWidth: 5,
186
+ paused: !this.props.isLoading
187
+ })
188
+ }), /*#__PURE__*/_jsx("div", {
189
+ className: tickIconStyle,
190
+ style: tickInlineStyle,
191
+ children: /*#__PURE__*/_jsx(TickIcon, {})
192
+ }), /*#__PURE__*/_jsx("div", {
193
+ className: cartPlusIconStyle,
194
+ style: cartInlineStyle,
195
+ onAnimationEnd: this.handleCartAnimationEnd,
196
+ children: /*#__PURE__*/_jsx(CartPlusIcon, {})
197
+ })]
198
+ });
199
+ };
200
+ return AddToCartButton;
201
+ }(Component);
191
202
  AddToCartButton.defaultProps = {
192
203
  'aria-hidden': false,
193
204
  'aria-label': null,
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  var _Class;
2
3
  import React, { Component } from 'react';
3
4
  import PropTypes from 'prop-types';
@@ -7,17 +8,28 @@ import PropTypes from 'prop-types';
7
8
  * @deprecated
8
9
  */
9
10
  // eslint-disable-next-line react/prefer-stateless-function
10
- export const MockedAddToCartButton = (_Class = class MockedAddToCartButton extends Component {
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ export const MockedAddToCartButton = (_Class = /*#__PURE__*/function (_Component) {
13
+ function MockedAddToCartButton() {
14
+ return _Component.apply(this, arguments) || this;
15
+ }
16
+ _inheritsLoose(MockedAddToCartButton, _Component);
17
+ var _proto = MockedAddToCartButton.prototype;
11
18
  /**
12
19
  * Renders mocked button.
13
20
  * @return {JSX}
14
21
  */
15
- render() {
16
- return /*#__PURE__*/React.createElement("button", {
17
- onClick: this.props.onClick,
18
- type: "button"
19
- });
20
- }
21
- }, _Class.defaultProps = {
22
+ _proto.render = function render() {
23
+ return (
24
+ /*#__PURE__*/
25
+ // eslint-disable-next-line jsx-a11y/control-has-associated-label
26
+ _jsx("button", {
27
+ onClick: this.props.onClick,
28
+ type: "button"
29
+ })
30
+ );
31
+ };
32
+ return MockedAddToCartButton;
33
+ }(Component), _Class.defaultProps = {
22
34
  onClick: () => {}
23
35
  }, _Class);
@@ -7,11 +7,12 @@ import AddToCartButton from "./index";
7
7
  * Flushes the promise queue.
8
8
  * @returns {Promise}
9
9
  */
10
+ import { jsx as _jsx } from "react/jsx-runtime";
10
11
  const flushMicrotasks = () => Promise.resolve();
11
12
  describe('<AddToCartButton />', () => {
12
13
  it('should render in loading state and should not be clickable', () => {
13
14
  const spy = jest.fn(() => Promise.resolve());
14
- const wrapper = mount(/*#__PURE__*/React.createElement(AddToCartButton, {
15
+ const wrapper = mount(/*#__PURE__*/_jsx(AddToCartButton, {
15
16
  onClick: spy,
16
17
  isLoading: true,
17
18
  isOrderable: true,
@@ -25,7 +26,7 @@ describe('<AddToCartButton />', () => {
25
26
  });
26
27
  it('should render with checkmark icon and should not be clickable the second time', async () => {
27
28
  const spy = jest.fn(() => Promise.resolve());
28
- const wrapper = mount(/*#__PURE__*/React.createElement(AddToCartButton, {
29
+ const wrapper = mount(/*#__PURE__*/_jsx(AddToCartButton, {
29
30
  onClick: spy,
30
31
  isLoading: false,
31
32
  isOrderable: true,
@@ -50,7 +51,7 @@ describe('<AddToCartButton />', () => {
50
51
  });
51
52
  it('should render with cart icon and should be clickable', async () => {
52
53
  const spy = jest.fn(() => Promise.resolve());
53
- const wrapper = mount(/*#__PURE__*/React.createElement(AddToCartButton, {
54
+ const wrapper = mount(/*#__PURE__*/_jsx(AddToCartButton, {
54
55
  onClick: spy,
55
56
  isLoading: false,
56
57
  isOrderable: true,
@@ -13,6 +13,7 @@ import styles from "./style";
13
13
  * @param {string} [props.className] CSS classes
14
14
  * @return {JSX}
15
15
  */
16
+ import { jsx as _jsx } from "react/jsx-runtime";
16
17
  const Availability = ({
17
18
  text,
18
19
  state,
@@ -29,10 +30,11 @@ const Availability = ({
29
30
  if (state === AVAILABILITY_STATE_ALERT) {
30
31
  style = styles.stateAlert;
31
32
  }
32
- return /*#__PURE__*/React.createElement("div", {
33
+ return /*#__PURE__*/_jsx("div", {
33
34
  className: `ui-shared__availability ${className} ${style}`,
34
- "data-test-id": `availabilityText: ${text}`
35
- }, text);
35
+ "data-test-id": `availabilityText: ${text}`,
36
+ children: text
37
+ });
36
38
  };
37
39
  Availability.defaultProps = {
38
40
  className: '',
@@ -2,22 +2,23 @@ import React from 'react';
2
2
  import { mount } from 'enzyme';
3
3
  import { AVAILABILITY_STATE_OK, AVAILABILITY_STATE_WARNING, AVAILABILITY_STATE_ALERT } from '@shopgate/pwa-common-commerce/product/constants';
4
4
  import Availability from "./index";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
5
6
  describe('<Availability />', () => {
6
7
  it('should not render when text is empty', () => {
7
- const wrapper = mount(/*#__PURE__*/React.createElement(Availability, {
8
+ const wrapper = mount(/*#__PURE__*/_jsx(Availability, {
8
9
  text: ""
9
10
  }));
10
11
  expect(wrapper).toMatchSnapshot();
11
12
  });
12
13
  it('should not render by default if state is "ok"', () => {
13
- const wrapper = mount(/*#__PURE__*/React.createElement(Availability, {
14
+ const wrapper = mount(/*#__PURE__*/_jsx(Availability, {
14
15
  state: AVAILABILITY_STATE_OK,
15
16
  text: "Available"
16
17
  }));
17
18
  expect(wrapper).toMatchSnapshot();
18
19
  });
19
20
  it('should render if state is "ok" when "showWhenAvailable" is set', () => {
20
- const wrapper = mount(/*#__PURE__*/React.createElement(Availability, {
21
+ const wrapper = mount(/*#__PURE__*/_jsx(Availability, {
21
22
  state: AVAILABILITY_STATE_OK,
22
23
  text: "Available",
23
24
  showWhenAvailable: true
@@ -25,14 +26,14 @@ describe('<Availability />', () => {
25
26
  expect(wrapper).toMatchSnapshot();
26
27
  });
27
28
  it('should render if state is "warning"', () => {
28
- const wrapper = mount(/*#__PURE__*/React.createElement(Availability, {
29
+ const wrapper = mount(/*#__PURE__*/_jsx(Availability, {
29
30
  state: AVAILABILITY_STATE_WARNING,
30
31
  text: "Only 5 left"
31
32
  }));
32
33
  expect(wrapper).toMatchSnapshot();
33
34
  });
34
35
  it('should render if state is "warning"', () => {
35
- const wrapper = mount(/*#__PURE__*/React.createElement(Availability, {
36
+ const wrapper = mount(/*#__PURE__*/_jsx(Availability, {
36
37
  state: AVAILABILITY_STATE_ALERT,
37
38
  text: "Out of stock"
38
39
  }));
package/Button/index.js CHANGED
@@ -1,79 +1,94 @@
1
- import _extends from "@babel/runtime/helpers/extends";
1
+ import _createClass from "@babel/runtime/helpers/createClass";
2
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
3
  import React, { Component } from 'react';
3
4
  import PropTypes from 'prop-types';
4
5
  import BaseButton from '@shopgate/pwa-common/components/Button';
5
6
  import styles from "./style";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
6
8
  /**
7
9
  * The basic button component. This components applies Material Design styles and acts as
8
10
  * base to more feature-rich button components such as ActionButton and RippleButton, but can
9
11
  * also be used as standalone component or any other kind of new button.
10
12
  */
11
- class Button extends Component {
12
- /**
13
- * Getter for style depending on prop type.
14
- * @returns {Object}
15
- */
16
- get style() {
17
- const {
18
- flat,
19
- disabled
20
- } = this.props;
21
- switch (this.props.type) {
22
- case 'plain':
23
- return styles.plain();
24
- case 'regular':
25
- return styles.regular(disabled);
26
- case 'simple':
27
- return styles.simple(disabled);
28
- default:
29
- case 'primary':
30
- return styles.primary(disabled, flat);
31
- case 'secondary':
32
- return styles.secondary(disabled, flat);
33
- }
34
- }
35
-
36
- /**
37
- * Getter for the calculated button props.
38
- * @returns {Object}
39
- */
40
- get buttonProps() {
41
- const {
42
- className,
43
- disabled,
44
- onClick,
45
- testId,
46
- type,
47
- wrapContent,
48
- flat,
49
- ...rest
50
- } = this.props;
51
- const buttonProps = {
52
- className,
53
- disabled,
54
- onClick,
55
- ...rest
56
- };
57
- return buttonProps;
13
+ let Button = /*#__PURE__*/function (_Component) {
14
+ function Button() {
15
+ return _Component.apply(this, arguments) || this;
58
16
  }
59
-
17
+ _inheritsLoose(Button, _Component);
18
+ var _proto = Button.prototype;
60
19
  /**
61
20
  * Renders the component.
62
21
  * @return {JSX}
63
22
  */
64
- render() {
23
+ _proto.render = function render() {
65
24
  const {
66
25
  style
67
26
  } = this;
68
- const content = this.props.wrapContent ? /*#__PURE__*/React.createElement("div", {
69
- className: style.content
70
- }, this.props.children) : this.props.children;
71
- return /*#__PURE__*/React.createElement(BaseButton, _extends({}, this.buttonProps, {
27
+ const content = this.props.wrapContent ? /*#__PURE__*/_jsx("div", {
28
+ className: style.content,
29
+ children: this.props.children
30
+ }) : this.props.children;
31
+ return /*#__PURE__*/_jsx(BaseButton, {
32
+ ...this.buttonProps,
72
33
  className: `ui-shared__button ${style.button} ${this.props.className}`,
73
- testId: this.props.testId
74
- }), content);
75
- }
76
- }
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);
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Getter for the calculated button props.
67
+ * @returns {Object}
68
+ */
69
+ }, {
70
+ key: "buttonProps",
71
+ get: function () {
72
+ const {
73
+ className,
74
+ disabled,
75
+ onClick,
76
+ testId,
77
+ type,
78
+ wrapContent,
79
+ flat,
80
+ ...rest
81
+ } = this.props;
82
+ const buttonProps = {
83
+ className,
84
+ disabled,
85
+ onClick,
86
+ ...rest
87
+ };
88
+ return buttonProps;
89
+ }
90
+ }]);
91
+ }(Component);
77
92
  Button.defaultProps = {
78
93
  ...BaseButton.defaultProps,
79
94
  className: '',