@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
@@ -9,20 +9,22 @@ 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 = props => {
13
14
  const labelStyles = styles.labelStyles(props.isFocused, props.isFloating, props.hasErrorMessage);
14
15
  return (
15
16
  /*#__PURE__*/
16
17
  // eslint-disable-next-line jsx-a11y/label-has-associated-control
17
- React.createElement("label", {
18
+ _jsx("label", {
18
19
  htmlFor: props.name,
19
20
  "aria-hidden": true,
20
21
  className: classNames(labelStyles, 'label', {
21
22
  floating: props.isFloating
23
+ }),
24
+ children: /*#__PURE__*/_jsx(I18n.Text, {
25
+ string: props.label
22
26
  })
23
- }, /*#__PURE__*/React.createElement(I18n.Text, {
24
- string: props.label
25
- }))
27
+ })
26
28
  );
27
29
  };
28
30
  Label.defaultProps = {
@@ -8,13 +8,15 @@ import styles from "./style";
8
8
  * @param {Object} props The component props.
9
9
  * @return {JSX}
10
10
  */
11
- const Underline = props => /*#__PURE__*/React.createElement("div", {
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ const Underline = props => /*#__PURE__*/_jsx("div", {
12
13
  className: classNames(styles.underlineWrapper, 'underline'),
13
- "aria-hidden": true
14
- }, /*#__PURE__*/React.createElement("div", {
15
- className: styles.underline,
16
- style: styles.underlineStyle(props.isFocused, props.hasErrorMessage)
17
- }));
14
+ "aria-hidden": true,
15
+ children: /*#__PURE__*/_jsx("div", {
16
+ className: styles.underline,
17
+ style: styles.underlineStyle(props.isFocused, props.hasErrorMessage)
18
+ })
19
+ });
18
20
  Underline.defaultProps = {
19
21
  isFocused: false,
20
22
  hasErrorMessage: false
@@ -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';
@@ -11,30 +13,32 @@ import FormElement from "./components/FormElement/index";
11
13
  /**
12
14
  * A component that provides a styled text field for user input in material design.
13
15
  */
14
- class TextField extends Component {
16
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
+ let TextField = /*#__PURE__*/function (_Component) {
15
18
  /**
16
19
  * Creates a new text field component.
17
20
  * @param {Object} props The component properties.
18
21
  */
19
- constructor(props) {
20
- super(props);
22
+ function TextField(props) {
23
+ var _this;
24
+ _this = _Component.call(this, props) || this;
21
25
  /**
22
26
  * Internal focus event handler.
23
27
  * @param {boolean} isFocused Whether the input component is focused.
24
28
  */
25
- this.handleFocusChange = isFocused => {
26
- this.setState({
29
+ _this.handleFocusChange = isFocused => {
30
+ _this.setState({
27
31
  isFocused
28
32
  });
29
- this.props.onFocusChange(isFocused);
33
+ _this.props.onFocusChange(isFocused);
30
34
  };
31
35
  /**
32
36
  * Updates the state if the input value has been changed.
33
37
  * @param {string} value The entered text.
34
38
  * @param {Object} event The original event object.
35
39
  */
36
- this.handleChange = (value, event) => {
37
- this.props.onChange(value, event);
40
+ _this.handleChange = (value, event) => {
41
+ _this.props.onChange(value, event);
38
42
  };
39
43
  /**
40
44
  * Updates the validation error text if required.
@@ -42,8 +46,8 @@ class TextField extends Component {
42
46
  * @param {boolean} isInitial Whether this is the initial value of the input field.
43
47
  * @return {boolean} Whether the validation was successful.
44
48
  */
45
- this.handleValidate = (value, isInitial) => {
46
- const validationError = this.props.onValidate(value);
49
+ _this.handleValidate = (value, isInitial) => {
50
+ const validationError = _this.props.onValidate(value);
47
51
  if (validationError !== true && validationError) {
48
52
  /**
49
53
  * An error message was returned by the validation callback. Update the state.
@@ -51,15 +55,15 @@ class TextField extends Component {
51
55
  * sure we're not calling setState() in this situation.
52
56
  */
53
57
  if (!isInitial) {
54
- this.setState({
58
+ _this.setState({
55
59
  validationError
56
60
  });
57
61
  } else {
58
- this.state.validationError = validationError;
62
+ _this.state.validationError = validationError;
59
63
  }
60
- } else if (this.state.validationError) {
64
+ } else if (_this.state.validationError) {
61
65
  // There was no error, clear the state variable.
62
- this.setState({
66
+ _this.setState({
63
67
  validationError: null
64
68
  });
65
69
  }
@@ -67,48 +71,23 @@ class TextField extends Component {
67
71
  // Forward the boolean result to the input field.
68
72
  return validationError === true;
69
73
  };
70
- this.state = {
74
+ _this.state = {
71
75
  isFocused: false,
72
76
  validationError: null
73
77
  };
78
+ return _this;
74
79
  }
75
80
 
76
81
  /**
77
82
  * @returns {boolean} Whether the text field is currently focused.
78
83
  */
79
- get isFocused() {
80
- return this.state.isFocused;
81
- }
82
-
83
- /**
84
- * @returns {boolean} Whether the label is currently floating.
85
- */
86
- get isLabelFloating() {
87
- // On Firefox empty date inputs always show a placeholder with date pattern
88
- if (navigator.userAgent.includes('Firefox') && this.props.type === 'date') {
89
- return true;
90
- }
91
- return this.isFocused || !!this.props.value;
92
- }
93
-
94
- /**
95
- * @returns {boolean} Whether the hint text is currently visible.
96
- */
97
- get isHintVisible() {
98
- return this.isFocused && !this.props.value;
99
- }
100
-
101
- /**
102
- * @return {boolean} Whether the error message is set.
103
- */
104
- get hasErrorMessage() {
105
- return !!(this.state.validationError || this.props.errorText);
106
- }
84
+ _inheritsLoose(TextField, _Component);
85
+ var _proto = TextField.prototype;
107
86
  /**
108
87
  * Renders the text field.
109
88
  * @return {JSX.Element}
110
89
  */
111
- render() {
90
+ _proto.render = function render() {
112
91
  const styleType = this.props.multiLine ? 'multiLine' : 'input';
113
92
  const style = styles.container[styleType];
114
93
  const {
@@ -130,50 +109,88 @@ class TextField extends Component {
130
109
  translateErrorText,
131
110
  required
132
111
  } = this.props;
133
- return /*#__PURE__*/React.createElement("div", {
112
+ return /*#__PURE__*/_jsxs("div", {
134
113
  className: classNames(style, className, 'textField', 'ui-shared__text-field', {
135
114
  disabled
136
- })
137
- }, /*#__PURE__*/React.createElement(Hint, {
138
- visible: this.isHintVisible,
139
- hintText: hintText
140
- }), /*#__PURE__*/React.createElement(Label, {
141
- name: name,
142
- label: label,
143
- isFocused: this.isFocused,
144
- isFloating: this.isLabelFloating,
145
- hasErrorMessage: this.hasErrorMessage
146
- }), /*#__PURE__*/React.createElement(FormElement, {
147
- id: name,
148
- multiLine: multiLine,
149
- name: name,
150
- setRef: setRef,
151
- onFocusChange: this.handleFocusChange,
152
- onChange: this.handleChange,
153
- onSanitize: onSanitize,
154
- onValidate: this.handleValidate,
155
- password: password,
156
- type: type,
157
- value: value,
158
- isControlled: isControlled,
159
- inputComponent: inputComponent,
160
- disabled: disabled,
161
- required: required,
162
- attributes: {
163
- 'aria-invalid': !!errorText,
164
- 'aria-describedby': this.hasErrorMessage ? `ariaError-${name}` : null
115
+ }),
116
+ children: [/*#__PURE__*/_jsx(Hint, {
117
+ visible: this.isHintVisible,
118
+ hintText: hintText
119
+ }), /*#__PURE__*/_jsx(Label, {
120
+ name: name,
121
+ label: label,
122
+ isFocused: this.isFocused,
123
+ isFloating: this.isLabelFloating,
124
+ hasErrorMessage: this.hasErrorMessage
125
+ }), /*#__PURE__*/_jsx(FormElement, {
126
+ id: name,
127
+ multiLine: multiLine,
128
+ name: name,
129
+ setRef: setRef,
130
+ onFocusChange: this.handleFocusChange,
131
+ onChange: this.handleChange,
132
+ onSanitize: onSanitize,
133
+ onValidate: this.handleValidate,
134
+ password: password,
135
+ type: type,
136
+ value: value,
137
+ isControlled: isControlled,
138
+ inputComponent: inputComponent,
139
+ disabled: disabled,
140
+ required: required,
141
+ attributes: {
142
+ 'aria-invalid': !!errorText,
143
+ 'aria-describedby': this.hasErrorMessage ? `ariaError-${name}` : null
144
+ }
145
+ }), /*#__PURE__*/_jsx(Underline, {
146
+ isFocused: this.isFocused,
147
+ hasErrorMessage: this.hasErrorMessage
148
+ }), showErrorText && /*#__PURE__*/_jsx(ErrorText, {
149
+ validationError: this.state.validationError,
150
+ errorText: errorText,
151
+ translate: translateErrorText,
152
+ elementName: name
153
+ })]
154
+ });
155
+ };
156
+ return _createClass(TextField, [{
157
+ key: "isFocused",
158
+ get: function () {
159
+ return this.state.isFocused;
160
+ }
161
+
162
+ /**
163
+ * @returns {boolean} Whether the label is currently floating.
164
+ */
165
+ }, {
166
+ key: "isLabelFloating",
167
+ get: function () {
168
+ // On Firefox empty date inputs always show a placeholder with date pattern
169
+ if (navigator.userAgent.includes('Firefox') && this.props.type === 'date') {
170
+ return true;
165
171
  }
166
- }), /*#__PURE__*/React.createElement(Underline, {
167
- isFocused: this.isFocused,
168
- hasErrorMessage: this.hasErrorMessage
169
- }), showErrorText && /*#__PURE__*/React.createElement(ErrorText, {
170
- validationError: this.state.validationError,
171
- errorText: errorText,
172
- translate: translateErrorText,
173
- elementName: name
174
- }));
175
- }
176
- }
172
+ return this.isFocused || !!this.props.value;
173
+ }
174
+
175
+ /**
176
+ * @returns {boolean} Whether the hint text is currently visible.
177
+ */
178
+ }, {
179
+ key: "isHintVisible",
180
+ get: function () {
181
+ return this.isFocused && !this.props.value;
182
+ }
183
+
184
+ /**
185
+ * @return {boolean} Whether the error message is set.
186
+ */
187
+ }, {
188
+ key: "hasErrorMessage",
189
+ get: function () {
190
+ return !!(this.state.validationError || this.props.errorText);
191
+ }
192
+ }]);
193
+ }(Component);
177
194
  TextField.defaultProps = {
178
195
  className: '',
179
196
  errorText: '',
package/TextField/spec.js CHANGED
@@ -1,35 +1,40 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import React from 'react';
3
2
  import { mount } from 'enzyme';
4
3
  import TextField from "./index";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  const inputProps = {
6
6
  name: 'test-input'
7
7
  };
8
8
  describe('<TextField />', () => {
9
9
  it('should render a simple text field', () => {
10
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, inputProps));
10
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
11
+ ...inputProps
12
+ }));
11
13
  expect(wrapper).toMatchSnapshot();
12
14
  expect(wrapper.find('input').length).toBe(1);
13
15
  });
14
16
  it('should render the text field as password', () => {
15
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
17
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
18
+ ...inputProps,
16
19
  password: true
17
- })));
20
+ }));
18
21
  expect(wrapper).toMatchSnapshot();
19
22
  expect(wrapper.find('input[type="password"]').length).toBe(1);
20
23
  });
21
24
  it('should render the text field with a default value', () => {
22
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
25
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
26
+ ...inputProps,
23
27
  value: "FooBar"
24
- })));
28
+ }));
25
29
  expect(wrapper).toMatchSnapshot();
