@megha-ui/react 1.2.767 → 1.2.770

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.
@@ -29,6 +29,6 @@ const Card = ({ header, content, footer, className, borderRadius = "0.5rem", wid
29
29
  setRemovalHeight(`${_removalHeight}px`);
30
30
  }
31
31
  }, [header, footer]);
32
- return (_jsxs("div", { ref: cardRef, className: `wk-card ${className}`, style: cardStyle, children: [header && (_jsx("div", { id: "header", className: "wk-card-header", children: header })), _jsx("div", { className: "wk-card-content", style: { height: `calc(100% - ${removalHeight})`, overflow: "auto" }, children: content }), footer && (_jsx("div", { id: "footer", className: "wk-card-footer", children: footer }))] }));
32
+ return (_jsxs("div", { ref: cardRef, className: `wk-card ${className}`, style: cardStyle, children: [header && (_jsx("div", { id: "header", className: "wk-card-header", children: header })), _jsx("div", { className: "wk-card-content", style: { height: height === "max-content" ? "max-content" : `calc(100% - ${removalHeight})`, overflow: "auto" }, children: content }), footer && (_jsx("div", { id: "footer", className: "wk-card-footer", children: footer }))] }));
33
33
  };
34
34
  export default Card;
@@ -25,6 +25,7 @@ interface TabPanelProps {
25
25
  children: ReactNode;
26
26
  className?: string;
27
27
  padding?: string | number;
28
+ getActiveTab?: (tab: string) => void;
28
29
  }
29
30
  export declare const TabPanel: React.FC<TabPanelProps>;
30
31
  export {};
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, createContext, useContext } from "react";
2
+ import { useState, createContext, useContext, useEffect, } from "react";
3
3
  const TabsContext = createContext(undefined);
4
4
  export const Tabs = ({ children, defaultActive, className, type = "horizontal", showTabNumber = false, showTabDescription = false, }) => {
5
5
  const [activeTab, setActiveTab] = useState(defaultActive || "");
@@ -70,13 +70,18 @@ export const Tab = ({ label, description, tabNumber }) => {
70
70
  fontSize: "0.85rem",
71
71
  }, children: description }))] })] }) }));
72
72
  };
73
- export const TabPanel = ({ label, children, className, padding, }) => {
73
+ export const TabPanel = ({ label, children, className, padding, getActiveTab, }) => {
74
74
  const context = useContext(TabsContext);
75
75
  if (!context) {
76
76
  throw new Error("TabPanel component must be used inside Tabs.");
77
77
  }
78
78
  const { activeTab } = context;
79
79
  const isActive = activeTab === label;
80
+ useEffect(() => {
81
+ if (activeTab && getActiveTab) {
82
+ getActiveTab(activeTab);
83
+ }
84
+ }, [activeTab]);
80
85
  return isActive ? (_jsx("div", { className: className, style: {
81
86
  flex: 1,
82
87
  background: "var(--tab-panal-bg)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.767",
3
+ "version": "1.2.770",
4
4
  "description": "A collection of reusable UI components for React applications, built with TypeScript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",