@shopgate/pwa-ui-shared 7.30.0-alpha.7 → 7.30.0-alpha.9

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 (266) hide show
  1. package/AccordionContainer/index.js +39 -5
  2. package/AccordionContainer/spec.js +25 -2
  3. package/ActionButton/index.js +63 -7
  4. package/ActionButton/spec.js +63 -2
  5. package/ActionButton/style.js +22 -1
  6. package/AddToCartButton/index.js +184 -27
  7. package/AddToCartButton/mock.js +18 -4
  8. package/AddToCartButton/spec.js +65 -2
  9. package/AddToCartButton/style.js +127 -11
  10. package/Availability/index.js +34 -2
  11. package/Availability/spec.js +41 -1
  12. package/Availability/style.js +19 -1
  13. package/Button/index.js +76 -5
  14. package/Button/spec.js +33 -1
  15. package/Button/style.js +130 -21
  16. package/ButtonLink/connector.js +11 -2
  17. package/ButtonLink/index.js +44 -6
  18. package/ButtonLink/spec.js +23 -1
  19. package/Card/index.js +19 -2
  20. package/Card/style.js +11 -1
  21. package/CardList/components/Item/index.js +26 -2
  22. package/CardList/components/Item/style.js +7 -1
  23. package/CardList/index.js +34 -3
  24. package/CartTotalLine/components/Amount/index.js +28 -2
  25. package/CartTotalLine/components/Amount/style.js +8 -1
  26. package/CartTotalLine/components/Hint/index.js +23 -2
  27. package/CartTotalLine/components/Hint/style.js +12 -1
  28. package/CartTotalLine/components/Label/index.js +36 -2
  29. package/CartTotalLine/components/Label/style.js +17 -1
  30. package/CartTotalLine/components/Spacer/index.js +16 -2
  31. package/CartTotalLine/index.js +39 -2
  32. package/CartTotalLine/style.js +31 -1
  33. package/Checkbox/index.js +31 -2
  34. package/Checkbox/style.js +18 -1
  35. package/Chip/index.js +61 -2
  36. package/Chip/spec.js +24 -1
  37. package/Chip/style.js +71 -3
  38. package/ContextMenu/ContextMenu.hooks.js +6 -2
  39. package/ContextMenu/ContextMenuProvider.context.js +9 -3
  40. package/ContextMenu/ContextMenuProvider.js +21 -2
  41. package/ContextMenu/components/Item/index.js +67 -5
  42. package/ContextMenu/components/Item/style.js +32 -3
  43. package/ContextMenu/components/Position/index.js +61 -10
  44. package/ContextMenu/components/Position/style.js +11 -1
  45. package/ContextMenu/index.js +124 -3
  46. package/ContextMenu/spec.js +101 -2
  47. package/ContextMenu/style.js +45 -1
  48. package/Dialog/components/BasicDialog/index.js +5 -1
  49. package/Dialog/components/HtmlContentDialog/index.js +22 -2
  50. package/Dialog/components/HtmlContentDialog/spec.js +59 -1
  51. package/Dialog/components/PipelineErrorDialog/index.js +114 -25
  52. package/Dialog/components/PipelineErrorDialog/spec.js +92 -12
  53. package/Dialog/components/TextMessageDialog/index.js +28 -2
  54. package/Dialog/components/TextMessageDialog/spec.js +59 -1
  55. package/Dialog/components/VariantSelectModal/connector.js +11 -2
  56. package/Dialog/components/VariantSelectModal/index.js +65 -6
  57. package/Dialog/components/VariantSelectModal/spec.js +51 -2
  58. package/Dialog/constants.js +6 -1
  59. package/Dialog/index.js +114 -7
  60. package/Dialog/spec.js +81 -3
  61. package/DiscountBadge/index.js +30 -2
  62. package/DiscountBadge/spec.js +19 -1
  63. package/DiscountBadge/style.js +34 -2
  64. package/FavoritesButton/connector.js +18 -3
  65. package/FavoritesButton/index.js +118 -15
  66. package/FavoritesButton/mock.js +50 -4
  67. package/FavoritesButton/spec.js +120 -2
  68. package/FavoritesButton/style.js +26 -1
  69. package/Form/Builder/builders/buildCountryList.js +40 -6
  70. package/Form/Builder/builders/buildFormDefaults.js +35 -6
  71. package/Form/Builder/builders/buildFormElements.js +68 -10
  72. package/Form/Builder/builders/buildProvinceList.js +19 -2
  73. package/Form/Builder/builders/buildValidationErrorList.js +7 -2
  74. package/Form/Builder/classes/ActionListener/constants.js +22 -2
  75. package/Form/Builder/classes/ActionListener/index.js +441 -93
  76. package/Form/Builder/classes/ActionListener/spec.js +321 -19
  77. package/Form/Builder/components/CheckboxElement.js +35 -3
  78. package/Form/Builder/components/CountryElement.js +40 -3
  79. package/Form/Builder/components/ProvinceElement.js +40 -3
  80. package/Form/Builder/components/RadioElement.js +41 -3
  81. package/Form/Builder/components/SelectElement.js +39 -3
  82. package/Form/Builder/components/TextElement.js +49 -4
  83. package/Form/Builder/elementTypes.js +11 -1
  84. package/Form/Builder/index.js +298 -52
  85. package/Form/Builder/iso-3166-2.js +4943 -1
  86. package/Form/Builder/spec.js +308 -16
  87. package/Form/Checkbox/index.js +66 -4
  88. package/Form/Checkbox/style.js +25 -2
  89. package/Form/InfoField/index.js +50 -2
  90. package/Form/InfoField/spec.js +9 -1
  91. package/Form/InfoField/style.js +11 -1
  92. package/Form/Password/index.js +51 -6
  93. package/Form/Password/spec.js +34 -1
  94. package/Form/Password/style.js +11 -1
  95. package/Form/RadioGroup/components/Item/index.js +59 -3
  96. package/Form/RadioGroup/components/Item/style.js +32 -2
  97. package/Form/RadioGroup/index.js +101 -9
  98. package/Form/RadioGroup/spec.js +83 -3
  99. package/Form/RadioGroup/style.js +18 -2
  100. package/Form/Select/index.js +158 -10
  101. package/Form/Select/spec.js +36 -5
  102. package/Form/Select/style.js +27 -1
  103. package/Form/SelectContextChoices/index.js +77 -3
  104. package/Form/SelectContextChoices/spec.js +33 -4
  105. package/Form/SelectContextChoices/style.js +23 -1
  106. package/Form/TextField/index.js +92 -8
  107. package/Form/TextField/spec.js +110 -1
  108. package/Form/TextField/style.js +66 -8
  109. package/Form/index.js +54 -13
  110. package/FormElement/components/ErrorText/index.js +31 -2
  111. package/FormElement/components/ErrorText/style.js +13 -1
  112. package/FormElement/components/Label/index.js +35 -2
  113. package/FormElement/components/Label/style.js +76 -8
  114. package/FormElement/components/Placeholder/index.js +26 -2
  115. package/FormElement/components/Placeholder/style.js +48 -6
  116. package/FormElement/components/Underline/index.js +18 -2
  117. package/FormElement/components/Underline/style.js +51 -4
  118. package/FormElement/index.js +91 -6
  119. package/FormElement/spec.js +67 -2
  120. package/FormElement/style.js +13 -2
  121. package/Glow/index.js +90 -7
  122. package/Glow/spec.js +9 -1
  123. package/Glow/style.js +18 -1
  124. package/IndicatorCircle/index.js +33 -3
  125. package/IndicatorCircle/spec.js +28 -1
  126. package/IndicatorCircle/style.js +57 -3
  127. package/LoadingIndicator/index.js +29 -2
  128. package/LoadingIndicator/style.js +20 -1
  129. package/Manufacturer/index.js +20 -2
  130. package/Manufacturer/style.js +5 -1
  131. package/MessageBar/index.js +36 -2
  132. package/MessageBar/spec.js +79 -1
  133. package/MessageBar/style.js +38 -1
  134. package/NoResults/components/Icon/index.js +130 -2
  135. package/NoResults/components/Icon/style.js +17 -1
  136. package/NoResults/index.js +46 -2
  137. package/NoResults/style.js +31 -1
  138. package/Placeholder/index.js +25 -3
  139. package/Placeholder/style.js +11 -1
  140. package/PlaceholderLabel/index.js +27 -2
  141. package/PlaceholderLabel/spec.js +19 -1
  142. package/PlaceholderLabel/style.js +12 -1
  143. package/PlaceholderParagraph/index.js +36 -2
  144. package/PlaceholderParagraph/spec.js +19 -1
  145. package/Price/index.js +88 -7
  146. package/Price/style.js +22 -1
  147. package/PriceInfo/index.js +20 -2
  148. package/PriceInfo/style.js +5 -1
  149. package/PriceStriked/index.js +83 -12
  150. package/PriceStriked/style.js +33 -3
  151. package/ProductProperties/index.js +32 -2
  152. package/ProgressBar/index.js +101 -13
  153. package/ProgressBar/spec.js +13 -1
  154. package/ProgressBar/style.js +83 -2
  155. package/RadioButton/index.js +18 -2
  156. package/RadioButton/spec.js +21 -1
  157. package/RadioButton/style.js +21 -1
  158. package/RatingNumber/index.js +29 -2
  159. package/RatingStars/constants.js +2 -1
  160. package/RatingStars/index.js +130 -12
  161. package/RatingStars/spec.js +90 -3
  162. package/RatingStars/style.js +51 -2
  163. package/Ripple/components/RippleAnimation/index.js +88 -6
  164. package/Ripple/index.js +218 -40
  165. package/Ripple/style.js +18 -1
  166. package/RippleButton/index.js +52 -5
  167. package/RippleButton/spec.js +45 -1
  168. package/ScannerOverlay/components/CameraOverlay/index.js +13 -2
  169. package/ScannerOverlay/components/CameraOverlay/style.js +40 -1
  170. package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +34 -2
  171. package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/style.js +28 -1
  172. package/ScannerOverlay/components/ScannerBar/components/ScannerInstructions/index.js +11 -2
  173. package/ScannerOverlay/components/ScannerBar/index.js +31 -2
  174. package/ScannerOverlay/components/ScannerBar/style.js +20 -1
  175. package/ScannerOverlay/index.js +47 -7
  176. package/Sheet/components/Header/components/SearchBar/index.js +46 -2
  177. package/Sheet/components/Header/components/SearchBar/spec.js +21 -3
  178. package/Sheet/components/Header/components/SearchBar/style.js +47 -1
  179. package/Sheet/components/Header/index.js +75 -7
  180. package/Sheet/components/Header/spec.js +14 -1
  181. package/Sheet/components/Header/style.js +50 -1
  182. package/Sheet/index.js +170 -17
  183. package/Sheet/spec.js +85 -5
  184. package/Sheet/style.js +143 -2
  185. package/TaxDisclaimer/index.js +34 -4
  186. package/TaxDisclaimer/spec.js +31 -3
  187. package/TaxDisclaimer/style.js +9 -1
  188. package/TextField/components/ErrorText/index.js +33 -2
  189. package/TextField/components/ErrorText/style.js +25 -3
  190. package/TextField/components/FormElement/index.js +19 -2
  191. package/TextField/components/FormElement/style.js +32 -4
  192. package/TextField/components/Hint/index.js +21 -2
  193. package/TextField/components/Hint/style.js +40 -5
  194. package/TextField/components/Label/index.js +32 -3
  195. package/TextField/components/Label/style.js +68 -8
  196. package/TextField/components/Underline/index.js +19 -2
  197. package/TextField/components/Underline/style.js +51 -4
  198. package/TextField/index.js +189 -27
  199. package/TextField/spec.js +128 -3
  200. package/TextField/style.js +34 -4
  201. package/ToggleIcon/index.js +58 -8
  202. package/ToggleIcon/spec.js +35 -1
  203. package/icons/AccountBoxIcon.js +11 -2
  204. package/icons/AddMoreIcon.js +11 -2
  205. package/icons/ArrowDropIcon.js +11 -2
  206. package/icons/ArrowIcon.js +21 -2
  207. package/icons/BarcodeScannerIcon.js +11 -2
  208. package/icons/BoxIcon.js +11 -2
  209. package/icons/BrowseIcon.js +11 -2
  210. package/icons/BurgerIcon.js +11 -2
  211. package/icons/CalendarIcon.js +15 -3
  212. package/icons/CartCouponIcon.js +72 -2
  213. package/icons/CartIcon.js +11 -2
  214. package/icons/CartPlusIcon.js +11 -2
  215. package/icons/CheckIcon.js +11 -2
  216. package/icons/CheckedIcon.js +11 -2
  217. package/icons/ChevronIcon.js +11 -2
  218. package/icons/CreditCardIcon.js +11 -2
  219. package/icons/CrossIcon.js +11 -2
  220. package/icons/DescriptionIcon.js +11 -2
  221. package/icons/FilterIcon.js +11 -2
  222. package/icons/FlashDisabledIcon.js +11 -2
  223. package/icons/FlashEnabledIcon.js +11 -2
  224. package/icons/GridIcon.js +11 -2
  225. package/icons/HeartIcon.js +11 -2
  226. package/icons/HeartOutlineIcon.js +11 -2
  227. package/icons/HeartPlusIcon.js +12 -2
  228. package/icons/HeartPlusOutlineIcon.js +12 -2
  229. package/icons/HomeIcon.js +11 -2
  230. package/icons/InfoIcon.js +11 -2
  231. package/icons/InfoOutlineIcon.js +11 -2
  232. package/icons/ListIcon.js +11 -2
  233. package/icons/LocalShippingIcon.js +11 -2
  234. package/icons/LocationIcon.js +13 -3
  235. package/icons/LocatorIcon.js +11 -2
  236. package/icons/LockIcon.js +11 -2
  237. package/icons/LogoutIcon.js +11 -2
  238. package/icons/MagnifierIcon.js +11 -2
  239. package/icons/MapMarkerIcon.js +24 -3
  240. package/icons/MoreIcon.js +11 -2
  241. package/icons/MoreVertIcon.js +11 -2
  242. package/icons/NotificationIcon.js +14 -3
  243. package/icons/PersonIcon.js +12 -2
  244. package/icons/PhoneIcon.js +13 -3
  245. package/icons/PlaceholderIcon.js +11 -2
  246. package/icons/RadioCheckedIcon.js +11 -2
  247. package/icons/RadioUncheckedIcon.js +11 -2
  248. package/icons/SecurityIcon.js +11 -2
  249. package/icons/ShippingMethodIcon.js +18 -3
  250. package/icons/ShoppingCartIcon.js +11 -2
  251. package/icons/SortIcon.js +11 -2
  252. package/icons/StarHalfIcon.js +18 -2
  253. package/icons/StarIcon.js +18 -2
  254. package/icons/StarOutlineIcon.js +11 -2
  255. package/icons/StopIcon.js +11 -2
  256. package/icons/TickIcon.js +11 -2
  257. package/icons/TimeIcon.js +14 -3
  258. package/icons/TrashIcon.js +11 -2
  259. package/icons/TrashOutlineIcon.js +12 -2
  260. package/icons/UncheckedIcon.js +11 -2
  261. package/icons/ViewListIcon.js +11 -2
  262. package/icons/VisibilityIcon.js +11 -2
  263. package/icons/VisibilityOffIcon.js +11 -2
  264. package/icons/WarningIcon.js +11 -2
  265. package/index.js +13 -1
  266. package/package.json +5 -5
