@cleartrip/ct-design-transition
Advanced tools
Comparing version 3.14.1-SNAPSHOT-MEVC-LOYALTY-ATP.0 to 3.15.0-SNAPSHOT-MEVC-ATP-LOYALTY-1.0
@@ -1,2 +0,2 @@ | ||
"use strict";var t=require("tslib"),n=require("react/jsx-runtime"),e=require("react"),i=require("react-transition-group"),r=require("@cleartrip/ct-design-theme"),o=require("@cleartrip/ct-design-use-merge-refs"),a=require("@cleartrip/ct-design-common-utils");function s(t){return t&&t.__esModule?t:{default:t}}function c(t){if(t&&t.__esModule)return t;var n=Object.create(null);return t&&Object.keys(t).forEach((function(e){if("default"!==e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})}})),n.default=t,Object.freeze(n)}var l=c(e),d=s(o),u={zoom:{entering:{transform:"none"},entered:{transform:"none"}},fade:{entering:{opacity:1},entered:{opacity:1}},grow:{entering:{opacity:1,transform:"scale(1, 1)"},entered:{opacity:1,transform:"none"}},slide_fade:{entering:{opacity:0,transform:"translateY(4px)"},entered:{opacity:1,transform:""},exited:{opacity:0,transform:"translateY(4px)"}},grow_from_container:{},collapse:{},slide:{}},f={grow:"scale(0.75, 0.5625)",zoom:"scale(0)"};function y(t,n){var e,i,r=t.timeout,o=t.easing,a=t.style,s=void 0===a?{}:a;return{duration:null!==(e=s.transitionDuration)&&void 0!==e?e:"number"==typeof r?r:r[n.mode]||0,easing:null!==(i=s.transitionTimingFunction)&&void 0!==i?i:"object"==typeof o?o[n.mode]:o,delay:s.transitionDelay}}function p(t,n,e){var i=function(t,n,e){var i=n.getBoundingClientRect(),r=e&&e.getBoundingClientRect(),o=window.getComputedStyle(n),a=o.getPropertyValue("-webkit-transform")||o.getPropertyValue("transform"),s=0,c=0;if(a&&"none"!==a&&"string"==typeof a){var l=a.split("(")[1].split(")")[0].split(",");s=parseInt(l[4],10),c=parseInt(l[5],10)}return"left"===t?"translateX(".concat(r?r.right+s-i.left:window.innerWidth+s-i.left,"px)"):"right"===t?"translateX(-".concat(r?i.right-r.left-s:i.left+i.width-s,"px)"):"up"===t?"translateY(".concat(r?r.bottom+c-i.top:window.innerHeight+c-i.top,"px)"):"translateY(-".concat(r?i.top-r.top+i.height-c:i.top+i.height-c,"px)")}(t,n,e);i&&(n.style.webkitTransform=i,n.style.transform=i)}var m=l.forwardRef((function(e,o){var s=e.appear,c=void 0===s||s,m=e.in;e.css;var g=e.style,v=e.type,w=e.children,h=e.timeout,x=e.easing,_=e.containerRef,b=e.slideDirection,E=void 0===b?"down":b,k=e.onEnter,T=e.onEntered,R=e.onEntering,j=e.onExit,q=e.onExited,O=e.onExiting,P=e.addEndListener,z=t.__rest(e,["appear","in","css","style","type","children","timeout","easing","containerRef","slideDirection","onEnter","onEntered","onEntering","onExit","onExited","onExiting","addEndListener"]),C=r.useTheme(),B={enter:C.transitions.duration.enteringScreen,exit:C.transitions.duration.leavingScreen};h=h||B;var D=l.useRef(null),F=d.default(D,null==w?void 0:w.ref,o),L=function(t){return function(n){if(t){var e=D.current;void 0===n?t(e):t(e,n)}}},A=L((function(t,n){"slide"===v&&p(E,t,_),function(t){t.scrollTop}(t);var e=y({style:g,timeout:h,easing:x},{mode:"enter"});if("fade"===v&&(t.style.webkitTransition=C.transitions.create("opacity",e),t.style.transition=C.transitions.create("opacity",e)),"slide_fade"===v&&(t.style.webkitTransition=[C.transitions.create("opacity",e),C.transitions.create("transform",e)].join(","),t.style.transition=[C.transitions.create("opacity",e),C.transitions.create("transform",e)].join(",")),"grow_from_container"===v&&function(t){var n=t.containerRef,e=t.node,i=t.transitionProps,r=null!=i?i:{},o=r.delay,a=void 0===o?0:o,s=r.duration,c=void 0===s?300:s,l=r.easing,d=void 0===l?"":l;requestAnimationFrame((function(){var t;if(null==n?void 0:n.current){var i=null!==(t=n.current.getBoundingClientRect())&&void 0!==t?t:{},r=i.width,o=i.height,s=i.top,l=i.left;e.style.transition="",e.style.opacity="0";var u=e.getBoundingClientRect(),f=u.height,y=u.width;requestAnimationFrame((function(){e.style.transformOrigin="top left",e.style.top=s+"px",e.style.left=l+"px",e.style.opacity="0",e.style.height=o+"px",e.style.width=r+"px",e.style.transform="translate(0, 0)",requestAnimationFrame((function(){e.style.transition="opacity ".concat(c/3,"ms ").concat(a,"ms ").concat(d,", width ").concat(c,"ms ").concat(a,"ms ").concat(d,", height ").concat(c,"ms ").concat(a,"ms ").concat(d,", transform ").concat(c,"ms ").concat(a,"ms ").concat(d),e.style.height=f+"px",e.style.width=y+"px",e.style.opacity="1",e.style.transform="translate(".concat(-l,"px, ").concat(-s,"px)")}))}))}}))}({node:t,containerRef:_,transitionProps:e}),"grow"===v){t.style.transition=[C.transitions.create("opacity",{duration:e.duration,delay:e.delay}),C.transitions.create("transform",{duration:void 0,delay:e.delay,easing:e.easing})].join(",")}"zoom"===v&&(t.style.webkitTransition=C.transitions.create("transform",e),t.style.transition=C.transitions.create("transform",e)),k&&k(t,n)})),Y=L((function(n,e){if("slide"===v){var i=x||{enter:C.transitions.easing.easeOut,exit:C.transitions.easing.sharp},r=y({timeout:h,style:g,easing:i},{mode:"enter"});n.style.webkitTransition=C.transitions.create("-webkit-transform",t.__assign({},r)),n.style.transition=C.transitions.create("transform",t.__assign({},r)),n.style.webkitTransform="none",n.style.transform="none"}R&&R(n,e)})),S=L(T),I=L(O),M=L((function(t){var n=y({style:g,timeout:h,easing:x},{mode:"exit"});"fade"==v&&(t.style.webkitTransition=C.transitions.create("opacity",n),t.style.transition=C.transitions.create("opacity",n)),"slide_fade"===v&&(t.style.transition="",t.style.webkitTransition=""),"grow_from_container"===v&&function(t){var n=t.containerRef,e=t.node,i=t.transitionProps,r=null!=i?i:{},o=r.delay,a=void 0===o?0:o,s=r.duration,c=void 0===s?300:s,l=r.easing,d=void 0===l?"":l,u=6*c/10,f=5*c/10;requestAnimationFrame((function(){var t;if(null==n?void 0:n.current){var i=null!==(t=n.current.getBoundingClientRect())&&void 0!==t?t:{},r=i.width,o=i.height,s=i.top,l=i.left;e.style.transition="opacity ".concat(c,"ms ").concat(f,"ms ").concat(d,", width ").concat(u,"ms ").concat(a,"ms ").concat(d,", height ").concat(u,"ms ").concat(a,"ms ").concat(d,", transform ").concat(u,"ms ").concat(a,"ms ").concat(d),e.style.transformOrigin="top left",e.style.top=s+"px",e.style.left=l+"px",e.style.opacity="0",e.style.height=o+"px",e.style.width=r+"px",e.style.transform="translate(0, 0)"}}))}({node:t,containerRef:_,transitionProps:n}),"grow"===v&&(t.style.transition=[C.transitions.create("opacity",{duration:n.duration,delay:n.delay}),C.transitions.create("transform",{duration:n.duration,delay:n.delay,easing:n.easing})].join(","),t.style.opacity=0,t.style.transform="scale(0.75, 0.5625)"),"zoom"===v&&(t.style.webkitTransition=C.transitions.create("transform",n),t.style.transition=C.transitions.create("transform",n)),"slide"===v&&(t.style.webkitTransition=C.transitions.create("-webkit-transform",n),t.style.transition=C.transitions.create("transform",n),p(E,t,_)),j&&j(t)})),V=L((function(t){"slide"===v&&(t.style.webkitTransition="",t.style.transition=""),q&&q(t)})),X=l.useCallback((function(){D.current&&p(E,D.current,_)}),[E,_]);return l.useEffect((function(){if(!m&&"down"!==E&&"right"!==E){var t=a.debounce((function(){D.current&&p(E,D.current,_)}));return window.addEventListener("resize",t),function(){window.removeEventListener("resize",t)}}}),[E,m,_]),l.useEffect((function(){"slide"!==v||m||X()}),[m,X]),n.jsx(i.Transition,t.__assign({appear:c,in:m,nodeRef:D,onEnter:A,onEntered:S,onEntering:Y,onExit:M,onExited:V,onExiting:I,addEndListener:function(t){P&&D.current&&P(D.current,t)},timeout:h},z,{children:function(n){var e={style:t.__assign(t.__assign(t.__assign({opacity:("fade"==v||"grow"===v)&&0,transform:f[v],visibility:"exited"!==n||m?void 0:"hidden"},u[v][n]),g),w.props.style),ref:F};return"slide"===v&&(e=t.__assign(t.__assign({},e),w.props)),l.cloneElement(w,e)}}))}));exports.Transition=m; | ||
"use strict";var t=require("tslib"),n=require("react/jsx-runtime"),e=require("react"),i=require("react-transition-group"),r=require("@cleartrip/ct-design-theme"),o=require("@cleartrip/ct-design-use-merge-refs"),a=require("@cleartrip/ct-design-common-utils");function s(t){return t&&t.__esModule?t:{default:t}}function c(t){if(t&&t.__esModule)return t;var n=Object.create(null);return t&&Object.keys(t).forEach((function(e){if("default"!==e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})}})),n.default=t,Object.freeze(n)}var l=c(e),d=s(o),u={zoom:{entering:{transform:"none"},entered:{transform:"none"}},fade:{entering:{opacity:1},entered:{opacity:1}},grow:{entering:{opacity:1,transform:"scale(1, 1)"},entered:{opacity:1,transform:"none"}},slide_fade:{entering:{opacity:0,transform:"translateY(4px)"},entered:{opacity:1,transform:""},exited:{opacity:0,transform:"translateY(4px)"}},grow_from_container:{},collapse:{},slide:{}},f={grow:"scale(0.75, 0.5625)",zoom:"scale(0)"};function y(t,n){var e,i,r=t.timeout,o=t.easing,a=t.style,s=void 0===a?{}:a;return{duration:null!==(e=s.transitionDuration)&&void 0!==e?e:"number"==typeof r?r:r[n.mode]||0,easing:null!==(i=s.transitionTimingFunction)&&void 0!==i?i:"object"==typeof o?o[n.mode]:o,delay:s.transitionDelay}}function p(t,n,e){var i=function(t,n,e){var i=n.getBoundingClientRect(),r=e&&e.getBoundingClientRect(),o=window.getComputedStyle(n),a=o.getPropertyValue("-webkit-transform")||o.getPropertyValue("transform"),s=0,c=0;if(a&&"none"!==a&&"string"==typeof a){var l=a.split("(")[1].split(")")[0].split(",");s=parseInt(l[4],10),c=parseInt(l[5],10)}return"left"===t?"translateX(".concat(r?r.right+s-i.left:window.innerWidth+s-i.left,"px) translateZ(0px)"):"right"===t?"translateX(-".concat(r?i.right-r.left-s:i.left+i.width-s,"px) translateZ(0px)"):"up"===t?"translateY(".concat(r?r.bottom+c-i.top:window.innerHeight+c-i.top,"px) translateZ(0px)"):"translateY(-".concat(r?i.top-r.top+i.height-c:i.top+i.height-c,"px) translateZ(0px)")}(t,n,e);i&&(n.style.webkitTransform=i,n.style.transform=i)}var m=l.forwardRef((function(e,o){var s=e.appear,c=void 0===s||s,m=e.in;e.css;var g=e.style,v=e.type,w=e.children,h=e.timeout,x=e.easing,_=e.containerRef,b=e.slideDirection,E=void 0===b?"down":b,k=e.onEnter,T=e.onEntered,R=e.onEntering,j=e.onExit,q=e.onExited,O=e.onExiting,P=e.addEndListener,z=t.__rest(e,["appear","in","css","style","type","children","timeout","easing","containerRef","slideDirection","onEnter","onEntered","onEntering","onExit","onExited","onExiting","addEndListener"]),C=r.useTheme(),Z={enter:C.transitions.duration.enteringScreen,exit:C.transitions.duration.leavingScreen};h=h||Z;var B=l.useRef(null),D=d.default(B,null==w?void 0:w.ref,o),F=function(t){return function(n){if(t){var e=B.current;void 0===n?t(e):t(e,n)}}},L=F((function(t,n){"slide"===v&&p(E,t,_),function(t){t.scrollTop}(t);var e=y({style:g,timeout:h,easing:x},{mode:"enter"});if("fade"===v&&(t.style.webkitTransition=C.transitions.create("opacity",e),t.style.transition=C.transitions.create("opacity",e)),"slide_fade"===v&&(t.style.webkitTransition=[C.transitions.create("opacity",e),C.transitions.create("transform",e)].join(","),t.style.transition=[C.transitions.create("opacity",e),C.transitions.create("transform",e)].join(",")),"grow_from_container"===v&&function(t){var n=t.containerRef,e=t.node,i=t.transitionProps,r=null!=i?i:{},o=r.delay,a=void 0===o?0:o,s=r.duration,c=void 0===s?300:s,l=r.easing,d=void 0===l?"":l;requestAnimationFrame((function(){var t;if(null==n?void 0:n.current){var i=null!==(t=n.current.getBoundingClientRect())&&void 0!==t?t:{},r=i.width,o=i.height,s=i.top,l=i.left;e.style.transition="",e.style.opacity="0";var u=e.getBoundingClientRect(),f=u.height,y=u.width;requestAnimationFrame((function(){e.style.transformOrigin="top left",e.style.top=s+"px",e.style.left=l+"px",e.style.opacity="0",e.style.height=o+"px",e.style.width=r+"px",e.style.transform="translate(0, 0)",requestAnimationFrame((function(){e.style.transition="opacity ".concat(c/3,"ms ").concat(a,"ms ").concat(d,", width ").concat(c,"ms ").concat(a,"ms ").concat(d,", height ").concat(c,"ms ").concat(a,"ms ").concat(d,", transform ").concat(c,"ms ").concat(a,"ms ").concat(d),e.style.height=f+"px",e.style.width=y+"px",e.style.opacity="1",e.style.transform="translate(".concat(-l,"px, ").concat(-s,"px)")}))}))}}))}({node:t,containerRef:_,transitionProps:e}),"grow"===v){t.style.transition=[C.transitions.create("opacity",{duration:e.duration,delay:e.delay}),C.transitions.create("transform",{duration:void 0,delay:e.delay,easing:e.easing})].join(",")}"zoom"===v&&(t.style.webkitTransition=C.transitions.create("transform",e),t.style.transition=C.transitions.create("transform",e)),k&&k(t,n)})),A=F((function(n,e){if("slide"===v){var i=x||{enter:C.transitions.easing.easeOut,exit:C.transitions.easing.sharp},r=y({timeout:h,style:g,easing:i},{mode:"enter"});n.style.webkitTransition=C.transitions.create("-webkit-transform",t.__assign({},r)),n.style.transition=C.transitions.create("transform",t.__assign({},r)),n.style.webkitTransform="translateZ(0px)",n.style.transform="translateZ(0px)"}R&&R(n,e)})),Y=F(T),S=F(O),I=F((function(t){var n=y({style:g,timeout:h,easing:x},{mode:"exit"});"fade"==v&&(t.style.webkitTransition=C.transitions.create("opacity",n),t.style.transition=C.transitions.create("opacity",n)),"slide_fade"===v&&(t.style.transition="",t.style.webkitTransition=""),"grow_from_container"===v&&function(t){var n=t.containerRef,e=t.node,i=t.transitionProps,r=null!=i?i:{},o=r.delay,a=void 0===o?0:o,s=r.duration,c=void 0===s?300:s,l=r.easing,d=void 0===l?"":l,u=6*c/10,f=5*c/10;requestAnimationFrame((function(){var t;if(null==n?void 0:n.current){var i=null!==(t=n.current.getBoundingClientRect())&&void 0!==t?t:{},r=i.width,o=i.height,s=i.top,l=i.left;e.style.transition="opacity ".concat(c,"ms ").concat(f,"ms ").concat(d,", width ").concat(u,"ms ").concat(a,"ms ").concat(d,", height ").concat(u,"ms ").concat(a,"ms ").concat(d,", transform ").concat(u,"ms ").concat(a,"ms ").concat(d),e.style.transformOrigin="top left",e.style.top=s+"px",e.style.left=l+"px",e.style.opacity="0",e.style.height=o+"px",e.style.width=r+"px",e.style.transform="translate(0, 0)"}}))}({node:t,containerRef:_,transitionProps:n}),"grow"===v&&(t.style.transition=[C.transitions.create("opacity",{duration:n.duration,delay:n.delay}),C.transitions.create("transform",{duration:n.duration,delay:n.delay,easing:n.easing})].join(","),t.style.opacity=0,t.style.transform="scale(0.75, 0.5625)"),"zoom"===v&&(t.style.webkitTransition=C.transitions.create("transform",n),t.style.transition=C.transitions.create("transform",n)),"slide"===v&&(t.style.webkitTransition=C.transitions.create("-webkit-transform",n),t.style.transition=C.transitions.create("transform",n),p(E,t,_)),j&&j(t)})),M=F((function(t){"slide"===v&&(t.style.webkitTransition="",t.style.transition=""),q&&q(t)})),V=l.useCallback((function(){B.current&&p(E,B.current,_)}),[E,_]);return l.useEffect((function(){if(!m&&"down"!==E&&"right"!==E){var t=a.debounce((function(){B.current&&p(E,B.current,_)}));return window.addEventListener("resize",t),function(){window.removeEventListener("resize",t)}}}),[E,m,_]),l.useEffect((function(){"slide"!==v||m||V()}),[m,V]),n.jsx(i.Transition,t.__assign({appear:c,in:m,nodeRef:B,onEnter:L,onEntered:Y,onEntering:A,onExit:I,onExited:M,onExiting:S,addEndListener:function(t){P&&B.current&&P(B.current,t)},timeout:h},z,{children:function(n){var e={style:t.__assign(t.__assign(t.__assign({opacity:("fade"==v||"grow"===v)&&0,transform:f[v],visibility:"exited"!==n||m?void 0:"hidden"},u[v][n]),g),w.props.style),ref:D};return"slide"===v&&(e=t.__assign(t.__assign({},e),w.props)),l.cloneElement(w,e)}}))}));exports.Transition=m; | ||
//# sourceMappingURL=ct-design-transition.browser.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import{__rest as t,__assign as n}from"tslib";import{jsx as e}from"react/jsx-runtime";import*as i from"react";import{Transition as r}from"react-transition-group";import{useTheme as o}from"@cleartrip/ct-design-theme";import a from"@cleartrip/ct-design-use-merge-refs";import{debounce as s}from"@cleartrip/ct-design-common-utils";var c={zoom:{entering:{transform:"none"},entered:{transform:"none"}},fade:{entering:{opacity:1},entered:{opacity:1}},grow:{entering:{opacity:1,transform:"scale(1, 1)"},entered:{opacity:1,transform:"none"}},slide_fade:{entering:{opacity:0,transform:"translateY(4px)"},entered:{opacity:1,transform:""},exited:{opacity:0,transform:"translateY(4px)"}},grow_from_container:{},collapse:{},slide:{}},l={grow:"scale(0.75, 0.5625)",zoom:"scale(0)"};function d(t,n){var e,i,r=t.timeout,o=t.easing,a=t.style,s=void 0===a?{}:a;return{duration:null!==(e=s.transitionDuration)&&void 0!==e?e:"number"==typeof r?r:r[n.mode]||0,easing:null!==(i=s.transitionTimingFunction)&&void 0!==i?i:"object"==typeof o?o[n.mode]:o,delay:s.transitionDelay}}function f(t,n,e){var i=function(t,n,e){var i=n.getBoundingClientRect(),r=e&&e.getBoundingClientRect(),o=window.getComputedStyle(n),a=o.getPropertyValue("-webkit-transform")||o.getPropertyValue("transform"),s=0,c=0;if(a&&"none"!==a&&"string"==typeof a){var l=a.split("(")[1].split(")")[0].split(",");s=parseInt(l[4],10),c=parseInt(l[5],10)}return"left"===t?"translateX(".concat(r?r.right+s-i.left:window.innerWidth+s-i.left,"px)"):"right"===t?"translateX(-".concat(r?i.right-r.left-s:i.left+i.width-s,"px)"):"up"===t?"translateY(".concat(r?r.bottom+c-i.top:window.innerHeight+c-i.top,"px)"):"translateY(-".concat(r?i.top-r.top+i.height-c:i.top+i.height-c,"px)")}(t,n,e);i&&(n.style.webkitTransform=i,n.style.transform=i)}var m=i.forwardRef((function(m,y){var p=m.appear,u=void 0===p||p,g=m.in;m.css;var v=m.style,w=m.type,h=m.children,x=m.timeout,E=m.easing,b=m.containerRef,k=m.slideDirection,R=void 0===k?"down":k,T=m.onEnter,_=m.onEntered,C=m.onEntering,j=m.onExit,z=m.onExited,P=m.onExiting,B=m.addEndListener,F=t(m,["appear","in","css","style","type","children","timeout","easing","containerRef","slideDirection","onEnter","onEntered","onEntering","onExit","onExited","onExiting","addEndListener"]),L=o(),q={enter:L.transitions.duration.enteringScreen,exit:L.transitions.duration.leavingScreen};x=x||q;var A=i.useRef(null),D=a(A,null==h?void 0:h.ref,y),Y=function(t){return function(n){if(t){var e=A.current;void 0===n?t(e):t(e,n)}}},O=Y((function(t,n){"slide"===w&&f(R,t,b),function(t){t.scrollTop}(t);var e=d({style:v,timeout:x,easing:E},{mode:"enter"});if("fade"===w&&(t.style.webkitTransition=L.transitions.create("opacity",e),t.style.transition=L.transitions.create("opacity",e)),"slide_fade"===w&&(t.style.webkitTransition=[L.transitions.create("opacity",e),L.transitions.create("transform",e)].join(","),t.style.transition=[L.transitions.create("opacity",e),L.transitions.create("transform",e)].join(",")),"grow_from_container"===w&&function(t){var n=t.containerRef,e=t.node,i=t.transitionProps,r=null!=i?i:{},o=r.delay,a=void 0===o?0:o,s=r.duration,c=void 0===s?300:s,l=r.easing,d=void 0===l?"":l;requestAnimationFrame((function(){var t;if(null==n?void 0:n.current){var i=null!==(t=n.current.getBoundingClientRect())&&void 0!==t?t:{},r=i.width,o=i.height,s=i.top,l=i.left;e.style.transition="",e.style.opacity="0";var f=e.getBoundingClientRect(),m=f.height,y=f.width;requestAnimationFrame((function(){e.style.transformOrigin="top left",e.style.top=s+"px",e.style.left=l+"px",e.style.opacity="0",e.style.height=o+"px",e.style.width=r+"px",e.style.transform="translate(0, 0)",requestAnimationFrame((function(){e.style.transition="opacity ".concat(c/3,"ms ").concat(a,"ms ").concat(d,", width ").concat(c,"ms ").concat(a,"ms ").concat(d,", height ").concat(c,"ms ").concat(a,"ms ").concat(d,", transform ").concat(c,"ms ").concat(a,"ms ").concat(d),e.style.height=m+"px",e.style.width=y+"px",e.style.opacity="1",e.style.transform="translate(".concat(-l,"px, ").concat(-s,"px)")}))}))}}))}({node:t,containerRef:b,transitionProps:e}),"grow"===w){t.style.transition=[L.transitions.create("opacity",{duration:e.duration,delay:e.delay}),L.transitions.create("transform",{duration:void 0,delay:e.delay,easing:e.easing})].join(",")}"zoom"===w&&(t.style.webkitTransition=L.transitions.create("transform",e),t.style.transition=L.transitions.create("transform",e)),T&&T(t,n)})),S=Y((function(t,e){if("slide"===w){var i=E||{enter:L.transitions.easing.easeOut,exit:L.transitions.easing.sharp},r=d({timeout:x,style:v,easing:i},{mode:"enter"});t.style.webkitTransition=L.transitions.create("-webkit-transform",n({},r)),t.style.transition=L.transitions.create("transform",n({},r)),t.style.webkitTransform="none",t.style.transform="none"}C&&C(t,e)})),I=Y(_),V=Y(P),X=Y((function(t){var n=d({style:v,timeout:x,easing:E},{mode:"exit"});"fade"==w&&(t.style.webkitTransition=L.transitions.create("opacity",n),t.style.transition=L.transitions.create("opacity",n)),"slide_fade"===w&&(t.style.transition="",t.style.webkitTransition=""),"grow_from_container"===w&&function(t){var n=t.containerRef,e=t.node,i=t.transitionProps,r=null!=i?i:{},o=r.delay,a=void 0===o?0:o,s=r.duration,c=void 0===s?300:s,l=r.easing,d=void 0===l?"":l,f=6*c/10,m=5*c/10;requestAnimationFrame((function(){var t;if(null==n?void 0:n.current){var i=null!==(t=n.current.getBoundingClientRect())&&void 0!==t?t:{},r=i.width,o=i.height,s=i.top,l=i.left;e.style.transition="opacity ".concat(c,"ms ").concat(m,"ms ").concat(d,", width ").concat(f,"ms ").concat(a,"ms ").concat(d,", height ").concat(f,"ms ").concat(a,"ms ").concat(d,", transform ").concat(f,"ms ").concat(a,"ms ").concat(d),e.style.transformOrigin="top left",e.style.top=s+"px",e.style.left=l+"px",e.style.opacity="0",e.style.height=o+"px",e.style.width=r+"px",e.style.transform="translate(0, 0)"}}))}({node:t,containerRef:b,transitionProps:n}),"grow"===w&&(t.style.transition=[L.transitions.create("opacity",{duration:n.duration,delay:n.delay}),L.transitions.create("transform",{duration:n.duration,delay:n.delay,easing:n.easing})].join(","),t.style.opacity=0,t.style.transform="scale(0.75, 0.5625)"),"zoom"===w&&(t.style.webkitTransition=L.transitions.create("transform",n),t.style.transition=L.transitions.create("transform",n)),"slide"===w&&(t.style.webkitTransition=L.transitions.create("-webkit-transform",n),t.style.transition=L.transitions.create("transform",n),f(R,t,b)),j&&j(t)})),H=Y((function(t){"slide"===w&&(t.style.webkitTransition="",t.style.transition=""),z&&z(t)})),W=i.useCallback((function(){A.current&&f(R,A.current,b)}),[R,b]);return i.useEffect((function(){if(!g&&"down"!==R&&"right"!==R){var t=s((function(){A.current&&f(R,A.current,b)}));return window.addEventListener("resize",t),function(){window.removeEventListener("resize",t)}}}),[R,g,b]),i.useEffect((function(){"slide"!==w||g||W()}),[g,W]),e(r,n({appear:u,in:g,nodeRef:A,onEnter:O,onEntered:I,onEntering:S,onExit:X,onExited:H,onExiting:V,addEndListener:function(t){B&&A.current&&B(A.current,t)},timeout:x},F,{children:function(t){var e={style:n(n(n({opacity:("fade"==w||"grow"===w)&&0,transform:l[w],visibility:"exited"!==t||g?void 0:"hidden"},c[w][t]),v),h.props.style),ref:D};return"slide"===w&&(e=n(n({},e),h.props)),i.cloneElement(h,e)}}))}));export{m as Transition}; | ||
import{__rest as t,__assign as n}from"tslib";import{jsx as e}from"react/jsx-runtime";import*as i from"react";import{Transition as r}from"react-transition-group";import{useTheme as o}from"@cleartrip/ct-design-theme";import a from"@cleartrip/ct-design-use-merge-refs";import{debounce as s}from"@cleartrip/ct-design-common-utils";var c={zoom:{entering:{transform:"none"},entered:{transform:"none"}},fade:{entering:{opacity:1},entered:{opacity:1}},grow:{entering:{opacity:1,transform:"scale(1, 1)"},entered:{opacity:1,transform:"none"}},slide_fade:{entering:{opacity:0,transform:"translateY(4px)"},entered:{opacity:1,transform:""},exited:{opacity:0,transform:"translateY(4px)"}},grow_from_container:{},collapse:{},slide:{}},l={grow:"scale(0.75, 0.5625)",zoom:"scale(0)"};function d(t,n){var e,i,r=t.timeout,o=t.easing,a=t.style,s=void 0===a?{}:a;return{duration:null!==(e=s.transitionDuration)&&void 0!==e?e:"number"==typeof r?r:r[n.mode]||0,easing:null!==(i=s.transitionTimingFunction)&&void 0!==i?i:"object"==typeof o?o[n.mode]:o,delay:s.transitionDelay}}function f(t,n,e){var i=function(t,n,e){var i=n.getBoundingClientRect(),r=e&&e.getBoundingClientRect(),o=window.getComputedStyle(n),a=o.getPropertyValue("-webkit-transform")||o.getPropertyValue("transform"),s=0,c=0;if(a&&"none"!==a&&"string"==typeof a){var l=a.split("(")[1].split(")")[0].split(",");s=parseInt(l[4],10),c=parseInt(l[5],10)}return"left"===t?"translateX(".concat(r?r.right+s-i.left:window.innerWidth+s-i.left,"px) translateZ(0px)"):"right"===t?"translateX(-".concat(r?i.right-r.left-s:i.left+i.width-s,"px) translateZ(0px)"):"up"===t?"translateY(".concat(r?r.bottom+c-i.top:window.innerHeight+c-i.top,"px) translateZ(0px)"):"translateY(-".concat(r?i.top-r.top+i.height-c:i.top+i.height-c,"px) translateZ(0px)")}(t,n,e);i&&(n.style.webkitTransform=i,n.style.transform=i)}var m=i.forwardRef((function(m,p){var y=m.appear,u=void 0===y||y,g=m.in;m.css;var v=m.style,w=m.type,h=m.children,x=m.timeout,E=m.easing,b=m.containerRef,k=m.slideDirection,R=void 0===k?"down":k,T=m.onEnter,_=m.onEntered,C=m.onEntering,j=m.onExit,z=m.onExited,P=m.onExiting,Z=m.addEndListener,B=t(m,["appear","in","css","style","type","children","timeout","easing","containerRef","slideDirection","onEnter","onEntered","onEntering","onExit","onExited","onExiting","addEndListener"]),F=o(),L={enter:F.transitions.duration.enteringScreen,exit:F.transitions.duration.leavingScreen};x=x||L;var q=i.useRef(null),A=a(q,null==h?void 0:h.ref,p),D=function(t){return function(n){if(t){var e=q.current;void 0===n?t(e):t(e,n)}}},Y=D((function(t,n){"slide"===w&&f(R,t,b),function(t){t.scrollTop}(t);var e=d({style:v,timeout:x,easing:E},{mode:"enter"});if("fade"===w&&(t.style.webkitTransition=F.transitions.create("opacity",e),t.style.transition=F.transitions.create("opacity",e)),"slide_fade"===w&&(t.style.webkitTransition=[F.transitions.create("opacity",e),F.transitions.create("transform",e)].join(","),t.style.transition=[F.transitions.create("opacity",e),F.transitions.create("transform",e)].join(",")),"grow_from_container"===w&&function(t){var n=t.containerRef,e=t.node,i=t.transitionProps,r=null!=i?i:{},o=r.delay,a=void 0===o?0:o,s=r.duration,c=void 0===s?300:s,l=r.easing,d=void 0===l?"":l;requestAnimationFrame((function(){var t;if(null==n?void 0:n.current){var i=null!==(t=n.current.getBoundingClientRect())&&void 0!==t?t:{},r=i.width,o=i.height,s=i.top,l=i.left;e.style.transition="",e.style.opacity="0";var f=e.getBoundingClientRect(),m=f.height,p=f.width;requestAnimationFrame((function(){e.style.transformOrigin="top left",e.style.top=s+"px",e.style.left=l+"px",e.style.opacity="0",e.style.height=o+"px",e.style.width=r+"px",e.style.transform="translate(0, 0)",requestAnimationFrame((function(){e.style.transition="opacity ".concat(c/3,"ms ").concat(a,"ms ").concat(d,", width ").concat(c,"ms ").concat(a,"ms ").concat(d,", height ").concat(c,"ms ").concat(a,"ms ").concat(d,", transform ").concat(c,"ms ").concat(a,"ms ").concat(d),e.style.height=m+"px",e.style.width=p+"px",e.style.opacity="1",e.style.transform="translate(".concat(-l,"px, ").concat(-s,"px)")}))}))}}))}({node:t,containerRef:b,transitionProps:e}),"grow"===w){t.style.transition=[F.transitions.create("opacity",{duration:e.duration,delay:e.delay}),F.transitions.create("transform",{duration:void 0,delay:e.delay,easing:e.easing})].join(",")}"zoom"===w&&(t.style.webkitTransition=F.transitions.create("transform",e),t.style.transition=F.transitions.create("transform",e)),T&&T(t,n)})),O=D((function(t,e){if("slide"===w){var i=E||{enter:F.transitions.easing.easeOut,exit:F.transitions.easing.sharp},r=d({timeout:x,style:v,easing:i},{mode:"enter"});t.style.webkitTransition=F.transitions.create("-webkit-transform",n({},r)),t.style.transition=F.transitions.create("transform",n({},r)),t.style.webkitTransform="translateZ(0px)",t.style.transform="translateZ(0px)"}C&&C(t,e)})),S=D(_),I=D(P),V=D((function(t){var n=d({style:v,timeout:x,easing:E},{mode:"exit"});"fade"==w&&(t.style.webkitTransition=F.transitions.create("opacity",n),t.style.transition=F.transitions.create("opacity",n)),"slide_fade"===w&&(t.style.transition="",t.style.webkitTransition=""),"grow_from_container"===w&&function(t){var n=t.containerRef,e=t.node,i=t.transitionProps,r=null!=i?i:{},o=r.delay,a=void 0===o?0:o,s=r.duration,c=void 0===s?300:s,l=r.easing,d=void 0===l?"":l,f=6*c/10,m=5*c/10;requestAnimationFrame((function(){var t;if(null==n?void 0:n.current){var i=null!==(t=n.current.getBoundingClientRect())&&void 0!==t?t:{},r=i.width,o=i.height,s=i.top,l=i.left;e.style.transition="opacity ".concat(c,"ms ").concat(m,"ms ").concat(d,", width ").concat(f,"ms ").concat(a,"ms ").concat(d,", height ").concat(f,"ms ").concat(a,"ms ").concat(d,", transform ").concat(f,"ms ").concat(a,"ms ").concat(d),e.style.transformOrigin="top left",e.style.top=s+"px",e.style.left=l+"px",e.style.opacity="0",e.style.height=o+"px",e.style.width=r+"px",e.style.transform="translate(0, 0)"}}))}({node:t,containerRef:b,transitionProps:n}),"grow"===w&&(t.style.transition=[F.transitions.create("opacity",{duration:n.duration,delay:n.delay}),F.transitions.create("transform",{duration:n.duration,delay:n.delay,easing:n.easing})].join(","),t.style.opacity=0,t.style.transform="scale(0.75, 0.5625)"),"zoom"===w&&(t.style.webkitTransition=F.transitions.create("transform",n),t.style.transition=F.transitions.create("transform",n)),"slide"===w&&(t.style.webkitTransition=F.transitions.create("-webkit-transform",n),t.style.transition=F.transitions.create("transform",n),f(R,t,b)),j&&j(t)})),X=D((function(t){"slide"===w&&(t.style.webkitTransition="",t.style.transition=""),z&&z(t)})),H=i.useCallback((function(){q.current&&f(R,q.current,b)}),[R,b]);return i.useEffect((function(){if(!g&&"down"!==R&&"right"!==R){var t=s((function(){q.current&&f(R,q.current,b)}));return window.addEventListener("resize",t),function(){window.removeEventListener("resize",t)}}}),[R,g,b]),i.useEffect((function(){"slide"!==w||g||H()}),[g,H]),e(r,n({appear:u,in:g,nodeRef:q,onEnter:Y,onEntered:S,onEntering:O,onExit:V,onExited:X,onExiting:I,addEndListener:function(t){Z&&q.current&&Z(q.current,t)},timeout:x},B,{children:function(t){var e={style:n(n(n({opacity:("fade"==w||"grow"===w)&&0,transform:l[w],visibility:"exited"!==t||g?void 0:"hidden"},c[w][t]),v),h.props.style),ref:A};return"slide"===w&&(e=n(n({},e),h.props)),i.cloneElement(h,e)}}))}));export{m as Transition}; | ||
//# sourceMappingURL=ct-design-transition.browser.esm.js.map |
@@ -108,22 +108,22 @@ 'use strict'; | ||
if (containerRect) { | ||
return "translateX(".concat(containerRect.right + offsetX - rect.left, "px)"); | ||
return "translateX(".concat(containerRect.right + offsetX - rect.left, "px) translateZ(0px)"); | ||
} | ||
return "translateX(".concat(window.innerWidth + offsetX - rect.left, "px)"); | ||
return "translateX(".concat(window.innerWidth + offsetX - rect.left, "px) translateZ(0px)"); | ||
} | ||
if (direction === 'right') { | ||
if (containerRect) { | ||
return "translateX(-".concat(rect.right - containerRect.left - offsetX, "px)"); | ||
return "translateX(-".concat(rect.right - containerRect.left - offsetX, "px) translateZ(0px)"); | ||
} | ||
return "translateX(-".concat(rect.left + rect.width - offsetX, "px)"); | ||
return "translateX(-".concat(rect.left + rect.width - offsetX, "px) translateZ(0px)"); | ||
} | ||
if (direction === 'up') { | ||
if (containerRect) { | ||
return "translateY(".concat(containerRect.bottom + offsetY - rect.top, "px)"); | ||
return "translateY(".concat(containerRect.bottom + offsetY - rect.top, "px) translateZ(0px)"); | ||
} | ||
return "translateY(".concat(window.innerHeight + offsetY - rect.top, "px)"); | ||
return "translateY(".concat(window.innerHeight + offsetY - rect.top, "px) translateZ(0px)"); | ||
} | ||
if (containerRect) { | ||
return "translateY(-".concat(rect.top - containerRect.top + rect.height - offsetY, "px)"); | ||
return "translateY(-".concat(rect.top - containerRect.top + rect.height - offsetY, "px) translateZ(0px)"); | ||
} | ||
return "translateY(-".concat(rect.top + rect.height - offsetY, "px)"); | ||
return "translateY(-".concat(rect.top + rect.height - offsetY, "px) translateZ(0px)"); | ||
} | ||
@@ -269,4 +269,4 @@ function setTranslateValue(direction, node, containerRef) { | ||
node.style.transition = theme.transitions.create('transform', tslib.__assign({}, transitionProps)); | ||
node.style.webkitTransform = 'none'; | ||
node.style.transform = 'none'; | ||
node.style.webkitTransform = 'translateZ(0px)'; | ||
node.style.transform = 'translateZ(0px)'; | ||
} | ||
@@ -273,0 +273,0 @@ if (onEntering) { |
@@ -83,22 +83,22 @@ import { __rest, __assign } from 'tslib'; | ||
if (containerRect) { | ||
return "translateX(".concat(containerRect.right + offsetX - rect.left, "px)"); | ||
return "translateX(".concat(containerRect.right + offsetX - rect.left, "px) translateZ(0px)"); | ||
} | ||
return "translateX(".concat(window.innerWidth + offsetX - rect.left, "px)"); | ||
return "translateX(".concat(window.innerWidth + offsetX - rect.left, "px) translateZ(0px)"); | ||
} | ||
if (direction === 'right') { | ||
if (containerRect) { | ||
return "translateX(-".concat(rect.right - containerRect.left - offsetX, "px)"); | ||
return "translateX(-".concat(rect.right - containerRect.left - offsetX, "px) translateZ(0px)"); | ||
} | ||
return "translateX(-".concat(rect.left + rect.width - offsetX, "px)"); | ||
return "translateX(-".concat(rect.left + rect.width - offsetX, "px) translateZ(0px)"); | ||
} | ||
if (direction === 'up') { | ||
if (containerRect) { | ||
return "translateY(".concat(containerRect.bottom + offsetY - rect.top, "px)"); | ||
return "translateY(".concat(containerRect.bottom + offsetY - rect.top, "px) translateZ(0px)"); | ||
} | ||
return "translateY(".concat(window.innerHeight + offsetY - rect.top, "px)"); | ||
return "translateY(".concat(window.innerHeight + offsetY - rect.top, "px) translateZ(0px)"); | ||
} | ||
if (containerRect) { | ||
return "translateY(-".concat(rect.top - containerRect.top + rect.height - offsetY, "px)"); | ||
return "translateY(-".concat(rect.top - containerRect.top + rect.height - offsetY, "px) translateZ(0px)"); | ||
} | ||
return "translateY(-".concat(rect.top + rect.height - offsetY, "px)"); | ||
return "translateY(-".concat(rect.top + rect.height - offsetY, "px) translateZ(0px)"); | ||
} | ||
@@ -244,4 +244,4 @@ function setTranslateValue(direction, node, containerRef) { | ||
node.style.transition = theme.transitions.create('transform', __assign({}, transitionProps)); | ||
node.style.webkitTransform = 'none'; | ||
node.style.transform = 'none'; | ||
node.style.webkitTransform = 'translateZ(0px)'; | ||
node.style.transform = 'translateZ(0px)'; | ||
} | ||
@@ -248,0 +248,0 @@ if (onEntering) { |
@@ -143,22 +143,22 @@ (function (global, factory) { | ||
if (containerRect) { | ||
return "translateX(".concat(containerRect.right + offsetX - rect.left, "px)"); | ||
return "translateX(".concat(containerRect.right + offsetX - rect.left, "px) translateZ(0px)"); | ||
} | ||
return "translateX(".concat(window.innerWidth + offsetX - rect.left, "px)"); | ||
return "translateX(".concat(window.innerWidth + offsetX - rect.left, "px) translateZ(0px)"); | ||
} | ||
if (direction === 'right') { | ||
if (containerRect) { | ||
return "translateX(-".concat(rect.right - containerRect.left - offsetX, "px)"); | ||
return "translateX(-".concat(rect.right - containerRect.left - offsetX, "px) translateZ(0px)"); | ||
} | ||
return "translateX(-".concat(rect.left + rect.width - offsetX, "px)"); | ||
return "translateX(-".concat(rect.left + rect.width - offsetX, "px) translateZ(0px)"); | ||
} | ||
if (direction === 'up') { | ||
if (containerRect) { | ||
return "translateY(".concat(containerRect.bottom + offsetY - rect.top, "px)"); | ||
return "translateY(".concat(containerRect.bottom + offsetY - rect.top, "px) translateZ(0px)"); | ||
} | ||
return "translateY(".concat(window.innerHeight + offsetY - rect.top, "px)"); | ||
return "translateY(".concat(window.innerHeight + offsetY - rect.top, "px) translateZ(0px)"); | ||
} | ||
if (containerRect) { | ||
return "translateY(-".concat(rect.top - containerRect.top + rect.height - offsetY, "px)"); | ||
return "translateY(-".concat(rect.top - containerRect.top + rect.height - offsetY, "px) translateZ(0px)"); | ||
} | ||
return "translateY(-".concat(rect.top + rect.height - offsetY, "px)"); | ||
return "translateY(-".concat(rect.top + rect.height - offsetY, "px) translateZ(0px)"); | ||
} | ||
@@ -304,4 +304,4 @@ function setTranslateValue(direction, node, containerRef) { | ||
node.style.transition = theme.transitions.create('transform', __assign({}, transitionProps)); | ||
node.style.webkitTransform = 'none'; | ||
node.style.transform = 'none'; | ||
node.style.webkitTransform = 'translateZ(0px)'; | ||
node.style.transform = 'translateZ(0px)'; | ||
} | ||
@@ -308,0 +308,0 @@ if (onEntering) { |
{ | ||
"name": "@cleartrip/ct-design-transition", | ||
"version": "3.14.1-SNAPSHOT-MEVC-LOYALTY-ATP.0", | ||
"version": "3.15.0-SNAPSHOT-MEVC-ATP-LOYALTY-1.0", | ||
"description": "Transition Component", | ||
@@ -19,5 +19,5 @@ "types": "dist/index.d.ts", | ||
"react-transition-group": "^4.4.5", | ||
"@cleartrip/ct-design-theme": "3.15.0-SNAPSHOT-MEVC-ATP-LOYALTY-1.0", | ||
"@cleartrip/ct-design-use-merge-refs": "3.14.0", | ||
"@cleartrip/ct-design-theme": "3.15.0-SNAPSHOT-MEVC-LOYALTY-ATP.0", | ||
"@cleartrip/ct-design-common-utils": "3.14.1-SNAPSHOT-MEVC-LOYALTY-ATP.0" | ||
"@cleartrip/ct-design-common-utils": "3.14.1-SNAPSHOT-MEVC-ATP-LOYALTY-1.0" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": {}, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168405
1282
+ Added@cleartrip/ct-design-common-utils@3.14.1-SNAPSHOT-MEVC-ATP-LOYALTY-1.0(transitive)
+ Added@cleartrip/ct-design-theme@3.15.0-SNAPSHOT-MEVC-ATP-LOYALTY-1.0(transitive)
+ Added@cleartrip/ct-design-tokens@3.15.0-SNAPSHOT-MEVC-ATP-LOYALTY-1.0(transitive)
+ Added@cleartrip/ct-design-types@3.14.1-SNAPSHOT-MEVC-ATP-LOYALTY-1.0(transitive)
- Removed@cleartrip/ct-design-common-utils@3.14.1-SNAPSHOT-MEVC-LOYALTY-ATP.0(transitive)
- Removed@cleartrip/ct-design-theme@3.15.0-SNAPSHOT-MEVC-LOYALTY-ATP.0(transitive)
- Removed@cleartrip/ct-design-tokens@3.15.0-SNAPSHOT-MEVC-LOYALTY-ATP.0(transitive)
- Removed@cleartrip/ct-design-types@3.14.1-SNAPSHOT-MEVC-LOYALTY-ATP.0(transitive)
Updated@cleartrip/ct-design-common-utils@3.14.1-SNAPSHOT-MEVC-ATP-LOYALTY-1.0
Updated@cleartrip/ct-design-theme@3.15.0-SNAPSHOT-MEVC-ATP-LOYALTY-1.0