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

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 (87) 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 +2 -2
  17. package/Chip/style.js +2 -2
  18. package/ClientInformation/index.js +10 -8
  19. package/ContextMenu/components/Position/index.js +5 -5
  20. package/ContextMenu/index.js +8 -8
  21. package/Dialog/components/PipelineErrorDialog/index.js +21 -13
  22. package/Dialog/components/PipelineErrorDialog/spec.js +1 -1
  23. package/Dialog/index.js +2 -2
  24. package/DiscountBadge/index.js +1 -1
  25. package/DiscountBadge/style.js +1 -2
  26. package/FavoritesButton/index.js +14 -14
  27. package/Footer/index.js +7 -7
  28. package/Form/Builder/builders/buildFormElements.js +2 -2
  29. package/Form/Builder/classes/ActionListener/constants.js +2 -2
  30. package/Form/Builder/classes/ActionListener/index.js +73 -16
  31. package/Form/Builder/classes/ActionListener/spec.js +2 -2
  32. package/Form/Builder/components/CheckboxElement.js +3 -3
  33. package/Form/Builder/components/CountryElement.js +3 -3
  34. package/Form/Builder/components/ProvinceElement.js +3 -3
  35. package/Form/Builder/components/RadioElement.js +3 -3
  36. package/Form/Builder/components/SelectElement.js +3 -3
  37. package/Form/Builder/components/TextElement.js +4 -4
  38. package/Form/Builder/index.js +39 -30
  39. package/Form/Checkbox/index.js +3 -3
  40. package/Form/Password/index.js +5 -5
  41. package/Form/RadioGroup/components/Item/index.js +2 -2
  42. package/Form/RadioGroup/index.js +6 -6
  43. package/Form/Select/index.js +10 -8
  44. package/Form/TextField/index.js +5 -5
  45. package/Form/index.js +8 -5
  46. package/FormElement/components/Label/style.js +1 -1
  47. package/FormElement/index.js +6 -6
  48. package/Glow/index.js +7 -7
  49. package/IndicatorCircle/index.js +1 -1
  50. package/LoadingIndicator/index.js +2 -2
  51. package/LoadingIndicator/style.js +1 -1
  52. package/Manufacturer/index.js +1 -1
  53. package/Manufacturer/style.js +1 -2
  54. package/MessageBar/index.js +1 -1
  55. package/NoResults/index.js +1 -1
  56. package/Placeholder/index.js +3 -3
  57. package/PlaceholderLabel/index.js +1 -1
  58. package/PlaceholderParagraph/index.js +1 -1
  59. package/Price/index.js +5 -3
  60. package/Price/style.js +1 -1
  61. package/PriceInfo/index.js +1 -1
  62. package/PriceStriked/index.js +9 -9
  63. package/ProductProperties/index.js +2 -2
  64. package/ProgressBar/index.js +12 -12
  65. package/RatingNumber/index.js +1 -1
  66. package/RatingStars/index.js +8 -8
  67. package/RatingStars/style.js +1 -2
  68. package/Ripple/components/RippleAnimation/index.js +3 -3
  69. package/Ripple/index.js +20 -17
  70. package/RippleButton/index.js +7 -7
  71. package/ScannerOverlay/components/ScannerBar/index.js +1 -1
  72. package/ScannerOverlay/index.js +4 -4
  73. package/Sheet/components/Header/components/SearchBar/index.js +3 -0
  74. package/Sheet/components/Header/components/SearchBar/spec.js +3 -0
  75. package/Sheet/components/Header/components/SearchBar/style.js +1 -0
  76. package/Sheet/components/Header/index.js +7 -7
  77. package/Sheet/index.js +19 -16
  78. package/Sheet/style.js +2 -1
  79. package/TaxDisclaimer/index.js +4 -2
  80. package/TaxDisclaimer/spec.js +1 -1
  81. package/TextField/components/Label/style.js +1 -1
  82. package/TextField/index.js +23 -14
  83. package/ToggleIcon/index.js +7 -7
  84. package/icons/ArrowIcon.js +2 -2
  85. package/icons/CartCouponIcon.js +5 -0
  86. package/icons/NotificationIcon.js +6 -0
  87. package/package.json +6 -6
