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

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
@@ -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 I18n from '@shopgate/pwa-common/components/I18n';
@@ -8,6 +9,7 @@ import styles from "./style";
8
9
  * @param {HTMLElement} element The price element
9
10
  * @returns {number} the calculated angle
10
11
  */
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
13
  const calcAngle = element => {
12
14
  /**
13
15
  * If the element is in a hidden container the browser won't calculate it's size.
@@ -31,66 +33,76 @@ const calcAngle = element => {
31
33
  * @param {string} [props.className] CSS classes
32
34
  * @return {JSX}
33
35
  */
34
- class PriceStriked extends Component {
36
+ let PriceStriked = /*#__PURE__*/function (_Component) {
35
37
  /**
36
38
  * Constructor
37
39
  * @param {Object} props The component props
38
40
  */
39
- constructor(props) {
40
- super(props);
41
+ function PriceStriked(props) {
42
+ var _this;
43
+ _this = _Component.call(this, props) || this;
41
44
  /**
42
45
  * Sets the calculated angle for the DOM element
43
46
  * and returns true if succeeded.
44
47
  * @returns {boolean}
45
48
  */
46
- this.setAngle = () => {
47
- if (this.element) {
48
- this.angle = calcAngle(this.element);
49
+ _this.setAngle = () => {
50
+ if (_this.element) {
51
+ _this.angle = calcAngle(_this.element);
49
52
  return true;
50
53
  }
51
54
  return false;
52
55
  };
53
- this.angle = null;
54
- this.element = null;
56
+ _this.angle = null;
57
+ _this.element = null;
58
+ return _this;
55
59
  }
56
60
 
57
61
  /**
58
62
  * Updates the component one more time with the calculated angle
59
63
  * based on the DOM element.
60
64
  */
61
- componentDidMount() {
65
+ _inheritsLoose(PriceStriked, _Component);
66
+ var _proto = PriceStriked.prototype;
67
+ _proto.componentDidMount = function componentDidMount() {
62
68
  if (this.setAngle()) {
63
69
  this.forceUpdate();
64
70
  }
65
- }
71
+ };
66
72
  /**
67
73
  * Renders the component.
68
74
  * @returns {JSX.Element}
69
75
  */
70
- render() {
76
+ _proto.render = function render() {
71
77
  const {
72
78
  __,
73
79
  _p
74
80
  } = this.context.i18n();
75
81
  const angleStyle = this.angle ? styles.getAngleStyle(this.angle) : '';
76
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
77
- className: `${styles.basic} ${this.props.className} ${angleStyle} price-striked ui-shared__price-striked`
78
- }, /*#__PURE__*/React.createElement("span", {
79
- "aria-hidden": true,
80
- ref: ref => {
81
- this.element = ref;
82
- },
83
- "data-test-id": `strikedPrice: ${this.props.value}`
84
- }, /*#__PURE__*/React.createElement(I18n.Price, {
85
- price: this.props.value,
86
- currency: this.props.currency
87
- }))), /*#__PURE__*/React.createElement("span", {
88
- className: "sr-only"
89
- }, __('price.label_old_price', {
90
- price: _p(this.props.value, this.props.currency, true)
91
- })));
92
- }
93
- }
82
+ return /*#__PURE__*/_jsxs(_Fragment, {
83
+ children: [/*#__PURE__*/_jsx("div", {
84
+ className: `${styles.basic} ${this.props.className} ${angleStyle} price-striked ui-shared__price-striked`,
85
+ children: /*#__PURE__*/_jsx("span", {
86
+ "aria-hidden": true,
87
+ ref: ref => {
88
+ this.element = ref;
89
+ },
90
+ "data-test-id": `strikedPrice: ${this.props.value}`,
91
+ children: /*#__PURE__*/_jsx(I18n.Price, {
92
+ price: this.props.value,
93
+ currency: this.props.currency
94
+ })
95
+ })
96
+ }), /*#__PURE__*/_jsx("span", {
97
+ className: "sr-only",
98
+ children: __('price.label_old_price', {
99
+ price: _p(this.props.value, this.props.currency, true)
100
+ })
101
+ })]
102
+ });
103
+ };
104
+ return PriceStriked;
105
+ }(Component);
94
106
  PriceStriked.defaultProps = {
95
107
  className: ''
96
108
  };
@@ -8,6 +8,7 @@ import Ellipsis from '@shopgate/pwa-common/components/Ellipsis';
8
8
  * @param {Object} props The component props.
9
9
  * @returns {JSX}
10
10
  */
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
12
  const Properties = ({
12
13
  lineClamp,
13
14
  properties,
@@ -16,16 +17,18 @@ const Properties = ({
16
17
  if (!properties.length) {
17
18
  return null;
18
19
  }
19
- return /*#__PURE__*/React.createElement("ul", {
20
- className: classNames(className, 'ui-shared__product-properties')
21
- }, properties.map(({
22
- label,
23
- value
24
- }) => /*#__PURE__*/React.createElement("li", {
25
- key: `${label}-${value}`
26
- }, lineClamp && /*#__PURE__*/React.createElement(Ellipsis, {
27
- rows: lineClamp
28
- }, `${label}: ${value}`), !lineClamp && `${label}: ${value}`)));
20
+ return /*#__PURE__*/_jsx("ul", {
21
+ className: classNames(className, 'ui-shared__product-properties'),
22
+ children: properties.map(({
23
+ label,
24
+ value
25
+ }) => /*#__PURE__*/_jsxs("li", {
26
+ children: [lineClamp && /*#__PURE__*/_jsx(Ellipsis, {
27
+ rows: lineClamp,
28
+ children: `${label}: ${value}`
29
+ }), !lineClamp && `${label}: ${value}`]
30
+ }, `${label}-${value}`))
31
+ });
29
32
  };
30
33
  Properties.defaultProps = {
31
34
  className: null,
@@ -1,9 +1,11 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  var _ProgressBar;
2
3
  import React, { Component } from 'react';
3
4
  import PropTypes from 'prop-types';
4
5
  import Transition from 'react-transition-group/Transition';
5
6
  import UIEvents from '@shopgate/pwa-core/emitters/ui';
6
7
  import styles from "./style";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
7
9
  const duration = 150;
8
10
  const transitionStyles = {
9
11
  entering: {
@@ -24,24 +26,28 @@ const transitionStyles = {
24
26
  * A component for visualizing any kind of progress.
25
27
  * This component will show the current progress in a linear bar.
26
28
  */
27
- class ProgressBar extends Component {
29
+ let ProgressBar = /*#__PURE__*/function (_Component) {
28
30
  /**
29
31
  * The constructor
30
32
  * @param {Object} props The component props.
31
33
  */
32
- constructor(props) {
33
- super(props);
34
- this.state = {
34
+ function ProgressBar(props) {
35
+ var _this;
36
+ _this = _Component.call(this, props) || this;
37
+ _this.state = {
35
38
  isAnimating: props.isVisible,
36
39
  isVisible: props.isVisible
37
40
  };
41
+ return _this;
38
42
  }
39
43
 
40
44
  /**
41
45
  * Update the state based on props.
42
46
  * @param {Object} nextProps The next set of props.
43
47
  */
44
- UNSAFE_componentWillReceiveProps(nextProps) {
48
+ _inheritsLoose(ProgressBar, _Component);
49
+ var _proto = ProgressBar.prototype;
50
+ _proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
45
51
  if (this.props.isVisible === nextProps.isVisible) {
46
52
  return;
47
53
  }
@@ -58,38 +64,41 @@ class ProgressBar extends Component {
58
64
  * @param {Object} nextProps The next set of props.
59
65
  * @param {Object} nextState The next component state.
60
66
  * @returns {boolean}
61
- */
62
- shouldComponentUpdate(nextProps, nextState) {
67
+ */;
68
+ _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
63
69
  return this.state.isAnimating !== nextState.isAnimating || this.state.isVisible !== nextState.isVisible;
64
70
  }
65
71
 
66
72
  /**
67
73
  * Renders the component.
68
74
  * @return {JSX}
69
- */
70
- render() {
75
+ */;
76
+ _proto.render = function render() {
71
77
  const animationClasses = [styles.innerElement];
72
78
 
73
79
  // Add the animation if we need it.
74
80
  if (this.state.isAnimating) {
75
81
  animationClasses.push(styles.animating);
76
82
  }
77
- return /*#__PURE__*/React.createElement(Transition, {
83
+ return /*#__PURE__*/_jsx(Transition, {
78
84
  in: this.state.isVisible,
79
85
  timeout: duration,
80
86
  onExited: () => {
81
87
  this.setState({
82
88
  isAnimating: false
83
89
  });
84
- }
85
- }, state => /*#__PURE__*/React.createElement("div", {
86
- className: `${styles.wrapper()} ui-shared__progress-bar`,
87
- style: transitionStyles[state]
88
- }, /*#__PURE__*/React.createElement("div", {
89
- className: animationClasses.join(' ')
90
- })));
91
- }
92
- }
90
+ },
91
+ children: state => /*#__PURE__*/_jsx("div", {
92
+ className: `${styles.wrapper()} ui-shared__progress-bar`,
93
+ style: transitionStyles[state],
94
+ children: /*#__PURE__*/_jsx("div", {
95
+ className: animationClasses.join(' ')
96
+ })
97
+ })
98
+ });
99
+ };
100
+ return ProgressBar;
101
+ }(Component);
93
102
  _ProgressBar = ProgressBar;
94
103
  ProgressBar.PROGRESS_BAR_SHOW = 'PROGRESS_BAR_SHOW';
95
104
  ProgressBar.PROGRESS_BAR_HIDE = 'PROGRESS_BAR_HIDE';
@@ -2,9 +2,10 @@ import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import Transition from 'react-transition-group/Transition';
4
4
  import ProgressBar from "./index";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
5
6
  describe('<ProgressBar />', () => {
6
7
  it('renders an indeterminate progress bar.', () => {
7
- const wrapper = shallow(/*#__PURE__*/React.createElement(ProgressBar, {
8
+ const wrapper = shallow(/*#__PURE__*/_jsx(ProgressBar, {
8
9
  isVisible: true
9
10
  }));
10
11
  expect(wrapper).toMatchSnapshot();
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import React from 'react';
3
2
  import BaseCheckbox from '@shopgate/pwa-common/components/Checkbox';
4
3
  import CheckedIcon from "../icons/RadioCheckedIcon";
@@ -10,12 +9,14 @@ import styles from "./style";
10
9
  * @param {Object} props The component properties.
11
10
  * @returns {JSX}
12
11
  */
13
- const RadioButton = props => /*#__PURE__*/React.createElement(BaseCheckbox, _extends({}, props, {
14
- checkedIcon: /*#__PURE__*/React.createElement(CheckedIcon, {
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ const RadioButton = props => /*#__PURE__*/_jsx(BaseCheckbox, {
14
+ ...props,
15
+ checkedIcon: /*#__PURE__*/_jsx(CheckedIcon, {
15
16
  className: styles.checkedIcon
16
17
  }),
17
- uncheckedIcon: /*#__PURE__*/React.createElement(UncheckedIcon, {
18
+ uncheckedIcon: /*#__PURE__*/_jsx(UncheckedIcon, {
18
19
  className: styles.uncheckedIcon
19
20
  })
20
- }));
21
+ });
21
22
  export default RadioButton;
@@ -3,9 +3,10 @@ import { mount } from 'enzyme';
3
3
  import CheckedIcon from "../icons/RadioCheckedIcon";
4
4
  import UncheckedIcon from "../icons/RadioUncheckedIcon";
5
5
  import RadioButton from "./index";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
6
7
  describe('RadioButton', () => {
7
8
  it('should render selected RadioButton', () => {
8
- const wrapper = mount(/*#__PURE__*/React.createElement(RadioButton, {
9
+ const wrapper = mount(/*#__PURE__*/_jsx(RadioButton, {
9
10
  checked: true
10
11
  }));
11
12
  expect(wrapper.find(CheckedIcon).exists()).toBe(true);
@@ -13,7 +14,7 @@ describe('RadioButton', () => {
13
14
  expect(wrapper).toMatchSnapshot();
14
15
  });
15
16
  it('should render unselected RadioButton', () => {
16
- const wrapper = mount(/*#__PURE__*/React.createElement(RadioButton, null));
17
+ const wrapper = mount(/*#__PURE__*/_jsx(RadioButton, {}));
17
18
  expect(wrapper.find(CheckedIcon).exists()).toBe(false);
18
19
  expect(wrapper.find(UncheckedIcon).exists()).toBe(true);
19
20
  expect(wrapper).toMatchSnapshot();
@@ -10,6 +10,7 @@ import { RATING_SCALE_DIVISOR } from "../RatingStars/constants";
10
10
  * @param {string} props.className Class name.
11
11
  * @returns {JSX.Element}
12
12
  */
13
+ import { jsx as _jsx } from "react/jsx-runtime";
13
14
  const RatingNumber = ({
14
15
  rating,
15
16
  className
@@ -21,7 +22,7 @@ const RatingNumber = ({
21
22
  if (Number.isNaN(number)) {
22
23
  return null;
23
24
  }
24
- return /*#__PURE__*/React.createElement(I18n.Number, {
25
+ return /*#__PURE__*/_jsx(I18n.Number, {
25
26
  number: number,
26
27
  className: `${className} ui-shared__rating-number`,
27
28
  fractions: 2
@@ -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 times from 'lodash/times';
@@ -9,7 +10,7 @@ import { RATING_SCALE_DIVISOR } from "./constants";
9
10
  /**
10
11
  * The available style keys for the rating stars.
11
12
  */
12
-
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
14
  const numStars = 5;
14
15
 
15
16
  /**
@@ -17,13 +18,18 @@ const numStars = 5;
17
18
  * @param {Object} props The component props.
18
19
  * @returns {JSX}
19
20
  */
20
- class RatingStars extends Component {
21
+ let RatingStars = /*#__PURE__*/function (_Component) {
22
+ function RatingStars() {
23
+ return _Component.apply(this, arguments) || this;
24
+ }
25
+ _inheritsLoose(RatingStars, _Component);
26
+ var _proto = RatingStars.prototype;
21
27
  /**
22
28
  * Only update the component if the star rating changed.
23
29
  * @param {Object} nextProps The next component props.
24
30
  * @returns {boolean}
25
31
  */
26
- shouldComponentUpdate(nextProps) {
32
+ _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
27
33
  return nextProps.value !== this.props.value;
28
34
  }
29
35
 
@@ -31,8 +37,8 @@ class RatingStars extends Component {
31
37
  * Returns textual version of stars for screen readers.
32
38
  * @param {number} stars Number of stars.
33
39
  * @returns {string}
34
- */
35
- getTextualFinal(stars) {
40
+ */;
41
+ _proto.getTextualFinal = function getTextualFinal(stars) {
36
42
  const {
37
43
  __
38
44
  } = this.context.i18n();
@@ -46,8 +52,8 @@ class RatingStars extends Component {
46
52
  * Returns text for call to a
47
53
  * @param {number} stars Number of stars.
48
54
  * @returns {string}
49
- */
50
- getTextualCTA(stars) {
55
+ */;
56
+ _proto.getTextualCTA = function getTextualCTA(stars) {
51
57
  const {
52
58
  __
53
59
  } = this.context.i18n();
@@ -60,8 +66,8 @@ class RatingStars extends Component {
60
66
  * Handles click on RatingStars.
61
67
  * @param {Object} e SyntheticEvent.
62
68
  * @param {number} pos Position/Index of clicked RatingStar.
63
- */
64
- handleSelection(e, pos) {
69
+ */;
70
+ _proto.handleSelection = function handleSelection(e, pos) {
65
71
  const {
66
72
  onSelection
67
73
  } = this.props;
@@ -72,8 +78,8 @@ class RatingStars extends Component {
72
78
  /**
73
79
  * Renders the component.
74
80
  * @returns {JSX.Element}
75
- */
76
- render() {
81
+ */;
82
+ _proto.render = function render() {
77
83
  const {
78
84
  value,
79
85
  isSelectable
@@ -84,7 +90,7 @@ class RatingStars extends Component {
84
90
  const size = styles.iconStyles[this.props.display].iconSize;
85
91
  const className = [styles.container, this.props.className, 'ui-shared__rating-stars'].join(' ');
86
92
  const iconClassName = [styles.iconStyles[this.props.display].iconStyle, styles.icon].join(' ');
87
- const emptyStars = [...times(numStars, i => {
93
+ const emptyStars = [].concat(times(numStars, i => {
88
94
  const pos = i + 1;
89
95
  const starProps = {
90
96
  className: iconClassName,
@@ -95,11 +101,14 @@ class RatingStars extends Component {
95
101
  onClick: e => this.handleSelection(e, pos)
96
102
  })
97
103
  };
98
- return /*#__PURE__*/React.createElement("div", starProps, /*#__PURE__*/React.createElement(StarIcon, {
99
- size: size
100
- }));
101
- })];
102
- const filledStars = [...times(numFullStars, i => {
104
+ return /*#__PURE__*/_jsx("div", {
105
+ ...starProps,
106
+ children: /*#__PURE__*/_jsx(StarIcon, {
107
+ size: size
108
+ })
109
+ });
110
+ }));
111
+ const filledStars = [].concat(times(numFullStars, i => {
103
112
  const pos = i + 1;
104
113
  const starProps = {
105
114
  className: iconClassName,
@@ -111,27 +120,34 @@ class RatingStars extends Component {
111
120
  onClick: e => this.handleSelection(e, pos)
112
121
  })
113
122
  };
114
- return /*#__PURE__*/React.createElement("div", starProps, /*#__PURE__*/React.createElement(StarIcon, {
115
- size: size
116
- }));
117
- }), ...times(numHalfStars, i => /*#__PURE__*/React.createElement("div", {
123
+ return /*#__PURE__*/_jsx("div", {
124
+ ...starProps,
125
+ children: /*#__PURE__*/_jsx(StarIcon, {
126
+ size: size
127
+ })
128
+ });
129
+ }), times(numHalfStars, i => /*#__PURE__*/_jsx("div", {
118
130
  className: iconClassName,
119
- key: i + numFullStars
120
- }, /*#__PURE__*/React.createElement(StarHalfIcon, {
121
- size: size
122
- })))];
123
- return /*#__PURE__*/React.createElement("div", {
131
+ children: /*#__PURE__*/_jsx(StarHalfIcon, {
132
+ size: size
133
+ })
134
+ }, i + numFullStars)));
135
+ return /*#__PURE__*/_jsxs("div", {
124
136
  role: isSelectable ? undefined : 'img',
125
137
  className: className,
126
138
  "aria-label": this.getTextualFinal(ratedStars),
127
- "data-test-id": `ratedStars: ${ratedStars}`
128
- }, /*#__PURE__*/React.createElement("div", {
129
- className: `${styles.emptyStars} rating-stars-empty`
130
- }, emptyStars), /*#__PURE__*/React.createElement("div", {
131
- className: `${styles.filledStars} rating-stars-filled`
132
- }, filledStars));
133
- }
134
- }
139
+ "data-test-id": `ratedStars: ${ratedStars}`,
140
+ children: [/*#__PURE__*/_jsx("div", {
141
+ className: `${styles.emptyStars} rating-stars-empty`,
142
+ children: emptyStars
143
+ }), /*#__PURE__*/_jsx("div", {
144
+ className: `${styles.filledStars} rating-stars-filled`,
145
+ children: filledStars
146
+ })]
147
+ });
148
+ };
149
+ return RatingStars;
150
+ }(Component);
135
151
  /**
136
152
  * Context types definition.
137
153
  * @type {{i18n: function}}
@@ -4,10 +4,11 @@ import mockRenderOptions from '@shopgate/pwa-common/helpers/mocks/mockRenderOpti
4
4
  import StarIcon from "../icons/StarIcon";
5
5
  import StarHalfIcon from "../icons/StarHalfIcon";
6
6
  import RatingStars from "./index";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
7
8
  const numEmptyStars = 5;
8
9
  describe('<RatingStars />', () => {
9
10
  it('renders with value of 50', () => {
10
- const wrapper = shallow(/*#__PURE__*/React.createElement(RatingStars, {
11
+ const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
11
12
  value: 50
12
13
  }), mockRenderOptions);
13
14
  expect(wrapper).toMatchSnapshot();
@@ -15,7 +16,7 @@ describe('<RatingStars />', () => {
15
16
  expect(wrapper.find(StarHalfIcon).length).toBe(1);
16
17
  });
17
18
  it('renders with value of 0', () => {
18
- const wrapper = shallow(/*#__PURE__*/React.createElement(RatingStars, {
19
+ const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
19
20
  value: 0
20
21
  }), mockRenderOptions);
21
22
  expect(wrapper).toMatchSnapshot();
@@ -23,7 +24,7 @@ describe('<RatingStars />', () => {
23
24
  expect(wrapper.find(StarHalfIcon).length).toBe(0);
24
25
  });
25
26
  it('renders with value of 100', () => {
26
- const wrapper = shallow(/*#__PURE__*/React.createElement(RatingStars, {
27
+ const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
27
28
  value: 100
28
29
  }), mockRenderOptions);
29
30
  expect(wrapper).toMatchSnapshot();
@@ -31,7 +32,7 @@ describe('<RatingStars />', () => {
31
32
  expect(wrapper.find(StarHalfIcon).length).toBe(0);
32
33
  });
33
34
  it('should change rating on click', () => {
34
- const wrapper = shallow(/*#__PURE__*/React.createElement(RatingStars, {
35
+ const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
35
36
  value: 100,
36
37
  isSelectable: true
37
38
  }), mockRenderOptions);
@@ -50,7 +51,7 @@ describe('<RatingStars />', () => {
50
51
  });
51
52
  it('should call onSelection callback when component is selectable', () => {
52
53
  const spy = jest.fn();
53
- const wrapper = shallow(/*#__PURE__*/React.createElement(RatingStars, {
54
+ const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
54
55
  value: 100,
55
56
  isSelectable: true,
56
57
  onSelection: e => {
@@ -79,7 +80,7 @@ describe('<RatingStars />', () => {
79
80
  });
80
81
  it('should NOT call onSelection callback when component is NOT selectable', () => {
81
82
  const spy = jest.fn();
82
- const wrapper = shallow(/*#__PURE__*/React.createElement(RatingStars, {
83
+ const wrapper = shallow(/*#__PURE__*/_jsx(RatingStars, {
83
84
  value: 100,
84
85
  onSelection: spy
85
86
  }), mockRenderOptions);
@@ -17,6 +17,7 @@ import style from "../../style";
17
17
  * @param {number} props.y The y coordinate of the ripple center.
18
18
  * @returns {JSX.Element}
19
19
  */
20
+ import { jsx as _jsx } from "react/jsx-runtime";
20
21
  function RippleAnimation({
21
22
  color,
22
23
  duration,
@@ -74,21 +75,22 @@ function RippleAnimation({
74
75
  el.addEventListener('transitionend', handleEnd);
75
76
  return () => el.removeEventListener('transitionend', handleEnd);
76
77
  }, [onComplete]);
77
- return /*#__PURE__*/React.createElement(Transition, {
78
+ return /*#__PURE__*/_jsx(Transition, {
78
79
  in: inProp,
79
80
  timeout: duration,
80
81
  appear: true,
81
82
  mountOnEnter: true,
82
83
  unmountOnExit: true,
83
- nodeRef: nodeRef
84
- }, state => /*#__PURE__*/React.createElement("div", {
85
- ref: nodeRef,
86
- className: style.ripple,
87
- style: {
88
- ...baseStyle,
89
- ...transitionStyles[state]
90
- }
91
- }));
84
+ nodeRef: nodeRef,
85
+ children: state => /*#__PURE__*/_jsx("div", {
86
+ ref: nodeRef,
87
+ className: style.ripple,
88
+ style: {
89
+ ...baseStyle,
90
+ ...transitionStyles[state]
91
+ }
92
+ })
93
+ });
92
94
  }
93
95
  RippleAnimation.defaultProps = {
94
96
  color: themeConfig.colors.dark,