@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,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 _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 classNames from'classnames';import Grid from'@shopgate/pwa-common/components/Grid';import Ripple from"../../../Ripple";import CrossIcon from"../../../icons/CrossIcon";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 classNames from'classnames';import Grid from'@shopgate/pwa-common/components/Grid';import Ripple from"../../../Ripple";import CrossIcon from"../../../icons/CrossIcon";import styles from"./style";import SearchBar from"./components/SearchBar";/**
2
2
  * Header component.
3
- */var Header=/*#__PURE__*/function(_Component){_inherits(Header,_Component);function Header(){_classCallCheck(this,Header);return _possibleConstructorReturn(this,_getPrototypeOf(Header).apply(this,arguments));}_createClass(Header,[{key:"shouldComponentUpdate",/**
4
- * The component's default props.
5
- * @type {Object}
6
- */ /**
3
+ */var Header=/*#__PURE__*/function(_Component){function Header(){_classCallCheck(this,Header);return _callSuper(this,Header,arguments);}_inherits(Header,_Component);return _createClass(Header,[{key:"shouldComponentUpdate",value:/**
7
4
  * @param {Object} nextProps Next Props
8
5
  * @returns {boolean}
9
- */value:function shouldComponentUpdate(nextProps){return this.props.shadow!==nextProps.shadow||this.props.title!==nextProps.title;}/**
6
+ */function shouldComponentUpdate(nextProps){return this.props.shadow!==nextProps.shadow||this.props.title!==nextProps.title;}/**
10
7
  * Renders the component.
11
8
  * @returns {JSX}
12
- */},{key:"render",value:function render(){var allowClose=this.props.allowClose;var classes=classNames(styles.wrapper,_defineProperty({},styles.shadow,this.props.shadow));var _this$context$i18n=this.context.i18n(),__=_this$context$i18n.__;return React.createElement(Grid,{className:classes,component:"div",wrap:false},allowClose?React.createElement("button",{className:styles.closeButton,onClick:this.props.onToggleClose,"aria-label":__('common.close'),type:"button"},React.createElement(Ripple,{className:styles.closeIcon},React.createElement(CrossIcon,{size:24}))):React.createElement("div",{className:styles.closePlaceholder}),React.createElement(Grid.Item,_extends({className:styles.title,component:"div",grow:1,role:"heading"},allowClose?{tabIndex:0}:null),this.props.title));}}]);return Header;}(Component);_defineProperty(Header,"defaultProps",{onToggleClose:function onToggleClose(){},shadow:false,allowClose:true});_defineProperty(Header,"contextTypes",{i18n:PropTypes.func});export default Header;
9
+ */},{key:"render",value:function render(){var allowClose=this.props.allowClose;var classes=classNames(styles.wrapper);var _this$context$i18n=this.context.i18n(),__=_this$context$i18n.__;return React.createElement("div",{className:classNames(_defineProperty({},styles.shadow,this.props.shadow))},React.createElement(Grid,{className:classes,component:"div",wrap:false},allowClose?React.createElement("button",{className:styles.closeButton,onClick:this.props.onToggleClose,"aria-label":__('common.close'),type:"button"},React.createElement(Ripple,{className:styles.closeIcon},React.createElement(CrossIcon,{size:24}))):React.createElement("div",{className:styles.closePlaceholder}),React.createElement(Grid.Item,_extends({className:styles.title,component:"div",grow:1,role:"heading"},allowClose?{tabIndex:0}:null),this.props.title)),this.props.showSearch&&React.createElement(SearchBar,{handleChange:this.props.handleChange}));}}]);}(Component);/**
10
+ * The component's default props.
11
+ * @type {Object}
12
+ */_defineProperty(Header,"defaultProps",{onToggleClose:function onToggleClose(){},shadow:false,allowClose:true,handleChange:function handleChange(){},showSearch:false});_defineProperty(Header,"contextTypes",{i18n:PropTypes.func});export default Header;
package/Sheet/index.js CHANGED
@@ -1,23 +1,26 @@
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 throttle from'lodash/throttle';import classNames from'classnames';import UIEvents from'@shopgate/pwa-core/emitters/ui';import Backdrop from'@shopgate/pwa-common/components/Backdrop';import Drawer from'@shopgate/pwa-common/components/Drawer';import ProgressBar from"../ProgressBar";import Header from"./components/Header";import styles from"./style";export var SHEET_EVENTS={OPEN:'Sheet.open',CLOSE:'Sheet.close'};/**
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 throttle from'lodash/throttle';import classNames from'classnames';import UIEvents from'@shopgate/pwa-core/emitters/ui';import Backdrop from'@shopgate/pwa-common/components/Backdrop';import Drawer from'@shopgate/pwa-common/components/Drawer';import ProgressBar from"../ProgressBar";import Header from"./components/Header";import styles from"./style";export var SHEET_EVENTS={OPEN:'Sheet.open',CLOSE:'Sheet.close'};/**
2
2
  * Sheet component.
3
- */var Sheet=/*#__PURE__*/function(_Component){_inherits(Sheet,_Component);/**
4
- * The component default props.
5
- * @type {Object}
6
- */ /**
3
+ */var Sheet=/*#__PURE__*/function(_Component){/**
7
4
  * The constructor.
8
5
  * @param {Object} props The component props.
9
- */function Sheet(props){var _this;_classCallCheck(this,Sheet);_this=_possibleConstructorReturn(this,_getPrototypeOf(Sheet).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleScroll",throttle(function(){var scrolled=_this.content.current.scrollTop!==0;if(_this.state.scrolled!==scrolled){_this.setState({scrolled:scrolled});}},10));_defineProperty(_assertThisInitialized(_this),"handleClose",function(){_this.props.onClose();_this.setState({isOpen:false,scrolled:false});});_defineProperty(_assertThisInitialized(_this),"handleDidOpen",function(){UIEvents.emit(SHEET_EVENTS.OPEN);_this.props.onDidOpen();});_defineProperty(_assertThisInitialized(_this),"handleDidClose",function(){UIEvents.emit(SHEET_EVENTS.CLOSE);_this.props.onDidClose();});_this.content=React.createRef();_this.state={isOpen:props.isOpen,scrolled:false};return _this;}/**
6
+ */function Sheet(props){var _this2;_classCallCheck(this,Sheet);_this2=_callSuper(this,Sheet,[props]);/**
7
+ * Close the Sheet.
8
+ */_defineProperty(_this2,"handleScroll",throttle(function(){var scrolled=_this2.content.current.scrollTop!==0;if(_this2.state.scrolled!==scrolled){_this2.setState({scrolled:scrolled});}},10));/**
9
+ * Close the Sheet.
10
+ */_defineProperty(_this2,"handleClose",function(){_this2.props.onClose();_this2.setState({isOpen:false,scrolled:false});});/** The Sheet is opened */_defineProperty(_this2,"handleDidOpen",function(){UIEvents.emit(SHEET_EVENTS.OPEN);_this2.props.onDidOpen();});/** The Sheet is closed */_defineProperty(_this2,"handleDidClose",function(){UIEvents.emit(SHEET_EVENTS.CLOSE);_this2.props.onDidClose();});/**
11
+ * New value from SearchBar
12
+ * @param {string} value .
13
+ */_defineProperty(_this2,"handleSearchInput",function(value){_this2.setState({query:value});});_this2.content=React.createRef();_this2.state={isOpen:props.isOpen,scrolled:false,query:''};return _this2;}/**
10
14
  * Change isOpen state for new incoming props.
11
15
  * @param {Object} nextProps The next component props.
12
- */_createClass(Sheet,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(_ref){var isOpen=_ref.isOpen;if(this.state.isOpen!==isOpen){this.setState({isOpen:isOpen});}}/**
13
- * Close the Sheet.
14
- */},{key:"render",/**
15
- * Renders the component.
16
- * @returns {JSX}
17
- */value:function render(){var _this2=this;var allowClose=this.props.allowClose;var children=React.Children.map(this.props.children,function(child){return React.cloneElement(child,// Only add onClose prop to other components
18
- typeof child.type==='function'&&_this2.props.onClose!==null?{onClose:_this2.props.onClose}:{});});var drawerClassNames=classNames(styles.container,_defineProperty({},this.props.className,this.props.className));var contentClassNames=classNames(styles.content,_defineProperty({},this.props.contentClassName,this.props.contentClassName),_defineProperty({},styles.shadow,!this.props.backdrop));return React.createElement("section",{className:this.state.isOpen?styles.section:null},React.createElement(Drawer,{className:drawerClassNames,isOpen:this.state.isOpen,onDidOpen:this.handleDidOpen,onDidClose:this.handleDidClose,onOpen:this.props.onOpen,onClose:this.handleClose,animation:this.animationProps},this.props.title&&React.createElement(Sheet.Header,{onToggleClose:this.handleClose,shadow:this.state.scrolled,title:this.props.title,allowClose:allowClose}),React.createElement("div",{className:styles.progressBarContainer},React.createElement(ProgressBar,{isVisible:this.props.isLoading})),React.createElement("div",{ref:this.content,onScroll:this.handleScroll,className:contentClassNames},children)),this.props.backdrop&&React.createElement(Backdrop,{isVisible:this.state.isOpen,level:4,onClick:allowClose?this.handleClose:function(){},opacity:20}));}},{key:"animationProps",/**
16
+ */_inherits(Sheet,_Component);return _createClass(Sheet,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(_ref){var isOpen=_ref.isOpen;if(this.state.isOpen!==isOpen){this.setState({isOpen:isOpen});}}},{key:"animationProps",get:/**
19
17
  * Getter for the animation props of the Sheet.
20
18
  * @returns {Object}
21
- */get:function get(){return _extends({duration:this.props.duration},styles.drawerAnimation,{},this.props.animation);}/**
22
- * Close the Sheet.
23
- */}]);return Sheet;}(Component);_defineProperty(Sheet,"Header",Header);_defineProperty(Sheet,"defaultProps",{animation:{},backdrop:true,children:null,className:null,contentClassName:null,duration:300,isOpen:false,isLoading:false,onClose:function onClose(){},onDidClose:function onDidClose(){},onDidOpen:function onDidOpen(){},onOpen:function onOpen(){},title:'',allowClose:true});export default Sheet;
19
+ */function get(){return _extends({duration:this.props.duration},styles.drawerAnimation,{},this.props.animation);}},{key:"render",value:/**
20
+ * Renders the component.
21
+ * @returns {JSX}
22
+ */function render(){var _this3=this;var allowClose=this.props.allowClose;var children=React.Children.map(this.props.children,function(child){return React.cloneElement(child,// Only add onClose prop to other components
23
+ typeof child.type==='function'&&_this3.props.onClose!==null?{onClose:_this3.props.onClose,query:_this3.state.query}:{});});var drawerClassNames=classNames(styles.container,_defineProperty({},this.props.className,this.props.className));var contentClassNames=classNames(styles.content,_defineProperty({},styles.containerFullScreen,this.props.showSearch),_defineProperty({},this.props.contentClassName,this.props.contentClassName),_defineProperty({},styles.shadow,!this.props.backdrop));return React.createElement("section",{className:classNames('ui-shared__sheet',_defineProperty({},styles.section,this.state.isOpen))},React.createElement(Drawer,{className:drawerClassNames,isOpen:this.state.isOpen,onDidOpen:this.handleDidOpen,onDidClose:this.handleDidClose,onOpen:this.props.onOpen,onClose:this.handleClose,animation:this.animationProps},this.props.title&&React.createElement(Sheet.Header,{showSearch:this.props.showSearch,handleChange:this.handleSearchInput,onToggleClose:this.handleClose,shadow:this.state.scrolled,title:this.props.title,allowClose:allowClose}),React.createElement("div",{className:styles.progressBarContainer},React.createElement(ProgressBar,{isVisible:this.props.isLoading})),React.createElement("div",{ref:this.content,onScroll:this.handleScroll,className:contentClassNames},children)),this.props.backdrop&&React.createElement(Backdrop,{isVisible:this.state.isOpen,level:4,onClick:allowClose?this.handleClose:function(){},opacity:20}));}}]);}(Component);_defineProperty(Sheet,"Header",Header);/**
24
+ * The component default props.
25
+ * @type {Object}
26
+ */_defineProperty(Sheet,"defaultProps",{animation:{},backdrop:true,children:null,className:null,contentClassName:null,duration:300,isOpen:false,isLoading:false,onClose:function onClose(){},onDidClose:function onDidClose(){},onDidOpen:function onDidOpen(){},onOpen:function onOpen(){},title:'',showSearch:false,allowClose:true});export default Sheet;
package/Sheet/style.js CHANGED
@@ -1 +1,2 @@
1
- var _css2,_css3,_css4,_css5;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{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{responsiveMediaQuery}from'@shopgate/engage/styles';var duration=300;var easing='cubic-bezier(0.25, 0.1, 0.25, 1)';var section=css(_defineProperty({},responsiveMediaQuery('>sm',{webOnly:true}),{display:'flex',justifyContent:'center',alignItems:'center',width:'80%',position:'fixed',left:0,right:0,top:0,bottom:0,margin:'auto',zIndex:100})).toString();var container=css((_css2={bottom:0,background:themeConfig.colors.light,width:'100vw',color:"var(--color-text-high-emphasis, ".concat(themeConfig.colors.dark,")")},_defineProperty(_css2,responsiveMediaQuery('>sm',{webOnly:true}),{position:'initial'}),_defineProperty(_css2,responsiveMediaQuery('>md',{webOnly:true}),{width:'60%'}),_css2)).toString();var progressBarContainer=css({position:'relative'}).toString();var shadow=css({boxShadow:themeConfig.shadows.sheet}).toString();var content=css((_css3={maxHeight:["calc(var(--vh-100, 100vh) - ".concat(themeConfig.variables.navigator.height,"px)"),"calc(var(--vh-100, 100vh) - ".concat(themeConfig.variables.navigator.height,"px - var(--safe-area-inset-top))")]},_defineProperty(_css3,responsiveMediaQuery('>sm',{webOnly:true}),{maxHeight:["calc(var(--vh-80, 80vh) - ".concat(themeConfig.variables.navigator.height,"px)"),"calc(var(--vh-80, 80vh) - ".concat(themeConfig.variables.navigator.height,"px - var(--safe-area-inset-top))")]}),_defineProperty(_css3,"paddingBottom",['var(--safe-area-inset-bottom)']),_defineProperty(_css3,"overflowY",'scroll'),_defineProperty(_css3,"WebkitOverflowScrolling",'touch'),_css3)).toString();var slideInSheetDrawer=css.keyframes({'0%':{transform:'translateY(100%)'},'100%':{transform:'translateY(0)'}});var fadeInSheetDrawer=css.keyframes({'0%':{opacity:0},'100%':{opacity:1}});var slideOutSheetDrawer=css.keyframes({'0%':{transform:'translateY(0)'},'100%':{transform:'translateY(100%)'}});var fadeOutSheetDrawer=css.keyframes({'0%':{opacity:1},'100%':{opacity:0}});var drawerAnimation={"in":css((_css4={},_defineProperty(_css4,responsiveMediaQuery('<=sm',{appAlways:true}),{animation:"".concat(slideInSheetDrawer," ").concat(duration,"ms 1 both ").concat(easing)}),_defineProperty(_css4,responsiveMediaQuery('>sm',{webOnly:true}),{animation:"".concat(fadeInSheetDrawer," ").concat(duration,"ms 1 both ").concat(easing)}),_css4)).toString(),out:css((_css5={},_defineProperty(_css5,responsiveMediaQuery('<=sm',{appAlways:true}),{animation:"".concat(slideOutSheetDrawer," ").concat(duration,"ms 1 both ").concat(easing)}),_defineProperty(_css5,responsiveMediaQuery('>sm',{webOnly:true}),{animation:"".concat(fadeOutSheetDrawer," ").concat(duration,"ms 1 both ").concat(easing)}),_css5)).toString()};export default{section:section,container:container,progressBarContainer:progressBarContainer,shadow:shadow,content:content,drawerAnimation:drawerAnimation};
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{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{responsiveMediaQuery}from'@shopgate/engage/styles';var duration=300;var easing='cubic-bezier(0.25, 0.1, 0.25, 1)';var section=css(_defineProperty({},responsiveMediaQuery('>sm',{webOnly:true}),{display:'flex',justifyContent:'center',alignItems:'center',width:'80%',position:'fixed',left:0,right:0,top:0,bottom:0,margin:'auto',zIndex:100})).toString();var container=css(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({bottom:0,background:themeConfig.colors.light,width:'100vw'},responsiveMediaQuery('<xl',{appOnly:true}),{// Max width was introduced in PWA6 CCP-2496
2
+ maxWidth:640}),"left",0),"right",0),"margin",'0 auto'),"color","var(--color-text-high-emphasis, ".concat(themeConfig.colors.dark,")")),responsiveMediaQuery('>sm',{webOnly:true}),{position:'initial'}),responsiveMediaQuery('>md',{webOnly:true}),{width:'60%'})).toString();var containerFullScreen=css({height:["calc(100vh - ".concat(themeConfig.variables.navigator.height,"px - 51px)"),"calc(100vh - ".concat(themeConfig.variables.navigator.height,"px - 51px - var(--safe-area-inset-top))")]});var searchBarWrapper=css({backgroundColor:'white',height:52,position:'sticky',width:'100%',top:0,zIndex:2});var progressBarContainer=css({position:'relative'}).toString();var shadow=css({boxShadow:themeConfig.shadows.sheet}).toString();var content=css(_defineProperty(_defineProperty(_defineProperty(_defineProperty({maxHeight:["calc(var(--vh-100, 100vh) - ".concat(themeConfig.variables.navigator.height,"px)"),"calc(var(--vh-100, 100vh) - ".concat(themeConfig.variables.navigator.height,"px - var(--safe-area-inset-top))")]},responsiveMediaQuery('>sm',{webOnly:true}),{maxHeight:["calc(var(--vh-80, 80vh) - ".concat(themeConfig.variables.navigator.height,"px)"),"calc(var(--vh-80, 80vh) - ".concat(themeConfig.variables.navigator.height,"px - var(--safe-area-inset-top))")]}),"paddingBottom",['var(--safe-area-inset-bottom)']),"overflowY",'scroll'),"WebkitOverflowScrolling",'touch')).toString();var slideInSheetDrawer=css.keyframes({'0%':{transform:'translateY(100%)'},'100%':{transform:'translateY(0)'}});var fadeInSheetDrawer=css.keyframes({'0%':{opacity:0},'100%':{opacity:1}});var slideOutSheetDrawer=css.keyframes({'0%':{transform:'translateY(0)'},'100%':{transform:'translateY(100%)'}});var fadeOutSheetDrawer=css.keyframes({'0%':{opacity:1},'100%':{opacity:0}});var drawerAnimation={"in":css(_defineProperty(_defineProperty({},responsiveMediaQuery('<=sm',{appAlways:true}),{animation:"".concat(slideInSheetDrawer," ").concat(duration,"ms 1 both ").concat(easing)}),responsiveMediaQuery('>sm',{webOnly:true}),{animation:"".concat(fadeInSheetDrawer," ").concat(duration,"ms 1 both ").concat(easing)})).toString(),out:css(_defineProperty(_defineProperty({},responsiveMediaQuery('<=sm',{appAlways:true}),{animation:"".concat(slideOutSheetDrawer," ").concat(duration,"ms 1 both ").concat(easing)}),responsiveMediaQuery('>sm',{webOnly:true}),{animation:"".concat(fadeOutSheetDrawer," ").concat(duration,"ms 1 both ").concat(easing)})).toString()};export default{section:section,container:container,containerFullScreen:containerFullScreen,searchBarWrapper:searchBarWrapper,progressBarContainer:progressBarContainer,shadow:shadow,content:content,drawerAnimation:drawerAnimation};
@@ -1,4 +1,5 @@
1
- import React,{Fragment}from'react';import Portal from'@shopgate/pwa-common/components/Portal';import{PRODUCT_TAX_DISCLAIMER,PRODUCT_TAX_DISCLAIMER_AFTER,PRODUCT_TAX_DISCLAIMER_BEFORE}from'@shopgate/pwa-common-commerce/product/constants/Portals';import I18n from'@shopgate/pwa-common/components/I18n';import showTaxDisclaimer from'@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer';import styles from"./style";/**
1
+ import React from'react';import SurroundPortals from'@shopgate/pwa-common/components/SurroundPortals';import{PRODUCT_TAX_DISCLAIMER}from'@shopgate/pwa-common-commerce/product/constants/Portals';import I18n from'@shopgate/pwa-common/components/I18n';import showTaxDisclaimer from'@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer';import{useWidgetSettings}from'@shopgate/engage/core/hooks/useWidgetSettings';import styles from"./style";/**
2
2
  * TaxDisclaimer component.
3
3
  * @returns {Function}
4
- */var TaxDisclaimer=function TaxDisclaimer(){return React.createElement(Fragment,null,React.createElement(Portal,{name:PRODUCT_TAX_DISCLAIMER_BEFORE}),React.createElement(Portal,{name:PRODUCT_TAX_DISCLAIMER},showTaxDisclaimer&&React.createElement("div",{"data-test-id":"taxDisclaimer","aria-hidden":true},React.createElement(I18n.Text,{className:styles,string:"product.tax_disclaimer"}))),React.createElement(Portal,{name:PRODUCT_TAX_DISCLAIMER_AFTER}));};export default TaxDisclaimer;
4
+ */var TaxDisclaimer=function TaxDisclaimer(){var _useWidgetSettings=useWidgetSettings('@shopgate/engage/components/TaxDisclaimer'),show=_useWidgetSettings.show,text=_useWidgetSettings.text;// use widget setting if set to true/false, otherwise use market logic
5
+ var showDisclaimer=typeof show==='boolean'?show:showTaxDisclaimer;return React.createElement(SurroundPortals,{portalName:PRODUCT_TAX_DISCLAIMER,portalProps:{showTaxDisclaimer:showDisclaimer}},showDisclaimer&&React.createElement("div",{"data-test-id":"taxDisclaimer","aria-hidden":true,className:"ui-shared__tax-disclaimer"},React.createElement(I18n.Text,{className:styles,string:text||'product.tax_disclaimer'})));};export default TaxDisclaimer;
@@ -1,3 +1,3 @@
1
- import React from'react';import{shallow}from'enzyme';import I18n from'@shopgate/pwa-common/components/I18n';describe('<TaxDisclaimer />',function(){afterEach(function(){jest.resetModules();});it('should display the component',function(){jest.mock('@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer',function(){return true;});// eslint-disable-next-line global-require
1
+ import React from'react';import{shallow}from'enzyme';import I18n from'@shopgate/pwa-common/components/I18n';jest.mock('@shopgate/engage/core/hooks/useWidgetSettings',function(){return{useWidgetSettings:jest.fn().mockReturnValue({show:null,hint:'*',text:null})};});describe('<TaxDisclaimer />',function(){afterEach(function(){jest.resetModules();});it('should display the component',function(){jest.mock('@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer',function(){return true;});// eslint-disable-next-line global-require
2
2
  var TaxDisclaimer=require("./index")["default"];var wrapper=shallow(React.createElement(TaxDisclaimer,null));expect(wrapper).toMatchSnapshot();expect(wrapper.find(I18n.Text).exists()).toBe(true);});it('should display null',function(){jest.mock('@shopgate/pwa-common-commerce/market/helpers/showTaxDisclaimer',function(){return false;});// eslint-disable-next-line global-require
3
3
  var TaxDisclaimer=require("./index")["default"];var wrapper=shallow(React.createElement(TaxDisclaimer,null));expect(wrapper).toMatchSnapshot();expect(wrapper.find(I18n.Text).exists()).toBe(false);});});
@@ -17,4 +17,4 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
17
17
  * @param {boolean} floating Whether the label is floating.
18
18
  * @param {boolean} error Whether the input field shows an error message.
19
19
  * @return {string} The style classes.
20
- */var labelStyles=function labelStyles(){var _classNames;var focused=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var floating=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var error=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;return classNames(label,(_classNames={},_defineProperty(_classNames,labelFloating,floating),_defineProperty(_classNames,labelRegular,!focused),_defineProperty(_classNames,labelFocus,!error&&focused),_defineProperty(_classNames,labelError,error&&focused),_classNames));};export default{labelStyles:labelStyles};
20
+ */var labelStyles=function labelStyles(){var focused=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var floating=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var error=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;return classNames(label,_defineProperty(_defineProperty(_defineProperty(_defineProperty({},labelFloating,floating),labelRegular,!focused),labelFocus,!error&&focused),labelError,error&&focused));};export default{labelStyles:labelStyles};
@@ -1,27 +1,36 @@
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{hot}from'react-hot-loader/root';import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import Label from"./components/Label";import Underline from"./components/Underline";import ErrorText from"./components/ErrorText";import Hint from"./components/Hint";import styles from"./style";import FormElement from"./components/FormElement/index";/**
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{hot}from'react-hot-loader/root';import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import Label from"./components/Label";import Underline from"./components/Underline";import ErrorText from"./components/ErrorText";import Hint from"./components/Hint";import styles from"./style";import FormElement from"./components/FormElement/index";/**
2
2
  * A component that provides a styled text field for user input in material design.
3
- */var TextField=/*#__PURE__*/function(_Component){_inherits(TextField,_Component);/**
3
+ */var TextField=/*#__PURE__*/function(_Component){/**
4
4
  * Creates a new text field component.
5
5
  * @param {Object} props The component properties.
6
- */function TextField(props){var _this;_classCallCheck(this,TextField);_this=_possibleConstructorReturn(this,_getPrototypeOf(TextField).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleFocusChange",function(isFocused){_this.setState({isFocused:isFocused});_this.props.onFocusChange(isFocused);});_defineProperty(_assertThisInitialized(_this),"handleChange",function(value,event){_this.props.onChange(value,event);});_defineProperty(_assertThisInitialized(_this),"handleValidate",function(value,isInitial){var validationError=_this.props.onValidate(value);if(validationError!==true&&validationError){/**
6
+ */function TextField(props){var _this2;_classCallCheck(this,TextField);_this2=_callSuper(this,TextField,[props]);/**
7
+ * Internal focus event handler.
8
+ * @param {boolean} isFocused Whether the input component is focused.
9
+ */_defineProperty(_this2,"handleFocusChange",function(isFocused){_this2.setState({isFocused:isFocused});_this2.props.onFocusChange(isFocused);});/**
10
+ * Updates the state if the input value has been changed.
11
+ * @param {string} value The entered text.
12
+ * @param {Object} event The original event object.
13
+ */_defineProperty(_this2,"handleChange",function(value,event){_this2.props.onChange(value,event);});/**
14
+ * Updates the validation error text if required.
15
+ * @param {string} value The entered text.
16
+ * @param {boolean} isInitial Whether this is the initial value of the input field.
17
+ * @return {boolean} Whether the validation was successful.
18
+ */_defineProperty(_this2,"handleValidate",function(value,isInitial){var validationError=_this2.props.onValidate(value);if(validationError!==true&&validationError){/**
7
19
  * An error message was returned by the validation callback. Update the state.
8
20
  * Because the validation is performed when the component is constructed, we need to make
9
21
  * sure we're not calling setState() in this situation.
10
- */if(!isInitial){_this.setState({validationError:validationError});}else{_this.state.validationError=validationError;}}else if(_this.state.validationError){// There was no error, clear the state variable.
11
- _this.setState({validationError:null});}// Forward the boolean result to the input field.
12
- return validationError===true;});_this.state={isFocused:false,validationError:null};return _this;}/**
22
+ */if(!isInitial){_this2.setState({validationError:validationError});}else{_this2.state.validationError=validationError;}}else if(_this2.state.validationError){// There was no error, clear the state variable.
23
+ _this2.setState({validationError:null});}// Forward the boolean result to the input field.
24
+ return validationError===true;});_this2.state={isFocused:false,validationError:null};return _this2;}/**
13
25
  * @returns {boolean} Whether the text field is currently focused.
14
- */_createClass(TextField,[{key:"render",/**
15
- * Renders the text field.
16
- * @return {JSX}
17
- */value:function render(){var styleType=this.props.multiLine?'multiLine':'input';var style=styles.container[styleType];return React.createElement("div",{className:classNames(style,this.props.className,'textField',{disabled:this.props.disabled})},React.createElement(Hint,{visible:this.isHintVisible,hintText:this.props.hintText}),React.createElement(Label,{name:this.props.name,label:this.props.label,isFocused:this.isFocused,isFloating:this.isLabelFloating,hasErrorMessage:this.hasErrorMessage}),React.createElement(FormElement,{id:this.props.name,multiLine:this.props.multiLine,name:this.props.name,setRef:this.props.setRef,onFocusChange:this.handleFocusChange,onChange:this.handleChange,onSanitize:this.props.onSanitize,onValidate:this.handleValidate,password:this.props.password,type:this.props.type,value:this.props.value,isControlled:this.props.isControlled,inputComponent:this.props.inputComponent,disabled:this.props.disabled}),React.createElement(Underline,{isFocused:this.isFocused,hasErrorMessage:this.hasErrorMessage}),this.props.showErrorText&&React.createElement(ErrorText,{validationError:this.state.validationError,errorText:this.props.errorText,translate:this.props.translateErrorText}));}},{key:"isFocused",get:function get(){return this.state.isFocused;}/**
26
+ */_inherits(TextField,_Component);return _createClass(TextField,[{key:"isFocused",get:function get(){return this.state.isFocused;}/**
18
27
  * @returns {boolean} Whether the label is currently floating.
19
28
  */},{key:"isLabelFloating",get:function get(){// On Firefox empty date inputs always show a placeholder with date pattern
20
29
  if(navigator.userAgent.includes('Firefox')&&this.props.type==='date'){return true;}return this.isFocused||!!this.props.value;}/**
21
30
  * @returns {boolean} Whether the hint text is currently visible.
22
31
  */},{key:"isHintVisible",get:function get(){return this.isFocused&&!this.props.value;}/**
23
32
  * @return {boolean} Whether the error message is set.
24
- */},{key:"hasErrorMessage",get:function get(){return!!(this.state.validationError||this.props.errorText);}/**
25
- * Internal focus event handler.
26
- * @param {boolean} isFocused Whether the input component is focused.
27
- */}]);return TextField;}(Component);_defineProperty(TextField,"defaultProps",{className:'',errorText:'',showErrorText:true,setRef:function setRef(){},hintText:'',isControlled:false,label:'',multiLine:false,onChange:function onChange(){},onFocusChange:function onFocusChange(){},onSanitize:function onSanitize(value){return value;},onValidate:function onValidate(){return true;},password:false,translateErrorText:true,type:'text',value:'',inputComponent:'input',disabled:false});export default hot(TextField);
33
+ */},{key:"hasErrorMessage",get:function get(){return!!(this.state.validationError||this.props.errorText);}},{key:"render",value:/**
34
+ * Renders the text field.
35
+ * @return {JSX}
36
+ */function render(){var styleType=this.props.multiLine?'multiLine':'input';var style=styles.container[styleType];return React.createElement("div",{className:classNames(style,this.props.className,'textField','ui-shared__text-field',{disabled:this.props.disabled})},React.createElement(Hint,{visible:this.isHintVisible,hintText:this.props.hintText}),React.createElement(Label,{name:this.props.name,label:this.props.label,isFocused:this.isFocused,isFloating:this.isLabelFloating,hasErrorMessage:this.hasErrorMessage}),React.createElement(FormElement,{id:this.props.name,multiLine:this.props.multiLine,name:this.props.name,setRef:this.props.setRef,onFocusChange:this.handleFocusChange,onChange:this.handleChange,onSanitize:this.props.onSanitize,onValidate:this.handleValidate,password:this.props.password,type:this.props.type,value:this.props.value,isControlled:this.props.isControlled,inputComponent:this.props.inputComponent,disabled:this.props.disabled}),React.createElement(Underline,{isFocused:this.isFocused,hasErrorMessage:this.hasErrorMessage}),this.props.showErrorText&&React.createElement(ErrorText,{validationError:this.state.validationError,errorText:this.props.errorText,translate:this.props.translateErrorText}));}}]);}(Component);_defineProperty(TextField,"defaultProps",{className:'',errorText:'',showErrorText:true,setRef:function setRef(){},hintText:'',isControlled:false,label:'',multiLine:false,onChange:function onChange(){},onFocusChange:function onFocusChange(){},onSanitize:function onSanitize(value){return value;},onValidate:function onValidate(){return true;},password:false,translateErrorText:true,type:'text',value:'',inputComponent:'input',disabled:false});export default hot(TextField);
@@ -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 _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';/**
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';/**
2
2
  * No operational default handler
3
3
  */var noop=function noop(){};/**
4
4
  * An toggle icon with toggle handlers.
5
- */var ToggleIcon=/*#__PURE__*/function(_Component){_inherits(ToggleIcon,_Component);/**
5
+ */var ToggleIcon=/*#__PURE__*/function(_Component){/**
6
6
  * @param {Object} props The component properties.
7
- */function ToggleIcon(props){var _this;_classCallCheck(this,ToggleIcon);_this=_possibleConstructorReturn(this,_getPrototypeOf(ToggleIcon).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleToggle",function(){_this.setState(function(_ref){var on=_ref.on;return{on:!on};},function(){return _this.props.toggleHandler(_this.state.on);});});_this.state={on:props.on};return _this;}/**
7
+ */function ToggleIcon(props){var _this2;_classCallCheck(this,ToggleIcon);_this2=_callSuper(this,ToggleIcon,[props]);/**
8
+ * Toggle icon
9
+ */_defineProperty(_this2,"handleToggle",function(){_this2.setState(function(_ref){var on=_ref.on;return{on:!on};},function(){return _this2.props.toggleHandler(_this2.state.on);});});_this2.state={on:props.on};return _this2;}/**
8
10
  * Reset state to received props
9
11
  * @param {Object} nextProps next props
10
- */_createClass(ToggleIcon,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){this.setState({on:nextProps.on});}/**
11
- * Toggle icon
12
- */},{key:"render",/**
12
+ */_inherits(ToggleIcon,_Component);return _createClass(ToggleIcon,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){this.setState({on:nextProps.on});}},{key:"render",value:/**
13
13
  * @return {*}
14
- */value:function render(){var _this$props=this.props,onIcon=_this$props.onIcon,offIcon=_this$props.offIcon;var on=this.state.on;return React.createElement("div",{onClick:this.handleToggle,"aria-hidden":true},on&&onIcon,!on&&offIcon);}}]);return ToggleIcon;}(Component);_defineProperty(ToggleIcon,"defaultProps",{on:true,toggleHandler:noop});export default ToggleIcon;
14
+ */function render(){var _this$props=this.props,onIcon=_this$props.onIcon,offIcon=_this$props.offIcon;var on=this.state.on;return React.createElement("div",{className:"ui-shared__toggle-icon",onClick:this.handleToggle,"aria-hidden":true},on&&onIcon,!on&&offIcon);}}]);}(Component);_defineProperty(ToggleIcon,"defaultProps",{on:true,toggleHandler:noop});export default ToggleIcon;
@@ -1,6 +1,6 @@
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 Icon from'@shopgate/pwa-common/components/Icon';import{themeConfig}from'@shopgate/pwa-common/helpers/config';/**
1
+ var _excluded=["shadow"];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 Icon from'@shopgate/pwa-common/components/Icon';import{themeConfig}from'@shopgate/pwa-common/helpers/config';/**
2
2
  * The arrow icon component.
3
3
  * @param {Object} props The icon component properties.
4
4
  * @param {boolean} props.shadow Whether to show a shadow under the arrow.
5
5
  * @returns {JSX}
6
- */var ArrowIcon=function ArrowIcon(_ref){var shadow=_ref.shadow,props=_objectWithoutProperties(_ref,["shadow"]);var content=shadow?themeConfig.icons.arrowShadowed:themeConfig.icons.arrow;return React.createElement(Icon,_extends({content:content},props));};ArrowIcon.defaultProps={shadow:false};export default ArrowIcon;
6
+ */var ArrowIcon=function ArrowIcon(_ref){var shadow=_ref.shadow,props=_objectWithoutProperties(_ref,_excluded);var content=shadow?themeConfig.icons.arrowShadowed:themeConfig.icons.arrow;return React.createElement(Icon,_extends({content:content},props));};ArrowIcon.defaultProps={shadow:false};export default ArrowIcon;
@@ -0,0 +1,5 @@
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);}import React from'react';import Icon from'@shopgate/pwa-common/components/Icon';var content="\n <defs>\n <style>\n .cls-1, .cls-3 {\n fill: #81c6e5;\n }\n\n .cls-1 {\n opacity: 0.19;\n }\n\n .cls-2 {\n fill: none;\n fill-rule: evenodd;\n }\n\n .cls-4 {\n clip-path: url(#clip-path);\n }\n\n .cls-5, .cls-6 {\n opacity: 0.09;\n }\n\n .cls-5 {\n fill: url(#linear-gradient);\n }\n\n .cls-6 {\n fill: url(#linear-gradient-2);\n }\n\n .cls-7 {\n fill: #fff;\n }\n </style>\n <clipPath id=\"clip-path\">\n <path class=\"cls-1\" d=\"M39.407,6.8A23.038,23.038,0,0,0,6.6,39.15a23.007,23.007,0,0,0,32.552.2l.1-.1A23.078,23.078,0,0,0,39.407,6.8Z\" transform=\"translate(0 0)\"/>\n </clipPath>\n <linearGradient id=\"linear-gradient\" x1=\"0.273\" y1=\"0.267\" x2=\"0.705\" y2=\"0.641\" gradientUnits=\"objectBoundingBox\">\n <stop offset=\"0\"/>\n <stop offset=\"1\" stop-opacity=\"0.251\"/>\n </linearGradient>\n <linearGradient id=\"linear-gradient-2\" x1=\"0.5\" y1=\"0\" x2=\"0.5\" y2=\"1\" xlink:href=\"#linear-gradient\"/>\n </defs>\n <g transform=\"translate(283 -149)\">\n <path class=\"cls-2\" d=\"M39.474-83.7a22.758,22.758,0,0,0-32.346-.1,23.309,23.309,0,0,0-.1,32.455A22.484,22.484,0,0,0,23.1-44.5a22.282,22.282,0,0,0,16.123-6.644l.1-.1A23.26,23.26,0,0,0,39.474-83.7Z\" transform=\"translate(3265.005 8065.5)\"/>\n <path class=\"cls-3\" d=\"M39.407,6.8A23.038,23.038,0,0,0,6.6,39.15a23.007,23.007,0,0,0,32.552.2l.1-.1A23.078,23.078,0,0,0,39.407,6.8Z\" transform=\"translate(3265 7975)\"/>\n <g class=\"cls-4\" transform=\"translate(3265 7975)\">\n <path class=\"cls-5\" d=\"M3173.978,8072.545l-20.807,21.038,17.736,17.381,20.526-22.043Z\" transform=\"translate(-3140.448 -8060)\"/>\n </g>\n <path class=\"cls-6\" d=\"M3160.986,8075.234l-6.975,6.144,6.15,6.08,6.542-6.665Z\" transform=\"translate(124.137 -86.315)\"/>\n <path class=\"cls-2\" d=\"M5.454-46.5a4.99,4.99,0,0,1,4.954,5.009,4.99,4.99,0,0,1-4.954,5.009A4.99,4.99,0,0,1,.5-41.491,4.99,4.99,0,0,1,5.454-46.5Z\" transform=\"translate(3275.621 8032.744)\"/>\n <path class=\"cls-2\" d=\"M32.454-10.482A4.99,4.99,0,0,1,27.5-15.491,4.99,4.99,0,0,1,32.454-20.5a4.99,4.99,0,0,1,4.954,5.009A4.99,4.99,0,0,1,32.454-10.482Z\" transform=\"translate(3262.269 8020.033)\"/>\n <g transform=\"translate(3276.244 7986.244)\">\n <path class=\"cls-7\" d=\"M5.008,0a5.073,5.073,0,0,1,5.008,5.12,5.073,5.073,0,0,1-5.008,5.12A5.073,5.073,0,0,1,0,5.12,5.073,5.073,0,0,1,5.008,0Z\" transform=\"translate(0 0)\"/>\n <path class=\"cls-7\" d=\"M2.553,23.044a1.533,1.533,0,0,1-1.067.467,1.448,1.448,0,0,1-1.067-.467,1.559,1.559,0,0,1,0-2.127L20.485.428a1.481,1.481,0,0,1,2.083,0,1.614,1.614,0,0,1,.051,2.127Z\" transform=\"translate(0.511 0)\"/>\n <path class=\"cls-7\" d=\"M4.854,9.927A4.918,4.918,0,0,1,0,4.963,4.918,4.918,0,0,1,4.854,0,4.918,4.918,0,0,1,9.709,4.963,4.918,4.918,0,0,1,4.854,9.927Z\" transform=\"translate(13.802 13.584)\"/>\n </g>\n </g>\n";/**
2
+ * Cart discount default icon
3
+ * @param {Object} props .
4
+ * @returns {JSX}
5
+ */var CartCouponIcon=function CartCouponIcon(props){return React.createElement(Icon,_extends({content:content,viewBox:"3548 7826 45.999 46"},props));};export default CartCouponIcon;
@@ -0,0 +1,6 @@
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);}import React from'react';import Icon from'@shopgate/pwa-common/components/Icon';import{themeConfig}from'@shopgate/pwa-common/helpers/config';// SVG Content
2
+ var content='<path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/>';/**
3
+ * The description icon component.
4
+ * @param {Object} props The icon component properties.
5
+ * @returns {JSX}
6
+ */var Notification=function Notification(props){return React.createElement(Icon,_extends({content:themeConfig.icons.notification||content},props));};export default Notification;
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-ui-shared",
3
- "version": "7.12.3-beta.1",
3
+ "version": "7.20.0-beta.1",
4
4
  "description": "Shopgate's shared UI components.",
5
5
  "main": "index.js",
6
6
  "license": "Apache-2.0",
7
7
  "dependencies": {
8
- "@shopgate/pwa-ui-ios": "7.12.3-beta.1",
9
- "@shopgate/pwa-ui-material": "7.12.3-beta.1",
8
+ "@shopgate/pwa-ui-ios": "7.20.0-beta.1",
9
+ "@shopgate/pwa-ui-material": "7.20.0-beta.1",
10
10
  "react-day-picker": "^7.4.8"
11
11
  },
12
12
  "devDependencies": {
13
- "@shopgate/pwa-common": "7.12.3-beta.1",
14
- "@shopgate/pwa-common-commerce": "7.12.3-beta.1",
15
- "classnames": "^2.2.5",
13
+ "@shopgate/pwa-common": "7.20.0-beta.1",
14
+ "@shopgate/pwa-common-commerce": "7.20.0-beta.1",
15
+ "classnames": "2.3.3",
16
16
  "react": "~16.12.0"
17
17
  },
18
18
  "peerDependencies": {