@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,39 +9,46 @@ import styles from "./style";
9
9
  /**
10
10
  * @return {JSX}
11
11
  */
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
13
  const SearchBar = ({
13
14
  handleChange
14
15
  }) => {
15
16
  const [query, setQuery] = useState('');
16
17
  const name = 'search';
17
- return /*#__PURE__*/React.createElement("div", {
18
+ return /*#__PURE__*/_jsx("div", {
18
19
  className: "ui-shared__sheet__search-field",
19
- "data-test-id": "SearchField"
20
- }, /*#__PURE__*/React.createElement("div", {
21
- className: styles.container
22
- }, /*#__PURE__*/React.createElement("div", {
23
- className: styles.inputWrapper
24
- }, /*#__PURE__*/React.createElement("form", {
25
- onSubmit: e => {
26
- e.preventDefault();
27
- }
28
- }, /*#__PURE__*/React.createElement("label", {
29
- htmlFor: name,
30
- className: styles.label
31
- }, /*#__PURE__*/React.createElement("div", {
32
- className: styles.icon
33
- }, /*#__PURE__*/React.createElement(MagnifierIcon, null)), !query.length && /*#__PURE__*/React.createElement(I18n.Text, {
34
- string: "search.placeholder"
35
- })), /*#__PURE__*/React.createElement(Input, {
36
- name: name,
37
- autoComplete: false,
38
- className: classNames(styles.input),
39
- onChange: value => {
40
- handleChange(value);
41
- setQuery(value);
42
- },
43
- value: query,
44
- type: "search"
45
- })))));
20
+ "data-test-id": "SearchField",
21
+ children: /*#__PURE__*/_jsx("div", {
22
+ className: styles.container,
23
+ children: /*#__PURE__*/_jsx("div", {
24
+ className: styles.inputWrapper,
25
+ children: /*#__PURE__*/_jsxs("form", {
26
+ onSubmit: e => {
27
+ e.preventDefault();
28
+ },
29
+ children: [/*#__PURE__*/_jsxs("label", {
30
+ htmlFor: name,
31
+ className: styles.label,
32
+ children: [/*#__PURE__*/_jsx("div", {
33
+ className: styles.icon,
34
+ children: /*#__PURE__*/_jsx(MagnifierIcon, {})
35
+ }), !query.length && /*#__PURE__*/_jsx(I18n.Text, {
36
+ string: "search.placeholder"
37
+ })]
38
+ }), /*#__PURE__*/_jsx(Input, {
39
+ name: name,
40
+ autoComplete: false,
41
+ className: classNames(styles.input),
42
+ onChange: value => {
43
+ handleChange(value);
44
+ setQuery(value);
45
+ },
46
+ value: query,
47
+ type: "search"
48
+ })]
49
+ })
50
+ })
51
+ })
52
+ });
46
53
  };
47
54
  export default SearchBar;
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import { mount } from 'enzyme';
3
3
  import SearchBar from "./index";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
