@trafilea/afrodita-components 7.24.5 → 7.24.6
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,2 +1,2 @@
|
|
|
1
|
-
import{__rest as
|
|
1
|
+
import{__rest as t,__assign as o}from"tslib";import{useRef as r,useState as e,useEffect as n,createElement as i}from"react";import{jsxs as a,jsx as u}from"react/jsx-runtime";import"../../../core/theme/Theme.js";import"../../../types/enums.js";import"../../pricing/clubOffer/ClubOfferTag.js";import"../../pricing/discount/styled.js";import"../../pricing/styles.js";import"../../tooltip/Styled.js";import"../../atoms/PriceLabel/PriceLabel.js";import"../../atoms/ClubPriceMemberLabel/ClubPriceMemberLabel.styled.js";import"../../atoms/HorizontalDivider/HorizontalDivider.js";import{Icon as c}from"../../atoms/Icon/Icon.js";import"../../atoms/Image/styled.js";import"../../atoms/PriceLabelV2/PriceLabelV2.js";import"../../atoms/Toggle/toggle.styled.js";import{ProgressBar as s}from"./components/ProgressBar.js";import{Container as d,PauseContainer as l,PlayContainer as m,PlayIcon as p,MuteButton as f,HTMLVideo as v}from"./styled.js";var y=function(y){var h,b,g=y.source,P=y.thumbnail,j=y.height,L=y.className,C=y.withProgressBar,A=void 0===C||C,k=y.hasAudioControl,T=y.muted,I=y.onLoadedData,D=y.autoPlay,z=y.isActive,B=void 0===z||z,N=y.lazyLoad,w=void 0!==N&&N,x=t(y,["source","thumbnail","height","className","withProgressBar","hasAudioControl","muted","onLoadedData","autoPlay","isActive","lazyLoad"]),E=r(null),H=e(!0),M=H[0],O=H[1],V=e(!1),_=V[0],q=V[1],F=e(!!D||T),S=F[0],U=F[1],G=e(0),J=G[0],K=G[1],Q=e(!1),R=Q[0],W=Q[1],X=e(!1),Y=X[0],Z=X[1],$=e(!w||B),tt=$[0],ot=$[1],rt=r(null),et=r(!1),nt=J>0,it=(null===(h=E.current)||void 0===h?void 0:h.duration)?J/E.current.duration:0,at=J===(null===(b=null==E?void 0:E.current)||void 0===b?void 0:b.duration)||0===J,ut=!w||B||tt,ct=!D||!ut?P:void 0;n((function(){B&&!tt&&ot(!0)}),[B,tt]),n((function(){var t=E.current;t&&ut&&rt.current!==g&&(rt.current=g,et.current=!1,Z(!1),O(!0),t.load())}),[g,ut]),n((function(){var t=E.current;t&&(B&&D&&Y?t.paused&&!et.current&&(et.current=!0,t.muted=!0,U(!0),t.play().then((function(){q(!0)})).catch((function(t){"AbortError"!==t.name&&console.debug("Autoplay blocked, user can tap to play")}))):B||(et.current=!1,t.pause(),q(!1)))}),[B,D,Y]);return a(d,o({className:L},{children:[!M&&A&&u(s,{progress:it,hide:at},void 0),_?u(l,{"data-testid":"pause",onClick:function(){E.current&&_&&(E.current.pause(),q(!1))}},void 0):u(m,o({"data-testid":"play",onClick:function(){E.current&&!R&&(W(!0),E.current.muted=!0,U(!0),E.current.play().then((function(){q(!0)})).catch((function(t){console.debug("Play failed:",t.name)})).finally((function(){return W(!1)})))}},{children:nt&&u(p,{},void 0)}),void 0),k&&a(f,o({onClick:function(){E.current&&U((function(t){return!t}))}},{children:[S&&u(c,{name:"custom/sound_off",testId:"sound-off-icon"},void 0),!S&&u(c,{name:"custom/sound_on",testId:"sound-on-icon"},void 0)]}),void 0),i(v,o({},x,{key:g,autoPlay:D&&B&&ut,muted:!!D||S,"data-testid":"video",poster:ct,playsInline:!0,controls:!1,ref:E,onTimeUpdate:function(){if(E.current){var t=E.current.currentTime;requestAnimationFrame((function(){return K(t)}))}},onCanPlay:function(){return O(!1)},onCanPlayThrough:function(t){if(Z(!0),D&&B&&!et.current){et.current=!0;var o=t.currentTarget;o.muted=!0,o.play().catch((function(t){"AbortError"!==t.name&&console.debug("Autoplay blocked, user can tap to play")}))}},onLoadedData:function(t){I&&I(t),O(!1)},onPause:function(){return q(!1)},onPlaying:function(){return q(!0)},height:j||"auto",preload:ut?D?"auto":"metadata":"none"}),u("track",{kind:"captions"},void 0),ut&&u("source",{src:g},void 0))]}),void 0)};export{y as Video};
|
|
2
2
|
//# sourceMappingURL=Video.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react"),t=require("react/jsx-runtime");require("../../../core/theme/Theme.js"),require("../../../types/enums.js"),require("../../pricing/clubOffer/ClubOfferTag.js"),require("../../pricing/discount/styled.js"),require("../../pricing/styles.js"),require("../../tooltip/Styled.js"),require("../../atoms/PriceLabel/PriceLabel.js"),require("../../atoms/ClubPriceMemberLabel/ClubPriceMemberLabel.styled.js"),require("../../atoms/HorizontalDivider/HorizontalDivider.js");var n=require("../../atoms/Icon/Icon.js");require("../../atoms/Image/styled.js"),require("../../atoms/PriceLabelV2/PriceLabelV2.js"),require("../../atoms/Toggle/toggle.styled.js");var o=require("./components/ProgressBar.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react"),t=require("react/jsx-runtime");require("../../../core/theme/Theme.js"),require("../../../types/enums.js"),require("../../pricing/clubOffer/ClubOfferTag.js"),require("../../pricing/discount/styled.js"),require("../../pricing/styles.js"),require("../../tooltip/Styled.js"),require("../../atoms/PriceLabel/PriceLabel.js"),require("../../atoms/ClubPriceMemberLabel/ClubPriceMemberLabel.styled.js"),require("../../atoms/HorizontalDivider/HorizontalDivider.js");var n=require("../../atoms/Icon/Icon.js");require("../../atoms/Image/styled.js"),require("../../atoms/PriceLabelV2/PriceLabelV2.js"),require("../../atoms/Toggle/toggle.styled.js");var o=require("./components/ProgressBar.js"),u=require("./styled.js");exports.Video=function(a){var i,s,c=a.source,l=a.thumbnail,d=a.height,f=a.className,m=a.withProgressBar,v=void 0===m||m,y=a.hasAudioControl,p=a.muted,g=a.onLoadedData,j=a.autoPlay,h=a.isActive,b=void 0===h||h,P=a.lazyLoad,q=void 0!==P&&P,_=e.__rest(a,["source","thumbnail","height","className","withProgressBar","hasAudioControl","muted","onLoadedData","autoPlay","isActive","lazyLoad"]),x=r.useRef(null),C=r.useState(!0),L=C[0],A=C[1],I=r.useState(!1),k=I[0],S=I[1],T=r.useState(!!j||p),E=T[0],B=T[1],D=r.useState(0),M=D[0],z=D[1],V=r.useState(!1),H=V[0],N=V[1],O=r.useState(!1),R=O[0],w=O[1],F=r.useState(!q||b),U=F[0],G=F[1],J=r.useRef(null),K=r.useRef(!1),Q=M>0,W=(null===(i=x.current)||void 0===i?void 0:i.duration)?M/x.current.duration:0,X=M===(null===(s=null==x?void 0:x.current)||void 0===s?void 0:s.duration)||0===M,Y=!q||b||U,Z=!j||!Y?l:void 0;r.useEffect((function(){b&&!U&&G(!0)}),[b,U]),r.useEffect((function(){var e=x.current;e&&Y&&J.current!==c&&(J.current=c,K.current=!1,w(!1),A(!0),e.load())}),[c,Y]),r.useEffect((function(){var e=x.current;e&&(b&&j&&R?e.paused&&!K.current&&(K.current=!0,e.muted=!0,B(!0),e.play().then((function(){S(!0)})).catch((function(e){"AbortError"!==e.name&&console.debug("Autoplay blocked, user can tap to play")}))):b||(K.current=!1,e.pause(),S(!1)))}),[b,j,R]);return t.jsxs(u.Container,e.__assign({className:f},{children:[!L&&v&&t.jsx(o.ProgressBar,{progress:W,hide:X},void 0),k?t.jsx(u.PauseContainer,{"data-testid":"pause",onClick:function(){x.current&&k&&(x.current.pause(),S(!1))}},void 0):t.jsx(u.PlayContainer,e.__assign({"data-testid":"play",onClick:function(){x.current&&!H&&(N(!0),x.current.muted=!0,B(!0),x.current.play().then((function(){S(!0)})).catch((function(e){console.debug("Play failed:",e.name)})).finally((function(){return N(!1)})))}},{children:Q&&t.jsx(u.PlayIcon,{},void 0)}),void 0),y&&t.jsxs(u.MuteButton,e.__assign({onClick:function(){x.current&&B((function(e){return!e}))}},{children:[E&&t.jsx(n.Icon,{name:"custom/sound_off",testId:"sound-off-icon"},void 0),!E&&t.jsx(n.Icon,{name:"custom/sound_on",testId:"sound-on-icon"},void 0)]}),void 0),r.createElement(u.HTMLVideo,e.__assign({},_,{key:c,autoPlay:j&&b&&Y,muted:!!j||E,"data-testid":"video",poster:Z,playsInline:!0,controls:!1,ref:x,onTimeUpdate:function(){if(x.current){var e=x.current.currentTime;requestAnimationFrame((function(){return z(e)}))}},onCanPlay:function(){return A(!1)},onCanPlayThrough:function(e){if(w(!0),j&&b&&!K.current){K.current=!0;var r=e.currentTarget;r.muted=!0,r.play().catch((function(e){"AbortError"!==e.name&&console.debug("Autoplay blocked, user can tap to play")}))}},onLoadedData:function(e){g&&g(e),A(!1)},onPause:function(){return S(!1)},onPlaying:function(){return S(!0)},height:d||"auto",preload:Y?j?"auto":"metadata":"none"}),t.jsx("track",{kind:"captions"},void 0),Y&&t.jsx("source",{src:c},void 0))]}),void 0)};
|
|
2
2
|
//# sourceMappingURL=Video.js.map
|
package/package.json
CHANGED