analytica-frontend-lib 1.0.58 → 1.0.60

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.
@@ -1,6 +1,15 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
+ interface CardBaseProps extends HTMLAttributes<HTMLDivElement> {
5
+ children: ReactNode;
6
+ variant?: 'default' | 'compact' | 'minimal';
7
+ layout?: 'horizontal' | 'vertical';
8
+ padding?: 'none' | 'small' | 'medium' | 'large';
9
+ minHeight?: 'none' | 'small' | 'medium' | 'large';
10
+ cursor?: 'default' | 'pointer';
11
+ }
12
+ declare const CardBase: react.ForwardRefExoticComponent<CardBaseProps & react.RefAttributes<HTMLDivElement>>;
4
13
  interface CardActivesResultsProps extends HTMLAttributes<HTMLDivElement> {
5
14
  icon: ReactNode;
6
15
  title: string;
@@ -100,4 +109,4 @@ interface CardAudioProps extends HTMLAttributes<HTMLDivElement> {
100
109
  }
101
110
  declare const CardAudio: react.ForwardRefExoticComponent<CardAudioProps & react.RefAttributes<HTMLDivElement>>;
102
111
 
103
- export { CardActivesResults, CardAudio, CardForum, CardPerformance, CardProgress, CardQuestions, CardResults, CardSettings, CardStatus, CardSupport, CardTopic };
112
+ export { CardActivesResults, CardAudio, CardBase, CardForum, CardPerformance, CardProgress, CardQuestions, CardResults, CardSettings, CardStatus, CardSupport, CardTopic };
@@ -1,6 +1,15 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
+ interface CardBaseProps extends HTMLAttributes<HTMLDivElement> {
5
+ children: ReactNode;
6
+ variant?: 'default' | 'compact' | 'minimal';
7
+ layout?: 'horizontal' | 'vertical';
8
+ padding?: 'none' | 'small' | 'medium' | 'large';
9
+ minHeight?: 'none' | 'small' | 'medium' | 'large';
10
+ cursor?: 'default' | 'pointer';
11
+ }
12
+ declare const CardBase: react.ForwardRefExoticComponent<CardBaseProps & react.RefAttributes<HTMLDivElement>>;
4
13
  interface CardActivesResultsProps extends HTMLAttributes<HTMLDivElement> {
5
14
  icon: ReactNode;
6
15
  title: string;
@@ -100,4 +109,4 @@ interface CardAudioProps extends HTMLAttributes<HTMLDivElement> {
100
109
  }
101
110
  declare const CardAudio: react.ForwardRefExoticComponent<CardAudioProps & react.RefAttributes<HTMLDivElement>>;
102
111
 
103
- export { CardActivesResults, CardAudio, CardForum, CardPerformance, CardProgress, CardQuestions, CardResults, CardSettings, CardStatus, CardSupport, CardTopic };
112
+ export { CardActivesResults, CardAudio, CardBase, CardForum, CardPerformance, CardProgress, CardQuestions, CardResults, CardSettings, CardStatus, CardSupport, CardTopic };
@@ -22,6 +22,7 @@ var Card_exports = {};
22
22
  __export(Card_exports, {
23
23
  CardActivesResults: () => CardActivesResults,
24
24
  CardAudio: () => CardAudio,
25
+ CardBase: () => CardBase,
25
26
  CardForum: () => CardForum,
26
27
  CardPerformance: () => CardPerformance,
27
28
  CardProgress: () => CardProgress,
@@ -673,6 +674,58 @@ var ProgressBar_default = ProgressBar;
673
674
  // src/components/Card/Card.tsx
674
675
  var import_phosphor_react2 = require("phosphor-react");
675
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
+ );
676
729
  var ACTION_CARD_CLASSES = {
677
730
  warning: "bg-warning-background",
678
731
  success: "bg-success-300",
@@ -735,7 +788,7 @@ var CardActivesResults = (0, import_react.forwardRef)(
735
788
  children: icon
736
789
  }
737
790
  ),
738
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-text-800 font-medium uppercase text-2xs", children: title }),
791
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text_default, { size: "2xs", weight: "medium", className: "text-text-800 uppercase", children: title }),
739
792
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: `text-lg font-bold ${actionSubTitleClasses}`, children: subTitle })
740
793
  ]
741
794
  }
@@ -768,13 +821,13 @@ var CardQuestions = (0, import_react.forwardRef)(
768
821
  const stateLabel = isDone ? "Realizado" : "N\xE3o Realizado";
769
822
  const buttonLabel = isDone ? "Ver Quest\xE3o" : "Responder";
770
823
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
771
- "div",
824
+ CardBase,
772
825
  {
773
826
  ref,
774
- className: `
775
- w-full flex flex-row justify-between rounded-xl p-4 gap-4 bg-background border border-border-50
776
- ${className}
777
- `,
827
+ layout: "horizontal",
828
+ padding: "medium",
829
+ minHeight: "medium",
830
+ className: `justify-between gap-4 ${className}`,
778
831
  ...props,
779
832
  children: [
780
833
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "flex flex-col gap-1", children: [
@@ -834,35 +887,48 @@ var CardProgress = (0, import_react.forwardRef)(
834
887
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-text-600", children: endDate })
835
888
  ] })
836
889
  ] }),
