@megha-ui/react 1.2.766 → 1.2.769

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.
@@ -152,9 +152,12 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
152
152
  bValue.toString().includes("-")) {
153
153
  aValue = aValue.toString().split("-")[0];
154
154
  bValue = bValue.toString().split("-")[0];
155
+ aValue = isNaN(parseFloat(aValue)) ? aValue : parseFloat(aValue);
156
+ bValue = isNaN(parseFloat(bValue)) ? bValue : parseFloat(bValue);
155
157
  }
156
158
  return aValue > bValue ? 1 : -1;
157
- }).filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()))
159
+ })
160
+ .filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()))
158
161
  : options.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
159
162
  setFilteredOptions(_options);
160
163
  const grouped = [];
@@ -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.766",
3
+ "version": "1.2.769",
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",