@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 o,__assign as t}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 f,MuteButton as p,HTMLVideo as v}from"./styled.js";var y=function(y){var h,g,b=y.source,P=y.thumbnail,j=y.height,L=y.className,C=y.withProgressBar,k=void 0===C||C,A=y.hasAudioControl,I=y.muted,T=y.onLoadedData,D=y.autoPlay,z=y.isActive,B=void 0===z||z,N=y.lazyLoad,w=void 0!==N&&N,x=o(y,["source","thumbnail","height","className","withProgressBar","hasAudioControl","muted","onLoadedData","autoPlay","isActive","lazyLoad"]),H=r(null),M=e(!0),O=M[0],V=M[1],_=e(!1),q=_[0],E=_[1],F=e(!!D||I),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),oo=$[0],to=$[1],ro=r(null),eo=J>0,no=(null===(h=H.current)||void 0===h?void 0:h.duration)?J/H.current.duration:0,io=J===(null===(g=null==H?void 0:H.current)||void 0===g?void 0:g.duration)||0===J,ao=!w||B||oo,uo=!D||!ao?P:void 0;n((function(){B&&!oo&&to(!0)}),[B,oo]),n((function(){var o=H.current;o&&ao&&ro.current!==b&&(ro.current=b,Z(!1),V(!0),o.load())}),[b,ao]),n((function(){var o=H.current;if(o)if(B&&D&&Y){if(o.muted=!0,U(!0),o.paused){var t=o.play();void 0!==t&&t.then((function(){E(!0)})).catch((function(o){"AbortError"!==o.name&&console.debug("Autoplay blocked, user can tap to play")}))}}else B||(o.pause(),E(!1))}),[B,D,Y]);return a(d,t({className:L},{children:[!O&&k&&u(s,{progress:no,hide:io},void 0),q?u(l,{"data-testid":"pause",onClick:function(){H.current&&q&&(H.current.pause(),E(!1))}},void 0):u(m,t({"data-testid":"play",onClick:function(){H.current&&!R&&(W(!0),H.current.muted=!0,U(!0),H.current.play().then((function(){E(!0)})).catch((function(o){console.debug("Play failed:",o.name)})).finally((function(){return W(!1)})))}},{children:eo&&u(f,{},void 0)}),void 0),A&&a(p,t({onClick:function(){H.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:b,autoPlay:D&&B&&ao,muted:!!D||S,"data-testid":"video",poster:uo,playsInline:!0,controls:!1,ref:H,onTimeUpdate:function(){if(H.current){var o=H.current.currentTime;requestAnimationFrame((function(){return K(o)}))}},onCanPlay:function(){return V(!1)},onCanPlayThrough:function(){return Z(!0)},onLoadedData:function(o){T&&T(o),V(!1)},onPause:function(){return E(!1)},onPlaying:function(){return E(!0)},height:j||"auto",preload:ao?D?"auto":"metadata":"none"}),u("track",{kind:"captions"},void 0),ao&&u("source",{src:b},void 0))]}),void 0)};export{y 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,y=u.hasAudioControl,j=u.muted,g=u.onLoadedData,p=u.autoPlay,h=u.isActive,P=void 0===h||h,b=u.lazyLoad,q=void 0!==b&&b,_=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),k=S[0],A=S[1],T=r.useState(!!p||j),B=T[0],D=T[1],E=r.useState(0),M=E[0],z=E[1],V=r.useState(!1),H=V[0],N=V[1],O=r.useState(!1),w=O[0],R=O[1],F=r.useState(!q||P),U=F[0],G=F[1],J=r.useRef(null),K=M>0,Q=(null===(a=x.current)||void 0===a?void 0:a.duration)?M/x.current.duration:0,W=M===(null===(s=null==x?void 0:x.current)||void 0===s?void 0:s.duration)||0===M,X=!q||P||U,Y=!p||!X?d:void 0;r.useEffect((function(){P&&!U&&G(!0)}),[P,U]),r.useEffect((function(){var e=x.current;e&&X&&J.current!==c&&(J.current=c,R(!1),I(!0),e.load())}),[c,X]),r.useEffect((function(){var e=x.current;if(e)if(P&&p&&w){if(e.muted=!0,D(!0),e.paused){var r=e.play();void 0!==r&&r.then((function(){A(!0)})).catch((function(e){"AbortError"!==e.name&&console.debug("Autoplay blocked, user can tap to play")}))}}else P||(e.pause(),A(!1))}),[P,p,w]);return t.jsxs(i.Container,e.__assign({className:f},{children:[!L&&v&&t.jsx(o.ProgressBar,{progress:Q,hide:W},void 0),k?t.jsx(i.PauseContainer,{"data-testid":"pause",onClick:function(){x.current&&k&&(x.current.pause(),A(!1))}},void 0):t.jsx(i.PlayContainer,e.__assign({"data-testid":"play",onClick:function(){x.current&&!H&&(N(!0),x.current.muted=!0,D(!0),x.current.play().then((function(){A(!0)})).catch((function(e){console.debug("Play failed:",e.name)})).finally((function(){return N(!1)})))}},{children:K&&t.jsx(i.PlayIcon,{},void 0)}),void 0),y&&t.jsxs(i.MuteButton,e.__assign({onClick:function(){x.current&&D((function(e){return!e}))}},{children:[B&&t.jsx(n.Icon,{name:"custom/sound_off",testId:"sound-off-icon"},void 0),!B&&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:p&&P&&X,muted:!!p||B,"data-testid":"video",poster:Y,playsInline:!0,controls:!1,ref:x,onTimeUpdate:function(){if(x.current){var e=x.current.currentTime;requestAnimationFrame((function(){return z(e)}))}},onCanPlay:function(){return I(!1)},onCanPlayThrough:function(){return R(!0)},onLoadedData:function(e){g&&g(e),I(!1)},onPause:function(){return A(!1)},onPlaying:function(){return A(!0)},height:l||"auto",preload:X?p?"auto":"metadata":"none"}),t.jsx("track",{kind:"captions"},void 0),X&&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.5",
6
+ "version": "7.24.6",
7
7
  "private": false,
8
8
  "main": "build/lib/index.js",
9
9
  "style": "build/es/index.css",