analytica-frontend-lib 1.0.71 → 1.0.73

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/index.mjs CHANGED
@@ -4038,6 +4038,125 @@ var CardSimulado = forwardRef9(
4038
4038
  );
4039
4039
  }
4040
4040
  );
4041
+ var CardTest = forwardRef9(
4042
+ ({
4043
+ title,
4044
+ duration,
4045
+ questionsCount,
4046
+ additionalInfo,
4047
+ selected = false,
4048
+ onSelect,
4049
+ className = "",
4050
+ ...props
4051
+ }, ref) => {
4052
+ const handleClick = () => {
4053
+ if (onSelect) {
4054
+ onSelect(!selected);
4055
+ }
4056
+ };
4057
+ const handleKeyDown = (event) => {
4058
+ if ((event.key === "Enter" || event.key === " ") && onSelect) {
4059
+ event.preventDefault();
4060
+ onSelect(!selected);
4061
+ }
4062
+ };
4063
+ const isSelectable = !!onSelect;
4064
+ const getQuestionsText = (count) => {
4065
+ const singular = count === 1 ? "quest\xE3o" : "quest\xF5es";
4066
+ return `${count} ${singular}`;
4067
+ };
4068
+ const displayInfo = questionsCount ? getQuestionsText(questionsCount) : additionalInfo || "";
4069
+ const baseClasses = "flex flex-row items-center p-4 gap-2 w-full max-w-full bg-background shadow-soft-shadow-1 rounded-xl isolate border-0 text-left";
4070
+ const interactiveClasses = isSelectable ? "cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary-950 focus:ring-offset-2" : "";
4071
+ const selectedClasses = selected ? "ring-2 ring-primary-950 ring-offset-2" : "";
4072
+ if (isSelectable) {
4073
+ return /* @__PURE__ */ jsx23(
4074
+ "button",
4075
+ {
4076
+ ref,
4077
+ type: "button",
4078
+ className: `${baseClasses} ${interactiveClasses} ${selectedClasses} ${className}`.trim(),
4079
+ onClick: handleClick,
4080
+ onKeyDown: handleKeyDown,
4081
+ "aria-pressed": selected,
4082
+ ...props,
4083
+ children: /* @__PURE__ */ jsxs18("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
4084
+ /* @__PURE__ */ jsx23(
4085
+ Text_default,
4086
+ {
4087
+ size: "md",
4088
+ weight: "bold",
4089
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
4090
+ children: title
4091
+ }
4092
+ ),
4093
+ /* @__PURE__ */ jsxs18("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
4094
+ duration && /* @__PURE__ */ jsxs18("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
4095
+ /* @__PURE__ */ jsx23(Clock, { size: 16, className: "text-text-700" }),
4096
+ /* @__PURE__ */ jsx23(
4097
+ Text_default,
4098
+ {
4099
+ size: "sm",
4100
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
4101
+ children: duration
4102
+ }
4103
+ )
4104
+ ] }),
4105
+ /* @__PURE__ */ jsx23(
4106
+ Text_default,
4107
+ {
4108
+ size: "sm",
4109
+ className: "text-text-700 leading-[21px] flex-grow truncate",
4110
+ children: displayInfo
4111
+ }
4112
+ )
4113
+ ] })
4114
+ ] })
4115
+ }
4116
+ );
4117
+ }
4118
+ return /* @__PURE__ */ jsx23(
4119
+ "div",
4120
+ {
4121
+ ref,
4122
+ className: `${baseClasses} ${className}`.trim(),
4123
+ ...props,
4124
+ children: /* @__PURE__ */ jsxs18("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
4125
+ /* @__PURE__ */ jsx23(
4126
+ Text_default,
4127
+ {
4128
+ size: "md",
4129
+ weight: "bold",
4130
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
4131
+ children: title
4132
+ }
4133
+ ),
4134
+ /* @__PURE__ */ jsxs18("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
4135
+ duration && /* @__PURE__ */ jsxs18("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
4136
+ /* @__PURE__ */ jsx23(Clock, { size: 16, className: "text-text-700" }),
4137
+ /* @__PURE__ */ jsx23(
4138
+ Text_default,
4139
+ {
4140
+ size: "sm",
4141
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
4142
+ children: duration
4143
+ }
4144
+ )
4145
+ ] }),
4146
+ /* @__PURE__ */ jsx23(
4147
+ Text_default,
4148
+ {
4149
+ size: "sm",
4150
+ className: "text-text-700 leading-[21px] flex-grow truncate min-w-0",
4151
+ children: displayInfo
4152
+ }
4153
+ )
4154
+ ] })
4155
+ ] })
4156
+ }
4157
+ );
4158
+ }
4159
+ );
4041
4160
 
