analytica-frontend-lib 1.0.71 → 1.0.72
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.css +0 -84
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -160
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -159
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +0 -84
- package/dist/styles.css.map +1 -1
- package/package.json +1 -2
- package/dist/Tab/index.d.mts +0 -37
- package/dist/Tab/index.d.ts +0 -37
- package/dist/Tab/index.js +0 -182
- package/dist/Tab/index.js.map +0 -1
- package/dist/Tab/index.mjs +0 -161
- package/dist/Tab/index.mjs.map +0 -1
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,
|
|
@@ -5799,164 +5798,6 @@ var useRouteAuth = (fallbackPath = "/") => {
|
|
|
5799
5798
|
redirectToLogin
|
|
5800
5799
|
};
|
|
5801
5800
|
};
|
|
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
5801
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5961
5802
|
0 && (module.exports = {
|
|
5962
5803
|
Alert,
|
|
@@ -6019,7 +5860,6 @@ var Tab_default = Tab;
|
|
|
6019
5860
|
SkeletonTable,
|
|
6020
5861
|
SkeletonText,
|
|
6021
5862
|
Stepper,
|
|
6022
|
-
Tab,
|
|
6023
5863
|
Table,
|
|
6024
5864
|
Text,
|
|
6025
5865
|
TextArea,
|