26
30
  expect(wrapper.find('input[value="FooBar"]').length).toBe(1);
27
31
  });
28
32
  it('should trigger the onChange callback', () => {
29
33
  const onChangeMock = jest.fn();
30
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
34
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
35
+ ...inputProps,
31
36
  onChange: onChangeMock
32
- })));
37
+ }));
33
38
  wrapper.find('input').simulate('change', {
34
39
  target: {
35
40
  value: 'a'
@@ -39,7 +44,9 @@ describe('<TextField />', () => {
39
44
  expect(wrapper.find('input').props().value).toEqual('a');
40
45
  });
41
46
  it('should receive the correct value while typing', () => {
42
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, inputProps));
47
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
48
+ ...inputProps
49
+ }));
43
50
  const input = wrapper.find('input');
44
51
  input.simulate('change', {
45
52
  target: {
@@ -50,9 +57,10 @@ describe('<TextField />', () => {
50
57
  expect(input.instance().value).toBe('foobar');
51
58
  });
52
59
  it('should sanitize the input', () => {
53
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
60
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
61
+ ...inputProps,
54
62
  onSanitize: value => value.toUpperCase()
55
- })));
63
+ }));
56
64
  const input = wrapper.find('input');
57
65
  input.simulate('change', {
58
66
  target: {
@@ -64,17 +72,19 @@ describe('<TextField />', () => {
64
72
  });
65
73
  it('should trigger the validation callback', () => {
66
74
  const onValidateMock = jest.fn();
67
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
75
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
76
+ ...inputProps,
68
77
  onValidate: onValidateMock
69
- })));
78
+ }));
70
79
  expect(wrapper).toMatchSnapshot();
