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.mjs CHANGED
@@ -5781,164 +5781,6 @@ var useRouteAuth = (fallbackPath = "/") => {
5781
5781
  redirectToLogin
5782
5782
  };
5783
5783
  };
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
5784
  export {
5943
5785
  Alert_default as Alert,
5944
5786
  AlertDialog,
@@ -6000,7 +5842,6 @@ export {
6000
5842
  SkeletonTable,
6001
5843
  SkeletonText,
6002
5844
  Stepper_default as Stepper,
6003
- Tab_default as Tab,
6004
5845
  Table_default as Table,
6005
5846
  Text_default as Text,
6006
5847
  TextArea_default as TextArea,