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.
package/dist/index.js CHANGED
@@ -4725,6 +4725,8 @@ var CardAudio = (0, import_react14.forwardRef)(
4725
4725
  const [duration, setDuration] = (0, import_react14.useState)(0);
4726
4726
  const [volume, setVolume] = (0, import_react14.useState)(1);
4727
4727
  const [showVolumeControl, setShowVolumeControl] = (0, import_react14.useState)(false);
4728
+ const [showSpeedMenu, setShowSpeedMenu] = (0, import_react14.useState)(false);
4729
+ const [playbackRate, setPlaybackRate] = (0, import_react14.useState)(1);
4728
4730
  const audioRef = (0, import_react14.useRef)(null);
4729
4731
  const formatTime2 = (time) => {
4730
4732
  const minutes = Math.floor(time / 60);
@@ -4778,6 +4780,16 @@ var CardAudio = (0, import_react14.forwardRef)(
4778
4780
  const toggleVolumeControl = () => {
4779
4781
  setShowVolumeControl(!showVolumeControl);
4780
4782
  };
4783
+ const toggleSpeedMenu = () => {
4784
+ setShowSpeedMenu(!showSpeedMenu);
4785
+ };
4786
+ const handleSpeedChange = (speed) => {
4787
+ setPlaybackRate(speed);
4788
+ if (audioRef.current) {
4789
+ audioRef.current.playbackRate = speed;
4790
+ }
4791
+ setShowSpeedMenu(false);
4792
+ };
4781
4793
  const getVolumeIcon = () => {
4782
4794
  if (volume === 0) {
4783
4795
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react12.SpeakerSimpleX, {});
@@ -4934,13 +4946,35 @@ var CardAudio = (0, import_react14.forwardRef)(
4934
4946
  }
4935
4947
  )
4936
4948
  ] }),
4937
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4938
- import_phosphor_react12.DotsThreeVertical,
4939
- {
4940
- size: 24,
4941
- className: "text-text-950 cursor-pointer hover:text-primary-600"
4942
- }
4943
- )
4949
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "relative", children: [
4950
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4951
+ "button",
4952
+ {
4953
+ type: "button",
4954
+ onClick: toggleSpeedMenu,
4955
+ className: "cursor-pointer text-text-950 hover:text-primary-600",
4956
+ "aria-label": "Op\xE7\xF5es de velocidade",
4957
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react12.DotsThreeVertical, { size: 24 })
4958
+ }
4959
+ ),
4960
+ showSpeedMenu && /* @__PURE__ */ (0, import_jsx_runtime26.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_runtime26.jsx)("div", { className: "flex flex-col gap-1", children: [
4961
+ { speed: 1, label: "1x" },
4962
+ { speed: 1.5, label: "1.5x" },
4963
+ { speed: 2, label: "2x" }
4964
+ ].map(({ speed, label }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4965
+ "button",
4966
+ {
4967
+ type: "button",
4968
+ onClick: () => handleSpeedChange(speed),
4969
+ className: cn(
4970
+ "px-3 py-1 text-sm text-left rounded hover:bg-border-50 transition-colors",
4971
+ playbackRate === speed ? "bg-primary-950 text-secondary-100 font-medium" : "text-text-950"
4972
+ ),
4973
+ children: label
4974
+ },
4975
+ speed
4976
+ )) }) })
4977
+ ] })
4944
4978
  ]
4945
4979
  }
4946
4980
  );