@shopgate/pwa-common 7.30.0-alpha.9 → 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 +2 -1
  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 +16 -12
  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 +8 -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 +5 -4
  93. package/components/Widgets/components/WidgetGrid/index.js +27 -19
  94. package/components/Widgets/components/WidgetGrid/spec.js +4 -3
  95. package/components/Widgets/index.js +33 -26
  96. package/components/Widgets/spec.js +12 -13
  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 -5
  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 URLSearchParams from 'url-search-params';
2
3
  import MediaProvider from "./MediaProvider";
3
4
 
@@ -6,13 +7,18 @@ import MediaProvider from "./MediaProvider";
6
7
  /**
7
8
  * The YouTube media provider class.
8
9
  */
9
- class YouTubeMediaProvider extends MediaProvider {
10
+ let YouTubeMediaProvider = /*#__PURE__*/function (_MediaProvider) {
11
+ function YouTubeMediaProvider() {
12
+ return _MediaProvider.apply(this, arguments) || this;
13
+ }
14
+ _inheritsLoose(YouTubeMediaProvider, _MediaProvider);
15
+ var _proto = YouTubeMediaProvider.prototype;
10
16
  /**
11
17
  * Retrieves a list of media containers for YouTube.
12
18
  * @param {ParentNode} container A DOM container that may contain YouTube iframes.
13
19
  * @returns {NodeListOf<Element>}
14
20
  */
15
- getMediaContainers(container) {
21
+ _proto.getMediaContainers = function getMediaContainers(container) {
16
22
  return container.querySelectorAll('iframe[src*="youtube.com"], iframe[src*="youtube-nocookie.com"]');
17
23
  }
18
24
 
@@ -21,8 +27,8 @@ class YouTubeMediaProvider extends MediaProvider {
21
27
  * @override
22
28
  * @param {ParentNode} container A DOM container.
23
29
  * @returns {YouTubeMediaProvider}
24
- */
25
- add(container) {
30
+ */;
31
+ _proto.add = function add(container) {
26
32
  const iframes = this.getMediaContainers(container);
27
33
  if (!iframes.length) {
28
34
  return this;
@@ -38,8 +44,8 @@ class YouTubeMediaProvider extends MediaProvider {
38
44
  *
39
45
  * @param {Document} document - The DOM document containing iframes to optimize.
40
46
  * @returns {YouTubeMediaProvider}
41
- */
42
- applyIframeOptimizations(document) {
47
+ */;
48
+ _proto.applyIframeOptimizations = function applyIframeOptimizations(document) {
43
49
  const iframes = this.getMediaContainers(document);
44
50
  if (!iframes.length) {
45
51
  return this;
@@ -67,8 +73,8 @@ class YouTubeMediaProvider extends MediaProvider {
67
73
  * Stops all playing videos within the DOM containers.
68
74
  * @override
69
75
  * @returns {YouTubeMediaProvider}
70
- */
71
- stop() {
76
+ */;
77
+ _proto.stop = function stop() {
72
78
  // Select all iframes in the document. Actually this should be done via the iframes
73
79
  // registered in this.containers, but that doesn't seem to work reliably anymore.
74
80
  // Since we had to find a quick fix for CURB-5033 we now select all iframes in the document
@@ -84,8 +90,9 @@ class YouTubeMediaProvider extends MediaProvider {
84
90
  }
85
91
  });
86
92
  return this;
87
- }
88
- }
93
+ };
94
+ return YouTubeMediaProvider;
95
+ }(MediaProvider);
89
96
  export default YouTubeMediaProvider;
90
97
 
91
98
  /* eslint-enable class-methods-use-this */
@@ -9,6 +9,7 @@ import style from "./style";
9
9
  * @param {Object} props The component props.
10
10
  * @returns {JSX.Element}
11
11
  */
12
+ import { jsx as _jsx } from "react/jsx-runtime";
12
13
  function Backdrop({
13
14
  className,
14
15
  color,
@@ -66,24 +67,25 @@ function Backdrop({
66
67
  }
67
68
  }), [targetOpacity]);
68
69
  const combinedClassName = `${style} ${className} common__backdrop`;
69
- return /*#__PURE__*/React.createElement(Transition, {
70
+ return /*#__PURE__*/_jsx(Transition, {
70
71
  in: isVisible,
71
72
  timeout: duration,
72
73
  mountOnEnter: true,
73
74
  unmountOnExit: true,
74
75
  appear: true,
75
- nodeRef: nodeRef
76
- }, state => /*#__PURE__*/React.createElement("div", {
77
- ref: nodeRef,
78
- "data-test-id": "Backdrop",
79
- "aria-hidden": true,
80
- className: combinedClassName,
81
- onClick: onClick,
82
- style: {
83
- ...baseStyle,
84
- ...transitionStyles[state]
85
- }
86
- }));
76
+ nodeRef: nodeRef,
77
+ children: state => /*#__PURE__*/_jsx("div", {
78
+ ref: nodeRef,
79
+ "data-test-id": "Backdrop",
80
+ "aria-hidden": true,
81
+ className: combinedClassName,
82
+ onClick: onClick,
83
+ style: {
84
+ ...baseStyle,
85
+ ...transitionStyles[state]
86
+ }
87
+ })
88
+ });
87
89
  }
88
90
  Backdrop.defaultProps = {
89
91
  className: '',
@@ -1,19 +1,20 @@
1
1
  import React from 'react';
2
2
  import { shallow, mount } from 'enzyme';
3
3
  import Backdrop from "./index";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
4
5
  describe('<Backdrop />', () => {
5
6
  let mockOpen;
6
7
  beforeEach(() => {
7
8
  mockOpen = jest.fn();
8
9
  });
9
10
  it('should render', () => {
10
- const wrapper = shallow(/*#__PURE__*/React.createElement(Backdrop, {
11
+ const wrapper = shallow(/*#__PURE__*/_jsx(Backdrop, {
11
12
  isVisible: true
12
13
  }));
13
14
  expect(wrapper).toMatchSnapshot();
14
15
  });
15
16
  it('should execute callback when Backdrop is clicked', () => {
16
- const wrapper = mount(/*#__PURE__*/React.createElement(Backdrop, {
17
+ const wrapper = mount(/*#__PURE__*/_jsx(Backdrop, {
17
18
  isVisible: true,
18
19
  onClick: mockOpen
19
20
  }));
@@ -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 style from "./style";
@@ -6,43 +7,54 @@ import style from "./style";
6
7
  /**
7
8
  * The button component.
8
9
  */
9
- class Button extends Component {
10
- /**
11
- * Getter for the calculated button props.
12
- * @returns {Object}
13
- */
14
- get buttonProps() {
15
- const {
16
- children,
17
- testId,
18
- className,
19
- disabled,
20
- onClick,
21
- ...props
22
- } = this.props;
23
- const buttonProps = {
24
- className: `${className} ${style} common__button`,
25
- disabled,
26
- onClick: disabled ? null : onClick,
27
- ...props
28
- };
29
- return buttonProps;
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ let Button = /*#__PURE__*/function (_Component) {
12
+ function Button() {
13
+ return _Component.apply(this, arguments) || this;
30
14
  }
31
-
15
+ _inheritsLoose(Button, _Component);
16
+ var _proto = Button.prototype;
32
17
  /**
33
18
  * Renders the component.
34
19
  * @returns {JSX.Element}
35
20
  */
36
- render() {
21
+ _proto.render = function render() {
37
22
  return (
38
23
  /*#__PURE__*/
39
24
  // eslint-disable-next-line react/button-has-type
40
- React.createElement("button", _extends({
41
- "data-test-id": this.props.testId
42
- }, this.buttonProps), this.props.children)
25
+ _jsx("button", {
26
+ "data-test-id": this.props.testId,
27
+ ...this.buttonProps,
28
+ children: this.props.children
29
+ })
43
30
  );
44
- }
45
- }
31
+ };
32
+ return _createClass(Button, [{
33
+ key: "buttonProps",
34
+ get:
35
+ /**
36
+ * Getter for the calculated button props.
37
+ * @returns {Object}
38
+ */
39
+ function () {
40
+ const {
41
+ children,
42
+ testId,
43
+ className,
44
+ disabled,
45
+ onClick,
46
+ ...props
47
+ } = this.props;
48
+ const buttonProps = {
49
+ className: `${className} ${style} common__button`,
50
+ disabled,
51
+ onClick: disabled ? null : onClick,
52
+ ...props
53
+ };
54
+ return buttonProps;
55
+ }
56
+ }]);
57
+ }(Component);
46
58
  Button.defaultProps = {
47
59
  className: '',
48
60
  disabled: false,
@@ -1,34 +1,40 @@
1
1
  import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import Button from "./index";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
4
5
  describe('<Button />', () => {
5
6
  it('should render the button', () => {
6
- const wrapper = shallow(/*#__PURE__*/React.createElement(Button, null, "My content"));
7
+ const wrapper = shallow(/*#__PURE__*/_jsx(Button, {
8
+ children: "My content"
9
+ }));
7
10
  expect(wrapper).toMatchSnapshot();
8
11
  expect(wrapper.find('button').length).toBe(1);
9
12
  });
10
13
  it('should render the button in disabled state', () => {
11
- const wrapper = shallow(/*#__PURE__*/React.createElement(Button, {
12
- disabled: true
13
- }, "My content"));
14
+ const wrapper = shallow(/*#__PURE__*/_jsx(Button, {
15
+ disabled: true,
16
+ children: "My content"
17
+ }));
14
18
  expect(wrapper).toMatchSnapshot();
15
19
  expect(wrapper.find('button[disabled]').length).toBe(1);
16
20
  });
17
21
  it('should trigger the click event', () => {
18
22
  const callback = jest.fn();
19
- const wrapper = shallow(/*#__PURE__*/React.createElement(Button, {
20
- onClick: callback
21
- }, "My content"));
23
+ const wrapper = shallow(/*#__PURE__*/_jsx(Button, {
24
+ onClick: callback,
25
+ children: "My content"
26
+ }));
22
27
  wrapper.simulate('click');
23
28
  expect(wrapper).toMatchSnapshot();
24
29
  expect(callback).toHaveBeenCalled();
25
30
  });
26
31
  it('should not trigger the click event when disabled', () => {
27
32
  const callback = jest.fn();
28
- const wrapper = shallow(/*#__PURE__*/React.createElement(Button, {
33
+ const wrapper = shallow(/*#__PURE__*/_jsx(Button, {
29
34
  disabled: true,
30
- onClick: callback
31
- }, "My content"));
35
+ onClick: callback,
36
+ children: "My content"
37
+ }));
32
38
  wrapper.simulate('click');
33
39
  expect(wrapper).toMatchSnapshot();
34
40
  expect(callback).not.toHaveBeenCalled();
@@ -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 classNames from 'classnames';
@@ -21,66 +22,68 @@ import classNames from 'classnames';
21
22
  * @extends {React.Component<CheckboxProps>}
22
23
  * @returns {JSX.Element}
23
24
  */
24
- class Checkbox extends Component {
25
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
26
+ let Checkbox = /*#__PURE__*/function (_Component) {
25
27
  /**
26
28
  * The checkbox component constructor.
27
29
  * It checks if the checkbox is a controlled or uncontrolled input and sets an internal state if
28
30
  * uncontrolled to keep track of th checked-state.
29
31
  * @param {Object} props The Checkbox properties.
30
32
  */
31
- constructor(props) {
32
- super(props);
33
+ function Checkbox(props) {
34
+ var _this;
35
+ _this = _Component.call(this, props) || this;
33
36
  /**
34
37
  * Returns if the checkbox is checked or not.
35
38
  * @return {boolean} Is the checkbox checked?
36
39
  */
37
- this.isChecked = () => typeof this.props.defaultChecked === 'undefined' ? this.props.checked // Controlled.
38
- : this.state.checked // Uncontrolled.
40
+ _this.isChecked = () => typeof _this.props.defaultChecked === 'undefined' ? _this.props.checked // Controlled.
41
+ : _this.state.checked // Uncontrolled.
39
42
  ;
40
43
  /**
41
44
  * Inverts the current "checked" value and calls the callback function with it.
42
45
  * If the checkbox is uncontrolled, it keeps track of the value.
43
46
  */
44
- this.handleCheck = () => {
45
- if (this.props.disabled) {
47
+ _this.handleCheck = () => {
48
+ if (_this.props.disabled) {
46
49
  return;
47
50
  }
48
- const checked = !this.isChecked();
49
- if (typeof this.props.defaultChecked !== 'undefined') {
51
+ const checked = !_this.isChecked();
52
+ if (typeof _this.props.defaultChecked !== 'undefined') {
50
53
  // Uncontrolled.
51
- this.setState({
54
+ _this.setState({
52
55
  checked
53
56
  });
54
57
  }
55
- this.props.onCheck(checked);
58
+ _this.props.onCheck(checked);
56
59
  };
57
60
  /**
58
61
  * Handler for keyDown events of the checkbox
59
62
  * @param {Object} e The keyDown event payload
60
63
  */
61
- this.handleKeyDown = e => {
64
+ _this.handleKeyDown = e => {
62
65
  if (e.key === ' ') {
63
66
  // Toggle checkbox on "space" - mocks behavior of native checkboxes
64
- this.handleCheck();
67
+ _this.handleCheck();
65
68
  }
66
69
  };
67
70
  /**
68
71
  * Renders the checked/unchecked icon.
69
72
  * @returns {JSX}
70
73
  */
71
- this.renderIcon = () => this.isChecked() ? this.props.checkedIcon : this.props.uncheckedIcon;
74
+ _this.renderIcon = () => _this.isChecked() ? _this.props.checkedIcon : _this.props.uncheckedIcon;
72
75
  /**
73
76
  * Renders an input if a "name" prop is provided.
74
77
  * @returns {JSX}
75
78
  */
76
- this.renderInput = () => {
79
+ _this.renderInput = () => {
77
80
  const {
78
81
  props: {
79
82
  name
80
83
  },
81
84
  isChecked
82
- } = this;
83
- return this.props.name ? /*#__PURE__*/React.createElement("input", {
85
+ } = _this;
86
+ return _this.props.name ? /*#__PURE__*/_jsx("input", {
84
87
  className: "input",
85
88
  type: "hidden",
86
89
  name: name,
@@ -92,25 +95,28 @@ class Checkbox extends Component {
92
95
  * @param {string} side Used to check against which side to render the label on.
93
96
  * @returns {JSX}
94
97
  */
95
- this.renderLabelIfItIsOnThe = side => this.props.labelPosition === side ? this.props.label : null;
98
+ _this.renderLabelIfItIsOnThe = side => _this.props.labelPosition === side ? _this.props.label : null;
96
99
  if (typeof props.defaultChecked !== 'undefined') {
97
100
  // Uncontrolled input.
98
- this.state = {
101
+ _this.state = {
99
102
  checked: props.defaultChecked
100
103
  };
101
104
  } else {
102
105
  // Controlled input
103
- this.state = {
106
+ _this.state = {
104
107
  checked: props.checked
105
108
  };
106
109
  }
110
+ return _this;
107
111
  }
108
112
 
109
113
  /**
110
114
  * Make sure state is updated with new checked value when input is controlled
111
115
  * @param {Object} nextProps Contains the new "checked" status
112
116
  */
113
- UNSAFE_componentWillReceiveProps(nextProps) {
117
+ _inheritsLoose(Checkbox, _Component);
118
+ var _proto = Checkbox.prototype;
119
+ _proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
114
120
  // Update only for controlled input
115
121
  if (typeof this.props.defaultChecked === 'undefined') {
116
122
  if (this.state.checked !== nextProps.checked) {
@@ -119,22 +125,24 @@ class Checkbox extends Component {
119
125
  });
120
126
  }
121
127
  }
122
- }
128
+ };
123
129
  /**
124
130
  * Renders the checkbox component.
125
131
  * @returns {JSX}
126
132
  */
127
- render() {
128
- return /*#__PURE__*/React.createElement("div", {
133
+ _proto.render = function render() {
134
+ return /*#__PURE__*/_jsxs("div", {
129
135
  className: classNames(this.props.className, 'checkbox', 'common__checkbox'),
130
136
  onClick: this.handleCheck,
131
137
  onKeyDown: this.handleKeyDown,
132
138
  role: "checkbox",
133
139
  "aria-checked": this.props.checked,
134
- tabIndex: 0
135
- }, this.renderInput(), this.renderLabelIfItIsOnThe('left'), this.renderIcon(), this.renderLabelIfItIsOnThe('right'));
136
- }
137
- }
140
+ tabIndex: 0,
141
+ children: [this.renderInput(), this.renderLabelIfItIsOnThe('left'), this.renderIcon(), this.renderLabelIfItIsOnThe('right')]
142
+ });
143
+ };
144
+ return Checkbox;
145
+ }(Component);
138
146
  Checkbox.defaultProps = {
139
147
  checked: undefined,
140
148
  className: undefined,
@@ -6,55 +6,68 @@ import Checkbox from "./index";
6
6
  * Checked Icon
7
7
  * @returns {JSX}
8
8
  */
9
- const Checked = () => /*#__PURE__*/React.createElement("div", null);
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ const Checked = () => /*#__PURE__*/_jsx("div", {});
10
11
 
11
12
  /**
12
13
  * Unchecked Icon
13
14
  * @returns {JSX}
14
15
  */
15
- const Unchecked = () => /*#__PURE__*/React.createElement("div", null);
16
+ const Unchecked = () => /*#__PURE__*/_jsx("div", {});
16
17
  describe('<Checkbox />', () => {
17
18
  it('should render the checkbox with the label before the icon', () => {
18
- const wrapper = shallow(/*#__PURE__*/React.createElement(Checkbox, {
19
- label: /*#__PURE__*/React.createElement("span", null, "Test Label Deluxe"),
19
+ const wrapper = shallow(/*#__PURE__*/_jsx(Checkbox, {
20
+ label: /*#__PURE__*/_jsx("span", {
21
+ children: "Test Label Deluxe"
22
+ }),
20
23
  labelPosition: "left",
21
- checkedIcon: /*#__PURE__*/React.createElement(Checked, null),
22
- uncheckedIcon: /*#__PURE__*/React.createElement(Unchecked, null),
24
+ checkedIcon: /*#__PURE__*/_jsx(Checked, {}),
25
+ uncheckedIcon: /*#__PURE__*/_jsx(Unchecked, {}),
23
26
  checked: false
24
27
  }));
25
- const expected = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "Test Label Deluxe"), /*#__PURE__*/React.createElement(Unchecked, null));
28
+ const expected = /*#__PURE__*/_jsxs("div", {
29
+ children: [/*#__PURE__*/_jsx("span", {
30
+ children: "Test Label Deluxe"
31
+ }), /*#__PURE__*/_jsx(Unchecked, {})]
32
+ });
26
33
  expect(wrapper).toMatchSnapshot();
27
34
  expect(wrapper.matchesElement(expected)).toBeTruthy();
28
35
  });
29
36
  it('should render the checkbox with the label after the icon', () => {
30
- const wrapper = shallow(/*#__PURE__*/React.createElement(Checkbox, {
31
- label: /*#__PURE__*/React.createElement("span", null, "Test Label Deluxe"),
37
+ const wrapper = shallow(/*#__PURE__*/_jsx(Checkbox, {
38
+ label: /*#__PURE__*/_jsx("span", {
39
+ children: "Test Label Deluxe"
40
+ }),
32
41
  labelPosition: "right",
33
- checkedIcon: /*#__PURE__*/React.createElement(Checked, null),
34
- uncheckedIcon: /*#__PURE__*/React.createElement(Unchecked, null),
42
+ checkedIcon: /*#__PURE__*/_jsx(Checked, {}),
43
+ uncheckedIcon: /*#__PURE__*/_jsx(Unchecked, {}),
35
44
  checked: false
36
45
  }));
37
- const expected = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Unchecked, null), /*#__PURE__*/React.createElement("span", null, "Test Label Deluxe"));
46
+ const expected = /*#__PURE__*/_jsxs("div", {
47
+ children: [/*#__PURE__*/_jsx(Unchecked, {}), /*#__PURE__*/_jsx("span", {
48
+ children: "Test Label Deluxe"
49
+ })]
50
+ });
38
51
  expect(wrapper).toMatchSnapshot();
39
52
  expect(wrapper.matchesElement(expected)).toBeTruthy();
40
53
  });
41
54
  it('should render the unchecked icon if "checked" is false', () => {
42
- const wrapper = shallow(/*#__PURE__*/React.createElement(Checkbox, {
55
+ const wrapper = shallow(/*#__PURE__*/_jsx(Checkbox, {
43
56
  checked: false,
44
57
  label: "Test Label Deluxe",
45
- checkedIcon: /*#__PURE__*/React.createElement(Checked, null),
46
- uncheckedIcon: /*#__PURE__*/React.createElement(Unchecked, null)
58
+ checkedIcon: /*#__PURE__*/_jsx(Checked, {}),
59
+ uncheckedIcon: /*#__PURE__*/_jsx(Unchecked, {})
47
60
  }));
48
61
  expect(wrapper).toMatchSnapshot();
49
62
  expect(wrapper.find(Checked).length).toBe(0);
50
63
  expect(wrapper.find(Unchecked).length).toBe(1);
51
64
  });
52
65
  it('should render the unchecked icon if "checked" is false', () => {
53
- const wrapper = shallow(/*#__PURE__*/React.createElement(Checkbox, {
66
+ const wrapper = shallow(/*#__PURE__*/_jsx(Checkbox, {
54
67
  checked: true,
55
68
  label: "Test Label Deluxe",
56
- checkedIcon: /*#__PURE__*/React.createElement(Checked, null),
57
- uncheckedIcon: /*#__PURE__*/React.createElement(Unchecked, null)
69
+ checkedIcon: /*#__PURE__*/_jsx(Checked, {}),
70
+ uncheckedIcon: /*#__PURE__*/_jsx(Unchecked, {})
58
71
  }));
59
72
  expect(wrapper).toMatchSnapshot();
60
73
  expect(wrapper.find(Checked).length).toBe(1);
@@ -62,10 +75,10 @@ describe('<Checkbox />', () => {
62
75
  });
63
76
  it('should call the callback with the inverted value', () => {
64
77
  const spy = jest.fn();
65
- const wrapper = shallow(/*#__PURE__*/React.createElement(Checkbox, {
78
+ const wrapper = shallow(/*#__PURE__*/_jsx(Checkbox, {
66
79
  label: "Test Label Deluxe",
67
- checkedIcon: /*#__PURE__*/React.createElement(Checked, null),
68
- uncheckedIcon: /*#__PURE__*/React.createElement(Unchecked, null),
80
+ checkedIcon: /*#__PURE__*/_jsx(Checked, {}),
81
+ uncheckedIcon: /*#__PURE__*/_jsx(Unchecked, {}),
69
82
  checked: false,
70
83
  onCheck: spy
71
84
  }));
@@ -73,10 +86,10 @@ describe('<Checkbox />', () => {
73
86
  expect(spy).toHaveBeenCalledWith(true);
74
87
  });
75
88
  it('should render an <input> element if a name prop is provided', () => {
76
- const wrapper = shallow(/*#__PURE__*/React.createElement(Checkbox, {
89
+ const wrapper = shallow(/*#__PURE__*/_jsx(Checkbox, {
77
90
  label: "Test Label Deluxe",
78
- checkedIcon: /*#__PURE__*/React.createElement(Checked, null),
79
- uncheckedIcon: /*#__PURE__*/React.createElement(Unchecked, null),
91
+ checkedIcon: /*#__PURE__*/_jsx(Checked, {}),
92
+ uncheckedIcon: /*#__PURE__*/_jsx(Unchecked, {}),
80
93
  defaultChecked: false,
81
94
  name: "myCheckbox"
82
95
  }));
@@ -86,10 +99,10 @@ describe('<Checkbox />', () => {
86
99
  expect(input.prop('value')).toEqual(0);
87
100
  });
88
101
  it('should work as an uncontrolled input', () => {
89
- const wrapper = shallow(/*#__PURE__*/React.createElement(Checkbox, {
102
+ const wrapper = shallow(/*#__PURE__*/_jsx(Checkbox, {
90
103
  label: "Test Label Deluxe",
91
- checkedIcon: /*#__PURE__*/React.createElement(Checked, null),
92
- uncheckedIcon: /*#__PURE__*/React.createElement(Unchecked, null),
104
+ checkedIcon: /*#__PURE__*/_jsx(Checked, {}),
105
+ uncheckedIcon: /*#__PURE__*/_jsx(Unchecked, {}),
93
106
  defaultChecked: false
94
107
  }));
95
108
  wrapper.simulate('click');
@@ -8,11 +8,14 @@ import buildParams from "./helpers/buildParams";
8
8
  * @param {Object} props.props The props to create.
9
9
  * @returns {JSX}
10
10
  */
11
+ import { jsx as _jsx } from "react/jsx-runtime";
11
12
  const Consume = ({
12
13
  children,
13
14
  context: {
14
15
  Consumer
15
16
  },
16
17
  props
17
- }) => /*#__PURE__*/React.createElement(Consumer, null, value => children(buildParams(value, props)));
18
+ }) => /*#__PURE__*/_jsx(Consumer, {
19
+ children: value => children(buildParams(value, props))
20
+ });
18
21
  export default Consume;