analytica-frontend-lib 1.0.57 → 1.0.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.
- package/dist/Card/index.d.mts +19 -1
- package/dist/Card/index.d.ts +19 -1
- package/dist/Card/index.js +246 -7
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.mjs +256 -8
- package/dist/Card/index.mjs.map +1 -1
- package/dist/Menu/index.js +13 -6
- package/dist/Menu/index.js.map +1 -1
- package/dist/Menu/index.mjs +13 -6
- package/dist/Menu/index.mjs.map +1 -1
- package/dist/index.css +29 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +257 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +268 -14
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +29 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3724,9 +3724,16 @@ var Menu = (0, import_react13.forwardRef)(
|
|
|
3724
3724
|
(0, import_react13.useEffect)(() => {
|
|
3725
3725
|
setValue(propValue ?? defaultValue);
|
|
3726
3726
|
}, [defaultValue, propValue, setValue]);
|
|
3727
|
+
const onValueChangeRef = (0, import_react13.useRef)(onValueChange);
|
|
3728
|
+
const isInitializedRef = (0, import_react13.useRef)(false);
|
|
3729
|
+
onValueChangeRef.current = onValueChange;
|
|
3727
3730
|
(0, import_react13.useEffect)(() => {
|
|
3728
|
-
|
|
3729
|
-
|
|
3731
|
+
if (isInitializedRef.current) {
|
|
3732
|
+
onValueChangeRef.current?.(value);
|
|
3733
|
+
} else {
|
|
3734
|
+
isInitializedRef.current = true;
|
|
3735
|
+
}
|
|
3736
|
+
}, [value]);
|
|
3730
3737
|
const baseClasses = "w-full py-2 px-6 flex flex-row items-center justify-center";
|
|
3731
3738
|
const variantClasses = VARIANT_CLASSES5[variant];
|
|
3732
3739
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
@@ -3831,9 +3838,9 @@ var MenuItem = (0, import_react13.forwardRef)(
|
|
|
3831
3838
|
{
|
|
3832
3839
|
"data-variant": "breadcrumb",
|
|
3833
3840
|
className: `
|
|
3834
|
-
w-full p-2 rounded-lg hover:text-primary-600 cursor-pointer font-bold text-xs
|
|
3841
|
+
w-full p-2 rounded-lg hover:text-primary-600 cursor-pointer font-bold text-xs
|
|
3835
3842
|
focus:outline-none focus:border-indicator-info focus:border-2
|
|
3836
|
-
${selectedValue === value ? "text-
|
|
3843
|
+
${selectedValue === value ? "text-text-950" : "text-text-600"}
|
|
3837
3844
|
${className ?? ""}
|
|
3838
3845
|
`,
|
|
3839
3846
|
...commonProps,
|
|
@@ -3841,8 +3848,8 @@ var MenuItem = (0, import_react13.forwardRef)(
|
|
|
3841
3848
|
"span",
|
|
3842
3849
|
{
|
|
3843
3850
|
className: `
|
|
3844
|
-
border-b border-text-600 hover:border-primary-600 text-inherit
|
|
3845
|
-
${selectedValue === value ? "border-b-
|
|
3851
|
+
border-b border-text-600 hover:border-primary-600 text-inherit text-xs
|
|
3852
|
+
${selectedValue === value ? "border-b-0 font-bold" : "border-b-primary-600"}
|
|
3846
3853
|
`,
|
|
3847
3854
|
children
|
|
3848
3855
|
}
|
|
@@ -4144,7 +4151,7 @@ var CardProgress = (0, import_react14.forwardRef)(
|
|
|
4144
4151
|
{
|
|
4145
4152
|
ref,
|
|
4146
4153
|
className: `
|
|
4147
|
-
w-full flex border border-border-50 bg-background rounded-xl
|
|
4154
|
+
w-full flex border border-border-50 bg-background rounded-xl cursor-pointer
|
|
4148
4155
|
${isHorizontal ? "flex-row h-20" : "flex-col"}
|
|
4149
4156
|
${className}
|
|
4150
4157
|
`,
|
|
@@ -4194,7 +4201,7 @@ var CardTopic = (0, import_react14.forwardRef)(
|
|
|
4194
4201
|
"div",
|
|
4195
4202
|
{
|
|
4196
4203
|
ref,
|
|
4197
|
-
className: `w-full py-2 px-4 flex flex-col justify-center gap-2 bg-background border border-border-50 rounded-xl min-h-20 ${className}`,
|
|
4204
|
+
className: `cursor-pointer w-full py-2 px-4 flex flex-col justify-center gap-2 bg-background border border-border-50 rounded-xl min-h-20 ${className}`,
|
|
4198
4205
|
...props,
|
|
4199
4206
|
children: [
|
|
4200
4207
|
subHead && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react14.Fragment, { children: [
|
|
@@ -4244,7 +4251,7 @@ var CardPerformance = (0, import_react14.forwardRef)(
|
|
|
4244
4251
|
!hasProgress && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4245
4252
|
import_phosphor_react13.CaretRight,
|
|
4246
4253
|
{
|
|
4247
|
-
className: "size-4.5 text-text-800",
|
|
4254
|
+
className: "size-4.5 text-text-800 cursor-pointer",
|
|
4248
4255
|
"data-testid": "caret-icon",
|
|
4249
4256
|
onClick: () => onClickButton?.(valueButton)
|
|
4250
4257
|
}
|
|
@@ -4328,7 +4335,7 @@ var CardResults = (0, import_react14.forwardRef)(
|
|
|
4328
4335
|
]
|
|
4329
4336
|
}
|
|
4330
4337
|
),
|
|
4331
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
|
|
4338
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer" })
|
|
4332
4339
|
]
|
|
4333
4340
|
}
|
|
4334
4341
|
);
|
|
@@ -4370,7 +4377,7 @@ var CardStatus = (0, import_react14.forwardRef)(
|
|
|
4370
4377
|
]
|
|
4371
4378
|
}
|
|
4372
4379
|
),
|
|
4373
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
|
|
4380
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer" })
|
|
4374
4381
|
]
|
|
4375
4382
|
}
|
|
4376
4383
|
);
|
|
@@ -4387,7 +4394,7 @@ var CardSettings = (0, import_react14.forwardRef)(
|
|
|
4387
4394
|
children: [
|
|
4388
4395
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "[&>svg]:size-6", children: icon }),
|
|
4389
4396
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "w-full text-md", children: header }),
|
|
4390
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { size: 24 })
|
|
4397
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { size: 24, className: "cursor-pointer" })
|
|
4391
4398
|
]
|
|
4392
4399
|
}
|
|
4393
4400
|
);
|
|
@@ -4414,7 +4421,7 @@ var CardSupport = (0, import_react14.forwardRef)(
|
|
|
4414
4421
|
]
|
|
4415
4422
|
}
|
|
4416
4423
|
),
|
|
4417
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { className: "text-text-800", size: 24 })
|
|
4424
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { className: "text-text-800 cursor-pointer", size: 24 })
|
|
4418
4425
|
]
|
|
4419
4426
|
}
|
|
4420
4427
|
);
|
|
@@ -4483,6 +4490,243 @@ var CardForum = (0, import_react14.forwardRef)(
|
|
|
4483
4490
|
);
|
|
4484
4491
|
}
|
|
4485
4492
|
);
|
|
4493
|
+
var CardAudio = (0, import_react14.forwardRef)(
|
|
4494
|
+
({
|
|
4495
|
+
src,
|
|
4496
|
+
title,
|
|
4497
|
+
onPlay,
|
|
4498
|
+
onPause,
|
|
4499
|
+
onEnded,
|
|
4500
|
+
onAudioTimeUpdate,
|
|
4501
|
+
loop = false,
|
|
4502
|
+
preload = "metadata",
|
|
4503
|
+
tracks,
|
|
4504
|
+
className,
|
|
4505
|
+
...props
|
|
4506
|
+
}, ref) => {
|
|
4507
|
+
const [isPlaying, setIsPlaying] = (0, import_react14.useState)(false);
|
|
4508
|
+
const [currentTime, setCurrentTime] = (0, import_react14.useState)(0);
|
|
4509
|
+
const [duration, setDuration] = (0, import_react14.useState)(0);
|
|
4510
|
+
const [volume, setVolume] = (0, import_react14.useState)(1);
|
|
4511
|
+
const [showVolumeControl, setShowVolumeControl] = (0, import_react14.useState)(false);
|
|
4512
|
+
const audioRef = (0, import_react14.useRef)(null);
|
|
4513
|
+
const formatTime = (time) => {
|
|
4514
|
+
const minutes = Math.floor(time / 60);
|
|
4515
|
+
const seconds = Math.floor(time % 60);
|
|
4516
|
+
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
|
|
4517
|
+
};
|
|
4518
|
+
const handlePlayPause = () => {
|
|
4519
|
+
if (isPlaying) {
|
|
4520
|
+
audioRef.current?.pause();
|
|
4521
|
+
setIsPlaying(false);
|
|
4522
|
+
onPause?.();
|
|
4523
|
+
} else {
|
|
4524
|
+
audioRef.current?.play();
|
|
4525
|
+
setIsPlaying(true);
|
|
4526
|
+
onPlay?.();
|
|
4527
|
+
}
|
|
4528
|
+
};
|
|
4529
|
+
const handleTimeUpdate = () => {
|
|
4530
|
+
const current = audioRef.current?.currentTime ?? 0;
|
|
4531
|
+
const total = audioRef.current?.duration ?? 0;
|
|
4532
|
+
setCurrentTime(current);
|
|
4533
|
+
setDuration(total);
|
|
4534
|
+
onAudioTimeUpdate?.(current, total);
|
|
4535
|
+
};
|
|
4536
|
+
const handleLoadedMetadata = () => {
|
|
4537
|
+
setDuration(audioRef.current?.duration ?? 0);
|
|
4538
|
+
};
|
|
4539
|
+
const handleEnded = () => {
|
|
4540
|
+
setIsPlaying(false);
|
|
4541
|
+
setCurrentTime(0);
|
|
4542
|
+
onEnded?.();
|
|
4543
|
+
};
|
|
4544
|
+
const handleProgressClick = (e) => {
|
|
4545
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
4546
|
+
const clickX = e.clientX - rect.left;
|
|
4547
|
+
const width = rect.width;
|
|
4548
|
+
const percentage = clickX / width;
|
|
4549
|
+
const newTime = percentage * duration;
|
|
4550
|
+
if (audioRef.current) {
|
|
4551
|
+
audioRef.current.currentTime = newTime;
|
|
4552
|
+
}
|
|
4553
|
+
setCurrentTime(newTime);
|
|
4554
|
+
};
|
|
4555
|
+
const handleVolumeChange = (e) => {
|
|
4556
|
+
const newVolume = parseFloat(e.target.value);
|
|
4557
|
+
setVolume(newVolume);
|
|
4558
|
+
if (audioRef.current) {
|
|
4559
|
+
audioRef.current.volume = newVolume;
|
|
4560
|
+
}
|
|
4561
|
+
};
|
|
4562
|
+
const toggleVolumeControl = () => {
|
|
4563
|
+
setShowVolumeControl(!showVolumeControl);
|
|
4564
|
+
};
|
|
4565
|
+
const getVolumeIcon = () => {
|
|
4566
|
+
if (volume === 0) {
|
|
4567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.SpeakerSimpleX, {});
|
|
4568
|
+
}
|
|
4569
|
+
if (volume < 0.5) {
|
|
4570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.SpeakerLow, {});
|
|
4571
|
+
}
|
|
4572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.SpeakerHigh, {});
|
|
4573
|
+
};
|
|
4574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4575
|
+
"div",
|
|
4576
|
+
{
|
|
4577
|
+
ref,
|
|
4578
|
+
className: `w-auto h-14 p-4 flex flex-row bg-background items-center gap-2 ${className}`,
|
|
4579
|
+
...props,
|
|
4580
|
+
children: [
|
|
4581
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4582
|
+
"audio",
|
|
4583
|
+
{
|
|
4584
|
+
ref: audioRef,
|
|
4585
|
+
src,
|
|
4586
|
+
loop,
|
|
4587
|
+
preload,
|
|
4588
|
+
onTimeUpdate: handleTimeUpdate,
|
|
4589
|
+
onLoadedMetadata: handleLoadedMetadata,
|
|
4590
|
+
onEnded: handleEnded,
|
|
4591
|
+
"data-testid": "audio-element",
|
|
4592
|
+
"aria-label": title,
|
|
4593
|
+
children: tracks ? tracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4594
|
+
"track",
|
|
4595
|
+
{
|
|
4596
|
+
kind: track.kind,
|
|
4597
|
+
src: track.src,
|
|
4598
|
+
srcLang: track.srcLang,
|
|
4599
|
+
label: track.label,
|
|
4600
|
+
default: track.default
|
|
4601
|
+
},
|
|
4602
|
+
track.src
|
|
4603
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4604
|
+
"track",
|
|
4605
|
+
{
|
|
4606
|
+
kind: "captions",
|
|
4607
|
+
src: "data:text/vtt;base64,",
|
|
4608
|
+
srcLang: "pt",
|
|
4609
|
+
label: "Sem legendas dispon\xEDveis"
|
|
4610
|
+
}
|
|
4611
|
+
)
|
|
4612
|
+
}
|
|
4613
|
+
),
|
|
4614
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4615
|
+
"button",
|
|
4616
|
+
{
|
|
4617
|
+
type: "button",
|
|
4618
|
+
onClick: handlePlayPause,
|
|
4619
|
+
disabled: !src,
|
|
4620
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600 disabled:text-text-400 disabled:cursor-not-allowed",
|
|
4621
|
+
"aria-label": isPlaying ? "Pausar" : "Reproduzir",
|
|
4622
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-0.5", children: [
|
|
4623
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" }),
|
|
4624
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" })
|
|
4625
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.Play, { size: 24 })
|
|
4626
|
+
}
|
|
4627
|
+
),
|
|
4628
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
|
|
4629
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4630
|
+
"button",
|
|
4631
|
+
{
|
|
4632
|
+
type: "button",
|
|
4633
|
+
className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
|
|
4634
|
+
onClick: handleProgressClick,
|
|
4635
|
+
onKeyDown: (e) => {
|
|
4636
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
4637
|
+
e.preventDefault();
|
|
4638
|
+
handleProgressClick(
|
|
4639
|
+
e
|
|
4640
|
+
);
|
|
4641
|
+
}
|
|
4642
|
+
},
|
|
4643
|
+
"aria-label": "Barra de progresso do \xE1udio",
|
|
4644
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4645
|
+
"div",
|
|
4646
|
+
{
|
|
4647
|
+
className: "h-full bg-primary-600 rounded-full transition-all duration-100",
|
|
4648
|
+
style: {
|
|
4649
|
+
width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
|
|
4650
|
+
}
|
|
4651
|
+
}
|
|
4652
|
+
)
|
|
4653
|
+
}
|
|
4654
|
+
) }),
|
|
4655
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(duration) }),
|
|
4656
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "relative", children: [
|
|
4657
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4658
|
+
"button",
|
|
4659
|
+
{
|
|
4660
|
+
type: "button",
|
|
4661
|
+
onClick: toggleVolumeControl,
|
|
4662
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600",
|
|
4663
|
+
"aria-label": "Controle de volume",
|
|
4664
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: getVolumeIcon() })
|
|
4665
|
+
}
|
|
4666
|
+
),
|
|
4667
|
+
showVolumeControl && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4668
|
+
"button",
|
|
4669
|
+
{
|
|
4670
|
+
type: "button",
|
|
4671
|
+
className: "absolute bottom-full right-0 mb-2 p-2 bg-background border border-border-100 rounded-lg shadow-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
4672
|
+
onKeyDown: (e) => {
|
|
4673
|
+
if (e.key === "Escape") {
|
|
4674
|
+
setShowVolumeControl(false);
|
|
4675
|
+
}
|
|
4676
|
+
},
|
|
4677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4678
|
+
"input",
|
|
4679
|
+
{
|
|
4680
|
+
type: "range",
|
|
4681
|
+
min: "0",
|
|
4682
|
+
max: "1",
|
|
4683
|
+
step: "0.1",
|
|
4684
|
+
value: volume,
|
|
4685
|
+
onChange: handleVolumeChange,
|
|
4686
|
+
onKeyDown: (e) => {
|
|
4687
|
+
if (e.key === "ArrowUp" || e.key === "ArrowRight") {
|
|
4688
|
+
e.preventDefault();
|
|
4689
|
+
const newVolume = Math.min(
|
|
4690
|
+
1,
|
|
4691
|
+
Math.round((volume + 0.1) * 10) / 10
|
|
4692
|
+
);
|
|
4693
|
+
setVolume(newVolume);
|
|
4694
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
4695
|
+
} else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
|
|
4696
|
+
e.preventDefault();
|
|
4697
|
+
const newVolume = Math.max(
|
|
4698
|
+
0,
|
|
4699
|
+
Math.round((volume - 0.1) * 10) / 10
|
|
4700
|
+
);
|
|
4701
|
+
setVolume(newVolume);
|
|
4702
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
4703
|
+
}
|
|
4704
|
+
},
|
|
4705
|
+
className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
|
|
4706
|
+
style: {
|
|
4707
|
+
background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
|
|
4708
|
+
},
|
|
4709
|
+
"aria-label": "Volume",
|
|
4710
|
+
"aria-valuenow": Math.round(volume * 100),
|
|
4711
|
+
"aria-valuemin": 0,
|
|
4712
|
+
"aria-valuemax": 100
|
|
4713
|
+
}
|
|
4714
|
+
)
|
|
4715
|
+
}
|
|
4716
|
+
)
|
|
4717
|
+
] }),
|
|
4718
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4719
|
+
import_phosphor_react13.DotsThreeVertical,
|
|
4720
|
+
{
|
|
4721
|
+
size: 24,
|
|
4722
|
+
className: "text-text-950 cursor-pointer hover:text-primary-600"
|
|
4723
|
+
}
|
|
4724
|
+
)
|
|
4725
|
+
]
|
|
4726
|
+
}
|
|
4727
|
+
);
|
|
4728
|
+
}
|
|
4729
|
+
);
|
|
4486
4730
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4487
4731
|
0 && (module.exports = {
|
|
4488
4732
|
Alert,
|