@megha-ui/react 1.3.135 → 1.3.137
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.
|
@@ -1138,6 +1138,17 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
|
|
|
1138
1138
|
freezeColumnsAvailable ||
|
|
1139
1139
|
filterDetails.filtersUpdated ||
|
|
1140
1140
|
hasCustomOperation;
|
|
1141
|
+
console.log({
|
|
1142
|
+
shouldShowHeaderActionsSpacer,
|
|
1143
|
+
isSummarise,
|
|
1144
|
+
showHideAvailable,
|
|
1145
|
+
exportAvailable,
|
|
1146
|
+
isHideDupsAvailable,
|
|
1147
|
+
fullScreen,
|
|
1148
|
+
freezeColumnsAvailable,
|
|
1149
|
+
filterDetails,
|
|
1150
|
+
hasCustomOperation,
|
|
1151
|
+
});
|
|
1141
1152
|
useEffect(() => {
|
|
1142
1153
|
if (showHideAvailable ||
|
|
1143
1154
|
exportAvailable ||
|
|
@@ -6,6 +6,7 @@ interface TabsProps {
|
|
|
6
6
|
type?: "horizontal" | "vertical";
|
|
7
7
|
showTabNumber?: boolean;
|
|
8
8
|
showTabDescription?: boolean;
|
|
9
|
+
getActiveTab?: (tab: string) => void;
|
|
9
10
|
}
|
|
10
11
|
export declare const Tabs: React.FC<TabsProps>;
|
|
11
12
|
interface TabListProps {
|
|
@@ -25,7 +26,6 @@ interface TabPanelProps {
|
|
|
25
26
|
children: ReactNode;
|
|
26
27
|
className?: string;
|
|
27
28
|
padding?: string | number;
|
|
28
|
-
getActiveTab?: (tab: string) => void;
|
|
29
29
|
}
|
|
30
30
|
export declare const TabPanel: React.FC<TabPanelProps>;
|
|
31
31
|
export {};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, createContext, useContext, useEffect, } from "react";
|
|
3
3
|
const TabsContext = createContext(undefined);
|
|
4
|
-
export const Tabs = ({ children, defaultActive, className, type = "horizontal", showTabNumber = false, showTabDescription = false, }) => {
|
|
4
|
+
export const Tabs = ({ children, defaultActive, className, type = "horizontal", showTabNumber = false, showTabDescription = false, getActiveTab, }) => {
|
|
5
5
|
const [activeTab, setActiveTab] = useState(defaultActive || "");
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (activeTab && getActiveTab) {
|
|
8
|
+
getActiveTab(activeTab);
|
|
9
|
+
}
|
|
10
|
+
}, [activeTab, getActiveTab]);
|
|
6
11
|
return (_jsx(TabsContext.Provider, { value: {
|
|
7
12
|
activeTab,
|
|
8
13
|
setActiveTab,
|
|
@@ -63,18 +68,13 @@ export const Tab = ({ label, description, tabNumber }) => {
|
|
|
63
68
|
fontSize: "0.85rem",
|
|
64
69
|
}, children: description }))] })] }) }));
|
|
65
70
|
};
|
|
66
|
-
export const TabPanel = ({ label, children, className, padding,
|
|
71
|
+
export const TabPanel = ({ label, children, className, padding, }) => {
|
|
67
72
|
const context = useContext(TabsContext);
|
|
68
73
|
if (!context) {
|
|
69
74
|
throw new Error("TabPanel component must be used inside Tabs.");
|
|
70
75
|
}
|
|
71
76
|
const { activeTab } = context;
|
|
72
77
|
const isActive = activeTab === label;
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
if (activeTab && getActiveTab) {
|
|
75
|
-
getActiveTab(activeTab);
|
|
76
|
-
}
|
|
77
|
-
}, [activeTab]);
|
|
78
78
|
return isActive ? (_jsx("div", { className: className, style: {
|
|
79
79
|
flex: 1,
|
|
80
80
|
background: "var(--tab-panal-bg)",
|
package/package.json
CHANGED