@shopgate/pwa-ui-shared 7.12.3-beta.1 → 7.20.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/AccordionContainer/index.js +3 -3
  2. package/ActionButton/index.js +9 -9
  3. package/AddToCartButton/index.js +14 -7
  4. package/AddToCartButton/mock.js +3 -3
  5. package/AddToCartButton/spec.js +1 -1
  6. package/AddToCartButton/style.js +3 -3
  7. package/Availability/index.js +1 -1
  8. package/Availability/style.js +1 -1
  9. package/Button/index.js +7 -7
  10. package/Button/style.js +8 -2
  11. package/ButtonLink/index.js +6 -3
  12. package/Card/index.js +1 -1
  13. package/CardList/index.js +3 -3
  14. package/CartTotalLine/index.js +1 -1
  15. package/Checkbox/index.js +6 -5
  16. package/Chip/index.js +1 -1
  17. package/ClientInformation/index.js +10 -8
  18. package/ContextMenu/components/Position/index.js +5 -5
  19. package/ContextMenu/index.js +8 -8
  20. package/Dialog/components/PipelineErrorDialog/index.js +21 -13
  21. package/Dialog/components/PipelineErrorDialog/spec.js +1 -1
  22. package/Dialog/index.js +2 -2
  23. package/DiscountBadge/index.js +1 -1
  24. package/FavoritesButton/index.js +14 -14
  25. package/Footer/index.js +7 -7
  26. package/Form/Builder/builders/buildFormElements.js +2 -2
  27. package/Form/Builder/classes/ActionListener/constants.js +2 -2
  28. package/Form/Builder/classes/ActionListener/index.js +73 -16
  29. package/Form/Builder/classes/ActionListener/spec.js +2 -2
  30. package/Form/Builder/components/CheckboxElement.js +3 -3
  31. package/Form/Builder/components/CountryElement.js +3 -3
  32. package/Form/Builder/components/ProvinceElement.js +3 -3
  33. package/Form/Builder/components/RadioElement.js +3 -3
  34. package/Form/Builder/components/SelectElement.js +3 -3
  35. package/Form/Builder/components/TextElement.js +4 -4
  36. package/Form/Builder/index.js +39 -30
  37. package/Form/Checkbox/index.js +3 -3
  38. package/Form/Password/index.js +5 -5
  39. package/Form/RadioGroup/components/Item/index.js +2 -2
  40. package/Form/RadioGroup/index.js +6 -6
  41. package/Form/Select/index.js +10 -8
  42. package/Form/TextField/index.js +5 -5
  43. package/Form/index.js +8 -5
  44. package/FormElement/components/Label/style.js +1 -1
  45. package/FormElement/index.js +6 -6
  46. package/Glow/index.js +7 -7
  47. package/IndicatorCircle/index.js +1 -1
  48. package/LoadingIndicator/index.js +2 -2
  49. package/LoadingIndicator/style.js +1 -1
  50. package/Manufacturer/index.js +1 -1
  51. package/MessageBar/index.js +1 -1
  52. package/NoResults/index.js +1 -1
  53. package/Placeholder/index.js +3 -3
  54. package/PlaceholderLabel/index.js +1 -1
  55. package/PlaceholderParagraph/index.js +1 -1
  56. package/Price/index.js +4 -3
  57. package/PriceInfo/index.js +1 -1
  58. package/PriceStriked/index.js +9 -9
  59. package/ProductProperties/index.js +2 -2
  60. package/ProgressBar/index.js +12 -12
  61. package/RatingNumber/index.js +1 -1
  62. package/RatingStars/index.js +8 -8
  63. package/RatingStars/style.js +1 -1
  64. package/Ripple/components/RippleAnimation/index.js +3 -3
  65. package/Ripple/index.js +20 -17
  66. package/RippleButton/index.js +7 -7
  67. package/ScannerOverlay/components/ScannerBar/index.js +1 -1
  68. package/ScannerOverlay/index.js +4 -4
  69. package/Sheet/components/Header/components/SearchBar/index.js +3 -0
  70. package/Sheet/components/Header/components/SearchBar/spec.js +3 -0
  71. package/Sheet/components/Header/components/SearchBar/style.js +1 -0
  72. package/Sheet/components/Header/index.js +7 -7
  73. package/Sheet/index.js +19 -16
  74. package/Sheet/style.js +2 -1
  75. package/TaxDisclaimer/index.js +3 -2
  76. package/TaxDisclaimer/spec.js +1 -1
  77. package/TextField/components/Label/style.js +1 -1
  78. package/TextField/index.js +23 -14
  79. package/ToggleIcon/index.js +7 -7
  80. package/icons/ArrowIcon.js +2 -2
  81. package/icons/CartCouponIcon.js +5 -0
  82. package/icons/NotificationIcon.js +6 -0
  83. package/package.json +6 -6
