analytica-frontend-lib 1.0.56 → 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 +20 -2
- package/dist/Card/index.d.ts +20 -2
- package/dist/Card/index.js +247 -8
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.mjs +257 -9
- package/dist/Card/index.mjs.map +1 -1
- package/dist/Menu/index.js +15 -7
- package/dist/Menu/index.js.map +1 -1
- package/dist/Menu/index.mjs +15 -7
- package/dist/Menu/index.mjs.map +1 -1
- package/dist/index.css +33 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +260 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +271 -16
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +33 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/Card/index.mjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// src/components/Card/Card.tsx
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
forwardRef,
|
|
4
|
+
Fragment as Fragment2,
|
|
5
|
+
useState,
|
|
6
|
+
useRef
|
|
7
|
+
} from "react";
|
|
3
8
|
|
|
4
9
|
// src/components/Button/Button.tsx
|
|
5
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -641,6 +646,11 @@ import {
|
|
|
641
646
|
CaretRight,
|
|
642
647
|
ChatCircleText,
|
|
643
648
|
CheckCircle,
|
|
649
|
+
DotsThreeVertical,
|
|
650
|
+
Play,
|
|
651
|
+
SpeakerHigh,
|
|
652
|
+
SpeakerLow,
|
|
653
|
+
SpeakerSimpleX,
|
|
644
654
|
XCircle
|
|
645
655
|
} from "phosphor-react";
|
|
646
656
|
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -822,7 +832,7 @@ var CardProgress = forwardRef(
|
|
|
822
832
|
{
|
|
823
833
|
ref,
|
|
824
834
|
className: `
|
|
825
|
-
w-full flex border border-border-50 bg-background rounded-xl
|
|
835
|
+
w-full flex border border-border-50 bg-background rounded-xl cursor-pointer
|
|
826
836
|
${isHorizontal ? "flex-row h-20" : "flex-col"}
|
|
827
837
|
${className}
|
|
828
838
|
`,
|
|
@@ -872,7 +882,7 @@ var CardTopic = forwardRef(
|
|
|
872
882
|
"div",
|
|
873
883
|
{
|
|
874
884
|
ref,
|
|
875
|
-
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}`,
|
|
885
|
+
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}`,
|
|
876
886
|
...props,
|
|
877
887
|
children: [
|
|
878
888
|
subHead && /* @__PURE__ */ jsx5("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
@@ -922,7 +932,7 @@ var CardPerformance = forwardRef(
|
|
|
922
932
|
!hasProgress && /* @__PURE__ */ jsx5(
|
|
923
933
|
CaretRight,
|
|
924
934
|
{
|
|
925
|
-
className: "size-4.5 text-text-800",
|
|
935
|
+
className: "size-4.5 text-text-800 cursor-pointer",
|
|
926
936
|
"data-testid": "caret-icon",
|
|
927
937
|
onClick: () => onClickButton?.(valueButton)
|
|
928
938
|
}
|
|
@@ -1006,7 +1016,7 @@ var CardResults = forwardRef(
|
|
|
1006
1016
|
]
|
|
1007
1017
|
}
|
|
1008
1018
|
),
|
|
1009
|
-
/* @__PURE__ */ jsx5(CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
|
|
1019
|
+
/* @__PURE__ */ jsx5(CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer" })
|
|
1010
1020
|
]
|
|
1011
1021
|
}
|
|
1012
1022
|
);
|
|
@@ -1032,7 +1042,7 @@ var CardStatus = forwardRef(
|
|
|
1032
1042
|
`,
|
|
1033
1043
|
children: [
|
|
1034
1044
|
/* @__PURE__ */ jsx5("p", { className: "text-xs font-bold text-text-950", children: header }),
|
|
1035
|
-
/* @__PURE__ */ jsxs4("span", { className: "flex flex-row gap-1 items-center", children: [
|
|
1045
|
+
status && /* @__PURE__ */ jsxs4("span", { className: "flex flex-row gap-1 items-center", children: [
|
|
1036
1046
|
/* @__PURE__ */ jsx5(
|
|
1037
1047
|
Badge_default,
|
|
1038
1048
|
{
|
|
@@ -1048,7 +1058,7 @@ var CardStatus = forwardRef(
|
|
|
1048
1058
|
]
|
|
1049
1059
|
}
|
|
1050
1060
|
),
|
|
1051
|
-
/* @__PURE__ */ jsx5(CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
|
|
1061
|
+
/* @__PURE__ */ jsx5(CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer" })
|
|
1052
1062
|
]
|
|
1053
1063
|
}
|
|
1054
1064
|
);
|
|
@@ -1065,7 +1075,7 @@ var CardSettings = forwardRef(
|
|
|
1065
1075
|
children: [
|
|
1066
1076
|
/* @__PURE__ */ jsx5("span", { className: "[&>svg]:size-6", children: icon }),
|
|
1067
1077
|
/* @__PURE__ */ jsx5("p", { className: "w-full text-md", children: header }),
|
|
1068
|
-
/* @__PURE__ */ jsx5(CaretRight, { size: 24 })
|
|
1078
|
+
/* @__PURE__ */ jsx5(CaretRight, { size: 24, className: "cursor-pointer" })
|
|
1069
1079
|
]
|
|
1070
1080
|
}
|
|
1071
1081
|
);
|
|
@@ -1092,7 +1102,7 @@ var CardSupport = forwardRef(
|
|
|
1092
1102
|
]
|
|
1093
1103
|
}
|
|
1094
1104
|
),
|
|
1095
|
-
/* @__PURE__ */ jsx5(CaretRight, { className: "text-text-800", size: 24 })
|
|
1105
|
+
/* @__PURE__ */ jsx5(CaretRight, { className: "text-text-800 cursor-pointer", size: 24 })
|
|
1096
1106
|
]
|
|
1097
1107
|
}
|
|
1098
1108
|
);
|
|
@@ -1161,8 +1171,246 @@ var CardForum = forwardRef(
|
|
|
1161
1171
|
);
|
|
1162
1172
|
}
|
|
1163
1173
|
);
|
|
1174
|
+
var CardAudio = forwardRef(
|
|
1175
|
+
({
|
|
1176
|
+
src,
|
|
1177
|
+
title,
|
|
1178
|
+
onPlay,
|
|
1179
|
+
onPause,
|
|
1180
|
+
onEnded,
|
|
1181
|
+
onAudioTimeUpdate,
|
|
1182
|
+
loop = false,
|
|
1183
|
+
preload = "metadata",
|
|
1184
|
+
tracks,
|
|
1185
|
+
className,
|
|
1186
|
+
...props
|
|
1187
|
+
}, ref) => {
|
|
1188
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
1189
|
+
const [currentTime, setCurrentTime] = useState(0);
|
|
1190
|
+
const [duration, setDuration] = useState(0);
|
|
1191
|
+
const [volume, setVolume] = useState(1);
|
|
1192
|
+
const [showVolumeControl, setShowVolumeControl] = useState(false);
|
|
1193
|
+
const audioRef = useRef(null);
|
|
1194
|
+
const formatTime = (time) => {
|
|
1195
|
+
const minutes = Math.floor(time / 60);
|
|
1196
|
+
const seconds = Math.floor(time % 60);
|
|
1197
|
+
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
|
|
1198
|
+
};
|
|
1199
|
+
const handlePlayPause = () => {
|
|
1200
|
+
if (isPlaying) {
|
|
1201
|
+
audioRef.current?.pause();
|
|
1202
|
+
setIsPlaying(false);
|
|
1203
|
+
onPause?.();
|
|
1204
|
+
} else {
|
|
1205
|
+
audioRef.current?.play();
|
|
1206
|
+
setIsPlaying(true);
|
|
1207
|
+
onPlay?.();
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
const handleTimeUpdate = () => {
|
|
1211
|
+
const current = audioRef.current?.currentTime ?? 0;
|
|
1212
|
+
const total = audioRef.current?.duration ?? 0;
|
|
1213
|
+
setCurrentTime(current);
|
|
1214
|
+
setDuration(total);
|
|
1215
|
+
onAudioTimeUpdate?.(current, total);
|
|
1216
|
+
};
|
|
1217
|
+
const handleLoadedMetadata = () => {
|
|
1218
|
+
setDuration(audioRef.current?.duration ?? 0);
|
|
1219
|
+
};
|
|
1220
|
+
const handleEnded = () => {
|
|
1221
|
+
setIsPlaying(false);
|
|
1222
|
+
setCurrentTime(0);
|
|
1223
|
+
onEnded?.();
|
|
1224
|
+
};
|
|
1225
|
+
const handleProgressClick = (e) => {
|
|
1226
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
1227
|
+
const clickX = e.clientX - rect.left;
|
|
1228
|
+
const width = rect.width;
|
|
1229
|
+
const percentage = clickX / width;
|
|
1230
|
+
const newTime = percentage * duration;
|
|
1231
|
+
if (audioRef.current) {
|
|
1232
|
+
audioRef.current.currentTime = newTime;
|
|
1233
|
+
}
|
|
1234
|
+
setCurrentTime(newTime);
|
|
1235
|
+
};
|
|
1236
|
+
const handleVolumeChange = (e) => {
|
|
1237
|
+
const newVolume = parseFloat(e.target.value);
|
|
1238
|
+
setVolume(newVolume);
|
|
1239
|
+
if (audioRef.current) {
|
|
1240
|
+
audioRef.current.volume = newVolume;
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
const toggleVolumeControl = () => {
|
|
1244
|
+
setShowVolumeControl(!showVolumeControl);
|
|
1245
|
+
};
|
|
1246
|
+
const getVolumeIcon = () => {
|
|
1247
|
+
if (volume === 0) {
|
|
1248
|
+
return /* @__PURE__ */ jsx5(SpeakerSimpleX, {});
|
|
1249
|
+
}
|
|
1250
|
+
if (volume < 0.5) {
|
|
1251
|
+
return /* @__PURE__ */ jsx5(SpeakerLow, {});
|
|
1252
|
+
}
|
|
1253
|
+
return /* @__PURE__ */ jsx5(SpeakerHigh, {});
|
|
1254
|
+
};
|
|
1255
|
+
return /* @__PURE__ */ jsxs4(
|
|
1256
|
+
"div",
|
|
1257
|
+
{
|
|
1258
|
+
ref,
|
|
1259
|
+
className: `w-auto h-14 p-4 flex flex-row bg-background items-center gap-2 ${className}`,
|
|
1260
|
+
...props,
|
|
1261
|
+
children: [
|
|
1262
|
+
/* @__PURE__ */ jsx5(
|
|
1263
|
+
"audio",
|
|
1264
|
+
{
|
|
1265
|
+
ref: audioRef,
|
|
1266
|
+
src,
|
|
1267
|
+
loop,
|
|
1268
|
+
preload,
|
|
1269
|
+
onTimeUpdate: handleTimeUpdate,
|
|
1270
|
+
onLoadedMetadata: handleLoadedMetadata,
|
|
1271
|
+
onEnded: handleEnded,
|
|
1272
|
+
"data-testid": "audio-element",
|
|
1273
|
+
"aria-label": title,
|
|
1274
|
+
children: tracks ? tracks.map((track) => /* @__PURE__ */ jsx5(
|
|
1275
|
+
"track",
|
|
1276
|
+
{
|
|
1277
|
+
kind: track.kind,
|
|
1278
|
+
src: track.src,
|
|
1279
|
+
srcLang: track.srcLang,
|
|
1280
|
+
label: track.label,
|
|
1281
|
+
default: track.default
|
|
1282
|
+
},
|
|
1283
|
+
track.src
|
|
1284
|
+
)) : /* @__PURE__ */ jsx5(
|
|
1285
|
+
"track",
|
|
1286
|
+
{
|
|
1287
|
+
kind: "captions",
|
|
1288
|
+
src: "data:text/vtt;base64,",
|
|
1289
|
+
srcLang: "pt",
|
|
1290
|
+
label: "Sem legendas dispon\xEDveis"
|
|
1291
|
+
}
|
|
1292
|
+
)
|
|
1293
|
+
}
|
|
1294
|
+
),
|
|
1295
|
+
/* @__PURE__ */ jsx5(
|
|
1296
|
+
"button",
|
|
1297
|
+
{
|
|
1298
|
+
type: "button",
|
|
1299
|
+
onClick: handlePlayPause,
|
|
1300
|
+
disabled: !src,
|
|
1301
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600 disabled:text-text-400 disabled:cursor-not-allowed",
|
|
1302
|
+
"aria-label": isPlaying ? "Pausar" : "Reproduzir",
|
|
1303
|
+
children: isPlaying ? /* @__PURE__ */ jsx5("div", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ jsxs4("div", { className: "flex gap-0.5", children: [
|
|
1304
|
+
/* @__PURE__ */ jsx5("div", { className: "w-1 h-4 bg-current rounded-sm" }),
|
|
1305
|
+
/* @__PURE__ */ jsx5("div", { className: "w-1 h-4 bg-current rounded-sm" })
|
|
1306
|
+
] }) }) : /* @__PURE__ */ jsx5(Play, { size: 24 })
|
|
1307
|
+
}
|
|
1308
|
+
),
|
|
1309
|
+
/* @__PURE__ */ jsx5("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
|
|
1310
|
+
/* @__PURE__ */ jsx5("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ jsx5(
|
|
1311
|
+
"button",
|
|
1312
|
+
{
|
|
1313
|
+
type: "button",
|
|
1314
|
+
className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
|
|
1315
|
+
onClick: handleProgressClick,
|
|
1316
|
+
onKeyDown: (e) => {
|
|
1317
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1318
|
+
e.preventDefault();
|
|
1319
|
+
handleProgressClick(
|
|
1320
|
+
e
|
|
1321
|
+
);
|
|
1322
|
+
}
|
|
1323
|
+
},
|
|
1324
|
+
"aria-label": "Barra de progresso do \xE1udio",
|
|
1325
|
+
children: /* @__PURE__ */ jsx5(
|
|
1326
|
+
"div",
|
|
1327
|
+
{
|
|
1328
|
+
className: "h-full bg-primary-600 rounded-full transition-all duration-100",
|
|
1329
|
+
style: {
|
|
1330
|
+
width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
)
|
|
1334
|
+
}
|
|
1335
|
+
) }),
|
|
1336
|
+
/* @__PURE__ */ jsx5("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(duration) }),
|
|
1337
|
+
/* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
1338
|
+
/* @__PURE__ */ jsx5(
|
|
1339
|
+
"button",
|
|
1340
|
+
{
|
|
1341
|
+
type: "button",
|
|
1342
|
+
onClick: toggleVolumeControl,
|
|
1343
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600",
|
|
1344
|
+
"aria-label": "Controle de volume",
|
|
1345
|
+
children: /* @__PURE__ */ jsx5("div", { className: "w-6 h-6 flex items-center justify-center", children: getVolumeIcon() })
|
|
1346
|
+
}
|
|
1347
|
+
),
|
|
1348
|
+
showVolumeControl && /* @__PURE__ */ jsx5(
|
|
1349
|
+
"button",
|
|
1350
|
+
{
|
|
1351
|
+
type: "button",
|
|
1352
|
+
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",
|
|
1353
|
+
onKeyDown: (e) => {
|
|
1354
|
+
if (e.key === "Escape") {
|
|
1355
|
+
setShowVolumeControl(false);
|
|
1356
|
+
}
|
|
1357
|
+
},
|
|
1358
|
+
children: /* @__PURE__ */ jsx5(
|
|
1359
|
+
"input",
|
|
1360
|
+
{
|
|
1361
|
+
type: "range",
|
|
1362
|
+
min: "0",
|
|
1363
|
+
max: "1",
|
|
1364
|
+
step: "0.1",
|
|
1365
|
+
value: volume,
|
|
1366
|
+
onChange: handleVolumeChange,
|
|
1367
|
+
onKeyDown: (e) => {
|
|
1368
|
+
if (e.key === "ArrowUp" || e.key === "ArrowRight") {
|
|
1369
|
+
e.preventDefault();
|
|
1370
|
+
const newVolume = Math.min(
|
|
1371
|
+
1,
|
|
1372
|
+
Math.round((volume + 0.1) * 10) / 10
|
|
1373
|
+
);
|
|
1374
|
+
setVolume(newVolume);
|
|
1375
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
1376
|
+
} else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
|
|
1377
|
+
e.preventDefault();
|
|
1378
|
+
const newVolume = Math.max(
|
|
1379
|
+
0,
|
|
1380
|
+
Math.round((volume - 0.1) * 10) / 10
|
|
1381
|
+
);
|
|
1382
|
+
setVolume(newVolume);
|
|
1383
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
|
|
1387
|
+
style: {
|
|
1388
|
+
background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
|
|
1389
|
+
},
|
|
1390
|
+
"aria-label": "Volume",
|
|
1391
|
+
"aria-valuenow": Math.round(volume * 100),
|
|
1392
|
+
"aria-valuemin": 0,
|
|
1393
|
+
"aria-valuemax": 100
|
|
1394
|
+
}
|
|
1395
|
+
)
|
|
1396
|
+
}
|
|
1397
|
+
)
|
|
1398
|
+
] }),
|
|
1399
|
+
/* @__PURE__ */ jsx5(
|
|
1400
|
+
DotsThreeVertical,
|
|
1401
|
+
{
|
|
1402
|
+
size: 24,
|
|
1403
|
+
className: "text-text-950 cursor-pointer hover:text-primary-600"
|
|
1404
|
+
}
|
|
1405
|
+
)
|
|
1406
|
+
]
|
|
1407
|
+
}
|
|
1408
|
+
);
|
|
1409
|
+
}
|
|
1410
|
+
);
|
|
1164
1411
|
export {
|
|
1165
1412
|
CardActivesResults,
|
|
1413
|
+
CardAudio,
|
|
1166
1414
|
CardForum,
|
|
1167
1415
|
CardPerformance,
|
|
1168
1416
|
CardProgress,
|