@megha-ui/react 1.2.362 → 1.2.363
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.
|
@@ -7,6 +7,7 @@ import Block from "../block";
|
|
|
7
7
|
import Text from "../text";
|
|
8
8
|
import Button from "../button";
|
|
9
9
|
import { HiChevronDown } from "react-icons/hi";
|
|
10
|
+
import { IoChevronDownCircleOutline } from "react-icons/io5";
|
|
10
11
|
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, compactDisplay = false, ultraCompactDisplay = false, isGrouping = false, }) => {
|
|
11
12
|
var _a, _b;
|
|
12
13
|
const { density } = useDensity();
|
|
@@ -24,6 +25,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
24
25
|
left: 0,
|
|
25
26
|
top: "100%",
|
|
26
27
|
});
|
|
28
|
+
const [collapsed, setCollapsed] = useState("");
|
|
27
29
|
const calculateAutoPosition = () => {
|
|
28
30
|
if (!wrapperRef.current)
|
|
29
31
|
return;
|
|
@@ -364,10 +366,35 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
364
366
|
display: "flex",
|
|
365
367
|
alignItems: "start",
|
|
366
368
|
width: "100%",
|
|
367
|
-
}, children: _jsxs("span", { style: { marginLeft: "0.5rem" }, children: ["+ Create ", searchTerm] }) })] }, String(searchTerm))) : groupedOptions.length > 0 ? (groupedOptions.map((groupOption, gIndex) => (_jsxs("div", { children: [
|
|
369
|
+
}, children: _jsxs("span", { style: { marginLeft: "0.5rem" }, children: ["+ Create ", searchTerm] }) })] }, String(searchTerm))) : groupedOptions.length > 0 ? (groupedOptions.map((groupOption, gIndex) => (_jsxs("div", { children: [_jsxs("div", { style: {
|
|
368
370
|
padding: "0.25rem 0 0.25rem 1rem",
|
|
369
371
|
backgroundColor: "var(--row-bg)",
|
|
370
|
-
|
|
372
|
+
display: "flex",
|
|
373
|
+
alignItems: "center",
|
|
374
|
+
}, children: [_jsx("span", { children: groupOption.groupedValue }), _jsx("span", { children: collapsed === groupOption.groupedValue ? (_jsx(IoChevronDownCircleOutline, { style: {
|
|
375
|
+
transition: "transform 0.2s ease",
|
|
376
|
+
transform: "rotate(180deg)",
|
|
377
|
+
marginLeft: "auto",
|
|
378
|
+
cursor: "pointer",
|
|
379
|
+
}, onClick: () => {
|
|
380
|
+
if (collapsed === groupOption.groupedValue) {
|
|
381
|
+
setCollapsed("");
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
setCollapsed(groupOption.groupedValue);
|
|
385
|
+
}
|
|
386
|
+
} })) : (_jsx(IoChevronDownCircleOutline, { style: {
|
|
387
|
+
transition: "transform 0.2s ease",
|
|
388
|
+
marginLeft: "auto",
|
|
389
|
+
cursor: "pointer",
|
|
390
|
+
}, onClick: () => {
|
|
391
|
+
if (collapsed === groupOption.groupedValue) {
|
|
392
|
+
setCollapsed("");
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
setCollapsed(groupOption.groupedValue);
|
|
396
|
+
}
|
|
397
|
+
} })) })] }), groupOption.options.map((option, index) => {
|
|
371
398
|
let prevOptions = groupedOptions.filter((item, index) => index < gIndex);
|
|
372
399
|
prevOptions = [
|
|
373
400
|
...prevOptions.map((item) => item.options),
|
package/package.json
CHANGED