analytica-frontend-lib 1.1.13 → 1.1.15

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.
@@ -1415,6 +1415,8 @@ var CardAudio = (0, import_react.forwardRef)(
1415
1415
  const [duration, setDuration] = (0, import_react.useState)(0);
1416
1416
  const [volume, setVolume] = (0, import_react.useState)(1);
1417
1417
  const [showVolumeControl, setShowVolumeControl] = (0, import_react.useState)(false);
1418
+ const [showSpeedMenu, setShowSpeedMenu] = (0, import_react.useState)(false);
1419
+ const [playbackRate, setPlaybackRate] = (0, import_react.useState)(1);
1418
1420
  const audioRef = (0, import_react.useRef)(null);
1419
1421
  const formatTime = (time) => {
1420
1422
  const minutes = Math.floor(time / 60);
@@ -1468,6 +1470,16 @@ var CardAudio = (0, import_react.forwardRef)(
1468
1470
  const toggleVolumeControl = () => {
1469
1471
  setShowVolumeControl(!showVolumeControl);
1470
1472
  };
1473
+ const toggleSpeedMenu = () => {
1474
+ setShowSpeedMenu(!showSpeedMenu);
1475
+ };
1476
+ const handleSpeedChange = (speed) => {
1477
+ setPlaybackRate(speed);
1478
+ if (audioRef.current) {
1479
+ audioRef.current.playbackRate = speed;
1480
+ }
1481
+ setShowSpeedMenu(false);
1482
+ };
1471
1483
  const getVolumeIcon = () => {
1472
1484
  if (volume === 0) {
1473
1485
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.SpeakerSimpleX, {});
@@ -1624,13 +1636,35 @@ var CardAudio = (0, import_react.forwardRef)(
1624
1636
  }
1625
1637
  )
1626
1638
  ] }),
1627
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1628
- import_phosphor_react2.DotsThreeVertical,
1629
- {
1630
- size: 24,
1631
- className: "text-text-950 cursor-pointer hover:text-primary-600"
1632
- }
1633
- )
1639
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
1640
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1641
+ "button",
1642
+ {
1643
+ type: "button",
1644
+ onClick: toggleSpeedMenu,
1645
+ className: "cursor-pointer text-text-950 hover:text-primary-600",
1646
+ "aria-label": "Op\xE7\xF5es de velocidade",
1647
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.DotsThreeVertical, { size: 24 })
1648
+ }
1649
+ ),
1650
+ 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: [
1651
+ { speed: 1, label: "1x" },
1652
+ { speed: 1.5, label: "1.5x" },
1653
+ { speed: 2, label: "2x" }
1654
+ ].map(({ speed, label }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1655
+ "button",
1656
+ {
1657
+ type: "button",
1658
+ onClick: () => handleSpeedChange(speed),
1659
+ className: cn(
1660
+ "px-3 py-1 text-sm text-left rounded hover:bg-border-50 transition-colors",
1661
+ playbackRate === speed ? "bg-primary-950 text-secondary-100 font-medium" : "text-text-950"
1662
+ ),
1663
+ children: label
1664
+ },
1665
+ speed
1666
+ )) }) })
1667
+ ] })
1634
1668
  ]
1635
1669
  }
1636
1670
  );