@@ -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,{PureComponent,Fragment}from'react';import PropTypes from'prop-types';import Chevron from"../../../icons/CheckIcon";import Select from"../../Select";/**
1
+ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent,Fragment}from'react';import PropTypes from'prop-types';import Chevron from"../../../icons/CheckIcon";import Select from"../../Select";/**
2
2
  * React component that takes the element and additional data and renders a configured select box.
3
3
  * @returns {JSX}
4
- */var SelectElement=/*#__PURE__*/function(_PureComponent){_inherits(SelectElement,_PureComponent);function SelectElement(){_classCallCheck(this,SelectElement);return _possibleConstructorReturn(this,_getPrototypeOf(SelectElement).apply(this,arguments));}_createClass(SelectElement,[{key:"render",/**
4
+ */var SelectElement=/*#__PURE__*/function(_PureComponent){function SelectElement(){_classCallCheck(this,SelectElement);return _callSuper(this,SelectElement,arguments);}_inherits(SelectElement,_PureComponent);return _createClass(SelectElement,[{key:"render",value:/**
5
5
  * @returns {JSX}
6
- */value:function render(){var _this$props=this.props,element=_this$props.element,errorText=_this$props.errorText,name=_this$props.name,style=_this$props.style,value=_this$props.value;return React.createElement(Fragment,null,React.createElement(Select,{name:name,className:style.fields,label:element.label,placeholder:element.placeholder,value:value,options:element.options,onChange:element.handleChange,errorText:errorText,isControlled:true,translateErrorText:false}),React.createElement(Chevron,null));}}]);return SelectElement;}(PureComponent);_defineProperty(SelectElement,"defaultProps",{value:'',style:{fields:''}});export default SelectElement;
6
+ */function render(){var _this$props=this.props,element=_this$props.element,errorText=_this$props.errorText,name=_this$props.name,style=_this$props.style,value=_this$props.value;return React.createElement(Fragment,null,React.createElement(Select,{name:name,className:style.fields,label:element.label,placeholder:element.placeholder,value:value,options:element.options,onChange:element.handleChange,errorText:errorText,isControlled:true,translateErrorText:false}),React.createElement(Chevron,null));}}]);}(PureComponent);_defineProperty(SelectElement,"defaultProps",{value:'',style:{fields:''}});export default SelectElement;
@@ -1,6 +1,6 @@
1
- var _mapping;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,{PureComponent}from'react';import PropTypes from'prop-types';import TextField from"../../../TextField";import{ELEMENT_TYPE_TEXT,ELEMENT_TYPE_NUMBER,ELEMENT_TYPE_EMAIL,ELEMENT_TYPE_PASSWORD,ELEMENT_TYPE_DATE,ELEMENT_TYPE_PHONE}from"../elementTypes";// Map element type to input type
2
- var mapping=(_mapping={},_defineProperty(_mapping,ELEMENT_TYPE_TEXT,'text'),_defineProperty(_mapping,ELEMENT_TYPE_NUMBER,'number'),_defineProperty(_mapping,ELEMENT_TYPE_EMAIL,'email'),_defineProperty(_mapping,ELEMENT_TYPE_PASSWORD,'password'),_defineProperty(_mapping,ELEMENT_TYPE_DATE,'date'),_defineProperty(_mapping,ELEMENT_TYPE_PHONE,'tel'),_mapping);/**
1
+ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import TextField from"../../../TextField";import{ELEMENT_TYPE_TEXT,ELEMENT_TYPE_NUMBER,ELEMENT_TYPE_EMAIL,ELEMENT_TYPE_PASSWORD,ELEMENT_TYPE_DATE,ELEMENT_TYPE_PHONE}from"../elementTypes";// Map element type to input type
2
+ var mapping=_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},ELEMENT_TYPE_TEXT,'text'),ELEMENT_TYPE_NUMBER,'number'),ELEMENT_TYPE_EMAIL,'email'),ELEMENT_TYPE_PASSWORD,'password'),ELEMENT_TYPE_DATE,'date'),ELEMENT_TYPE_PHONE,'tel');/**
3
3
  * React component that takes the element and additional data and renders a configured text input.
4
- */var TextElement=/*#__PURE__*/function(_PureComponent){_inherits(TextElement,_PureComponent);function TextElement(){_classCallCheck(this,TextElement);return _possibleConstructorReturn(this,_getPrototypeOf(TextElement).apply(this,arguments));}_createClass(TextElement,[{key:"render",/**
4
+ */var TextElement=/*#__PURE__*/function(_PureComponent){function TextElement(){_classCallCheck(this,TextElement);return _callSuper(this,TextElement,arguments);}_inherits(TextElement,_PureComponent);return _createClass(TextElement,[{key:"render",value:/**
5
5
  * @returns {JSX}
6
- */value:function render(){var _this$props=this.props,element=_this$props.element,errorText=_this$props.errorText,name=_this$props.name,style=_this$props.style,value=_this$props.value;var type=mapping[element.type];return React.createElement(TextField,{type:type,name:name,className:style.fields,label:element.label,value:value,onChange:element.handleChange,errorText:errorText,isControlled:true,translateErrorText:false});}}]);return TextElement;}(PureComponent);_defineProperty(TextElement,"defaultProps",{value:'',style:{field:''}});export default TextElement;
6
+ */function render(){var _this$props=this.props,element=_this$props.element,errorText=_this$props.errorText,name=_this$props.name,style=_this$props.style,value=_this$props.value;var type=mapping[element.type];return React.createElement(TextField,{type:type,name:name,className:style.fields,label:element.label,value:value,onChange:element.handleChange,errorText:errorText,isControlled:true,translateErrorText:false});}}]);}(PureComponent);_defineProperty(TextElement,"defaultProps",{value:'',style:{field:''}});export default TextElement;
@@ -1,4 +1,4 @@
1
- import _isEqual from"lodash/isEqual";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 _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,Fragment}from'react';import PropTypes from'prop-types';import{logger}from'@shopgate/pwa-core/helpers';import Portal from'@shopgate/pwa-common/components/Portal';import Form from'@shopgate/pwa-ui-shared/Form';import{BEFORE,AFTER}from'@shopgate/pwa-common/constants/Portals';import ActionListener from"./classes/ActionListener";import{ELEMENT_TYPE_EMAIL,ELEMENT_TYPE_PASSWORD,ELEMENT_TYPE_TEXT,ELEMENT_TYPE_NUMBER,ELEMENT_TYPE_SELECT,ELEMENT_TYPE_COUNTRY,ELEMENT_TYPE_PROVINCE,ELEMENT_TYPE_CHECKBOX,ELEMENT_TYPE_RADIO,ELEMENT_TYPE_DATE,ELEMENT_TYPE_PHONE}from"./elementTypes";import TextElement from"./components/TextElement";import SelectElement from"./components/SelectElement";import CountryElement from"./components/CountryElement";import ProvinceElement from"./components/ProvinceElement";import RadioElement from"./components/RadioElement";import CheckboxElement from"./components/CheckboxElement";import buildFormElements from"./builders/buildFormElements";import buildFormDefaults from"./builders/buildFormDefaults";import buildCountryList from"./builders/buildCountryList";import buildProvinceList from"./builders/buildProvinceList";import buildValidationErrorList from"./builders/buildValidationErrorList";/**
1
+ import _isEqual from"lodash/isEqual";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 _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,Fragment}from'react';import PropTypes from'prop-types';import{logger}from'@shopgate/pwa-core/helpers';import Portal from'@shopgate/pwa-common/components/Portal';import Form from'@shopgate/pwa-ui-shared/Form';import{BEFORE,AFTER}from'@shopgate/pwa-common/constants/Portals';import ActionListener from"./classes/ActionListener";import{ELEMENT_TYPE_EMAIL,ELEMENT_TYPE_PASSWORD,ELEMENT_TYPE_TEXT,ELEMENT_TYPE_NUMBER,ELEMENT_TYPE_SELECT,ELEMENT_TYPE_COUNTRY,ELEMENT_TYPE_PROVINCE,ELEMENT_TYPE_CHECKBOX,ELEMENT_TYPE_RADIO,ELEMENT_TYPE_DATE,ELEMENT_TYPE_PHONE}from"./elementTypes";import TextElement from"./components/TextElement";import SelectElement from"./components/SelectElement";import CountryElement from"./components/CountryElement";import ProvinceElement from"./components/ProvinceElement";import RadioElement from"./components/RadioElement";import CheckboxElement from"./components/CheckboxElement";import buildFormElements from"./builders/buildFormElements";import buildFormDefaults from"./builders/buildFormDefaults";import buildCountryList from"./builders/buildCountryList";import buildProvinceList from"./builders/buildProvinceList";import buildValidationErrorList from"./builders/buildValidationErrorList";/**
2
2
  * Takes a string and converts it to a part to be used in a portal name
3
3
  * @package FormBuilder
4
4
  * @param {string} s The string to be sanitized
@@ -9,47 +9,56 @@ import _isEqual from"lodash/isEqual";function _typeof(obj){if(typeof Symbol==="f
9
9
  */var emptySelectOption={'':''};/**
10
10
  * Takes a form configuration and handles rendering and updates of the form fields.
11
11
  * Note: Only one country and one province element is supported per FormBuilder instance.
12
- */var Builder=/*#__PURE__*/function(_Component){_inherits(Builder,_Component);function Builder(props){var _this;_classCallCheck(this,Builder);_this=_possibleConstructorReturn(this,_getPrototypeOf(Builder).call(this,props));// Prepare internal state
13
- _defineProperty(_assertThisInitialized(_this),"elementSortFunc",function(element1,element2){// Keep current sort order when no specific sort order was set for both
12
+ */var Builder=/*#__PURE__*/function(_Component){function Builder(props){var _this2;_classCallCheck(this,Builder);_this2=_callSuper(this,Builder,[props]);// Prepare internal state
13
+ /**
14
+ * Sorts the elements by "sortOrder" property
15
+ *
16
+ * @typedef {Object} FormElement
17
+ * @property {number} sortOrder
18
+ *
19
+ * @param {FormElement} element1 First element
20
+ * @param {FormElement} element2 Second element
21
+ * @returns {number}
22
+ */_defineProperty(_this2,"elementSortFunc",function(element1,element2){// Keep current sort order when no specific sort order was set for both
14
23
  if(element1.sortOrder===undefined||element2.sortOrder===undefined){return 0;}// Sort in ascending order of sortOrder otherwise
15
- return element1.sortOrder-element2.sortOrder;});_defineProperty(_assertThisInitialized(_this),"elementChangeHandler",function(elementId,value){// Apply value change to new state
16
- var newState=_extends({},_this.state,{formData:_extends({},_this.state.formData,_defineProperty({},elementId,value))});// Remove validation error message on first change of the element
24
+ return element1.sortOrder-element2.sortOrder;});/**
25
+ * Element change handler based on it's type,
26
+ * @param {string} elementId Element to create the handler for
27
+ * @param {string} value Element value
28
+ */_defineProperty(_this2,"elementChangeHandler",function(elementId,value){// Apply value change to new state
29
+ var newState=_extends({},_this2.state,{formData:_extends({},_this2.state.formData,_defineProperty({},elementId,value))});// Remove validation error message on first change of the element
17
30
  Object.keys(newState.errors).forEach(function(key){// Action listeners might add some again
18
- if(_this.state.formData[key]!==newState.formData[key]){delete newState.errors[key];}});var hasBackendValidationErrors=Object.keys(newState.errors).length>0;// Handle context sensitive functionality by via "action" listener and use the "new" state
19
- var updatedState=_this.actionListener.notify(elementId,_this.state,newState);// TODO: handle frontend validation errors and set "hasErrors" accordingly
31
+ if(_this2.state.formData[key]!==newState.formData[key]){delete newState.errors[key];}});var hasBackendValidationErrors=Object.keys(newState.errors).length>0;// Handle context sensitive functionality by via "action" listener and use the "new" state
32
+ var updatedState=_this2.actionListener.notify(elementId,_this2.state,newState);// TODO: handle frontend validation errors and set "hasErrors" accordingly
20
33
  var hasErrors=false;// Check "required" fields for all visible elements and enable rendering on changes
21
- _this.formElements.forEach(function(formElement){if(!updatedState.elementVisibility[formElement.id]||!formElement.required){return;}var tmpVal=updatedState.formData[formElement.id];var tmpResult=tmpVal===null||tmpVal===undefined||tmpVal===''||tmpVal===false;hasErrors=hasErrors||tmpResult;});var hasFrontendValidationErrors=Object.keys(updatedState.errors).length<=0;var hasValidationErrors=hasBackendValidationErrors&&hasFrontendValidationErrors;// Handle state internally and send an "onChange" event to parent if this finished
22
- _this.setState(updatedState);// Transform to external structure (unavailable ones will be set undefined)
23
- var updateData={};_this.formElements.forEach(function(el){if(el.custom){if(updateData.customAttributes===undefined){updateData.customAttributes={};}updateData.customAttributes[el.id]=updatedState.formData[el.id];}else{updateData[el.id]=updatedState.formData[el.id];}});// Trigger the given update action
24
- _this.props.handleUpdate(updateData,hasErrors||hasValidationErrors);});_defineProperty(_assertThisInitialized(_this),"renderElement",function(element){var elementName="".concat(_this.props.name,".").concat(element.id);var elementErrorText=_this.state.errors[element.id]||'';var elementValue=_this.state.formData[element.id];var elementVisible=_this.state.elementVisibility[element.id]||false;if(!elementVisible){return null;}/*
34
+ _this2.formElements.forEach(function(formElement){if(!updatedState.elementVisibility[formElement.id]||!formElement.required){return;}var tmpVal=updatedState.formData[formElement.id];var tmpResult=tmpVal===null||tmpVal===undefined||tmpVal===''||tmpVal===false;hasErrors=hasErrors||tmpResult;});var hasFrontendValidationErrors=Object.keys(updatedState.errors).length<=0;var hasValidationErrors=hasBackendValidationErrors&&hasFrontendValidationErrors;// Handle state internally and send an "onChange" event to parent if this finished
35
+ _this2.setState(updatedState);// Transform to external structure (unavailable ones will be set undefined)
36
+ var updateData={};_this2.formElements.forEach(function(el){if(el.custom){if(updateData.customAttributes===undefined){updateData.customAttributes={};}updateData.customAttributes[el.id]=updatedState.formData[el.id];}else{updateData[el.id]=updatedState.formData[el.id];}});// Trigger the given update action
37
+ _this2.props.handleUpdate(updateData,hasErrors||hasValidationErrors);});/**
38
+ * Takes an element of any type and renders it depending on type.
39
+ * Also puts portals around the element.
40
+ * @param {Object} element The data of the element to be rendered
41
+ * @returns {JSX}
42
+ */_defineProperty(_this2,"renderElement",function(element){var elementName="".concat(_this2.props.name,".").concat(element.id);var elementErrorText=_this2.state.errors[element.id]||'';var elementValue=_this2.state.formData[element.id];var elementVisible=_this2.state.elementVisibility[element.id]||false;if(!elementVisible){return null;}/*
25
43
  * Elements do check the type before they render themselves, but not even trying to render
26
44
  * creates a better React DOM
27
- */switch(element.type){case ELEMENT_TYPE_TEXT:case ELEMENT_TYPE_NUMBER:case ELEMENT_TYPE_EMAIL:case ELEMENT_TYPE_PASSWORD:case ELEMENT_TYPE_DATE:case ELEMENT_TYPE_PHONE:{return React.createElement(TextElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue||'',visible:elementVisible});}case ELEMENT_TYPE_SELECT:return React.createElement(SelectElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue,visible:elementVisible});case ELEMENT_TYPE_COUNTRY:return React.createElement(CountryElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue,visible:elementVisible,countryList:_this.countryList});case ELEMENT_TYPE_PROVINCE:{var countryElement=_this.formElements.find(function(el){return el.type===ELEMENT_TYPE_COUNTRY;});var provincesList=countryElement&&_this.state.formData[countryElement.id]?buildProvinceList(_this.state.formData[countryElement.id],element.required?null:emptySelectOption):{};return React.createElement(ProvinceElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue,visible:elementVisible,provincesList:provincesList});}case ELEMENT_TYPE_RADIO:{return React.createElement(RadioElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue,visible:elementVisible});}case ELEMENT_TYPE_CHECKBOX:{return React.createElement(CheckboxElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue,visible:elementVisible});}default:{logger.error("Unknown form element type: ".concat(element.type));break;}}return null;});_this.state={elementVisibility:{},formData:{},// Convert errors structure to direct access errors
45
+ */switch(element.type){case ELEMENT_TYPE_TEXT:case ELEMENT_TYPE_NUMBER:case ELEMENT_TYPE_EMAIL:case ELEMENT_TYPE_PASSWORD:case ELEMENT_TYPE_DATE:case ELEMENT_TYPE_PHONE:{return React.createElement(TextElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue||'',visible:elementVisible});}case ELEMENT_TYPE_SELECT:return React.createElement(SelectElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue,visible:elementVisible});case ELEMENT_TYPE_COUNTRY:return React.createElement(CountryElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue,visible:elementVisible,countryList:_this2.countryList});case ELEMENT_TYPE_PROVINCE:{var countryElement=_this2.formElements.find(function(el){return el.type===ELEMENT_TYPE_COUNTRY;});var provincesList=countryElement&&_this2.state.formData[countryElement.id]?buildProvinceList(_this2.state.formData[countryElement.id],element.required?null:emptySelectOption):{};return React.createElement(ProvinceElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue,visible:elementVisible,provincesList:provincesList});}case ELEMENT_TYPE_RADIO:{return React.createElement(RadioElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue,visible:elementVisible});}case ELEMENT_TYPE_CHECKBOX:{return React.createElement(CheckboxElement,{name:elementName,element:element,errorText:elementErrorText,value:elementValue,visible:elementVisible});}default:{logger.error("Unknown form element type: ".concat(element.type));break;}}return null;});_this2.state={elementVisibility:{},formData:{},// Convert errors structure to direct access errors
28
46
  errors:buildValidationErrorList(props.validationErrors)};// Reorganize form elements into a structure that can be easily rendered
