@megha-ui/react 1.2.782 → 1.2.784

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.
@@ -26,6 +26,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
26
26
  top: "100%",
27
27
  });
28
28
  const [collapsed, setCollapsed] = useState("");
29
+ const [height, setHeight] = useState(0);
29
30
  const calculateAutoPosition = () => {
30
31
  if (!wrapperRef.current)
31
32
  return;
@@ -297,6 +298,9 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
297
298
  };
298
299
  const handleClick = (e) => {
299
300
  const clearEle = document.getElementById(clearId || "");
301
+ const screen = document.body.clientHeight;
302
+ const rect = e.currentTarget.getBoundingClientRect();
303
+ setHeight(screen - rect.bottom);
300
304
  if (clearEle === e.target) {
301
305
  e.preventDefault();
302
306
  }
@@ -385,7 +389,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
385
389
  display: "flex",
386
390
  alignItems: "start",
387
391
  width: "100%",
388
- }, children: _jsx("span", { children: "Select All" }) })] })), _jsx("div", { style: { maxHeight: maxDropdownHeight, overflowY: "auto" }, children: isLoading ? (_jsxs(Block, { as: "div", className: "flex items-center justify-between", children: [_jsx(Text, { as: "span", children: "Loading options" }), _jsx(Loader, { size: 12 })] })) : isCreatable && filteredOptions.length < 1 && searchTerm ? (_jsxs("li", { onClick: (e) => onCreate(searchTerm), style: Object.assign(Object.assign({}, listItemStyle), { display: "flex", alignItems: "center", wordWrap: "break-word", textWrap: "wrap", justifyContent: "space-between" }), children: [isMultiple && (_jsx(Checkbox, { selected: intermediateValues.includes(searchTerm), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper })), _jsx("div", { style: {
392
+ }, children: _jsx("span", { children: "Select All" }) })] })), _jsx("div", { style: { maxHeight: maxDropdownHeight !== null && maxDropdownHeight !== void 0 ? maxDropdownHeight : `${height}px`, overflowY: "auto" }, children: isLoading ? (_jsxs(Block, { as: "div", className: "flex items-center justify-between", children: [_jsx(Text, { as: "span", children: "Loading options" }), _jsx(Loader, { size: 12 })] })) : isCreatable && filteredOptions.length < 1 && searchTerm ? (_jsxs("li", { onClick: (e) => onCreate(searchTerm), style: Object.assign(Object.assign({}, listItemStyle), { display: "flex", alignItems: "center", wordWrap: "break-word", textWrap: "wrap", justifyContent: "space-between" }), children: [isMultiple && (_jsx(Checkbox, { selected: intermediateValues.includes(searchTerm), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper })), _jsx("div", { style: {
389
393
  display: "flex",
390
394
  alignItems: "start",
391
395
  width: "100%",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.782",
3
+ "version": "1.2.784",
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",