@monolith-forensics/monolith-ui 1.8.1-dev.3 → 1.8.1

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 (171) hide show
  1. package/dist/Button/Button.js +58 -9
  2. package/dist/Calendar/Calendar.d.ts +2 -7
  3. package/dist/Calendar/Calendar.js +49 -226
  4. package/dist/Calendar/CalendarStyles.d.ts +2 -6
  5. package/dist/Calendar/CalendarStyles.js +33 -153
  6. package/dist/Calendar/calendarHelpers.d.ts +2 -6
  7. package/dist/Calendar/calendarHelpers.js +5 -13
  8. package/dist/Charts/BarChart/BarChart.js +28 -14
  9. package/dist/Charts/BarChart/BarChart.styled.d.ts +7 -2
  10. package/dist/Charts/BarChart/BarChart.styled.js +5 -1
  11. package/dist/Charts/BarChart/BarChart.types.d.ts +13 -5
  12. package/dist/Charts/ChartUtils/chartSizing.d.ts +20 -0
  13. package/dist/Charts/ChartUtils/chartSizing.js +83 -0
  14. package/dist/Charts/ChartUtils/index.d.ts +1 -0
  15. package/dist/Charts/ChartUtils/index.js +1 -0
  16. package/dist/Charts/HeatMap/HeatMap.js +28 -7
  17. package/dist/Charts/HeatMap/HeatMap.styled.d.ts +6 -2
  18. package/dist/Charts/HeatMap/HeatMap.styled.js +3 -0
  19. package/dist/Charts/HeatMap/HeatMap.types.d.ts +7 -1
  20. package/dist/Charts/LineChart/LineChart.js +34 -15
  21. package/dist/Charts/LineChart/LineChart.styled.d.ts +7 -2
  22. package/dist/Charts/LineChart/LineChart.styled.js +5 -1
  23. package/dist/Charts/LineChart/LineChart.types.d.ts +13 -5
  24. package/dist/Charts/PieChart/PieChart.js +48 -33
  25. package/dist/Charts/PieChart/PieChart.styled.d.ts +7 -2
  26. package/dist/Charts/PieChart/PieChart.styled.js +6 -1
  27. package/dist/Charts/PieChart/PieChart.types.d.ts +7 -3
  28. package/dist/CheckBox/CheckBox.js +19 -36
  29. package/dist/DateInput/DateInput.js +143 -198
  30. package/dist/DropDownMenu/DropDownMenu.js +15 -25
  31. package/dist/DropDownMenu/components/MenuComponent.js +2 -8
  32. package/dist/DropDownMenu/components/MenuItem.d.ts +0 -2
  33. package/dist/DropDownMenu/components/MenuItem.js +21 -25
  34. package/dist/DropDownMenu/components/MenuItemList.d.ts +0 -3
  35. package/dist/DropDownMenu/components/MenuItemList.js +86 -192
  36. package/dist/DropDownMenu/components/StyledContent.js +2 -1
  37. package/dist/DropDownMenu/components/StyledFloatContainer.js +1 -1
  38. package/dist/DropDownMenu/types.d.ts +0 -3
  39. package/dist/FieldLabel/FieldLabel.js +12 -4
  40. package/dist/FileInputField/FileInputField.js +23 -4
  41. package/dist/FileViewer/viewers/ImageViewer.js +18 -75
  42. package/dist/FormSection/FormSection.js +25 -5
  43. package/dist/IconButton/IconButton.js +16 -2
  44. package/dist/Input/Input.js +56 -7
  45. package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +4 -1
  46. package/dist/Pill/Pill.js +79 -8
  47. package/dist/Popover/Popover.context.d.ts +1 -2
  48. package/dist/Popover/Popover.js +2 -5
  49. package/dist/Popover/Popover.styles.d.ts +6 -1
  50. package/dist/Popover/Popover.styles.js +28 -11
  51. package/dist/Popover/Popover.transitions.d.ts +2 -4
  52. package/dist/Popover/Popover.transitions.js +49 -23
  53. package/dist/Popover/PopoverDropdown.js +8 -6
  54. package/dist/Popover/PopoverTarget.js +3 -6
  55. package/dist/QueryFilter/DefaultOperators.d.ts +76 -1
  56. package/dist/QueryFilter/DefaultOperators.js +21 -1
  57. package/dist/QueryFilter/QueryFilter.d.ts +1 -1
  58. package/dist/QueryFilter/QueryFilter.js +303 -3
  59. package/dist/QueryFilter/index.d.ts +2 -3
  60. package/dist/QueryFilter/index.js +2 -3
  61. package/dist/QueryFilter/types.d.ts +52 -1
  62. package/dist/QueryFilter/types.js +1 -1
  63. package/dist/QueryFilter/useQueryFilter.d.ts +1 -1
  64. package/dist/QueryFilter/useQueryFilter.js +19 -23
  65. package/dist/RichTextEditor/Components/CodeBlockBaseButton.d.ts +18 -0
  66. package/dist/RichTextEditor/Components/CodeBlockBaseButton.js +6 -0
  67. package/dist/RichTextEditor/Components/CodeBlockCopyButton.d.ts +9 -0
  68. package/dist/RichTextEditor/Components/CodeBlockCopyButton.js +42 -0
  69. package/dist/RichTextEditor/Components/CodeBlockFormatButton.d.ts +10 -0
  70. package/dist/RichTextEditor/Components/CodeBlockFormatButton.js +60 -0
  71. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.d.ts +9 -0
  72. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.js +30 -0
  73. package/dist/RichTextEditor/Components/CodeBlockNodeView.d.ts +3 -0
  74. package/dist/RichTextEditor/Components/CodeBlockNodeView.js +28 -0
  75. package/dist/RichTextEditor/Components/CodeBlockWrapButton.d.ts +10 -0
  76. package/dist/RichTextEditor/Components/CodeBlockWrapButton.js +17 -0
  77. package/dist/RichTextEditor/Components/LinkEditor.d.ts +8 -0
  78. package/dist/RichTextEditor/Components/LinkEditor.js +94 -0
  79. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.d.ts +2 -0
  80. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.js +19 -0
  81. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.d.ts +2 -0
  82. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.js +24 -0
  83. package/dist/RichTextEditor/Components/TableTools/TableRails.d.ts +2 -0
  84. package/dist/RichTextEditor/Components/TableTools/TableRails.js +180 -0
  85. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.d.ts +5 -0
  86. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.js +6 -0
  87. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.d.ts +5 -0
  88. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.js +183 -0
  89. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.d.ts +16 -0
  90. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.js +217 -0
  91. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.d.ts +8 -0
  92. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.js +11 -0
  93. package/dist/RichTextEditor/Components/TableTools/TableTools.d.ts +3 -0
  94. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.d.ts +23 -0
  95. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.js +75 -0
  96. package/dist/RichTextEditor/Components/TableTools/TableTools.js +3 -0
  97. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.d.ts +16 -0
  98. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.js +53 -0
  99. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.d.ts +40 -0
  100. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.js +167 -0
  101. package/dist/RichTextEditor/Components/TableTools/TableTools.types.d.ts +76 -0
  102. package/dist/RichTextEditor/Components/TableTools/TableTools.types.js +1 -0
  103. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.d.ts +4 -0
  104. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.js +4 -0
  105. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.d.ts +2 -0
  106. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.js +12 -0
  107. package/dist/RichTextEditor/Components/TableTools/index.d.ts +3 -0
  108. package/dist/RichTextEditor/Components/TableTools/index.js +2 -0
  109. package/dist/RichTextEditor/Enums/HighlightColors.d.ts +9 -0
  110. package/dist/RichTextEditor/Enums/HighlightColors.js +10 -0
  111. package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +15 -5
  112. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +4 -7
  113. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.d.ts +0 -15
  114. package/dist/RichTextEditor/Plugins/UploadImagesPlugin.js +51 -115
  115. package/dist/RichTextEditor/Plugins/index.d.ts +0 -1
  116. package/dist/RichTextEditor/Plugins/index.js +0 -1
  117. package/dist/RichTextEditor/RichTextEditor.d.ts +2 -3
  118. package/dist/RichTextEditor/RichTextEditor.js +35 -302
  119. package/dist/RichTextEditor/Utils/codeBlockUtils.d.ts +20 -0
  120. package/dist/RichTextEditor/Utils/codeBlockUtils.js +137 -0
  121. package/dist/RichTextEditor/Utils/codeUtils.d.ts +3 -0
  122. package/dist/RichTextEditor/Utils/codeUtils.js +12 -0
  123. package/dist/RichTextEditor/Utils/linkUtils.d.ts +19 -0
  124. package/dist/RichTextEditor/Utils/linkUtils.js +57 -0
  125. package/dist/RichTextEditor/Utils/tableUtils.d.ts +1 -0
  126. package/dist/RichTextEditor/Utils/tableUtils.js +1 -0
  127. package/dist/SegmentedControl/SegmentedControl.utils.d.ts +2 -2
  128. package/dist/SegmentedControl/SegmentedControl.utils.js +30 -3
  129. package/dist/SelectBox/SelectBox.js +5 -5
  130. package/dist/SelectBox/select-box.styled-components.d.ts +1 -4
  131. package/dist/SelectBox/select-box.styled-components.js +48 -11
  132. package/dist/SelectBox/types.d.ts +0 -1
  133. package/dist/Switch/Switch.d.ts +2 -2
  134. package/dist/Switch/Switch.js +83 -18
  135. package/dist/Table/ColumnResizer.d.ts +9 -6
  136. package/dist/Table/ColumnResizer.js +10 -30
  137. package/dist/Table/StateStorage.d.ts +0 -4
  138. package/dist/Table/StateStorage.js +0 -13
  139. package/dist/Table/Table.js +12 -160
  140. package/dist/Table/TableComponents.d.ts +0 -10
  141. package/dist/Table/TableComponents.js +10 -71
  142. package/dist/Table/TableDefaults.d.ts +0 -7
  143. package/dist/Table/TableDefaults.js +0 -7
  144. package/dist/Table/TableHeader.js +16 -31
  145. package/dist/Table/TableMenu/TableMenu.js +1 -1
  146. package/dist/Table/TableProvider.js +75 -354
  147. package/dist/Table/TableRow.js +16 -28
  148. package/dist/Table/Utils/index.d.ts +1 -0
  149. package/dist/Table/Utils/index.js +1 -0
  150. package/dist/Table/types.d.ts +19 -70
  151. package/dist/TagBox/TagBox.d.ts +1 -1
  152. package/dist/TagBox/TagBox.js +80 -22
  153. package/dist/TagBox/types.d.ts +0 -1
  154. package/dist/TextArea/TextArea.js +23 -9
  155. package/dist/TextInput/TextInput.js +6 -12
  156. package/dist/Utilities/parseTimestamp.js +6 -11
  157. package/dist/core/ArrowButton.d.ts +0 -2
  158. package/dist/core/ArrowButton.js +3 -7
  159. package/dist/core/ClearButton.d.ts +0 -2
  160. package/dist/core/ClearButton.js +3 -7
  161. package/dist/core/controlSizes.js +9 -9
  162. package/dist/core/index.d.ts +0 -1
  163. package/dist/core/index.js +0 -1
  164. package/dist/index.d.ts +0 -3
  165. package/dist/index.js +0 -2
  166. package/dist/theme/variants.js +8 -2
  167. package/package.json +18 -26
  168. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +0 -41
  169. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +0 -363
  170. package/dist/DateTimeRangePicker/index.d.ts +0 -2
  171. package/dist/DateTimeRangePicker/index.js +0 -2