29
- var formElements=buildFormElements(props.config,_this.elementChangeHandler);// Compute defaults
47
+ var formElements=buildFormElements(props.config,_this2.elementChangeHandler);// Compute defaults
30
48
  var formDefaults=buildFormDefaults(formElements,props.defaults);// Assign defaults to state
31
- _this.state.formData=formDefaults;// Handle fixed visibilities
49
+ _this2.state.formData=formDefaults;// Handle fixed visibilities
32
50
  formElements.forEach(function(element){// Assume as visible except it's explicitly set to "false"
33
- _this.state.elementVisibility[element.id]=element.visible!==false;});_this.actionListener=new ActionListener(buildProvinceList,formDefaults);_this.actionListener.attachAll(formElements);// Sort the elements after attaching action listeners to keep action hierarchy same as creation
34
- _this.formElements=formElements.sort(_this.elementSortFunc);// Assemble combined country/province list based on the config element
35
- var _countryElement=_this.formElements.find(function(el){return el.type===ELEMENT_TYPE_COUNTRY;});if(_countryElement){_this.countryList=buildCountryList(_countryElement,emptySelectOption);var provinceElement=_this.formElements.find(function(el){return el.type===ELEMENT_TYPE_PROVINCE;});if(provinceElement&&provinceElement.required&&!!formDefaults[_countryElement.id]&&!formDefaults[provinceElement.id]){// Set default for province field for given country
36
- var _Object$values=Object.values(buildProvinceList(formDefaults[_countryElement.id])),_Object$values2=_slicedToArray(_Object$values,1),first=_Object$values2[0];if(first){_this.state.formData[provinceElement.id]=first;}}}// Final form initialization, by triggering actionListeners and enable rendering for elements
37
- var _newState=_this.state;_this.formElements.forEach(function(element){_newState=_this.actionListener.notify(element.id,_this.state,_newState);});_this.state=_newState;return _this;}/**
51
+ _this2.state.elementVisibility[element.id]=element.visible!==false;});_this2.actionListener=new ActionListener(buildProvinceList,formDefaults);_this2.actionListener.attachAll(formElements);// Sort the elements after attaching action listeners to keep action hierarchy same as creation
52
+ _this2.formElements=formElements.sort(_this2.elementSortFunc);// Assemble combined country/province list based on the config element
53
+ var _countryElement=_this2.formElements.find(function(el){return el.type===ELEMENT_TYPE_COUNTRY;});if(_countryElement){_this2.countryList=buildCountryList(_countryElement,emptySelectOption);var provinceElement=_this2.formElements.find(function(el){return el.type===ELEMENT_TYPE_PROVINCE;});if(provinceElement&&provinceElement.required&&!!formDefaults[_countryElement.id]&&!formDefaults[provinceElement.id]){// Set default for province field for given country
54
+ var _Object$values3=Object.values(buildProvinceList(formDefaults[_countryElement.id])),_Object$values4=_slicedToArray(_Object$values3,1),first=_Object$values4[0];if(first){_this2.state.formData[provinceElement.id]=first;}}}// Final form initialization, by triggering actionListeners and enable rendering for elements
55
+ var _newState=_this2.state;_this2.formElements.forEach(function(element){_newState=_this2.actionListener.notify(element.id,_this2.state,_newState);});_this2.state=_newState;return _this2;}/**
38
56
  * Handles response of validation errors
39
57
  * @param {Object} nextProps The new props object with changed data
40
- */_createClass(Builder,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){var oldValidationErrors=buildValidationErrorList(this.props.validationErrors);var newValidationErrors=buildValidationErrorList(nextProps.validationErrors);if(!_isEqual(oldValidationErrors,newValidationErrors)){this.setState({errors:newValidationErrors});}}/**
41
- * Sorts the elements by "sortOrder" property
42
- *
43
- * @typedef {Object} FormElement
44
- * @property {number} sortOrder
45
- *
46
- * @param {FormElement} element1 First element
47
- * @param {FormElement} element2 Second element
48
- * @returns {number}
49
- */},{key:"render",/**
58
+ */_inherits(Builder,_Component);return _createClass(Builder,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){var oldValidationErrors=buildValidationErrorList(this.props.validationErrors);var newValidationErrors=buildValidationErrorList(nextProps.validationErrors);if(!_isEqual(oldValidationErrors,newValidationErrors)){this.setState({errors:newValidationErrors});}}},{key:"render",value:/**
50
59
  * Renders the component based on the given config
51
60
  * @return {JSX}
52
- */value:function render(){var _this2=this;return React.createElement(Fragment,null,React.createElement(Form,{onSubmit:this.props.onSubmit},React.createElement("div",{className:this.props.className},this.formElements.map(function(element){return React.createElement(Fragment,{key:"".concat(_this2.props.name,".").concat(element.id)},React.createElement(Portal,{name:"".concat(sanitize(_this2.props.name),".").concat(sanitize(element.id),".").concat(BEFORE)}),React.createElement(Portal,{name:"".concat(sanitize(_this2.props.name),".").concat(sanitize(element.id))},_this2.renderElement(element)),React.createElement(Portal,{name:"".concat(sanitize(_this2.props.name),".").concat(sanitize(element.id),".").concat(AFTER)}));}))));}}]);return Builder;}(Component);_defineProperty(Builder,"defaultProps",{className:'',defaults:{},onSubmit:function onSubmit(){},validationErrors:[]/**
61
+ */function render(){var _this3=this;return React.createElement(Fragment,null,React.createElement(Form,{onSubmit:this.props.onSubmit},React.createElement("div",{className:this.props.className},this.formElements.map(function(element){return React.createElement(Fragment,{key:"".concat(_this3.props.name,".").concat(element.id)},React.createElement(Portal,{name:"".concat(sanitize(_this3.props.name),".").concat(sanitize(element.id),".").concat(BEFORE)}),React.createElement(Portal,{name:"".concat(sanitize(_this3.props.name),".").concat(sanitize(element.id))},_this3.renderElement(element)),React.createElement(Portal,{name:"".concat(sanitize(_this3.props.name),".").concat(sanitize(element.id),".").concat(AFTER)}));}))));}}]);}(Component);_defineProperty(Builder,"defaultProps",{className:'',defaults:{},onSubmit:function onSubmit(){},validationErrors:[]/**
53
62
  * Initializes the component.
54
63
  * @param {Object} props The components props.
55
64
  */});export default Builder;
