@shopgate/pwa-ui-material 7.20.0-beta.2 → 7.20.0-beta.4
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.
- package/SnackBar/index.js +3 -1
- package/SnackBar/style.js +4 -1
- package/package.json +2 -2
package/SnackBar/index.js
CHANGED
|
@@ -28,4 +28,6 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
|
|
|
28
28
|
* @returns {JSX}
|
|
29
29
|
*/function render(){var _this3=this;var visible=this.state.visible;var _this$snack=this.snack,_this$snack$action=_this$snack.action,action=_this$snack$action===void 0?null:_this$snack$action,_this$snack$actionLab=_this$snack.actionLabel,actionLabel=_this$snack$actionLab===void 0?null:_this$snack$actionLab,_this$snack$message=_this$snack.message,message=_this$snack$message===void 0?null:_this$snack$message;// Action exits without actionLabel. Handle the whole box
|
|
30
30
|
var boxProps=_extends({},action&&!actionLabel&&{onClick:this.handleAction});// Calculate the required amount of rows and the height of the snack bar.
|
|
31
|
-
var rows=this.calcRows(message,actionLabel);var snackBarHeight=40+rows*20;return React.createElement("div",{className:"".concat(styles.container," ui-material__snack-bar"),style:{'--snack-bar-height':"".concat(snackBarHeight,"px")}},React.createElement(Spring,{from:{top:snackBarHeight},to:{top:0},config:config.stiff,reverse:!visible,force:true,onRest:this.handleRest},function(props){return
|
|
31
|
+
var rows=this.calcRows(message,actionLabel);var snackBarHeight=40+rows*20;return React.createElement("div",{className:"".concat(styles.container," ui-material__snack-bar"),style:{'--snack-bar-height':"".concat(snackBarHeight,"px")}},React.createElement(Spring,{from:{top:snackBarHeight},to:{top:0},config:config.stiff,reverse:!visible,force:true,onRest:this.handleRest},function(props){return(// eslint-disable-next-line max-len
|
|
32
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
33
|
+
React.createElement("div",{className:styles.wrapper,style:props,"data-footer-inset-update-ignore":"true",onClick:_this3.hide},React.createElement("div",_extends({className:styles.box},boxProps),React.createElement(Ellipsis,{rows:rows},React.createElement("span",{className:styles.label,"aria-live":"assertive",role:"status"},message)),action&&actionLabel&&React.createElement("button",{className:styles.button,onClick:_this3.handleAction,type:"button","aria-hidden":true},actionLabel))));}));}}]);}(Component);_defineProperty(SnackBar,"defaultProps",{toasts:null});_defineProperty(SnackBar,"contextTypes",{i18n:PropTypes.func});export default SnackBar;
|
package/SnackBar/style.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import{css}from'glamor';import Color from'color';import{themeColors,themeShadows}from'@shopgate/pwa-common/helpers/config';var backgroundColor=themeColors.lightDark;var buttonColor=themeColors.accent;var buttonColorContrast=Color(buttonColor).contrast(Color(backgroundColor));// Button color can be anything. Fall back to white if accent is too dark.
|
|
2
|
-
var safebuttonColor=buttonColorContrast>4?buttonColor:themeColors.light;var container=css({position:'fixed',height:'var(--snack-bar-height, 80px)'
|
|
2
|
+
var safebuttonColor=buttonColorContrast>4?buttonColor:themeColors.light;var container=css({position:'fixed',height:'var(--snack-bar-height, 80px)',// Quick workaround for a feature introduced with PWA6 CCP-2358 (hide TabBar on scroll down).
|
|
3
|
+
// TabBar is position fixed now, to its height is not recognized when footer height is measured.
|
|
4
|
+
// Without the fix SnackBar would overlap the TabBar.
|
|
5
|
+
bottom:'max(var(--footer-height), var(--tabbar-height, 0px))',transition:'bottom 0.3s ease',overflow:'hidden',zIndex:6,width:'100%'});var wrapper=css({top:'var(--snack-bar-height, 80px)',display:'flex',justifyContent:'center',left:0,position:'absolute',width:'100%',zIndex:6});var box=css({alignItems:'center',background:backgroundColor,borderRadius:3,boxShadow:themeShadows.toast,color:themeColors.light,display:'flex',fontSize:'0.875rem',justifyContent:'space-between',letterSpacing:0.5,margin:16,maxWidth:344,minHeight:48,padding:'6px 16px',width:'100%'});var label=css({lineHeight:1.4,margin:'6px 0',overflow:'hidden'}).toString();var button=css({color:safebuttonColor,fontWeight:500,height:36,letterSpacing:'inherit',margin:'0 -8px 0 8px',outline:0,padding:'0 8px',textTransform:'uppercase'});export default{container:container,wrapper:wrapper,box:box,label:label,button:button};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-ui-material",
|
|
3
|
-
"version": "7.20.0-beta.
|
|
3
|
+
"version": "7.20.0-beta.4",
|
|
4
4
|
"description": "Shopgate's material design UI components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@shopgate/pwa-common": "7.20.0-beta.
|
|
8
|
+
"@shopgate/pwa-common": "7.20.0-beta.4",
|
|
9
9
|
"react": "~16.12.0",
|
|
10
10
|
"react-dom": "~16.12.0",
|
|
11
11
|
"redux": "^4.0.1"
|