@megha-ui/react 1.2.170 → 1.2.171

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.
Files changed (43) hide show
  1. package/dist/components/block/index.js +3 -5
  2. package/dist/components/button/index.js +3 -5
  3. package/dist/components/button/types/borderStyle.js +1 -2
  4. package/dist/components/button/types/cursorType.js +1 -2
  5. package/dist/components/card/index.js +7 -9
  6. package/dist/components/checkbox/index.js +7 -9
  7. package/dist/components/date-input/index.js +6 -8
  8. package/dist/components/dropdown/index.js +42 -47
  9. package/dist/components/grid/hooks/useBulkSelect.js +6 -10
  10. package/dist/components/grid/hooks/usePagination.js +6 -10
  11. package/dist/components/grid/hooks/useResizeObserver.js +3 -5
  12. package/dist/components/grid/hooks/useSearch.js +3 -7
  13. package/dist/components/grid/hooks/useSort.js +4 -8
  14. package/dist/components/grid/hooks/useVisibleData.js +6 -10
  15. package/dist/components/grid/index.js +149 -186
  16. package/dist/components/grid/types/grid.d.ts +1 -0
  17. package/dist/components/grid/types/grid.js +1 -2
  18. package/dist/components/grid/utils/SummariseDetails.js +12 -17
  19. package/dist/components/grid/utils/calculatedropdown.js +4 -6
  20. package/dist/components/grid/utils/globalSearchChips.js +11 -16
  21. package/dist/components/grid/utils/gridFilterDropdown.js +22 -27
  22. package/dist/components/grid/utils/gridHeader.js +78 -118
  23. package/dist/components/grid/utils/gridHeaderDropdown.js +4 -6
  24. package/dist/components/grid/utils/gridRow.js +29 -34
  25. package/dist/components/grid/utils/groupedGridDetails.js +17 -22
  26. package/dist/components/grid/utils/groupedRow.js +12 -17
  27. package/dist/components/grid/utils/pagination.js +7 -11
  28. package/dist/components/grid/utils/paginationUtils.js +1 -5
  29. package/dist/components/grid/utils/regexUtils.js +2 -7
  30. package/dist/components/grid/utils/shimmer.js +4 -6
  31. package/dist/components/grid/utils/textFilterDropdown.js +8 -13
  32. package/dist/components/loader/index.js +6 -41
  33. package/dist/components/modal/index.js +11 -13
  34. package/dist/components/tabs/index.js +19 -26
  35. package/dist/components/text/index.js +3 -5
  36. package/dist/components/text/textType.js +1 -2
  37. package/dist/components/text-input/index.js +10 -12
  38. package/dist/components/textarea/index.js +3 -5
  39. package/dist/components/texteditor/index.js +25 -27
  40. package/dist/components/toggle/index.js +4 -6
  41. package/dist/index.js +16 -41
  42. package/dist/services/commonService.js +3 -7
  43. package/package.json +1 -1
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __rest = (this && this.__rest) || function (s, e) {
3
2
  var t = {};
4
3
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -10,8 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
9
  }
11
10
  return t;
12
11
  };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- const jsx_runtime_1 = require("react/jsx-runtime");
12
+ import { jsx as _jsx } from "react/jsx-runtime";
15
13
  const Block = (_a) => {
16
14
  var { color, backgroundColor, fontSize, fontWeight, fontStyle, textAlign, textTransform, paddingTop, paddingRight, paddingBottom, paddingLeft, marginTop, marginRight, marginBottom, marginLeft, className, onClick, children, as = "div", style, position, display, alignItems, alignContent, alignSelf, justifyContent, justifyItems, justifySelf, width, maxWidth, minWidth, height, minHeight, maxHeight, zIndex, borderRadius, borderTopLeftRadius, borderTopRightRadius, borderBottomLeftRadius, borderBottomRightRadius, flexDirection, cursor, overflow, borderTopWidth, borderTopColor, borderTopStyle, borderColor, border, borderWidth, borderStyle, borderBottom, borderTop, borderLeft, borderRight, borderBottomColor, borderBottomStyle, borderBottomWidth, borderLeftColor, borderLeftStyle, borderLeftWidth, borderRightColor, borderRightStyle, borderRightWidth, boxShadow, opacity, transform, transition, animation, gridTemplateColumns, gridTemplateRows, gridColumnGap, gridRowGap, gridColumn, gridRow, flexWrap, flexGrow, flexShrink, order } = _a, props = __rest(_a, ["color", "backgroundColor", "fontSize", "fontWeight", "fontStyle", "textAlign", "textTransform", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "marginTop", "marginRight", "marginBottom", "marginLeft", "className", "onClick", "children", "as", "style", "position", "display", "alignItems", "alignContent", "alignSelf", "justifyContent", "justifyItems", "justifySelf", "width", "maxWidth", "minWidth", "height", "minHeight", "maxHeight", "zIndex", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "flexDirection", "cursor", "overflow", "borderTopWidth", "borderTopColor", "borderTopStyle", "borderColor", "border", "borderWidth", "borderStyle", "borderBottom", "borderTop", "borderLeft", "borderRight", "borderBottomColor", "borderBottomStyle", "borderBottomWidth", "borderLeftColor", "borderLeftStyle", "borderLeftWidth", "borderRightColor", "borderRightStyle", "borderRightWidth", "boxShadow", "opacity", "transform", "transition", "animation", "gridTemplateColumns", "gridTemplateRows", "gridColumnGap", "gridRowGap", "gridColumn", "gridRow", "flexWrap", "flexGrow", "flexShrink", "order"]);
17
15
  const Element = as;
@@ -91,6 +89,6 @@ const Block = (_a) => {
91
89
  flexShrink,
92
90
  order,
93
91
  };
94
- return ((0, jsx_runtime_1.jsx)(Element, Object.assign({ style: Object.assign(Object.assign({}, computedStyle), style), className: className, onClick: onClick }, props, { children: children })));
92
+ return (_jsx(Element, Object.assign({ style: Object.assign(Object.assign({}, computedStyle), style), className: className, onClick: onClick }, props, { children: children })));
95
93
  };
