@megha-ui/react 1.2.363 → 1.2.364
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { useDensity } from "../../context/DensityContext";
|
|
4
4
|
import Checkbox from "../checkbox";
|
|
@@ -371,6 +371,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
371
371
|
backgroundColor: "var(--row-bg)",
|
|
372
372
|
display: "flex",
|
|
373
373
|
alignItems: "center",
|
|
374
|
+
justifyContent: "space-between",
|
|
374
375
|
}, children: [_jsx("span", { children: groupOption.groupedValue }), _jsx("span", { children: collapsed === groupOption.groupedValue ? (_jsx(IoChevronDownCircleOutline, { style: {
|
|
375
376
|
transition: "transform 0.2s ease",
|
|
376
377
|
transform: "rotate(180deg)",
|
|
@@ -394,35 +395,35 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
394
395
|
else {
|
|
395
396
|
setCollapsed(groupOption.groupedValue);
|
|
396
397
|
}
|
|
397
|
-
} })) })] }), groupOption.options.map((option, index) => {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
398
|
+
} })) })] }), collapsed === groupOption.groupedValue ? null : (_jsx(_Fragment, { children: groupOption.options.map((option, index) => {
|
|
399
|
+
let prevOptions = groupedOptions.filter((item, index) => index < gIndex);
|
|
400
|
+
prevOptions = [
|
|
401
|
+
...prevOptions.map((item) => item.options),
|
|
402
|
+
];
|
|
403
|
+
prevOptions = prevOptions.flatMap((item) => item);
|
|
404
|
+
const refIndex = gIndex > 0 ? prevOptions.length + index : index;
|
|
405
|
+
return (_jsxs("li", { ref: (el) => {
|
|
406
|
+
optionRefs.current[refIndex] = el;
|
|
407
|
+
}, id: `${refIndex}`, onClick: (e) => onSelectChange
|
|
408
|
+
? handleItemSelect(option, option.disabled || false)
|
|
409
|
+
: handleSelect(option.value, option.disabled || false), style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, listItemStyle), { display: "flex", alignItems: "center" }), (refIndex === highlightIndex
|
|
410
|
+
? listItemHoverStyle
|
|
411
|
+
: {})), (option.disabled ? listItemDisabledStyle : {})), (refIndex !== highlightIndex &&
|
|
412
|
+
!isMultiple &&
|
|
413
|
+
intermediateValues.includes(option.value)
|
|
414
|
+
? selectedItemStyle
|
|
415
|
+
: {})), { wordWrap: "break-word", textWrap: "wrap", justifyContent: "space-between", padding: "0.75rem 1rem 0.75rem 2.5rem" }), onMouseEnter: (e) => {
|
|
416
|
+
if (!option.disabled) {
|
|
417
|
+
setHighlightIndex(refIndex);
|
|
418
|
+
}
|
|
419
|
+
}, children: [isMultiple && (_jsx("div", { style: { marginRight: "0.5rem" }, children: _jsx(Checkbox, { selected: intermediateValues.includes(option.value), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }) })), _jsxs("div", { style: {
|
|
420
|
+
display: "flex",
|
|
421
|
+
alignItems: "start",
|
|
422
|
+
width: "100%",
|
|
423
|
+
}, children: [option.icon &&
|
|
424
|
+
option.isDelete &&
|
|
425
|
+
!option.isDelete && _jsx("span", { children: option.icon }), _jsx("span", { style: { margin: "0 0.5rem" }, children: option.label })] }), option.icon && option.isDelete && option.icon] }, String(option.value)));
|
|
426
|
+
}) }))] }, gIndex)))) : (filteredOptions.map((option, index) => (_jsxs("li", { ref: (el) => {
|
|
426
427
|
optionRefs.current[index] = el;
|
|
427
428
|
}, onClick: (e) => onSelectChange
|
|
428
429
|
? handleItemSelect(option, option.disabled || false)
|
package/package.json
CHANGED