@shopgate/pwa-ui-shared 7.11.1-beta.2 → 7.12.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ActionButton/index.js +1 -1
- package/Button/index.js +1 -1
- package/Button/spec.js +1 -1
- package/RatingStars/index.js +2 -2
- package/Ripple/index.js +1 -1
- package/RippleButton/index.js +1 -1
- package/RippleButton/spec.js +1 -1
- package/package.json +5 -5
package/ActionButton/index.js
CHANGED
|
@@ -3,7 +3,7 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
|
|
|
3
3
|
*/var ActionButton=/*#__PURE__*/function(_Component){_inherits(ActionButton,_Component);function ActionButton(){var _getPrototypeOf2;var _this;_classCallCheck(this,ActionButton);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(ActionButton)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"handleClick",function(event){var clickDelay=_this.constructor.clickDelay;setTimeout(function(){_this.props.onClick(event);},clickDelay);});return _this;}_createClass(ActionButton,[{key:"render",/**
|
|
4
4
|
* The render function.
|
|
5
5
|
* @returns {JSX}
|
|
6
|
-
*/value:function render(){var containerClass=this.props.noGap?styles.noGapContainer:styles.container;if(this.props.loading){return React.createElement("div",{className:styles.containerCircle},React.createElement(IndicatorCircle,null));}return React.createElement("div",{className:containerClass,"data-test-id":this.props.testId},React.createElement(RippleButton,_extends({},this.buttonProps,{onClick:this.handleClick}),this.props.children));}},{key:"buttonProps",/**
|
|
6
|
+
*/value:function render(){var containerClass=this.props.noGap?styles.noGapContainer:styles.container;if(this.props.loading){return React.createElement("div",{className:styles.containerCircle},React.createElement(IndicatorCircle,null));}return React.createElement("div",{className:"ui-shared__action-button ".concat(containerClass),"data-test-id":this.props.testId},React.createElement(RippleButton,_extends({},this.buttonProps,{onClick:this.handleClick}),this.props.children));}},{key:"buttonProps",/**
|
|
7
7
|
* Getter for the calculated button props.
|
|
8
8
|
* @returns {Object}
|
|
9
9
|
*/get:function get(){var buttonProps={className:this.props.className,disabled:this.props.disabled,flat:this.props.flat,type:this.props.type};return buttonProps;}/**
|
package/Button/index.js
CHANGED
|
@@ -5,7 +5,7 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
|
|
|
5
5
|
*/var Button=/*#__PURE__*/function(_Component){_inherits(Button,_Component);function Button(){_classCallCheck(this,Button);return _possibleConstructorReturn(this,_getPrototypeOf(Button).apply(this,arguments));}_createClass(Button,[{key:"render",/**
|
|
6
6
|
* Renders the component.
|
|
7
7
|
* @return {JSX}
|
|
8
|
-
*/value:function render(){var style=this.style;var content=this.props.wrapContent?React.createElement("div",{className:style.content},this.props.children):this.props.children;return React.createElement(BaseButton,_extends({},this.buttonProps,{className:"".concat(style.button," ").concat(this.props.className),testId:this.props.testId}),content);}},{key:"style",/**
|
|
8
|
+
*/value:function render(){var style=this.style;var content=this.props.wrapContent?React.createElement("div",{className:style.content},this.props.children):this.props.children;return React.createElement(BaseButton,_extends({},this.buttonProps,{className:"ui-shared__button ".concat(style.button," ").concat(this.props.className),testId:this.props.testId}),content);}},{key:"style",/**
|
|
9
9
|
* Getter for style depending on prop type.
|
|
10
10
|
* @returns {Object}
|
|
11
11
|
*/get:function get(){var _this$props=this.props,flat=_this$props.flat,disabled=_this$props.disabled;switch(this.props.type){case'plain':return styles.plain();case'regular':return styles.regular(disabled);default:case'primary':return styles.primary(disabled,flat);case'secondary':return styles.secondary(disabled,flat);}}/**
|
package/Button/spec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import trim from'lodash/trim';import React from'react';import{shallow}from'enzyme';import Button from"./index";import styles from"./style";describe('<Button />',function(){it('should render as a regular button if type is omitted',function(){var wrapper=shallow(React.createElement(Button,null,"Press me"));expect(wrapper).toMatchSnapshot();expect(wrapper.render().text()).toEqual('Press me');});it('should render as a regular button if type is explicitly defined',function(){var wrapper=shallow(React.createElement(Button,{type:"regular"},"Press me"));expect(wrapper).toMatchSnapshot();expect(trim(wrapper.prop('className'))).toEqual(styles.regular(false).button);});it('should render as a primary button',function(){var wrapper=shallow(React.createElement(Button,{type:"primary"},"Press me"));expect(trim(wrapper.prop('className'))).toEqual(styles.primary(false,false).button);expect(wrapper).toMatchSnapshot();});it('should render as a secondary button',function(){var wrapper=shallow(React.createElement(Button,{type:"secondary"},"Press me"));expect(trim(wrapper.prop('className'))).toEqual(styles.secondary(false,false).button);expect(wrapper).toMatchSnapshot();});});
|
|
1
|
+
import trim from'lodash/trim';import React from'react';import{shallow}from'enzyme';import Button from"./index";import styles from"./style";describe('<Button />',function(){it('should render as a regular button if type is omitted',function(){var wrapper=shallow(React.createElement(Button,null,"Press me"));expect(wrapper).toMatchSnapshot();expect(wrapper.render().text()).toEqual('Press me');});it('should render as a regular button if type is explicitly defined',function(){var wrapper=shallow(React.createElement(Button,{type:"regular"},"Press me"));expect(wrapper).toMatchSnapshot();expect(trim(wrapper.prop('className'))).toEqual("ui-shared__button ".concat(styles.regular(false).button));});it('should render as a primary button',function(){var wrapper=shallow(React.createElement(Button,{type:"primary"},"Press me"));expect(trim(wrapper.prop('className'))).toEqual("ui-shared__button ".concat(styles.primary(false,false).button));expect(wrapper).toMatchSnapshot();});it('should render as a secondary button',function(){var wrapper=shallow(React.createElement(Button,{type:"secondary"},"Press me"));expect(trim(wrapper.prop('className'))).toEqual("ui-shared__button ".concat(styles.secondary(false,false).button));expect(wrapper).toMatchSnapshot();});});
|
package/RatingStars/index.js
CHANGED
|
@@ -26,5 +26,5 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
|
|
|
26
26
|
*/},{key:"handleSelection",value:function handleSelection(e,pos){var onSelection=this.props.onSelection;e.target.value=pos*RATING_SCALE_DIVISOR;onSelection(e);}/**
|
|
27
27
|
* Renders the component.
|
|
28
28
|
* @returns {JSX}
|
|
29
|
-
*/},{key:"render",value:function render(){var _this=this;var _this$props=this.props,value=_this$props.value,isSelectable=_this$props.isSelectable;var ratedStars=value/RATING_SCALE_DIVISOR;var numFullStars=Math.floor(ratedStars);var numHalfStars=Math.ceil(ratedStars-numFullStars);var size=styles.iconStyles[this.props.display].iconSize;var className=[styles.container,this.props.className].join(' ');var iconClassName=[styles.iconStyles[this.props.display].iconStyle,styles.icon].join(' ');var emptyStars=[].concat(times(numStars,function(i){var pos=i+1;var starProps=_extends({className:iconClassName,key:pos},isSelectable&&{'aria-label':_this.getTextualCTA(pos),role:'button',onClick:function onClick(e){return _this.handleSelection(e,pos);}});return React.createElement("div",starProps,React.createElement(StarIcon,{size:size}));}));var filledStars=[].concat(times(numFullStars,function(i){var pos=i+1;var starProps=_extends({className:iconClassName,key:numStars+pos},isSelectable&&{'aria-hidden':true,// Aria hidden since it's basically a duplicate for a screen reader.
|
|
30
|
-
role:'button',onClick:function onClick(e){return _this.handleSelection(e,pos);}});return React.createElement("div",starProps,React.createElement(StarIcon,{size:size}));}),times(numHalfStars,function(i){return React.createElement("div",{className:iconClassName,key:i+numFullStars},React.createElement(StarHalfIcon,{size:size}));}));/* eslint-disable jsx-a11y/aria-role */return React.createElement("div",{role:"text",className:className,"aria-label":this.getTextualFinal(ratedStars),"data-test-id":"ratedStars: ".concat(ratedStars)},React.createElement("div",{className:styles.emptyStars},emptyStars),React.createElement("div",{className:styles.filledStars},filledStars));/* eslint-enable jsx-a11y/aria-role */}}]);return RatingStars;}(Component);_defineProperty(RatingStars,"contextTypes",{i18n:PropTypes.func});_defineProperty(RatingStars,"defaultProps",{className:'',display:'small',isSelectable:false,onSelection:function onSelection(){}});export default RatingStars;
|
|
29
|
+
*/},{key:"render",value:function render(){var _this=this;var _this$props=this.props,value=_this$props.value,isSelectable=_this$props.isSelectable;var ratedStars=value/RATING_SCALE_DIVISOR;var numFullStars=Math.floor(ratedStars);var numHalfStars=Math.ceil(ratedStars-numFullStars);var size=styles.iconStyles[this.props.display].iconSize;var className=[styles.container,this.props.className,'ui-shared__rating-stars'].join(' ');var iconClassName=[styles.iconStyles[this.props.display].iconStyle,styles.icon].join(' ');var emptyStars=[].concat(times(numStars,function(i){var pos=i+1;var starProps=_extends({className:iconClassName,key:pos},isSelectable&&{'aria-label':_this.getTextualCTA(pos),role:'button',onClick:function onClick(e){return _this.handleSelection(e,pos);}});return React.createElement("div",starProps,React.createElement(StarIcon,{size:size}));}));var filledStars=[].concat(times(numFullStars,function(i){var pos=i+1;var starProps=_extends({className:iconClassName,key:numStars+pos},isSelectable&&{'aria-hidden':true,// Aria hidden since it's basically a duplicate for a screen reader.
|
|
30
|
+
role:'button',onClick:function onClick(e){return _this.handleSelection(e,pos);}});return React.createElement("div",starProps,React.createElement(StarIcon,{size:size}));}),times(numHalfStars,function(i){return React.createElement("div",{className:iconClassName,key:i+numFullStars},React.createElement(StarHalfIcon,{size:size}));}));/* eslint-disable jsx-a11y/aria-role */return React.createElement("div",{role:"text",className:className,"aria-label":this.getTextualFinal(ratedStars),"data-test-id":"ratedStars: ".concat(ratedStars)},React.createElement("div",{className:"".concat(styles.emptyStars," rating-stars-empty")},emptyStars),React.createElement("div",{className:"".concat(styles.filledStars," rating-stars-filled")},filledStars));/* eslint-enable jsx-a11y/aria-role */}}]);return RatingStars;}(Component);_defineProperty(RatingStars,"contextTypes",{i18n:PropTypes.func});_defineProperty(RatingStars,"defaultProps",{className:'',display:'small',isSelectable:false,onSelection:function onSelection(){}});export default RatingStars;
|
package/Ripple/index.js
CHANGED
|
@@ -48,7 +48,7 @@ if(!this.state.hasRipples){return null;}return React.createElement("div",{classN
|
|
|
48
48
|
* Renders the final ripple component including it's contents.
|
|
49
49
|
* @returns {JSX}
|
|
50
50
|
*/},{key:"render",value:function render(){/* eslint-disable jsx-a11y/click-events-have-key-events,
|
|
51
|
-
jsx-a11y/no-static-element-interactions */return React.createElement("div",{className:this.props.className,"data-test-id":"Ripple",onClick:this.handleClick,style:this.style},this.renderRipples(),this.props.children);/* eslint-enable jsx-a11y/click-events-have-key-events,
|
|
51
|
+
jsx-a11y/no-static-element-interactions */return React.createElement("div",{className:"ui-shared__ripple ".concat(this.props.className),"data-test-id":"Ripple",onClick:this.handleClick,style:this.style},this.renderRipples(),this.props.children);/* eslint-enable jsx-a11y/click-events-have-key-events,
|
|
52
52
|
jsx-a11y/no-static-element-interactions */}},{key:"rippleSize",get:function get(){if(this.props.size){if(this.props.fill){return this.props.size*2;}return this.props.size;}/**
|
|
53
53
|
* We want the Ripple to fill the element. We set the diameter of the Ripple
|
|
54
54
|
* to double the distance of the opposing corners of the node. That way the Ripple
|
package/RippleButton/index.js
CHANGED
|
@@ -8,4 +8,4 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
|
|
|
8
8
|
return React.createElement(Button,_extends({},this.buttonProps,{wrapContent:true}),this.props.children);}var rippleProps={className:"".concat(style.contentWrapper," ").concat(this.props.rippleClassName),fill:true,size:this.props.rippleSize};return React.createElement(Button,_extends({},this.buttonProps,{testId:this.props.testId}),React.createElement(Ripple,rippleProps,this.props.children));}},{key:"buttonProps",/**
|
|
9
9
|
* Getter for the calculated button props.
|
|
10
10
|
* @returns {Object}
|
|
11
|
-
*/get:function get(){return{className:this.props.className,disabled:this.props.disabled,onClick:this.props.onClick,flat:this.props.flat,type:this.props.type,wrapContent:false,'aria-label':this.props['aria-label'],'aria-haspopup':this.props['aria-haspopup']};}}]);return RippleButton;}(Component);_defineProperty(RippleButton,"defaultProps",_extends({},Button.defaultProps,{rippleClassName:'',rippleSize:null,testId:'Button'}));export default RippleButton;
|
|
11
|
+
*/get:function get(){return{className:"".concat(this.props.className," ui-shared__ripple-button"),disabled:this.props.disabled,onClick:this.props.onClick,flat:this.props.flat,type:this.props.type,wrapContent:false,'aria-label':this.props['aria-label'],'aria-haspopup':this.props['aria-haspopup']};}}]);return RippleButton;}(Component);_defineProperty(RippleButton,"defaultProps",_extends({},Button.defaultProps,{rippleClassName:'',rippleSize:null,testId:'Button'}));export default RippleButton;
|
package/RippleButton/spec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import trim from'lodash/trim';import React from'react';import{shallow,mount}from'enzyme';import Button from'@shopgate/pwa-common/components/Button';import Ripple from"../Ripple";import styles from"../Button/style";import RippleButton from"./index";describe('<RippleButton />',function(){it('should render as a regular ripple button effect if type is omitted',function(){var wrapper=shallow(React.createElement(RippleButton,null,"Press me"));expect(wrapper).toMatchSnapshot();expect(wrapper.find(Ripple).render().text()).toEqual('Press me');});it('should render as a regular ripple button if type is explicitly defined',function(){var wrapper=mount(React.createElement(RippleButton,{type:"regular"},"Press me"));expect(trim(wrapper.find(Button).props().className)).toEqual(styles.regular(false).button);expect(wrapper.find(Ripple).render().text()).toEqual('Press me');expect(wrapper).toMatchSnapshot();});it('should render as a primary ripple button',function(){var wrapper=mount(React.createElement(RippleButton,{type:"primary"},"Press me"));expect(trim(wrapper.find(Button).props().className)).toEqual(styles.primary(false).button);expect(wrapper.find(Ripple).render().text()).toEqual('Press me');expect(wrapper).toMatchSnapshot();});it('should render as a secondary ripple button',function(){var wrapper=mount(React.createElement(RippleButton,{type:"secondary"},"Press me"));expect(trim(wrapper.find(Button).props().className)).toEqual(styles.secondary(false).button);expect(wrapper.find(Ripple).render().text()).toEqual('Press me');expect(wrapper).toMatchSnapshot();});it('should render as a disabled ripple button',function(){var wrapper=mount(React.createElement(RippleButton,{disabled:true},"Press me"));expect(wrapper.find(Button).props().disabled).toBe(true);expect(wrapper).toMatchSnapshot();});});
|
|
1
|
+
import trim from'lodash/trim';import React from'react';import{shallow,mount}from'enzyme';import Button from'@shopgate/pwa-common/components/Button';import Ripple from"../Ripple";import styles from"../Button/style";import RippleButton from"./index";describe('<RippleButton />',function(){it('should render as a regular ripple button effect if type is omitted',function(){var wrapper=shallow(React.createElement(RippleButton,null,"Press me"));expect(wrapper).toMatchSnapshot();expect(wrapper.find(Ripple).render().text()).toEqual('Press me');});it('should render as a regular ripple button if type is explicitly defined',function(){var wrapper=mount(React.createElement(RippleButton,{type:"regular"},"Press me"));expect(trim(wrapper.find(Button).props().className)).toEqual("ui-shared__button ".concat(styles.regular(false).button," ui-shared__ripple-button"));expect(wrapper.find(Ripple).render().text()).toEqual('Press me');expect(wrapper).toMatchSnapshot();});it('should render as a primary ripple button',function(){var wrapper=mount(React.createElement(RippleButton,{type:"primary"},"Press me"));expect(trim(wrapper.find(Button).props().className)).toEqual("ui-shared__button ".concat(styles.primary(false).button," ui-shared__ripple-button"));expect(wrapper.find(Ripple).render().text()).toEqual('Press me');expect(wrapper).toMatchSnapshot();});it('should render as a secondary ripple button',function(){var wrapper=mount(React.createElement(RippleButton,{type:"secondary"},"Press me"));expect(trim(wrapper.find(Button).props().className)).toEqual("ui-shared__button ".concat(styles.secondary(false).button," ui-shared__ripple-button"));expect(wrapper.find(Ripple).render().text()).toEqual('Press me');expect(wrapper).toMatchSnapshot();});it('should render as a disabled ripple button',function(){var wrapper=mount(React.createElement(RippleButton,{disabled:true},"Press me"));expect(wrapper.find(Button).props().disabled).toBe(true);expect(wrapper).toMatchSnapshot();});});
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-ui-shared",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.12.0-beta.1",
|
|
4
4
|
"description": "Shopgate's shared UI components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@shopgate/pwa-ui-ios": "7.
|
|
9
|
-
"@shopgate/pwa-ui-material": "7.
|
|
8
|
+
"@shopgate/pwa-ui-ios": "7.12.0-beta.1",
|
|
9
|
+
"@shopgate/pwa-ui-material": "7.12.0-beta.1",
|
|
10
10
|
"react-day-picker": "^7.4.8"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@shopgate/pwa-common": "7.
|
|
14
|
-
"@shopgate/pwa-common-commerce": "7.
|
|
13
|
+
"@shopgate/pwa-common": "7.12.0-beta.1",
|
|
14
|
+
"@shopgate/pwa-common-commerce": "7.12.0-beta.1",
|
|
15
15
|
"classnames": "^2.2.5",
|
|
16
16
|
"react": "~16.12.0"
|
|
17
17
|
},
|