837
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
838
- ProgressBar_default,
839
- {
840
- size: "medium",
841
- showPercentage: true,
842
- value: progress,
843
- "data-testid": "progress-bar"
844
- }
845
- )
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
+ ] })
846
912
  ] }),
847
913
  vertical: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm text-text-800", children: subhead })
848
914
  };
849
915
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
850
- "div",
916
+ CardBase,
851
917
  {
852
918
  ref,
853
- className: `
854
- w-full flex border border-border-50 bg-background rounded-xl cursor-pointer
855
- ${isHorizontal ? "flex-row h-20" : "flex-col"}
856
- ${className}
857
- `,
919
+ layout: isHorizontal ? "horizontal" : "vertical",
920
+ padding: "none",
921
+ minHeight: "medium",
922
+ cursor: "pointer",
923
+ className: `${isHorizontal ? "h-20" : ""} ${className}`,
858
924
  ...props,
859
925
  children: [
860
926
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
861
927
  "div",
862
928
  {
863
929
  className: `
864
- flex justify-center items-center [&>svg]:size-8 text-text-950
865
- ${isHorizontal ? "w-20 h-full rounded-l-xl" : "min-h-[50px] w-full rounded-t-xl"}
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"}
866
932
  `,
867
933
  style: {
868
934
  backgroundColor: color
@@ -878,7 +944,7 @@ var CardProgress = (0, import_react.forwardRef)(
878
944
  ${!isHorizontal && "gap-4"}
879
945
  `,
880
946
  children: [
881
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs font-bold text-text-950", children: header }),
947
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-950", children: header }),
882
948
  contentComponent[direction]
883
949
  ]
884
950
  }
@@ -898,18 +964,43 @@ var CardTopic = (0, import_react.forwardRef)(
898
964
  ...props
899
965
  }, ref) => {
900
966
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
901
- "div",
967
+ CardBase,
902
968
  {
903
969
  ref,
904
- 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}`,
970
+ layout: "vertical",
971
+ padding: "small",
972
+ minHeight: "medium",
973
+ cursor: "pointer",
974
+ className: `justify-center gap-2 py-2 px-4 ${className}`,
905
975
  ...props,
906
976
  children: [
907
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: [
908
978
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: text }),
909
979
  index < subHead.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: "\u2022" })
910
980
  ] }, `${text} - ${index}`)) }),
911
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs text-text-950 font-bold", children: header }),
912
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ProgressBar_default, { showPercentage, value: progress })
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
+ ] })
913
1004
  ]
914
1005
  }
915
1006
  );
