@shopgate/pwa-ui-shared 7.29.1-beta.2 → 7.30.0-alpha.3

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.
@@ -1,6 +1,19 @@
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 Transition from'react-inline-transition-group';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import style from"../../style";/**
2
- * The ripple animation component.
3
- */var RippleAnimation=/*#__PURE__*/function(_Component){function RippleAnimation(){var _this2;_classCallCheck(this,RippleAnimation);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this2=_callSuper(this,RippleAnimation,[].concat(args));_defineProperty(_this2,"handlePhaseEnd",function(){_this2.props.onComplete();});return _this2;}_inherits(RippleAnimation,_Component);return _createClass(RippleAnimation,[{key:"render",value:/**
4
- * Renders the component.
5
- * @returns {JSX}
6
- */function render(){var duration=this.props.duration;return React.createElement(Transition,{childrenStyles:{base:{backgroundColor:this.props.color,height:this.props.size,width:this.props.size,transform:'translate3d(-50%, -50%, 0) scale3d(0, 0, 1)',transition:"opacity ".concat(duration,"ms cubic-bezier(0.25, 0.1, 0.25, 1), transform ").concat(duration,"ms cubic-bezier(0.25, 0.1, 0.25, 1)"),left:this.props.x,top:this.props.y,opacity:0.25},appear:{transform:'translate3d(-50%, -50%, 0) scale3d(1, 1, 1)',opacity:0},enter:{transform:'translate3d(-50%, -50%, 0) scale3d(1, 1, 1)',opacity:0},leave:{}},onPhaseEnd:this.handlePhaseEnd},React.createElement("div",{className:style.ripple}));}}]);}(Component);_defineProperty(RippleAnimation,"defaultProps",{color:themeConfig.colors.dark,duration:300,onComplete:function onComplete(){},size:48,x:0,y:0});export default RippleAnimation;
1
+ 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);}import React,{useEffect,useRef,useMemo}from'react';import PropTypes from'prop-types';import{Transition}from'react-transition-group';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import style from"../../style";/**
2
+ * The RippleAnimation component
3
+ *
4
+ * Plays a one-shot ripple animation and calls `onComplete` when finished.
5
+ * @param {Object} props The component props.
6
+ * @param {string} props.color The ripple color.
7
+ * @param {number} props.duration The animation duration in milliseconds.
8
+ * @param {Function} props.onComplete The callback to be called when the animation is complete.
9
+ * @param {number} props.size The size of the ripple in pixels.
10
+ * @param {number} props.x The x coordinate of the ripple center.
11
+ * @param {number} props.y The y coordinate of the ripple center.
12
+ * @returns {JSX.Element}
13
+ */function RippleAnimation(_ref){var color=_ref.color,duration=_ref.duration,onComplete=_ref.onComplete,size=_ref.size,x=_ref.x,y=_ref.y;var nodeRef=useRef(null);// Trigger the animation immediately
14
+ var inProp=true;var baseStyle=useMemo(function(){return{position:'absolute',backgroundColor:color,height:size,width:size,left:x,top:y,borderRadius:'50%',transform:'translate3d(-50%, -50%, 0) scale3d(0, 0, 1)',opacity:0.25,transition:"opacity ".concat(duration,"ms cubic-bezier(0.25, 0.1, 0.25, 1), transform ").concat(duration,"ms cubic-bezier(0.25, 0.1, 0.25, 1)"),pointerEvents:'none'};},[color,duration,size,x,y]);var transitionStyles=useMemo(function(){return{entering:{transform:'translate3d(-50%, -50%, 0) scale3d(1, 1, 1)',opacity:0},entered:{transform:'translate3d(-50%, -50%, 0) scale3d(1, 1, 1)',opacity:0},exiting:{},exited:{},unmounted:{}};},[]);// Run callback when transition ends
15
+ useEffect(function(){var el=nodeRef.current;if(!el)return undefined;/**
16
+ * Handles the transition end event and calls onComplete for relevant properties.
17
+ * @param {TransitionEvent} e - The transition event object
18
+ */var handleEnd=function handleEnd(e){// Only handle transform or opacity transitions
19
+ if(e.propertyName==='transform'||e.propertyName==='opacity'){onComplete();}};el.addEventListener('transitionend',handleEnd);return function(){return el.removeEventListener('transitionend',handleEnd);};},[onComplete]);return React.createElement(Transition,{"in":inProp,timeout:duration,appear:true,mountOnEnter:true,unmountOnExit:true,nodeRef:nodeRef},function(state){return React.createElement("div",{ref:nodeRef,className:style.ripple,style:_extends({},baseStyle,{},transitionStyles[state])});});}RippleAnimation.defaultProps={color:themeConfig.colors.dark,duration:300,onComplete:function onComplete(){},size:48,x:0,y:0};export default React.memo(RippleAnimation);
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-ui-shared",
3
- "version": "7.29.1-beta.2",
3
+ "version": "7.30.0-alpha.3",
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.29.1-beta.2",
9
- "@shopgate/pwa-ui-material": "7.29.1-beta.2",
8
+ "@shopgate/pwa-ui-ios": "7.30.0-alpha.3",
9
+ "@shopgate/pwa-ui-material": "7.30.0-alpha.3",
10
10
  "react-day-picker": "^7.4.8"
11
11
  },
12
12
  "devDependencies": {
13
- "@shopgate/pwa-common": "7.29.1-beta.2",
14
- "@shopgate/pwa-common-commerce": "7.29.1-beta.2",
13
+ "@shopgate/pwa-common": "7.30.0-alpha.3",
14
+ "@shopgate/pwa-common-commerce": "7.30.0-alpha.3",
15
15
  "classnames": "2.5.1",
16
16
  "react": "~16.14.0"
17
17
  },