@@ -1,8 +1,8 @@
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 _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}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{Component}from'react';import PropTypes from'prop-types';/**
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{Component}from'react';import PropTypes from'prop-types';/**
2
2
  * The Accordion container component.
3
- */var AccordionContainer=/*#__PURE__*/function(_Component){_inherits(AccordionContainer,_Component);function AccordionContainer(props){var _this;_classCallCheck(this,AccordionContainer);_this=_possibleConstructorReturn(this,_getPrototypeOf(AccordionContainer).call(this,props));_defineProperty(_assertThisInitialized(_this),"open",function(){_this.setState({open:true});});_defineProperty(_assertThisInitialized(_this),"close",function(){_this.setState({open:false});});_this.state={open:props.open};return _this;}_createClass(AccordionContainer,[{key:"render",/**
3
+ */var AccordionContainer=/*#__PURE__*/function(_Component){function AccordionContainer(props){var _this2;_classCallCheck(this,AccordionContainer);_this2=_callSuper(this,AccordionContainer,[props]);_defineProperty(_this2,"open",function(){_this2.setState({open:true});});_defineProperty(_this2,"close",function(){_this2.setState({open:false});});_this2.state={open:props.open};return _this2;}_inherits(AccordionContainer,_Component);return _createClass(AccordionContainer,[{key:"render",value:/**
4
4
  * @returns {JSX}
5
- */value:function render(){return this.props.children({handleClose:this.close,open:this.state.open,handleOpen:this.open});}}]);return AccordionContainer;}(Component);_defineProperty(AccordionContainer,"defaultProps",{open:false/**
5
+ */function render(){return this.props.children({handleClose:this.close,open:this.state.open,handleOpen:this.open});}}]);}(Component);_defineProperty(AccordionContainer,"defaultProps",{open:false/**
6
6
  * Init
7
7
  * @param {Object} props Props
8
8
  */});export default AccordionContainer;
@@ -1,12 +1,12 @@
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 _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}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 _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}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 IndicatorCircle from"../IndicatorCircle";import RippleButton from"../RippleButton";import styles from"./style";/**
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 _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}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 IndicatorCircle from"../IndicatorCircle";import RippleButton from"../RippleButton";import styles from"./style";/**
2
2
  * The action button component.
3
- */var ActionButton=/*#__PURE__*/function(_Component){_inherits(ActionButton,_Component);function ActionButton(){var _getPrototypeOf2;var _this;_classCallCheck(this,ActionButton);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(ActionButton)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"handleClick",function(event){var clickDelay=_this.constructor.clickDelay;setTimeout(function(){_this.props.onClick(event);},clickDelay);});return _this;}_createClass(ActionButton,[{key:"render",/**
4
- * The render function.
5
- * @returns {JSX}
6
- */value:function render(){var containerClass=this.props.noGap?styles.noGapContainer:styles.container;if(this.props.loading){return React.createElement("div",{className:styles.containerCircle},React.createElement(IndicatorCircle,null));}return React.createElement("div",{className:"ui-shared__action-button ".concat(containerClass),"data-test-id":this.props.testId},React.createElement(RippleButton,_extends({},this.buttonProps,{onClick:this.handleClick}),this.props.children));}},{key:"buttonProps",/**
7
- * Getter for the calculated button props.
8
- * @returns {Object}
9
- */get:function get(){var buttonProps={className:this.props.className,disabled:this.props.disabled,flat:this.props.flat,type:this.props.type};return buttonProps;}/**
3
+ */var ActionButton=/*#__PURE__*/function(_Component){function ActionButton(){var _this2;_classCallCheck(this,ActionButton);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this2=_callSuper(this,ActionButton,[].concat(args));/**
10
4
  * The click handler
11
5
  * @param {Object} event The event object for the click handler
12
- */}]);return ActionButton;}(Component);_defineProperty(ActionButton,"clickDelay",300);_defineProperty(ActionButton,"defaultProps",_extends({},RippleButton.defaultProps,{loading:false,type:'primary',flat:true,noGap:false,testId:null}));export default ActionButton;
6
+ */_defineProperty(_this2,"handleClick",function(event){var clickDelay=_this2.constructor.clickDelay;setTimeout(function(){_this2.props.onClick(event);},clickDelay);});return _this2;}_inherits(ActionButton,_Component);return _createClass(ActionButton,[{key:"buttonProps",get:/**
7
+ * Getter for the calculated button props.
8
+ * @returns {Object}
9
+ */function get(){var buttonProps={className:this.props.className,disabled:this.props.disabled,flat:this.props.flat,type:this.props.type};return buttonProps;}},{key:"render",value:/**
10
+ * The render function.
11
+ * @returns {JSX}
12
+ */function render(){var containerClass=this.props.noGap?styles.noGapContainer:styles.container;if(this.props.loading){return React.createElement("div",{className:styles.containerCircle},React.createElement(IndicatorCircle,null));}return React.createElement("div",{className:"ui-shared__action-button ".concat(containerClass),"data-test-id":this.props.testId},React.createElement(RippleButton,_extends({},this.buttonProps,{onClick:this.handleClick}),this.props.children));}}]);}(Component);_defineProperty(ActionButton,"clickDelay",300);_defineProperty(ActionButton,"defaultProps",_extends({},RippleButton.defaultProps,{loading:false,type:'primary',flat:true,noGap:false,testId:null}));export default ActionButton;
@@ -1,20 +1,27 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";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 _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}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 _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}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{themeConfig}from'@shopgate/pwa-common/helpers/config';import{withForwardedRef}from'@shopgate/engage/core';import CartPlusIcon from"../icons/CartPlusIcon";import TickIcon from"../icons/TickIcon";import IndicatorCircle from"../IndicatorCircle";import styles from"./style";/**
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";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 _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}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{themeConfig}from'@shopgate/pwa-common/helpers/config';import{withForwardedRef}from'@shopgate/engage/core';import CartPlusIcon from"../icons/CartPlusIcon";import TickIcon from"../icons/TickIcon";import IndicatorCircle from"../IndicatorCircle";import styles from"./style";/**
2
2
  * AddToCartButton component.
3
- */var AddToCartButton=/*#__PURE__*/function(_Component){_inherits(AddToCartButton,_Component);/**
3
+ */var AddToCartButton=/*#__PURE__*/function(_Component){/**
4
4
  * Constructor for the AddToCartButton component.
5
5
  * @param {Object} props Props for the component.
6
- */function AddToCartButton(props){var _this;_classCallCheck(this,AddToCartButton);_this=_possibleConstructorReturn(this,_getPrototypeOf(AddToCartButton).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleClick",function(e){// Ignore clicks when check mark or loading spinner is shown or the button is disabled.
7
- if(_this.state.showCheckmark||_this.props.isLoading||_this.props.isDisabled){return;}/** */var handleCompletion=function handleCompletion(){_this.setState({showCheckmark:true});setTimeout(function(){_this.setState({showCheckmark:false});},900);};var result=_this.props.onClick(e);if(result instanceof Promise){_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return result;case 3:handleCompletion();_context.next=8;break;case 6:_context.prev=6;_context.t0=_context["catch"](0);case 8:case"end":return _context.stop();}}},_callee,null,[[0,6]]);}))();return;}handleCompletion();});_defineProperty(_assertThisInitialized(_this),"handleCartAnimationEnd",function(){if(_this.state.showCheckmark===false){_this.setState({showCheckmark:null});}_this.props.onReset();});_this.state={showCheckmark:null};return _this;}/**
6
+ */function AddToCartButton(props){var _this2;_classCallCheck(this,AddToCartButton);_this2=_callSuper(this,AddToCartButton,[props]);/**
8
7
  * Handles the button click.
9
8
  * - Show checkmark.
10
9
  * - Add to cart.
11
10
  * - Wait 900ms.
12
11
  * - Show cart icon again.
13
12
  * @param {Event} e Event
14
- */_createClass(AddToCartButton,[{key:"render",/**
13
+ */_defineProperty(_this2,"handleClick",function(e){// Ignore clicks when check mark or loading spinner is shown or the button is disabled.
14
+ if(_this2.state.showCheckmark||_this2.props.isLoading||_this2.props.isDisabled){return;}/** */var handleCompletion=function handleCompletion(){_this2.setState({showCheckmark:true});setTimeout(function(){_this2.setState({showCheckmark:false});},900);};var result=_this2.props.onClick(e);if(result instanceof Promise){_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return result;case 3:handleCompletion();_context.next=8;break;case 6:_context.prev=6;_context.t0=_context["catch"](0);case 8:case"end":return _context.stop();}},_callee,null,[[0,6]]);}))();return;}handleCompletion();});/**
15
+ * Handles the cart animation end event.
16
+ * Resets the showCheckmark state to null in order to
17
+ * prevent the icon from animating after changing visibility
18
+ * of the view.
19
+ * This is caused by CSS animations that get re-applied when
20
+ * setting an element from hidden (display: none) to visible.
21
+ */_defineProperty(_this2,"handleCartAnimationEnd",function(){if(_this2.state.showCheckmark===false){_this2.setState({showCheckmark:null});}_this2.props.onReset();});_this2.state={showCheckmark:null};return _this2;}_inherits(AddToCartButton,_Component);return _createClass(AddToCartButton,[{key:"render",value:/**
15
22
  * Renders the component
16
23
  * @returns {JSX}
17
- */value:function render(){// Set initial base styles
24
+ */function render(){// Set initial base styles
18
25
  var buttonStyle=styles.buttonReady;var tickIconStyle=styles.icon;var cartPlusIconStyle=styles.icon;// Depending on the isLoading prop we only show the spinner or the other way around.
19
26
  var iconOpacity=this.props.isLoading?{opacity:0}:{opacity:1};var spinnerInlineStyle=this.props.isLoading?{opacity:1}:{opacity:0};/**
20
27
  * The initial positions for the icons:
@@ -33,4 +40,4 @@ var iconOpacity=this.props.isLoading?{opacity:0}:{opacity:1};var spinnerInlineSt
33
40
  */tickIconStyle+=" ".concat(styles.springToBottom);cartPlusIconStyle+=" ".concat(styles.springFromTop);/**
34
41
  * After the keyframe animation is done the transform values are reset
35
42
  * We add the inline style to make sure the icons stay where they are even after the animation
36
- */cartInlineStyle=_extends({transform:'translate3d(0, -50%, 0)'},iconOpacity);tickInlineStyle=_extends({transform:'translate3d(0, -300%, 0)'},iconOpacity);}var className=styles.buttonWrapper(this.props.buttonSize,this.props.iconSize);if(this.props.noShadow){className=styles.buttonWrapperNoShadow(this.props.buttonSize,this.props.iconSize);}return React.createElement("button",{"data-test-id":"addToCartButton",className:"".concat(this.props.className," ").concat(className," ").concat(buttonStyle),onClick:this.handleClick,"aria-hidden":this.props['aria-hidden'],"aria-label":this.props['aria-label'],"aria-disabled":this.props.isDisabled,ref:this.props.forwardedRef,type:"button"},this.props.isLoading&&React.createElement("div",{className:"".concat(styles.icon," ").concat(styles.spinnerIcon),style:spinnerInlineStyle},React.createElement(IndicatorCircle,{color:themeConfig.colors.primaryContrast,strokeWidth:5,paused:!this.props.isLoading})),React.createElement("div",{className:tickIconStyle,style:tickInlineStyle},React.createElement(TickIcon,null)),React.createElement("div",{className:cartPlusIconStyle,style:cartInlineStyle,onAnimationEnd:this.handleCartAnimationEnd},React.createElement(CartPlusIcon,null)));}}]);return AddToCartButton;}(Component);_defineProperty(AddToCartButton,"defaultProps",{'aria-hidden':false,'aria-label':null,buttonSize:styles.buttonSize,className:null,forwardedRef:null,iconSize:styles.iconSize,noShadow:false,onReset:function onReset(){}});export default withForwardedRef(AddToCartButton);
43
+ */cartInlineStyle=_extends({transform:'translate3d(0, -50%, 0)'},iconOpacity);tickInlineStyle=_extends({transform:'translate3d(0, -300%, 0)'},iconOpacity);}var className=styles.buttonWrapper(this.props.buttonSize,this.props.iconSize);if(this.props.noShadow){className=styles.buttonWrapperNoShadow(this.props.buttonSize,this.props.iconSize);}return React.createElement("button",{"data-test-id":"addToCartButton",className:"ui-shared__add-to-cart-button ".concat(this.props.className," ").concat(className," ").concat(buttonStyle),onClick:this.handleClick,"aria-hidden":this.props['aria-hidden'],"aria-label":this.props['aria-label'],"aria-disabled":this.props.isDisabled,ref:this.props.forwardedRef,type:"button"},this.props.isLoading&&React.createElement("div",{className:"".concat(styles.icon," ").concat(styles.spinnerIcon),style:spinnerInlineStyle},React.createElement(IndicatorCircle,{color:themeConfig.colors.primaryContrast,strokeWidth:5,paused:!this.props.isLoading})),React.createElement("div",{className:tickIconStyle,style:tickInlineStyle},React.createElement(TickIcon,null)),React.createElement("div",{className:cartPlusIconStyle,style:cartInlineStyle,onAnimationEnd:this.handleCartAnimationEnd},React.createElement(CartPlusIcon,null)));}}]);}(Component);_defineProperty(AddToCartButton,"defaultProps",{'aria-hidden':false,'aria-label':null,buttonSize:styles.buttonSize,className:null,forwardedRef:null,iconSize:styles.iconSize,noShadow:false,onReset:function onReset(){}});export default withForwardedRef(AddToCartButton);
@@ -1,9 +1,9 @@
1
- var _class,_temp;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 _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';/**
1
+ var _Class,_temp;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';/**
2
2
  * Mocked AddToCartButton.