@@ -1,39 +1,29 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { Menu, MenuItemList, StyledInnerItemContainer } from "./components";
4
- export const DropDownMenu = ({ data, children, defaultValue, value, variant, arrow, size, searchable, grouped, onAddNew, loading, onScroll, onScrollToTop, onScrollToBottom, onSearch, manualSearch, multiselect, enableSelectAll, renderOption, dynamicOptionHeight, onItemSelect, onChange, buttonProps, TooltipContent, dropDownProps, query, disabled, }) => {
4
+ export const DropDownMenu = ({ data, children, defaultValue, variant, arrow, size, searchable, grouped, onAddNew, loading, onScroll, onScrollToTop, onScrollToBottom, onSearch, manualSearch, multiselect, renderOption, onItemSelect, onChange, buttonProps, TooltipContent, dropDownProps, query, disabled, }) => {
5
5
  var _a;
6
6
  const isObjectArray = (_a = Object.keys((data === null || data === void 0 ? void 0 : data[0]) || {})) === null || _a === void 0 ? void 0 : _a.includes("label");
7
- const [internalSelected, setInternalSelected] = useState(defaultValue || []);
8
- const isControlled = value !== undefined;
9
- const selected = isControlled ? value || [] : internalSelected;
10
- const updateSelected = (newSelected, diff) => {
11
- if (!isControlled) {
12
- setInternalSelected(newSelected);
13
- }
14
- onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
15
- };
16
- const isSameItem = (a, b) => isObjectArray ? (a === null || a === void 0 ? void 0 : a.value) === (b === null || b === void 0 ? void 0 : b.value) : a === b;
7
+ const [selected, setSelected] = useState(defaultValue || []);
17
8
  const handleAddItem = (item) => {
18
- if (!multiselect) {
19
- updateSelected([item], [item]);
20
- return;
21
- }
22
- const nextSelected = selected.some((selectedItem) => isSameItem(selectedItem, item))
23
- ? selected
24
- : [...selected, item];
25
- updateSelected(nextSelected, [item]);
9
+ setSelected((prev) => {
10
+ let newSelected = [...prev, item];
11
+ const diff = [item];
12
+ onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
13
+ return newSelected;
14
+ });
26
15
  };
27
16
  const handleRemoveItem = (item) => {
28
- const newSelected = selected.filter((i) => !isSameItem(i, item));
29
- updateSelected(newSelected, [item]);
30
- };
31
- const handleSetSelected = (newSelected, diff) => {
32
- updateSelected(newSelected, diff);
17
+ setSelected((prev) => {
18
+ let newSelected = prev.filter((i) => isObjectArray ? (i === null || i === void 0 ? void 0 : i.value) !== (item === null || item === void 0 ? void 0 : item.value) : i !== item);
19
+ const diff = [item];
20
+ onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
21
+ return newSelected;
22
+ });
33
23
  };
34
24
  const handleMenuClose = () => { };
35
25
  const handleScrollToBottom = (e) => {
36
26
  onScrollToBottom === null || onScrollToBottom === void 0 ? void 0 : onScrollToBottom(e);
37
27
  };
38
- return (_jsx(Menu, { label: children, disabled: disabled, arrow: arrow, buttonSize: size, variant: variant, multiselect: multiselect, buttonProps: buttonProps, onMenuClose: handleMenuClose, dropDownProps: dropDownProps, children: _jsxs(StyledInnerItemContainer, { children: [loading && _jsx("div", { children: "Loading..." }), !loading && (_jsx(MenuItemList, { menuItems: data, searchable: searchable, grouped: grouped, onAddNew: onAddNew, onSearch: onSearch, manualSearch: manualSearch, dynamicOptionHeight: dynamicOptionHeight, selected: selected, TooltipContent: TooltipContent, multiselect: multiselect, enableSelectAll: enableSelectAll, size: size, handleAddItem: handleAddItem, handleRemoveItem: handleRemoveItem, handleSetSelected: handleSetSelected, onItemSelect: onItemSelect, renderOption: renderOption, onScroll: onScroll, onScrollToTop: onScrollToTop, onScrollToBottom: handleScrollToBottom, query: query }))] }) }));
28
+ return (_jsx(Menu, { label: children, disabled: disabled, arrow: arrow, buttonSize: size, variant: variant, multiselect: multiselect, buttonProps: buttonProps, onMenuClose: handleMenuClose, dropDownProps: dropDownProps, children: _jsxs(StyledInnerItemContainer, { children: [loading && _jsx("div", { children: "Loading..." }), !loading && (_jsx(MenuItemList, { menuItems: data, searchable: searchable, grouped: grouped, onAddNew: onAddNew, onSearch: onSearch, manualSearch: manualSearch, selected: selected, TooltipContent: TooltipContent, multiselect: multiselect, size: size, handleAddItem: handleAddItem, handleRemoveItem: handleRemoveItem, onItemSelect: onItemSelect, renderOption: renderOption, onScroll: onScroll, onScrollToTop: onScrollToTop, onScrollToBottom: handleScrollToBottom, query: query }))] }) }));
39
29
  };
@@ -11,9 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { forwardRef, useContext, useEffect, useRef, useState } from "react";
14
- import { autoUpdate, flip, FloatingFocusManager, FloatingList, FloatingNode, FloatingPortal, offset, safePolygon, shift, size as floatingSize, useClick, useDismiss, useFloating, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, useHover, useInteractions, useListItem, useListNavigation, useMergeRefs, useRole, useTypeahead, } from "@floating-ui/react";
14
+ import { autoUpdate, flip, FloatingFocusManager, FloatingList, FloatingNode, FloatingPortal, offset, safePolygon, shift, useClick, useDismiss, useFloating, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, useHover, useInteractions, useListItem, useListNavigation, useMergeRefs, useRole, useTypeahead, } from "@floating-ui/react";
15
15
  import { ChevronDownIcon, ChevronRightIcon } from "lucide-react";
16
- import { getControlSizeTokens } from "../../core";
17
16
  import { MenuContext } from "./MenuContext";
18
17
  import { StyledFloatContainer } from "./StyledFloatContainer";
19
18
  import { StyledContent } from "./StyledContent";
@@ -43,11 +42,6 @@ export const MenuComponent = forwardRef((_a, forwardedRef) => {
43
42
  }),
44
43
  flip(),
45
44
  shift(),
46
- floatingSize({
47
- apply({ rects, elements }) {
48
- elements.floating.style.setProperty("--mfui-dropdown-reference-width", `${rects.reference.width}px`);
49
- },
50
- }),
51
45
  ],