4042
4161
  // src/components/Accordation/Accordation.tsx
4043
4162
  import { CaretRight as CaretRight2 } from "phosphor-react";
@@ -5781,164 +5900,6 @@ var useRouteAuth = (fallbackPath = "/") => {
5781
5900
  redirectToLogin
5782
5901
  };
5783
5902
  };
5784
-
5785
- // src/components/Tab/Tab.tsx
5786
- import { forwardRef as forwardRef17 } from "react";
5787
- import { Fragment as Fragment8, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
5788
- var TAB_SIZE_CLASSES = {
5789
- small: {
5790
- container: "h-10 gap-1",
5791
- tab: "px-3 py-2 text-sm",
5792
- indicator: "h-0.5"
5793
- },
5794
- medium: {
5795
- container: "h-12 gap-2",
5796
- tab: "px-4 py-4 text-sm",
5797
- indicator: "h-1"
5798
- },
5799
- large: {
5800
- container: "h-14 gap-2",
5801
- tab: "px-6 py-4 text-base",
5802
- indicator: "h-1"
5803
- }
5804
- };
5805
- var RESPONSIVE_WIDTH_CLASSES = {
5806
- twoTabs: "w-[115px] sm:w-[204px]",
5807
- threeTabs: "w-[100px] sm:w-[160px]",
5808
- fourTabs: "w-[80px] sm:w-[140px]",
5809
- fiveTabs: "w-[70px] sm:w-[120px]",
5810
- default: "flex-1"
5811
- };
5812
- var Tab = forwardRef17(
5813
- ({
5814
- tabs,
5815
- activeTab,
5816
- onTabChange,
5817
- size = "medium",
5818
- responsive = true,
5819
- className = "",
5820
- ...props
5821
- }, ref) => {
5822
- const sizeClasses = TAB_SIZE_CLASSES[size];
5823
- const getResponsiveWidthClass = (tabCount) => {
5824
- if (!responsive) return RESPONSIVE_WIDTH_CLASSES.default;
5825
- switch (tabCount) {
5826
- case 2:
5827
- return RESPONSIVE_WIDTH_CLASSES.twoTabs;
5828
- case 3:
5829
- return RESPONSIVE_WIDTH_CLASSES.threeTabs;
5830
- case 4:
5831
- return RESPONSIVE_WIDTH_CLASSES.fourTabs;
5832
- case 5:
5833
- return RESPONSIVE_WIDTH_CLASSES.fiveTabs;
5834
- default:
5835
- return RESPONSIVE_WIDTH_CLASSES.default;
5836
- }
5837
- };
5838
- const handleTabClick = (tabId) => {
5839
- const tab = tabs.find((t) => t.id === tabId);
5840
- if (tab && !tab.disabled) {
5841
- onTabChange(tabId);
5842
- }
5843
- };
5844
- const wrapAroundIndex = (index, maxLength) => {
5845
- if (index < 0) return maxLength - 1;
5846
- if (index >= maxLength) return 0;
5847
- return index;
5848
- };
5849
- const findNextValidTab = (startIndex, direction) => {
5850
- let nextIndex = wrapAroundIndex(startIndex + direction, tabs.length);
5851
- let attempts = 0;
5852
- while (tabs[nextIndex]?.disabled && attempts < tabs.length) {
5853
- nextIndex = wrapAroundIndex(nextIndex + direction, tabs.length);
5854
- attempts++;
5855
- }
5856
- return nextIndex;
5857
- };
5858
- const handleArrowNavigation = (direction) => {
5859
- const currentIndex = tabs.findIndex((tab) => tab.id === activeTab);
5860
- const nextIndex = findNextValidTab(currentIndex, direction);
5861
- if (!tabs[nextIndex]?.disabled && nextIndex !== currentIndex) {
5862
- handleTabClick(tabs[nextIndex].id);
5863
- }
5864
- };
5865
- const handleKeyDown = (event, tabId) => {
5866
- if (event.key === "Enter" || event.key === " ") {
5867
- event.preventDefault();
5868
- handleTabClick(tabId);
5869
- return;
5870
- }
5871
- if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
5872
- event.preventDefault();
5873
- const direction = event.key === "ArrowLeft" ? -1 : 1;
5874
- handleArrowNavigation(direction);
5875
- }
5876
- };
5877
- const getTabClassNames = (isDisabled, isActive) => {
5878
- if (isDisabled) {
5879
- return "text-text-400 cursor-not-allowed opacity-50";
5880
- }
5881
- if (isActive) {
5882
- return "text-text-950";
5883
- }
5884
- return "text-text-700 hover:text-text-800";
5885
- };
5886
- const tabWidthClass = getResponsiveWidthClass(tabs.length);
5887
- const containerWidth = responsive && tabs.length <= 2 ? "w-[240px] sm:w-[416px]" : "w-full";
5888
- return /* @__PURE__ */ jsx32(
5889
- "div",
5890
- {
5891
- ref,
5892
- className: `flex flex-row items-start ${sizeClasses.container} ${containerWidth} ${className}`,
5893
- role: "tablist",
5894
- ...props,
5895
- children: tabs.map((tab) => {
5896
- const isActive = tab.id === activeTab;
5897
- const isDisabled = Boolean(tab.disabled);
5898
- const tabClassNames = getTabClassNames(isDisabled, isActive);
5899
- return /* @__PURE__ */ jsxs26(
5900
- "button",
5901
- {
5902
- type: "button",
5903
- role: "tab",
5904
- "aria-selected": isActive,
5905
- "aria-disabled": isDisabled,
5906
- tabIndex: isActive ? 0 : -1,
5907
- className: `
5908
- relative flex flex-row justify-center items-center gap-2 rounded transition-colors isolate
5909
- ${sizeClasses.tab}
5910
- ${tabWidthClass}
5911
- ${tabClassNames}
5912
- ${!isDisabled && !isActive ? "hover:bg-background-50" : ""}
5913
- focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2
5914
- `,
5915
- onClick: () => handleTabClick(tab.id),
5916
- onKeyDown: (e) => handleKeyDown(e, tab.id),
5917
- disabled: isDisabled,
5918
- "data-testid": `tab-${tab.id}`,
5919
- children: [
5920
- /* @__PURE__ */ jsx32("span", { className: "font-bold leading-4 tracking-[0.2px] truncate", children: responsive && tab.mobileLabel ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
5921
- /* @__PURE__ */ jsx32("span", { className: "sm:hidden", children: tab.mobileLabel }),
5922
- /* @__PURE__ */ jsx32("span", { className: "hidden sm:inline", children: tab.label })
5923
- ] }) : tab.label }),
5924
- isActive && /* @__PURE__ */ jsx32(
5925
- "div",
5926
- {
5927
- className: `absolute bottom-0 left-2 right-2 bg-primary-700 rounded-lg z-[2] ${sizeClasses.indicator}`,
5928
- "data-testid": "active-indicator"
5929
- }
5930
- )
5931
- ]
5932
- },
5933
- tab.id
5934
- );
5935
- })
5936
- }
5937
- );
5938
- }
5939
- );
5940
- Tab.displayName = "Tab";
5941
- var Tab_default = Tab;
5942
5903
  export {
5943
5904
  Alert_default as Alert,
5944
5905
  AlertDialog,
@@ -6000,7 +5961,6 @@ export {
6000
5961
  SkeletonTable,
6001
5962
  SkeletonText,
6002
5963
  Stepper_default as Stepper,
6003
- Tab_default as Tab,
6004
5964
  Table_default as Table,
6005
5965
  Text_default as Text,
6006
5966
  TextArea_default as TextArea,