3
3
  * @type {MockedAddToCartButton}
4
4
  * @deprecated
5
5
  */ // eslint-disable-next-line react/prefer-stateless-function
6
- export var MockedAddToCartButton=(_temp=_class=/*#__PURE__*/function(_Component){_inherits(MockedAddToCartButton,_Component);function MockedAddToCartButton(){_classCallCheck(this,MockedAddToCartButton);return _possibleConstructorReturn(this,_getPrototypeOf(MockedAddToCartButton).apply(this,arguments));}_createClass(MockedAddToCartButton,[{key:"render",/**
6
+ export var MockedAddToCartButton=(_temp=_Class=/*#__PURE__*/function(_Component){function MockedAddToCartButton(){_classCallCheck(this,MockedAddToCartButton);return _callSuper(this,MockedAddToCartButton,arguments);}_inherits(MockedAddToCartButton,_Component);return _createClass(MockedAddToCartButton,[{key:"render",value:/**
7
7
  * Renders mocked button.
8
8
  * @return {JSX}
9
- */value:function render(){return React.createElement("button",{onClick:this.props.onClick,type:"button"});}}]);return MockedAddToCartButton;}(Component),_defineProperty(_class,"defaultProps",{onClick:function onClick(){}}),_temp);
9
+ */function render(){return React.createElement("button",{onClick:this.props.onClick,type:"button"});}}]);}(Component),_defineProperty(_Class,"defaultProps",{onClick:function onClick(){}}),_temp);
@@ -1,4 +1,4 @@
1
1
  import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import React from'react';import{mount}from'enzyme';import AddToCartButton from"./index";/**
2
2
  * Flushes the promise queue.
3
3
  * @returns {Promise}
4
- */var flushPromises=function flushPromises(){return new Promise(function(resolve){return setImmediate(resolve);});};describe('<AddToCartButton />',function(){it('should render in loading state and should not be clickable',function(){var spy=jest.fn(function(){return new Promise(function(resolve){return resolve();});});var wrapper=mount(React.createElement(AddToCartButton,{onClick:spy,isLoading:true,isOrderable:true,isDisabled:false}));wrapper.find('button').prop('onClick')();expect(wrapper).toMatchSnapshot();expect(spy).toHaveBeenCalledTimes(0);});it('should render with checkmark icon and should not be clickable the second time',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var spy,wrapper;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:spy=jest.fn(function(){return new Promise(function(resolve){return resolve();});});wrapper=mount(React.createElement(AddToCartButton,{onClick:spy,isLoading:false,isOrderable:true,isDisabled:false}));wrapper.find('button').prop('onClick')();wrapper.update();_context.next=6;return flushPromises();case 6:wrapper.find('button').prop('onClick')();wrapper.update();_context.next=10;return flushPromises();case 10:expect(wrapper).toMatchSnapshot();expect(spy).toHaveBeenCalledTimes(1);case 12:case"end":return _context.stop();}}},_callee);})));it('should render with cart icon and should be clickable',function(){var spy=jest.fn(function(){return new Promise(function(resolve){return resolve();});});var wrapper=mount(React.createElement(AddToCartButton,{onClick:spy,isLoading:false,isOrderable:true,isDisabled:false}));wrapper.find('button').prop('onClick')();expect(wrapper).toMatchSnapshot();expect(spy).toHaveBeenCalledTimes(1);});});
4
+ */var flushPromises=function flushPromises(){return new Promise(function(resolve){return setImmediate(resolve);});};describe('<AddToCartButton />',function(){it('should render in loading state and should not be clickable',function(){var spy=jest.fn(function(){return new Promise(function(resolve){return resolve();});});var wrapper=mount(React.createElement(AddToCartButton,{onClick:spy,isLoading:true,isOrderable:true,isDisabled:false}));wrapper.find('button').prop('onClick')();expect(wrapper).toMatchSnapshot();expect(spy).toHaveBeenCalledTimes(0);});it('should render with checkmark icon and should not be clickable the second time',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var spy,wrapper;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:spy=jest.fn(function(){return new Promise(function(resolve){return resolve();});});wrapper=mount(React.createElement(AddToCartButton,{onClick:spy,isLoading:false,isOrderable:true,isDisabled:false}));wrapper.find('button').prop('onClick')();wrapper.update();_context.next=6;return flushPromises();case 6:wrapper.find('button').prop('onClick')();wrapper.update();_context.next=10;return flushPromises();case 10:expect(wrapper).toMatchSnapshot();expect(spy).toHaveBeenCalledTimes(1);case 12:case"end":return _context.stop();}},_callee);})));it('should render with cart icon and should be clickable',function(){var spy=jest.fn(function(){return new Promise(function(resolve){return resolve();});});var wrapper=mount(React.createElement(AddToCartButton,{onClick:spy,isLoading:false,isOrderable:true,isDisabled:false}));wrapper.find('button').prop('onClick')();expect(wrapper).toMatchSnapshot();expect(spy).toHaveBeenCalledTimes(1);});});
@@ -21,11 +21,11 @@ overflow:'hidden',flexShrink:0};};/**
21
21
  * @return {string} Class name
22
22
  */var buttonWrapperNoShadow=function buttonWrapperNoShadow(bSize,iSize){return css(_extends({},buttonWrapperDefault(bSize,iSize))).toString();};/**
23
23
  * Styling that is applied to the button when cart icon is shown.
24
- */var buttonReady=css({background:"var(--color-primary, ".concat(themeConfig.colors.cta,")"),color:"var(--color-primary-contrast, ".concat(themeConfig.colors.ctaContrast,")")}).toString();/**
24
+ */var buttonReady=css({background:"var(--color-button-cta, ".concat(themeConfig.colors.cta,")"),color:"var(--color-button-cta-contrast, ".concat(themeConfig.colors.ctaContrast,")")}).toString();/**
25
25
  * Styling that is applied to the button when checkmark is shown.
26
- */var buttonSuccess=css({color:"var(--color-primary, ".concat(themeConfig.colors.cta,")"),background:"var(--color-primary-contrast, ".concat(themeConfig.colors.ctaContrast,")")}).toString();/**
26
+ */var buttonSuccess=css({background:"var(--color-button-cta-contrast, ".concat(themeConfig.colors.ctaContrast,")"),color:"var(--color-button-cta, ".concat(themeConfig.colors.cta,")")}).toString();/**
27
27
  * Styling that is applied to the button when it is disabled.
28
- */var buttonDisabled=css({background:themeConfig.colors.shade5,color:themeConfig.colors.ctaContrast,boxShadow:themeConfig.shadows.buttons.disabled}).toString();/**
28
+ */var buttonDisabled=css({background:themeConfig.colors.shade5,color:"var(--color-button-cta-contrast, ".concat(themeConfig.colors.ctaContrast,")"),boxShadow:themeConfig.shadows.buttons.disabled}).toString();/**
29
29
  * Basic icon style that is always applied to all icons.
30
30
  */var icon=css({transition:'opacity 450ms cubic-bezier(0.4, 0.0, 0.2, 1)',opacity:1,position:'absolute'}).toString();/**
31
31
  * Icon style that is applied only to the spinner icon.
@@ -7,4 +7,4 @@ import React from'react';import PropTypes from'prop-types';import{AVAILABILITY_S
7
7
  * state of the availability text is "ok"
8
8
  * @param {string} [props.className] CSS classes
9
9
  * @return {JSX}
10
- */var Availability=function Availability(_ref){var text=_ref.text,state=_ref.state,_ref$showWhenAvailabl=_ref.showWhenAvailable,showWhenAvailable=_ref$showWhenAvailabl===void 0?false:_ref$showWhenAvailabl,_ref$className=_ref.className,className=_ref$className===void 0?null:_ref$className;if(!text||state===AVAILABILITY_STATE_OK&&!showWhenAvailable){return null;}var style=styles.stateOk;if(state===AVAILABILITY_STATE_WARNING){style=styles.stateWarning;}if(state===AVAILABILITY_STATE_ALERT){style=styles.stateAlert;}return React.createElement("div",{className:"".concat(className," ").concat(style),"data-test-id":"availabilityText: ".concat(text)},text);};Availability.defaultProps={className:'',showWhenAvailable:false,state:AVAILABILITY_STATE_OK};export default Availability;
10
+ */var Availability=function Availability(_ref){var text=_ref.text,state=_ref.state,_ref$showWhenAvailabl=_ref.showWhenAvailable,showWhenAvailable=_ref$showWhenAvailabl===void 0?false:_ref$showWhenAvailabl,_ref$className=_ref.className,className=_ref$className===void 0?null:_ref$className;if(!text||state===AVAILABILITY_STATE_OK&&!showWhenAvailable){return null;}var style=styles.stateOk;if(state===AVAILABILITY_STATE_WARNING){style=styles.stateWarning;}if(state===AVAILABILITY_STATE_ALERT){style=styles.stateAlert;}return React.createElement("div",{className:"ui-shared__availability ".concat(className," ").concat(style),"data-test-id":"availabilityText: ".concat(text)},text);};Availability.defaultProps={className:'',showWhenAvailable:false,state:AVAILABILITY_STATE_OK};export default Availability;
@@ -1 +1 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var stateOk=css({color:"var(--color-state-ok, ".concat(themeConfig.colors.success,")")}).toString();var stateWarning=css({color:"var(--color-state-warning, ".concat(themeConfig.colors.warning,")")}).toString();var stateAlert=css({color:"var(--color-state-alert, ".concat(themeConfig.colors.error,")")}).toString();export default{stateOk:stateOk,stateWarning:stateWarning,stateAlert:stateAlert};
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var stateOk=css({fontSize:'0.875rem',color:"var(--color-state-ok, ".concat(themeConfig.colors.success,")")}).toString();var stateWarning=css({fontSize:'0.875rem',color:"var(--color-state-warning, ".concat(themeConfig.colors.warning,")")}).toString();var stateAlert=css({fontSize:'0.875rem',color:"var(--color-state-alert, ".concat(themeConfig.colors.error,")")}).toString();export default{stateOk:stateOk,stateWarning:stateWarning,stateAlert:stateAlert};
package/Button/index.js CHANGED
@@ -1,14 +1,14 @@
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 _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}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 _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 BaseButton from'@shopgate/pwa-common/components/Button';import styles from"./style";/**
1
+ var _excluded=["className","disabled","onClick","testId","type","wrapContent","flat"];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 _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}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 BaseButton from'@shopgate/pwa-common/components/Button';import styles from"./style";/**
2
2
  * The basic button component. This components applies Material Design styles and acts as
3
3
  * base to more feature-rich button components such as ActionButton and RippleButton, but can
4
4
  * also be used as standalone component or any other kind of new button.
5
- */var Button=/*#__PURE__*/function(_Component){_inherits(Button,_Component);function Button(){_classCallCheck(this,Button);return _possibleConstructorReturn(this,_getPrototypeOf(Button).apply(this,arguments));}_createClass(Button,[{key:"render",/**
6
- * Renders the component.
7
- * @return {JSX}
8
- */value:function render(){var style=this.style;var content=this.props.wrapContent?React.createElement("div",{className:style.content},this.props.children):this.props.children;return React.createElement(BaseButton,_extends({},this.buttonProps,{className:"ui-shared__button ".concat(style.button," ").concat(this.props.className),testId:this.props.testId}),content);}},{key:"style",/**
5
+ */var Button=/*#__PURE__*/function(_Component){function Button(){_classCallCheck(this,Button);return _callSuper(this,Button,arguments);}_inherits(Button,_Component);return _createClass(Button,[{key:"style",get:/**
9
6
  * Getter for style depending on prop type.
10
7
  * @returns {Object}
11
- */get:function get(){var _this$props=this.props,flat=_this$props.flat,disabled=_this$props.disabled;switch(this.props.type){case'plain':return styles.plain();case'regular':return styles.regular(disabled);default:case'primary':return styles.primary(disabled,flat);case'secondary':return styles.secondary(disabled,flat);}}/**
8
+ */function get(){var _this$props=this.props,flat=_this$props.flat,disabled=_this$props.disabled;switch(this.props.type){case'plain':return styles.plain();case'regular':return styles.regular(disabled);case'simple':return styles.simple(disabled);default:case'primary':return styles.primary(disabled,flat);case'secondary':return styles.secondary(disabled,flat);}}/**
12
9
  * Getter for the calculated button props.
13
10
  * @returns {Object}
14
- */},{key:"buttonProps",get:function get(){var _this$props2=this.props,className=_this$props2.className,disabled=_this$props2.disabled,onClick=_this$props2.onClick,testId=_this$props2.testId,type=_this$props2.type,wrapContent=_this$props2.wrapContent,flat=_this$props2.flat,rest=_objectWithoutProperties(_this$props2,["className","disabled","onClick","testId","type","wrapContent","flat"]);var buttonProps=_extends({className:className,disabled:disabled,onClick:onClick},rest);return buttonProps;}}]);return Button;}(Component);_defineProperty(Button,"defaultProps",_extends({},BaseButton.defaultProps,{className:'',flat:false,type:'primary',wrapContent:true,testId:'Button'}));export default Button;
11
+ */},{key:"buttonProps",get:function get(){var _this$props2=this.props,className=_this$props2.className,disabled=_this$props2.disabled,onClick=_this$props2.onClick,testId=_this$props2.testId,type=_this$props2.type,wrapContent=_this$props2.wrapContent,flat=_this$props2.flat,rest=_objectWithoutProperties(_this$props2,_excluded);var buttonProps=_extends({className:className,disabled:disabled,onClick:onClick},rest);return buttonProps;}/**
12
+ * Renders the component.
13
+ * @return {JSX}
14
+ */},{key:"render",value:function render(){var style=this.style;var content=this.props.wrapContent?React.createElement("div",{className:style.content},this.props.children):this.props.children;return React.createElement(BaseButton,_extends({},this.buttonProps,{className:"ui-shared__button ".concat(style.button," ").concat(this.props.className),testId:this.props.testId}),content);}}]);}(Component);_defineProperty(Button,"defaultProps",_extends({},BaseButton.defaultProps,{className:'',flat:false,type:'primary',wrapContent:true,testId:'Button'}));export default Button;
package/Button/style.js CHANGED
@@ -3,7 +3,7 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
3
3
  * @param {string} text The text color.
