@appquality/unguess-design-system 2.12.63 → 2.12.64

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v2.12.64 (Mon Jan 30 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - refactor(controls): progress update must be attached to any ref change [#193](https://github.com/AppQuality/unguess-design-system/pull/193) ([@cannarocks](https://github.com/cannarocks))
6
+
7
+ #### Authors: 1
8
+
9
+ - Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))
10
+
11
+ ---
12
+
1
13
  # v2.12.62 (Mon Jan 30 2023)
2
14
 
3
15
  #### 🐛 Bug Fix
package/build/index.js CHANGED
@@ -4248,15 +4248,15 @@ const Controls = (props) => {
4248
4248
  }
4249
4249
  return 0;
4250
4250
  };
4251
- const handleProgressUpdate = () => {
4251
+ const handleProgressUpdate = React.useCallback(() => {
4252
4252
  const currentTime = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) || 0;
4253
4253
  setProgress((currentTime / duration) * 100);
4254
- };
4255
- const handleSkipAhead = (pageX) => {
4254
+ }, [duration, videoRef]);
4255
+ const handleSkipAhead = React.useCallback((pageX) => {
4256
4256
  if (videoRef) {
4257
4257
  videoRef.currentTime = getVideoPositionFromEvent(pageX);
4258
4258
  }
4259
- };
4259
+ }, [videoRef]);
4260
4260
  const StyledDiv = styled__default["default"].div `
4261
4261
  display: flex;
4262
4262
  align-items: center;
@@ -4386,6 +4386,10 @@ const Player = React.forwardRef((props, forwardRef) => {
4386
4386
  setIsLoaded(true);
4387
4387
  setDuration(((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) || 0);
4388
4388
  };
4389
+ const handleDuration = React.useCallback(() => {
4390
+ var _a;
4391
+ setDuration(((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) || 0);
4392
+ }, [videoRef]);
4389
4393
  const handlePlayPause = React.useCallback(() => {
4390
4394
  if (!videoRef || !videoRef.current)
4391
4395
  return;
@@ -4424,7 +4428,7 @@ const Player = React.forwardRef((props, forwardRef) => {
4424
4428
  return (jsxRuntime.jsxs(Container, Object.assign({ isLoaded: isLoaded, isPlaying: isPlaying, onClick: (e) => {
4425
4429
  e.stopPropagation();
4426
4430
  handlePlayPause();
4427
- } }, { children: [!isLoaded ? (jsxRuntime.jsx(VideoSpinner, {})) : (jsxRuntime.jsx(FloatingControls, { isPlaying: isPlaying })), jsxRuntime.jsx(Video, Object.assign({ ref: videoRef, onLoadedMetadata: handleLoad, preload: "auto", playsInline: true }, { children: props.children })), jsxRuntime.jsx(Controls, { videoRef: videoRef.current, duration: duration, isPlaying: isPlaying, onPlayChange: (isPlaying) => setIsPlaying(isPlaying) })] })));
4431
+ } }, { children: [!isLoaded ? (jsxRuntime.jsx(VideoSpinner, {})) : (jsxRuntime.jsx(FloatingControls, { isPlaying: isPlaying })), jsxRuntime.jsx(Video, Object.assign({ ref: videoRef, onLoadedMetadata: handleLoad, onLoad: handleDuration, preload: "auto", playsInline: true }, { children: props.children })), jsxRuntime.jsx(Controls, { videoRef: videoRef.current, duration: duration, isPlaying: isPlaying, onPlayChange: (isPlaying) => setIsPlaying(isPlaying) })] })));
4428
4432
  });
4429
4433
 
4430
4434
  var _path$5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appquality/unguess-design-system",
3
- "version": "2.12.63",
3
+ "version": "2.12.64",
4
4
  "dependencies": {
5
5
  "@nivo/bar": "^0.80.0",
6
6
  "@nivo/bullet": "^0.80.0",