analytica-frontend-lib 1.1.50 → 1.1.51

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.mjs CHANGED
@@ -7118,6 +7118,7 @@ import {
7118
7118
  useEffect as useEffect13,
7119
7119
  useCallback as useCallback2
7120
7120
  } from "react";
7121
+ import { createPortal } from "react-dom";
7121
7122
  import {
7122
7123
  Play as Play2,
7123
7124
  Pause,
@@ -7193,30 +7194,63 @@ var SpeedMenu = ({
7193
7194
  showSpeedMenu,
7194
7195
  playbackRate,
7195
7196
  onToggleMenu,
7196
- onSpeedChange
7197
- }) => /* @__PURE__ */ jsxs31("div", { className: "relative", children: [
7198
- /* @__PURE__ */ jsx37(
7199
- IconButton_default,
7197
+ onSpeedChange,
7198
+ isFullscreen
7199
+ }) => {
7200
+ const buttonRef = useRef10(null);
7201
+ const getMenuPosition = () => {
7202
+ if (!buttonRef.current) return { top: 0, left: 0 };
7203
+ const rect = buttonRef.current.getBoundingClientRect();
7204
+ return {
7205
+ // Fixed coords are viewport-based — no scroll offsets.
7206
+ top: Math.max(8, rect.top - 180),
7207
+ left: Math.max(8, rect.right - 80)
7208
+ };
7209
+ };
7210
+ const position = getMenuPosition();
7211
+ const menuContent = /* @__PURE__ */ jsx37(
7212
+ "div",
7200
7213
  {
7201
- icon: /* @__PURE__ */ jsx37(DotsThreeVertical2, { size: 24 }),
7202
- onClick: onToggleMenu,
7214
+ role: "menu",
7203
7215
  "aria-label": "Playback speed",
7204
- className: "!bg-transparent !text-white hover:!bg-white/20"
7216
+ className: isFullscreen ? "absolute bottom-12 right-0 bg-black/90 rounded-lg p-2 min-w-20 z-[9999]" : "fixed bg-black/90 rounded-lg p-2 min-w-20 z-[9999]",
7217
+ style: !isFullscreen ? {
7218
+ top: `${position.top}px`,
7219
+ left: `${position.left}px`
7220
+ } : void 0,
7221
+ children: [0.5, 0.75, 1, 1.25, 1.5, 2].map((speed) => /* @__PURE__ */ jsxs31(
7222
+ "button",
7223
+ {
7224
+ role: "menuitemradio",
7225
+ "aria-checked": playbackRate === speed,
7226
+ onClick: () => onSpeedChange(speed),
7227
+ className: `block w-full text-left px-3 py-1 text-sm rounded hover:bg-white/20 transition-colors ${playbackRate === speed ? "text-primary-400" : "text-white"}`,
7228
+ children: [
7229
+ speed,
7230
+ "x"
7231
+ ]
7232
+ },
7233
+ speed
7234
+ ))
7205
7235
  }
7206
- ),
7207
- showSpeedMenu && /* @__PURE__ */ jsx37("div", { className: "absolute bottom-12 right-0 bg-black/90 rounded-lg p-2 min-w-20", children: [0.5, 0.75, 1, 1.25, 1.5, 2].map((speed) => /* @__PURE__ */ jsxs31(
7208
- "button",
7209
- {
7210
- onClick: () => onSpeedChange(speed),
7211
- className: `block w-full text-left px-3 py-1 text-sm rounded hover:bg-white/20 transition-colors ${playbackRate === speed ? "text-primary-400" : "text-white"}`,
7212
- children: [
7213
- speed,
7214
- "x"
7215
- ]
7216
- },
7217
- speed
7218
- )) })
7219
- ] });
7236
+ );
7237
+ const portalContent = typeof window !== "undefined" && typeof document !== "undefined" ? createPortal(menuContent, document.body) : null;
7238
+ return /* @__PURE__ */ jsxs31("div", { className: "relative", children: [
7239
+ /* @__PURE__ */ jsx37(
7240
+ IconButton_default,
7241
+ {
7242
+ ref: buttonRef,
7243
+ icon: /* @__PURE__ */ jsx37(DotsThreeVertical2, { size: 24 }),
7244
+ onClick: onToggleMenu,
7245
+ "aria-label": "Playback speed",
7246
+ "aria-haspopup": "menu",
7247
+ "aria-expanded": showSpeedMenu,
7248
+ className: "!bg-transparent !text-white hover:!bg-white/20"
7249
+ }
7250
+ ),
7251
+ showSpeedMenu && (isFullscreen ? menuContent : portalContent)
7252
+ ] });
7253
+ };
7220
7254
  var VideoPlayer = ({
7221
7255
  src,
7222
7256
  poster,
@@ -7756,7 +7790,8 @@ var VideoPlayer = ({
7756
7790
  showSpeedMenu,
7757
7791
  playbackRate,
7758
7792
  onToggleMenu: toggleSpeedMenu,
7759
- onSpeedChange: handleSpeedChange
7793
+ onSpeedChange: handleSpeedChange,
7794
+ isFullscreen
7760
7795
  }
7761
7796
  ) })
7762
7797
  ] })