4
4
  * @param {string|null} background The fill color.
5
5
  * @return {Object} The button style.
6
- */var button=function button(text,background){return _extends({position:'relative',display:'inline-block',outline:0,color:text,backgroundColor:background,minWidth:64,':disabled':{cursor:'not-allowed'}},themeConfig.variables.buttonBase);};/**
6
+ */var button=function button(text,background){return _extends({position:'relative',display:'inline-block',outline:0,color:text,backgroundColor:background,minWidth:64,overflow:'hidden',':disabled':{cursor:'not-allowed'}},themeConfig.variables.buttonBase);};/**
7
7
  * The basic content wrapper styles.
8
8
  */var contentWrapper=css({padding:buttonPadding}).toString();/**
9
9
  * Creates the button styles object.
@@ -14,6 +14,12 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
14
14
  * Creates a plain button style object without any styling.
15
15
  * @return {Object}
16
16
  */var plain=function plain(){return{button:css({padding:0,outline:0,border:0,textAlign:'left'}).toString(),content:''};};/**
17
+ * Creates a simple button style object.
18
+ * @param {boolean} disabled Whether this button is disabled.
19
+ * @return {Object}
20
+ */var simple=function simple(disabled){if(disabled){// simple disabled button style.
21
+ return createButtonStyles(themeConfig.colors.shade4,themeConfig.colors.shade7);}// simple enabled button style.
22
+ return createButtonStyles(themeConfig.colors.dark,themeConfig.colors.shade7);};/**
17
23
  * The regular flat button style.
18
24
  * @param {boolean} disabled Whether this button is disabled.
19
25
  * @return {Object} An object of style definitions.
@@ -37,4 +43,4 @@ return createButtonStyles("var(--color-secondary, ".concat(colors.accent,")"),nu
37
43
  return createButtonStyles(colors.shade4,colors.shade7);}// Regular enabled button style.
38
44
  return createButtonStyles("var(--color-primary-contrast, ".concat(colors.primaryContrast,")"),"var(--color-primary, ".concat(colors.primary,")"));}if(disabled){// Flat disabled button style.
39
45
  return createButtonStyles(colors.shade4,null);}// Flat enabled button style.
40
- return createButtonStyles("var(--color-primary, ".concat(colors.primary,")"),null);};export default{plain:plain,regular:regular,primary:primary,secondary:secondary,contentWrapper:contentWrapper};
46
+ return createButtonStyles("var(--color-primary, ".concat(colors.primary,")"),null);};export default{plain:plain,regular:regular,simple:simple,primary:primary,secondary:secondary,contentWrapper:contentWrapper};
@@ -1,6 +1,9 @@
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 _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}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 _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}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 ActionButton from"../ActionButton";import connect from"./connector";/**
1
+ var _excluded=["children","href","navigate"];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 _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}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 ActionButton from"../ActionButton";import connect from"./connector";/**
2
2
  * Simple wrapper around ActionButton so it's easy to render buttons which behave as links.
3
- */var ButtonLink=/*#__PURE__*/function(_Component){_inherits(ButtonLink,_Component);function ButtonLink(){var _getPrototypeOf2;var _this;_classCallCheck(this,ButtonLink);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(ButtonLink)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"handleClick",function(){_this.props.navigate(_this.props.href);});return _this;}_createClass(ButtonLink,[{key:"render",/**
3
+ */var ButtonLink=/*#__PURE__*/function(_Component){function ButtonLink(){var _this2;_classCallCheck(this,ButtonLink);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this2=_callSuper(this,ButtonLink,[].concat(args));/**
4
+ * Opens the given url on click.
5
+ * @returns {undefined}
6
+ */_defineProperty(_this2,"handleClick",function(){_this2.props.navigate(_this2.props.href);});return _this2;}_inherits(ButtonLink,_Component);return _createClass(ButtonLink,[{key:"render",value:/**
4
7
  * Renders an ActionButton and handles link handling.
5
8
  * @returns {XML}
6
- */value:function render(){var _this$props=this.props,children=_this$props.children,href=_this$props.href,navigate=_this$props.navigate,props=_objectWithoutProperties(_this$props,["children","href","navigate"]);return React.createElement(ActionButton,_extends({onClick:this.handleClick,type:"secondary"},props),children);}}]);return ButtonLink;}(Component);_defineProperty(ButtonLink,"defaultProps",{disabled:false,className:'',navigate:function navigate(){},noGap:false,flat:true});export default connect(ButtonLink);export{ButtonLink as UnwrappedButtonLink};
9
+ */function render(){var _this$props=this.props,children=_this$props.children,href=_this$props.href,navigate=_this$props.navigate,props=_objectWithoutProperties(_this$props,_excluded);return React.createElement(ActionButton,_extends({className:"ui-shared__button-link",onClick:this.handleClick,type:"secondary"},props),children);}}]);}(Component);_defineProperty(ButtonLink,"defaultProps",{disabled:false,className:'',navigate:function navigate(){},noGap:false,flat:true});export default connect(ButtonLink);export{ButtonLink as UnwrappedButtonLink};
package/Card/index.js CHANGED
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import styles from"./
2
2
  * Renders the card component.
