analytica-frontend-lib 1.1.56 → 1.1.58

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.
@@ -1563,6 +1563,8 @@ var CardAudio = (0, import_react.forwardRef)(
1563
1563
  const [showSpeedMenu, setShowSpeedMenu] = (0, import_react.useState)(false);
1564
1564
  const [playbackRate, setPlaybackRate] = (0, import_react.useState)(1);
1565
1565
  const audioRef = (0, import_react.useRef)(null);
1566
+ const volumeControlRef = (0, import_react.useRef)(null);
1567
+ const speedMenuRef = (0, import_react.useRef)(null);
1566
1568
  const formatTime = (time) => {
1567
1569
  const minutes = Math.floor(time / 60);
1568
1570
  const seconds = Math.floor(time % 60);
@@ -1614,9 +1616,11 @@ var CardAudio = (0, import_react.forwardRef)(
1614
1616
  };
1615
1617
  const toggleVolumeControl = () => {
1616
1618
  setShowVolumeControl(!showVolumeControl);
1619
+ setShowSpeedMenu(false);
1617
1620
  };
1618
1621
  const toggleSpeedMenu = () => {
1619
1622
  setShowSpeedMenu(!showSpeedMenu);
1623
+ setShowVolumeControl(false);
1620
1624
  };
1621
1625
  const handleSpeedChange = (speed) => {
1622
1626
  setPlaybackRate(speed);
@@ -1634,6 +1638,20 @@ var CardAudio = (0, import_react.forwardRef)(
1634
1638
  }
1635
1639
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react2.SpeakerHigh, { size: 24 });
1636
1640
  };
1641
+ (0, import_react.useEffect)(() => {
1642
+ const handleClickOutside = (event) => {
1643
+ if (volumeControlRef.current && !volumeControlRef.current.contains(event.target)) {
1644
+ setShowVolumeControl(false);
1645
+ }
1646
+ if (speedMenuRef.current && !speedMenuRef.current.contains(event.target)) {
1647
+ setShowSpeedMenu(false);
1648
+ }
1649
+ };
1650
+ document.addEventListener("mousedown", handleClickOutside);
1651
+ return () => {
1652
+ document.removeEventListener("mousedown", handleClickOutside);
1653
+ };
1654
+ }, []);
1637
1655
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1638
1656
  CardBase,
1639
1657
  {
@@ -1722,7 +1740,7 @@ var CardAudio = (0, import_react.forwardRef)(
1722
1740
  }
1723
1741
  ) }),
1724
1742
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-text-800 text-md font-medium min-w-[2.5rem]", children: formatTime(duration) }),
1725
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative h-6", children: [
1743
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative h-6", ref: volumeControlRef, children: [
1726
1744
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1727
1745
  "button",
1728
1746
  {
@@ -1784,7 +1802,7 @@ var CardAudio = (0, import_react.forwardRef)(
1784
1802
  }
1785
1803
  )
1786
1804
  ] }),
1787
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative h-6", children: [
1805
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative h-6", ref: speedMenuRef, children: [
1788
1806
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1789
1807
  "button",
1790
1808
  {