71
80
  expect(onValidateMock).toHaveBeenCalled();
72
81
  });
73
82
  it('should focus the input', () => {
74
83
  const onFocusMock = jest.fn();
75
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
84
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
85
+ ...inputProps,
76
86
  onFocusChange: onFocusMock
77
- })));
87
+ }));
78
88
  const input = wrapper.find('input');
79
89
  expect(wrapper).toMatchSnapshot();
80
90
  expect(wrapper.instance().isFocused).toBe(false);
@@ -85,25 +95,28 @@ describe('<TextField />', () => {
85
95
  });
86
96
  it('should show the error message', () => {
87
97
  const errorText = 'This is an error here';
88
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
98
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
99
+ ...inputProps,
89
100
  errorText: errorText
90
- })));
101
+ }));
91
102
  expect(wrapper).toMatchSnapshot();
92
103
  expect(wrapper.find('Translate').at(2).props().string).toEqual(errorText);
93
104
  });
94
105
  it('should show the label', () => {
95
106
  const label = 'This is the label';
96
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
107
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
108
+ ...inputProps,
97
109
  label: label
98
- })));
110
+ }));
99
111
  expect(wrapper).toMatchSnapshot();
100
112
  expect(wrapper.find('Label').find('Translate').props().string).toEqual(label);
