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.d.mts CHANGED
@@ -30,7 +30,6 @@ export { default as Menu, MenuContent, MenuItem, MenuOverflow } from './Menu/ind
30
30
  export { CardActivitiesResults, CardPerformance, CardProgress, CardQuestions, CardResults, CardSimulado, CardStatus, CardTopic } from './Card/index.mjs';
31
31
  export { Skeleton, SkeletonCard, SkeletonCircle, SkeletonList, SkeletonRectangle, SkeletonRounded, SkeletonTable, SkeletonText } from './Skeleton/index.mjs';
32
32
  export { AuthProvider, ProtectedRoute, PublicRoute, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.mjs';
33
- export { default as Tab } from './Tab/index.mjs';
34
33
  import 'react/jsx-runtime';
35
34
  import 'react';
36
35
  import 'zustand';
package/dist/index.d.ts CHANGED
@@ -30,7 +30,6 @@ export { default as Menu, MenuContent, MenuItem, MenuOverflow } from './Menu/ind
30
30
  export { CardActivitiesResults, CardPerformance, CardProgress, CardQuestions, CardResults, CardSimulado, CardStatus, CardTopic } from './Card/index.js';
31
31
  export { Skeleton, SkeletonCard, SkeletonCircle, SkeletonList, SkeletonRectangle, SkeletonRounded, SkeletonTable, SkeletonText } from './Skeleton/index.js';
32
32
  export { AuthProvider, ProtectedRoute, PublicRoute, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.js';
33
- export { default as Tab } from './Tab/index.js';
34
33
  import 'react/jsx-runtime';
35
34
  import 'react';
36
35
  import 'zustand';
package/dist/index.js CHANGED
@@ -80,7 +80,6 @@ __export(src_exports, {
80
80
  SkeletonTable: () => SkeletonTable,
81
81
  SkeletonText: () => SkeletonText,
82
82
  Stepper: () => Stepper_default,
83
- Tab: () => Tab_default,
84
83
  Table: () => Table_default,
85
84
  Text: () => Text_default,
86
85
  TextArea: () => TextArea_default,
@@ -4091,6 +4090,125 @@ var CardSimulado = (0, import_react11.forwardRef)(
4091
4090
  );
4092
4091
  }
4093
4092
  );
4093
+ var CardTest = (0, import_react11.forwardRef)(
4094
+ ({
4095
+ title,
4096
+ duration,
4097
+ questionsCount,
4098
+ additionalInfo,
4099
+ selected = false,
4100
+ onSelect,
4101
+ className = "",
4102
+ ...props
4103
+ }, ref) => {
4104
+ const handleClick = () => {
4105
+ if (onSelect) {
4106
+ onSelect(!selected);
4107
+ }
4108
+ };
4109
+ const handleKeyDown = (event) => {
4110
+ if ((event.key === "Enter" || event.key === " ") && onSelect) {
4111
+ event.preventDefault();
4112
+ onSelect(!selected);
4113
+ }
4114
+ };
4115
+ const isSelectable = !!onSelect;
4116
+ const getQuestionsText = (count) => {
4117
+ const singular = count === 1 ? "quest\xE3o" : "quest\xF5es";
4118
+ return `${count} ${singular}`;
4119
+ };
4120
+ const displayInfo = questionsCount ? getQuestionsText(questionsCount) : additionalInfo || "";
4121
+ 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";
4122
+ const interactiveClasses = isSelectable ? "cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary-950 focus:ring-offset-2" : "";
4123
+ const selectedClasses = selected ? "ring-2 ring-primary-950 ring-offset-2" : "";
4124
+ if (isSelectable) {
4125
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4126
+ "button",
4127
+ {
4128
+ ref,
4129
+ type: "button",
4130
+ className: `${baseClasses} ${interactiveClasses} ${selectedClasses} ${className}`.trim(),
4131
+ onClick: handleClick,
4132
+ onKeyDown: handleKeyDown,
4133
+ "aria-pressed": selected,
4134
+ ...props,
4135
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
4136
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4137
+ Text_default,
4138
+ {
4139
+ size: "md",
4140
+ weight: "bold",
4141
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
4142
+ children: title
4143
+ }
4144
+ ),
4145
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
4146
+ duration && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
4147
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.Clock, { size: 16, className: "text-text-700" }),
4148
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4149
+ Text_default,
4150
+ {
4151
+ size: "sm",
4152
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
4153
+ children: duration
4154
+ }
4155
+ )
4156
+ ] }),
4157
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4158
+ Text_default,
4159
+ {
4160
+ size: "sm",
4161
+ className: "text-text-700 leading-[21px] flex-grow truncate",
4162
+ children: displayInfo
4163
+ }
4164
+ )
4165
+ ] })
4166
+ ] })
4167
+ }
4168
+ );
4169
+ }
4170
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4171
+ "div",
4172
+ {
4173
+ ref,
4174
+ className: `${baseClasses} ${className}`.trim(),
4175
+ ...props,
4176
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
4177
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4178
+ Text_default,
4179
+ {
4180
+ size: "md",
4181
+ weight: "bold",
4182
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
4183
+ children: title
4184
+ }
4185
+ ),
4186
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
4187
+ duration && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
4188
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.Clock, { size: 16, className: "text-text-700" }),
4189
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4190
+ Text_default,
4191
+ {
4192
+ size: "sm",
4193
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
4194
+ children: duration
4195
+ }
4196
+ )
4197
+ ] }),
4198
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4199
+ Text_default,
4200
+ {
4201
+ size: "sm",
4202
+ className: "text-text-700 leading-[21px] flex-grow truncate min-w-0",
4203
+ children: displayInfo
4204
+ }
4205
+ )
4206
+ ] })
4207
+ ] })
4208
+ }
4209
+ );
4210
+ }
4211
+ );
4094
4212
 
