@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
|
-
})
|
|
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 = [];
|
|
@@ -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