analytica-frontend-lib 1.0.57 → 1.0.59
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 +28 -1
- package/dist/Card/index.d.ts +28 -1
- package/dist/Card/index.js +403 -56
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.mjs +412 -57
- 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/Skeleton/index.d.mts +39 -0
- package/dist/Skeleton/index.d.ts +39 -0
- package/dist/Skeleton/index.js +191 -0
- package/dist/Skeleton/index.js.map +1 -0
- package/dist/Skeleton/index.mjs +159 -0
- package/dist/Skeleton/index.mjs.map +1 -0
- package/dist/index.css +92 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +577 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +580 -63
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +92 -2
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
package/dist/Card/index.js
CHANGED
|
@@ -21,6 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var Card_exports = {};
|
|
22
22
|
__export(Card_exports, {
|
|
23
23
|
CardActivesResults: () => CardActivesResults,
|
|
24
|
+
CardAudio: () => CardAudio,
|
|
25
|
+
CardBase: () => CardBase,
|
|
24
26
|
CardForum: () => CardForum,
|
|
25
27
|
CardPerformance: () => CardPerformance,
|
|
26
28
|
CardProgress: () => CardProgress,
|
|
@@ -672,6 +674,58 @@ var ProgressBar_default = ProgressBar;
|
|
|
672
674
|
// src/components/Card/Card.tsx
|
|
673
675
|
var import_phosphor_react2 = require("phosphor-react");
|
|
674
676
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
677
|
+
var CARD_BASE_CLASSES = {
|
|
678
|
+
default: "w-full bg-background border border-border-50 rounded-xl",
|
|
679
|
+
compact: "w-full bg-background border border-border-50 rounded-lg",
|
|
680
|
+
minimal: "w-full bg-background border border-border-100 rounded-md"
|
|
681
|
+
};
|
|
682
|
+
var CARD_PADDING_CLASSES = {
|
|
683
|
+
none: "",
|
|
684
|
+
small: "p-2",
|
|
685
|
+
medium: "p-4",
|
|
686
|
+
large: "p-6"
|
|
687
|
+
};
|
|
688
|
+
var CARD_MIN_HEIGHT_CLASSES = {
|
|
689
|
+
none: "",
|
|
690
|
+
small: "min-h-16",
|
|
691
|
+
medium: "min-h-20",
|
|
692
|
+
large: "min-h-24"
|
|
693
|
+
};
|
|
694
|
+
var CARD_LAYOUT_CLASSES = {
|
|
695
|
+
horizontal: "flex flex-row",
|
|
696
|
+
vertical: "flex flex-col"
|
|
697
|
+
};
|
|
698
|
+
var CARD_CURSOR_CLASSES = {
|
|
699
|
+
default: "",
|
|
700
|
+
pointer: "cursor-pointer"
|
|
701
|
+
};
|
|
702
|
+
var CardBase = (0, import_react.forwardRef)(
|
|
703
|
+
({
|
|
704
|
+
children,
|
|
705
|
+
variant = "default",
|
|
706
|
+
layout = "horizontal",
|
|
707
|
+
padding = "medium",
|
|
708
|
+
minHeight = "medium",
|
|
709
|
+
cursor = "default",
|
|
710
|
+
className = "",
|
|
711
|
+
...props
|
|
712
|
+
}, ref) => {
|
|
713
|
+
const baseClasses = CARD_BASE_CLASSES[variant];
|
|
714
|
+
const paddingClasses = CARD_PADDING_CLASSES[padding];
|
|
715
|
+
const minHeightClasses = CARD_MIN_HEIGHT_CLASSES[minHeight];
|
|
716
|
+
const layoutClasses = CARD_LAYOUT_CLASSES[layout];
|
|
717
|
+
const cursorClasses = CARD_CURSOR_CLASSES[cursor];
|
|
718
|
+
const combinedClasses = [
|
|
719
|
+
baseClasses,
|
|
720
|
+
paddingClasses,
|
|
721
|
+
minHeightClasses,
|
|
722
|
+
layoutClasses,
|
|
723
|
+
cursorClasses,
|
|
724
|
+
className
|
|
725
|
+
].filter(Boolean).join(" ");
|
|
726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref, className: combinedClasses, ...props, children });
|
|
727
|
+
}
|
|
728
|
+
);
|
|
675
729
|
var ACTION_CARD_CLASSES = {
|
|
676
730
|
warning: "bg-warning-background",
|
|
677
731
|
success: "bg-success-300",
|
|
@@ -734,7 +788,7 @@ var CardActivesResults = (0, import_react.forwardRef)(
|
|
|
734
788
|
children: icon
|
|
735
789
|
}
|
|
736
790
|
),
|
|
737
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("
|
|
791
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text_default, { size: "2xs", weight: "medium", className: "text-text-800 uppercase", children: title }),
|
|
738
792
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: `text-lg font-bold ${actionSubTitleClasses}`, children: subTitle })
|
|
739
793
|
]
|
|
740
794
|
}
|
|
@@ -767,13 +821,13 @@ var CardQuestions = (0, import_react.forwardRef)(
|
|
|
767
821
|
const stateLabel = isDone ? "Realizado" : "N\xE3o Realizado";
|
|
768
822
|
const buttonLabel = isDone ? "Ver Quest\xE3o" : "Responder";
|
|
769
823
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
770
|
-
|
|
824
|
+
CardBase,
|
|
771
825
|
{
|
|
772
826
|
ref,
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
`,
|
|
827
|
+
layout: "horizontal",
|
|
828
|
+
padding: "medium",
|
|
829
|
+
minHeight: "medium",
|
|
830
|
+
className: `justify-between gap-4 ${className}`,
|
|
777
831
|
...props,
|
|
778
832
|
children: [
|
|
779
833
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "flex flex-col gap-1", children: [
|
|
@@ -833,35 +887,48 @@ var CardProgress = (0, import_react.forwardRef)(
|
|
|
833
887
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-text-600", children: endDate })
|
|
834
888
|
] })
|
|
835
889
|
] }),
|
|
836
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
890
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
892
|
+
ProgressBar_default,
|
|
893
|
+
{
|
|
894
|
+
size: "small",
|
|
895
|
+
value: progress,
|
|
896
|
+
"data-testid": "progress-bar"
|
|
897
|
+
}
|
|
898
|
+
),
|
|
899
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
900
|
+
Text_default,
|
|
901
|
+
{
|
|
902
|
+
size: "xs",
|
|
903
|
+
weight: "medium",
|
|
904
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none`,
|
|
905
|
+
children: [
|
|
906
|
+
Math.round(progress),
|
|
907
|
+
"%"
|
|
908
|
+
]
|
|
909
|
+
}
|
|
910
|
+
)
|
|
911
|
+
] })
|
|
845
912
|
] }),
|
|
846
913
|
vertical: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm text-text-800", children: subhead })
|
|
847
914
|
};
|
|
848
915
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
849
|
-
|
|
916
|
+
CardBase,
|
|
850
917
|
{
|
|
851
918
|
ref,
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
`,
|
|
919
|
+
layout: isHorizontal ? "horizontal" : "vertical",
|
|
920
|
+
padding: "none",
|
|
921
|
+
minHeight: "medium",
|
|
922
|
+
cursor: "pointer",
|
|
923
|
+
className: `${isHorizontal ? "h-20" : ""} ${className}`,
|
|
857
924
|
...props,
|
|
858
925
|
children: [
|
|
859
926
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
860
927
|
"div",
|
|
861
928
|
{
|
|
862
929
|
className: `
|
|
863
|
-
flex justify-center items-center [&>svg]:size-
|
|
864
|
-
${isHorizontal ? "w-
|
|
930
|
+
flex justify-center items-center [&>svg]:size-6 text-text-950
|
|
931
|
+
${isHorizontal ? "min-w-[80px] min-h-[80px] rounded-l-xl" : "min-h-[50px] w-full rounded-t-xl"}
|
|
865
932
|
`,
|
|
866
933
|
style: {
|
|
867
934
|
backgroundColor: color
|
|
@@ -877,7 +944,7 @@ var CardProgress = (0, import_react.forwardRef)(
|
|
|
877
944
|
${!isHorizontal && "gap-4"}
|
|
878
945
|
`,
|
|
879
946
|
children: [
|
|
880
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
947
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-950", children: header }),
|
|
881
948
|
contentComponent[direction]
|
|
882
949
|
]
|
|
883
950
|
}
|
|
@@ -897,18 +964,43 @@ var CardTopic = (0, import_react.forwardRef)(
|
|
|
897
964
|
...props
|
|
898
965
|
}, ref) => {
|
|
899
966
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
900
|
-
|
|
967
|
+
CardBase,
|
|
901
968
|
{
|
|
902
969
|
ref,
|
|
903
|
-
|
|
970
|
+
layout: "vertical",
|
|
971
|
+
padding: "small",
|
|
972
|
+
minHeight: "medium",
|
|
973
|
+
cursor: "pointer",
|
|
974
|
+
className: `justify-center gap-2 py-2 px-4 ${className}`,
|
|
904
975
|
...props,
|
|
905
976
|
children: [
|
|
906
977
|
subHead && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react.Fragment, { children: [
|
|
907
978
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: text }),
|
|
908
979
|
index < subHead.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "\u2022" })
|
|
909
980
|
] }, `${text} - ${index}`)) }),
|
|
910
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-
|
|
911
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
981
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm text-text-950 font-bold", children: header }),
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
984
|
+
ProgressBar_default,
|
|
985
|
+
{
|
|
986
|
+
size: "small",
|
|
987
|
+
value: progress,
|
|
988
|
+
"data-testid": "progress-bar"
|
|
989
|
+
}
|
|
990
|
+
),
|
|
991
|
+
showPercentage && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
992
|
+
Text_default,
|
|
993
|
+
{
|
|
994
|
+
size: "xs",
|
|
995
|
+
weight: "medium",
|
|
996
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none`,
|
|
997
|
+
children: [
|
|
998
|
+
Math.round(progress),
|
|
999
|
+
"%"
|
|
1000
|
+
]
|
|
1001
|
+
}
|
|
1002
|
+
)
|
|
1003
|
+
] })
|
|
912
1004
|
]
|
|
913
1005
|
}
|
|
914
1006
|
);
|
|
@@ -926,15 +1018,18 @@ var CardPerformance = (0, import_react.forwardRef)(
|
|
|
926
1018
|
}, ref) => {
|
|
927
1019
|
const hasProgress = progress !== void 0;
|
|
928
1020
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
929
|
-
|
|
1021
|
+
CardBase,
|
|
930
1022
|
{
|
|
931
1023
|
ref,
|
|
932
|
-
|
|
1024
|
+
layout: "horizontal",
|
|
1025
|
+
padding: "medium",
|
|
1026
|
+
minHeight: "large",
|
|
1027
|
+
className: `justify-between gap-2 ${className}`,
|
|
933
1028
|
...props,
|
|
934
1029
|
children: [
|
|
935
1030
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "w-full flex flex-col justify-between gap-2", children: [
|
|
936
1031
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-row justify-between items-center", children: [
|
|
937
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-
|
|
1032
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-lg font-bold text-text-950", children: header }),
|
|
938
1033
|
hasProgress && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
939
1034
|
Button_default,
|
|
940
1035
|
{
|
|
@@ -950,7 +1045,7 @@ var CardPerformance = (0, import_react.forwardRef)(
|
|
|
950
1045
|
!hasProgress && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
951
1046
|
import_phosphor_react2.CaretRight,
|
|
952
1047
|
{
|
|
953
|
-
className: "size-4.5 text-text-800",
|
|
1048
|
+
className: "size-4.5 text-text-800 cursor-pointer",
|
|
954
1049
|
"data-testid": "caret-icon",
|
|
955
1050
|
onClick: () => onClickButton?.(valueButton)
|
|
956
1051
|
}
|
|
@@ -973,13 +1068,13 @@ var CardResults = (0, import_react.forwardRef)(
|
|
|
973
1068
|
}, ref) => {
|
|
974
1069
|
const isRow = direction == "row";
|
|
975
1070
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
976
|
-
|
|
1071
|
+
CardBase,
|
|
977
1072
|
{
|
|
978
1073
|
ref,
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
`,
|
|
1074
|
+
layout: "horizontal",
|
|
1075
|
+
padding: "none",
|
|
1076
|
+
minHeight: "medium",
|
|
1077
|
+
className: `items-center pr-4 ${className}`,
|
|
983
1078
|
...props,
|
|
984
1079
|
children: [
|
|
985
1080
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -1002,7 +1097,7 @@ var CardResults = (0, import_react.forwardRef)(
|
|
|
1002
1097
|
${isRow ? "flex-row items-center" : "flex-col"}
|
|
1003
1098
|
`,
|
|
1004
1099
|
children: [
|
|
1005
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-
|
|
1100
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm font-bold text-text-950", children: header }),
|
|
1006
1101
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex flex-row gap-1 items-center", children: [
|
|
1007
1102
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1008
1103
|
Badge_default,
|
|
@@ -1034,7 +1129,7 @@ var CardResults = (0, import_react.forwardRef)(
|
|
|
1034
1129
|
]
|
|
1035
1130
|
}
|
|
1036
1131
|
),
|
|
1037
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer" })
|
|
1038
1133
|
]
|
|
1039
1134
|
}
|
|
1040
1135
|
);
|
|
@@ -1043,13 +1138,13 @@ var CardResults = (0, import_react.forwardRef)(
|
|
|
1043
1138
|
var CardStatus = (0, import_react.forwardRef)(
|
|
1044
1139
|
({ header, className, status, ...props }, ref) => {
|
|
1045
1140
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1046
|
-
|
|
1141
|
+
CardBase,
|
|
1047
1142
|
{
|
|
1048
1143
|
ref,
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
`,
|
|
1144
|
+
layout: "horizontal",
|
|
1145
|
+
padding: "none",
|
|
1146
|
+
minHeight: "medium",
|
|
1147
|
+
className: `items-center pr-4 ${className}`,
|
|
1053
1148
|
...props,
|
|
1054
1149
|
children: [
|
|
1055
1150
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
@@ -1059,7 +1154,7 @@ var CardStatus = (0, import_react.forwardRef)(
|
|
|
1059
1154
|
p-4 flex justify-between w-full h-full flex-row items-center
|
|
1060
1155
|
`,
|
|
1061
1156
|
children: [
|
|
1062
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-
|
|
1157
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm font-bold text-text-950", children: header }),
|
|
1063
1158
|
status && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex flex-row gap-1 items-center", children: [
|
|
1064
1159
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1065
1160
|
Badge_default,
|
|
@@ -1076,7 +1171,7 @@ var CardStatus = (0, import_react.forwardRef)(
|
|
|
1076
1171
|
]
|
|
1077
1172
|
}
|
|
1078
1173
|
),
|
|
1079
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
|
|
1174
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer" })
|
|
1080
1175
|
]
|
|
1081
1176
|
}
|
|
1082
1177
|
);
|
|
@@ -1085,15 +1180,18 @@ var CardStatus = (0, import_react.forwardRef)(
|
|
|
1085
1180
|
var CardSettings = (0, import_react.forwardRef)(
|
|
1086
1181
|
({ header, className, icon, ...props }, ref) => {
|
|
1087
1182
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1088
|
-
|
|
1183
|
+
CardBase,
|
|
1089
1184
|
{
|
|
1090
1185
|
ref,
|
|
1091
|
-
|
|
1186
|
+
layout: "horizontal",
|
|
1187
|
+
padding: "small",
|
|
1188
|
+
minHeight: "none",
|
|
1189
|
+
className: `border-none items-center gap-2 text-text-700 ${className}`,
|
|
1092
1190
|
...props,
|
|
1093
1191
|
children: [
|
|
1094
1192
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "[&>svg]:size-6", children: icon }),
|
|
1095
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "w-full text-
|
|
1096
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.CaretRight, { size: 24 })
|
|
1193
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "w-full text-sm", children: header }),
|
|
1194
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.CaretRight, { size: 24, className: "cursor-pointer" })
|
|
1097
1195
|
]
|
|
1098
1196
|
}
|
|
1099
1197
|
);
|
|
@@ -1102,10 +1200,13 @@ var CardSettings = (0, import_react.forwardRef)(
|
|
|
1102
1200
|
var CardSupport = (0, import_react.forwardRef)(
|
|
1103
1201
|
({ header, className, direction = "col", children, ...props }, ref) => {
|
|
1104
1202
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1105
|
-
|
|
1203
|
+
CardBase,
|
|
1106
1204
|
{
|
|
1107
1205
|
ref,
|
|
1108
|
-
|
|
1206
|
+
layout: "horizontal",
|
|
1207
|
+
padding: "medium",
|
|
1208
|
+
minHeight: "none",
|
|
1209
|
+
className: `border-none items-center gap-2 text-text-700 ${className}`,
|
|
1109
1210
|
...props,
|
|
1110
1211
|
children: [
|
|
1111
1212
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
@@ -1115,12 +1216,12 @@ var CardSupport = (0, import_react.forwardRef)(
|
|
|
1115
1216
|
w-full flex ${direction == "col" ? "flex-col" : "flex-row items-center"} gap-2
|
|
1116
1217
|
`,
|
|
1117
1218
|
children: [
|
|
1118
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm text-text-950 font-bold", children: header }) }),
|
|
1119
1220
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "flex flex-row gap-1", children })
|
|
1120
1221
|
]
|
|
1121
1222
|
}
|
|
1122
1223
|
),
|
|
1123
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.CaretRight, { className: "text-text-800", size: 24 })
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.CaretRight, { className: "text-text-800 cursor-pointer", size: 24 })
|
|
1124
1225
|
]
|
|
1125
1226
|
}
|
|
1126
1227
|
);
|
|
@@ -1141,10 +1242,14 @@ var CardForum = (0, import_react.forwardRef)(
|
|
|
1141
1242
|
...props
|
|
1142
1243
|
}, ref) => {
|
|
1143
1244
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1144
|
-
|
|
1245
|
+
CardBase,
|
|
1145
1246
|
{
|
|
1146
1247
|
ref,
|
|
1147
|
-
|
|
1248
|
+
layout: "horizontal",
|
|
1249
|
+
padding: "medium",
|
|
1250
|
+
minHeight: "none",
|
|
1251
|
+
variant: "minimal",
|
|
1252
|
+
className: `w-auto h-auto gap-3 ${className}`,
|
|
1148
1253
|
...props,
|
|
1149
1254
|
children: [
|
|
1150
1255
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -1189,9 +1294,251 @@ var CardForum = (0, import_react.forwardRef)(
|
|
|
1189
1294
|
);
|
|
1190
1295
|
}
|
|
1191
1296
|
);
|
|
1297
|
+
var CardAudio = (0, import_react.forwardRef)(
|
|
1298
|
+
({
|
|
1299
|
+
src,
|
|
1300
|
+
title,
|
|
1301
|
+
onPlay,
|
|
1302
|
+
onPause,
|
|
1303
|
+
onEnded,
|
|
1304
|
+
onAudioTimeUpdate,
|
|
1305
|
+
loop = false,
|
|
1306
|
+
preload = "metadata",
|
|
1307
|
+
tracks,
|
|
1308
|
+
className,
|
|
1309
|
+
...props
|
|
1310
|
+
}, ref) => {
|
|
1311
|
+
const [isPlaying, setIsPlaying] = (0, import_react.useState)(false);
|
|
1312
|
+
const [currentTime, setCurrentTime] = (0, import_react.useState)(0);
|
|
1313
|
+
const [duration, setDuration] = (0, import_react.useState)(0);
|
|
1314
|
+
const [volume, setVolume] = (0, import_react.useState)(1);
|
|
1315
|
+
const [showVolumeControl, setShowVolumeControl] = (0, import_react.useState)(false);
|
|
1316
|
+
const audioRef = (0, import_react.useRef)(null);
|
|
1317
|
+
const formatTime = (time) => {
|
|
1318
|
+
const minutes = Math.floor(time / 60);
|
|
1319
|
+
const seconds = Math.floor(time % 60);
|
|
1320
|
+
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
|
|
1321
|
+
};
|
|
1322
|
+
const handlePlayPause = () => {
|
|
1323
|
+
if (isPlaying) {
|
|
1324
|
+
audioRef.current?.pause();
|
|
1325
|
+
setIsPlaying(false);
|
|
1326
|
+
onPause?.();
|
|
1327
|
+
} else {
|
|
1328
|
+
audioRef.current?.play();
|
|
1329
|
+
setIsPlaying(true);
|
|
1330
|
+
onPlay?.();
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1333
|
+
const handleTimeUpdate = () => {
|
|
1334
|
+
const current = audioRef.current?.currentTime ?? 0;
|
|
1335
|
+
const total = audioRef.current?.duration ?? 0;
|
|
1336
|
+
setCurrentTime(current);
|
|
1337
|
+
setDuration(total);
|
|
1338
|
+
onAudioTimeUpdate?.(current, total);
|
|
1339
|
+
};
|
|
1340
|
+
const handleLoadedMetadata = () => {
|
|
1341
|
+
setDuration(audioRef.current?.duration ?? 0);
|
|
1342
|
+
};
|
|
1343
|
+
const handleEnded = () => {
|
|
1344
|
+
setIsPlaying(false);
|
|
1345
|
+
setCurrentTime(0);
|
|
1346
|
+
onEnded?.();
|
|
1347
|
+
};
|
|
1348
|
+
const handleProgressClick = (e) => {
|
|
1349
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
1350
|
+
const clickX = e.clientX - rect.left;
|
|
1351
|
+
const width = rect.width;
|
|
1352
|
+
const percentage = clickX / width;
|
|
1353
|
+
const newTime = percentage * duration;
|
|
1354
|
+
if (audioRef.current) {
|
|
1355
|
+
audioRef.current.currentTime = newTime;
|
|
1356
|
+
}
|
|
1357
|
+
setCurrentTime(newTime);
|
|
1358
|
+
};
|
|
1359
|
+
const handleVolumeChange = (e) => {
|
|
1360
|
+
const newVolume = parseFloat(e.target.value);
|
|
1361
|
+
setVolume(newVolume);
|
|
1362
|
+
if (audioRef.current) {
|
|
1363
|
+
audioRef.current.volume = newVolume;
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
const toggleVolumeControl = () => {
|
|
1367
|
+
setShowVolumeControl(!showVolumeControl);
|
|
1368
|
+
};
|
|
1369
|
+
const getVolumeIcon = () => {
|
|
1370
|
+
if (volume === 0) {
|
|
1371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.SpeakerSimpleX, {});
|
|
1372
|
+
}
|
|
1373
|
+
if (volume < 0.5) {
|
|
1374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.SpeakerLow, {});
|
|
1375
|
+
}
|
|
1376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.SpeakerHigh, {});
|
|
1377
|
+
};
|
|
1378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1379
|
+
CardBase,
|
|
1380
|
+
{
|
|
1381
|
+
ref,
|
|
1382
|
+
layout: "horizontal",
|
|
1383
|
+
padding: "medium",
|
|
1384
|
+
minHeight: "none",
|
|
1385
|
+
className: `w-auto h-14 items-center gap-2 border-none ${className}`,
|
|
1386
|
+
...props,
|
|
1387
|
+
children: [
|
|
1388
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1389
|
+
"audio",
|
|
1390
|
+
{
|
|
1391
|
+
ref: audioRef,
|
|
1392
|
+
src,
|
|
1393
|
+
loop,
|
|
1394
|
+
preload,
|
|
1395
|
+
onTimeUpdate: handleTimeUpdate,
|
|
1396
|
+
onLoadedMetadata: handleLoadedMetadata,
|
|
1397
|
+
onEnded: handleEnded,
|
|
1398
|
+
"data-testid": "audio-element",
|
|
1399
|
+
"aria-label": title,
|
|
1400
|
+
children: tracks ? tracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1401
|
+
"track",
|
|
1402
|
+
{
|
|
1403
|
+
kind: track.kind,
|
|
1404
|
+
src: track.src,
|
|
1405
|
+
srcLang: track.srcLang,
|
|
1406
|
+
label: track.label,
|
|
1407
|
+
default: track.default
|
|
1408
|
+
},
|
|
1409
|
+
track.src
|
|
1410
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1411
|
+
"track",
|
|
1412
|
+
{
|
|
1413
|
+
kind: "captions",
|
|
1414
|
+
src: "data:text/vtt;base64,",
|
|
1415
|
+
srcLang: "pt",
|
|
1416
|
+
label: "Sem legendas dispon\xEDveis"
|
|
1417
|
+
}
|
|
1418
|
+
)
|
|
1419
|
+
}
|
|
1420
|
+
),
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1422
|
+
"button",
|
|
1423
|
+
{
|
|
1424
|
+
type: "button",
|
|
1425
|
+
onClick: handlePlayPause,
|
|
1426
|
+
disabled: !src,
|
|
1427
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600 disabled:text-text-400 disabled:cursor-not-allowed",
|
|
1428
|
+
"aria-label": isPlaying ? "Pausar" : "Reproduzir",
|
|
1429
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex gap-0.5", children: [
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" }),
|
|
1431
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" })
|
|
1432
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.Play, { size: 24 })
|
|
1433
|
+
}
|
|
1434
|
+
),
|
|
1435
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1437
|
+
"button",
|
|
1438
|
+
{
|
|
1439
|
+
type: "button",
|
|
1440
|
+
className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
|
|
1441
|
+
onClick: handleProgressClick,
|
|
1442
|
+
onKeyDown: (e) => {
|
|
1443
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1444
|
+
e.preventDefault();
|
|
1445
|
+
handleProgressClick(
|
|
1446
|
+
e
|
|
1447
|
+
);
|
|
1448
|
+
}
|
|
1449
|
+
},
|
|
1450
|
+
"aria-label": "Barra de progresso do \xE1udio",
|
|
1451
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1452
|
+
"div",
|
|
1453
|
+
{
|
|
1454
|
+
className: "h-full bg-primary-600 rounded-full transition-all duration-100",
|
|
1455
|
+
style: {
|
|
1456
|
+
width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
)
|
|
1460
|
+
}
|
|
1461
|
+
) }),
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(duration) }),
|
|
1463
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1465
|
+
"button",
|
|
1466
|
+
{
|
|
1467
|
+
type: "button",
|
|
1468
|
+
onClick: toggleVolumeControl,
|
|
1469
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600",
|
|
1470
|
+
"aria-label": "Controle de volume",
|
|
1471
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: getVolumeIcon() })
|
|
1472
|
+
}
|
|
1473
|
+
),
|
|
1474
|
+
showVolumeControl && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1475
|
+
"button",
|
|
1476
|
+
{
|
|
1477
|
+
type: "button",
|
|
1478
|
+
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",
|
|
1479
|
+
onKeyDown: (e) => {
|
|
1480
|
+
if (e.key === "Escape") {
|
|
1481
|
+
setShowVolumeControl(false);
|
|
1482
|
+
}
|
|
1483
|
+
},
|
|
1484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1485
|
+
"input",
|
|
1486
|
+
{
|
|
1487
|
+
type: "range",
|
|
1488
|
+
min: "0",
|
|
1489
|
+
max: "1",
|
|
1490
|
+
step: "0.1",
|
|
1491
|
+
value: volume,
|
|
1492
|
+
onChange: handleVolumeChange,
|
|
1493
|
+
onKeyDown: (e) => {
|
|
1494
|
+
if (e.key === "ArrowUp" || e.key === "ArrowRight") {
|
|
1495
|
+
e.preventDefault();
|
|
1496
|
+
const newVolume = Math.min(
|
|
1497
|
+
1,
|
|
1498
|
+
Math.round((volume + 0.1) * 10) / 10
|
|
1499
|
+
);
|
|
1500
|
+
setVolume(newVolume);
|
|
1501
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
1502
|
+
} else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
|
|
1503
|
+
e.preventDefault();
|
|
1504
|
+
const newVolume = Math.max(
|
|
1505
|
+
0,
|
|
1506
|
+
Math.round((volume - 0.1) * 10) / 10
|
|
1507
|
+
);
|
|
1508
|
+
setVolume(newVolume);
|
|
1509
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
1510
|
+
}
|
|
1511
|
+
},
|
|
1512
|
+
className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
|
|
1513
|
+
style: {
|
|
1514
|
+
background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
|
|
1515
|
+
},
|
|
1516
|
+
"aria-label": "Volume",
|
|
1517
|
+
"aria-valuenow": Math.round(volume * 100),
|
|
1518
|
+
"aria-valuemin": 0,
|
|
1519
|
+
"aria-valuemax": 100
|
|
1520
|
+
}
|
|
1521
|
+
)
|
|
1522
|
+
}
|
|
1523
|
+
)
|
|
1524
|
+
] }),
|
|
1525
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1526
|
+
import_phosphor_react2.DotsThreeVertical,
|
|
1527
|
+
{
|
|
1528
|
+
size: 24,
|
|
1529
|
+
className: "text-text-950 cursor-pointer hover:text-primary-600"
|
|
1530
|
+
}
|
|
1531
|
+
)
|
|
1532
|
+
]
|
|
1533
|
+
}
|
|
1534
|
+
);
|
|
1535
|
+
}
|
|
1536
|
+
);
|
|
1192
1537
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1193
1538
|
0 && (module.exports = {
|
|
1194
1539
|
CardActivesResults,
|
|
1540
|
+
CardAudio,
|
|
1541
|
+
CardBase,
|
|
1195
1542
|
CardForum,
|
|
1196
1543
|
CardPerformance,
|
|
1197
1544
|
CardProgress,
|