3
3
  * @param {Object} props The component properties.
4
4
  * @returns {JSX}
5
- */var Card=function Card(_ref){var className=_ref.className,children=_ref.children,id=_ref.id;return React.createElement("div",{className:"".concat(styles," ").concat(className),id:id},children);};Card.defaultProps={className:'',id:null};export default Card;
5
+ */var Card=function Card(_ref){var className=_ref.className,children=_ref.children,id=_ref.id;return React.createElement("div",{className:"ui-shared__card ".concat(styles," ").concat(className),id:id},children);};Card.defaultProps={className:'',id:null};export default Card;
package/CardList/index.js CHANGED
@@ -1,6 +1,6 @@
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 _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,Children,isValidElement}from'react';import PropTypes from'prop-types';import List from'@shopgate/pwa-common/components/List';import Item from"./components/Item";/**
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,Children,isValidElement}from'react';import PropTypes from'prop-types';import List from'@shopgate/pwa-common/components/List';import Item from"./components/Item";/**
2
2
  * The CardList component.
3
- */var CardList=/*#__PURE__*/function(_Component){_inherits(CardList,_Component);function CardList(){_classCallCheck(this,CardList);return _possibleConstructorReturn(this,_getPrototypeOf(CardList).apply(this,arguments));}_createClass(CardList,[{key:"render",/**
3
+ */var CardList=/*#__PURE__*/function(_Component){function CardList(){_classCallCheck(this,CardList);return _callSuper(this,CardList,arguments);}_inherits(CardList,_Component);return _createClass(CardList,[{key:"render",value:/**
4
4
  * Renders the component.
5
5
  * @return {JSX}
6
- */value:function render(){var _this$props=this.props,children=_this$props.children,className=_this$props.className;if(!Children.count(children)){return null;}return React.createElement(List,{className:className},Children.map(children,function(child){if(!isValidElement(child)){return null;}return child;}));}}]);return CardList;}(Component);_defineProperty(CardList,"Item",Item);_defineProperty(CardList,"defaultProps",{children:null,className:''});export default CardList;
6
+ */function render(){var _this$props=this.props,children=_this$props.children,className=_this$props.className;if(!Children.count(children)){return null;}return React.createElement(List,{className:"ui-shared__card-list ".concat(className)},Children.map(children,function(child){if(!isValidElement(child)){return null;}return child;}));}}]);}(Component);_defineProperty(CardList,"Item",Item);_defineProperty(CardList,"defaultProps",{children:null,className:''});export default CardList;
@@ -1,3 +1,3 @@
1
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 from'react';import PropTypes from'prop-types';import classNames from'classnames';import Label from"./components/Label";import Amount from"./components/Amount";import Hint from"./components/Hint";import Spacer from"./components/Spacer";import styles from"./style";/**
2
2
  * @returns {JSX}
3
- */var CartTotalLine=function CartTotalLine(_ref){var _classNames;var children=_ref.children,type=_ref.type,isDisabled=_ref.isDisabled,className=_ref.className;if(!children){return null;}return React.createElement("div",{className:classNames(className,styles.line,(_classNames={},_defineProperty(_classNames,styles.disabled,isDisabled),_defineProperty(_classNames,styles[type]||styles.base,true),_classNames)),"data-test-id":"".concat(type,"CartTotal")},children);};CartTotalLine.defaultProps={children:null,className:null,isDisabled:false,type:null};CartTotalLine.Label=Label;CartTotalLine.Amount=Amount;CartTotalLine.Hint=Hint;CartTotalLine.Spacer=Spacer;export default CartTotalLine;
3
+ */var CartTotalLine=function CartTotalLine(_ref){var children=_ref.children,type=_ref.type,isDisabled=_ref.isDisabled,className=_ref.className;if(!children){return null;}return React.createElement("div",{className:classNames(className,"ui-shared__cart-total-line ui-shared__cart-".concat(type,"-line"),styles.line,_defineProperty(_defineProperty({},styles.disabled,isDisabled),styles[type]||styles.base,true)),"data-test-id":"".concat(type,"CartTotal")},children);};CartTotalLine.defaultProps={children:null,className:null,isDisabled:false,type:null};CartTotalLine.Label=Label;CartTotalLine.Amount=Amount;CartTotalLine.Hint=Hint;CartTotalLine.Spacer=Spacer;export default CartTotalLine;
package/Checkbox/index.js CHANGED
@@ -1,7 +1,8 @@
1
- function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import BaseCheckbox from'@shopgate/pwa-common/components/Checkbox';import CheckedIcon from"../icons/CheckedIcon";import UncheckedIcon from"../icons/UncheckedIcon";import styles from"./style";/**
1
+ var _excluded=["checkedClassName","unCheckedClassName","className"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import BaseCheckbox from'@shopgate/pwa-common/components/Checkbox';import CheckedIcon from"../icons/CheckedIcon";import UncheckedIcon from"../icons/UncheckedIcon";import styles from"./style";/**
2
2
  * The checkbox template component.
3
- * @param {string} checkedClassName class for checked icon.
4
- * @param {string} unCheckedClassName class for unchecked icon.
5
- * @param {Object} props The component properties.
3
+ * @param {Object} props The component props
4
+ * @param {string} props.checkedClassName class for checked icon.
5
+ * @param {string} props.unCheckedClassName class for unchecked icon.
6
+ * @param {string} props.className className
6
7
  * @returns {JSX}
7
- */var Checkbox=function Checkbox(_ref){var checkedClassName=_ref.checkedClassName,unCheckedClassName=_ref.unCheckedClassName,props=_objectWithoutProperties(_ref,["checkedClassName","unCheckedClassName"]);return React.createElement(BaseCheckbox,_extends({},props,{checkedIcon:React.createElement(CheckedIcon,{className:classNames(styles.icon,checkedClassName,'checkedIcon')}),uncheckedIcon:React.createElement(UncheckedIcon,{className:classNames(styles.icon,unCheckedClassName,'uncheckedIcon')})}));};Checkbox.defaultProps={checkedClassName:styles.checkedIcon,unCheckedClassName:styles.uncheckedIcon};export default Checkbox;
8
+ */var Checkbox=function Checkbox(_ref){var checkedClassName=_ref.checkedClassName,unCheckedClassName=_ref.unCheckedClassName,className=_ref.className,props=_objectWithoutProperties(_ref,_excluded);return React.createElement(BaseCheckbox,_extends({},props,{className:"ui-shared__checkbox ".concat(className),checkedIcon:React.createElement(CheckedIcon,{className:classNames(styles.icon,checkedClassName,'checkedIcon')}),uncheckedIcon:React.createElement(UncheckedIcon,{className:classNames(styles.icon,unCheckedClassName,'uncheckedIcon')})}));};Checkbox.defaultProps={checkedClassName:styles.checkedIcon,className:'',unCheckedClassName:styles.uncheckedIcon};export default Checkbox;
package/Chip/index.js CHANGED
@@ -2,4 +2,4 @@ import React,{useRef,useCallback,useEffect}from'react';import PropTypes from'pro
2
2
  * The chip component.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
