analytica-frontend-lib 1.1.13 → 1.1.14

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.
@@ -1404,6 +1404,8 @@ var CardAudio = (0, import_react.forwardRef)(
1404
1404
  const [duration, setDuration] = (0, import_react.useState)(0);
1405
1405
  const [volume, setVolume] = (0, import_react.useState)(1);
1406
1406
  const [showVolumeControl, setShowVolumeControl] = (0, import_react.useState)(false);
1407
+ const [showSpeedMenu, setShowSpeedMenu] = (0, import_react.useState)(false);
1408
+ const [playbackRate, setPlaybackRate] = (0, import_react.useState)(1);
1407
1409
  const audioRef = (0, import_react.useRef)(null);
1408
1410
  const formatTime = (time) => {
1409
1411
  const minutes = Math.floor(time / 60);
@@ -1457,6 +1459,16 @@ var CardAudio = (0, import_react.forwardRef)(
1457
1459
  const toggleVolumeControl = () => {
1458
1460
  setShowVolumeControl(!showVolumeControl);
1459
1461
  };
1462
+ const toggleSpeedMenu = () => {
1463
+ setShowSpeedMenu(!showSpeedMenu);
1464
+ };
1465
+ const handleSpeedChange = (speed) => {
1466
+ setPlaybackRate(speed);
1467
+ if (audioRef.current) {
1468
+ audioRef.current.playbackRate = speed;
1469
+ }
1470
+ setShowSpeedMenu(false);
1471
+ };
1460
1472
  const getVolumeIcon = () => {
1461
1473
  if (volume === 0) {
1462
1474
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.SpeakerSimpleX, {});
@@ -1613,13 +1625,35 @@ var CardAudio = (0, import_react.forwardRef)(
1613
1625
  }
1614
1626
  )
1615
1627
  ] }),
1616
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1617
- import_phosphor_react2.DotsThreeVertical,
1618
- {
1619
- size: 24,
1620
- className: "text-text-950 cursor-pointer hover:text-primary-600"
1621
- }
1622
- )
1628
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
1629
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1630
+ "button",
1631
+ {
1632
+ type: "button",
1633
+ onClick: toggleSpeedMenu,
1634
+ className: "cursor-pointer text-text-950 hover:text-primary-600",
1635
+ "aria-label": "Op\xE7\xF5es de velocidade",
1636
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.DotsThreeVertical, { size: 24 })
1637
+ }
1638
+ ),
1639
+ showSpeedMenu && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "absolute bottom-full right-0 mb-2 p-2 bg-background border border-border-100 rounded-lg shadow-lg min-w-24 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex flex-col gap-1", children: [
1640
+ { speed: 1, label: "1x" },
1641
+ { speed: 1.5, label: "1.5x" },
1642
+ { speed: 2, label: "2x" }
1643
+ ].map(({ speed, label }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1644
+ "button",
1645
+ {
1646
+ type: "button",
1647
+ onClick: () => handleSpeedChange(speed),
1648
+ className: cn(
1649
+ "px-3 py-1 text-sm text-left rounded hover:bg-border-50 transition-colors",
1650
+ playbackRate === speed ? "bg-primary-950 text-secondary-100 font-medium" : "text-text-950"
1651
+ ),
1652
+ children: label
1653
+ },
1654
+ speed
1655
+ )) }) })
1656
+ ] })
1623
1657
  ]
1624
1658
  }
1625
1659
  );