analytica-frontend-lib 1.1.11 → 1.1.12

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/dist/index.js CHANGED
@@ -6826,6 +6826,8 @@ var NotFound_default = NotFound;
6826
6826
  var import_react22 = require("react");
6827
6827
  var import_phosphor_react18 = require("phosphor-react");
6828
6828
  var import_jsx_runtime36 = require("react/jsx-runtime");
6829
+ var CONTROLS_HIDE_TIMEOUT = 3e3;
6830
+ var LEAVE_HIDE_TIMEOUT = 1e3;
6829
6831
  var formatTime = (seconds) => {
6830
6832
  if (!seconds || isNaN(seconds)) return "0:00";
6831
6833
  const mins = Math.floor(seconds / 60);
@@ -6945,6 +6947,16 @@ var VideoPlayer = ({
6945
6947
  const controlsTimeoutRef = (0, import_react22.useRef)(null);
6946
6948
  const lastMousePositionRef = (0, import_react22.useRef)({ x: 0, y: 0 });
6947
6949
  const mouseMoveTimeoutRef = (0, import_react22.useRef)(null);
6950
+ const isUserInteracting = (0, import_react22.useCallback)(() => {
6951
+ if (showSpeedMenu) return true;
6952
+ const activeElement = document.activeElement;
6953
+ const videoContainer = videoRef.current?.parentElement;
6954
+ if (activeElement && videoContainer?.contains(activeElement)) {
6955
+ const isControl = activeElement.matches("button, input, [tabindex]");
6956
+ if (isControl) return true;
6957
+ }
6958
+ return false;
6959
+ }, [showSpeedMenu]);
6948
6960
  const clearControlsTimeout = (0, import_react22.useCallback)(() => {
6949
6961
  if (controlsTimeoutRef.current) {
6950
6962
  clearTimeout(controlsTimeoutRef.current);
@@ -6961,12 +6973,11 @@ var VideoPlayer = ({
6961
6973
  setShowControls(true);
6962
6974
  clearControlsTimeout();
6963
6975
  if (isPlaying) {
6964
- const timeout = isFullscreen ? 2e3 : 3e3;
6965
6976
  controlsTimeoutRef.current = window.setTimeout(() => {
6966
6977
  setShowControls(false);
6967
- }, timeout);
6978
+ }, CONTROLS_HIDE_TIMEOUT);
6968
6979
  }
6969
- }, [isPlaying, isFullscreen, clearControlsTimeout]);
6980
+ }, [isPlaying, clearControlsTimeout]);
6970
6981
  const handleMouseMove = (0, import_react22.useCallback)(
6971
6982
  (event) => {
6972
6983
  const currentX = event.clientX;
@@ -6980,6 +6991,14 @@ var VideoPlayer = ({
6980
6991
  },
6981
6992
  [showControlsWithTimer]
6982
6993
  );
6994
+ const handleMouseLeave = (0, import_react22.useCallback)(() => {
6995
+ clearControlsTimeout();
6996
+ if (isPlaying && !isUserInteracting()) {
6997
+ controlsTimeoutRef.current = window.setTimeout(() => {
6998
+ setShowControls(false);
6999
+ }, LEAVE_HIDE_TIMEOUT);
7000
+ }
7001
+ }, [isPlaying, clearControlsTimeout, isUserInteracting]);
6983
7002
  (0, import_react22.useEffect)(() => {
6984
7003
  if (videoRef.current) {
6985
7004
  videoRef.current.volume = volume;
@@ -7280,12 +7299,13 @@ var VideoPlayer = ({
7280
7299
  className: cn(
7281
7300
  "relative w-full bg-background overflow-hidden group",
7282
7301
  title || subtitleText ? "rounded-b-xl" : "rounded-xl",
7283
- // Hide cursor when controls are hidden and video is playing in fullscreen
7284
- isFullscreen && isPlaying && !showControls ? "cursor-none" : "cursor-default"
7302
+ // Hide cursor when controls are hidden and video is playing
7303
+ isPlaying && !showControls ? "cursor-none group-hover:cursor-default" : "cursor-default"
7285
7304
  ),
7286
7305
  "aria-label": title ? `Video player: ${title}` : "Video player",
7287
- onMouseMove: isFullscreen ? handleMouseMove : showControlsWithTimer,
7306
+ onMouseMove: handleMouseMove,
7288
7307
  onMouseEnter: showControlsWithTimer,
7308
+ onMouseLeave: handleMouseLeave,
7289
7309
  children: [
7290
7310
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7291
7311
  "video",