@shopgate/engage 7.12.0-beta.4 → 7.12.0-beta.6
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.
|
@@ -2,7 +2,7 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
2
2
|
* The ViewContent component.
|
|
3
3
|
*/var ViewContent=/*#__PURE__*/function(_Component){_inherits(ViewContent,_Component);/**
|
|
4
4
|
* @param {Object} props The component props.
|
|
5
|
-
*/function ViewContent(props){var _this;_classCallCheck(this,ViewContent);_this=_possibleConstructorReturn(this,_getPrototypeOf(ViewContent).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleKeyboardChange",function(_ref){var open=_ref.open,overlap=_ref.overlap;var height=open?overlap:0;if(_this.props.visible&&height!==_this.state.keyboardHeight){_this.setState({keyboardHeight:height});}});_defineProperty(_assertThisInitialized(_this),"handleSwipe",function(e,x,y,isFlick,velocity){var swipeEvent=new CustomEvent('swipe',{detail:{event:e,x:x,y:y,isFlick:isFlick,velocity:velocity}});_this.ref.current.dispatchEvent(swipeEvent);});_this.ref=React.createRef();_this.state={keyboardHeight:0};_this.scrollContainer=useScrollContainer();if(!_this.scrollContainer){_this.ref.current=window;}_this.props.setContentRef(_this.ref);event.addCallback(EVENT_KEYBOARD_WILL_CHANGE,_this.handleKeyboardChange);return _this;}/**
|
|
5
|
+
*/function ViewContent(props){var _this;_classCallCheck(this,ViewContent);_this=_possibleConstructorReturn(this,_getPrototypeOf(ViewContent).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleKeyboardChange",function(_ref){var open=_ref.open,overlap=_ref.overlap;if(_this.props.noKeyboardListener){return;}var height=open?overlap:0;if(_this.props.visible&&height!==_this.state.keyboardHeight){_this.setState({keyboardHeight:height});}});_defineProperty(_assertThisInitialized(_this),"handleSwipe",function(e,x,y,isFlick,velocity){var swipeEvent=new CustomEvent('swipe',{detail:{event:e,x:x,y:y,isFlick:isFlick,velocity:velocity}});_this.ref.current.dispatchEvent(swipeEvent);});_this.ref=React.createRef();_this.state={keyboardHeight:0};_this.scrollContainer=useScrollContainer();if(!_this.scrollContainer){_this.ref.current=window;}_this.props.setContentRef(_this.ref);event.addCallback(EVENT_KEYBOARD_WILL_CHANGE,_this.handleKeyboardChange);return _this;}/**
|
|
6
6
|
* @param {Object} props The component props.
|
|
7
7
|
* @param {Object} state The component state.
|
|
8
8
|
* @returns {Object}
|
|
@@ -18,4 +18,4 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
18
18
|
* Handles a keyboard change event.
|
|
19
19
|
* @param {boolean} open If the keyboard is now open.
|
|
20
20
|
* @param {boolean} overlap The height of the keyboard.
|
|
21
|
-
*/}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(props,state){if(props.visible||state.keyboardHeight===0){return null;}return{keyboardHeight:0};}}]);return ViewContent;}(Component);_defineProperty(ViewContent,"contextType",RouteContext);_defineProperty(ViewContent,"defaultProps",{children:null,noScrollOnKeyboard:false,noContentPortal:false});export default(function(props){return React.createElement(RouteContext.Consumer,null,function(_ref2){var visible=_ref2.visible;return React.createElement(ViewContent,_extends({},props,{visible:visible}));});});
|
|
21
|
+
*/}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(props,state){if(props.visible||state.keyboardHeight===0){return null;}return{keyboardHeight:0};}}]);return ViewContent;}(Component);_defineProperty(ViewContent,"contextType",RouteContext);_defineProperty(ViewContent,"defaultProps",{children:null,noScrollOnKeyboard:false,noContentPortal:false,noKeyboardListener:false});export default(function(props){return React.createElement(RouteContext.Consumer,null,function(_ref2){var visible=_ref2.visible;return React.createElement(ViewContent,_extends({},props,{visible:visible}));});});
|
package/components/View/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export{ViewContext};/**
|
|
|
3
3
|
* The View container component.
|
|
4
4
|
* @param {Object} props The component props.
|
|
5
5
|
* @return {JSX}
|
|
6
|
-
*/function ViewContainer(_ref){var background=_ref.background,children=_ref.children,noScrollOnKeyboard=_ref.noScrollOnKeyboard,visible=_ref.visible,ariaHidden=_ref['aria-hidden'],noContentPortal=_ref.noContentPortal;if(visible){setPageBackgroundColor(background);}var style={display:visible?'flex':'none'};return React.createElement(ViewProvider,null,React.createElement(ViewContext.Consumer,null,function(_ref2){var setContentRef=_ref2.setContentRef,ariaHiddenContext=_ref2.ariaHidden;return React.createElement("section",{className:styles,style:style,"aria-hidden":ariaHidden||ariaHiddenContext},React.createElement(Content,{noScrollOnKeyboard:noScrollOnKeyboard,setContentRef:setContentRef,noContentPortal:noContentPortal},children));}));}ViewContainer.defaultProps={'aria-hidden':false,background:colors.light,children:null,noScrollOnKeyboard:false,noContentPortal:false};/**
|
|
6
|
+
*/function ViewContainer(_ref){var background=_ref.background,children=_ref.children,noScrollOnKeyboard=_ref.noScrollOnKeyboard,visible=_ref.visible,ariaHidden=_ref['aria-hidden'],noContentPortal=_ref.noContentPortal,noKeyboardListener=_ref.noKeyboardListener;if(visible){setPageBackgroundColor(background);}var style={display:visible?'flex':'none'};return React.createElement(ViewProvider,null,React.createElement(ViewContext.Consumer,null,function(_ref2){var setContentRef=_ref2.setContentRef,ariaHiddenContext=_ref2.ariaHidden;return React.createElement("section",{className:styles,style:style,"aria-hidden":ariaHidden||ariaHiddenContext},React.createElement(Content,{noScrollOnKeyboard:noScrollOnKeyboard,noKeyboardListener:noKeyboardListener,setContentRef:setContentRef,noContentPortal:noContentPortal},children));}));}ViewContainer.defaultProps={'aria-hidden':false,background:colors.light,children:null,noScrollOnKeyboard:false,noContentPortal:false,noKeyboardListener:false};/**
|
|
7
7
|
* @param {Object} props The component props.
|
|
8
8
|
* @returns {JSX}
|
|
9
9
|
*/export default function View(props){return React.createElement(RouteContext.Consumer,null,function(_ref3){var visible=_ref3.visible;return React.createElement(ViewContainer,_extends({},props,{visible:visible}));});}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/engage",
|
|
3
|
-
"version": "7.12.0-beta.
|
|
3
|
+
"version": "7.12.0-beta.6",
|
|
4
4
|
"description": "Shopgate's ENGAGE library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@shopgate/native-modules": "1.0.0-beta.18",
|
|
19
|
-
"@shopgate/pwa-common": "7.12.0-beta.
|
|
20
|
-
"@shopgate/pwa-common-commerce": "7.12.0-beta.
|
|
21
|
-
"@shopgate/pwa-core": "7.12.0-beta.
|
|
22
|
-
"@shopgate/pwa-ui-ios": "7.12.0-beta.
|
|
23
|
-
"@shopgate/pwa-ui-material": "7.12.0-beta.
|
|
24
|
-
"@shopgate/pwa-ui-shared": "7.12.0-beta.
|
|
19
|
+
"@shopgate/pwa-common": "7.12.0-beta.6",
|
|
20
|
+
"@shopgate/pwa-common-commerce": "7.12.0-beta.6",
|
|
21
|
+
"@shopgate/pwa-core": "7.12.0-beta.6",
|
|
22
|
+
"@shopgate/pwa-ui-ios": "7.12.0-beta.6",
|
|
23
|
+
"@shopgate/pwa-ui-material": "7.12.0-beta.6",
|
|
24
|
+
"@shopgate/pwa-ui-shared": "7.12.0-beta.6",
|
|
25
25
|
"@stripe/react-stripe-js": "^1.1.2",
|
|
26
26
|
"@stripe/stripe-js": "^1.3.1",
|
|
27
27
|
"@virtuous/conductor": "~2.5.0",
|