@trafilea/afrodita-components 7.22.2 → 7.22.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,2 +1,2 @@
|
|
|
1
|
-
import{__rest as o,__assign as t}from"tslib";import{useRef as r,useState as
|
|
1
|
+
import{__rest as o,__assign as t}from"tslib";import{useRef as r,useState as n,useEffect as e,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,PlayContainer as l,PlayIcon as m,PauseContainer as f,MuteButton as p,HTMLVideo as v}from"./styled.js";var h=function(h){var y,g,j=h.source,P=h.thumbnail,b=h.height,C=h.className,L=h.withProgressBar,A=void 0===L||L,k=h.hasAudioControl,I=h.muted,T=h.onLoadedData,D=h.autoPlay,N=h.isActive,w=void 0===N||N,B=o(h,["source","thumbnail","height","className","withProgressBar","hasAudioControl","muted","onLoadedData","autoPlay","isActive"]),x=r(null),z=n(!0),E=z[0],H=z[1],M=n(!1),O=M[0],V=M[1],_=n(!!D||I),q=_[0],F=_[1],S=n(0),U=S[0],G=S[1],J=n(!1),K=J[0],Q=J[1],R=n(!1),W=R[0],X=R[1],Y=n(!1),Z=Y[0],$=Y[1],oo=U>0,to=(null===(y=x.current)||void 0===y?void 0:y.duration)?U/x.current.duration:0,ro=U===(null===(g=null==x?void 0:x.current)||void 0===g?void 0:g.duration)||0===U,no=D?void 0:P;e((function(){$(!1)}),[j]),e((function(){var o=x.current;o&&o.load()}),[j,no]),e((function(){var o=x.current;if(o)if(w&&D&&Z){o.muted=!0,F(!0);var t=o.play();void 0!==t&&t.then((function(){V(!0)})).catch((function(o){"NotAllowedError"===o.name&&X(!0)}))}else w||(o.pause(),V(!1))}),[w,D,Z]);return a(d,t({className:C},{children:[!E&&A&&u(s,{progress:to,hide:ro},void 0),O?u(f,{"data-testid":"pause",onClick:function(){x.current&&O&&(x.current.pause(),V(!1))}},void 0):u(l,t({"data-testid":"play",onClick:function(){x.current&&!K&&(Q(!0),x.current.play().then((function(){V(!0)})).catch((function(o){"NotAllowedError"===o.name&&X(!0)})).finally((function(){return Q(!1)})))}},{children:oo&&u(m,{},void 0)}),void 0),k&&a(p,t({onClick:function(){x.current&&F((function(o){return!o}))}},{children:[q&&u(c,{name:"custom/sound_off",testId:"sound-off-icon"},void 0),!q&&u(c,{name:"custom/sound_on",testId:"sound-on-icon"},void 0)]}),void 0),i(v,t({},B,{key:"".concat(j,"-").concat(no||"no-poster"),autoPlay:D&&w,muted:q,"data-testid":"video",poster:no,playsInline:!0,controls:W,ref:x,onTimeUpdate:function(){if(x.current){var o=x.current.currentTime;requestAnimationFrame((function(){return G(o)}))}},onCanPlay:function(){return H(!1)},onCanPlayThrough:function(){return $(!0)},onLoadedData:function(o){T&&T(o),H(!1)},onPause:function(){return V(!1)},onPlaying:function(){return V(!0)},height:b||"auto"}),u("track",{kind:"captions"},void 0),u("source",{src:j},void 0))]}),void 0)};export{h 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"),i=require("./styled.js");exports.Video=function(s){var u,a,c=s.source,d=s.thumbnail,l=s.height,f=s.className,m=s.withProgressBar,v=void 0===m||m,j=s.hasAudioControl,
|
|
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"),i=require("./styled.js");exports.Video=function(s){var u,a,c=s.source,d=s.thumbnail,l=s.height,f=s.className,m=s.withProgressBar,v=void 0===m||m,j=s.hasAudioControl,h=s.muted,g=s.onLoadedData,y=s.autoPlay,p=s.isActive,P=void 0===p||p,q=e.__rest(s,["source","thumbnail","height","className","withProgressBar","hasAudioControl","muted","onLoadedData","autoPlay","isActive"]),b=r.useRef(null),_=r.useState(!0),x=_[0],C=_[1],L=r.useState(!1),I=L[0],S=L[1],A=r.useState(!!y||h),T=A[0],k=A[1],E=r.useState(0),B=E[0],D=E[1],M=r.useState(!1),N=M[0],w=M[1],V=r.useState(!1),H=V[0],O=V[1],z=r.useState(!1),F=z[0],R=z[1],U=B>0,G=(null===(u=b.current)||void 0===u?void 0:u.duration)?B/b.current.duration:0,J=B===(null===(a=null==b?void 0:b.current)||void 0===a?void 0:a.duration)||0===B,K=y?void 0:d;r.useEffect((function(){R(!1)}),[c]),r.useEffect((function(){var e=b.current;e&&e.load()}),[c,K]),r.useEffect((function(){var e=b.current;if(e)if(P&&y&&F){e.muted=!0,k(!0);var r=e.play();void 0!==r&&r.then((function(){S(!0)})).catch((function(e){"NotAllowedError"===e.name&&O(!0)}))}else P||(e.pause(),S(!1))}),[P,y,F]);return t.jsxs(i.Container,e.__assign({className:f},{children:[!x&&v&&t.jsx(o.ProgressBar,{progress:G,hide:J},void 0),I?t.jsx(i.PauseContainer,{"data-testid":"pause",onClick:function(){b.current&&I&&(b.current.pause(),S(!1))}},void 0):t.jsx(i.PlayContainer,e.__assign({"data-testid":"play",onClick:function(){b.current&&!N&&(w(!0),b.current.play().then((function(){S(!0)})).catch((function(e){"NotAllowedError"===e.name&&O(!0)})).finally((function(){return w(!1)})))}},{children:U&&t.jsx(i.PlayIcon,{},void 0)}),void 0),j&&t.jsxs(i.MuteButton,e.__assign({onClick:function(){b.current&&k((function(e){return!e}))}},{children:[T&&t.jsx(n.Icon,{name:"custom/sound_off",testId:"sound-off-icon"},void 0),!T&&t.jsx(n.Icon,{name:"custom/sound_on",testId:"sound-on-icon"},void 0)]}),void 0),r.createElement(i.HTMLVideo,e.__assign({},q,{key:"".concat(c,"-").concat(K||"no-poster"),autoPlay:y&&P,muted:T,"data-testid":"video",poster:K,playsInline:!0,controls:H,ref:b,onTimeUpdate:function(){if(b.current){var e=b.current.currentTime;requestAnimationFrame((function(){return D(e)}))}},onCanPlay:function(){return C(!1)},onCanPlayThrough:function(){return R(!0)},onLoadedData:function(e){g&&g(e),C(!1)},onPause:function(){return S(!1)},onPlaying:function(){return S(!0)},height:l||"auto"}),t.jsx("track",{kind:"captions"},void 0),t.jsx("source",{src:c},void 0))]}),void 0)};
|
|
2
2
|
//# sourceMappingURL=Video.js.map
|
package/package.json
CHANGED