@shopgate/pwa-common 7.30.0-alpha.8 → 7.30.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/App.js +28 -13
  2. package/actions/app/handleUniversalLink.js +0 -2
  3. package/collections/AuthRoutes.js +15 -13
  4. package/collections/Configuration.js +11 -10
  5. package/collections/EmbeddedMedia.js +21 -19
  6. package/collections/PersistedReducers.js +11 -9
  7. package/collections/Redirects.js +15 -13
  8. package/collections/media-providers/MediaProvider.js +23 -21
  9. package/collections/media-providers/Vimeo.js +28 -22
  10. package/collections/media-providers/YouTube.js +17 -10
  11. package/components/Backdrop/index.js +15 -13
  12. package/components/Backdrop/spec.js +3 -2
  13. package/components/Button/index.js +41 -29
  14. package/components/Button/spec.js +16 -10
  15. package/components/Checkbox/index.js +36 -28
  16. package/components/Checkbox/spec.js +40 -27
  17. package/components/Consume/index.js +4 -1
  18. package/components/CountdownTimer/index.js +27 -20
  19. package/components/CountdownTimer/spec.js +39 -38
  20. package/components/Drawer/index.js +31 -23
  21. package/components/Drawer/spec.js +7 -6
  22. package/components/Dropdown/index.js +27 -18
  23. package/components/Ellipsis/index.js +5 -3
  24. package/components/Ellipsis/spec.js +5 -3
  25. package/components/EmbeddedMedia/index.js +9 -6
  26. package/components/EmbeddedMedia/spec.js +11 -2
  27. package/components/ErrorBoundary/index.js +26 -16
  28. package/components/Grid/components/Item/index.js +13 -6
  29. package/components/Grid/components/Item/spec.js +4 -3
  30. package/components/Grid/index.js +13 -6
  31. package/components/Grid/spec.js +4 -3
  32. package/components/HtmlSanitizer/index.js +42 -45
  33. package/components/HtmlSanitizer/spec.js +31 -21
  34. package/components/I18n/components/FormatDate/index.js +11 -4
  35. package/components/I18n/components/FormatDate/spec.js +22 -14
  36. package/components/I18n/components/FormatNumber/index.js +8 -6
  37. package/components/I18n/components/FormatNumber/spec.js +10 -5
  38. package/components/I18n/components/FormatPrice/index.js +5 -3
  39. package/components/I18n/components/FormatPrice/spec.js +22 -14
  40. package/components/I18n/components/FormatTime/index.js +11 -4
  41. package/components/I18n/components/FormatTime/spec.js +22 -14
  42. package/components/I18n/components/I18nProvider/index.js +18 -11
  43. package/components/I18n/components/I18nProvider/spec.js +2 -1
  44. package/components/I18n/components/Placeholder/index.js +10 -3
  45. package/components/I18n/components/Placeholder/spec.js +12 -5
  46. package/components/I18n/components/Translate/index.js +12 -8
  47. package/components/I18n/components/Translate/spec.js +9 -6
  48. package/components/Icon/index.js +2 -1
  49. package/components/Image/Image.js +23 -21
  50. package/components/Image/ImageInner.js +2 -1
  51. package/components/InfiniteContainer/index.js +59 -53
  52. package/components/InfiniteContainer/spec.js +10 -5
  53. package/components/Input/components/MultiLineInput.js +33 -26
  54. package/components/Input/components/SimpleInput.js +70 -54
  55. package/components/Input/index.js +7 -17
  56. package/components/Input/spec.js +12 -11
  57. package/components/KeyboardConsumer/index.js +19 -13
  58. package/components/Link/index.js +28 -20
  59. package/components/Link/spec.js +13 -9
  60. package/components/List/components/Item/index.js +5 -3
  61. package/components/List/index.js +5 -3
  62. package/components/List/spec.js +6 -9
  63. package/components/Loading/index.js +1 -3
  64. package/components/Modal/index.js +13 -10
  65. package/components/ModalContainer/spec.js +24 -20
  66. package/components/Picker/components/Button/index.js +18 -12
  67. package/components/Picker/components/List/index.js +19 -16
  68. package/components/Picker/components/Modal/index.js +34 -25
  69. package/components/Picker/index.js +44 -33
  70. package/components/Picker/spec.js +4 -1
  71. package/components/Portal/index.js +26 -17
  72. package/components/ProductCharacteristics/index.js +65 -57
  73. package/components/RangeSlider/components/Handle/index.js +7 -5
  74. package/components/RangeSlider/index.js +98 -84
  75. package/components/Route/RouteNotFound.js +30 -19
  76. package/components/Route/index.js +31 -21
  77. package/components/Router/index.js +51 -34
  78. package/components/ScannerContainer/index.js +17 -10
  79. package/components/Select/components/Item/index.js +5 -3
  80. package/components/Select/index.js +59 -47
  81. package/components/Select/spec.js +7 -6
  82. package/components/SelectBox/components/Item/index.js +23 -13
  83. package/components/SelectBox/index.js +83 -80
  84. package/components/SelectBox/spec.js +8 -5
  85. package/components/SurroundPortals/index.js +15 -11
  86. package/components/Swiper/components/SwiperItem/index.js +6 -5
  87. package/components/Swiper/components/SwiperItem/spec.js +12 -4
  88. package/components/Swiper/index.js +23 -20
  89. package/components/Toaster/index.js +4 -1
  90. package/components/Transition/index.js +19 -12
  91. package/components/Widgets/components/Widget/index.js +27 -16
  92. package/components/Widgets/components/Widget/spec.js +6 -5
  93. package/components/Widgets/components/WidgetGrid/index.js +27 -19
  94. package/components/Widgets/components/WidgetGrid/spec.js +5 -4
  95. package/components/Widgets/index.js +33 -26
  96. package/components/Widgets/spec.js +32 -18
  97. package/helpers/data/index.js +1 -1
  98. package/helpers/portals/portalCollection.js +13 -10
  99. package/helpers/redux/mutable.js +2 -2
  100. package/package.json +5 -6
  101. package/providers/loading/index.js +71 -57
  102. package/providers/toast/index.js +39 -28
  103. package/reducers/modal/index.js +1 -1
  104. package/store/index.js +1 -1
  105. package/subscriptions/helpers/buildRegisterUrl.js +1 -0
  106. package/components/Input/components/DateInput.js +0 -273
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import "core-js/modules/es.string.replace.js";
2
3
  import React from 'react';