@@ -1 +1,31 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var wrapper=css({alignItems:'center',display:'flex',flexDirection:'column',height:'100%',width:'100%',justifyContent:'center',textAlign:'center',background:"var(--page-background-color, ".concat(themeConfig.colors.shade8,")")}).toString();var icon=css({width:216,color:"var(--color-primary, ".concat(themeConfig.colors.primary,")")}).toString();var headline=css({fontSize:'1.25rem',fontWeight:500,marginTop:30}).toString();var text=css({marginTop:themeConfig.variables.gap.big,padding:"0 ".concat(themeConfig.variables.gap.big,"px")}).toString();export default{wrapper:wrapper,icon:icon,headline:headline,text:text};
1
+ import { css } from 'glamor';
2
+ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
3
+ const wrapper = css({
4
+ alignItems: 'center',
5
+ display: 'flex',
6
+ flexDirection: 'column',
7
+ height: '100%',
8
+ width: '100%',
9
+ justifyContent: 'center',
10
+ textAlign: 'center',
11
+ background: `var(--page-background-color, ${themeConfig.colors.shade8})`
12
+ }).toString();
13
+ const icon = css({
14
+ width: 216,
15
+ color: `var(--color-primary, ${themeConfig.colors.primary})`
16
+ }).toString();
17
+ const headline = css({
18
+ fontSize: '1.25rem',
19
+ fontWeight: 500,
20
+ marginTop: 30
21
+ }).toString();
22
+ const text = css({
23
+ marginTop: themeConfig.variables.gap.big,
24
+ padding: `0 ${themeConfig.variables.gap.big}px`
25
+ }).toString();
26
+ export default {
27
+ wrapper,
28
+ icon,
29
+ headline,
30
+ text
31
+ };
@@ -1,5 +1,27 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import styles from"./style";/**
1
+ import React, { PureComponent } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styles from "./style";
4
+
5
+ /**
2
6
  * The placeholder component.
3
- */var Placeholder=/*#__PURE__*/function(_PureComponent){function Placeholder(){_classCallCheck(this,Placeholder);return _callSuper(this,Placeholder,arguments);}_inherits(Placeholder,_PureComponent);return _createClass(Placeholder,[{key:"render",value:/**
7
+ */
8
+ class Placeholder extends PureComponent {
9
+ /**
4
10
  * @returns {JSX}
5
- */function render(){return React.createElement("div",{className:"".concat(styles," ui-shared__placeholder"),style:this.props});}}]);}(PureComponent);/* eslint-disable react/no-unused-prop-types */ /* eslint-enable react/no-unused-prop-types */_defineProperty(Placeholder,"defaultProps",{height:0,left:0,top:0,width:0});export default Placeholder;
11
+ */
12
+ render() {
13
+ return /*#__PURE__*/React.createElement("div", {
14
+ className: `${styles} ui-shared__placeholder`,
15
+ style: this.props
16
+ });
17
+ }
18
+ }
19
+ /* eslint-disable react/no-unused-prop-types */
20
+ /* eslint-enable react/no-unused-prop-types */
21
+ Placeholder.defaultProps = {
22
+ height: 0,
23
+ left: 0,
24
+ top: 0,
25
+ width: 0
26
+ };
27
+ export default Placeholder;
@@ -1 +1,11 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var shade7=themeConfig.colors.shade7;export default css({background:"var(--color-background-accent, ".concat(shade7,")"),position:'relative'});
1
+ import { css } from 'glamor';
2
+ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
3
+ const {
4
+ colors: {
5
+ shade7
6
+ }
7
+ } = themeConfig;
8
+ export default css({
9
+ background: `var(--color-background-accent, ${shade7})`,
10
+ position: 'relative'
11
+ });
@@ -1,5 +1,30 @@
1
- import React from'react';import PropTypes from'prop-types';import styles from"./style";/**
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styles from "./style";
4
+
5
+ /**
2
6
  * Placeholder for one line texts.
3
7
  * @param {Object} props The component props.
4
8
  * @return {JSX}
5
- */var PlaceholderLabel=function PlaceholderLabel(_ref){var children=_ref.children,className=_ref.className,ready=_ref.ready,style=_ref.style;if(!ready){return React.createElement("div",{style:style,className:"".concat(styles.label," ").concat(className," ui-shared__placeholder-label")});}return children;};PlaceholderLabel.defaultProps={children:null,className:'',style:null,ready:false};export default PlaceholderLabel;
9
+ */
10
+ const PlaceholderLabel = ({
11
+ children,
12
+ className,
13
+ ready,
14
+ style
15
+ }) => {
16
+ if (!ready) {
17
+ return /*#__PURE__*/React.createElement("div", {
18
+ style: style,
19
+ className: `${styles.label} ${className} ui-shared__placeholder-label`
20
+ });
21
+ }
22
+ return children;
23
+ };
24
+ PlaceholderLabel.defaultProps = {
25
+ children: null,
26
+ className: '',
27
+ style: null,
28
+ ready: false
29
+ };
30
+ export default PlaceholderLabel;
@@ -1 +1,19 @@
1
- import React from'react';import{mount}from'enzyme';import PlaceholderLabel from"./index";describe('<PlaceholderLabel />',function(){it('should render placeholder ',function(){var wrapper=mount(React.createElement(PlaceholderLabel,{ready:false},React.createElement("h1",null,"foo")));expect(wrapper).toMatchSnapshot();expect(wrapper.find('h1').length).toEqual(0);});it('should render children',function(){var wrapper=mount(React.createElement(PlaceholderLabel,{ready:true},React.createElement("h1",null,"foo")));expect(wrapper).toMatchSnapshot();expect(wrapper.find('h1').length).toEqual(1);});});
1
+ import React from 'react';
2
+ import { mount } from 'enzyme';
3
+ import PlaceholderLabel from "./index";
4
+ describe('<PlaceholderLabel />', () => {
5
+ it('should render placeholder ', () => {
6
+ const wrapper = mount(/*#__PURE__*/React.createElement(PlaceholderLabel, {
7
+ ready: false
8
+ }, /*#__PURE__*/React.createElement("h1", null, "foo")));
9
+ expect(wrapper).toMatchSnapshot();
10
+ expect(wrapper.find('h1').length).toEqual(0);
11
+ });
12
+ it('should render children', () => {
13
+ const wrapper = mount(/*#__PURE__*/React.createElement(PlaceholderLabel, {
14
+ ready: true
15
+ }, /*#__PURE__*/React.createElement("h1", null, "foo")));
16
+ expect(wrapper).toMatchSnapshot();
17
+ expect(wrapper.find('h1').length).toEqual(1);
18
+ });
19
+ });
@@ -1 +1,12 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var label=css({background:themeConfig.colors.dark,opacity:0.1,width:'100%',height:16,marginBottom:12}).toString();export default{label:label};
1
+ import { css } from 'glamor';
2
+ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
3
+ const label = css({
4
+ background: themeConfig.colors.dark,
5
+ opacity: 0.1,
6
+ width: '100%',
7
+ height: 16,
8
+ marginBottom: 12
9
+ }).toString();
10
+ export default {
11
+ label
12
+ };
@@ -1,6 +1,40 @@
1
- import React from'react';import PropTypes from'prop-types';import range from'lodash/range';import PlaceholderLabel from"../PlaceholderLabel";var widths=[95,100,92,88,96,93,96,48];/**
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import range from 'lodash/range';
4
+ import PlaceholderLabel from "../PlaceholderLabel";
5
+ const widths = [95, 100, 92, 88, 96, 93, 96, 48];
6
+
7
+ /**
2
8
  * The paragraph placeholder component.
3
9
  * Creates a simple paragraph out of PlaceholderLabels.
4
10
  * @param {Object} props The component props.
5
11
  * @return {JSX}
6
- */var PlaceholderParagraph=function PlaceholderParagraph(_ref){var className=_ref.className,children=_ref.children,lines=_ref.lines,ready=_ref.ready;if(ready){return children;}return React.createElement("div",{className:"ui-shared__placeholder-paragraph"},range(lines).map(function(num){var width=num%2===0?"".concat(widths[(num/2+widths.length)%widths.length],"%"):null;return React.createElement(PlaceholderLabel,{key:num,style:width?{width:width}:null,className:className});}));};PlaceholderParagraph.defaultProps={className:'',lines:3,ready:false};export default PlaceholderParagraph;
12
+ */
13
+ const PlaceholderParagraph = ({
14
+ className,
15
+ children,
16
+ lines,
17
+ ready
18
+ }) => {
19
+ if (ready) {
20
+ return children;
21
+ }
22
+ return /*#__PURE__*/React.createElement("div", {
23
+ className: "ui-shared__placeholder-paragraph"
24
+ }, range(lines).map(num => {
25
+ const width = num % 2 === 0 ? `${widths[(num / 2 + widths.length) % widths.length]}%` : null;
26
+ return /*#__PURE__*/React.createElement(PlaceholderLabel, {
27
+ key: num,
28
+ style: width ? {
29
+ width
30
+ } : null,
31
+ className: className
32
+ });
33
+ }));
34
+ };
35
+ PlaceholderParagraph.defaultProps = {
36
+ className: '',
37
+ lines: 3,
38
+ ready: false
39
+ };
40
+ export default PlaceholderParagraph;
@@ -1 +1,19 @@
1
- import React from'react';import{mount}from'enzyme';import PlaceholderParagraph from"./index";describe('<PlaceholderParagraph />',function(){it('should render placeholder ',function(){var wrapper=mount(React.createElement(PlaceholderParagraph,{ready:false},React.createElement("h1",null,"foo")));expect(wrapper).toMatchSnapshot();expect(wrapper.find('h1').length).toEqual(0);});it('should render children',function(){var wrapper=mount(React.createElement(PlaceholderParagraph,{ready:true},React.createElement("h1",null,"foo")));expect(wrapper).toMatchSnapshot();expect(wrapper.find('h1').length).toEqual(1);});});
1
+ import React from 'react';
2
+ import { mount } from 'enzyme';
3
+ import PlaceholderParagraph from "./index";
4
+ describe('<PlaceholderParagraph />', () => {
5
+ it('should render placeholder ', () => {
6
+ const wrapper = mount(/*#__PURE__*/React.createElement(PlaceholderParagraph, {
7
+ ready: false
8
+ }, /*#__PURE__*/React.createElement("h1", null, "foo")));
9
+ expect(wrapper).toMatchSnapshot();
10
+ expect(wrapper.find('h1').length).toEqual(0);
11
+ });
12
+ it('should render children', () => {
13
+ const wrapper = mount(/*#__PURE__*/React.createElement(PlaceholderParagraph, {
14
+ ready: true
15
+ }, /*#__PURE__*/React.createElement("h1", null, "foo")));
16
+ expect(wrapper).toMatchSnapshot();
17
+ expect(wrapper.find('h1').length).toEqual(1);
18
+ });
19
+ });
package/Price/index.js CHANGED
@@ -1,4 +1,13 @@
1
- function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useMemo}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{I18n}from'@shopgate/engage/components';import showTaxDisclaimer from'@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer';import{useWidgetSettings}from'@shopgate/engage/core/hooks/useWidgetSettings';import styles from"./style";/**
1
+ import "core-js/modules/es.string.replace.js";
2
+ import React, { useMemo } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import classNames from 'classnames';
5
+ import { I18n } from '@shopgate/engage/components';
6
+ import showTaxDisclaimer from '@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer';
7
+ import { useWidgetSettings } from '@shopgate/engage/core/hooks/useWidgetSettings';
8
+ import styles from "./style";
9
+
10
+ /**
2
11
  * The Price component
3
12
  * @param {Object} props The component props
4
13
  * @param {string} [props.className] CSS classes
@@ -8,12 +17,84 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
8
17
  * @param {boolean} props.discounted Tells if the pice is discounted
9
18
  * @param {Object} context The component context.
10
19
  * @return {JSX.Element}
11
- */var Price=function Price(props,context){// Added with PWA 6 - CCP-2372
12
- var _useWidgetSettings=useWidgetSettings('@shopgate/engage/components/TaxDisclaimer'),show=_useWidgetSettings.show,hint=_useWidgetSettings.hint;// use widget setting if set to true/false, otherwise use market logic
13
- var showDisclaimer=typeof show==='boolean'?show:showTaxDisclaimer;var containerClasses=classNames(styles.container,props.className,_defineProperty({},styles.discounted,props.discounted),'price',props.discounted?'ui-shared__price-discounted':'ui-shared__price');var _context$i18n=context.i18n(),__=_context$i18n.__,_p=_context$i18n._p;var ariaPrice;var showFromPrice=useMemo(function(){// unitPriceMin is falsy so we don't have a price range
14
- if(!props.unitPriceMin)return false;// Only show 'from' if we have a price range (both prices are available and different)
15
- return props.unitPriceMin!==props.unitPriceMax;},[props.unitPriceMax,props.unitPriceMin]);if(showFromPrice){ariaPrice=__('price.from',{price:_p(props.unitPriceMin,props.currency,props.fractions)});}else{ariaPrice=_p(props.unitPrice,props.currency,props.fractions);}ariaPrice=ariaPrice.replace('-',"\u2212");/**
20
+ */
21
+ const Price = (props, context) => {
22
+ // Added with PWA 6 - CCP-2372
23
+ const {
24
+ show,
25
+ hint
26
+ } = useWidgetSettings('@shopgate/engage/components/TaxDisclaimer');
27
+
28
+ // use widget setting if set to true/false, otherwise use market logic
29
+ const showDisclaimer = typeof show === 'boolean' ? show : showTaxDisclaimer;
30
+ const containerClasses = classNames(styles.container, props.className, {
31
+ [styles.discounted]: props.discounted
32
+ }, 'price', props.discounted ? 'ui-shared__price-discounted' : 'ui-shared__price');
33
+ const {
34
+ __,
35
+ _p
36
+ } = context.i18n();
37
+ let ariaPrice;
38
+ const showFromPrice = useMemo(() => {
39
+ // unitPriceMin is falsy so we don't have a price range
40
+ if (!props.unitPriceMin) return false;
41
+ // Only show 'from' if we have a price range (both prices are available and different)
42
+ return props.unitPriceMin !== props.unitPriceMax;
43
+ }, [props.unitPriceMax, props.unitPriceMin]);
44
+ if (showFromPrice) {
45
+ ariaPrice = __('price.from', {
46
+ price: _p(props.unitPriceMin, props.currency, props.fractions)
47
+ });
48
+ } else {
49
+ ariaPrice = _p(props.unitPrice, props.currency, props.fractions);
50
+ }
51
+ ariaPrice = ariaPrice.replace('-', '\u2212');
52
+
53
+ /**
16
54
  * A unitPriceMin > 0 means, that the product has child products with different prices.
17
55
  * The unitPriceMin contains the lowest of these prices and will be
18
56
  * displayed with a 'From' prefix.
19
- */return React.createElement("div",{className:containerClasses,"data-test-id":"minPrice: ".concat(props.unitPriceMin," price: ").concat(props.unitPrice," currency: ").concat(props.currency)},React.createElement("span",{"aria-label":__('price.label',{price:ariaPrice})},showFromPrice?React.createElement(I18n.Text,{"aria-hidden":true,string:"price.from"},React.createElement(I18n.Price,{currency:props.currency,fractions:props.fractions,forKey:"price",price:props.unitPriceMin})):React.createElement(React.Fragment,null,props.allowFree&&props.unitPrice===0?React.createElement(I18n.Text,{string:"price.free"}):React.createElement(I18n.Price,{currency:props.currency,fractions:props.fractions,price:props.unitPrice}))),props.taxDisclaimer&&showDisclaimer?React.createElement("div",{className:styles.disclaimer},React.createElement("span",{"aria-hidden":true},hint||'*'),React.createElement("span",{className:"sr-only","aria-label":hint||__('product.tax_disclaimer_aria')},__('product.tax_disclaimer_aria'))):null);};Price.defaultProps={className:'',unitPriceMin:0,unitPriceMax:undefined,discounted:false,fractions:true,taxDisclaimer:false,allowFree:false};Price.contextTypes={i18n:PropTypes.func};export default Price;
57
+ */
58
+ return /*#__PURE__*/React.createElement("div", {
59
+ className: containerClasses,
60
+ "data-test-id": `minPrice: ${props.unitPriceMin} price: ${props.unitPrice} currency: ${props.currency}`
61
+ }, /*#__PURE__*/React.createElement("span", {
62
+ "aria-label": __('price.label', {
63
+ price: ariaPrice
64
+ })
65
+ }, showFromPrice ? /*#__PURE__*/React.createElement(I18n.Text, {
66
+ "aria-hidden": true,
67
+ string: "price.from"
68
+ }, /*#__PURE__*/React.createElement(I18n.Price, {
69
+ currency: props.currency,
70
+ fractions: props.fractions,
71
+ forKey: "price",
72
+ price: props.unitPriceMin
73
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, props.allowFree && props.unitPrice === 0 ? /*#__PURE__*/React.createElement(I18n.Text, {
74
+ string: "price.free"
75
+ }) : /*#__PURE__*/React.createElement(I18n.Price, {
76
+ currency: props.currency,
77
+ fractions: props.fractions,
78
+ price: props.unitPrice
79
+ }))), props.taxDisclaimer && showDisclaimer ? /*#__PURE__*/React.createElement("div", {
80
+ className: styles.disclaimer
81
+ }, /*#__PURE__*/React.createElement("span", {
82
+ "aria-hidden": true
83
+ }, hint || '*'), /*#__PURE__*/React.createElement("span", {
84
+ className: "sr-only",
85
+ "aria-label": hint || __('product.tax_disclaimer_aria')
86
+ }, __('product.tax_disclaimer_aria'))) : null);
87
+ };
88
+ Price.defaultProps = {
89
+ className: '',
90
+ unitPriceMin: 0,
91
+ unitPriceMax: undefined,
92
+ discounted: false,
93
+ fractions: true,
94
+ taxDisclaimer: false,
95
+ allowFree: false
96
+ };
97
+ Price.contextTypes = {
98
+ i18n: PropTypes.func
99
+ };
100
+ export default Price;
package/Price/style.js CHANGED
@@ -1 +1,22 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var container=css({display:'flex',position:'relative',whiteSpace:'nowrap'}).toString();var disclaimer=css({color:'initial',fontSize:14,position:'absolute',right:-10,top:0}).toString();var discounted=css({color:"var(--color-primary, ".concat(themeConfig.colors.primary,")")}).toString();export default{container:container,disclaimer:disclaimer,discounted:discounted};
1
+ import { css } from 'glamor';
2
+ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
3
+ const container = css({
4
+ display: 'flex',
5
+ position: 'relative',
6
+ whiteSpace: 'nowrap'
7
+ }).toString();
8
+ const disclaimer = css({
9
+ color: 'initial',
10
+ fontSize: 14,
11
+ position: 'absolute',
12
+ right: -10,
13
+ top: 0
14
+ }).toString();
15
+ const discounted = css({
16
+ color: `var(--color-primary, ${themeConfig.colors.primary})`
17
+ }).toString();
18
+ export default {
19
+ container,
20
+ disclaimer,
21
+ discounted
22
+ };
@@ -1,7 +1,25 @@
1
- import React from'react';import PropTypes from'prop-types';import styles from"./style";/**
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styles from "./style";
4
+
5
+ /**
2
6
  * The price info component
3
7
  * @param {Object} props The component props
4
8
  * @param {string} props.text The price info string e.g. 12,00 € / l
5
9
  * @param {string} [props.className] CSS classes
6
10
  * @return {JSX}
7
- */var PriceInfo=function PriceInfo(_ref){var className=_ref.className,text=_ref.text;return React.createElement("div",{className:"".concat(styles," ").concat(className," ui-shared__price-info"),dangerouslySetInnerHTML:{__html:text},"data-test-id":"priceInfo: ".concat(text)});};PriceInfo.defaultProps={className:''};export default PriceInfo;
11
+ */
12
+ const PriceInfo = ({
13
+ className,
14
+ text
15
+ }) => /*#__PURE__*/React.createElement("div", {
16
+ className: `${styles} ${className} ui-shared__price-info`,
17
+ dangerouslySetInnerHTML: {
18
+ __html: text
19
+ },
20
+ "data-test-id": `priceInfo: ${text}`
21
+ });
22
+ PriceInfo.defaultProps = {
23
+ className: ''
24
+ };
25
+ export default PriceInfo;
@@ -1 +1,5 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';export default css({color:themeConfig.colors.shade3}).toString();
1
+ import { css } from 'glamor';
2
+ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
3
+ export default css({
4
+ color: themeConfig.colors.shade3
5
+ }).toString();
@@ -1,29 +1,100 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import I18n from'@shopgate/pwa-common/components/I18n';import styles from"./style";/**
1
+ import React, { Component } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import I18n from '@shopgate/pwa-common/components/I18n';
4
+ import styles from "./style";
5
+
6
+ /**
2
7
  * Calculates the angle for the strike-through line
3
8
  * @param {HTMLElement} element The price element
4
9
  * @returns {number} the calculated angle
5
- */var calcAngle=function calcAngle(element){/**
10
+ */
11
+ const calcAngle = element => {
12
+ /**
6
13
  * If the element is in a hidden container the browser won't calculate it's size.
7
14
  * In that case we clone in into a visible container and then remove it again.
8
- */var cloned=element.cloneNode(true);document.body.appendChild(cloned);var width=cloned.offsetWidth;var height=cloned.offsetHeight;document.body.removeChild(cloned);// Calculate the correct angle for the strike-through line
9
- return Math.round(90-Math.atan(width/height)*(180/Math.PI));};/**
15
+ */
16
+ const cloned = element.cloneNode(true);
17
+ document.body.appendChild(cloned);
18
+ const width = cloned.offsetWidth;
19
+ const height = cloned.offsetHeight;
20
+ document.body.removeChild(cloned);
21
+
22
+ // Calculate the correct angle for the strike-through line
23
+ return Math.round(90 - Math.atan(width / height) * (180 / Math.PI));
24
+ };
25
+
26
+ /**
10
27
  * The price striked component
11
28
  * @param {Object} props The component props
12
29
  * @param {number} props.value The striked price of the product
13
30
  * @param {string} props.currency The currency of the price
14
31
  * @param {string} [props.className] CSS classes
15
32
  * @return {JSX}
16
- */var PriceStriked=/*#__PURE__*/function(_Component){/**
33
+ */
34
+ class PriceStriked extends Component {
35
+ /**
17
36
  * Constructor
18
37
  * @param {Object} props The component props
19
- */function PriceStriked(props){var _this2;_classCallCheck(this,PriceStriked);_this2=_callSuper(this,PriceStriked,[props]);/**
20
- * Sets the calculated angle for the DOM element
21
- * and returns true if succeeded.
22
- * @returns {boolean}
23
- */_defineProperty(_this2,"setAngle",function(){if(_this2.element){_this2.angle=calcAngle(_this2.element);return true;}return false;});_this2.angle=null;_this2.element=null;return _this2;}/**
38
+ */
39
+ constructor(props) {
40
+ super(props);
41
+ /**
42
+ * Sets the calculated angle for the DOM element
43
+ * and returns true if succeeded.
44
+ * @returns {boolean}
45
+ */
46
+ this.setAngle = () => {
47
+ if (this.element) {
48
+ this.angle = calcAngle(this.element);
49
+ return true;
50
+ }
51
+ return false;
52
+ };
53
+ this.angle = null;
54
+ this.element = null;
55
+ }
56
+
57
+ /**
24
58
  * Updates the component one more time with the calculated angle
25
59
  * based on the DOM element.
26
- */_inherits(PriceStriked,_Component);return _createClass(PriceStriked,[{key:"componentDidMount",value:function componentDidMount(){if(this.setAngle()){this.forceUpdate();}}},{key:"render",value:/**
60
+ */
61
+ componentDidMount() {
62
+ if (this.setAngle()) {
63
+ this.forceUpdate();
64
+ }
65
+ }
66
+ /**
27
67
  * Renders the component.
28
68
  * @returns {JSX.Element}
29
- */function render(){var _this3=this;var _this$context$i18n=this.context.i18n(),__=_this$context$i18n.__,_p=_this$context$i18n._p;var angleStyle=this.angle?styles.getAngleStyle(this.angle):'';return React.createElement(React.Fragment,null,React.createElement("div",{className:"".concat(styles.basic," ").concat(this.props.className," ").concat(angleStyle," price-striked ui-shared__price-striked")},React.createElement("span",{"aria-hidden":true,ref:function ref(_ref){_this3.element=_ref;},"data-test-id":"strikedPrice: ".concat(this.props.value)},React.createElement(I18n.Price,{price:this.props.value,currency:this.props.currency}))),React.createElement("span",{className:"sr-only"},__('price.label_old_price',{price:_p(this.props.value,this.props.currency,true)})));}}]);}(Component);_defineProperty(PriceStriked,"defaultProps",{className:''});_defineProperty(PriceStriked,"contextTypes",{i18n:PropTypes.func});export default PriceStriked;
69
+ */
70
+ render() {
71
+ const {
72
+ __,
73
+ _p
74
+ } = this.context.i18n();
75
+ 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
+ }
94
+ PriceStriked.defaultProps = {
95
+ className: ''
96
+ };
97
+ PriceStriked.contextTypes = {
98
+ i18n: PropTypes.func
99
+ };
100
+ export default PriceStriked;
@@ -1,6 +1,36 @@
1
- import{css}from'glamor';import{themeColors}from'@shopgate/pwa-common/helpers/config';var basic=css({whiteSpace:'nowrap','& span':{position:'relative',':before':{// The strike-through effect is achieved by using the :before pseudo-class.
2
- borderColor:'currentColor',content:'""',position:'absolute',left:0,right:0,top:'50%'}},color:themeColors.shade11}).toString();/**
1
+ import { css } from 'glamor';
2
+ import { themeColors } from '@shopgate/pwa-common/helpers/config';
3
+ const basic = css({
4
+ whiteSpace: 'nowrap',
5
+ '& span': {
6
+ position: 'relative',
7
+ ':before': {
8
+ // The strike-through effect is achieved by using the :before pseudo-class.
9
+ borderColor: 'currentColor',
10
+ content: '""',
11
+ position: 'absolute',
12
+ left: 0,
13
+ right: 0,
14
+ top: '50%'
15
+ }
16
+ },
17
+ color: themeColors.shade11
18
+ }).toString();
19
+
20
+ /**
3
21
  * Returns a class for the rotated strike-through line.
4
22
  * @param {number} angle The calculated angle for the strike-through line.
5
23
  * @returns {string} Classname
6
- */var getAngleStyle=function getAngleStyle(angle){return css({'& span':{':before':{borderTop:'1px solid',transform:"rotate(-".concat(angle,"deg)")}}}).toString();};export default{basic:basic,getAngleStyle:getAngleStyle};
24
+ */
25
+ const getAngleStyle = angle => css({
26
+ '& span': {
27
+ ':before': {
28
+ borderTop: '1px solid',
29
+ transform: `rotate(-${angle}deg)`
30
+ }
31
+ }
32
+ }).toString();
33
+ export default {
34
+ basic,
35
+ getAngleStyle
36
+ };
@@ -1,5 +1,35 @@
1
- import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import Ellipsis from'@shopgate/pwa-common/components/Ellipsis';/**
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import classNames from 'classnames';
4
+ import Ellipsis from '@shopgate/pwa-common/components/Ellipsis';
5
+
6
+ /**
2
7
  * The Product Properties component.
3
8
  * @param {Object} props The component props.
4
9
  * @returns {JSX}
5
- */var Properties=function Properties(_ref){var lineClamp=_ref.lineClamp,properties=_ref.properties,className=_ref.className;if(!properties.length){return null;}return React.createElement("ul",{className:classNames(className,'ui-shared__product-properties')},properties.map(function(_ref2){var label=_ref2.label,value=_ref2.value;return React.createElement("li",{key:"".concat(label,"-").concat(value)},lineClamp&&React.createElement(Ellipsis,{rows:lineClamp},"".concat(label,": ").concat(value)),!lineClamp&&"".concat(label,": ").concat(value));}));};Properties.defaultProps={className:null,lineClamp:null,properties:[]};export default Properties;
10
+ */
11
+ const Properties = ({
12
+ lineClamp,
13
+ properties,
14
+ className
15
+ }) => {
16
+ if (!properties.length) {
17
+ return null;
18
+ }
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}`)));
29
+ };
30
+ Properties.defaultProps = {
31
+ className: null,
32
+ lineClamp: null,
33
+ properties: []
34
+ };
35
+ export default Properties;