@trafilea/afrodita-components 6.51.5 → 6.51.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.
- package/build/index.d.ts +1 -2
- package/build/index.esm.js +21 -20
- package/build/index.esm.js.map +1 -1
- package/build/index.js +21 -20
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -2714,12 +2714,11 @@ declare type SpinnerProps = {
|
|
|
2714
2714
|
declare const Spinner: React.FC<SpinnerProps>;
|
|
2715
2715
|
|
|
2716
2716
|
declare type VideoProps = {
|
|
2717
|
-
thumbnail: string;
|
|
2718
2717
|
source: string;
|
|
2718
|
+
thumbnail?: string;
|
|
2719
2719
|
height?: string;
|
|
2720
2720
|
hasAudioControl?: boolean;
|
|
2721
2721
|
withProgressBar?: boolean;
|
|
2722
|
-
isSlideActive?: boolean;
|
|
2723
2722
|
} & DetailedHTMLProps<VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
|
|
2724
2723
|
declare const Video: React.FC<VideoProps>;
|
|
2725
2724
|
|
package/build/index.esm.js
CHANGED
|
@@ -7064,28 +7064,23 @@ var ProgressBar$1 = function (_a) {
|
|
|
7064
7064
|
var Container$17 = newStyled.div(templateObject_1$1F || (templateObject_1$1F = __makeTemplateObject(["\n max-width: 530px;\n position: relative;\n"], ["\n max-width: 530px;\n position: relative;\n"])));
|
|
7065
7065
|
var HTMLVideo = newStyled.video(templateObject_2$1j || (templateObject_2$1j = __makeTemplateObject(["\n width: 100%;\n max-width: 530px;\n height: ", ";\n"], ["\n width: 100%;\n max-width: 530px;\n height: ", ";\n"])), function (props) { return props.height; });
|
|
7066
7066
|
var PlayIcon = newStyled(Icon.PDP.PlayVideo)(templateObject_3$14 || (templateObject_3$14 = __makeTemplateObject(["\n width: 120px;\n height: 120px;\n\n @media (max-width: 768px) {\n width: 80px;\n height: 80px;\n }\n"], ["\n width: 120px;\n height: 120px;\n\n @media (max-width: 768px) {\n width: 80px;\n height: 80px;\n }\n"])));
|
|
7067
|
-
var PlayContainer = newStyled.div(templateObject_4$T || (templateObject_4$T = __makeTemplateObject(["\n z-index: 1;\n width: 100%;\n height: 100%;\n display: flex;\n position: absolute;\n align-items: center;\n justify-content: center;\n"], ["\n z-index: 1;\n width: 100%;\n height: 100%;\n display: flex;\n position: absolute;\n align-items: center;\n justify-content: center;\n"])));
|
|
7067
|
+
var PlayContainer = newStyled.div(templateObject_4$T || (templateObject_4$T = __makeTemplateObject(["\n z-index: 1;\n width: 100%;\n height: 100%;\n display: flex;\n position: absolute;\n align-items: center;\n justify-content: center;\n\n &:hover {\n cursor: pointer;\n }\n"], ["\n z-index: 1;\n width: 100%;\n height: 100%;\n display: flex;\n position: absolute;\n align-items: center;\n justify-content: center;\n\n &:hover {\n cursor: pointer;\n }\n"])));
|
|
7068
7068
|
var PauseContainer = newStyled.div(templateObject_5$K || (templateObject_5$K = __makeTemplateObject(["\n z-index: 1;\n width: 100%;\n height: 100%;\n position: absolute;\n"], ["\n z-index: 1;\n width: 100%;\n height: 100%;\n position: absolute;\n"])));
|
|
7069
7069
|
var MuteButton = newStyled.button(templateObject_6$C || (templateObject_6$C = __makeTemplateObject(["\n position: absolute;\n background: transparent;\n border: none;\n bottom: 21px;\n right: 23px;\n z-index: 2;\n cursor: pointer;\n"], ["\n position: absolute;\n background: transparent;\n border: none;\n bottom: 21px;\n right: 23px;\n z-index: 2;\n cursor: pointer;\n"])));
|
|
7070
7070
|
var templateObject_1$1F, templateObject_2$1j, templateObject_3$14, templateObject_4$T, templateObject_5$K, templateObject_6$C;
|
|
7071
7071
|
|
|
7072
7072
|
var Video$1 = function (_a) {
|
|
7073
|
-
var _b, _c
|
|
7074
|
-
var source = _a.source, thumbnail = _a.thumbnail, height = _a.height, className = _a.className,
|
|
7073
|
+
var _b, _c;
|
|
7074
|
+
var source = _a.source, thumbnail = _a.thumbnail, height = _a.height, className = _a.className, _d = _a.withProgressBar, withProgressBar = _d === void 0 ? true : _d, hasAudioControl = _a.hasAudioControl, muted = _a.muted, onLoadedData = _a.onLoadedData, rest = __rest(_a, ["source", "thumbnail", "height", "className", "withProgressBar", "hasAudioControl", "muted", "onLoadedData"]);
|
|
7075
7075
|
var videoRef = useRef(null);
|
|
7076
|
-
var
|
|
7077
|
-
var
|
|
7078
|
-
var
|
|
7079
|
-
var
|
|
7080
|
-
var
|
|
7076
|
+
var _e = useState(true), isLoading = _e[0], setIsLoading = _e[1];
|
|
7077
|
+
var _f = useState(false), isPlaying = _f[0], setIsPlaying = _f[1];
|
|
7078
|
+
var _g = useState(muted), isMuted = _g[0], setIsMuted = _g[1];
|
|
7079
|
+
var _h = useState(0), videoProgress = _h[0], setVideoProgress = _h[1];
|
|
7080
|
+
var _j = useState(false), debouncePlay = _j[0], setDebouncePlay = _j[1];
|
|
7081
7081
|
var isStarted = videoProgress > 0;
|
|
7082
|
-
var progress =
|
|
7083
|
-
var hideProgressBar = videoProgress === ((
|
|
7084
|
-
if (isSlideActive !== undefined) {
|
|
7085
|
-
if (!isMuted && !isSlideActive && videoRef.current) {
|
|
7086
|
-
setIsMuted(true);
|
|
7087
|
-
}
|
|
7088
|
-
}
|
|
7082
|
+
var progress = ((_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.duration) ? videoProgress / videoRef.current.duration : 0;
|
|
7083
|
+
var hideProgressBar = videoProgress === ((_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) || videoProgress === 0;
|
|
7089
7084
|
var handlePlayClick = function () {
|
|
7090
7085
|
if (videoRef.current && !debouncePlay) {
|
|
7091
7086
|
setDebouncePlay(true);
|
|
@@ -7093,12 +7088,11 @@ var Video$1 = function (_a) {
|
|
|
7093
7088
|
.play()
|
|
7094
7089
|
.then(function () {
|
|
7095
7090
|
setIsPlaying(true);
|
|
7096
|
-
setDebouncePlay(false);
|
|
7097
7091
|
})
|
|
7098
7092
|
.catch(function (error) {
|
|
7099
7093
|
console.error('Error playing video:', error);
|
|
7100
|
-
|
|
7101
|
-
|
|
7094
|
+
})
|
|
7095
|
+
.finally(function () { return setDebouncePlay(false); });
|
|
7102
7096
|
}
|
|
7103
7097
|
};
|
|
7104
7098
|
var handlePauseClick = function () {
|
|
@@ -7114,10 +7108,17 @@ var Video$1 = function (_a) {
|
|
|
7114
7108
|
};
|
|
7115
7109
|
var onTimeUpdate = function () {
|
|
7116
7110
|
if (videoRef.current) {
|
|
7117
|
-
|
|
7111
|
+
var currentTime_1 = videoRef.current.currentTime;
|
|
7112
|
+
requestAnimationFrame(function () { return setVideoProgress(currentTime_1); });
|
|
7113
|
+
}
|
|
7114
|
+
};
|
|
7115
|
+
var handleOnloadedData = function (event) {
|
|
7116
|
+
if (onLoadedData) {
|
|
7117
|
+
onLoadedData(event);
|
|
7118
7118
|
}
|
|
7119
|
+
setIsLoading(false);
|
|
7119
7120
|
};
|
|
7120
|
-
return (jsxs$1(Container$17, __assign$1({ className: className }, { children: [!isLoading && withProgressBar && jsx$1(ProgressBar$1, { progress: progress, hide: hideProgressBar }, void 0), !isPlaying ? (jsx$1(PlayContainer, __assign$1({ "data-testid": "play", onClick: handlePlayClick }, { children: isStarted && jsx$1(PlayIcon, {}, void 0) }), void 0)) : (jsx$1(PauseContainer, { "data-testid": "pause", onClick: handlePauseClick }, void 0)), hasAudioControl && (jsxs$1(MuteButton, __assign$1({ onClick: handleMuteToggle }, { children: [isMuted && jsx$1(Icon$1, { name: "custom/sound_off" }, void 0), !isMuted && jsx$1(Icon$1, { name: "custom/sound_on" }, void 0)] }), void 0)), jsxs$1(HTMLVideo, __assign$1({}, rest, { muted: isMuted, "data-testid": "video", poster: thumbnail, playsInline: true, ref: videoRef, onTimeUpdate: onTimeUpdate, onCanPlay: function () { return setIsLoading(false); }, onLoadedData:
|
|
7121
|
+
return (jsxs$1(Container$17, __assign$1({ className: className }, { children: [!isLoading && withProgressBar && jsx$1(ProgressBar$1, { progress: progress, hide: hideProgressBar }, void 0), !isPlaying ? (jsx$1(PlayContainer, __assign$1({ "data-testid": "play", onClick: handlePlayClick }, { children: isStarted && jsx$1(PlayIcon, {}, void 0) }), void 0)) : (jsx$1(PauseContainer, { "data-testid": "pause", onClick: handlePauseClick }, void 0)), hasAudioControl && (jsxs$1(MuteButton, __assign$1({ onClick: handleMuteToggle }, { children: [isMuted && jsx$1(Icon$1, { name: "custom/sound_off", testId: "sound-off-icon" }, void 0), !isMuted && jsx$1(Icon$1, { name: "custom/sound_on", testId: "sound-on-icon" }, void 0)] }), void 0)), jsxs$1(HTMLVideo, __assign$1({}, rest, { muted: isMuted, "data-testid": "video", poster: thumbnail, playsInline: true, ref: videoRef, onTimeUpdate: onTimeUpdate, onCanPlay: function () { return setIsLoading(false); }, onLoadedData: handleOnloadedData, onPause: function () { return setIsPlaying(false); }, onPlaying: function () { return setIsPlaying(true); }, height: height || 'auto' }, { children: [jsx$1("track", { kind: "captions" }, void 0), jsx$1("source", { src: source }, void 0)] }), void 0)] }), void 0));
|
|
7121
7122
|
};
|
|
7122
7123
|
|
|
7123
7124
|
var LikeCount = newStyled.span(templateObject_1$1E || (templateObject_1$1E = __makeTemplateObject(["\n font-size: 14px;\n line-height: 22px;\n color: ", ";\n font-weight: 600;\n\n &.like-count {\n transition: color 0.2s ease;\n }\n"], ["\n font-size: 14px;\n line-height: 22px;\n color: ", ";\n font-weight: 600;\n\n &.like-count {\n transition: color 0.2s ease;\n }\n"])), function (_a) {
|