3
4
  import PropTypes from 'prop-types';
@@ -16,6 +17,7 @@ import connect from "./connector";
16
17
  * Adds additional history listeners to compensate bugs and improve the behaviour within
17
18
  * browser environments.
18
19
  */
20
+ import { jsx as _jsx } from "react/jsx-runtime";
19
21
  const createBrowserListeners = () => {
20
22
  const {
21
23
  history
@@ -63,17 +65,18 @@ const createBrowserListeners = () => {
63
65
  /**
64
66
  * The Router component.
65
67
  */
66
- class Router extends React.Component {
68
+ let Router = /*#__PURE__*/function (_React$Component) {
67
69
  /**
68
70
  * @param {Object} props The component props.
69
71
  */
70
- constructor(props) {
71
- super(props);
72
+ function Router(props) {
73
+ var _this;
74
+ _this = _React$Component.call(this, props) || this;
72
75
  /**
73
76
  * Updates the user initialized component state
74
77
  */
75
- this.setUserInitialized = () => {
76
- this.setState({
78
+ _this.setUserInitialized = () => {
79
+ _this.setState({
77
80
  userInitialized: true
78
81
  });
79
82
  };
@@ -81,7 +84,7 @@ class Router extends React.Component {
81
84
  * Determines the current location from the browser history
82
85
  * @returns {string}
83
86
  */
84
- this.getHistoryLocation = () => {
87
+ _this.getHistoryLocation = () => {
85
88
  const {
86
89
  hash,
87
90
  pathname,
@@ -93,11 +96,11 @@ class Router extends React.Component {
93
96
  * Determines if the current route is a protected route
94
97
  * @returns {null|string}
95
98
  */
96
- this.getRouteProtector = () => authRoutes.getProtector(this.getHistoryLocation());
99
+ _this.getRouteProtector = () => authRoutes.getProtector(_this.getHistoryLocation());
97
100
  /**
98
101
  * @param {Object} data Data for the update method
99
102
  */
100
- this.update = data => {
103
+ _this.update = data => {
101
104
  const {
102
105
  prev,
103
106
  next
@@ -107,12 +110,12 @@ class Router extends React.Component {
107
110
  * The only change right now compared to the original component. When invoked for "onUpdate"
108
111
  * only the updated route is passed instead of an object with prev and next.
109
112
  */
110
- this.setState({
113
+ _this.setState({
111
114
  updated: Date.now()
112
115
  });
113
116
  return;
114
117
  }
115
- this.setState({
118
+ _this.setState({
116
119
  prev: prev ? prev.id : null,
117
120
  next: next.id,
118
121
  updated: Date.now()
@@ -121,22 +124,24 @@ class Router extends React.Component {
121
124
  if (typeof props.history === 'function') {
122
125
  router.constructor(props.history);
123
126
  }
124
- this.state = {
127
+ _this.contextValue = null;
128
+ _this.state = {
125
129
  prev: null,
126
130
  next: null,
127
131
  updated: null,
128
132
  userInitialized: false,
129
- initialRouteProtected: !!this.getRouteProtector()
133
+ initialRouteProtected: !!_this.getRouteProtector()
130
134
  };
131
- UIEvents.addListener(EVENT_USER_INITIALIZED, this.setUserInitialized);
132
- onDidPush(this.update);
133
- onDidPop(this.update);
134
- onDidReplace(this.update);
135
- onDidReset(this.update);
136
- onUpdate(this.update);
135
+ UIEvents.addListener(EVENT_USER_INITIALIZED, _this.setUserInitialized);
136
+ onDidPush(_this.update);
137
+ onDidPop(_this.update);
138
+ onDidReplace(_this.update);
139
+ onDidReset(_this.update);
140
+ onUpdate(_this.update);
137
141
  if (hasWebBridge() || hasSGJavaScriptBridge()) {
138
142
  createBrowserListeners();
139
143
  }
144
+ return _this;
140
145
  }
141
146
 
142
147
  /**
@@ -144,7 +149,9 @@ class Router extends React.Component {
144
149
  * @param {Object} nextState The next component state.
145
150
  * @returns {boolean}
146
151
  */
147
- shouldComponentUpdate(nextProps, nextState) {
152
+ _inheritsLoose(Router, _React$Component);
153
+ var _proto = Router.prototype;
154
+ _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
148
155
  const {
149
156
  isUserLoggedIn
150
157
  } = this.props;
@@ -159,8 +166,8 @@ class Router extends React.Component {
159
166
  * Replaces the initial route with a protector if necessary
160
167
  * @param {Object} nextProps The next component props
161
168
  * @param {Object} nextState The next components state
162
- */
163
- UNSAFE_componentWillUpdate(nextProps, nextState) {
169
+ */;
170
+ _proto.UNSAFE_componentWillUpdate = function UNSAFE_componentWillUpdate(nextProps, nextState) {
164
171
  const {
165
172
  isUserLoggedIn
166
173
  } = nextProps;
@@ -203,6 +210,8 @@ class Router extends React.Component {
203
210
  }
204
211
  }
205
212
  });
213
+
214
+ // eslint-disable-next-line react/no-will-update-set-state
206
215
  this.setState({
207
216
  initialRouteProtected: false
208
217
  });
@@ -211,14 +220,14 @@ class Router extends React.Component {
211
220
 
212
221
  /**
213
222
  * Removes the listener for the EVENT_USER_INITIALIZED event
214
- */
215
- componentWillUnmount() {
223
+ */;
224
+ _proto.componentWillUnmount = function componentWillUnmount() {
216
225
  UIEvents.removeListener(EVENT_USER_INITIALIZED, this.setUserInitialized);
217
- }
226
+ };
218
227
  /**
219
228
  * @returns {JSX}
220
229
  */
221
- render() {
230
+ _proto.render = function render() {
222
231
  const {
223
232
  children
224
233
  } = this.props;
@@ -236,15 +245,23 @@ class Router extends React.Component {
236
245
  return null;
237
246
  }
238
247
  const stack = Array.from(routeStack.getAll());
239
- return /*#__PURE__*/React.createElement(RouterContext.Provider, {
240
- value: {
241
- prev,
242
- next,
243
- stack
244
- }
245
- }, children);
246
- }
247
- }
248
+ const nextContextValue = {
249
+ prev,
250
+ next,
251
+ stack
252
+ };
253
+
254
+ // Only update the reference if something actually changed.
255
+ if (!this.contextValue || this.contextValue.prev !== prev || this.contextValue.next !== next || this.contextValue.stack !== stack) {
256
+ this.contextValue = nextContextValue;
257
+ }
258
+ return /*#__PURE__*/_jsx(RouterContext.Provider, {
259
+ value: this.contextValue,
260
+ children: children
261
+ });
262
+ };
263
+ return Router;
264
+ }(React.Component);
248
265
  Router.defaultProps = {
249
266
  history: null,
250
267
  isUserLoggedIn: false
@@ -1,4 +1,5 @@
1
- import React, { Fragment, PureComponent } from 'react';
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
+ import { PureComponent } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import AppScanner from '@shopgate/pwa-core/classes/Scanner';
4
5
  import connect from "./connector";
@@ -7,11 +8,16 @@ import connect from "./connector";
7
8
  * Wraps the Scanner overlay with functionality to automatically open and close the scanner,
8
9
  * as well as triggering the removal and reset of the background.
9
10
  */
10
- class ScannerContainer extends PureComponent {
11
+ let ScannerContainer = /*#__PURE__*/function (_PureComponent) {
12
+ function ScannerContainer() {
13
+ return _PureComponent.apply(this, arguments) || this;
14
+ }
15
+ _inheritsLoose(ScannerContainer, _PureComponent);
16
+ var _proto = ScannerContainer.prototype;
11
17
  /**
12
18
  * Starts up the app scanner.
13
19
  */
14
- async componentDidMount() {
20
+ _proto.componentDidMount = async function componentDidMount() {
15
21
  // Avoid trying to open the scanner if the app does not support it.
16
22
  if (!this.props.hasScannerSupport) {
17
23
  return;
@@ -22,8 +28,8 @@ class ScannerContainer extends PureComponent {
22
28
 
23
29
  /**
24
30
  * Shut down the app scanner.
25
- */
26
- componentWillUnmount() {
31
+ */;
32
+ _proto.componentWillUnmount = function componentWillUnmount() {
27
33
  if (!this.props.hasScannerSupport) {
28
34
  return;
29
35
  }
@@ -34,11 +40,12 @@ class ScannerContainer extends PureComponent {
34
40
  /**
35
41
  * Does not render anything when the app does not support the scanner.
36
42
  * @returns {JSX}
37
- */
38
- render() {
39
- return /*#__PURE__*/React.createElement(Fragment, null, this.props.hasScannerSupport && this.props.children);
40
- }
41
- }
43
+ */;
44
+ _proto.render = function render() {
45
+ return this.props.hasScannerSupport && this.props.children;
46
+ };
47
+ return ScannerContainer;
48
+ }(PureComponent);
42
49
  ScannerContainer.defaultProps = {
43
50
  children: null,
44
51
  scannerDidClose: () => {},
@@ -8,10 +8,12 @@ import styles from "./style";
8
8
  * @param {React.Children} props.children - Some content to display inside.
9
9
  * @returns {JSX}
10
10
  */
11
- const SelectItem = props => /*#__PURE__*/React.createElement("div", {
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ const SelectItem = props => /*#__PURE__*/_jsx("div", {
12
13
  className: `${styles} ${props.className}`,
13
- onTouchEnd: () => props.onSelect(props.value, props.label)
14
- }, props.label);
14
+ onTouchEnd: () => props.onSelect(props.value, props.label),
15
+ children: props.label
16
+ });
15
17
 
16
18
  /**
17
19
  * The component prop types.
@@ -1,7 +1,9 @@
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 styles from "./style";
4
5
  import SelectItem from "./components/Item";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
7
  const DEFAULT_PLACEHOLDER_TEXT = 'Select ...';
6
8
 
7
9
  /**
@@ -28,23 +30,24 @@ const normalizeItem = item => ({
28
30
  * @param {Object} props - The component props.
29
31
  * @param {React.Children} props.children - Some content to display inside.
30
32
  */
31
- class Select extends Component {
33
+ let Select = /*#__PURE__*/function (_Component) {
32
34
  /**
33
35
  * The constructor.
34
36
  * @param {Object} props - The component props.
35
37
  */
36
- constructor(props) {
37
- super(props);
38
+ function Select(props) {
39
+ var _this;
40
+ _this = _Component.call(this, props) || this;
38
41
  /**
39
42
  * Triggers the onChange callback if the selected value has changed.
40
43
  * @param {Object} nextState - The next state.
41
44
  */
42
- this.triggerChangeCallback = nextState => {
43
- if (this.state.selected && this.state.selected.value === nextState.selected.value) {
45
+ _this.triggerChangeCallback = nextState => {
46
+ if (_this.state.selected && _this.state.selected.value === nextState.selected.value) {
44
47
  return;
45
48
  }
46
- if (this.props.onChange instanceof Function) {
47
- this.props.onChange(nextState.selected.value);
49
+ if (_this.props.onChange instanceof Function) {
50
+ _this.props.onChange(nextState.selected.value);
48
51
  }
49
52
  };
50
53
  /**
@@ -52,9 +55,9 @@ class Select extends Component {
52
55
  * In this case the select gets closed.
53
56
  * @param {Event} event - The event of the user interaction (e.g. TouchEvent).
54
57
  */
55
- this.handleInteractionOutside = event => {
56
- if (!this.domElement.contains(event.target)) {
57
- this.setState({
58
+ _this.handleInteractionOutside = event => {
59
+ if (!_this.domElement.contains(event.target)) {
60
+ _this.setState({
58
61
  isOpen: false
59
62
  });
60
63
  }
@@ -64,7 +67,7 @@ class Select extends Component {
64
67
  * @param {*} value - The selected value.
65
68
  * @param {string} label - The selected label.
66
69
  */
67
- this.handleItemSelect = (value, label) => {
70
+ _this.handleItemSelect = (value, label) => {
68
71
  const stateUpdate = {
69
72
  selected: {
70
73
  label,
@@ -72,41 +75,44 @@ class Select extends Component {
72
75
  },
73
76
  isOpen: false
74
77
  };
75
- this.triggerChangeCallback(stateUpdate);
76
- this.setState(stateUpdate);
78
+ _this.triggerChangeCallback(stateUpdate);
79
+ _this.setState(stateUpdate);
77
80
  };
78
81
  /**
79
82
  * Toggles the open state of the component.
80
83
  */
81
- this.toggleOpenState = () => {
82
- this.setState(({
84
+ _this.toggleOpenState = () => {
85
+ _this.setState(({
83
86
  isOpen
84
87
  }) => ({
85
88
  isOpen: !isOpen
86
89
  }));
87
90
  };
88
- this.state = {
91
+ _this.state = {
89
92
  selected: null,
90
93
  isOpen: false
91
94
  };
92
- this.domElement = null;
95
+ _this.domElement = null;
93
96
  if (props.value) {
94
- this.state.selected = normalizeItem(findItemByValue(props.items, props.value));
97
+ _this.state.selected = normalizeItem(findItemByValue(props.items, props.value));
95
98
  }
99
+ return _this;
96
100
  }
97
101
 
98
102
  /**
99
103
  * Adds event listener when the component is mounted.
100
104
  */
101
- componentDidMount() {
105
+ _inheritsLoose(Select, _Component);
106
+ var _proto = Select.prototype;
107
+ _proto.componentDidMount = function componentDidMount() {
102
108
  document.addEventListener('touchstart', this.handleInteractionOutside);
103
109
  }
104
110
 
105
111
  /**
106
112
  * Updates the selected item when the value prop changes.
107
113
  * @param {Object} nextProps - The next props.
108
- */
109
- UNSAFE_componentWillReceiveProps(nextProps) {
114
+ */;
115
+ _proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
110
116
  if (!this.state.selected || nextProps.value !== this.state.selected.value) {
111
117
  this.state.selected = normalizeItem(findItemByValue(nextProps.items, nextProps.value));
112
118
  }
@@ -114,42 +120,48 @@ class Select extends Component {
114
120
 
115
121
  /**
116
122
  * Removes event listener when the component will unmount.
117
- */
118
- componentWillUnmount() {
123
+ */;
124
+ _proto.componentWillUnmount = function componentWillUnmount() {
119
125
  document.removeEventListener('touchstart', this.handleInteractionOutside);
120
- }
126
+ };
121
127
  /**
122
128
  * Renders the component.
123
129
  * @returns {JSX}
124
130
  */
125
- render() {
131
+ _proto.render = function render() {
126
132
  const hasSelection = this.state.selected && this.state.selected.value !== undefined;
127
133
  const selectedLabel = hasSelection ? this.state.selected.label : this.props.placeholder;
128
- const items = this.state.isOpen ? /*#__PURE__*/React.createElement("div", {
129
- className: styles.items
130
- }, this.props.items.map(item => {
131
- const normalizedItem = normalizeItem(item);
132
- const selected = hasSelection && this.state.selected.value === normalizedItem.value;
133
- return /*#__PURE__*/React.createElement(SelectItem, {
134
- key: normalizedItem.value,
135
- value: normalizedItem.value,
136
- label: normalizedItem.label,
137
- selected: selected,
138
- onSelect: this.handleItemSelect
139
- });
140
- })) : null;
141
- return /*#__PURE__*/React.createElement("div", {
134
+ const items = this.state.isOpen ? /*#__PURE__*/_jsx("div", {
135
+ className: styles.items,
136
+ children: this.props.items.map(item => {
137
+ const normalizedItem = normalizeItem(item);
138
+ const selected = hasSelection && this.state.selected.value === normalizedItem.value;
139
+ return /*#__PURE__*/_jsx(SelectItem, {
140
+ value: normalizedItem.value,
141
+ label: normalizedItem.label,
142
+ selected: selected,
143
+ onSelect: this.handleItemSelect
144
+ }, normalizedItem.value);
145
+ })
146
+ }) : null;
147
+ return /*#__PURE__*/_jsxs("div", {
142
148
  className: `${styles.container} ${this.props.className} common_select`,
143
149
  ref: ref => {
144
150
  this.domElement = ref;
145
- }
146
- }, /*#__PURE__*/React.createElement("div", {
147
- onTouchStart: this.toggleOpenState
148
- }, /*#__PURE__*/React.createElement("span", null, selectedLabel), /*#__PURE__*/React.createElement("span", {
149
- className: styles.selectHandle
150
- }, "\u25BE")), items);
151
- }
152
- }
151
+ },
152
+ children: [/*#__PURE__*/_jsxs("div", {
153
+ onTouchStart: this.toggleOpenState,
154
+ children: [/*#__PURE__*/_jsx("span", {
155
+ children: selectedLabel
156
+ }), /*#__PURE__*/_jsx("span", {
157
+ className: styles.selectHandle,
158
+ children: "\u25BE"
159
+ })]
160
+ }), items]
161
+ });
162
+ };
163
+ return Select;
164
+ }(Component);
153
165
  /**
154
166
  * The component prop types.
155
167
  * @type {Object}
@@ -2,10 +2,11 @@ import React from 'react';
2
2
  import { shallow, mount } from 'enzyme';
3
3
  import Select from "./index";
4
4
  import SelectItem from "./components/Item";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
5
6
  describe('<Select />', () => {
6
7
  jest.useFakeTimers();
7
8
  it('opens and closes the item list', () => {
8
- const wrapper = shallow(/*#__PURE__*/React.createElement(Select, null));
9
+ const wrapper = shallow(/*#__PURE__*/_jsx(Select, {}));
9
10
  let previousOpenState = wrapper.state('isOpen');
10
11
  wrapper.instance().toggleOpenState();
11
12
  expect(wrapper.state('isOpen')).toBe(!previousOpenState);
@@ -14,14 +15,14 @@ describe('<Select />', () => {
14
15
  expect(wrapper.state('isOpen')).toBe(!previousOpenState);
15
16
  });
16
17
  it('renders without items', () => {
17
- const wrapper = mount(/*#__PURE__*/React.createElement(Select, null));
18
+ const wrapper = mount(/*#__PURE__*/_jsx(Select, {}));
18
19
  wrapper.instance().toggleOpenState();
19
20
  expect(wrapper).toMatchSnapshot();
20
21
  expect(wrapper.find(SelectItem).length).toBe(0);
21
22
  });
22
23
  it('renders with implicit items (closed)', () => {
23
24
  const items = ['a', 'b', 'c', 'd', 'e', 'f'];
24
- const wrapper = mount(/*#__PURE__*/React.createElement(Select, {
25
+ const wrapper = mount(/*#__PURE__*/_jsx(Select, {
25
26
  items: items
26
27
  }));
27
28
  expect(wrapper).toMatchSnapshot();
@@ -29,7 +30,7 @@ describe('<Select />', () => {
29
30
  });
30
31
  it('renders with implicit items (opened)', () => {
31
32
  const items = ['a', 'b', 'c', 'd', 'e', 'f'];
32
- const wrapper = mount(/*#__PURE__*/React.createElement(Select, {
33
+ const wrapper = mount(/*#__PURE__*/_jsx(Select, {
33
34
  items: items
34
35
  }));
35
36
  wrapper.instance().toggleOpenState();
@@ -44,7 +45,7 @@ describe('<Select />', () => {
44
45
  value: 'e',
45
46
  label: 'E'
46
47
  }, 'f'];
47
- const wrapper = mount(/*#__PURE__*/React.createElement(Select, {
48
+ const wrapper = mount(/*#__PURE__*/_jsx(Select, {
48
49
  items: items
49
50
  }));
50
51
  wrapper.instance().toggleOpenState();
@@ -75,7 +76,7 @@ describe('<Select />', () => {
75
76
  const callback = value => {
76
77
  expect(value).toBe(items[selectionIndex]);
77
78
  };
78
- const wrapper = mount(/*#__PURE__*/React.createElement(Select, {
79
+ const wrapper = mount(/*#__PURE__*/_jsx(Select, {
79
80
  items: items,
80
81
  onChange: callback
81
82
  }));
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import React, { Component } from 'react';
2
3
  import classNames from 'classnames';
3
4
  import PropTypes from 'prop-types';
@@ -9,27 +10,32 @@ import { item } from "./style";
9
10
  * @param {Object} props The components props.
10
11
  * @returns {JSX}
11
12
  */
12
- class SelectBoxItem extends Component {
13
- constructor(...args) {
14
- super(...args);
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ let SelectBoxItem = /*#__PURE__*/function (_Component) {
15
+ function SelectBoxItem(...args) {
16
+ var _this;
17
+ _this = _Component.call.apply(_Component, [this].concat(args)) || this;
15
18
  /**
16
19
  * Calls the handleSelectionUpdate prop and prevents further events.
17
20
  */
18
- this.handleSelectionUpdate = () => {
19
- this.props.handleSelectionUpdate(this.props.value);
21
+ _this.handleSelectionUpdate = () => {
22
+ _this.props.handleSelectionUpdate(_this.props.value);
20
23
  };
24
+ return _this;
21
25
  }
26
+ _inheritsLoose(SelectBoxItem, _Component);
27
+ var _proto = SelectBoxItem.prototype;
22
28
  /**
23
29
  * Renders the component
24
30
  * @returns {JSX}
25
31
  */
26
- render() {
32
+ _proto.render = function render() {
27
33
  const Wrapper = this.props.wrapper;
28
34
  const {
29
35
  selectItem,
30
36
  selectItemSelected
31
37
  } = this.props.classNames;
32
- return /*#__PURE__*/React.createElement("li", {
38
+ return /*#__PURE__*/_jsx("li", {
33
39
  className: classNames(selectItem, item, {
34
40
  [selectItemSelected]: this.props.isSelected
35
41
  }),
@@ -39,12 +45,16 @@ class SelectBoxItem extends Component {
39
45
  role: "menuitem",
40
46
  ref: this.props.forwardedRef,
41
47
  tabIndex: this.props.isSelected ? '0' : '-1',
42
- "aria-current": this.props.isSelected
43
- }, /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(I18n.Text, {
44
- string: this.props.label
45
- })));
46
- }
47
- }
48
+ "aria-current": this.props.isSelected,
49
+ children: /*#__PURE__*/_jsx(Wrapper, {
50
+ children: /*#__PURE__*/_jsx(I18n.Text, {
51
+ string: this.props.label
52
+ })
53
+ })
54
+ });
55
+ };
56
+ return SelectBoxItem;
57
+ }(Component);
48
58
  SelectBoxItem.defaultProps = {
49
59
  forwardedRef: null,
50
60
  classNames: {}