96
- exports.default = Block;
94
+ export default Block;
@@ -1,6 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
2
  const Button = ({ text, color, icon, fontSize, fontWeight, onClick, gap = "0.5rem", borderWidth = 1, borderColor, borderRadius = "0.25rem", border = true, backgroundColor, borderStyle = "solid", cursor = "pointer", type, width, paddingBottom = "0.35rem", paddingLeft = "0.65rem", paddingRight = "0.65rem", paddingTop = "0.35rem", marginBottom, marginLeft, marginRight, marginTop, disabled = false, style, className, iconPosition = "before", textEleClass = "", }) => {
5
3
  const buttonStyle = Object.assign({ color,
6
4
  fontSize,
@@ -13,6 +11,6 @@ const Button = ({ text, color, icon, fontSize, fontWeight, onClick, gap = "0.5re
13
11
  marginLeft,
14
12
  marginRight,
15
13
  marginTop }, style);
16
- return ((0, jsx_runtime_1.jsxs)("button", { style: buttonStyle, onClick: disabled ? undefined : onClick, type: type, className: className, disabled: disabled, children: [iconPosition !== "after" && icon, (0, jsx_runtime_1.jsx)("span", { className: textEleClass, children: text }), iconPosition === "after" && icon] }));
14
+ return (_jsxs("button", { style: buttonStyle, onClick: disabled ? undefined : onClick, type: type, className: className, disabled: disabled, children: [iconPosition !== "after" && icon, _jsx("span", { className: textEleClass, children: text }), iconPosition === "after" && icon] }));
17
15
  };
18
- exports.default = Button;
16
+ export default Button;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const react_1 = require("react");
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
5
3
  const Card = ({ header, content, footer, className, borderRadius = "0.5rem", width, height = "100%", paddingTop, paddingBottom, paddingLeft, paddingRight, maxWidth, }) => {
6
4
  const cardStyle = {
7
5
  paddingTop,
@@ -13,9 +11,9 @@ const Card = ({ header, content, footer, className, borderRadius = "0.5rem", wid
13
11
  borderRadius,
14
12
  maxWidth,
15
13
  };
16
- const [removalHeight, setRemovalHeight] = (0, react_1.useState)("0px");
17
- const cardRef = (0, react_1.useRef)(null);
18
- (0, react_1.useEffect)(() => {
14
+ const [removalHeight, setRemovalHeight] = useState("0px");
15
+ const cardRef = useRef(null);
16
+ useEffect(() => {
19
17
  var _a, _b;
20
18
  const headerEle = (_a = cardRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("#header");
21
19
  const footerEle = (_b = cardRef.current) === null || _b === void 0 ? void 0 : _b.querySelector("#foooter");
@@ -31,6 +29,6 @@ const Card = ({ header, content, footer, className, borderRadius = "0.5rem", wid
31
29
  setRemovalHeight(`${_removalHeight}px`);
32
30
  }
33
31
  }, [header, footer]);
34
- return ((0, jsx_runtime_1.jsxs)("div", { ref: cardRef, className: `wk-card ${className}`, style: cardStyle, children: [header && ((0, jsx_runtime_1.jsx)("div", { id: "header", className: "wk-card-header", children: header })), (0, jsx_runtime_1.jsx)("div", { className: "wk-card-content", style: { height: `calc(100% - ${removalHeight})`, overflow: "auto" }, children: content }), footer && ((0, jsx_runtime_1.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: `calc(100% - ${removalHeight})`, overflow: "auto" }, children: content }), footer && (_jsx("div", { id: "footer", className: "wk-card-footer", children: footer }))] }));
35
33
  };
36
- exports.default = Card;
34
+ export default Card;
@@ -1,10 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const react_1 = require("react");
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from "react";
5
3
  const Checkbox = ({ onChange, disabled, wrapperClass, name, width, noLabel, label, value, labelMargin, style, indeterminate, selected = false, }) => {
6
- const checkboxWrapper = (0, react_1.useRef)(null);
7
- (0, react_1.useEffect)(() => {
4
+ const checkboxWrapper = useRef(null);
5
+ useEffect(() => {
8
6
  let checkbox = null;
9
7
  if (checkboxWrapper.current) {
10
8
  checkbox = checkboxWrapper.current.querySelector("#checkbox");
@@ -16,16 +14,16 @@ const Checkbox = ({ onChange, disabled, wrapperClass, name, width, noLabel, labe
16
14
  checkbox.indeterminate = false;
17
15
  }
18
16
  }, [indeterminate]);
19
- return ((0, jsx_runtime_1.jsx)("div", { ref: checkboxWrapper, className: wrapperClass, style: style, children: (0, jsx_runtime_1.jsxs)("label", { style: {
17
+ return (_jsx("div", { ref: checkboxWrapper, className: wrapperClass, style: style, children: _jsxs("label", { style: {
20
18
  width: width,
21
19
  display: "inline-flex",
22
20
  alignItems: "center",
23
21
  margin: labelMargin,
24
- }, children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", id: "checkbox", name: name, value: value, checked: selected, disabled: disabled, onChange: (event) => onChange(event.target.checked) }), (0, jsx_runtime_1.jsx)("span", { style: {
22
+ }, children: [_jsx("input", { type: "checkbox", id: "checkbox", name: name, value: value, checked: selected, disabled: disabled, onChange: (event) => onChange(event.target.checked) }), _jsx("span", { style: {
25
23
  marginRight: !noLabel ? "0.5rem" : "",
26
24
  display: "flex",
27
25
  alignItems: "center",
28
26
  justifyContent: "center",
29
27
  } }), !noLabel ? label : ""] }) }));
30
28
  };
31
- exports.default = Checkbox;
29
+ export default Checkbox;
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const react_1 = require("react");
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
5
3
  const DateInput = ({ value = "", onChange, placeholder, min, max, className, width = "100%", disabled = false, padding = "0.5rem", borderRadius = "0.25rem", fontSize = "1rem", height = "2.5rem", labelFontSize, labelFontWeight, labelMarginBottom, asteriskColor, label, required, isValid, validationErrorColor = "red", validationSuccessColor = "green", border = "1px solid var(--form-border-color, #dbdfe9)", }) => {
6
4
  const dateInputStyle = {
7
5
  width,
@@ -15,8 +13,8 @@ const DateInput = ({ value = "", onChange, placeholder, min, max, className, wid
15
13
  display: "block",
16
14
  fontFamily: "var(--font-family)",
17
15
  };
18
- const [focused, setFocused] = (0, react_1.useState)(false);
19
- const [error, setError] = (0, react_1.useState)(null);
16
+ const [focused, setFocused] = useState(false);
17
+ const [error, setError] = useState(null);
20
18
  const inputWrapperStyle = {
21
19
  display: "flex",
22
20
  alignItems: "center",
@@ -50,6 +48,6 @@ const DateInput = ({ value = "", onChange, placeholder, min, max, className, wid
50
48
  setError(null);
51
49
  }
52
50
  };
53
- return ((0, jsx_runtime_1.jsxs)("div", { style: { display: "flex", flexDirection: "column" }, children: [label && ((0, jsx_runtime_1.jsxs)("p", { style: labelStyle, children: [label, required && (0, jsx_runtime_1.jsx)("span", { style: asteriskStyle, children: " *" })] })), (0, jsx_runtime_1.jsx)("div", { style: inputWrapperStyle, className: `${className} custom-border`, children: (0, jsx_runtime_1.jsx)("input", { type: "date", value: value, onChange: handleDateChange, onBlur: handleBlur, placeholder: placeholder, min: min, max: max, style: dateInputStyle, className: className, disabled: disabled }) })] }));
51
+ return (_jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [label && (_jsxs("p", { style: labelStyle, children: [label, required && _jsx("span", { style: asteriskStyle, children: " *" })] })), _jsx("div", { style: inputWrapperStyle, className: `${className} custom-border`, children: _jsx("input", { type: "date", value: value, onChange: handleDateChange, onBlur: handleBlur, placeholder: placeholder, min: min, max: max, style: dateInputStyle, className: className, disabled: disabled }) })] }));
54
52
  };
55
- exports.default = DateInput;
53
+ export default DateInput;
@@ -1,28 +1,23 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const react_1 = require("react");
8
- const checkbox_1 = __importDefault(require("../checkbox"));
9
- const loader_1 = __importDefault(require("../loader"));
10
- const block_1 = __importDefault(require("../block"));
11
- const text_1 = __importDefault(require("../text"));
12
- const button_1 = __importDefault(require("../button"));
13
- const hi_1 = require("react-icons/hi");
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import Checkbox from "../checkbox";
4
+ import Loader from "../loader";
5
+ import Block from "../block";
6
+ import Text from "../text";
7
+ import Button from "../button";
8
+ import { HiChevronDown } from "react-icons/hi";
14
9
  const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select...", isMultiple = false, isSelectAll = false, className, style, labelFontSize, labelFontWeight, labelMarginBottom, asteriskColor, label, disabled = false, width, searchEnabled = true, dropdownListWidth, marginBottom, marginTop, marginRight, marginLeft, required, dropdownListBG, searchBorderColor = "#2377ba", maxDropdownHeight = "12rem", border = "1px solid #dbdfe9", selectedCharLength = 0, menuFrom = "left", Tooltip, DropDownIcon, onMenuClose, isClear, ClearIcon, clearId, selectedDisplay, checkboxWrapper, isSort = true, onSelectChange, isLoading = false, onApplyChange, withTooltip = false, isCreatable = false, onCreate = () => { }, autoPosition = false, }) => {
15
10
  var _a, _b;
16
- const [isOpen, setIsOpen] = (0, react_1.useState)(false);
17
- const [searchTerm, setSearchTerm] = (0, react_1.useState)("");
18
- const [filteredOptions, setFilteredOptions] = (0, react_1.useState)(options);
19
- const wrapperRef = (0, react_1.useRef)(null);
20
- const clearIconRef = (0, react_1.useRef)(null);
21
- const searchInputRef = (0, react_1.useRef)(null);
22
- const optionRefs = (0, react_1.useRef)([]);
23
- const [highlightIndex, setHighlightIndex] = (0, react_1.useState)(0);
24
- const [intermediateValues, setIntermediateValues] = (0, react_1.useState)(selectedValues);
25
- const [clickStyle, setClickStyle] = (0, react_1.useState)({
11
+ const [isOpen, setIsOpen] = useState(false);
12
+ const [searchTerm, setSearchTerm] = useState("");
13
+ const [filteredOptions, setFilteredOptions] = useState(options);
14
+ const wrapperRef = useRef(null);
15
+ const clearIconRef = useRef(null);
16
+ const searchInputRef = useRef(null);
17
+ const optionRefs = useRef([]);
18
+ const [highlightIndex, setHighlightIndex] = useState(0);
19
+ const [intermediateValues, setIntermediateValues] = useState(selectedValues);
20
+ const [clickStyle, setClickStyle] = useState({
26
21
  left: 0,
27
22
  top: "100%",
28
23
  });
@@ -42,10 +37,10 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
42
37
  setClickStyle({ left: 0, top: "100%" });
43
38
  }
44
39
  };
45
- (0, react_1.useEffect)(() => {
40
+ useEffect(() => {
46
41
  setIntermediateValues(selectedValues);
47
42
  }, [selectedValues]);
48
- (0, react_1.useEffect)(() => {
43
+ useEffect(() => {
49
44
  var _a;
50
45
  if (isOpen && searchEnabled) {
51
46
  (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
@@ -54,18 +49,18 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
54
49
  setHighlightIndex(0);
55
50
  }
56
51
  }, [isOpen, searchEnabled]);
57
- (0, react_1.useEffect)(() => {
52
+ useEffect(() => {
58
53
  if (isOpen) {
59
54
  setHighlightIndex(0);
60
55
  }
61
56
  }, [filteredOptions, isOpen]);
62
- (0, react_1.useEffect)(() => {
57
+ useEffect(() => {
63
58
  var _a;
64
59
  if (isOpen && optionRefs.current[highlightIndex]) {
65
60
  (_a = optionRefs.current[highlightIndex]) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: "nearest" });
66
61
  }
67
62
  }, [highlightIndex, isOpen]);
68
- (0, react_1.useEffect)(() => {
63
+ useEffect(() => {
69
64
  function handleClickOutside(event) {
70
65
  if (wrapperRef.current &&
71
66
  !wrapperRef.current.contains(event.target)) {
@@ -81,7 +76,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
81
76
  document.addEventListener("mousedown", handleClickOutside);
82
77
  return () => document.removeEventListener("mousedown", handleClickOutside);
83
78
  }, [selectedValues, onApplyChange, onMenuClose]);
84
- (0, react_1.useEffect)(() => {
79
+ useEffect(() => {
85
80
  const handleKeyDown = (e) => {
86
81
  if (!isOpen)
87
82
  return;
@@ -111,7 +106,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
111
106
  window.addEventListener("keydown", handleKeyDown);
112
107
  return () => window.removeEventListener("keydown", handleKeyDown);
113
108
  }, [isOpen, filteredOptions, highlightIndex]);
114
- (0, react_1.useEffect)(() => {
109
+ useEffect(() => {
115
110
  if (menuFrom !== "left") {
116
111
  if (menuFrom === "top") {
117
112
  setClickStyle({
@@ -133,7 +128,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
133
128
  }
134
129
  }
135
130
  }, [menuFrom]);
136
- (0, react_1.useEffect)(() => {
131
+ useEffect(() => {
137
132
  if (!autoPosition)
138
133
  return;
139
134
  if (isOpen) {
@@ -142,7 +137,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
142
137
  return () => window.removeEventListener("resize", calculateAutoPosition);
143
138
  }
144
139
  }, [autoPosition, isOpen]);
145
- (0, react_1.useEffect)(() => {
140
+ useEffect(() => {
146
141
  const _options = isSort
147
142
  ? options
148
143
  .sort((a, b) => (a.label > b.label ? 1 : -1))
@@ -215,7 +210,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
215
210
  return;
216
211
  onApplyChange ? onApplyChange([]) : onChange([]);
217
212
  };
218
- (0, react_1.useEffect)(() => {
213
+ useEffect(() => {
219
214
  if (!isMultiple && intermediateValues.length > 0) {
220
215
  setSearchTerm("");
221
216
  }
@@ -288,51 +283,51 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
288
283
  }
289
284
  return text;
290
285
  };
291
- return ((0, jsx_runtime_1.jsxs)("div", { style: {
286
+ return (_jsxs("div", { style: {
292
287
  width: width !== null && width !== void 0 ? width : "100%",
293
288
  marginBottom,
294
289
  marginTop,
295
290
  marginRight,
296
291
  marginLeft,
297
- }, children: [label && ((0, jsx_runtime_1.jsxs)("p", { style: labelStyle, children: [label, required && (0, jsx_runtime_1.jsx)("span", { style: asteriskStyle, children: " *" })] })), (0, jsx_runtime_1.jsxs)("div", { ref: wrapperRef, className: `${className}`, style: Object.assign({ border, borderRadius: 4, padding: "0 0.5rem", alignItems: "center", display: "flex", minHeight: "2.5rem", position: "relative" }, style), children: [(0, jsx_runtime_1.jsxs)("div", { style: {
292
+ }, children: [label && (_jsxs("p", { style: labelStyle, children: [label, required && _jsx("span", { style: asteriskStyle, children: " *" })] })), _jsxs("div", { ref: wrapperRef, className: `${className}`, style: Object.assign({ border, borderRadius: 4, padding: "0 0.5rem", alignItems: "center", display: "flex", minHeight: "2.5rem", position: "relative" }, style), children: [_jsxs("div", { style: {
298
293
  display: "flex",
299
294
  alignItems: "center",
300
295
  justifyContent: "space-between",
301
296
  cursor: "pointer",
302
297
  width: "100%",
303
- }, ref: clearIconRef, onClick: handleClick, children: [(0, jsx_runtime_1.jsx)("span", { children: selectedDisplay
298
+ }, ref: clearIconRef, onClick: handleClick, children: [_jsx("span", { children: selectedDisplay
304
299
  ? selectedDisplay
305
300
  : displayValue
306
301
  ? wrapMiddle(displayValue, selectedCharLength)
307
302
  : disabled
308
303
  ? "--"
309
- : placeholder }), (0, jsx_runtime_1.jsxs)("div", { style: {
304
+ : placeholder }), _jsxs("div", { style: {
310
305
  display: "flex",
311
306
  alignItems: "center",
312
- }, children: [isClear && (displayValue || selectedDisplay) && ((0, jsx_runtime_1.jsx)("div", { style: { marginRight: "0.5rem" }, onClick: handleClear, id: clearId, title: "Click to clear the value", children: ClearIcon ? (ClearIcon) : ((0, jsx_runtime_1.jsx)("span", { style: { color: "#dbdfe9", fontSize: "1rem" }, children: "X" })) })), disabled ? (Tooltip && Tooltip) : DropDownIcon ? (DropDownIcon) : ((0, jsx_runtime_1.jsx)(hi_1.HiChevronDown, { fontSize: "1rem" })), withTooltip && Tooltip && Tooltip] })] }), (0, jsx_runtime_1.jsxs)("ul", { style: Object.assign(Object.assign({ width: dropdownListWidth || "100%", position: "absolute", backgroundColor: dropdownListBG || "var(--dropdown-bg)", boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)", border: "1px solid #f5f5f5", zIndex: 10, marginTop: 4, borderRadius: 4, overflow: "hidden" }, clickStyle), { display: !isOpen ? "none" : "" }), children: [searchEnabled && ((0, jsx_runtime_1.jsx)("li", { style: { padding: "0.5rem" }, children: (0, jsx_runtime_1.jsx)("input", { ref: searchInputRef, type: "text", placeholder: "Search...", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), disabled: disabled, style: {
307
+ }, children: [isClear && (displayValue || selectedDisplay) && (_jsx("div", { style: { marginRight: "0.5rem" }, onClick: handleClear, id: clearId, title: "Click to clear the value", children: ClearIcon ? (ClearIcon) : (_jsx("span", { style: { color: "#dbdfe9", fontSize: "1rem" }, children: "X" })) })), disabled ? (Tooltip && Tooltip) : DropDownIcon ? (DropDownIcon) : (_jsx(HiChevronDown, { fontSize: "1rem" })), withTooltip && Tooltip && Tooltip] })] }), _jsxs("ul", { style: Object.assign(Object.assign({ width: dropdownListWidth || "100%", position: "absolute", backgroundColor: dropdownListBG || "var(--dropdown-bg)", boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)", border: "1px solid #f5f5f5", zIndex: 10, marginTop: 4, borderRadius: 4, overflow: "hidden" }, clickStyle), { display: !isOpen ? "none" : "" }), children: [searchEnabled && (_jsx("li", { style: { padding: "0.5rem" }, children: _jsx("input", { ref: searchInputRef, type: "text", placeholder: "Search...", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), disabled: disabled, style: {
313
308
  width: "100%",
314
309
  padding: "0.5rem",
315
310
  boxSizing: "border-box",
316
311
  border: "1px solid",
317
312
  borderColor: searchBorderColor,
318
313
  borderRadius: 4,
319
- } }) })), isSelectAll && isMultiple && filteredOptions.length > 0 && ((0, jsx_runtime_1.jsxs)("li", { style: Object.assign(Object.assign(Object.assign(Object.assign({}, listItemStyle), { display: "flex", alignItems: "center" }), (-1 === highlightIndex ? listItemHoverStyle : {})), { borderBottom: "1px solid #dddddd", wordWrap: "break-word", textWrap: "wrap", justifyContent: "space-between" }), onMouseEnter: (e) => {
314
+ } }) })), isSelectAll && isMultiple && filteredOptions.length > 0 && (_jsxs("li", { style: Object.assign(Object.assign(Object.assign(Object.assign({}, listItemStyle), { display: "flex", alignItems: "center" }), (-1 === highlightIndex ? listItemHoverStyle : {})), { borderBottom: "1px solid #dddddd", wordWrap: "break-word", textWrap: "wrap", justifyContent: "space-between" }), onMouseEnter: (e) => {
320
315
  setHighlightIndex(-1);
321
- }, onClick: () => onSelectChange ? handleAllItemSelect() : handleAllSelect(), children: [(0, jsx_runtime_1.jsx)("div", { style: { marginRight: "0.5rem" }, children: (0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: intermediateValues
316
+ }, onClick: () => onSelectChange ? handleAllItemSelect() : handleAllSelect(), children: [_jsx("div", { style: { marginRight: "0.5rem" }, children: _jsx(Checkbox, { selected: intermediateValues
322
317
  .sort((a, b) => (a > b ? -1 : 1))
323
318
  .toString() ===
324
319
  filteredOptions
325
320
  .map((item) => item.value)
326
321
  .sort((a, b) => (a > b ? -1 : 1))
327
- .toString(), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }) }), (0, jsx_runtime_1.jsx)("div", { style: {
322
+ .toString(), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }) }), _jsx("div", { style: {
328
323
  display: "flex",
329
324
  alignItems: "start",
330
325
  width: "100%",
331
- }, children: (0, jsx_runtime_1.jsx)("span", { children: "Select All" }) })] })), (0, jsx_runtime_1.jsx)("div", { style: { maxHeight: maxDropdownHeight, overflowY: "auto" }, children: isLoading ? ((0, jsx_runtime_1.jsxs)(block_1.default, { as: "div", className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)(text_1.default, { as: "span", children: "Loading options" }), (0, jsx_runtime_1.jsx)(loader_1.default, { size: 12 })] })) : isCreatable && filteredOptions.length < 1 ? ((0, jsx_runtime_1.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 && ((0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: intermediateValues.includes(searchTerm), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper })), (0, jsx_runtime_1.jsx)("div", { style: {
326
+ }, 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 ? (_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: {
332
327
  display: "flex",
333
328
  alignItems: "start",
334
329
  width: "100%",
335
- }, children: (0, jsx_runtime_1.jsxs)("span", { style: { marginLeft: "0.5rem" }, children: ["+ Create ", searchTerm] }) })] }, String(searchTerm))) : (filteredOptions.map((option, index) => ((0, jsx_runtime_1.jsxs)("li", { ref: (el) => {
330
+ }, children: _jsxs("span", { style: { marginLeft: "0.5rem" }, children: ["+ Create ", searchTerm] }) })] }, String(searchTerm))) : (filteredOptions.map((option, index) => (_jsxs("li", { ref: (el) => {
336
331
  optionRefs.current[index] = el;
337
332
  }, onClick: (e) => onSelectChange
338
333
  ? handleItemSelect(option, option.disabled || false)
@@ -346,19 +341,19 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
346
341
  if (!option.disabled) {
347
342
  setHighlightIndex(index);
348
343
  }
349
- }, children: [isMultiple && ((0, jsx_runtime_1.jsx)("div", { style: { marginLeft: "0.5rem" }, children: (0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: intermediateValues.includes(option.value), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }) })), (0, jsx_runtime_1.jsxs)("div", { style: {
344
+ }, children: [isMultiple && (_jsx("div", { style: { marginLeft: "0.5rem" }, children: _jsx(Checkbox, { selected: intermediateValues.includes(option.value), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }) })), _jsxs("div", { style: {
350
345
  display: "flex",
351
346
  alignItems: "start",
352
347
  width: "100%",
353
- }, children: [option.icon && option.isDelete && !option.isDelete && ((0, jsx_runtime_1.jsx)("span", { style: { margin: "0 0.5rem" }, children: option.icon })), (0, jsx_runtime_1.jsx)("span", { children: option.label })] }), option.icon && option.isDelete && option.icon] }, String(option.value))))) }), onApplyChange && ((0, jsx_runtime_1.jsx)("li", { style: {
348
+ }, children: [option.icon && option.isDelete && !option.isDelete && (_jsx("span", { style: { margin: "0 0.5rem" }, children: option.icon })), _jsx("span", { children: option.label })] }), option.icon && option.isDelete && option.icon] }, String(option.value))))) }), onApplyChange && (_jsx("li", { style: {
354
349
  display: "flex",
355
350
  alignItems: "center",
356
351
  justifyContent: "end",
357
352
  padding: "0.75rem 0.5rem",
358
353
  borderTop: "1px solid #f5f5f5",
359
- }, children: (0, jsx_runtime_1.jsx)(button_1.default, { text: "Apply", fontSize: "", fontWeight: "", color: "#FFFFFF", backgroundColor: "#2377BA", borderColor: "#2377BA", onClick: () => {
354
+ }, children: _jsx(Button, { text: "Apply", fontSize: "", fontWeight: "", color: "#FFFFFF", backgroundColor: "#2377BA", borderColor: "#2377BA", onClick: () => {
360
355
  onApplyChange(intermediateValues);
361
356
  setIsOpen(false);
362
357
  }, borderRadius: "0.5rem" }) }))] })] })] }));
363
358
  };
364
- exports.default = Dropdown;
359
+ export default Dropdown;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useBulkSelect = void 0;
4
- const react_1 = require("react");
5
- const useBulkSelect = ({ data, selectedRows, setSelectedRows }) => {
6
- const toggleRowSelection = (0, react_1.useCallback)((id) => {
1
+ import { useCallback, useMemo } from "react";
2
+ export const useBulkSelect = ({ data, selectedRows, setSelectedRows }) => {
3
+ const toggleRowSelection = useCallback((id) => {
7
4
  setSelectedRows && setSelectedRows((prevSelectedRows) => {
8
5
  const newSelectedRows = new Set(prevSelectedRows);
9
6
  if (newSelectedRows.has(id)) {
@@ -15,7 +12,7 @@ const useBulkSelect = ({ data, selectedRows, setSelectedRows }) => {
15
12
  return newSelectedRows;
16
13
  });
17
14
  }, []);
18
- const toggleSelectAll = (0, react_1.useCallback)((visibleData, allSelected) => {
15
+ const toggleSelectAll = useCallback((visibleData, allSelected) => {
19
16
  setSelectedRows && setSelectedRows((prevSelectedRows) => {
20
17
  const newSelectedRows = new Set(prevSelectedRows);
21
18
  if (allSelected) {
@@ -30,14 +27,14 @@ const useBulkSelect = ({ data, selectedRows, setSelectedRows }) => {
30
27
  return newSelectedRows;
31
28
  });
32
29
  }, []);
33
- const allRowsSelected = (0, react_1.useMemo)(() => {
30
+ const allRowsSelected = useMemo(() => {
34
31
  return data.every((item) => {
35
32
  var _a;
36
33
  return (item === null || item === void 0 ? void 0 : item["id"]) &&
37
34
  selectedRows && selectedRows.has((_a = item === null || item === void 0 ? void 0 : item["id"].value) === null || _a === void 0 ? void 0 : _a.toString());
38
35
  });
39
36
  }, [data, selectedRows]);
40
- const someRowsSelected = (0, react_1.useMemo)(() => {
37
+ const someRowsSelected = useMemo(() => {
41
38
  return data.some((item) => {
42
39
  var _a;
43
40
  return (item === null || item === void 0 ? void 0 : item["id"]) &&
@@ -52,4 +49,3 @@ const useBulkSelect = ({ data, selectedRows, setSelectedRows }) => {
52
49
  someRowsSelected,
53
50
  };
54
51
  };
55
- exports.useBulkSelect = useBulkSelect;
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePagination = void 0;
4
- const react_1 = require("react");
5
- const usePagination = (sortedData, defaultRowsPerPage) => {
6
- const [currentPage, setCurrentPage] = (0, react_1.useState)(1);
7
- const [rowsPerPage, setRowsPerPage] = (0, react_1.useState)(10);
8
- (0, react_1.useEffect)(() => {
1
+ import { useState, useMemo, useEffect } from "react";
2
+ export const usePagination = (sortedData, defaultRowsPerPage) => {
3
+ const [currentPage, setCurrentPage] = useState(1);
4
+ const [rowsPerPage, setRowsPerPage] = useState(10);
5
+ useEffect(() => {
9
6
  setRowsPerPage(defaultRowsPerPage);
10
7
  }, [defaultRowsPerPage]);
11
- const paginatedData = (0, react_1.useMemo)(() => {
8
+ const paginatedData = useMemo(() => {
12
9
  const startIndex = (currentPage - 1) * rowsPerPage;
13
10
  return sortedData.slice(startIndex, startIndex + rowsPerPage);
14
11
  }, [sortedData, currentPage, rowsPerPage]);
@@ -27,4 +24,3 @@ const usePagination = (sortedData, defaultRowsPerPage) => {
27
24
  rowsPerPage,
28
25
  };
29
26
  };
30
- exports.usePagination = usePagination;
@@ -1,8 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_1 = require("react");
1
+ import { useEffect } from "react";
4
2
  const useResizeObserver = (ref, callback) => {
5
- (0, react_1.useEffect)(() => {
3
+ useEffect(() => {
6
4
  const observer = new ResizeObserver((entries) => {
7
5
  callback(entries);
8
6
  });
@@ -16,4 +14,4 @@ const useResizeObserver = (ref, callback) => {
16
14
  };
17
15
  }, [ref, callback]);
18
16
  };
19
- exports.default = useResizeObserver;
17
+ export default useResizeObserver;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSearch = void 0;
4
- const react_1 = require("react");
5
- const useSearch = (data, searchTerm, searchKeys) => {
1
+ import { useMemo } from "react";
2
+ export const useSearch = (data, searchTerm, searchKeys) => {
6
3
  const searchQuery = searchTerm.toLowerCase();
7
- const filteredData = (0, react_1.useMemo)(() => {
4
+ const filteredData = useMemo(() => {
8
5
  if (!searchQuery)
9
6
  return data;
10
7
  return data.filter((item) => searchKeys.some((key) => {
@@ -15,4 +12,3 @@ const useSearch = (data, searchTerm, searchKeys) => {
15
12
  }, [data, searchQuery, searchKeys]);
16
13
  return filteredData;
17
14
  };
18
- exports.useSearch = useSearch;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSort = void 0;
4
- const react_1 = require("react");
5
- const useSort = (data, columns, uniqueSearch, multiSorting, withAscii) => {
6
- const [sortQueries, setSortQueries] = (0, react_1.useState)({});
1
+ import { useState, useMemo } from "react";
2
+ export const useSort = (data, columns, uniqueSearch, multiSorting, withAscii) => {
3
+ const [sortQueries, setSortQueries] = useState({});
7
4
  const hierarchicalSort = (keys, orders) => {
8
5
  return (a, b) => {
9
6
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
@@ -33,7 +30,7 @@ const useSort = (data, columns, uniqueSearch, multiSorting, withAscii) => {
33
30
  return 0;
34
31
  };
35
32
  };
36
- const sortedData = (0, react_1.useMemo)(() => {
33
+ const sortedData = useMemo(() => {
37
34
  const keys = Object.keys(uniqueSearch);
38
35
  let returnData = [...data];
39
36
  const _sortQueries = sortQueries;
@@ -68,4 +65,3 @@ const useSort = (data, columns, uniqueSearch, multiSorting, withAscii) => {
68
65
  };
69
66
  return { sortedData, handleSort, sortQueries, setSortQueries };
70
67
  };
71
- exports.useSort = useSort;
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useVisibleData = void 0;
4
- const react_1 = require("react");
5
- const useVisibleData = ({ sortedData, rowHeight, viewportHeight, }) => {
6
- const [scrollTop, setScrollTop] = (0, react_1.useState)(0);
1
+ import { useState, useMemo } from "react";
2
+ export const useVisibleData = ({ sortedData, rowHeight, viewportHeight, }) => {
3
+ const [scrollTop, setScrollTop] = useState(0);
7
4
  const overscan = rowHeight;
8
- const visibleItemCount = (0, react_1.useMemo)(() => Math.ceil(viewportHeight / rowHeight) + overscan, [viewportHeight, rowHeight, overscan]);
9
- const totalHeight = (0, react_1.useMemo)(() => sortedData.length * rowHeight, [sortedData.length, rowHeight]);
5
+ const visibleItemCount = useMemo(() => Math.ceil(viewportHeight / rowHeight) + overscan, [viewportHeight, rowHeight, overscan]);
6
+ const totalHeight = useMemo(() => sortedData.length * rowHeight, [sortedData.length, rowHeight]);
10
7
  const startNode = Math.max(0, Math.floor(scrollTop / rowHeight) - overscan);
11
8
  const endNode = Math.min(sortedData.length, startNode + visibleItemCount);
12
- const visibleData = (0, react_1.useMemo)(() => {
9
+ const visibleData = useMemo(() => {
13
10
  return sortedData.slice(startNode, endNode);
14
11
  }, [sortedData, startNode, endNode]);
15
12
  return {
@@ -20,4 +17,3 @@ const useVisibleData = ({ sortedData, rowHeight, viewportHeight, }) => {
20
17
  endNode,
21
18
  };
22
19
  };
23
- exports.useVisibleData = useVisibleData;