@@ -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 _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 _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import classNames from'classnames';import I18n from'@shopgate/pwa-common/components/I18n';import UICheckbox from'@shopgate/pwa-ui-shared/Checkbox';import FormElement from'@shopgate/pwa-ui-shared/FormElement';import style from"./style";/**
1
+ var _excluded=["name","label","onChange","className","errorText","translateErrorText","showErrorText"];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,{PureComponent}from'react';import PropTypes from'prop-types';import classNames from'classnames';import I18n from'@shopgate/pwa-common/components/I18n';import UICheckbox from'@shopgate/pwa-ui-shared/Checkbox';import FormElement from'@shopgate/pwa-ui-shared/FormElement';import style from"./style";/**
2
2
  * A component that provides a styled checkbox field.
3
3
  * @returns {JSX}
4
- */var Checkbox=/*#__PURE__*/function(_PureComponent){_inherits(Checkbox,_PureComponent);function Checkbox(){_classCallCheck(this,Checkbox);return _possibleConstructorReturn(this,_getPrototypeOf(Checkbox).apply(this,arguments));}_createClass(Checkbox,[{key:"render",/**
4
+ */var Checkbox=/*#__PURE__*/function(_PureComponent){function Checkbox(){_classCallCheck(this,Checkbox);return _callSuper(this,Checkbox,arguments);}_inherits(Checkbox,_PureComponent);return _createClass(Checkbox,[{key:"render",value:/**
5
5
  * @return {JSX}
6
- */value:function render(){var _this$props=this.props,name=_this$props.name,label=_this$props.label,onChange=_this$props.onChange,className=_this$props.className,errorText=_this$props.errorText,translateErrorText=_this$props.translateErrorText,showErrorText=_this$props.showErrorText,restProps=_objectWithoutProperties(_this$props,["name","label","onChange","className","errorText","translateErrorText","showErrorText"]);return React.createElement(FormElement,{className:classNames(className,style.root,'checkbox'),htmlFor:name,errorText:errorText,translateErrorText:translateErrorText,hasUnderline:false,hasPlaceholder:false,disabled:restProps.disabled,showErrorText:showErrorText},React.createElement(UICheckbox,_extends({},restProps,{name:name,onCheck:onChange,checkedClassName:"".concat(className," ").concat(style.checked),unCheckedClassName:className,labelPosition:"right",label:React.createElement("div",{className:classNames(style.labelWrapper,'label')},React.createElement(I18n.Text,{className:style.label,string:label}))})));}}]);return Checkbox;}(PureComponent);_defineProperty(Checkbox,"defaultProps",{className:'',defaultChecked:undefined,errorText:'',label:'',onChange:function onChange(){},translateErrorText:true,disabled:false,showErrorText:true});export default Checkbox;
6
+ */function render(){var _this$props=this.props,name=_this$props.name,label=_this$props.label,onChange=_this$props.onChange,className=_this$props.className,errorText=_this$props.errorText,translateErrorText=_this$props.translateErrorText,showErrorText=_this$props.showErrorText,restProps=_objectWithoutProperties(_this$props,_excluded);return React.createElement(FormElement,{className:classNames(className,style.root,'checkbox','ui-shared__form__checkbox'),htmlFor:name,errorText:errorText,translateErrorText:translateErrorText,hasUnderline:false,hasPlaceholder:false,disabled:restProps.disabled,showErrorText:showErrorText},React.createElement(UICheckbox,_extends({},restProps,{name:name,onCheck:onChange,checkedClassName:"".concat(className," ").concat(style.checked),unCheckedClassName:className,labelPosition:"right",label:React.createElement("div",{className:classNames(style.labelWrapper,'label')},React.createElement(I18n.Text,{className:style.label,string:label}))})));}}]);}(PureComponent);_defineProperty(Checkbox,"defaultProps",{className:'',defaultChecked:undefined,errorText:'',label:'',onChange:function onChange(){},translateErrorText:true,disabled:false,showErrorText:true});export default Checkbox;
@@ -1,10 +1,10 @@
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 ToggleIcon from"../../ToggleIcon";import VisibilityIcon from"../../icons/VisibilityIcon";import VisibilityOffIcon from"../../icons/VisibilityOffIcon";import TextField from"../TextField";import style 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 ToggleIcon from"../../ToggleIcon";import VisibilityIcon from"../../icons/VisibilityIcon";import VisibilityOffIcon from"../../icons/VisibilityOffIcon";import TextField from"../TextField";import style from"./style";/**
2
2
  * A component that provides a password field with visibility toggle.
3
- */var Password=/*#__PURE__*/function(_Component){_inherits(Password,_Component);/**
3
+ */var Password=/*#__PURE__*/function(_Component){/**
4
4
  * Initializes the component.
5
5
  * @param {Object} props The components props.
6
- */function Password(props){var _this;_classCallCheck(this,Password);_this=_possibleConstructorReturn(this,_getPrototypeOf(Password).call(this,props));_defineProperty(_assertThisInitialized(_this),"togglePasswordVisibility",function(isVisible){_this.setState({isVisible:isVisible});});_this.state={isVisible:false};return _this;}/**
6
+ */function Password(props){var _this2;_classCallCheck(this,Password);_this2=_callSuper(this,Password,[props]);/**
7
7
  * @param {boolean} isVisible The next isVisible state.
8
- */_createClass(Password,[{key:"render",/**
8
+ */_defineProperty(_this2,"togglePasswordVisibility",function(isVisible){_this2.setState({isVisible:isVisible});});_this2.state={isVisible:false};return _this2;}_inherits(Password,_Component);return _createClass(Password,[{key:"render",value:/**
9
9
  * @return {*}
10
- */value:function render(){var isVisible=this.state.isVisible;return React.createElement(TextField,_extends({},this.props,{rightElement:React.createElement(ToggleIcon,{on:isVisible,onIcon:React.createElement(VisibilityIcon,{size:24}),offIcon:React.createElement(VisibilityOffIcon,{size:24,className:style.visOff}),toggleHandler:this.togglePasswordVisibility}),type:isVisible?'text':'password'}));}}]);return Password;}(Component);export default Password;
10
+ */function render(){var isVisible=this.state.isVisible;return React.createElement(TextField,_extends({},this.props,{className:"ui-shared__form__password ".concat(this.props.className),rightElement:React.createElement(ToggleIcon,{on:isVisible,onIcon:React.createElement(VisibilityIcon,{size:24}),offIcon:React.createElement(VisibilityOffIcon,{size:24,className:style.visOff}),toggleHandler:this.togglePasswordVisibility}),type:isVisible?'text':'password'}));}}]);}(Component);export default Password;
@@ -1,6 +1,6 @@
1
- import _camelCase from"lodash/camelCase";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,{PureComponent}from'react';import PropTypes from'prop-types';import classNames from'classnames';import CheckedIcon from'@shopgate/pwa-ui-shared/icons/RadioCheckedIcon';import UncheckedIcon from'@shopgate/pwa-ui-shared/icons/RadioUncheckedIcon';import I18n from'@shopgate/pwa-common/components/I18n';import style from"./style";/**
1
+ import _camelCase from"lodash/camelCase";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,{PureComponent}from'react';import PropTypes from'prop-types';import classNames from'classnames';import CheckedIcon from'@shopgate/pwa-ui-shared/icons/RadioCheckedIcon';import UncheckedIcon from'@shopgate/pwa-ui-shared/icons/RadioUncheckedIcon';import I18n from'@shopgate/pwa-common/components/I18n';import style from"./style";/**
2
2
  * RadioItem component.
3
- */var RadioItem=/*#__PURE__*/function(_PureComponent){_inherits(RadioItem,_PureComponent);function RadioItem(){_classCallCheck(this,RadioItem);return _possibleConstructorReturn(this,_getPrototypeOf(RadioItem).apply(this,arguments));}_createClass(RadioItem,[{key:"render",value:function render(){var _this$props=this.props,ItemLabel=_this$props.label,name=_this$props.name,onChange=_this$props.onChange,checked=_this$props.checked,className=_this$props.className,attributes=_this$props.attributes;var _ref=attributes||{},disabled=_ref.disabled;return React.createElement("label",{className:classNames(style.container,className,_defineProperty({},style.disabled,!!disabled),_camelCase(name),'radioItem'),htmlFor:this.key},checked&&React.createElement(CheckedIcon,{className:classNames(style.active,style.icon,'checkedIcon')}),!checked&&React.createElement(UncheckedIcon,{className:classNames(style.icon,'uncheckedIcon')}),React.createElement("input",_extends({className:classNames(style.input,'input'),checked:checked,type:"radio",name:name,onChange:onChange},attributes)),React.createElement(I18n.Text,{className:classNames(style.label,'label'),string:ItemLabel}));}}]);return RadioItem;}(PureComponent);_defineProperty(RadioItem,"defaultProps",{attributes:null,checked:false,className:'',onChange:function onChange(){}/**
3
+ */var RadioItem=/*#__PURE__*/function(_PureComponent){function RadioItem(){_classCallCheck(this,RadioItem);return _callSuper(this,RadioItem,arguments);}_inherits(RadioItem,_PureComponent);return _createClass(RadioItem,[{key:"render",value:function render(){var _this$props=this.props,ItemLabel=_this$props.label,name=_this$props.name,onChange=_this$props.onChange,checked=_this$props.checked,className=_this$props.className,attributes=_this$props.attributes;var _ref=attributes||{},disabled=_ref.disabled;return React.createElement("label",{className:classNames(style.container,className,_defineProperty({},style.disabled,!!disabled),_camelCase(name),'radioItem'),htmlFor:this.key},checked&&React.createElement(CheckedIcon,{className:classNames(style.active,style.icon,'checkedIcon')}),!checked&&React.createElement(UncheckedIcon,{className:classNames(style.icon,'uncheckedIcon')}),React.createElement("input",_extends({className:classNames(style.input,'input'),checked:checked,type:"radio",name:name,onChange:onChange},attributes)),React.createElement(I18n.Text,{className:classNames(style.label,'label'),string:ItemLabel}));}}]);}(PureComponent);_defineProperty(RadioItem,"defaultProps",{attributes:null,checked:false,className:'',onChange:function onChange(){}/**
4
4
  * Renders the component.
5
5
  * @returns {JSX}
6
6
  */});export default RadioItem;
@@ -1,13 +1,13 @@
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,Children,cloneElement}from'react';import PropTypes from'prop-types';import classNames from'classnames';import FormElement from'@shopgate/pwa-ui-shared/FormElement';import style 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{hot}from'react-hot-loader/root';import React,{Component,Children,cloneElement}from'react';import PropTypes from'prop-types';import classNames from'classnames';import FormElement from'@shopgate/pwa-ui-shared/FormElement';import style from"./style";/**
2
2
  * RadioGroup component.
3
- */var RadioGroup=/*#__PURE__*/function(_Component){_inherits(RadioGroup,_Component);function RadioGroup(props){var _this;_classCallCheck(this,RadioGroup);_this=_possibleConstructorReturn(this,_getPrototypeOf(RadioGroup).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleChange",function(_ref){var name=_ref.target.name;if(_this.props.disabled){return;}if(!_this.props.isControlled){_this.setState({value:name});}_this.props.onChange(name);});_this.state={value:props.value};return _this;}/**
4
- * @param {Object} nextProps props
5
- */_createClass(RadioGroup,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(this.props.isControlled&&this.state.value!==nextProps.value){this.setState({value:nextProps.value});}}/**
3
+ */var RadioGroup=/*#__PURE__*/function(_Component){function RadioGroup(props){var _this2;_classCallCheck(this,RadioGroup);_this2=_callSuper(this,RadioGroup,[props]);/**
6
4
  * @param {string} event click from radio element
7
- */},{key:"render",/**
5
+ */_defineProperty(_this2,"handleChange",function(_ref){var name=_ref.target.name;if(_this2.props.disabled){return;}if(!_this2.props.isControlled){_this2.setState({value:name});}_this2.props.onChange(name);});_this2.state={value:props.value};return _this2;}/**
6
+ * @param {Object} nextProps props
7
+ */_inherits(RadioGroup,_Component);return _createClass(RadioGroup,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(this.props.isControlled&&this.state.value!==nextProps.value){this.setState({value:nextProps.value});}}},{key:"render",value:/**
8
8
  * Renders the component.
9
9
  * @returns {JSX}
10
- */value:function render(){var _this2=this;var _this$props=this.props,children=_this$props.children,className=_this$props.className,label=_this$props.label,errorText=_this$props.errorText,direction=_this$props.direction,name=_this$props.name,translateErrorText=_this$props.translateErrorText,disabled=_this$props.disabled,showErrorText=_this$props.showErrorText;return React.createElement(FormElement,{className:classNames(className,'radioGroup',{disabled:disabled}),label:label,labelStatic:true,errorText:errorText,translateErrorText:translateErrorText,showErrorText:showErrorText,htmlFor:"none",hasUnderline:false,hasValue:true},React.createElement("div",{className:classNames(style.container(direction),'radioGroup')},Children.map(children,function(child){if(!child){return null;}return cloneElement(child,{key:"".concat(name,"_").concat(child.props.name),checked:_this2.state.value===child.props.name,onChange:_this2.handleChange});})));}}]);return RadioGroup;}(Component);_defineProperty(RadioGroup,"defaultProps",{onChange:function onChange(){},children:null,className:'',direction:'column',disabled:false,errorText:'',isControlled:false,label:'',translateErrorText:true,value:null,showErrorText:true/**
10
+ */function render(){var _this3=this;var _this$props=this.props,children=_this$props.children,className=_this$props.className,label=_this$props.label,errorText=_this$props.errorText,direction=_this$props.direction,name=_this$props.name,translateErrorText=_this$props.translateErrorText,disabled=_this$props.disabled,showErrorText=_this$props.showErrorText;return React.createElement(FormElement,{className:classNames(className,'radioGroup','ui-shared__form__radio-group',{disabled:disabled}),label:label,labelStatic:true,errorText:errorText,translateErrorText:translateErrorText,showErrorText:showErrorText,htmlFor:"none",hasUnderline:false,hasValue:true},React.createElement("div",{className:classNames(style.container(direction),'radioGroup')},Children.map(children,function(child){if(!child){return null;}return cloneElement(child,{key:"".concat(name,"_").concat(child.props.name),checked:_this3.state.value===child.props.name,onChange:_this3.handleChange});})));}}]);}(Component);_defineProperty(RadioGroup,"defaultProps",{onChange:function onChange(){},children:null,className:'',direction:'column',disabled:false,errorText:'',isControlled:false,label:'',translateErrorText:true,value:null,showErrorText:true/**
11
11
  * Initializes the component.
12
12
  * @param {Object} props The components props.
13
13
  */});export default hot(RadioGroup);