101
113
  });
102
114
  it('should show the hint text', () => {
103
115
  const hintText = 'This is the hint text';
104
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
116
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
117
+ ...inputProps,
105
118
  hintText: hintText
106
- })));
119
+ }));
107
120
  expect(wrapper).toMatchSnapshot();
108
121
  expect(wrapper.find('Hint').find('Translate').at(0).props().string).toEqual(hintText);
109
122
  });
@@ -113,9 +126,10 @@ describe('<TextField />', () => {
113
126
  * @return {string} The error message.
114
127
  */
115
128
  const onValidate = () => 'Custom validation error';
116
- const wrapper = mount(/*#__PURE__*/React.createElement(TextField, _extends({}, inputProps, {
129
+ const wrapper = mount(/*#__PURE__*/_jsx(TextField, {
130
+ ...inputProps,
117
131
  onValidate: onValidate
118
- })));
132
+ }));
119
133
  wrapper.find('input').simulate('blur');
120
134
  expect(wrapper).toMatchSnapshot();
121
135
  // Expect at least one element containing the validation error text.
@@ -1,48 +1,54 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import React, { Component } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
 
4
5
  /**
5
6
  * No operational default handler
6
7
  */
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
9
  const noop = () => {};
8
10
 
9
11
  /**
10
12
  * An toggle icon with toggle handlers.
11
13
  */
12
- class ToggleIcon extends Component {
14
+ let ToggleIcon = /*#__PURE__*/function (_Component) {
13
15
  /**
14
16
  * @param {Object} props The component properties.
15
17
  */
16
- constructor(props) {
17
- super(props);
18
+ function ToggleIcon(props) {
19
+ var _this;
20
+ _this = _Component.call(this, props) || this;
18
21
  /**
19
22
  * Toggle icon
20
23
  */
21
- this.handleToggle = () => {
22
- this.setState(({
24
+ _this.handleToggle = () => {
25
+ _this.setState(({
23
26
  on
24
27
  }) => ({
25
28
  on: !on
26
- }), () => this.props.toggleHandler(this.state.on));
29
+ }), () => _this.props.toggleHandler(_this.state.on));
27
30
  };
28
- this.state = {
31
+ _this.state = {
29
32
  on: props.on
30
33
  };
34
+ return _this;
31
35
  }
32
36
 
33
37
  /**
34
38
  * Reset state to received props
35
39
  * @param {Object} nextProps next props
36
40
  */
37
- UNSAFE_componentWillReceiveProps(nextProps) {
41
+ _inheritsLoose(ToggleIcon, _Component);
42
+ var _proto = ToggleIcon.prototype;
43
+ _proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
38
44
  this.setState({
39
45
  on: nextProps.on
40
46
  });
41
- }
47
+ };
42
48
  /**
43
49
  * @return {*}
44
50
  */
45
- render() {
51
+ _proto.render = function render() {
46
52
  const {
47
53
  onIcon,
48
54
  offIcon
@@ -50,13 +56,15 @@ class ToggleIcon extends Component {
50
56
  const {
51
57
  on
52
58
  } = this.state;
53
- return /*#__PURE__*/React.createElement("div", {
59
+ return /*#__PURE__*/_jsxs("div", {
54
60
  className: "ui-shared__toggle-icon",
55
61
  onClick: this.handleToggle,
56
- "aria-hidden": true
57
- }, on && onIcon, !on && offIcon);
58
- }
59
- }
62
+ "aria-hidden": true,
63
+ children: [on && onIcon, !on && offIcon]
64
+ });
65
+ };
66
+ return ToggleIcon;
67
+ }(Component);
60
68
  ToggleIcon.defaultProps = {
61
69
  on: true,
62
70
  toggleHandler: noop
@@ -1,33 +1,37 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import React from 'react';
3
2
  import { mount } from 'enzyme';
4
3
  import ToggleIcon from "./index";
5
4
  import VisibilityIcon from "../icons/VisibilityIcon";
6
5
  import VisibilityOffIcon from "../icons/VisibilityOffIcon";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const inputProps = {
8
- onIcon: /*#__PURE__*/React.createElement(VisibilityIcon, null),
9
- offIcon: /*#__PURE__*/React.createElement(VisibilityOffIcon, null)
8
+ onIcon: /*#__PURE__*/_jsx(VisibilityIcon, {}),
9
+ offIcon: /*#__PURE__*/_jsx(VisibilityOffIcon, {})
10
10
  };
11
11
  describe('<ToggleIcon>', () => {
12
12
  it('should render a toggle icon', () => {
13
- const wrapper = mount(/*#__PURE__*/React.createElement(ToggleIcon, inputProps));
13
+ const wrapper = mount(/*#__PURE__*/_jsx(ToggleIcon, {
14
+ ...inputProps
15
+ }));
14
16
  expect(wrapper).toMatchSnapshot();
15
17
  expect(wrapper.find('VisibilityIcon').length).toBe(1);
16
18
  expect(wrapper.find('VisibilityOffIcon').length).toBe(0);
17
19
  });
18
20
  it('should render a toggle icon with false as default', () => {
19
- const wrapper = mount(/*#__PURE__*/React.createElement(ToggleIcon, _extends({}, inputProps, {
21
+ const wrapper = mount(/*#__PURE__*/_jsx(ToggleIcon, {
22
+ ...inputProps,
20
23
  on: false
21
- })));
24
+ }));
22
25
  expect(wrapper).toMatchSnapshot();
23
26
  expect(wrapper.find('VisibilityIcon').length).toBe(0);
24
27
  expect(wrapper.find('VisibilityOffIcon').length).toBe(1);
25
28
  });
26
29
  it('should trigger the toggleHandler callback', () => {
27
30
  const mockToggleHandler = jest.fn();
28
- const wrapper = mount(/*#__PURE__*/React.createElement(ToggleIcon, _extends({}, inputProps, {
31
+ const wrapper = mount(/*#__PURE__*/_jsx(ToggleIcon, {
32
+ ...inputProps,
29
33
  toggleHandler: mockToggleHandler
30
- })));
34
+ }));
31
35
  wrapper.find('div').simulate('click');
32
36
  expect(wrapper).toMatchSnapshot();
33
37
  expect(mockToggleHandler.mock.calls.length).toBe(1);
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import React from 'react';
3
2
  import Icon from '@shopgate/pwa-common/components/Icon';
4
3
  import { themeConfig } from '@shopgate/pwa-common/helpers/config';
@@ -8,7 +7,9 @@ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
8
7
  * @param {Object} props The icon component properties.
9
8
  * @returns {JSX}
10
9
  */
11
- const AccountBox = props => /*#__PURE__*/React.createElement(Icon, _extends({
12
- content: themeConfig.icons.accountBox
13
- }, props));
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const AccountBox = props => /*#__PURE__*/_jsx(Icon, {
12
+ content: themeConfig.icons.accountBox,
13
+ ...props
14
+ });
14
15
  export default AccountBox;
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import React from 'react';
3
2
  import Icon from '@shopgate/pwa-common/components/Icon';
4
3
  import { themeConfig } from '@shopgate/pwa-common/helpers/config';
@@ -8,7 +7,9 @@ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
8
7
  * @param {Object} props The icon component properties.
9
8
  * @returns {JSX}
10
9
  */
11
- const AddMore = props => /*#__PURE__*/React.createElement(Icon, _extends({
12
- content: themeConfig.icons.addMore
13
- }, props));
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const AddMore = props => /*#__PURE__*/_jsx(Icon, {
12
+ content: themeConfig.icons.addMore,
13
+ ...props
14
+ });
14
15
  export default AddMore;
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import React from 'react';
3
2
  import Icon from '@shopgate/pwa-common/components/Icon';
4
3
  import { themeConfig } from '@shopgate/pwa-common/helpers/config';
@@ -8,7 +7,9 @@ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
8
7
  * @param {Object} props The icon component properties.
9
8
  * @returns {JSX}
10
9
  */
11
- const ArrowDrop = props => /*#__PURE__*/React.createElement(Icon, _extends({
12
- content: themeConfig.icons.arrowDrop
13
- }, props));
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const ArrowDrop = props => /*#__PURE__*/_jsx(Icon, {
12
+ content: themeConfig.icons.arrowDrop,
13
+ ...props
14
+ });
14
15
  export default ArrowDrop;
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import React from 'react';
3
2
  import PropTypes from 'prop-types';
4
3
  import Icon from '@shopgate/pwa-common/components/Icon';
@@ -10,14 +9,16 @@ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
10
9
  * @param {boolean} props.shadow Whether to show a shadow under the arrow.
11
10
  * @returns {JSX}
12
11
  */
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  const ArrowIcon = ({
14
14
  shadow,
15
15
  ...props
16
16
  }) => {
17
17
  const content = shadow ? themeConfig.icons.arrowShadowed : themeConfig.icons.arrow;
18
- return /*#__PURE__*/React.createElement(Icon, _extends({
19
- content: content
20
- }, props));
18
+ return /*#__PURE__*/_jsx(Icon, {
19
+ content: content,
20
+ ...props
21
+ });
21
22
  };
22
23
  ArrowIcon.defaultProps = {
23
24
  shadow: false