5
- */function Chip(props){var removable=props.removable,children=props.children,id=props.id,onClick=props.onClick,onRemove=props.onRemove,invert=props.invert,removeLabel=props.removeLabel,editLabel=props.editLabel;var ref=useRef(null);var handleRemove=useCallback(function(){onRemove(id);},[onRemove,id]);useEffect(function(){ref.current.removeAttribute('style');});return React.createElement("div",{ref:ref,className:styles.chip(removable,invert),"data-test-id":id},removable&&React.createElement(Button,{className:styles.removeButton,onClick:handleRemove,testId:"removeFilter","aria-label":removeLabel},React.createElement(ResponsiveContainer,{breakpoint:"<=xs",appAlways:true},React.createElement(CrossIcon,{size:16,color:invert?themeConfig.colors.light:"var(--color-primary, ".concat(themeConfig.colors.accent,")")})),React.createElement(ResponsiveContainer,{breakpoint:">xs",webOnly:true},React.createElement(CrossIcon,{size:18,color:invert?themeConfig.colors.light:'var(--color-primary)'}))),React.createElement(Button,{className:styles.name,onClick:onClick,"aria-label":editLabel},children));}Chip.defaultProps={invert:false,onClick:function onClick(){},onRemove:function onRemove(){},removable:true,removeLabel:null,editLabel:null};export default Chip;
5
+ */function Chip(props){var removable=props.removable,children=props.children,id=props.id,onClick=props.onClick,onRemove=props.onRemove,invert=props.invert,removeLabel=props.removeLabel,editLabel=props.editLabel;var ref=useRef(null);var handleRemove=useCallback(function(){onRemove(id);},[onRemove,id]);useEffect(function(){ref.current.removeAttribute('style');});return React.createElement("div",{ref:ref,className:"ui-shared__chip ".concat(styles.chip(removable,invert)),"data-test-id":id},removable&&React.createElement(Button,{className:styles.removeButton,onClick:handleRemove,testId:"removeFilter","aria-label":removeLabel},React.createElement(ResponsiveContainer,{breakpoint:"<=xs",appAlways:true},React.createElement(CrossIcon,{size:16,color:invert?themeConfig.colors.light:"var(--color-primary, ".concat(themeConfig.colors.accent,")")})),React.createElement(ResponsiveContainer,{breakpoint:">xs",webOnly:true},React.createElement(CrossIcon,{size:18,color:invert?themeConfig.colors.light:'var(--color-primary)'}))),React.createElement(Button,{className:styles.name,onClick:onClick,"aria-label":editLabel},children));}Chip.defaultProps={invert:false,onClick:function onClick(){},onRemove:function onRemove(){},removable:true,removeLabel:null,editLabel:null};export default Chip;
@@ -1,20 +1,22 @@
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 _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}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 connect from"./connector";import styles from"./style";var TIMEOUT_SHOW_DEVICE_ID=5000;/**
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 connect from"./connector";import styles from"./style";var TIMEOUT_SHOW_DEVICE_ID=5000;/**
2
2
  * Client information component which is shown as the footer of the navigation drawer.
3
- */var ClientInformation=/*#__PURE__*/function(_Component){_inherits(ClientInformation,_Component);/**
3
+ */var ClientInformation=/*#__PURE__*/function(_Component){/**
4
4
  * The component constructor.
5
5
  * @param {Object} props The component props.
6
- */function ClientInformation(props){var _this;_classCallCheck(this,ClientInformation);_this=_possibleConstructorReturn(this,_getPrototypeOf(ClientInformation).call(this,props));_defineProperty(_assertThisInitialized(_this),"startTimer",function(){_this.timer=setTimeout(_this.showDeviceId,TIMEOUT_SHOW_DEVICE_ID);});_defineProperty(_assertThisInitialized(_this),"showDeviceId",function(){if(!_this.state.isDeviceIdVisible){_this.setState({isDeviceIdVisible:true});_this.props.enableDebugLogging();}});_defineProperty(_assertThisInitialized(_this),"cancelTimer",function(){clearTimeout(_this.timer);});_this.state={isDeviceIdVisible:false};return _this;}/**
6
+ */function ClientInformation(props){var _this2;_classCallCheck(this,ClientInformation);_this2=_callSuper(this,ClientInformation,[props]);/**
7
+ * Starts the timer.
8
+ */_defineProperty(_this2,"startTimer",function(){_this2.timer=setTimeout(_this2.showDeviceId,TIMEOUT_SHOW_DEVICE_ID);});_defineProperty(_this2,"showDeviceId",function(){if(!_this2.state.isDeviceIdVisible){_this2.setState({isDeviceIdVisible:true});_this2.props.enableDebugLogging();}});/**
9
+ * Cancels the timer.
10
+ */_defineProperty(_this2,"cancelTimer",function(){clearTimeout(_this2.timer);});_this2.state={isDeviceIdVisible:false};return _this2;}/**
7
11
  * Setup event listener.
8
- */_createClass(ClientInformation,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener('touchend',this.cancelTimer);}/**
12
+ */_inherits(ClientInformation,_Component);return _createClass(ClientInformation,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener('touchend',this.cancelTimer);}/**
9
13
  * @param {Object} nextProps the next component props.
10
14
  * @param {Object} nextState the next component state.
11
15
  * @returns {boolean}
12
16
  */},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(nextProps,nextState){return this.props.codebaseVersion!==nextProps.codebaseVersion||this.state.isDeviceIdVisible!==nextState.isDeviceIdVisible;}/**
13
17
  * Remove event listener.
14
- */},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener('touchend',this.cancelTimer);}/**
15
- * Starts the timer.
16
- */},{key:"render",/**
18
+ */},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener('touchend',this.cancelTimer);}},{key:"render",value:/**
17
19
  * Renders the component.
18
20
  * @return {JSX}
19
- */value:function render(){if(this.props.codebaseVersion===null){return null;}var isDeviceIdVisible=this.state.isDeviceIdVisible;var _this$props=this.props,appVersion=_this$props.appVersion,libVersion=_this$props.libVersion,deviceId=_this$props.deviceId,codebaseVersion=_this$props.codebaseVersion;return React.createElement("div",{className:styles.wrapper,onTouchStart:this.startTimer,"aria-hidden":true},React.createElement("p",{className:styles.unselectable},"App Version:",' ',appVersion,' ',"(",codebaseVersion,")",React.createElement("br",null),"Lib Version:",' ',libVersion),isDeviceIdVisible&&React.createElement("p",{className:styles.deviceId},"Device ID:",' ',deviceId));}}]);return ClientInformation;}(Component);_defineProperty(ClientInformation,"defaultProps",{appVersion:null,codebaseVersion:null,deviceId:null,libVersion:null});export default connect(ClientInformation);// For testing.
21
+ */function render(){if(this.props.codebaseVersion===null){return null;}var isDeviceIdVisible=this.state.isDeviceIdVisible;var _this$props=this.props,appVersion=_this$props.appVersion,libVersion=_this$props.libVersion,deviceId=_this$props.deviceId,codebaseVersion=_this$props.codebaseVersion;return React.createElement("div",{className:"ui-shared__client-information ".concat(styles.wrapper),onTouchStart:this.startTimer,"aria-hidden":true},React.createElement("p",{className:styles.unselectable},"App Version:",' ',appVersion,' ',"(",codebaseVersion,")",React.createElement("br",null),"Lib Version:",' ',libVersion),isDeviceIdVisible&&React.createElement("p",{className:styles.deviceId},"Device ID:",' ',deviceId));}}]);}(Component);_defineProperty(ClientInformation,"defaultProps",{appVersion:null,codebaseVersion:null,deviceId:null,libVersion:null});export default connect(ClientInformation);// For testing.
20
22
  export{ClientInformation as Unwrapped};
