@trafilea/afrodita-components 7.24.4 → 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 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,PauseContainer as l,PlayContainer as m,PlayIcon 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,L=h.className,C=h.withProgressBar,A=void 0===C||C,k=h.hasAudioControl,I=h.muted,T=h.onLoadedData,D=h.autoPlay,N=h.isActive,w=void 0===N||N,z=h.lazyLoad,B=void 0!==z&&z,x=o(h,["source","thumbnail","height","className","withProgressBar","hasAudioControl","muted","onLoadedData","autoPlay","isActive","lazyLoad"]),E=r(null),H=n(!0),M=H[0],O=H[1],V=n(!1),_=V[0],q=V[1],F=n(!!D||I),S=F[0],U=F[1],G=n(0),J=G[0],K=G[1],Q=n(!1),R=Q[0],W=Q[1],X=n(!1),Y=X[0],Z=X[1],$=n(!1),oo=$[0],to=$[1],ro=n(!B||w),no=ro[0],eo=ro[1],io=r(null),ao=J>0,uo=(null===(y=E.current)||void 0===y?void 0:y.duration)?J/E.current.duration:0,co=J===(null===(g=null==E?void 0:E.current)||void 0===g?void 0:g.duration)||0===J,so=!B||no,lo=!D||!so?P:void 0;e((function(){w&&!no&&eo(!0)}),[w,no]),e((function(){var o=E.current;o&&so&&io.current!==j&&(io.current=j,to(!1),O(!0),o.load())}),[j,so]),e((function(){var o=E.current;if(o)if(w&&D&&oo){o.muted=!0,U(!0);var t=o.play();void 0!==t&&t.then((function(){q(!0)})).catch((function(o){"NotAllowedError"===o.name&&Z(!0)}))}else w||(o.pause(),q(!1))}),[w,D,oo]);return a(d,t({className:L},{children:[!M&&A&&u(s,{progress:uo,hide:co},void 0),_?u(l,{"data-testid":"pause",onClick:function(){E.current&&_&&(E.current.pause(),q(!1))}},void 0):u(m,t({"data-testid":"play",onClick:function(){E.current&&!R&&(W(!0),E.current.play().then((function(){q(!0)})).catch((function(o){"NotAllowedError"===o.name&&Z(!0)})).finally((function(){return W(!1)})))}},{children:ao&&u(f,{},void 0)}),void 0),k&&a(p,t({onClick:function(){E.current&&U((function(o){return!o}))}},{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,t({},x,{key:j,autoPlay:D&&w&&so,muted:!!D||S,"data-testid":"video",poster:lo,playsInline:!0,controls:Y,ref:E,onTimeUpdate:function(){if(E.current){var o=E.current.currentTime;requestAnimationFrame((function(){return K(o)}))}},onCanPlay:function(){return O(!1)},onCanPlayThrough:function(){return to(!0)},onLoadedData:function(o){T&&T(o),O(!1)},onPause:function(){return q(!1)},onPlaying:function(){return q(!0)},height:b||"auto",preload:so?D?"auto":"metadata":"none"}),u("track",{kind:"captions"},void 0),so&&u("source",{src:j},void 0))]}),void 0)};export{h as Video};
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"),i=require("./styled.js");exports.Video=function(u){var a,s,c=u.source,d=u.thumbnail,l=u.height,f=u.className,m=u.withProgressBar,v=void 0===m||m,j=u.hasAudioControl,y=u.muted,h=u.onLoadedData,g=u.autoPlay,p=u.isActive,P=void 0===p||p,q=u.lazyLoad,b=void 0!==q&&q,_=e.__rest(u,["source","thumbnail","height","className","withProgressBar","hasAudioControl","muted","onLoadedData","autoPlay","isActive","lazyLoad"]),x=r.useRef(null),C=r.useState(!0),L=C[0],I=C[1],S=r.useState(!1),A=S[0],T=S[1],k=r.useState(!!g||y),E=k[0],B=k[1],D=r.useState(0),M=D[0],N=D[1],w=r.useState(!1),z=w[0],V=w[1],H=r.useState(!1),O=H[0],R=H[1],F=r.useState(!1),U=F[0],G=F[1],J=r.useState(!b||P),K=J[0],Q=J[1],W=r.useRef(null),X=M>0,Y=(null===(a=x.current)||void 0===a?void 0:a.duration)?M/x.current.duration:0,Z=M===(null===(s=null==x?void 0:x.current)||void 0===s?void 0:s.duration)||0===M,$=!b||K,ee=!g||!$?d:void 0;r.useEffect((function(){P&&!K&&Q(!0)}),[P,K]),r.useEffect((function(){var e=x.current;e&&$&&W.current!==c&&(W.current=c,G(!1),I(!0),e.load())}),[c,$]),r.useEffect((function(){var e=x.current;if(e)if(P&&g&&U){e.muted=!0,B(!0);var r=e.play();void 0!==r&&r.then((function(){T(!0)})).catch((function(e){"NotAllowedError"===e.name&&R(!0)}))}else P||(e.pause(),T(!1))}),[P,g,U]);return t.jsxs(i.Container,e.__assign({className:f},{children:[!L&&v&&t.jsx(o.ProgressBar,{progress:Y,hide:Z},void 0),A?t.jsx(i.PauseContainer,{"data-testid":"pause",onClick:function(){x.current&&A&&(x.current.pause(),T(!1))}},void 0):t.jsx(i.PlayContainer,e.__assign({"data-testid":"play",onClick:function(){x.current&&!z&&(V(!0),x.current.play().then((function(){T(!0)})).catch((function(e){"NotAllowedError"===e.name&&R(!0)})).finally((function(){return V(!1)})))}},{children:X&&t.jsx(i.PlayIcon,{},void 0)}),void 0),j&&t.jsxs(i.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(i.HTMLVideo,e.__assign({},_,{key:c,autoPlay:g&&P&&$,muted:!!g||E,"data-testid":"video",poster:ee,playsInline:!0,controls:O,ref:x,onTimeUpdate:function(){if(x.current){var e=x.current.currentTime;requestAnimationFrame((function(){return N(e)}))}},onCanPlay:function(){return I(!1)},onCanPlayThrough:function(){return G(!0)},onLoadedData:function(e){h&&h(e),I(!1)},onPause:function(){return T(!1)},onPlaying:function(){return T(!0)},height:l||"auto",preload:$?g?"auto":"metadata":"none"}),t.jsx("track",{kind:"captions"},void 0),$&&t.jsx("source",{src:c},void 0))]}),void 0)};
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
@@ -3,7 +3,7 @@
3
3
  "description": "Trafilea's Design System",
4
4
  "author": "Trafilea",
5
5
  "repository": "https://github.com/trafilea/afrodita-components",
6
- "version": "7.24.4",
6
+ "version": "7.24.6",
7
7
  "private": false,
8
8
  "main": "build/lib/index.js",
9
9
  "style": "build/es/index.css",