@@ -1,16 +1,18 @@
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 classNames from'classnames';import Chevron from"../../icons/ChevronIcon";import FormElement from"../../FormElement";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 Chevron from"../../icons/ChevronIcon";import FormElement from"../../FormElement";import styles from"./style";/**
2
2
  * A component that provides a styled select for user input in material design.
3
- */var Select=/*#__PURE__*/function(_Component){_inherits(Select,_Component);/**
3
+ */var Select=/*#__PURE__*/function(_Component){/**
4
4
  * Creates a new text field component.
5
5
  * @param {Object} props The component properties.
6
- */function Select(props){var _this;_classCallCheck(this,Select);_this=_possibleConstructorReturn(this,_getPrototypeOf(Select).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleChange",function(_ref){var target=_ref.target;var multiple=_this.props.multiple;var value=target.value;if(multiple){value=Array.from(target.selectedOptions,function(option){return option.value;});}if(!_this.props.isControlled){_this.setState({value:value});}_this.props.onChange(value);});_defineProperty(_assertThisInitialized(_this),"handleFocusChange",function(isFocused){_this.setState({isFocused:isFocused});});_this.state={value:props.value,isFocused:false};return _this;}/**
6
+ */function Select(props){var _this2;_classCallCheck(this,Select);_this2=_callSuper(this,Select,[props]);/**
7
+ * @param {string} value The entered text.
8
+ */_defineProperty(_this2,"handleChange",function(_ref){var target=_ref.target;var multiple=_this2.props.multiple;var value=target.value;if(multiple){value=Array.from(target.selectedOptions,function(option){return option.value;});}if(!_this2.props.isControlled){_this2.setState({value:value});}_this2.props.onChange(value);});/**
9
+ * @param {boolean} isFocused focused
10
+ */_defineProperty(_this2,"handleFocusChange",function(isFocused){_this2.setState({isFocused:isFocused});});_this2.state={value:props.value,isFocused:false};return _this2;}/**
7
11
  * Corrects the selected value to the first option when the initial value is not located within
8
12
  * the options.
9
- */_createClass(Select,[{key:"componentDidMount",value:function componentDidMount(){var _this$props=this.props,multiple=_this$props.multiple,options=_this$props.options;var value=this.state.value;if(!multiple&&(options===null||options===void 0?void 0:options[value])===undefined){var _Object$entries,_Object$entries$;var fallback=(_Object$entries=Object.entries(options))===null||_Object$entries===void 0?void 0:(_Object$entries$=_Object$entries[0])===null||_Object$entries$===void 0?void 0:_Object$entries$[0];if(fallback!==undefined){this.handleChange({target:{value:fallback}});}}}/**
13
+ */_inherits(Select,_Component);return _createClass(Select,[{key:"componentDidMount",value:function componentDidMount(){var _this$props=this.props,multiple=_this$props.multiple,options=_this$props.options;var value=this.state.value;if(!multiple&&(options===null||options===void 0?void 0:options[value])===undefined){var _Object$entries,_Object$entries$;var fallback=(_Object$entries=Object.entries(options))===null||_Object$entries===void 0?void 0:(_Object$entries$=_Object$entries[0])===null||_Object$entries$===void 0?void 0:_Object$entries$[0];if(fallback!==undefined){this.handleChange({target:{value:fallback}});}}}/**
10
14
  * Update state with new props.
11
15
  * @param {Object} nextProps The new props.
12
- */},{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){this.setState({value:nextProps.value});}/**
13
- * @param {string} value The entered text.
14
- */},{key:"render",/**
16
+ */},{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){this.setState({value:nextProps.value});}},{key:"render",value:/**
15
17
  * @return {JSX}
16
- */value:function render(){var _this2=this;var _this$props2=this.props,name=_this$props2.name,options=_this$props2.options,translateErrorText=_this$props2.translateErrorText,disabled=_this$props2.disabled,multiple=_this$props2.multiple,size=_this$props2.size,showErrorText=_this$props2.showErrorText;return React.createElement(FormElement,{className:this.props.className,placeholder:this.props.placeholder,htmlFor:name,label:this.props.label,errorText:this.props.errorText,translateErrorText:translateErrorText,isFocused:this.state.isFocused,hasValue:!!this.state.value||!!options[''],hasPlaceholder:!disabled||this.state.value!=='',disabled:disabled,showErrorText:showErrorText},React.createElement("select",_extends({id:this.props.name,name:this.props.name,onChange:this.handleChange,onFocus:function onFocus(){return _this2.handleFocusChange(true);},onBlur:function onBlur(){return _this2.handleFocusChange(false);},value:this.state.value,className:classNames(styles.select,'select'),disabled:disabled},multiple&&{multiple:multiple,size:size}),Object.keys(options).map(function(key){return React.createElement("option",{className:"option",value:key,key:"".concat(name,"_").concat(key)},options[key]);})),React.createElement(Chevron,{className:styles.chevron}));}}]);return Select;}(Component);_defineProperty(Select,"defaultProps",{className:'',errorText:'',isControlled:false,placeholder:'',label:'',onChange:function onChange(){},options:{},translateErrorText:true,showErrorText:true,size:null,value:'',disabled:false,multiple:false});export default Select;
18
+ */function render(){var _this3=this;var _this$props2=this.props,name=_this$props2.name,options=_this$props2.options,translateErrorText=_this$props2.translateErrorText,disabled=_this$props2.disabled,multiple=_this$props2.multiple,size=_this$props2.size,showErrorText=_this$props2.showErrorText;return React.createElement(FormElement,{className:"".concat(this.props.className," ui-shared__form__select"),placeholder:this.props.placeholder,htmlFor:name,label:this.props.label,errorText:this.props.errorText,translateErrorText:translateErrorText,isFocused:this.state.isFocused,hasValue:!!this.state.value||!!options[''],hasPlaceholder:!disabled||this.state.value!=='',disabled:disabled,showErrorText:showErrorText},React.createElement("select",_extends({id:this.props.name,name:this.props.name,onChange:this.handleChange,onFocus:function onFocus(){return _this3.handleFocusChange(true);},onBlur:function onBlur(){return _this3.handleFocusChange(false);},value:this.state.value,className:classNames(styles.select,'select'),disabled:disabled},multiple&&{multiple:multiple,size:size}),Object.keys(options).map(function(key){return React.createElement("option",{className:"option",value:key,key:"".concat(name,"_").concat(key)},options[key]);})),React.createElement(Chevron,{className:styles.chevron}));}}]);}(Component);_defineProperty(Select,"defaultProps",{className:'',errorText:'',isControlled:false,placeholder:'',label:'',onChange:function onChange(){},options:{},translateErrorText:true,showErrorText:true,size:null,value:'',disabled:false,multiple:false});export default Select;
@@ -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 _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 Input from'@shopgate/pwa-common/components/Input';import Grid from'@shopgate/pwa-common/components/Grid';import FormElement from'@shopgate/pwa-ui-shared/FormElement';import style from"./style";/**
1
+ var _excluded=["className","placeholder","label","errorText","leftElement","rightElement","hasUnderline"];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 Input from'@shopgate/pwa-common/components/Input';import Grid from'@shopgate/pwa-common/components/Grid';import FormElement from'@shopgate/pwa-ui-shared/FormElement';import style from"./style";/**
2
2
  * No operational
3
3
  */var noop=function noop(){};/**
4
4
  * TextField component
5
- */var TextField=/*#__PURE__*/function(_Component){_inherits(TextField,_Component);/**
5
+ */var TextField=/*#__PURE__*/function(_Component){/**
6
6
  * Creates a new text field component.
7
7
  * @param {Object} props The component properties.
8
- */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);});_this.state={isFocused:false};return _this;}/**
8
+ */function TextField(props){var _this2;_classCallCheck(this,TextField);_this2=_callSuper(this,TextField,[props]);/**
9
9
  * Internal focus event handler.
10
10
  * @param {boolean} isFocused Whether the input component is focused.
11
- */_createClass(TextField,[{key:"render",/**
11
+ */_defineProperty(_this2,"handleFocusChange",function(isFocused){_this2.setState({isFocused:isFocused});_this2.props.onFocusChange(isFocused);});_this2.state={isFocused:false};return _this2;}_inherits(TextField,_Component);return _createClass(TextField,[{key:"render",value:/**
12
12
  * Renders the text field.
13
13
  * @return {JSX}
14
- */value:function render(){var _this$props=this.props,className=_this$props.className,placeholder=_this$props.placeholder,label=_this$props.label,errorText=_this$props.errorText,leftElement=_this$props.leftElement,rightElement=_this$props.rightElement,hasUnderline=_this$props.hasUnderline,props=_objectWithoutProperties(_this$props,["className","placeholder","label","errorText","leftElement","rightElement","hasUnderline"]);return React.createElement(FormElement,{className:className,htmlFor:props.name,placeholder:placeholder,label:label,errorText:errorText,hasUnderline:hasUnderline,hasValue:!!props.value,isFocused:this.state.isFocused},React.createElement(Grid,null,leftElement&&React.createElement(Grid.Item,{grow:0,className:style.element},leftElement),React.createElement(Grid.Item,{grow:1,className:style.container},React.createElement(Input,_extends({},props,{onFocusChange:this.handleFocusChange,className:style[props.multiLine?'multiLine':'input'],validateOnBlur:true}))),rightElement&&React.createElement(Grid.Item,{grow:0,className:style.element},rightElement)));}}]);return TextField;}(Component);_defineProperty(TextField,"defaultProps",{attributes:null,className:'',errorText:'',hasUnderline:true,label:'',leftElement:null,onChange:noop,onFocusChange:noop,placeholder:'',multiLine:false,rightElement:null,value:'',type:'text'});export default TextField;
14
+ */function render(){var _this$props=this.props,className=_this$props.className,placeholder=_this$props.placeholder,label=_this$props.label,errorText=_this$props.errorText,leftElement=_this$props.leftElement,rightElement=_this$props.rightElement,hasUnderline=_this$props.hasUnderline,props=_objectWithoutProperties(_this$props,_excluded);return React.createElement(FormElement,{className:"".concat(className," ui-shared__form__text-field"),htmlFor:props.name,placeholder:placeholder,label:label,errorText:errorText,hasUnderline:hasUnderline,hasValue:!!props.value,isFocused:this.state.isFocused},React.createElement(Grid,null,leftElement&&React.createElement(Grid.Item,{grow:0,className:style.element},leftElement),React.createElement(Grid.Item,{grow:1,className:style.container},React.createElement(Input,_extends({},props,{onFocusChange:this.handleFocusChange,className:style[props.multiLine?'multiLine':'input'],validateOnBlur:true}))),rightElement&&React.createElement(Grid.Item,{grow:0,className:style.element},rightElement)));}}]);}(Component);_defineProperty(TextField,"defaultProps",{attributes:null,className:'',errorText:'',hasUnderline:true,label:'',leftElement:null,onChange:noop,onFocusChange:noop,placeholder:'',multiLine:false,rightElement:null,value:'',type:'text',maxLength:''});export default TextField;
package/Form/index.js CHANGED
@@ -1,14 +1,17 @@
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,{PureComponent}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,{PureComponent}from'react';import PropTypes from'prop-types';/**
2
2
  * Form component that handles keyboard submit, next buttons, ...
3
3
  * @deprecated Use `@shopgate/engage/components/Form` instead.
4
- */var Form=/*#__PURE__*/function(_PureComponent){_inherits(Form,_PureComponent);function Form(props){var _this;_classCallCheck(this,Form);_this=_possibleConstructorReturn(this,_getPrototypeOf(Form).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleSubmit",function(event){event.preventDefault();var inputFocused=[].concat(_this.formElement.current.querySelectorAll('input')).some(function(input){return document.activeElement===input;});if(inputFocused){document.activeElement.blur();}_this.props.onSubmit();});_defineProperty(_assertThisInitialized(_this),"handleKeyPress",function(event){// Enter key and on iOS also the "Done" button.
5
- if(event.which===13){_this.handleSubmit(event);}});_this.formElement=React.createRef();return _this;}/**
4
+ */var Form=/*#__PURE__*/function(_PureComponent){function Form(props){var _this2;_classCallCheck(this,Form);_this2=_callSuper(this,Form,[props]);/**
6
5
  * Handles the form submit.
7
6
  * @param {Object} event The event that caused the submit.
8
- */_createClass(Form,[{key:"render",/**
7
+ */_defineProperty(_this2,"handleSubmit",function(event){event.preventDefault();var inputFocused=[].concat(_this2.formElement.current.querySelectorAll('input')).some(function(input){return document.activeElement===input;});if(inputFocused){document.activeElement.blur();}_this2.props.onSubmit();});/**
8
+ * Handles form submits by key.
9
+ * @param {Object} event The event that caused the keypress.
10
+ */_defineProperty(_this2,"handleKeyPress",function(event){// Enter key and on iOS also the "Done" button.
11
+ if(event.which===13){_this2.handleSubmit(event);}});_this2.formElement=React.createRef();return _this2;}_inherits(Form,_PureComponent);return _createClass(Form,[{key:"render",value:/**
9
12
  * Renders the component.
10
13
  * @returns {JSX}
11
- */value:function render(){/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */return React.createElement("form",{action:"#",onSubmit:this.handleSubmit,onKeyPress:this.handleKeyPress,ref:this.formElement},this.props.children);/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */}}]);return Form;}(PureComponent);_defineProperty(Form,"defaultProps",{onSubmit:function onSubmit(){}/**
14
+ */function render(){/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */return React.createElement("form",{action:"#",onSubmit:this.handleSubmit,onKeyPress:this.handleKeyPress,ref:this.formElement,className:"ui-shared__form"},this.props.children);/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */}}]);}(PureComponent);_defineProperty(Form,"defaultProps",{onSubmit:function onSubmit(){}/**
12
15
  * Initializes the form component.
13
16
  * @param {Object} props The components props.
14
17
  */});export default Form;
@@ -18,4 +18,4 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
18
18
  * @param {boolean} error Whether the input field shows an error message.
19
19
  * @param {boolean} isStatic Whether the label is static.
20
20
  * @return {string} The style classes.
21
- */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;var isStatic=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;return classNames((_classNames={},_defineProperty(_classNames,label,!isStatic),_defineProperty(_classNames,labelStatic,isStatic),_defineProperty(_classNames,labelFloating,floating),_defineProperty(_classNames,labelRegular,!focused),_defineProperty(_classNames,labelFocus,!error&&focused),_defineProperty(_classNames,labelError,error&&focused),_classNames));};export default{labelStyles:labelStyles};
21
+ */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;var isStatic=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;return classNames(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},label,!isStatic),labelStatic,isStatic),labelFloating,floating),labelRegular,!focused),labelFocus,!error&&focused),labelError,error&&focused));};export default{labelStyles:labelStyles};
@@ -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 _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 Label from"./components/Label";import Underline from"./components/Underline";import ErrorText from"./components/ErrorText";import Placeholder from"./components/Placeholder";import style 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}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 Placeholder from"./components/Placeholder";import style from"./style";/**
2
2
  * A component that provides a styled form element in material design.
3
- */var FormElement=/*#__PURE__*/function(_Component){_inherits(FormElement,_Component);function FormElement(){_classCallCheck(this,FormElement);return _possibleConstructorReturn(this,_getPrototypeOf(FormElement).apply(this,arguments));}_createClass(FormElement,[{key:"render",/**
4
- * @return {JSX}
5
- */value:function render(){var _this$props=this.props,isFocused=_this$props.isFocused,errorText=_this$props.errorText,translateErrorText=_this$props.translateErrorText,placeholder=_this$props.placeholder,hasPlaceholder=_this$props.hasPlaceholder,htmlFor=_this$props.htmlFor,label=_this$props.label,className=_this$props.className,disabled=_this$props.disabled,labelStatic=_this$props.labelStatic,showErrorText=_this$props.showErrorText;return React.createElement("div",{className:classNames(style.formElement,className,'formElement',{disabled:disabled})},hasPlaceholder&&(placeholder||label)&&React.createElement(Placeholder,{visible:this.isPlaceholderVisible,placeholder:placeholder||label,"aria-hidden":true}),label&&React.createElement(Label,{htmlFor:htmlFor,label:label,labelStatic:labelStatic,isFocused:isFocused,isFloating:this.isLabelFloating,hasErrorMessage:this.hasErrorMessage}),this.props.children,this.props.hasUnderline&&React.createElement(Underline,{isFocused:isFocused,hasErrorMessage:this.hasErrorMessage}),errorText&&showErrorText&&React.createElement(ErrorText,{errorText:errorText,translate:translateErrorText}));}},{key:"isLabelFloating",/**
3
+ */var FormElement=/*#__PURE__*/function(_Component){function FormElement(){_classCallCheck(this,FormElement);return _callSuper(this,FormElement,arguments);}_inherits(FormElement,_Component);return _createClass(FormElement,[{key:"isLabelFloating",get:/**
6
4
  * @returns {boolean} Whether the label is currently floating.
7
- */get:function get(){return!this.props.labelStatic&&(this.props.isFocused||this.props.hasValue);}/**
5
+ */function get(){return!this.props.labelStatic&&(this.props.isFocused||this.props.hasValue);}/**
8
6
  * @returns {boolean} Whether the hint text is currently visible.
9
7
  */},{key:"isPlaceholderVisible",get:function get(){return!this.props.isFocused&&!this.props.hasValue;}/**
10
8
  * @returns {boolean} Whether the hint text is currently visible.
11
- */},{key:"hasErrorMessage",get:function get(){return!!this.props.errorText;}}]);return FormElement;}(Component);_defineProperty(FormElement,"defaultProps",{children:null,className:'',errorText:'',placeholder:'',htmlFor:'',label:'',labelStatic:false,isFocused:false,hasValue:false,hasPlaceholder:true,hasUnderline:true,translateErrorText:true,disabled:false,showErrorText:true});export default FormElement;
9
+ */},{key:"hasErrorMessage",get:function get(){return!!this.props.errorText;}/**
10
+ * @return {JSX}
11
+ */},{key:"render",value:function render(){var _this$props=this.props,isFocused=_this$props.isFocused,errorText=_this$props.errorText,translateErrorText=_this$props.translateErrorText,placeholder=_this$props.placeholder,hasPlaceholder=_this$props.hasPlaceholder,htmlFor=_this$props.htmlFor,label=_this$props.label,className=_this$props.className,disabled=_this$props.disabled,labelStatic=_this$props.labelStatic,showErrorText=_this$props.showErrorText;return React.createElement("div",{className:classNames(style.formElement,className,'formElement','ui-shared__form-element',{disabled:disabled})},hasPlaceholder&&(placeholder||label)&&React.createElement(Placeholder,{visible:this.isPlaceholderVisible,placeholder:placeholder||label,"aria-hidden":true}),label&&React.createElement(Label,{htmlFor:htmlFor,label:label,labelStatic:labelStatic,isFocused:isFocused,isFloating:this.isLabelFloating,hasErrorMessage:this.hasErrorMessage}),this.props.children,this.props.hasUnderline&&React.createElement(Underline,{isFocused:isFocused,hasErrorMessage:this.hasErrorMessage}),errorText&&showErrorText&&React.createElement(ErrorText,{errorText:errorText,translate:translateErrorText}));}}]);}(Component);_defineProperty(FormElement,"defaultProps",{children:null,className:'',errorText:'',placeholder:'',htmlFor:'',label:'',labelStatic:false,isFocused:false,hasValue:false,hasPlaceholder:true,hasUnderline:true,translateErrorText:true,disabled:false,showErrorText:true});export default FormElement;
package/Glow/index.js CHANGED
@@ -1,13 +1,13 @@
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 classNames from'classnames';import{withForwardedRef}from'@shopgate/engage/core';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import styles from"./style";/**
1
+ var _excluded=["children","styles","forwardedRef","className","color"];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 classNames from'classnames';import{withForwardedRef}from'@shopgate/engage/core';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import styles from"./style";/**
2
2
  * Renders a glowing component that is visible when the user interacts with the element.
3
- */var Glow=/*#__PURE__*/function(_Component){_inherits(Glow,_Component);/**
3
+ */var Glow=/*#__PURE__*/function(_Component){/**
4
4
  * The component constructor.
5
5
  * @param {Object} props The component props.
6
- */function Glow(props){var _this;_classCallCheck(this,Glow);_this=_possibleConstructorReturn(this,_getPrototypeOf(Glow).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleTouchTap",function(){if(_this.props.disabled){return;}_this.setState({hover:true});_this.timeout=setTimeout(function(){_this.setState({hover:false});},250);});_this.timeout=null;_this.state={hover:false};return _this;}/**
6
+ */function Glow(props){var _this2;_classCallCheck(this,Glow);_this2=_callSuper(this,Glow,[props]);_defineProperty(_this2,"handleTouchTap",function(){if(_this2.props.disabled){return;}_this2.setState({hover:true});_this2.timeout=setTimeout(function(){_this2.setState({hover:false});},250);});_this2.timeout=null;_this2.state={hover:false};return _this2;}/**
7
7
  * Clears any previously set timeout.
8
- */_createClass(Glow,[{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this.timeout);}},{key:"render",/**
8
+ */_inherits(Glow,_Component);return _createClass(Glow,[{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this.timeout);}},{key:"render",value:/**
9
9
  * Renders the component.
10
10
  * @returns {JSX}
11
- */value:function render(){var _this$props=this.props,children=_this$props.children,propStyles=_this$props.styles,forwardedRef=_this$props.forwardedRef,className=_this$props.className,color=_this$props.color,rest=_objectWithoutProperties(_this$props,["children","styles","forwardedRef","className","color"]);var innerInlineStyles;if(this.state.hover){innerInlineStyles=_extends({},propStyles.glow,{},propStyles.hover,{background:color});}else{innerInlineStyles=_extends({},propStyles.glow);}/* eslint-disable jsx-a11y/no-static-element-interactions,
12
- jsx-a11y/click-events-have-key-events */return React.createElement("div",_extends({},rest,{className:classNames(styles.container,className),onClick:this.handleTouchTap,style:propStyles.container,ref:forwardedRef}),React.createElement("div",{className:styles.glow,style:innerInlineStyles}),children);/* eslint-enable jsx-a11y/no-static-element-interactions,
13
- jsx-a11y/click-events-have-key-events */}}]);return Glow;}(Component);_defineProperty(Glow,"defaultProps",{color:themeConfig.colors.shade8,className:null,forwardedRef:null,disabled:false,styles:{container:null,glow:null,hover:null}});export default withForwardedRef(Glow);
11
+ */function render(){var _this$props=this.props,children=_this$props.children,propStyles=_this$props.styles,forwardedRef=_this$props.forwardedRef,className=_this$props.className,color=_this$props.color,rest=_objectWithoutProperties(_this$props,_excluded);var innerInlineStyles;if(this.state.hover){innerInlineStyles=_extends({},propStyles.glow,{},propStyles.hover,{background:color});}else{innerInlineStyles=_extends({},propStyles.glow);}/* eslint-disable jsx-a11y/no-static-element-interactions,
12
+ jsx-a11y/click-events-have-key-events */return React.createElement("div",_extends({},rest,{className:classNames(styles.container,className,'ui-shared__glow'),onClick:this.handleTouchTap,style:propStyles.container,ref:forwardedRef}),React.createElement("div",{className:styles.glow,style:innerInlineStyles}),children);/* eslint-enable jsx-a11y/no-static-element-interactions,
13
+ jsx-a11y/click-events-have-key-events */}}]);}(Component);_defineProperty(Glow,"defaultProps",{color:themeConfig.colors.shade8,className:null,forwardedRef:null,disabled:false,styles:{container:null,glow:null,hover:null}});export default withForwardedRef(Glow);