@@ -1,11 +1,11 @@
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 _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}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 _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 clamp from'lodash/clamp';import styles from"./style";/**
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 _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}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 clamp from'lodash/clamp';import styles from"./style";/**
2
2
  * The Context Menu Position component.
3
- */var Position=/*#__PURE__*/function(_Component){_inherits(Position,_Component);/**
3
+ */var Position=/*#__PURE__*/function(_Component){/**
4
4
  * The Constructor.
5
5
  * @param {Object} props The component props.
6
- */function Position(props){var _this;_classCallCheck(this,Position);_this=_possibleConstructorReturn(this,_getPrototypeOf(Position).call(this,props));_this.elementRef=null;return _this;}/**
6
+ */function Position(props){var _this2;_classCallCheck(this,Position);_this2=_callSuper(this,Position,[props]);_this2.elementRef=null;return _this2;}/**
7
7
  * Calculate and apply the correct menu position after mounting.
8
- */_createClass(Position,[{key:"componentDidMount",value:function componentDidMount(){var offset=this.props.offset;// Get ref to the actual child DOM element and calculate bounding rect.
8
+ */_inherits(Position,_Component);return _createClass(Position,[{key:"componentDidMount",value:function componentDidMount(){var offset=this.props.offset;// Get ref to the actual child DOM element and calculate bounding rect.
9
9
  var _this$elementRef$chil=_slicedToArray(this.elementRef.childNodes,1),child=_this$elementRef$chil[0];var bounds=child.getBoundingClientRect();// Get window dimensions
10
10
  var width=window.innerWidth;var height=window.innerHeight;// Get the outer gap from styles
11
11
  var gap=styles.outerGap;// Calculate clamped menu position
@@ -13,4 +13,4 @@ var left=clamp(offset.left,0,width-bounds.width-gap*2);var top=clamp(offset.top-
13
13
  this.elementRef.style.left="".concat(left,"px");this.elementRef.style.top="".concat(top,"px");}/**
14
14
  * Renders the component.
15
15
  * @returns {JSX}
16
- */},{key:"render",value:function render(){var _this2=this;return React.createElement("div",{ref:function ref(_ref){_this2.elementRef=_ref;},className:styles.container},this.props.children);}}]);return Position;}(Component);_defineProperty(Position,"defaultProps",{children:null,offset:{top:0,left:0}});export default Position;
16
+ */},{key:"render",value:function render(){var _this3=this;return React.createElement("div",{ref:function ref(_ref){_this3.elementRef=_ref;},className:styles.container},this.props.children);}}]);}(Component);_defineProperty(Position,"defaultProps",{children:null,offset:{top:0,left:0}});export default Position;
@@ -1,15 +1,15 @@
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 _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}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,Children}from'react';import PropTypes from'prop-types';import Portal from'react-portal';import classNames from'classnames';import Backdrop from'@shopgate/pwa-common/components/Backdrop';import MoreVertIcon from"../icons/MoreVertIcon";import Position from"./components/Position";import Item from"./components/Item";import styles from"./style";/**
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,Children}from'react';import PropTypes from'prop-types';import Portal from'react-portal';import classNames from'classnames';import Backdrop from'@shopgate/pwa-common/components/Backdrop';import MoreVertIcon from"../icons/MoreVertIcon";import Position from"./components/Position";import Item from"./components/Item";import styles from"./style";/**
2
2
  * The ContextMenu component.
3
- */var ContextMenu=/*#__PURE__*/function(_Component){_inherits(ContextMenu,_Component);/**
3
+ */var ContextMenu=/*#__PURE__*/function(_Component){/**
4
4
  * The Constructor.
5
5
  * @param {Object} props The component props.
6
- */function ContextMenu(props){var _this;_classCallCheck(this,ContextMenu);_this=_possibleConstructorReturn(this,_getPrototypeOf(ContextMenu).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleMenuToggle",function(e){if(e){e.preventDefault();e.stopPropagation();}if(_this.elementRef){_this.setState(function(_ref){var active=_ref.active;var state={active:!active};if(_this.props.onStateChange){_this.props.onStateChange(state);}return state;});}});_this.elementRef=null;_this.state={active:props.isOpened};return _this;}/** @inheritDoc */_createClass(ContextMenu,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(_ref2){var isOpened=_ref2.isOpened;if(typeof isOpened==='boolean'&&this.state.active!==isOpened){this.setState({active:isOpened});}}/**
6
+ */function ContextMenu(props){var _this2;_classCallCheck(this,ContextMenu);_this2=_callSuper(this,ContextMenu,[props]);/**
7
+ * Handles any menu toggling interactions.
8
+ * @param {Object} [e] Event
9
+ */_defineProperty(_this2,"handleMenuToggle",function(e){if(e){e.preventDefault();e.stopPropagation();}if(_this2.elementRef){_this2.setState(function(_ref){var active=_ref.active;var state={active:!active};if(_this2.props.onStateChange){_this2.props.onStateChange(state);}return state;});}});_this2.elementRef=null;_this2.state={active:props.isOpened};return _this2;}/** @inheritDoc */_inherits(ContextMenu,_Component);return _createClass(ContextMenu,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(_ref2){var isOpened=_ref2.isOpened;if(typeof isOpened==='boolean'&&this.state.active!==isOpened){this.setState({active:isOpened});}}/**
7
10
  * Gets the offset of the DOM element.
8
11
  * @returns {Object}
9
- */},{key:"render",/**
12
+ */},{key:"offset",get:function get(){if(this.elementRef){return this.elementRef.getBoundingClientRect();}return{top:0,left:0};}},{key:"render",value:/**
10
13
  * Renders the component.
11
14
  * @returns {JSX}
12
- */value:function render(){var _this2=this;var _this$props=this.props,children=_this$props.children,classes=_this$props.classes,disabled=_this$props.disabled,showToggle=_this$props.showToggle,scroll=_this$props.scroll;var active=this.state.active;var useScroll=typeof scroll==='boolean'&&!!scroll;return React.createElement("div",{"data-test-id":"contextMenu",ref:function ref(_ref3){_this2.elementRef=_ref3;},className:classNames(styles.container,classes.container),"aria-hidden":true},showToggle&&React.createElement("button",{className:classNames(styles.button,classes.button,_defineProperty({},styles.disabled,disabled)),onClick:this.handleMenuToggle,disabled:disabled,type:"button","aria-hidden":true},React.createElement(MoreVertIcon,null)),React.createElement(Portal,{isOpened:active},React.createElement("div",{className:styles.overlay},React.createElement(Backdrop,{isVisible:true,level:0,opacity:0,onClick:this.handleMenuToggle}),React.createElement(Position,{offset:this.offset},React.createElement("div",{className:classNames(styles.menu,_defineProperty({},styles.scrollable,useScroll))},Children.map(children,function(child){if(!child){return null;}return React.cloneElement(child,{closeMenu:_this2.handleMenuToggle});}))))));}},{key:"offset",get:function get(){if(this.elementRef){return this.elementRef.getBoundingClientRect();}return{top:0,left:0};}/**
13
- * Handles any menu toggling interactions.
14
- * @param {Object} [e] Event
15
- */}]);return ContextMenu;}(Component);_defineProperty(ContextMenu,"Item",Item);_defineProperty(ContextMenu,"defaultProps",{children:null,classes:{container:'',button:''},disabled:false,showToggle:true,isOpened:null,onStateChange:null,scroll:null});export default ContextMenu;
15
+ */function render(){var _this3=this;var _this$props=this.props,children=_this$props.children,classes=_this$props.classes,disabled=_this$props.disabled,showToggle=_this$props.showToggle,scroll=_this$props.scroll;var active=this.state.active;var useScroll=typeof scroll==='boolean'&&!!scroll;return React.createElement("div",{"data-test-id":"contextMenu",ref:function ref(_ref3){_this3.elementRef=_ref3;},className:classNames(styles.container,classes.container,'ui-shared__context-menu'),"aria-hidden":true},showToggle&&React.createElement("button",{className:classNames(styles.button,classes.button,_defineProperty({},styles.disabled,disabled)),onClick:this.handleMenuToggle,disabled:disabled,type:"button","aria-hidden":true},React.createElement(MoreVertIcon,null)),React.createElement(Portal,{isOpened:active},React.createElement("div",{className:styles.overlay},React.createElement(Backdrop,{isVisible:true,level:0,opacity:0,onClick:this.handleMenuToggle}),React.createElement(Position,{offset:this.offset},React.createElement("div",{className:classNames(styles.menu,_defineProperty({},styles.scrollable,useScroll))},Children.map(children,function(child){if(!child){return null;}return React.cloneElement(child,{closeMenu:_this3.handleMenuToggle});}))))));}}]);}(Component);_defineProperty(ContextMenu,"Item",Item);_defineProperty(ContextMenu,"defaultProps",{children:null,classes:{container:'',button:''},disabled:false,showToggle:true,isOpened:null,onStateChange:null,scroll:null});export default ContextMenu;