@@ -927,15 +1018,18 @@ var CardPerformance = (0, import_react.forwardRef)(
927
1018
  }, ref) => {
928
1019
  const hasProgress = progress !== void 0;
929
1020
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
930
- "div",
1021
+ CardBase,
931
1022
  {
932
1023
  ref,
933
- className: `w-full min-h-20.5 flex flex-row justify-between p-4 gap-2 bg-background border border-border-50 ${className}`,
1024
+ layout: "horizontal",
1025
+ padding: "medium",
1026
+ minHeight: "large",
1027
+ className: `justify-between gap-2 ${className}`,
934
1028
  ...props,
935
1029
  children: [
936
1030
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "w-full flex flex-col justify-between gap-2", children: [
937
1031
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-row justify-between items-center", children: [
938
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-md font-bold text-text-950", children: header }),
1032
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-lg font-bold text-text-950", children: header }),
939
1033
  hasProgress && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
940
1034
  Button_default,
941
1035
  {
@@ -974,13 +1068,13 @@ var CardResults = (0, import_react.forwardRef)(
974
1068
  }, ref) => {
975
1069
  const isRow = direction == "row";
976
1070
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
977
- "div",
1071
+ CardBase,
978
1072
  {
979
1073
  ref,
980
- className: `
981
- w-full flex border border-border-50 bg-background rounded-xl min-h-20 flex-row items-center pr-4
982
- ${className}
983
- `,
1074
+ layout: "horizontal",
1075
+ padding: "none",
1076
+ minHeight: "medium",
1077
+ className: `items-center pr-4 ${className}`,
984
1078
  ...props,
985
1079
  children: [
986
1080
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -1003,7 +1097,7 @@ var CardResults = (0, import_react.forwardRef)(
1003
1097
  ${isRow ? "flex-row items-center" : "flex-col"}
1004
1098
  `,
1005
1099
  children: [
1006
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs font-bold text-text-950", children: header }),
1100
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm font-bold text-text-950", children: header }),
1007
1101
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex flex-row gap-1 items-center", children: [
1008
1102
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1009
1103
  Badge_default,
@@ -1044,13 +1138,13 @@ var CardResults = (0, import_react.forwardRef)(
1044
1138
  var CardStatus = (0, import_react.forwardRef)(
1045
1139
  ({ header, className, status, ...props }, ref) => {
1046
1140
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1047
- "div",
1141
+ CardBase,
1048
1142
  {
1049
1143
  ref,
1050
- className: `
1051
- w-full flex border border-border-50 bg-background rounded-xl min-h-20 flex-row items-center pr-4
1052
- ${className}
1053
- `,
1144
+ layout: "horizontal",
1145
+ padding: "none",
1146
+ minHeight: "medium",
1147
+ className: `items-center pr-4 ${className}`,
1054
1148
  ...props,
1055
1149
  children: [
1056
1150
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
@@ -1060,7 +1154,7 @@ var CardStatus = (0, import_react.forwardRef)(
1060
1154
  p-4 flex justify-between w-full h-full flex-row items-center
1061
1155
  `,
1062
1156
  children: [
1063
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs font-bold text-text-950", children: header }),
1157
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm font-bold text-text-950", children: header }),
1064
1158
  status && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex flex-row gap-1 items-center", children: [
1065
1159
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1066
1160
  Badge_default,
@@ -1086,14 +1180,17 @@ var CardStatus = (0, import_react.forwardRef)(
1086
1180
  var CardSettings = (0, import_react.forwardRef)(
1087
1181
  ({ header, className, icon, ...props }, ref) => {
1088
1182
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1089
- "div",
1183
+ CardBase,
1090
1184
  {
1091
1185
  ref,
1092
- className: `w-full p-2 flex flex-row items-center gap-2 text-text-700 bg-background rounded-xl ${className}`,
1186
+ layout: "horizontal",
1187
+ padding: "small",
1188
+ minHeight: "none",
1189
+ className: `border-none items-center gap-2 text-text-700 ${className}`,
1093
1190
  ...props,
1094
1191
  children: [
1095
1192
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "[&>svg]:size-6", children: icon }),
1096
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "w-full text-md", children: header }),
1193
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "w-full text-sm", children: header }),
1097
1194
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.CaretRight, { size: 24, className: "cursor-pointer" })
1098
1195
  ]
1099
1196
  }
@@ -1103,10 +1200,13 @@ var CardSettings = (0, import_react.forwardRef)(
1103
1200
  var CardSupport = (0, import_react.forwardRef)(
1104
1201
  ({ header, className, direction = "col", children, ...props }, ref) => {
1105
1202
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1106
- "div",
1203
+ CardBase,
1107
1204
  {
1108
1205
  ref,
1109
- className: `w-full p-4 flex flex-row items-center gap-2 text-text-700 bg-background rounded-xl ${className}`,
1206
+ layout: "horizontal",
1207
+ padding: "medium",
1208
+ minHeight: "none",
1209
+ className: `border-none items-center gap-2 text-text-700 ${className}`,
1110
1210
  ...props,
1111
1211
  children: [
1112
1212
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
@@ -1116,7 +1216,7 @@ var CardSupport = (0, import_react.forwardRef)(
1116
1216
  w-full flex ${direction == "col" ? "flex-col" : "flex-row items-center"} gap-2
1117
1217
  `,
1118
1218
  children: [
1119
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs text-text-950 font-bold", children: header }) }),
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 }) }),
1120
1220
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "flex flex-row gap-1", children })
1121
1221
  ]
1122
1222
  }
@@ -1142,10 +1242,14 @@ var CardForum = (0, import_react.forwardRef)(
1142
1242
  ...props
1143
1243
  }, ref) => {
1144
1244
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1145
- "div",
1245
+ CardBase,
1146
1246
  {
1147
1247
  ref,
1148
- className: `w-auto h-auto p-4 rounded-lg flex flex-row gap-3 border border-border-100 bg-background ${className}`,
1248
+ layout: "horizontal",
1249
+ padding: "medium",
1250
+ minHeight: "none",
1251
+ variant: "minimal",
1252
+ className: `w-auto h-auto gap-3 ${className}`,
1149
1253
  ...props,
1150
1254
  children: [
1151
1255
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -1272,10 +1376,13 @@ var CardAudio = (0, import_react.forwardRef)(
1272
1376
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.SpeakerHigh, {});
1273
1377
  };
1274
1378
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1275
- "div",
1379
+ CardBase,
1276
1380
  {
1277
1381
  ref,
1278
- className: `w-auto h-14 p-4 flex flex-row bg-background items-center gap-2 ${className}`,
1382
+ layout: "horizontal",
1383
+ padding: "medium",
1384
+ minHeight: "none",
1385
+ className: `w-auto h-14 items-center gap-2 border-none ${className}`,
1279
1386
  ...props,
1280
1387
  children: [
1281
1388
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -1431,6 +1538,7 @@ var CardAudio = (0, import_react.forwardRef)(
1431
1538
  0 && (module.exports = {
1432
1539
  CardActivesResults,
1433
1540
  CardAudio,
1541
+ CardBase,
1434
1542
  CardForum,
1435
1543
  CardPerformance,
1436
1544
  CardProgress,