@shopgate/pwa-ui-shared 7.25.0-beta.4 → 7.25.0-beta.5
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/ButtonLink/index.js +1 -1
- package/RatingNumber/index.js +2 -2
- package/RatingStars/index.js +3 -3
- package/package.json +5 -5
package/ButtonLink/index.js
CHANGED
|
@@ -5,5 +5,5 @@ var _excluded=["children","href","navigate"];function _typeof(obj){if(typeof Sym
|
|
|
5
5
|
* @returns {undefined}
|
|
6
6
|
*/_defineProperty(_this2,"handleClick",function(){_this2.props.navigate(_this2.props.href);});return _this2;}_inherits(ButtonLink,_Component);return _createClass(ButtonLink,[{key:"render",value:/**
|
|
7
7
|
* Renders an ActionButton and handles link handling.
|
|
8
|
-
* @returns {
|
|
8
|
+
* @returns {JSX.Element}
|
|
9
9
|
*/function render(){var _this$props=this.props,children=_this$props.children,href=_this$props.href,navigate=_this$props.navigate,props=_objectWithoutProperties(_this$props,_excluded);return React.createElement(ActionButton,_extends({className:"ui-shared__button-link",onClick:this.handleClick,type:"secondary"},props),children);}}]);}(Component);_defineProperty(ButtonLink,"defaultProps",{disabled:false,className:'',navigate:function navigate(){},noGap:false,flat:true});export default connect(ButtonLink);export{ButtonLink as UnwrappedButtonLink};
|
package/RatingNumber/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from'react';import PropTypes from'prop-types';import
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{I18n}from'@shopgate/engage/components';import{RATING_SCALE_DIVISOR}from"../RatingStars/constants";/**
|
|
2
2
|
* Rating number component.
|
|
3
3
|
* @param {Object} props Props.
|
|
4
4
|
* @param {number} props.rating Rating value.
|
|
5
5
|
* @param {string} props.className Class name.
|
|
6
|
-
* @returns {JSX}
|
|
6
|
+
* @returns {JSX.Element}
|
|
7
7
|
*/var RatingNumber=function RatingNumber(_ref){var rating=_ref.rating,className=_ref.className;if(!rating&&rating!==0){return null;}var number=rating/RATING_SCALE_DIVISOR;if(Number.isNaN(number)){return null;}return React.createElement(I18n.Number,{number:number,className:"".concat(className," ui-shared__rating-number"),fractions:2});};RatingNumber.defaultProps={className:'',rating:null};export default RatingNumber;
|
package/RatingStars/index.js
CHANGED
|
@@ -22,9 +22,9 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
|
|
|
22
22
|
* @param {number} pos Position/Index of clicked RatingStar.
|
|
23
23
|
*/},{key:"handleSelection",value:function handleSelection(e,pos){var onSelection=this.props.onSelection;e.target.value=pos*RATING_SCALE_DIVISOR;onSelection(e);}/**
|
|
24
24
|
* Renders the component.
|
|
25
|
-
* @returns {JSX}
|
|
25
|
+
* @returns {JSX.Element}
|
|
26
26
|
*/},{key:"render",value:function render(){var _this2=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':_this2.getTextualCTA(pos),role:'button',onClick:function onClick(e){return _this2.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.
|
|
27
|
-
role:'button',onClick:function onClick(e){return _this2.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}));}))
|
|
27
|
+
role:'button',onClick:function onClick(e){return _this2.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}));}));return React.createElement("div",{role:isSelectable?undefined:'img',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));}}]);}(Component);/**
|
|
28
28
|
* Context types definition.
|
|
29
|
-
* @type {{i18n:
|
|
29
|
+
* @type {{i18n: function}}
|
|
30
30
|
*/_defineProperty(RatingStars,"contextTypes",{i18n:PropTypes.func});_defineProperty(RatingStars,"defaultProps",{className:'',display:'small',isSelectable:false,onSelection:function onSelection(){}});export default RatingStars;
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-ui-shared",
|
|
3
|
-
"version": "7.25.0-beta.
|
|
3
|
+
"version": "7.25.0-beta.5",
|
|
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.25.0-beta.
|
|
9
|
-
"@shopgate/pwa-ui-material": "7.25.0-beta.
|
|
8
|
+
"@shopgate/pwa-ui-ios": "7.25.0-beta.5",
|
|
9
|
+
"@shopgate/pwa-ui-material": "7.25.0-beta.5",
|
|
10
10
|
"react-day-picker": "^7.4.8"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@shopgate/pwa-common": "7.25.0-beta.
|
|
14
|
-
"@shopgate/pwa-common-commerce": "7.25.0-beta.
|
|
13
|
+
"@shopgate/pwa-common": "7.25.0-beta.5",
|
|
14
|
+
"@shopgate/pwa-common-commerce": "7.25.0-beta.5",
|
|
15
15
|
"classnames": "2.5.1",
|
|
16
16
|
"react": "~16.14.0"
|
|
17
17
|
},
|