@megha-ui/react 1.3.93 → 1.3.96

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.
@@ -1,24 +1,8 @@
1
1
  import React from "react";
2
- interface DropdownOption {
3
- label: string;
4
- value: string;
5
- action: (columnKey: string, optionValue: string) => void;
6
- }
7
- interface MenuPosition {
8
- top: number;
9
- left: number;
10
- }
11
2
  interface GridFilterDropdownProps {
12
- searchOptions: DropdownOption[];
13
- position: MenuPosition;
14
- combined: boolean;
15
- columnKey: string;
16
- activeSearchType: string;
17
- searchElement: any;
18
3
  headerDropdownIndex?: number;
19
4
  sortingOps?: any;
20
- searchable: boolean;
21
- searchInput?: any;
5
+ searchOps?: any | null;
22
6
  columnIndex: number;
23
7
  }
24
8
  declare const TextFilterDropdown: React.FC<GridFilterDropdownProps>;
@@ -1,32 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect } from "react";
3
- import Dropdown from "../../dropdown";
4
- const TextFilterDropdown = ({ headerDropdownIndex, searchOptions, combined, position, columnKey, searchElement, activeSearchType, sortingOps, searchable, searchInput, columnIndex, }) => {
5
- useEffect(() => {
6
- var _a;
7
- if (searchElement) {
8
- const _searchElement = document.getElementById("search-input");
9
- if (_searchElement) {
10
- const ele = _searchElement.getElementsByTagName("input");
11
- (_a = ele.item(0)) === null || _a === void 0 ? void 0 : _a.focus();
12
- }
13
- }
14
- }, []);
15
- const handleDropdownChange = (selected, columnKey) => {
16
- const clickedOption = searchOptions.find((item) => selected === item.value);
17
- clickedOption === null || clickedOption === void 0 ? void 0 : clickedOption.action(columnKey, selected);
18
- };
19
- return (_jsxs("div", { style: Object.assign(Object.assign({ position: "absolute", top: combined ? 0 : "calc(100% + 5px)" }, (combined
20
- ? {
21
- left: "100%",
22
- }
23
- : columnIndex > 1
24
- ? { right: 0 }
25
- : { left: 0 })), { zIndex: headerDropdownIndex ? headerDropdownIndex : 1000, backgroundColor: "var(--background)", color: "var(--foreground)", boxShadow: "0px 0.5rem 1rem 0px rgba(0,0,0,0.2)", listStyleType: "none", padding: "0.25rem 0", width: 230, borderRadius: "0.5rem", margin: 0 }), id: "grid-dropdown", onClick: (e) => e.stopPropagation(), children: [searchInput && searchInput, sortingOps && sortingOps, _jsx("div", { style: {
26
- padding: "0.5rem 0.75rem",
27
- }, children: _jsx(Dropdown, { options: searchOptions, selectedValues: [activeSearchType], onChange: (selected) => { var _a; return handleDropdownChange((_a = selected[0].toString()) !== null && _a !== void 0 ? _a : "", columnKey); }, searchEnabled: false, maxDropdownHeight: 350 }) }), !["blank", "notblank"].includes(activeSearchType.toLowerCase()) && (_jsx("div", { style: {
28
- padding: "0.5rem 0.75rem",
29
- cursor: "pointer",
30
- }, children: searchElement }))] }));
2
+ const TextFilterDropdown = ({ headerDropdownIndex, sortingOps, searchOps, columnIndex, }) => {
3
+ return (_jsx("div", { style: Object.assign(Object.assign({ position: "absolute", top: "calc(100% + 5px)" }, (columnIndex > 1 ? { right: 0 } : { left: 0 })), { zIndex: headerDropdownIndex ? headerDropdownIndex : 1000, backgroundColor: "var(--card-bg, var(--background))", color: "var(--foreground)", boxShadow: "0px 0.5rem 1rem 0px rgba(0,0,0,0.2)", border: "1px solid var(--divider, #eceff4)", listStyleType: "none", padding: "0.25rem 0.35rem", width: 230, borderRadius: "0.5rem", margin: 0 }), id: "grid-dropdown", onClick: (e) => e.stopPropagation(), children: _jsxs("div", { style: {
4
+ display: "flex",
5
+ flexDirection: "column",
6
+ gap: "0.25rem",
7
+ }, children: [sortingOps && (_jsx("div", { style: {
8
+ padding: "0.35rem 0.5rem 0.25rem",
9
+ borderBottom: searchOps
10
+ ? "1px solid var(--divider, #eceff4)"
11
+ : "none",
12
+ }, children: sortingOps })), searchOps && (_jsx("div", { style: {
13
+ padding: "0.25rem 0.5rem 0.35rem",
14
+ }, children: searchOps }))] }) }));
31
15
  };
32
16
  export default TextFilterDropdown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.3.93",
3
+ "version": "1.3.96",
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",