4
5
  describe('<SearchBar />', () => {
5
6
  it('should call handleChange on input', async () => {
6
7
  const handleChange = jest.fn();
7
- const wrapper = await mount(/*#__PURE__*/React.createElement(SearchBar, {
8
+ const wrapper = await mount(/*#__PURE__*/_jsx(SearchBar, {
8
9
  handleChange: handleChange
9
10
  }));
10
11
  expect(wrapper).toMatchSnapshot();
@@ -1,4 +1,4 @@
1
- import _extends from "@babel/runtime/helpers/extends";
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
2
  import React, { Component } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import classNames from 'classnames';
@@ -11,20 +11,26 @@ import SearchBar from "./components/SearchBar";
11
11
  /**
12
12
  * Header component.
13
13
  */
14
- class Header extends Component {
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
+ let Header = /*#__PURE__*/function (_Component) {
16
+ function Header() {
17
+ return _Component.apply(this, arguments) || this;
18
+ }
19
+ _inheritsLoose(Header, _Component);
20
+ var _proto = Header.prototype;
15
21
  /**
16
22
  * @param {Object} nextProps Next Props
17
23
  * @returns {boolean}
18
24
  */
19
- shouldComponentUpdate(nextProps) {
25
+ _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
20
26
  return this.props.shadow !== nextProps.shadow || this.props.title !== nextProps.title;
21
27
  }
22
28
 
23
29
  /**
24
30
  * Renders the component.
25
31
  * @returns {JSX}
26
- */
27
- render() {
32
+ */;
33
+ _proto.render = function render() {
28
34
  const {
29
35
  allowClose
30
36
  } = this.props;
@@ -32,37 +38,44 @@ class Header extends Component {
32
38
  const {
33
39
  __
34
40
  } = this.context.i18n();
35
- return /*#__PURE__*/React.createElement("div", {
41
+ return /*#__PURE__*/_jsxs("div", {
36
42
  className: classNames({
37
43
  [styles.shadow]: this.props.shadow
38
- })
39
- }, /*#__PURE__*/React.createElement(Grid, {
40
- className: classes,
41
- component: "div",
42
- wrap: false
43
- }, allowClose ? /*#__PURE__*/React.createElement("button", {
44
- className: styles.closeButton,
45
- onClick: this.props.onToggleClose,
46
- "aria-label": __('common.close'),
47
- type: "button"
48
- }, /*#__PURE__*/React.createElement(Ripple, {
49
- className: styles.closeIcon
50
- }, /*#__PURE__*/React.createElement(CrossIcon, {
51
- size: 24
52
- }))) : /*#__PURE__*/React.createElement("div", {
53
- className: styles.closePlaceholder
54
- }), /*#__PURE__*/React.createElement(Grid.Item, _extends({
55
- className: styles.title,
56
- component: "div",
57
- grow: 1,
58
- role: "heading"
59
- }, allowClose ? {
60
- tabIndex: 0
61
- } : null), this.props.title)), this.props.showSearch && /*#__PURE__*/React.createElement(SearchBar, {
62
- handleChange: this.props.handleChange
63
- }));
64
- }
65
- }
44
+ }),
45
+ children: [/*#__PURE__*/_jsxs(Grid, {
46
+ className: classes,
47
+ component: "div",
48
+ wrap: false,
49
+ children: [allowClose ? /*#__PURE__*/_jsx("button", {
50
+ className: styles.closeButton,
51
+ onClick: this.props.onToggleClose,
52
+ "aria-label": __('common.close'),
53
+ type: "button",
54
+ children: /*#__PURE__*/_jsx(Ripple, {
55
+ className: styles.closeIcon,
56
+ children: /*#__PURE__*/_jsx(CrossIcon, {
57
+ size: 24
58
+ })
59
+ })
60
+ }) : /*#__PURE__*/_jsx("div", {
61
+ className: styles.closePlaceholder
62
+ }), /*#__PURE__*/_jsx(Grid.Item, {
63
+ className: styles.title,
64
+ component: "div",
65
+ grow: 1,
66
+ role: "heading",
67
+ ...(allowClose ? {
68
+ tabIndex: 0
69
+ } : null),
70
+ children: this.props.title
71
+ })]
72
+ }), this.props.showSearch && /*#__PURE__*/_jsx(SearchBar, {
73
+ handleChange: this.props.handleChange
74
+ })]
75
+ });
76
+ };
77
+ return Header;
78
+ }(Component);
66
79
  /**
67
80
  * The component's default props.
68
81
  * @type {Object}
@@ -2,10 +2,11 @@ import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import mockRenderOptions from '@shopgate/pwa-common/helpers/mocks/mockRenderOptions';
4
4
  import Header from "./index";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
5
6
  describe('<Header />', () => {
6
7
  it('should render with correct title', () => {
7
8
  const title = 'My Title';
8
- const wrapper = shallow(/*#__PURE__*/React.createElement(Header, {
9
+ const wrapper = shallow(/*#__PURE__*/_jsx(Header, {
9
10
  title: title
10
11
  }), mockRenderOptions);
11
12
  expect(wrapper).toMatchSnapshot();
package/Sheet/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, { Component } from 'react';
2
4
  import PropTypes from 'prop-types';
3
5
  import throttle from 'lodash/throttle';
@@ -8,6 +10,7 @@ import Drawer from '@shopgate/pwa-common/components/Drawer';
8
10
  import ProgressBar from "../ProgressBar";
9
11
  import Header from "./components/Header";
10
12
  import styles from "./style";
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
14
  export const SHEET_EVENTS = {
12
15
  OPEN: 'Sheet.open',
13
16
  CLOSE: 'Sheet.close'
@@ -16,20 +19,21 @@ export const SHEET_EVENTS = {
16
19
  /**
17
20
  * Sheet component.
18
21
  */
19
- class Sheet extends Component {
22
+ let Sheet = /*#__PURE__*/function (_Component) {
20
23
  /**
21
24
  * The constructor.
22
25
  * @param {Object} props The component props.
23
26
  */
24
- constructor(props) {
25
- super(props);
27
+ function Sheet(props) {
28
+ var _this;
29
+ _this = _Component.call(this, props) || this;
26
30
  /**
27
31
  * Close the Sheet.
28
32
  */
29
- this.handleScroll = throttle(() => {
30
- const scrolled = this.content.current.scrollTop !== 0;
31
- if (this.state.scrolled !== scrolled) {
32
- this.setState({
33
+ _this.handleScroll = throttle(() => {
34
+ const scrolled = _this.content.current.scrollTop !== 0;
35
+ if (_this.state.scrolled !== scrolled) {
36
+ _this.setState({
33
37
  scrolled
34
38
  });
35
39
  }
@@ -37,45 +41,48 @@ class Sheet extends Component {
37
41
  /**
38
42
  * Close the Sheet.
39
43
  */
40
- this.handleClose = () => {
41
- this.props.onClose();
42
- this.setState({
44
+ _this.handleClose = () => {
45
+ _this.props.onClose();
46
+ _this.setState({
43
47
  isOpen: false,
44
48
  scrolled: false
45
49
  });
46
50
  };
47
51
  /** The Sheet is opened */
48
- this.handleDidOpen = () => {
52
+ _this.handleDidOpen = () => {
49
53
  UIEvents.emit(SHEET_EVENTS.OPEN);
50
- this.props.onDidOpen();
54
+ _this.props.onDidOpen();
51
55
  };
52
56
  /** The Sheet is closed */
53
- this.handleDidClose = () => {
57
+ _this.handleDidClose = () => {
54
58
  UIEvents.emit(SHEET_EVENTS.CLOSE);
55
- this.props.onDidClose();
59
+ _this.props.onDidClose();
56
60
  };
57
61
  /**
58
62
  * New value from SearchBar
59
63
  * @param {string} value .
60
64
  */
61
- this.handleSearchInput = value => {
62
- this.setState({
65
+ _this.handleSearchInput = value => {
66
+ _this.setState({
63
67
  query: value
64
68
  });
65
69
  };
66
- this.content = /*#__PURE__*/React.createRef();
67
- this.state = {
70
+ _this.content = /*#__PURE__*/React.createRef();
71
+ _this.state = {
68
72
  isOpen: props.isOpen,
69
73
  scrolled: false,
70
74
  query: ''
71
75
  };
76
+ return _this;
72
77
  }
73
78
 
74
79
  /**
75
80
  * Change isOpen state for new incoming props.
76
81
  * @param {Object} nextProps The next component props.
77
82
  */
78
- UNSAFE_componentWillReceiveProps({
83
+ _inheritsLoose(Sheet, _Component);
84
+ var _proto = Sheet.prototype;
85
+ _proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps({
79
86
  isOpen
80
87
  }) {
81
88
  if (this.state.isOpen !== isOpen) {
@@ -83,23 +90,12 @@ class Sheet extends Component {
83
90
  isOpen
84
91
  });
85
92
  }
86
- }
87
- /**
88
- * Getter for the animation props of the Sheet.
89
- * @returns {Object}
90
- */
91
- get animationProps() {
92
- return {
93
- duration: this.props.duration,
94
- ...styles.drawerAnimation,
95
- ...this.props.animation
96
- };
97
- }
93
+ };
98
94
  /**
99
95
  * Renders the component.
100
96
  * @returns {JSX}
101
97
  */
102
- render() {
98
+ _proto.render = function render() {
103
99
  const {
104
100
  allowClose
105
101
  } = this.props;
@@ -119,41 +115,60 @@ class Sheet extends Component {
119
115
  }, {
120
116
  [styles.shadow]: !this.props.backdrop
121
117
  });
122
- return /*#__PURE__*/React.createElement("section", {
118
+ return /*#__PURE__*/_jsxs("section", {
123
119
  className: classNames('ui-shared__sheet', {
124
120
  [styles.section]: this.state.isOpen
125
- })
126
- }, /*#__PURE__*/React.createElement(Drawer, {
127
- className: drawerClassNames,
128
- isOpen: this.state.isOpen,
129
- onDidOpen: this.handleDidOpen,
130
- onDidClose: this.handleDidClose,
131
- onOpen: this.props.onOpen,
132
- onClose: this.handleClose,
133
- animation: this.animationProps
134
- }, this.props.title && /*#__PURE__*/React.createElement(Sheet.Header, {
135
- showSearch: this.props.showSearch,
136
- handleChange: this.handleSearchInput,
137
- onToggleClose: this.handleClose,
138
- shadow: this.state.scrolled,
139
- title: this.props.title,
140
- allowClose: allowClose
141
- }), /*#__PURE__*/React.createElement("div", {
142
- className: styles.progressBarContainer
143
- }, /*#__PURE__*/React.createElement(ProgressBar, {
144
- isVisible: this.props.isLoading
145
- })), /*#__PURE__*/React.createElement("div", {
146
- ref: this.content,
147
- onScroll: this.handleScroll,
148
- className: contentClassNames
149
- }, children)), this.props.backdrop && /*#__PURE__*/React.createElement(Backdrop, {
150
- isVisible: this.state.isOpen,
151
- level: 4,
152
- onClick: allowClose ? this.handleClose : () => {},
153
- opacity: 20
154
- }));
155
- }
156
- }
121
+ }),
122
+ children: [/*#__PURE__*/_jsxs(Drawer, {
123
+ className: drawerClassNames,
124
+ isOpen: this.state.isOpen,
125
+ onDidOpen: this.handleDidOpen,
126
+ onDidClose: this.handleDidClose,
127
+ onOpen: this.props.onOpen,
128
+ onClose: this.handleClose,
129
+ animation: this.animationProps,
130
+ children: [this.props.title && /*#__PURE__*/_jsx(Sheet.Header, {
131
+ showSearch: this.props.showSearch,
132
+ handleChange: this.handleSearchInput,
133
+ onToggleClose: this.handleClose,
134
+ shadow: this.state.scrolled,
135
+ title: this.props.title,
136
+ allowClose: allowClose
137
+ }), /*#__PURE__*/_jsx("div", {
138
+ className: styles.progressBarContainer,
139
+ children: /*#__PURE__*/_jsx(ProgressBar, {
140
+ isVisible: this.props.isLoading
141
+ })
142
+ }), /*#__PURE__*/_jsx("div", {
143
+ ref: this.content,
144
+ onScroll: this.handleScroll,
145
+ className: contentClassNames,
146
+ children: children
147
+ })]
148
+ }), this.props.backdrop && /*#__PURE__*/_jsx(Backdrop, {
149
+ isVisible: this.state.isOpen,
150
+ level: 4,
151
+ onClick: allowClose ? this.handleClose : () => {},
152
+ opacity: 20
153
+ })]
154
+ });
155
+ };
156
+ return _createClass(Sheet, [{
157
+ key: "animationProps",
158
+ get:
159
+ /**
160
+ * Getter for the animation props of the Sheet.
161
+ * @returns {Object}
162
+ */
163
+ function () {
164
+ return {
165
+ duration: this.props.duration,
166
+ ...styles.drawerAnimation,
167
+ ...this.props.animation
168
+ };
169
+ }
170
+ }]);
171
+ }(Component);
157
172
  Sheet.Header = Header;
158
173
  /**
159
174
  * The component default props.
package/Sheet/spec.js CHANGED
@@ -3,6 +3,7 @@ import { shallow, mount } from 'enzyme';
3
3
  import mockRenderOptions from '@shopgate/pwa-common/helpers/mocks/mockRenderOptions';
4
4
  import UIEvents from '@shopgate/pwa-core/emitters/ui';
5
5
  import Sheet, { SHEET_EVENTS } from "./index";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
6
7
  window.requestAnimationFrame = () => {};
7
8
  jest.mock('@shopgate/pwa-core/emitters/ui', () => ({
8
9
  emit: jest.fn()
@@ -10,30 +11,36 @@ jest.mock('@shopgate/pwa-core/emitters/ui', () => ({
10
11
  jest.mock('@shopgate/engage/a11y/components');
11
12
  describe('<Sheet />', () => {
12
13
  it('should render closed without content', () => {
13
- const wrapper = shallow(/*#__PURE__*/React.createElement(Sheet, null));
14
+ const wrapper = shallow(/*#__PURE__*/_jsx(Sheet, {}));
14
15
  expect(wrapper).toMatchSnapshot();
15
16
  });
16
17
  it('should render opened without content', () => {
17
- const wrapper = shallow(/*#__PURE__*/React.createElement(Sheet, {
18
+ const wrapper = shallow(/*#__PURE__*/_jsx(Sheet, {
18
19
  isOpen: true
19
20
  }));
20
21
  expect(wrapper).toMatchSnapshot();
21
22
  });
22
23
  it('should render with content and title', () => {
23
- const wrapper = shallow(/*#__PURE__*/React.createElement(Sheet, {
24
+ const wrapper = shallow(/*#__PURE__*/_jsx(Sheet, {
24
25
  isOpen: true,
25
- title: "Test-Title"
26
- }, /*#__PURE__*/React.createElement("div", null, "Test")));
26
+ title: "Test-Title",
27
+ children: /*#__PURE__*/_jsx("div", {
28
+ children: "Test"
29
+ })
30
+ }));
27
31
  expect(wrapper).toMatchSnapshot();
28
32
  });
29
33
  it('should call onDidOpen callback when the Sheet was opened', () => {
30
34
  const onOpen = jest.fn();
31
35
  const onDidOpen = jest.fn();
32
- const wrapper = mount(/*#__PURE__*/React.createElement(Sheet, {
36
+ const wrapper = mount(/*#__PURE__*/_jsx(Sheet, {
33
37
  isOpen: false,
34
38
  onOpen: onOpen,
35
- onDidOpen: onDidOpen
36
- }, /*#__PURE__*/React.createElement("div", null, "Test")), mockRenderOptions);
39
+ onDidOpen: onDidOpen,
40
+ children: /*#__PURE__*/_jsx("div", {
41
+ children: "Test"
42
+ })
43
+ }), mockRenderOptions);
37
44
  expect(onOpen).not.toHaveBeenCalled();
38
45
  expect(onDidOpen).not.toHaveBeenCalled();
39
46
  wrapper.setProps({
@@ -46,11 +53,14 @@ describe('<Sheet />', () => {
46
53
  });
47
54
  it('should trigger onClose callback and close the Sheet', () => {
48
55
  const onCloseSpy = jest.fn();
49
- const wrapper = mount(/*#__PURE__*/React.createElement(Sheet, {
56
+ const wrapper = mount(/*#__PURE__*/_jsx(Sheet, {
50
57
  isOpen: true,
51
58
  title: "Test-Title",
52
- onClose: onCloseSpy
53
- }, /*#__PURE__*/React.createElement("div", null, "Test")), mockRenderOptions);
59
+ onClose: onCloseSpy,
60
+ children: /*#__PURE__*/_jsx("div", {
61
+ children: "Test"
62
+ })
63
+ }), mockRenderOptions);
54
64
 
55
65
  // Trigger a click on the close button of the Sheet.
56
66
  wrapper.find('button').first().simulate('click');
@@ -71,10 +81,13 @@ describe('<Sheet />', () => {
71
81
  });
72
82
  });
73
83
  it('should open', () => {
74
- const wrapper = mount(/*#__PURE__*/React.createElement(Sheet, {
84
+ const wrapper = mount(/*#__PURE__*/_jsx(Sheet, {
75
85
  isOpen: false,
76
- title: "Test-Title"
77
- }, /*#__PURE__*/React.createElement("div", null, "Test")), mockRenderOptions);
86
+ title: "Test-Title",
87
+ children: /*#__PURE__*/_jsx("div", {
88
+ children: "Test"
89
+ })
90
+ }), mockRenderOptions);
78
91
  wrapper.setProps({
79
92
  isOpen: true
80
93
  });
@@ -10,6 +10,7 @@ import styles from "./style";
10
10
  * TaxDisclaimer component.
11
11
  * @returns {Function}
12
12
  */
13
+ import { jsx as _jsx } from "react/jsx-runtime";
13
14
  const TaxDisclaimer = () => {
14
15
  // Added with PWA 6 - CCP-2372
15
16
  const {
@@ -19,18 +20,20 @@ const TaxDisclaimer = () => {
19
20
 
20
21
  // use widget setting if set to true/false, otherwise use market logic
21
22
  const showDisclaimer = typeof show === 'boolean' ? show : showTaxDisclaimer;
22
- return /*#__PURE__*/React.createElement(SurroundPortals, {
23
+ return /*#__PURE__*/_jsx(SurroundPortals, {
23
24
  portalName: PRODUCT_TAX_DISCLAIMER,
24
25
  portalProps: {
25
26
  showTaxDisclaimer: showDisclaimer
26
- }
27
- }, showDisclaimer && /*#__PURE__*/React.createElement("div", {
28
- "data-test-id": "taxDisclaimer",
29
- "aria-hidden": true,
30
- className: "ui-shared__tax-disclaimer"
31
- }, /*#__PURE__*/React.createElement(I18n.Text, {
32
- className: styles,
33
- string: text || 'product.tax_disclaimer'
34
- })));
27
+ },
28
+ children: showDisclaimer && /*#__PURE__*/_jsx("div", {
29
+ "data-test-id": "taxDisclaimer",
30
+ "aria-hidden": true,
31
+ className: "ui-shared__tax-disclaimer",
32
+ children: /*#__PURE__*/_jsx(I18n.Text, {
33
+ className: styles,
34
+ string: text || 'product.tax_disclaimer'
35
+ })
36
+ })
37
+ });
35
38
  };
36
39
  export default TaxDisclaimer;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import I18n from '@shopgate/pwa-common/components/I18n';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
4
5
  jest.mock('@shopgate/engage/core/hooks/useWidgetSettings', () => ({
5
6
  useWidgetSettings: jest.fn().mockReturnValue({
6
7
  show: null,
@@ -16,7 +17,7 @@ describe('<TaxDisclaimer />', () => {
16
17
  jest.mock('@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer', () => true);
17
18
  // eslint-disable-next-line global-require
18
19
  const TaxDisclaimer = require("./index").default;
19
- const wrapper = shallow(/*#__PURE__*/React.createElement(TaxDisclaimer, null));
20
+ const wrapper = shallow(/*#__PURE__*/_jsx(TaxDisclaimer, {}));
20
21
  expect(wrapper).toMatchSnapshot();
21
22
  expect(wrapper.find(I18n.Text).exists()).toBe(true);
22
23
  });
@@ -24,7 +25,7 @@ describe('<TaxDisclaimer />', () => {
24
25
  jest.mock('@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer', () => false);
25
26
  // eslint-disable-next-line global-require
26
27
  const TaxDisclaimer = require("./index").default;
27
- const wrapper = shallow(/*#__PURE__*/React.createElement(TaxDisclaimer, null));
28
+ const wrapper = shallow(/*#__PURE__*/_jsx(TaxDisclaimer, {}));
28
29
  expect(wrapper).toMatchSnapshot();
29
30
  expect(wrapper.find(I18n.Text).exists()).toBe(false);
30
31
  });
@@ -9,6 +9,7 @@ import styles from "./style";
9
9
  * @param {Object} props The component props.
10
10
  * @returns {JSX.Element}
11
11
  */
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
13
  const ErrorText = ({
13
14
  elementName,
14
15
  validationError,
@@ -16,15 +17,16 @@ const ErrorText = ({
16
17
  ariaHidden,
17
18
  translate,
18
19
  className
19
- }) => /*#__PURE__*/React.createElement("div", {
20
+ }) => /*#__PURE__*/_jsxs("div", {
20
21
  id: `ariaError-${elementName}`,
21
22
  className: classNames(className, styles.error, 'errorText'),
22
23
  "aria-live": "assertive",
23
24
  "aria-atomic": "true",
24
- "aria-hidden": ariaHidden
25
- }, translate && /*#__PURE__*/React.createElement(I18n.Text, {
26
- string: validationError || errorText
27
- }), !translate && (validationError || errorText));
25
+ "aria-hidden": ariaHidden,
26
+ children: [translate && /*#__PURE__*/_jsx(I18n.Text, {
27
+ string: validationError || errorText
28
+ }), !translate && (validationError || errorText)]
29
+ });
28
30
  ErrorText.defaultProps = {
29
31
  className: '',
30
32
  errorText: null,
@@ -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 Input from '@shopgate/pwa-common/components/Input';
@@ -9,12 +8,14 @@ import styles from "./style";
9
8
  * @param {Object} props The props.
10
9
  * @returns {JSX.Element}
11
10
  */
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const FormElement = props => {
13
13
  const styleType = props.multiLine ? 'multiLine' : 'input';
14
- return /*#__PURE__*/React.createElement(Input, _extends({}, props, {
14
+ return /*#__PURE__*/_jsx(Input, {
15
+ ...props,
15
16
  className: styles[styleType],
16
17
  validateOnBlur: true
17
- }));
18
+ });
18
19
  };
19
20
  FormElement.defaultProps = {
20
21
  multiLine: false
@@ -10,14 +10,16 @@ import styles from "./style";
10
10
  * @param {boolean} visible Sets the hint visibility.
11
11
  * @return {JSX}
12
12
  */
13
+ import { jsx as _jsx } from "react/jsx-runtime";
13
14
  const Hint = ({
14
15
  hintText,
15
16
  visible
16
- }) => /*#__PURE__*/React.createElement("div", {
17
- className: classNames(styles.hintStyles(visible), 'hint')
18
- }, /*#__PURE__*/React.createElement(I18n.Text, {
19
- string: hintText
20
- }));
17
+ }) => /*#__PURE__*/_jsx("div", {
18
+ className: classNames(styles.hintStyles(visible), 'hint'),
19
+ children: /*#__PURE__*/_jsx(I18n.Text, {
20
+ string: hintText
21
+ })
22
+ });
21
23
  Hint.defaultProps = {
22
24
  hintText: '',
23
25
  visible: false