@megha-ui/react 1.2.600 → 1.2.602
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.
|
@@ -13,6 +13,7 @@ interface DropdownProps {
|
|
|
13
13
|
options: DropdownOption[];
|
|
14
14
|
selectedValues: (string | number | any)[];
|
|
15
15
|
labelClass?: string;
|
|
16
|
+
labelAlignment?: "vertical" | "horizontal";
|
|
16
17
|
onChange: (values: (string | number)[]) => void;
|
|
17
18
|
closeOnSelect?: boolean;
|
|
18
19
|
placeholder?: string;
|
|
@@ -8,7 +8,7 @@ import Text from "../text";
|
|
|
8
8
|
import Button from "../button";
|
|
9
9
|
import { HiChevronDown } from "react-icons/hi";
|
|
10
10
|
import { FaChevronDown, FaChevronUp } from "react-icons/fa";
|
|
11
|
-
const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select...", isMultiple = false, isSelectAll = false, className, style, labelFontSize, labelFontWeight, labelMarginBottom, labelClass, 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, onMenuOpen, isClear, ClearIcon, clearId, selectedDisplay, checkboxWrapper, isSort = true, onSelectChange, isLoading = false, onApplyChange, withTooltip = false, isCreatable = false, onCreate = () => { }, autoPosition = false, compactDisplay = false, ultraCompactDisplay = false, isGrouping = false, isIcon = false, withValue = false, closeOnSelect = true, }) => {
|
|
11
|
+
const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select...", isMultiple = false, isSelectAll = false, className, style, labelAlignment = "vertical", labelFontSize, labelFontWeight, labelMarginBottom, labelClass, 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, onMenuOpen, isClear, ClearIcon, clearId, selectedDisplay, checkboxWrapper, isSort = true, onSelectChange, isLoading = false, onApplyChange, withTooltip = false, isCreatable = false, onCreate = () => { }, autoPosition = false, compactDisplay = false, ultraCompactDisplay = false, isGrouping = false, isIcon = false, withValue = false, closeOnSelect = true, }) => {
|
|
12
12
|
var _a, _b;
|
|
13
13
|
const { density } = useDensity();
|
|
14
14
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -320,6 +320,8 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
320
320
|
marginTop,
|
|
321
321
|
marginRight,
|
|
322
322
|
marginLeft,
|
|
323
|
+
display: "flex",
|
|
324
|
+
flexDirection: labelAlignment === "horizontal" ? "row" : "column",
|
|
323
325
|
}, children: [label && (_jsxs("p", { style: labelStyle, className: labelClass, children: [label, required && _jsx("span", { style: asteriskStyle, children: " *" })] })), _jsxs("div", { ref: wrapperRef, className: `${className}`, style: Object.assign(Object.assign(Object.assign({ border, borderRadius: 4 }, (isIcon ? {} : { padding: "0 0.5rem" })), { alignItems: "center", display: "flex", minHeight: `var(--control-min-height, ${ultraCompactDisplay
|
|
324
326
|
? "1.5rem"
|
|
325
327
|
: compactDisplay
|
|
@@ -1399,13 +1399,12 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
|
|
|
1399
1399
|
options = [...new Set(options)];
|
|
1400
1400
|
if (!column.hidden) {
|
|
1401
1401
|
return (_jsx("div", { style: {
|
|
1402
|
-
position: "relative",
|
|
1403
1402
|
width: "18rem",
|
|
1404
1403
|
marginLeft: "0.75rem",
|
|
1405
1404
|
}, children: _jsx(Dropdown, { options: options.map((option) => ({
|
|
1406
1405
|
label: option,
|
|
1407
1406
|
value: option,
|
|
1408
|
-
})), label: column.label, placeholder: "Select", selectedValues: selectedValues, onChange: (selected) => {
|
|
1407
|
+
})), labelAlignment: "horizontal", labelClass: "ml-2", label: column.label, placeholder: "Select", selectedValues: selectedValues, onChange: (selected) => {
|
|
1409
1408
|
if (column.fixedFilter !== "multi-select") {
|
|
1410
1409
|
const values = selected
|
|
1411
1410
|
.filter((item) => item)
|
|
@@ -1427,7 +1426,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
|
|
|
1427
1426
|
updateFixedFilterValues(updatedValues);
|
|
1428
1427
|
}
|
|
1429
1428
|
}
|
|
1430
|
-
: undefined, isSort: column.fixedFilterOrder ? false : undefined, isClear: true, searchEnabled: true, dropdownListWidth: "max-content", className: "h-8 mt-2", isMultiple: column.fixedFilter === "multi-select" }) }, column.key));
|
|
1429
|
+
: undefined, isSort: column.fixedFilterOrder ? false : undefined, isClear: true, searchEnabled: true, dropdownListWidth: "max-content", className: "h-8 mt-2 flex-1", isMultiple: column.fixedFilter === "multi-select" }) }, column.key));
|
|
1431
1430
|
}
|
|
1432
1431
|
return null;
|
|
1433
1432
|
}), isSummarise && (_jsx("div", { onClick: () => setSummariseAvailable((prev) => !prev), style: {
|
package/package.json
CHANGED