4095
4213
  // src/components/Accordation/Accordation.tsx
4096
4214
  var import_phosphor_react11 = require("phosphor-react");
@@ -5799,164 +5917,6 @@ var useRouteAuth = (fallbackPath = "/") => {
5799
5917
  redirectToLogin
5800
5918
  };
5801
5919
  };
5802
-
5803
- // src/components/Tab/Tab.tsx
5804
- var import_react20 = require("react");
5805
- var import_jsx_runtime32 = require("react/jsx-runtime");
5806
- var TAB_SIZE_CLASSES = {
5807
- small: {
5808
- container: "h-10 gap-1",
5809
- tab: "px-3 py-2 text-sm",
5810
- indicator: "h-0.5"
5811
- },
5812
- medium: {
5813
- container: "h-12 gap-2",
5814
- tab: "px-4 py-4 text-sm",
5815
- indicator: "h-1"
5816
- },
5817
- large: {
5818
- container: "h-14 gap-2",
5819
- tab: "px-6 py-4 text-base",
5820
- indicator: "h-1"
5821
- }
5822
- };
5823
- var RESPONSIVE_WIDTH_CLASSES = {
5824
- twoTabs: "w-[115px] sm:w-[204px]",
5825
- threeTabs: "w-[100px] sm:w-[160px]",
5826
- fourTabs: "w-[80px] sm:w-[140px]",
5827
- fiveTabs: "w-[70px] sm:w-[120px]",
5828
- default: "flex-1"
5829
- };
5830
- var Tab = (0, import_react20.forwardRef)(
5831
- ({
5832
- tabs,
5833
- activeTab,
5834
- onTabChange,
5835
- size = "medium",
5836
- responsive = true,
5837
- className = "",
5838
- ...props
5839
- }, ref) => {
5840
- const sizeClasses = TAB_SIZE_CLASSES[size];
5841
- const getResponsiveWidthClass = (tabCount) => {
5842
- if (!responsive) return RESPONSIVE_WIDTH_CLASSES.default;
5843
- switch (tabCount) {
5844
- case 2:
5845
- return RESPONSIVE_WIDTH_CLASSES.twoTabs;
5846
- case 3:
5847
- return RESPONSIVE_WIDTH_CLASSES.threeTabs;
5848
- case 4:
5849
- return RESPONSIVE_WIDTH_CLASSES.fourTabs;
5850
- case 5:
5851
- return RESPONSIVE_WIDTH_CLASSES.fiveTabs;
5852
- default:
5853
- return RESPONSIVE_WIDTH_CLASSES.default;
5854
- }
5855
- };
5856
- const handleTabClick = (tabId) => {
5857
- const tab = tabs.find((t) => t.id === tabId);
5858
- if (tab && !tab.disabled) {
5859
- onTabChange(tabId);
5860
- }
5861
- };
5862
- const wrapAroundIndex = (index, maxLength) => {
5863
- if (index < 0) return maxLength - 1;
5864
- if (index >= maxLength) return 0;
5865
- return index;
5866
- };
5867
- const findNextValidTab = (startIndex, direction) => {
5868
- let nextIndex = wrapAroundIndex(startIndex + direction, tabs.length);
5869
- let attempts = 0;
5870
- while (tabs[nextIndex]?.disabled && attempts < tabs.length) {
5871
- nextIndex = wrapAroundIndex(nextIndex + direction, tabs.length);
5872
- attempts++;
5873
- }
5874
- return nextIndex;
5875
- };
5876
- const handleArrowNavigation = (direction) => {
5877
- const currentIndex = tabs.findIndex((tab) => tab.id === activeTab);
5878
- const nextIndex = findNextValidTab(currentIndex, direction);
5879
- if (!tabs[nextIndex]?.disabled && nextIndex !== currentIndex) {
5880
- handleTabClick(tabs[nextIndex].id);
5881
- }
5882
- };
5883
- const handleKeyDown = (event, tabId) => {
5884
- if (event.key === "Enter" || event.key === " ") {
5885
- event.preventDefault();
5886
- handleTabClick(tabId);
5887
- return;
5888
- }
5889
- if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
5890
- event.preventDefault();
5891
- const direction = event.key === "ArrowLeft" ? -1 : 1;
5892
- handleArrowNavigation(direction);
5893
- }
5894
- };
5895
- const getTabClassNames = (isDisabled, isActive) => {
5896
- if (isDisabled) {
5897
- return "text-text-400 cursor-not-allowed opacity-50";
5898
- }
5899
- if (isActive) {
5900
- return "text-text-950";
5901
- }
5902
- return "text-text-700 hover:text-text-800";
5903
- };
5904
- const tabWidthClass = getResponsiveWidthClass(tabs.length);
5905
- const containerWidth = responsive && tabs.length <= 2 ? "w-[240px] sm:w-[416px]" : "w-full";
5906
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5907
- "div",
5908
- {
5909
- ref,
5910
- className: `flex flex-row items-start ${sizeClasses.container} ${containerWidth} ${className}`,
5911
- role: "tablist",
5912
- ...props,
5913
- children: tabs.map((tab) => {
5914
- const isActive = tab.id === activeTab;
5915
- const isDisabled = Boolean(tab.disabled);
5916
- const tabClassNames = getTabClassNames(isDisabled, isActive);
5917
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
5918
- "button",
5919
- {
5920
- type: "button",
5921
- role: "tab",
5922
- "aria-selected": isActive,
5923
- "aria-disabled": isDisabled,
5924
- tabIndex: isActive ? 0 : -1,
5925
- className: `
5926
- relative flex flex-row justify-center items-center gap-2 rounded transition-colors isolate
5927
- ${sizeClasses.tab}
5928
- ${tabWidthClass}
5929
- ${tabClassNames}
5930
- ${!isDisabled && !isActive ? "hover:bg-background-50" : ""}
5931
- focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2
5932
- `,
5933
- onClick: () => handleTabClick(tab.id),
5934
- onKeyDown: (e) => handleKeyDown(e, tab.id),
5935
- disabled: isDisabled,
5936
- "data-testid": `tab-${tab.id}`,
5937
- children: [
5938
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "font-bold leading-4 tracking-[0.2px] truncate", children: responsive && tab.mobileLabel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
5939
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "sm:hidden", children: tab.mobileLabel }),
5940
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "hidden sm:inline", children: tab.label })
5941
- ] }) : tab.label }),
5942
- isActive && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5943
- "div",
5944
- {
5945
- className: `absolute bottom-0 left-2 right-2 bg-primary-700 rounded-lg z-[2] ${sizeClasses.indicator}`,
5946
- "data-testid": "active-indicator"
5947
- }
5948
- )
5949
- ]
5950
- },
5951
- tab.id
5952
- );
5953
- })
5954
- }
5955
- );
5956
- }
5957
- );
5958
- Tab.displayName = "Tab";
5959
- var Tab_default = Tab;
5960
5920
  // Annotate the CommonJS export names for ESM import in node:
5961
5921
  0 && (module.exports = {
5962
5922
  Alert,
@@ -6019,7 +5979,6 @@ var Tab_default = Tab;
6019
5979
  SkeletonTable,
6020
5980
  SkeletonText,
6021
5981
  Stepper,
6022
- Tab,
6023
5982
  Table,
6024
5983
  Text,
6025
5984
  TextArea,