52
46
  whileElementsMounted: autoUpdate,
53
47
  });
@@ -113,7 +107,7 @@ export const MenuComponent = forwardRef((_a, forwardedRef) => {
113
107
  (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, event);
114
108
  setHasFocusInside(false);
115
109
  parent.setHasFocusInside(true);
116
- } }))), { rightSection: arrow ? (_jsx(ChevronDownIcon, { size: getControlSizeTokens(buttonSize).iconSize })) : isNested ? (_jsx(ChevronRightIcon, { size: getControlSizeTokens(buttonSize).iconSize })) : null, size: buttonSize, variant: variant, selected: isOpen, nested: isNested }, buttonProps, { children: label })), _jsx(MenuContext.Provider, { value: {
110
+ } }))), { rightSection: arrow ? (_jsx(ChevronDownIcon, { size: 12 })) : isNested ? (_jsx(ChevronRightIcon, { size: 12 })) : null, size: buttonSize, variant: variant, selected: isOpen, nested: isNested }, buttonProps, { children: label })), _jsx(MenuContext.Provider, { value: {
117
111
  activeIndex,
118
112
  setActiveIndex,
119
113
  getItemProps,
@@ -19,7 +19,6 @@ export declare const MenuItem: import("styled-components/dist/types").IStyledCom
19
19
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
20
20
  } & {
21
21
  multiselect?: boolean;
22
- $dynamicHeight?: boolean;
23
22
  }, "ref"> & import("react").RefAttributes<unknown>, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<MenuProps & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
24
23
  ref?: RefObject<HTMLButtonElement>;
25
24
  children?: import("react").ReactNode | string;
@@ -39,5 +38,4 @@ export declare const MenuItem: import("styled-components/dist/types").IStyledCom
39
38
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
40
39
  } & {
41
40
  multiselect?: boolean;
42
- $dynamicHeight?: boolean;
43
41
  }, "ref"> & import("react").RefAttributes<unknown>>, keyof import("react").Component<any, {}, any>>;
@@ -13,7 +13,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { forwardRef, useContext } from "react";
14
14
  import styled from "styled-components";
15
15
  import { Button } from "../../Button";
16
- import { getControlSizeTokens } from "../../core";
17
16
  import { useFloatingTree, useListItem, useMergeRefs } from "@floating-ui/react";
18
17
  import { MenuContext } from "./MenuContext";
19
18
  import Tooltip from "../../Tooltip";
@@ -44,23 +43,21 @@ export const MenuItem = styled(forwardRef((_a, forwardedRef) => {
44
43
  border-radius: 3px;
45
44
  display: flex;
46
45
  flex-direction: row;
47
- gap: ${({ size = "sm" }) => `${getControlSizeTokens(size).iconGap}px`};
46
+ gap: 5px;
48
47
  align-items: center;
49
- min-height: ${({ size = "sm" }) => `${getControlSizeTokens(size).menuRowHeight}px`};
48
+ min-height: 25px;
50
49
  width: 100%;
51
50
  min-width: 100%;
52
- height: ${({ size = "sm", $dynamicHeight }) => $dynamicHeight ? "auto" : `${getControlSizeTokens(size).menuRowHeight}px`};
53
- box-sizing: border-box;
51
+ height: auto;
54
52
  position: relative;
55
53
  user-select: none;
56
54
  outline: none;
57
55
 
58
56
  border: none;
59
- text-align: left;
60
57
 
61
- white-space: ${({ $dynamicHeight }) => $dynamicHeight ? "normal" : "nowrap"};
62
- overflow: ${({ $dynamicHeight }) => $dynamicHeight ? "visible" : "hidden"};
63
- text-overflow: ${({ $dynamicHeight }) => $dynamicHeight ? "clip" : "ellipsis"};
58
+ white-space: nowrap;
59
+ overflow: hidden;
60
+ text-overflow: ellipsis;
64
61
 
65
62
  cursor: pointer;
66
63
  text-decoration: none;
@@ -68,7 +65,17 @@ export const MenuItem = styled(forwardRef((_a, forwardedRef) => {
68
65
  font-weight: normal;
69
66
  letter-spacing: normal;
70
67
 
71
- padding: ${({ size = "sm", $dynamicHeight }) => `${$dynamicHeight ? 6 : 0}px ${getControlSizeTokens(size).menuItemPaddingX}px`};
68
+ padding: ${({ size }) => size === "xs"
69
+ ? "2px 8px"
70
+ : size === "sm"
71
+ ? "4px 10px"
72
+ : size === "md"
73
+ ? "4px 12px"
74
+ : size === "lg"
75
+ ? "5px 14px"
76
+ : size === "xl"
77
+ ? "6px 16px"
78
+ : "2px 8px"};
72
79
 
73
80
  &[data-disabled="true"] {
74
81
  opacity: 0.5;
@@ -76,12 +83,6 @@ export const MenuItem = styled(forwardRef((_a, forwardedRef) => {
76
83
  pointer-events: "none";
77
84
  }
78
85
 
79
- &[data-selected="true"] {
80
- background-color: ${(props) => props.theme.palette.primary.main}20;
81
- color: ${(props) => props.theme.palette.primary.main};
82
- font-weight: 600;
83
- }
84
-
85
86
  &:hover {
86
87
  background-color: ${(props) => props.theme.palette.action.hover};
87
88
  color: ${(props) => props.theme.palette.text.primary};
@@ -92,15 +93,10 @@ export const MenuItem = styled(forwardRef((_a, forwardedRef) => {
92
93
  }
93
94
 
94
95
  .button-label {
95
- display: ${({ $dynamicHeight }) => $dynamicHeight ? "flex" : "inline-block"};
96
- align-items: center;
97
- justify-content: flex-start;
98
- min-width: 0;
99
- width: 100%;
100
- text-align: left;
101
- overflow: ${({ $dynamicHeight }) => $dynamicHeight ? "visible" : "hidden"};
102
- white-space: ${({ $dynamicHeight }) => $dynamicHeight ? "normal" : "nowrap"};
103
- text-overflow: ${({ $dynamicHeight }) => $dynamicHeight ? "clip" : "ellipsis"};
96
+ display: inline-block;
97
+ overflow: hidden;
98
+ white-space: nowrap;
99
+ text-overflow: ellipsis;
104
100
  }
105
101
  }
106
102
  `;
@@ -7,17 +7,14 @@ export declare const MenuItemList: React.FC<{
7
7
  searchValue?: string;
8
8
  onSearch?: (value: string) => void;
9
9
  manualSearch?: boolean;
10
- dynamicOptionHeight?: boolean;
11
10
  selected?: DropDownItem[];
12
11
  TooltipContent?: ComponentType<any>;
13
12
  multiselect?: boolean;
14
- enableSelectAll?: boolean;
15
13
  grouped?: boolean;
16
14
  onAddNew?: (value: string) => void;
17
15
  size?: Size;
18
16
  handleAddItem: (item: DropDownItem) => void;
19
17
  handleRemoveItem: (item: DropDownItem) => void;
20
- handleSetSelected: (selected: DropDownItem[], diff: DropDownItem[]) => void;
21
18
  onItemSelect?: (item: DropDownItem) => void;
22
19
  renderOption?: (item: DropDownItem) => React.ReactNode;
23
20
  onScroll?: (e: Event) => void;
@@ -10,19 +10,17 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
- import { useCallback, useLayoutEffect, useMemo, useRef, useState, } from "react";
13
+ import { useLayoutEffect, useRef, useState } from "react";
14
14
  import styled from "styled-components";
15
- import { FixedSizeList, VariableSizeList } from "react-window";
15
+ import { FixedSizeList } from "react-window";
16
16
  import { Plus } from "lucide-react";
17
17
  import CheckBox from "../../CheckBox";
18
- import { getControlSizeTokens } from "../../core";
19
18
  import { DropDownMenu } from "../DropDownMenu";
20
19
  import { MenuItem } from "./MenuItem";
21
20
  import { useInfiniteQuery } from "@tanstack/react-query";
22
21
  import { useDebouncedCallback } from "use-debounce";
23
22
  import { SearchInput } from "./SearchInput";
24
23
  import Loader from "../../Loader";
25
- const getItemKey = (item) => item && typeof item === "object" && "value" in item ? item.value : item;
26
24
  const filterMenuItems = (menuItems, searchValue) => {
27
25
  return menuItems.filter((item) => {
28
26
  var _a, _b, _c;
@@ -56,28 +54,6 @@ const buildGroupedDisplayList = (items) => {
56
54
  const ListViewPort = styled.div.attrs({ className: "ListViewPort" }) `
57
55
  display: flex;
58
56
  flex-direction: column;
59
- width: 100%;
60
- `;
61
- const ListScroller = styled.div `
62
- scrollbar-color: ${({ theme }) => `${theme.scrollbar.thumb} ${theme.scrollbar.track}`};
63
- scrollbar-gutter: stable;
64
- scrollbar-width: thin;
65
-
66
- &::-webkit-scrollbar {
67
- width: 6px;
68
- }
69
-
70
- &::-webkit-scrollbar-track {
71
- background: ${(props) => props.theme.scrollbar.track};
72
- }
73
-
74
- &::-webkit-scrollbar-thumb {
75
- background: ${(props) => props.theme.scrollbar.thumb};
76
- }
77
-
78
- &::-webkit-scrollbar-thumb:hover {
79
- background: ${(props) => props.theme.scrollbar.thumbHover};
80
- }
81
57
  `;
82
58
  const GroupHeader = styled.div `
83
59
  display: flex;
@@ -86,9 +62,28 @@ const GroupHeader = styled.div `
86
62
  color: ${(props) => props.theme.palette.text.secondary};
87
63
  font-weight: 500;
88
64
  user-select: none;
89
- min-height: ${({ $size = "sm" }) => `${getControlSizeTokens($size).menuRowHeight}px`};
90
- padding: ${({ $size = "sm" }) => `0px ${getControlSizeTokens($size).menuItemPaddingX}px`};
91
- font-size: ${({ $size = "sm" }) => `${getControlSizeTokens($size).menuGroupFontSize}px`};
65
+ padding: ${({ $size }) => $size === "xs"
66
+ ? "2px 8px"
67
+ : $size === "sm"
68
+ ? "4px 10px"
69
+ : $size === "md"
70
+ ? "4px 12px"
71
+ : $size === "lg"
72
+ ? "5px 14px"
73
+ : $size === "xl"
74
+ ? "6px 16px"
75
+ : "2px 8px"};
76
+ font-size: ${({ $size }) => $size === "xs"
77
+ ? "10px"
78
+ : $size === "sm"
79
+ ? "11px"
80
+ : $size === "md"
81
+ ? "13px"
82
+ : $size === "lg"
83
+ ? "15px"
84
+ : $size === "xl"
85
+ ? "17px"
86
+ : "10px"};
92
87
 
93
88
  .group-line {
94
89
  border-top: 1px solid ${(props) => props.theme.palette.divider};
@@ -100,41 +95,17 @@ const GroupHeader = styled.div `
100
95
  min-width: fit-content;
101
96
  }
102
97
  `;
103
- const MeasuredRow = ({ children, index, setItemSize, style }) => {
104
- const rowRef = useRef(null);
105
- useLayoutEffect(() => {
106
- const row = rowRef.current;
107
- if (!row)
108
- return;
109
- const updateSize = () => {
110
- const measuredHeight = Math.ceil(row.getBoundingClientRect().height);
111
- if (measuredHeight > 0) {
112
- setItemSize(index, measuredHeight);
113
- }
114
- };
115
- updateSize();
116
- if (typeof ResizeObserver === "undefined")
117
- return;
118
- const observer = new ResizeObserver(updateSize);
119
- observer.observe(row);
120
- return () => observer.disconnect();
121
- }, [children, index, setItemSize]);
122
- return (_jsx("div", { style: Object.assign(Object.assign({}, style), { overflow: "visible" }), children: _jsx("div", { ref: rowRef, children: children }) }));
123
- };
124
- export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, dynamicOptionHeight, selected, TooltipContent, multiselect, enableSelectAll, grouped, onAddNew, size, handleAddItem, handleRemoveItem, handleSetSelected, onItemSelect, renderOption, onScroll, onScrollToTop, onScrollToBottom, query, }) => {
98
+ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, selected, TooltipContent, multiselect, grouped, onAddNew, size, handleAddItem, handleRemoveItem, onItemSelect, renderOption, onScroll, onScrollToTop, onScrollToBottom, query, }) => {
99
+ var _a;
125
100
  const [searchValue, setSearchValue] = useState("");
126
- const _a = query !== null && query !== void 0 ? query : {}, { queryKey, queryFn, getNextPageParam, initialPageParam } = _a, rest = __rest(_a, ["queryKey", "queryFn", "getNextPageParam", "initialPageParam"]);
101
+ const _b = query !== null && query !== void 0 ? query : {}, { queryKey, queryFn, getNextPageParam, initialPageParam } = _b, rest = __rest(_b, ["queryKey", "queryFn", "getNextPageParam", "initialPageParam"]);
102
+ const abortController = new AbortController();
127
103
  const targetElm = useRef(null);
128
104
  const listElm = useRef(null);
129
- const fixedListRef = useRef(null);
130
- const variableListRef = useRef(null);
131
- const hasHandledInitialSelectedScroll = useRef(false);
132
- const itemSizeMap = useRef({});
133
105
  const [viewPortDimensions, setViewPortDimensions] = useState({
134
106
  width: 0,
135
107
  height: 0,
136
108
  });
137
- const [, setMeasurementRevision] = useState(0);
138
109
  const { data: infiniteQueryResult, isLoading: isLoadingInfiniteQuery, fetchNextPage, } = useInfiniteQuery(Object.assign({ queryKey: (queryKey === null || queryKey === void 0 ? void 0 : queryKey({ search: searchValue })) || [], queryFn: queryFn, getNextPageParam: (query === null || query === void 0 ? void 0 : query.getNextPageParam) || (() => undefined), initialPageParam: (query === null || query === void 0 ? void 0 : query.initialPageParam) || 1, enabled: !!query }, rest));
139
110
  const infinteOptionsData = infiniteQueryResult;
140
111
  const infiniteSelectOptions = infinteOptionsData || [];
@@ -152,9 +123,6 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, dy
152
123
  if (multiselect) {
153
124
  isSelected ? handleRemoveItem(item) : handleAddItem(item);
154
125
  }
155
- else {
156
- handleAddItem(item);
157
- }
158
126
  onItemSelect === null || onItemSelect === void 0 ? void 0 : onItemSelect(item);
159
127
  (_a = item === null || item === void 0 ? void 0 : item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, item);
160
128
  };
@@ -185,55 +153,39 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, dy
185
153
  }
186
154
  return items;
187
155
  })();
188
- const selectedKeys = useMemo(() => new Set((selected || []).map(getItemKey)), [selected]);
189
- const isItemSelected = (item) => selectedKeys.has(getItemKey(item));
190
- const selectableItems = useMemo(() => displayItems.filter((item) => !item._isGroupHeader &&
191
- !item._isAddNew &&
192
- !item.disabled &&
193
- !item.items), [displayItems]);
194
- const selectableKeys = useMemo(() => new Set(selectableItems.map(getItemKey)), [selectableItems]);
195
- const selectedSelectableItems = useMemo(() => selectableItems.filter((item) => selectedKeys.has(getItemKey(item))), [selectableItems, selectedKeys]);
196
- const allSelectableItemsSelected = selectableItems.length > 0 &&
197
- selectedSelectableItems.length === selectableItems.length;
198
- const someSelectableItemsSelected = selectedSelectableItems.length > 0 && !allSelectableItemsSelected;
199
- const selectedDisplayIndex = displayItems.findIndex((item) => {
200
- if (item._isGroupHeader || item._isAddNew)
201
- return false;
202
- return isItemSelected(item);
203
- });
204
- const selectedDisplayKey = selected === null || selected === void 0 ? void 0 : selected.map(getItemKey).join("|");
156
+ const isObjectArray = (_a = Object.keys((visibleItems === null || visibleItems === void 0 ? void 0 : visibleItems[0]) || {})) === null || _a === void 0 ? void 0 : _a.includes("label");
205
157
  const isLoading = isLoadingInfiniteQuery;
206
- const handleOnScroll = useCallback((event) => {
158
+ const handleOnScroll = (event) => {
207
159
  const scrollTolerance = 15;
208
160
  onScroll === null || onScroll === void 0 ? void 0 : onScroll(event);
209
161
  const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;
162
+ // scroll to top
210
163
  if (scrollTop <= scrollTolerance) {
211
164
  onScrollToTop === null || onScrollToTop === void 0 ? void 0 : onScrollToTop(event);
212
165
  }
166
+ // Scroll to bottom
213
167
  if (scrollHeight - scrollTop <= clientHeight + scrollTolerance) {
214
168
  onScrollToBottom === null || onScrollToBottom === void 0 ? void 0 : onScrollToBottom(event);
215
169
  debouncedFetchNextPage();
216
170
  }
217
- }, [debouncedFetchNextPage, onScroll, onScrollToBottom, onScrollToTop]);
218
- const handleToggleSelectAll = () => {
219
- if (selectableItems.length === 0)
220
- return;
221
- const currentSelected = selected || [];
222
- if (allSelectableItemsSelected) {
223
- const nextSelected = currentSelected.filter((selectedItem) => !selectableKeys.has(getItemKey(selectedItem)));
224
- handleSetSelected(nextSelected, selectedSelectableItems);
225
- return;
226
- }
227
- const itemsToAdd = selectableItems.filter((item) => !isItemSelected(item));
228
- handleSetSelected([...currentSelected, ...itemsToAdd], itemsToAdd);
229
171
  };
230
172
  useLayoutEffect(() => {
231
- const list = listElm.current;
232
- if (!list)
233
- return;
234
- list.addEventListener("scroll", handleOnScroll);
235
- return () => list.removeEventListener("scroll", handleOnScroll);
236
- }, [dynamicOptionHeight, handleOnScroll, isLoading, renderOption]);
173
+ if (listElm.current) {
174
+ listElm.current.addEventListener("scroll", (e) => handleOnScroll(e));
175
+ }
176
+ // Event cleanup
177
+ return () => {
178
+ abortController.abort();
179
+ };
180
+ }, [
181
+ filteredItems,
182
+ listElm.current,
183
+ isLoading,
184
+ onScroll,
185
+ onScrollToTop,
186
+ onScrollToBottom,
187
+ handleOnScroll,
188
+ ]);
237
189
  useLayoutEffect(() => {
238
190
  var _a;
239
191
  if (targetElm.current) {
@@ -245,103 +197,20 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, dy
245
197
  }
246
198
  }, [targetElm.current, isLoading]);
247
199
  const overscanCount = 10;
248
- const sizeTokens = getControlSizeTokens(size || "sm");
249
- const itemHeight = sizeTokens.menuRowHeight;
250
- const dynamicListEnabled = dynamicOptionHeight !== null && dynamicOptionHeight !== void 0 ? dynamicOptionHeight : Boolean(renderOption);
251
- const estimatedDynamicItemHeight = itemHeight + 16;
200
+ const itemHeight = 25;
252
201
  const itemCount = (displayItems === null || displayItems === void 0 ? void 0 : displayItems.length) || 0;
253
- const displayItemsKey = displayItems
254
- .map((item) => `${item.value}:${item.label}:${item._isGroupHeader ? "g" : "i"}`)
255
- .join("|");
256
- const getDynamicItemSize = (index) => {
257
- var _a;
258
- return itemSizeMap.current[index] ||
259
- (((_a = displayItems[index]) === null || _a === void 0 ? void 0 : _a._isGroupHeader) ? itemHeight : estimatedDynamicItemHeight);
260
- };
261
- const estimatedHeight = dynamicListEnabled
262
- ? displayItems.reduce((total, _, index) => total + getDynamicItemSize(index), 0)
263
- : itemCount * itemHeight;
264
202
  const height = viewPortDimensions.height
265
203
  ? viewPortDimensions.height
266
- : estimatedHeight < 200
267
- ? estimatedHeight
204
+ : itemCount * itemHeight < 200
205
+ ? itemCount * itemHeight
268
206
  : 200;
269
- const width = "100%";
270
- const setItemSize = useCallback((index, measuredSize) => {
271
- var _a;
272
- if (itemSizeMap.current[index] === measuredSize)
273
- return;
274
- itemSizeMap.current = Object.assign(Object.assign({}, itemSizeMap.current), { [index]: measuredSize });
275
- (_a = variableListRef.current) === null || _a === void 0 ? void 0 : _a.resetAfterIndex(index);
276
- setMeasurementRevision((revision) => revision + 1);
277
- }, []);
278
- useLayoutEffect(() => {
279
- var _a;
280
- itemSizeMap.current = {};
281
- (_a = variableListRef.current) === null || _a === void 0 ? void 0 : _a.resetAfterIndex(0, true);
282
- setMeasurementRevision((revision) => revision + 1);
283
- }, [displayItemsKey, dynamicListEnabled]);
284
- useLayoutEffect(() => {
285
- var _a, _b, _c, _d;
286
- if (multiselect) {
287
- if (hasHandledInitialSelectedScroll.current || itemCount === 0) {
288
- return;
289
- }
290
- hasHandledInitialSelectedScroll.current = true;
291
- if (selectedDisplayIndex < 0)
292
- return;
293
- (_a = fixedListRef.current) === null || _a === void 0 ? void 0 : _a.scrollToItem(selectedDisplayIndex, "smart");
294
- (_b = variableListRef.current) === null || _b === void 0 ? void 0 : _b.scrollToItem(selectedDisplayIndex, "smart");
295
- return;
296
- }
297
- if (selectedDisplayIndex < 0)
298
- return;
299
- (_c = fixedListRef.current) === null || _c === void 0 ? void 0 : _c.scrollToItem(selectedDisplayIndex, "smart");
300
- (_d = variableListRef.current) === null || _d === void 0 ? void 0 : _d.scrollToItem(selectedDisplayIndex, "smart");
301
- }, [
302
- displayItemsKey,
303
- itemCount,
304
- multiselect,
305
- selectedDisplayIndex,
306
- selectedDisplayKey,
307
- ]);
308
- const renderDisplayItem = (item, index, style) => {
309
- if (item._isGroupHeader) {
310
- return (_jsxs(GroupHeader, { "$size": size, style: style, children: [_jsx("span", { className: "group-line" }), _jsx("span", { className: "group-label", children: item.label }), _jsx("span", { className: "group-line" })] }, item.value));
311
- }
312
- if (item._isAddNew) {
313
- return (_jsx(MenuItem, { className: "MenuItem", size: size, leftSection: _jsx(Plus, { size: 14 }), onClick: (e) => {
314
- e.preventDefault();
315
- e.stopPropagation();
316
- onAddNew === null || onAddNew === void 0 ? void 0 : onAddNew(item.value);
317
- }, style: style, children: item.label }, "__add_new__"));
318
- }
319
- const isSelected = isItemSelected(item);
320
- if (item.items) {
321
- return (_jsx(DropDownMenu, { data: item.items, size: size, buttonProps: style ? Object.assign({ style }, item) : Object.assign({}, item), disabled: item.disabled, dynamicOptionHeight: dynamicListEnabled, children: item.label }));
322
- }
323
- return (_jsx(MenuItem, { className: "MenuItem", itemData: item, TooltipContent: TooltipContent, "data-selected": !multiselect && isSelected, "data-disabled": item.disabled, disabled: item.disabled, leftSection: multiselect ? (_jsxs(_Fragment, { children: [_jsx(CheckBox, { value: isSelected, size: size, onChange: (newValue) => {
324
- var _a;
325
- newValue ? handleAddItem(item) : handleRemoveItem(item);
326
- (_a = item === null || item === void 0 ? void 0 : item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, item);
327
- } }), (item === null || item === void 0 ? void 0 : item.leftSection) || null] })) : ((item === null || item === void 0 ? void 0 : item.leftSection) || null), rightSection: item === null || item === void 0 ? void 0 : item.rightSection, multiselect: multiselect, size: size, title: !TooltipContent ? item === null || item === void 0 ? void 0 : item.label : undefined, onClick: (e) => {
328
- e.preventDefault();
329
- e.stopPropagation();
330
- handleItemClick(item, isSelected);
331
- }, style: style, "$dynamicHeight": dynamicListEnabled, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) ||
332
- (item === null || item === void 0 ? void 0 : item.label) ||
333
- (typeof item === "string" || typeof item === "number" ? item : null) }, index));
334
- };
207
+ const width = viewPortDimensions.width || 188;
335
208
  return (_jsxs("div", { children: [searchable && (_jsx(SearchInput, { variant: "outlined", size: size, placeholder: "Search", defaultValue: searchValue, onChange: (e) => {
336
209
  if (!manualSearch) {
337
210
  handleSearch(e);
338
211
  }
339
212
  onSearch === null || onSearch === void 0 ? void 0 : onSearch(e.target.value);
340
- } })), multiselect && enableSelectAll && selectableItems.length > 0 && (_jsx(MenuItem, { className: "MenuItem", size: size, leftSection: _jsx(CheckBox, { value: allSelectableItemsSelected, partialCheck: someSelectableItemsSelected, size: size, onChange: handleToggleSelectAll }), onClick: (e) => {
341
- e.preventDefault();
342
- e.stopPropagation();
343
- handleToggleSelectAll();
344
- }, children: "Select all" })), isLoading && (_jsxs("div", { style: {
213
+ } })), isLoading && (_jsxs("div", { style: {
345
214
  display: "flex",
346
215
  flexDirection: "column",
347
216
  gap: "10px",
@@ -349,15 +218,40 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, dy
349
218
  alignItems: "center",
350
219
  height: "100%",
351
220
  padding: "10px 0",
352
- }, children: [_jsx("div", { style: { fontSize: `${sizeTokens.supportingFontSize}px` }, children: "Loading..." }), _jsx(Loader, {})] })), !isLoading && (_jsx(ListViewPort, { ref: targetElm, children: dynamicListEnabled ? (_jsx(VariableSizeList, { ref: variableListRef, itemData: displayItems, overscanCount: overscanCount, height: height, width: width, itemCount: itemCount, itemSize: getDynamicItemSize, outerElementType: ListScroller, outerRef: listElm, children: ({ data, index, style }) => {
353
- const item = data === null || data === void 0 ? void 0 : data[index];
354
- if (!item)
355
- return null;
356
- return (_jsx(MeasuredRow, { index: index, setItemSize: setItemSize, style: style, children: renderDisplayItem(item, index) }));
357
- } })) : (_jsx(FixedSizeList, { ref: fixedListRef, itemData: displayItems, overscanCount: overscanCount, height: height, width: width, itemCount: itemCount, itemSize: itemHeight, outerElementType: ListScroller, outerRef: listElm, children: ({ data, index, style }) => {
221
+ }, children: [_jsx("div", { style: { fontSize: "12px" }, children: "Loading..." }), _jsx(Loader, {})] })), !isLoading && (_jsx(ListViewPort, { ref: targetElm, children: _jsx(FixedSizeList, { itemData: displayItems, overscanCount: overscanCount, height: height, width: width, itemCount: itemCount, itemSize: itemHeight, outerRef: listElm, children: ({ data, index, style }) => {
358
222
  const item = data === null || data === void 0 ? void 0 : data[index];
359
223
  if (!item)
360
224
  return null;
361
- return renderDisplayItem(item, index, style);
362
- } })) }))] }));
225
+ if (item._isGroupHeader) {
226
+ return (_jsxs(GroupHeader, { "$size": size, style: style, children: [_jsx("span", { className: "group-line" }), _jsx("span", { className: "group-label", children: item.label }), _jsx("span", { className: "group-line" })] }, item.value));
227
+ }
228
+ if (item._isAddNew) {
229
+ return (_jsx(MenuItem, { className: "MenuItem", size: size, leftSection: _jsx(Plus, { size: 14 }), onClick: (e) => {
230
+ e.preventDefault();
231
+ e.stopPropagation();
232
+ onAddNew === null || onAddNew === void 0 ? void 0 : onAddNew(item.value);
233
+ }, style: style, children: item.label }, "__add_new__"));
234
+ }
235
+ const isSelected = !!(selected === null || selected === void 0 ? void 0 : selected.find((s) => {
236
+ return isObjectArray ? (s === null || s === void 0 ? void 0 : s.value) === (item === null || item === void 0 ? void 0 : item.value) : s === item;
237
+ }));
238
+ if (item.items) {
239
+ return (_jsx(DropDownMenu, { data: item.items, size: size, buttonProps: Object.assign({ style }, item), disabled: item.disabled, children: item.label }));
240
+ }
241
+ return (_jsx(MenuItem, { className: "MenuItem", itemData: item, TooltipContent: TooltipContent, "data-selected": isSelected, "data-disabled": item.disabled, disabled: item.disabled, leftSection: multiselect ? (_jsxs(_Fragment, { children: [_jsx(CheckBox, { value: isSelected, size: size, onChange: (newValue) => {
242
+ var _a;
243
+ newValue
244
+ ? handleAddItem(item)
245
+ : handleRemoveItem(item);
246
+ (_a = item === null || item === void 0 ? void 0 : item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, item);
247
+ } }), (item === null || item === void 0 ? void 0 : item.leftSection) || null] })) : ((item === null || item === void 0 ? void 0 : item.leftSection) || null), rightSection: item === null || item === void 0 ? void 0 : item.rightSection, multiselect: multiselect, size: size, title: !TooltipContent ? item === null || item === void 0 ? void 0 : item.label : undefined, onClick: (e) => {
248
+ e.preventDefault();
249
+ e.stopPropagation();
250
+ handleItemClick(item, isSelected);
251
+ }, style: style, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) ||
252
+ (item === null || item === void 0 ? void 0 : item.label) ||
253
+ (typeof item === "string" || typeof item === "number"
254
+ ? item
255
+ : null) }, index));
256
+ } }) }))] }));
363
257
  };
@@ -7,7 +7,8 @@ export const StyledContent = styled.div `
7
7
  overflow-y: hidden;
8
8
  overflow-x: hidden;
9
9
 
10
- width: var(--mfui-dropdown-reference-width, 150px);
10
+ width: 200px;
11
+ min-width: 150px;
11
12
  max-width: 400px;
12
13
  max-height: ${({ maxDropdownHeight }) => Number.isInteger(maxDropdownHeight)
13
14
  ? `${maxDropdownHeight}px`
@@ -1,5 +1,5 @@
1
1
  import styled from "styled-components";
2
2
  export const StyledFloatContainer = styled.div `
3
- z-index: 100002;
3
+ z-index: 1500;
4
4
  outline: none;
5
5
  `;
@@ -31,7 +31,6 @@ export type DropDownMenuProps = {
31
31
  defaultValue?: DropDownItem[];
32
32
  value?: DropDownItem[];
33
33
  multiselect?: boolean;
34
- enableSelectAll?: boolean;
35
34
  size?: Size;
36
35
  title?: string;
37
36
  TooltipContent?: ComponentType<any>;
@@ -45,7 +44,6 @@ export type DropDownMenuProps = {
45
44
  searchable?: boolean;
46
45
  manualSearch?: boolean;
47
46
  grouped?: boolean;
48
- dynamicOptionHeight?: boolean;
49
47
  onAddNew?: (value: string) => void;
50
48
  loading?: boolean;
51
49
  arrow?: boolean;
@@ -79,5 +77,4 @@ export type MenuProps = {
79
77
  TooltipContent?: ComponentType<any>;
80
78
  dropDownProps?: ComponentPropsWithoutRef<typeof StyledContent>;
81
79
  disabled?: boolean;
82
- dynamicOptionHeight?: boolean;
83
80
  };