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

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
package/Ripple/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, { PureComponent } from 'react';
2
4
  import PropTypes from 'prop-types';
3
5
  import { findDOMNode } from 'react-dom';
@@ -11,59 +13,64 @@ import style from "./style";
11
13
  /**
12
14
  * The ripple component.
13
15
  */
14
- class Ripple extends PureComponent {
16
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
+ let Ripple = /*#__PURE__*/function (_PureComponent) {
15
18
  /**
16
19
  * Constructor.
17
20
  * @param {Object} props The component props.
18
21
  */
19
- constructor(props) {
20
- super(props);
22
+ function Ripple(props) {
23
+ var _this;
24
+ _this = _PureComponent.call(this, props) || this;
21
25
  /**
22
26
  * Triggers adding of a new ripple on touch start event.
23
27
  * @param {Object} event The even object.
24
28
  */
25
- this.handleClick = event => {
26
- if (this.props.disabled) {
29
+ _this.handleClick = event => {
30
+ if (_this.props.disabled) {
27
31
  return;
28
32
  }
29
- this.addRipple(event, true);
30
- this.props.onClick();
33
+ _this.addRipple(event, true);
34
+ _this.props.onClick();
31
35
  };
32
36
  /**
33
37
  * Will be triggered from the ripple animation component, when the
34
38
  * ripple animation is over. It removes the ripple from the queue again.
35
39
  */
36
- this.removeRipple = () => {
37
- if (!this.mounted) {
40
+ _this.removeRipple = () => {
41
+ if (!_this.mounted) {
38
42
  return;
39
43
  }
40
- this.setState(prevState => {
44
+ _this.setState(prevState => {
41
45
  const ripples = shift(prevState.ripples);
42
- this.props.onComplete();
46
+ _this.props.onComplete();
43
47
  return {
44
48
  ripples,
45
49
  hasRipples: !!ripples.length
46
50
  };
47
51
  });
48
52
  };
49
- this.state = {
53
+ _this.state = {
50
54
  ripples: [],
51
55
  nextKey: 0,
52
56
  hasRipples: false
53
57
  };
54
- this.duration = 500;
55
- this.ignoreNextMouseDown = false;
56
- this.mounted = false;
57
- this.offset = null;
58
- this.position = null;
59
- this.rootNode = null;
60
- this.style = null;
58
+ _this.duration = 500;
59
+ _this.ignoreNextMouseDown = false;
60
+ _this.mounted = false;
61
+ _this.offset = null;
62
+ _this.position = null;
63
+ _this.rootNode = null;
64
+ _this.style = null;
65
+ return _this;
61
66
  }
62
67
 
63
68
  /**
64
69
  * Sets the `mounted` flag to true.
65
70
  */
66
- componentDidMount() {
71
+ _inheritsLoose(Ripple, _PureComponent);
72
+ var _proto = Ripple.prototype;
73
+ _proto.componentDidMount = function componentDidMount() {
67
74
  const {
68
75
  fill
69
76
  } = this.props;
@@ -94,42 +101,21 @@ class Ripple extends PureComponent {
94
101
 
95
102
  /**
96
103
  * Sets the `mounted` flag to false
97
- */
98
- componentWillUnmount() {
104
+ */;
105
+ _proto.componentWillUnmount = function componentWillUnmount() {
99
106
  this.mounted = false;
100
107
  }
101
108
 
102
109
  /**
103
110
  * Calculate the size of the ripple.
104
111
  * @returns {number}
105
- */
106
- get rippleSize() {
107
- if (this.props.size) {
108
- if (this.props.fill) {
109
- return this.props.size * 2;
110
- }
111
- return this.props.size;
112
- }
113
-
114
- /**
115
- * We want the Ripple to fill the element. We set the diameter of the Ripple
116
- * to double the distance of the opposing corners of the node. That way the Ripple
117
- * will reach the furthest away corner if you click at a corner.
118
- */
119
- if (this.props.fill) {
120
- return Math.sqrt(this.rootNode.offsetWidth ** 2 + this.rootNode.offsetHeight ** 2) * 2;
121
- }
122
-
123
- // Otherwise we set the size to be the smaller of the element's height and width.
124
- return Math.min(this.rootNode.offsetWidth, this.rootNode.offsetHeight);
125
- }
126
-
112
+ */;
127
113
  /**
128
114
  * Calculates the ripple position from the event.
129
115
  * @param {Object} event The event object.
130
116
  * @returns {Object} An object containing x and y values for the ripple.
131
117
  */
132
- getRipplePosition(event) {
118
+ _proto.getRipplePosition = function getRipplePosition(event) {
133
119
  // If the Ripple is to fill the element then we should set the
134
120
  // Starting position to be where the user clicked within that element.
135
121
  if (this.props.fill) {
@@ -145,13 +131,13 @@ class Ripple extends PureComponent {
145
131
  this.position.y = pageY - this.offset.top;
146
132
  }
147
133
  return this.position;
148
- }
134
+ };
149
135
  /**
150
136
  * Adds a new Ripple to the queue.
151
137
  * @param {Object} event The event object.
152
138
  * @param {boolean} isTouchGenerated Whether the action was triggered by a touch or click.
153
139
  */
154
- addRipple(event, isTouchGenerated) {
140
+ _proto.addRipple = function addRipple(event, isTouchGenerated) {
155
141
  // If the adding of the Ripple was already triggered
156
142
  // By a touch start event, no further action will be done.
157
143
  if (this.ignoreNextMouseDown && !isTouchGenerated) {
@@ -172,16 +158,15 @@ class Ripple extends PureComponent {
172
158
  } = this.state;
173
159
 
174
160
  // Append the new ripple to the ripples array.
175
- ripples.push(/*#__PURE__*/React.createElement(RippleAnimation, {
161
+ ripples.push(/*#__PURE__*/_jsx(RippleAnimation, {
176
162
  color: this.props.color,
177
163
  duration: this.duration,
178
164
  fill: this.props.fill,
179
- key: this.state.nextKey,
180
165
  onComplete: this.removeRipple,
181
166
  size: this.rippleSize,
182
167
  x: x,
183
168
  y: y
184
- }));
169
+ }, this.state.nextKey));
185
170
  this.ignoreNextMouseDown = isTouchGenerated;
186
171
 
187
172
  // Update the state.
@@ -197,34 +182,59 @@ class Ripple extends PureComponent {
197
182
  /**
198
183
  * Renders all the ripples in the queue.
199
184
  * @returns {JSX|null}
200
- */
201
- renderRipples() {
185
+ */;
186
+ _proto.renderRipples = function renderRipples() {
202
187
  // It only needs to render, if there is at least one ripple in the queue.
203
188
  if (!this.state.hasRipples) {
204
189
  return null;
205
190
  }
206
- return /*#__PURE__*/React.createElement("div", {
207
- className: style.container
208
- }, this.state.ripples);
191
+ return /*#__PURE__*/_jsx("div", {
192
+ className: style.container,
193
+ children: this.state.ripples
194
+ });
209
195
  }
210
196
 
211
197
  /**
212
198
  * Renders the final ripple component including it's contents.
213
199
  * @returns {JSX}
214
- */
215
- render() {
200
+ */;
201
+ _proto.render = function render() {
216
202
  /* eslint-disable jsx-a11y/click-events-have-key-events,
217
203
  jsx-a11y/no-static-element-interactions */
218
- return /*#__PURE__*/React.createElement("div", {
204
+ return /*#__PURE__*/_jsxs("div", {
219
205
  className: `ui-shared__ripple ${this.props.className}`,
220
206
  "data-test-id": "Ripple",
221
207
  onClick: this.handleClick,
222
- style: this.style
223
- }, this.renderRipples(), this.props.children);
208
+ style: this.style,
209
+ children: [this.renderRipples(), this.props.children]
210
+ });
224
211
  /* eslint-enable jsx-a11y/click-events-have-key-events,
225
212
  jsx-a11y/no-static-element-interactions */
226
- }
227
- }
213
+ };
214
+ return _createClass(Ripple, [{
215
+ key: "rippleSize",
216
+ get: function () {
217
+ if (this.props.size) {
218
+ if (this.props.fill) {
219
+ return this.props.size * 2;
220
+ }
221
+ return this.props.size;
222
+ }
223
+
224
+ /**
225
+ * We want the Ripple to fill the element. We set the diameter of the Ripple
226
+ * to double the distance of the opposing corners of the node. That way the Ripple
227
+ * will reach the furthest away corner if you click at a corner.
228
+ */
229
+ if (this.props.fill) {
230
+ return Math.sqrt(this.rootNode.offsetWidth ** 2 + this.rootNode.offsetHeight ** 2) * 2;
231
+ }
232
+
233
+ // Otherwise we set the size to be the smaller of the element's height and width.
234
+ return Math.min(this.rootNode.offsetWidth, this.rootNode.offsetHeight);
235
+ }
236
+ }]);
237
+ }(PureComponent);
228
238
  Ripple.defaultProps = {
229
239
  className: '',
230
240
  color: themeConfig.colors.dark,
@@ -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 Ripple from "../Ripple";
@@ -9,34 +10,25 @@ import style from "../Button/style";
9
10
  * The ripple button component is a special derivation of the basic button component
10
11
  * that adds a ripple effect when clicked.
11
12
  */
12
- class RippleButton extends Component {
13
- /**
14
- * Getter for the calculated button props.
15
- * @returns {Object}
16
- */
17
- get buttonProps() {
18
- return {
19
- className: `${this.props.className} ui-shared__ripple-button`,
20
- disabled: this.props.disabled,
21
- onClick: this.props.onClick,
22
- flat: this.props.flat,
23
- type: this.props.type,
24
- wrapContent: false,
25
- 'aria-label': this.props['aria-label'],
26
- 'aria-haspopup': this.props['aria-haspopup']
27
- };
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ let RippleButton = /*#__PURE__*/function (_Component) {
15
+ function RippleButton() {
16
+ return _Component.apply(this, arguments) || this;
28
17
  }
29
-
18
+ _inheritsLoose(RippleButton, _Component);
19
+ var _proto = RippleButton.prototype;
30
20
  /**
31
21
  * Renders the component.
32
22
  * @returns {JSX}
33
23
  */
34
- render() {
24
+ _proto.render = function render() {
35
25
  if (this.props.disabled) {
36
26
  // Don't show the ripple effect when the button is disabled.
37
- return /*#__PURE__*/React.createElement(Button, _extends({}, this.buttonProps, {
38
- wrapContent: true
39
- }), this.props.children);
27
+ return /*#__PURE__*/_jsx(Button, {
28
+ ...this.buttonProps,
29
+ wrapContent: true,
30
+ children: this.props.children
31
+ });
40
32
  }
41
33
  const rippleProps = {
42
34
  className: `${style.contentWrapper} ${this.props.rippleClassName}`,
@@ -44,11 +36,36 @@ class RippleButton extends Component {
44
36
  size: this.props.rippleSize,
45
37
  overflow: true
46
38
  };
47
- return /*#__PURE__*/React.createElement(Button, _extends({}, this.buttonProps, {
48
- testId: this.props.testId
49
- }), /*#__PURE__*/React.createElement(Ripple, rippleProps, this.props.children));
50
- }
51
- }
39
+ return /*#__PURE__*/_jsx(Button, {
40
+ ...this.buttonProps,
41
+ testId: this.props.testId,
42
+ children: /*#__PURE__*/_jsx(Ripple, {
43
+ ...rippleProps,
44
+ children: this.props.children
45
+ })
46
+ });
47
+ };
48
+ return _createClass(RippleButton, [{
49
+ key: "buttonProps",
50
+ get:
51
+ /**
52
+ * Getter for the calculated button props.
53
+ * @returns {Object}
54
+ */
55
+ function () {
56
+ return {
57
+ className: `${this.props.className} ui-shared__ripple-button`,
58
+ disabled: this.props.disabled,
59
+ onClick: this.props.onClick,
60
+ flat: this.props.flat,
61
+ type: this.props.type,
62
+ wrapContent: false,
63
+ 'aria-label': this.props['aria-label'],
64
+ 'aria-haspopup': this.props['aria-haspopup']
65
+ };
66
+ }
67
+ }]);
68
+ }(Component);
52
69
  RippleButton.defaultProps = {
53
70
  ...Button.defaultProps,
54
71
  rippleClassName: '',
@@ -5,40 +5,47 @@ import Button from '@shopgate/pwa-common/components/Button';
5
5
  import Ripple from "../Ripple";
6
6
  import styles from "../Button/style";
7
7
  import RippleButton from "./index";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
8
9
  describe('<RippleButton />', () => {
9
10
  it('should render as a regular ripple button effect if type is omitted', () => {
10
- const wrapper = shallow(/*#__PURE__*/React.createElement(RippleButton, null, "Press me"));
11
+ const wrapper = shallow(/*#__PURE__*/_jsx(RippleButton, {
12
+ children: "Press me"
13
+ }));
11
14
  expect(wrapper).toMatchSnapshot();
12
15
  expect(wrapper.find(Ripple).render().text()).toEqual('Press me');
13
16
  });
14
17
  it('should render as a regular ripple button if type is explicitly defined', () => {
15
- const wrapper = mount(/*#__PURE__*/React.createElement(RippleButton, {
16
- type: "regular"
17
- }, "Press me"));
18
+ const wrapper = mount(/*#__PURE__*/_jsx(RippleButton, {
19
+ type: "regular",
20
+ children: "Press me"
21
+ }));
18
22
  expect(trim(wrapper.find(Button).props().className)).toEqual(`ui-shared__button ${styles.regular(false).button} ui-shared__ripple-button`);
19
23
  expect(wrapper.find(Ripple).render().text()).toEqual('Press me');
20
24
  expect(wrapper).toMatchSnapshot();
21
25
  });
22
26
  it('should render as a primary ripple button', () => {
23
- const wrapper = mount(/*#__PURE__*/React.createElement(RippleButton, {
24
- type: "primary"
25
- }, "Press me"));
27
+ const wrapper = mount(/*#__PURE__*/_jsx(RippleButton, {
28
+ type: "primary",
29
+ children: "Press me"
30
+ }));
26
31
  expect(trim(wrapper.find(Button).props().className)).toEqual(`ui-shared__button ${styles.primary(false).button} ui-shared__ripple-button`);
27
32
  expect(wrapper.find(Ripple).render().text()).toEqual('Press me');
28
33
  expect(wrapper).toMatchSnapshot();
29
34
  });
30
35
  it('should render as a secondary ripple button', () => {
31
- const wrapper = mount(/*#__PURE__*/React.createElement(RippleButton, {
32
- type: "secondary"
33
- }, "Press me"));
36
+ const wrapper = mount(/*#__PURE__*/_jsx(RippleButton, {
37
+ type: "secondary",
38
+ children: "Press me"
39
+ }));
34
40
  expect(trim(wrapper.find(Button).props().className)).toEqual(`ui-shared__button ${styles.secondary(false).button} ui-shared__ripple-button`);
35
41
  expect(wrapper.find(Ripple).render().text()).toEqual('Press me');
36
42
  expect(wrapper).toMatchSnapshot();
37
43
  });
38
44
  it('should render as a disabled ripple button', () => {
39
- const wrapper = mount(/*#__PURE__*/React.createElement(RippleButton, {
40
- disabled: true
41
- }, "Press me"));
45
+ const wrapper = mount(/*#__PURE__*/_jsx(RippleButton, {
46
+ disabled: true,
47
+ children: "Press me"
48
+ }));
42
49
  expect(wrapper.find(Button).props().disabled).toBe(true);
43
50
  expect(wrapper).toMatchSnapshot();
44
51
  });
@@ -6,9 +6,12 @@ import styles from "./style";
6
6
  /**
7
7
  * @returns {JSX}
8
8
  */
9
- const CameraOverlay = () => /*#__PURE__*/React.createElement(SurroundPortals, {
10
- portalName: SCANNER_CAMERA
11
- }, /*#__PURE__*/React.createElement("div", {
12
- className: styles
13
- }, /*#__PURE__*/React.createElement("div", null)));
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const CameraOverlay = () => /*#__PURE__*/_jsx(SurroundPortals, {
11
+ portalName: SCANNER_CAMERA,
12
+ children: /*#__PURE__*/_jsx("div", {
13
+ className: styles,
14
+ children: /*#__PURE__*/_jsx("div", {})
15
+ })
16
+ });
14
17
  export default CameraOverlay;
@@ -9,28 +9,32 @@ import styles from "./style";
9
9
  * The FlashlightButton component.
10
10
  * @returns {JSX.Element}
11
11
  */
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
13
  const FlashlightButton = ({
13
14
  flashlightState,
14
15
  onToggle
15
- }) => /*#__PURE__*/React.createElement(SurroundPortals, {
16
- portalName: SCANNER_FLASH
17
- }, /*#__PURE__*/React.createElement("button", {
18
- className: styles.button,
19
- onClick: onToggle,
20
- role: "link",
21
- type: "button",
22
- "aria-label": i18n.text(flashlightState ? 'scanner.flashlight.switchOff' : 'scanner.flashlight.switchOn')
23
- }, /*#__PURE__*/React.createElement(ToggleIcon, {
24
- on: flashlightState,
25
- onIcon: /*#__PURE__*/React.createElement(FlashEnabledIcon, {
26
- className: styles.icon
27
- }),
28
- offIcon: /*#__PURE__*/React.createElement(FlashDisabledIcon, {
29
- className: styles.icon
30
- })
31
- })), /*#__PURE__*/React.createElement("div", {
32
- className: "sr-only",
33
- role: "status",
34
- "aria-live": "polite"
35
- }, i18n.text(flashlightState ? 'scanner.flashlight.on' : 'scanner.flashlight.off')));
16
+ }) => /*#__PURE__*/_jsxs(SurroundPortals, {
17
+ portalName: SCANNER_FLASH,
18
+ children: [/*#__PURE__*/_jsx("button", {
19
+ className: styles.button,
20
+ onClick: onToggle,
21
+ role: "link",
22
+ type: "button",
23
+ "aria-label": i18n.text(flashlightState ? 'scanner.flashlight.switchOff' : 'scanner.flashlight.switchOn'),
24
+ children: /*#__PURE__*/_jsx(ToggleIcon, {
25
+ on: flashlightState,
26
+ onIcon: /*#__PURE__*/_jsx(FlashEnabledIcon, {
27
+ className: styles.icon
28
+ }),
29
+ offIcon: /*#__PURE__*/_jsx(FlashDisabledIcon, {
30
+ className: styles.icon
31
+ })
32
+ })
33
+ }), /*#__PURE__*/_jsx("div", {
34
+ className: "sr-only",
35
+ role: "status",
36
+ "aria-live": "polite",
37
+ children: i18n.text(flashlightState ? 'scanner.flashlight.on' : 'scanner.flashlight.off')
38
+ })]
39
+ });
36
40
  export default FlashlightButton;
@@ -5,9 +5,11 @@ import { SCANNER_INSTRUCTIONS } from '@shopgate/engage/scanner/constants';
5
5
  * The Scanner Instructions component.
6
6
  * @returns {JSX.Element}
7
7
  */
8
- const ScannerInstructions = () => /*#__PURE__*/React.createElement(SurroundPortals, {
9
- portalName: SCANNER_INSTRUCTIONS
10
- }, /*#__PURE__*/React.createElement(I18n.Text, {
11
- string: "scanner.instructions"
12
- }));
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const ScannerInstructions = () => /*#__PURE__*/_jsx(SurroundPortals, {
10
+ portalName: SCANNER_INSTRUCTIONS,
11
+ children: /*#__PURE__*/_jsx(I18n.Text, {
12
+ string: "scanner.instructions"
13
+ })
14
+ });
13
15
  export default ScannerInstructions;
@@ -13,23 +13,28 @@ import styles from "./style";
13
13
  * @param {Function} props.onToggleFlashlight The toggle event triggered by the user.
14
14
  * @returns {React.ReactPortal} A React portal that renders the scanner bar in the AppFooter.
15
15
  */
16
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
17
  const ScannerBar = ({
17
18
  flashlightState,
18
19
  onToggleFlashlight
19
- }) => /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(SurroundPortals, {
20
+ }) => /*#__PURE__*/createPortal(/*#__PURE__*/_jsx(SurroundPortals, {
20
21
  portalName: SCANNER_BAR,
21
22
  portalProps: {
22
23
  flashlightState,
23
24
  onToggleFlashlight
24
- }
25
- }, /*#__PURE__*/React.createElement(Grid, {
26
- className: `${styles.container} ui-shared__scanner-bar`
27
- }, /*#__PURE__*/React.createElement(Grid.Item, {
28
- className: styles.column
29
- }, /*#__PURE__*/React.createElement(FlashlightButton, {
30
- onToggle: onToggleFlashlight,
31
- flashlightState: flashlightState
32
- })), /*#__PURE__*/React.createElement(Grid.Item, {
33
- className: styles.column
34
- }, /*#__PURE__*/React.createElement(ScannerInstructions, null)))), document.getElementById('AppFooter'));
25
+ },
26
+ children: /*#__PURE__*/_jsxs(Grid, {
27
+ className: `${styles.container} ui-shared__scanner-bar`,
28
+ children: [/*#__PURE__*/_jsx(Grid.Item, {
29
+ className: styles.column,
30
+ children: /*#__PURE__*/_jsx(FlashlightButton, {
31
+ onToggle: onToggleFlashlight,
32
+ flashlightState: flashlightState
33
+ })
34
+ }), /*#__PURE__*/_jsx(Grid.Item, {
35
+ className: styles.column,
36
+ children: /*#__PURE__*/_jsx(ScannerInstructions, {})
37
+ })]
38
+ })
39
+ }), document.getElementById('AppFooter'));
35
40
  export default ScannerBar;
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import React, { Fragment, PureComponent } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import AppScanner from '@shopgate/pwa-core/classes/Scanner';
@@ -7,44 +8,52 @@ import ScannerBar from "./components/ScannerBar";
7
8
  /**
8
9
  * The scanner overlay component.
9
10
  */
10
- class ScannerOverlay extends PureComponent {
11
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
12
+ let ScannerOverlay = /*#__PURE__*/function (_PureComponent) {
11
13
  /**
12
14
  * Initializes the component.
13
15
  * @param {Object} props The components props.
14
16
  */
15
- constructor(props) {
16
- super(props);
17
- this.handleToggleFlashlight = () => {
18
- this.setState({
17
+ function ScannerOverlay(props) {
18
+ var _this;
19
+ _this = _PureComponent.call(this, props) || this;
20
+ _this.handleToggleFlashlight = () => {
21
+ _this.setState({
19
22
  flashlight: AppScanner.toggleFlashlight()
20
23
  });
21
24
  };
22
- this.state = {
25
+ _this.state = {
23
26
  flashlight: props.flashlight
24
27
  };
28
+ return _this;
25
29
  }
26
30
 
27
31
  /**
28
32
  * @param {Object} nextProps New props to apply.
29
33
  */
30
- UNSAFE_componentWillReceiveProps(nextProps) {
34
+ _inheritsLoose(ScannerOverlay, _PureComponent);
35
+ var _proto = ScannerOverlay.prototype;
36
+ _proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
31
37
  if (this.state.flashlight !== nextProps.flashlight) {
32
38
  this.setState({
33
39
  flashlight: nextProps.flashlight
34
40
  });
35
41
  }
36
- }
42
+ };
37
43
  /**
38
44
  * Render the camera overlay and the bottom bar with its contents.
39
45
  * @returns {JSX}
40
46
  */
41
- render() {
42
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(CameraOverlay, null), /*#__PURE__*/React.createElement(ScannerBar, {
43
- flashlightState: this.state.flashlight,
44
- onToggleFlashlight: this.handleToggleFlashlight
45
- }));
46
- }
47
- }
47
+ _proto.render = function render() {
48
+ return /*#__PURE__*/_jsxs(_Fragment, {
49
+ children: [/*#__PURE__*/_jsx(CameraOverlay, {}), /*#__PURE__*/_jsx(ScannerBar, {
50
+ flashlightState: this.state.flashlight,
51
+ onToggleFlashlight: this.handleToggleFlashlight
52
+ })]
53
+ });
54
+ };
55
+ return ScannerOverlay;
56
+ }(PureComponent);
48
57
  ScannerOverlay.defaultProps = {
49
58
  flashlight: false
50
59
  };