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.
@@ -3215,6 +3215,8 @@ var CardAudio = (0, import_react7.forwardRef)(
3215
3215
  const [duration, setDuration] = (0, import_react7.useState)(0);
3216
3216
  const [volume, setVolume] = (0, import_react7.useState)(1);
3217
3217
  const [showVolumeControl, setShowVolumeControl] = (0, import_react7.useState)(false);
3218
+ const [showSpeedMenu, setShowSpeedMenu] = (0, import_react7.useState)(false);
3219
+ const [playbackRate, setPlaybackRate] = (0, import_react7.useState)(1);
3218
3220
  const audioRef = (0, import_react7.useRef)(null);
3219
3221
  const formatTime = (time) => {
3220
3222
  const minutes = Math.floor(time / 60);
@@ -3268,6 +3270,16 @@ var CardAudio = (0, import_react7.forwardRef)(
3268
3270
  const toggleVolumeControl = () => {
3269
3271
  setShowVolumeControl(!showVolumeControl);
3270
3272
  };
3273
+ const toggleSpeedMenu = () => {
3274
+ setShowSpeedMenu(!showSpeedMenu);
3275
+ };
3276
+ const handleSpeedChange = (speed) => {
3277
+ setPlaybackRate(speed);
3278
+ if (audioRef.current) {
3279
+ audioRef.current.playbackRate = speed;
3280
+ }
3281
+ setShowSpeedMenu(false);
3282
+ };
3271
3283
  const getVolumeIcon = () => {
3272
3284
  if (volume === 0) {
3273
3285
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.SpeakerSimpleX, {});
@@ -3424,13 +3436,35 @@ var CardAudio = (0, import_react7.forwardRef)(
3424
3436
  }
3425
3437
  )
3426
3438
  ] }),
3427
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3428
- import_phosphor_react5.DotsThreeVertical,
3429
- {
3430
- size: 24,
3431
- className: "text-text-950 cursor-pointer hover:text-primary-600"
3432
- }
3433
- )
3439
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative", children: [
3440
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3441
+ "button",
3442
+ {
3443
+ type: "button",
3444
+ onClick: toggleSpeedMenu,
3445
+ className: "cursor-pointer text-text-950 hover:text-primary-600",
3446
+ "aria-label": "Op\xE7\xF5es de velocidade",
3447
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.DotsThreeVertical, { size: 24 })
3448
+ }
3449
+ ),
3450
+ showSpeedMenu && /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)("div", { className: "flex flex-col gap-1", children: [
3451
+ { speed: 1, label: "1x" },
3452
+ { speed: 1.5, label: "1.5x" },
3453
+ { speed: 2, label: "2x" }
3454
+ ].map(({ speed, label }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3455
+ "button",
3456
+ {
3457
+ type: "button",
3458
+ onClick: () => handleSpeedChange(speed),
3459
+ className: cn(
3460
+ "px-3 py-1 text-sm text-left rounded hover:bg-border-50 transition-colors",
3461
+ playbackRate === speed ? "bg-primary-950 text-secondary-100 font-medium" : "text-text-950"
3462
+ ),
3463
+ children: label
3464
+ },
3465
+ speed
3466
+ )) }) })
3467
+ ] })
3434
3468
  ]
3435
3469
  }
3436
3470
  );