@megha-ui/react 1.2.438 → 1.2.440
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.
|
@@ -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, 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, }) => {
|
|
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, 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, }) => {
|
|
12
12
|
var _a, _b;
|
|
13
13
|
const { density } = useDensity();
|
|
14
14
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -313,12 +313,12 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
313
313
|
return text;
|
|
314
314
|
};
|
|
315
315
|
return (_jsxs("div", { style: {
|
|
316
|
-
width: width !== null && width !== void 0 ? width : "100%",
|
|
316
|
+
width: width !== null && width !== void 0 ? width : (isIcon ? "max-content" : "100%"),
|
|
317
317
|
marginBottom,
|
|
318
318
|
marginTop,
|
|
319
319
|
marginRight,
|
|
320
320
|
marginLeft,
|
|
321
|
-
}, 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: `var(--control-min-height, ${ultraCompactDisplay
|
|
321
|
+
}, children: [label && (_jsxs("p", { style: labelStyle, 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
|
|
322
322
|
? "1.5rem"
|
|
323
323
|
: compactDisplay
|
|
324
324
|
? "2rem"
|
|
@@ -326,13 +326,13 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
326
326
|
? "1.5rem"
|
|
327
327
|
: density === "compact"
|
|
328
328
|
? "2rem"
|
|
329
|
-
: "2.5rem"})`, position: "relative" }, style), children: [_jsxs("div", { style: {
|
|
329
|
+
: "2.5rem"})`, position: "relative" }), style), children: [_jsxs("div", { style: {
|
|
330
330
|
display: "flex",
|
|
331
331
|
alignItems: "center",
|
|
332
332
|
justifyContent: "space-between",
|
|
333
333
|
cursor: "pointer",
|
|
334
334
|
width: "100%",
|
|
335
|
-
}, ref: clearIconRef, onClick: handleClick, children: [_jsx("span", { children: selectedDisplay
|
|
335
|
+
}, ref: clearIconRef, onClick: handleClick, children: [_jsx("span", { style: { display: isIcon ? withValue ? "inline-block" : "none" : "inline-block" }, children: selectedDisplay
|
|
336
336
|
? selectedDisplay
|
|
337
337
|
: displayValue
|
|
338
338
|
? wrapMiddle(displayValue, selectedCharLength)
|
package/package.json
CHANGED