@monolith-forensics/monolith-ui 1.8.1-dev.0 → 1.8.1-dev.2

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 (72) hide show
  1. package/dist/Calendar/CalendarStyles.js +7 -4
  2. package/dist/DropDownMenu/DropDownMenu.js +2 -2
  3. package/dist/DropDownMenu/components/MenuItem.d.ts +2 -0
  4. package/dist/DropDownMenu/components/MenuItem.js +16 -9
  5. package/dist/DropDownMenu/components/MenuItemList.d.ts +1 -0
  6. package/dist/DropDownMenu/components/MenuItemList.js +101 -59
  7. package/dist/DropDownMenu/types.d.ts +2 -0
  8. package/dist/SelectBox/SelectBox.js +2 -2
  9. package/dist/SelectBox/select-box.styled-components.d.ts +1 -0
  10. package/dist/SelectBox/select-box.styled-components.js +3 -2
  11. package/dist/SelectBox/types.d.ts +1 -0
  12. package/dist/TagBox/TagBox.d.ts +1 -1
  13. package/dist/TagBox/TagBox.js +6 -6
  14. package/dist/TagBox/types.d.ts +1 -0
  15. package/dist/TextArea/TextArea.js +5 -0
  16. package/package.json +1 -1
  17. package/dist/BarChart/BarChart.d.ts +0 -3
  18. package/dist/BarChart/BarChart.js +0 -511
  19. package/dist/BarChart/BarChart.lib.d.ts +0 -31
  20. package/dist/BarChart/BarChart.lib.js +0 -136
  21. package/dist/BarChart/BarChart.styled.d.ts +0 -49
  22. package/dist/BarChart/BarChart.styled.js +0 -111
  23. package/dist/BarChart/BarChart.types.d.ts +0 -170
  24. package/dist/BarChart/BarChart.types.js +0 -1
  25. package/dist/BarChart/index.d.ts +0 -3
  26. package/dist/BarChart/index.js +0 -2
  27. package/dist/ChartPrimitives/chartLegend.styled.d.ts +0 -12
  28. package/dist/ChartPrimitives/chartLegend.styled.js +0 -52
  29. package/dist/ChartPrimitives/chartTooltip.styled.d.ts +0 -19
  30. package/dist/ChartPrimitives/chartTooltip.styled.js +0 -61
  31. package/dist/ChartPrimitives/index.d.ts +0 -2
  32. package/dist/ChartPrimitives/index.js +0 -2
  33. package/dist/ChartUtils/chartColors.d.ts +0 -8
  34. package/dist/ChartUtils/chartColors.js +0 -65
  35. package/dist/ChartUtils/chartMath.d.ts +0 -3
  36. package/dist/ChartUtils/chartMath.js +0 -3
  37. package/dist/ChartUtils/index.d.ts +0 -2
  38. package/dist/ChartUtils/index.js +0 -2
  39. package/dist/HeatMap/HeatMap.d.ts +0 -3
  40. package/dist/HeatMap/HeatMap.js +0 -174
  41. package/dist/HeatMap/HeatMap.lib.d.ts +0 -30
  42. package/dist/HeatMap/HeatMap.lib.js +0 -115
  43. package/dist/HeatMap/HeatMap.styled.d.ts +0 -34
  44. package/dist/HeatMap/HeatMap.styled.js +0 -83
  45. package/dist/HeatMap/HeatMap.types.d.ts +0 -79
  46. package/dist/HeatMap/HeatMap.types.js +0 -1
  47. package/dist/HeatMap/index.d.ts +0 -3
  48. package/dist/HeatMap/index.js +0 -2
  49. package/dist/LineChart/LineChart.d.ts +0 -3
  50. package/dist/LineChart/LineChart.js +0 -491
  51. package/dist/LineChart/LineChart.lib.d.ts +0 -24
  52. package/dist/LineChart/LineChart.lib.js +0 -132
  53. package/dist/LineChart/LineChart.styled.d.ts +0 -57
  54. package/dist/LineChart/LineChart.styled.js +0 -150
  55. package/dist/LineChart/LineChart.types.d.ts +0 -192
  56. package/dist/LineChart/LineChart.types.js +0 -1
  57. package/dist/LineChart/index.d.ts +0 -3
  58. package/dist/LineChart/index.js +0 -2
  59. package/dist/PieChart/PieChart.d.ts +0 -2
  60. package/dist/PieChart/PieChart.js +0 -161
  61. package/dist/PieChart/PieChart.lib.d.ts +0 -5
  62. package/dist/PieChart/PieChart.lib.js +0 -19
  63. package/dist/PieChart/PieChart.styled.d.ts +0 -49
  64. package/dist/PieChart/PieChart.styled.js +0 -161
  65. package/dist/PieChart/PieChart.types.d.ts +0 -99
  66. package/dist/PieChart/PieChart.types.js +0 -1
  67. package/dist/PieChart/index.d.ts +0 -2
  68. package/dist/PieChart/index.js +0 -1
  69. package/dist/SuperDatePicker/SuperDatePicker.d.ts +0 -74
  70. package/dist/SuperDatePicker/SuperDatePicker.js +0 -557
  71. package/dist/SuperDatePicker/index.d.ts +0 -2
  72. package/dist/SuperDatePicker/index.js +0 -2
@@ -5,7 +5,7 @@ export const MainContainer = styled.div `
5
5
  gap: 8px;
6
6
  `;
7
7
  export const CalendarContainer = styled.div `
8
- width: 264px;
8
+ width: 268px;
9
9
  border-radius: 4px;
10
10
  overflow: hidden;
11
11
  box-sizing: border-box;
@@ -48,8 +48,8 @@ export const CalendarNavButton = styled.button `
48
48
  `;
49
49
  export const CalendarGrid = styled.div `
50
50
  display: grid;
51
- grid-template: repeat(7, auto) / repeat(7, auto);
52
- gap: 3px;
51
+ grid-template: repeat(7, auto) / repeat(7, 1fr);
52
+ justify-items: center;
53
53
  `;
54
54
  export const CalendarMonth = styled.div `
55
55
  font-weight: 500;
@@ -74,7 +74,9 @@ export const CalendarCell = styled.div `
74
74
  align-self: center;
75
75
  letter-spacing: 0.1rem;
76
76
  min-width: 32px;
77
+ width: 32px;
77
78
  min-height: 32px;
79
+ height: 32px;
78
80
  padding: 6px 4px;
79
81
  user-select: none;
80
82
  border-radius: 5px;
@@ -126,7 +128,8 @@ export const HighlightedCalendarDate = styled(CalendarDate) `
126
128
  font-weight: 700;
127
129
  opacity: 1;
128
130
  position: relative;
129
- box-shadow: inset 0 0 0 1px ${(props) => props.theme.palette.primary.main},
131
+ box-shadow:
132
+ inset 0 0 0 1px ${(props) => props.theme.palette.primary.main},
130
133
  0 4px 10px ${(props) => `${props.theme.palette.primary.main}33`};
131
134
  ::before {
132
135
  content: "";
@@ -1,7 +1,7 @@
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, variant, arrow, size, searchable, grouped, onAddNew, loading, onScroll, onScrollToTop, onScrollToBottom, onSearch, manualSearch, multiselect, renderOption, 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, dynamicOptionHeight, 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
7
  const [selected, setSelected] = useState(defaultValue || []);
@@ -25,5 +25,5 @@ export const DropDownMenu = ({ data, children, defaultValue, variant, arrow, siz
25
25
  const handleScrollToBottom = (e) => {
26
26
  onScrollToBottom === null || onScrollToBottom === void 0 ? void 0 : onScrollToBottom(e);
27
27
  };
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 }))] }) }));
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, dynamicOptionHeight: dynamicOptionHeight, selected: selected, TooltipContent: TooltipContent, multiselect: multiselect, size: size, handleAddItem: handleAddItem, handleRemoveItem: handleRemoveItem, onItemSelect: onItemSelect, renderOption: renderOption, onScroll: onScroll, onScrollToTop: onScrollToTop, onScrollToBottom: handleScrollToBottom, query: query }))] }) }));
29
29
  };
@@ -19,6 +19,7 @@ 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;
22
23
  }, "ref"> & import("react").RefAttributes<unknown>, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<MenuProps & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
23
24
  ref?: RefObject<HTMLButtonElement>;
24
25
  children?: import("react").ReactNode | string;
@@ -38,4 +39,5 @@ export declare const MenuItem: import("styled-components/dist/types").IStyledCom
38
39
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
39
40
  } & {
40
41
  multiselect?: boolean;
42
+ $dynamicHeight?: boolean;
41
43
  }, "ref"> & import("react").RefAttributes<unknown>>, keyof import("react").Component<any, {}, any>>;
@@ -49,16 +49,18 @@ export const MenuItem = styled(forwardRef((_a, forwardedRef) => {
49
49
  min-height: ${({ size = "sm" }) => `${getControlSizeTokens(size).menuRowHeight}px`};
50
50
  width: 100%;
51
51
  min-width: 100%;
52
- height: ${({ size = "sm" }) => `${getControlSizeTokens(size).menuRowHeight}px`};
52
+ height: ${({ size = "sm", $dynamicHeight }) => $dynamicHeight ? "auto" : `${getControlSizeTokens(size).menuRowHeight}px`};
53
+ box-sizing: border-box;
53
54
  position: relative;
54
55
  user-select: none;
55
56
  outline: none;
56
57
 
57
58
  border: none;
59
+ text-align: left;
58
60
 
59
- white-space: nowrap;
60
- overflow: hidden;
61
- text-overflow: ellipsis;
61
+ white-space: ${({ $dynamicHeight }) => $dynamicHeight ? "normal" : "nowrap"};
62
+ overflow: ${({ $dynamicHeight }) => $dynamicHeight ? "visible" : "hidden"};
63
+ text-overflow: ${({ $dynamicHeight }) => $dynamicHeight ? "clip" : "ellipsis"};
62
64
 
63
65
  cursor: pointer;
64
66
  text-decoration: none;
@@ -66,7 +68,7 @@ export const MenuItem = styled(forwardRef((_a, forwardedRef) => {
66
68
  font-weight: normal;
67
69
  letter-spacing: normal;
68
70
 
69
- padding: ${({ size = "sm" }) => `0px ${getControlSizeTokens(size).menuItemPaddingX}px`};
71
+ padding: ${({ size = "sm", $dynamicHeight }) => `${$dynamicHeight ? 6 : 0}px ${getControlSizeTokens(size).menuItemPaddingX}px`};
70
72
 
71
73
  &[data-disabled="true"] {
72
74
  opacity: 0.5;
@@ -84,10 +86,15 @@ export const MenuItem = styled(forwardRef((_a, forwardedRef) => {
84
86
  }
85
87
 
86
88
  .button-label {
87
- display: inline-block;
88
- overflow: hidden;
89
- white-space: nowrap;
90
- text-overflow: ellipsis;
89
+ display: ${({ $dynamicHeight }) => $dynamicHeight ? "flex" : "inline-block"};
90
+ align-items: center;
91
+ justify-content: flex-start;
92
+ min-width: 0;
93
+ width: 100%;
94
+ text-align: left;
95
+ overflow: ${({ $dynamicHeight }) => $dynamicHeight ? "visible" : "hidden"};
96
+ white-space: ${({ $dynamicHeight }) => $dynamicHeight ? "normal" : "nowrap"};
97
+ text-overflow: ${({ $dynamicHeight }) => $dynamicHeight ? "clip" : "ellipsis"};
91
98
  }
92
99
  }
93
100
  `;
@@ -7,6 +7,7 @@ export declare const MenuItemList: React.FC<{
7
7
  searchValue?: string;
8
8
  onSearch?: (value: string) => void;
9
9
  manualSearch?: boolean;
10
+ dynamicOptionHeight?: boolean;
10
11
  selected?: DropDownItem[];
11
12
  TooltipContent?: ComponentType<any>;
12
13
  multiselect?: boolean;
@@ -10,9 +10,9 @@ 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 { useLayoutEffect, useRef, useState } from "react";
13
+ import { useCallback, useLayoutEffect, useRef, useState, } from "react";
14
14
  import styled from "styled-components";
15
- import { FixedSizeList } from "react-window";
15
+ import { FixedSizeList, VariableSizeList } from "react-window";
16
16
  import { Plus } from "lucide-react";
17
17
  import CheckBox from "../../CheckBox";
18
18
  import { getControlSizeTokens } from "../../core";
@@ -77,17 +77,40 @@ const GroupHeader = styled.div `
77
77
  min-width: fit-content;
78
78
  }
79
79
  `;
80
- export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, selected, TooltipContent, multiselect, grouped, onAddNew, size, handleAddItem, handleRemoveItem, onItemSelect, renderOption, onScroll, onScrollToTop, onScrollToBottom, query, }) => {
80
+ const MeasuredRow = ({ children, index, setItemSize, style }) => {
81
+ const rowRef = useRef(null);
82
+ useLayoutEffect(() => {
83
+ const row = rowRef.current;
84
+ if (!row)
85
+ return;
86
+ const updateSize = () => {
87
+ const measuredHeight = Math.ceil(row.getBoundingClientRect().height);
88
+ if (measuredHeight > 0) {
89
+ setItemSize(index, measuredHeight);
90
+ }
91
+ };
92
+ updateSize();
93
+ if (typeof ResizeObserver === "undefined")
94
+ return;
95
+ const observer = new ResizeObserver(updateSize);
96
+ observer.observe(row);
97
+ return () => observer.disconnect();
98
+ }, [children, index, setItemSize]);
99
+ return (_jsx("div", { style: Object.assign(Object.assign({}, style), { overflow: "visible" }), children: _jsx("div", { ref: rowRef, children: children }) }));
100
+ };
101
+ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, dynamicOptionHeight, selected, TooltipContent, multiselect, grouped, onAddNew, size, handleAddItem, handleRemoveItem, onItemSelect, renderOption, onScroll, onScrollToTop, onScrollToBottom, query, }) => {
81
102
  var _a;
82
103
  const [searchValue, setSearchValue] = useState("");
83
104
  const _b = query !== null && query !== void 0 ? query : {}, { queryKey, queryFn, getNextPageParam, initialPageParam } = _b, rest = __rest(_b, ["queryKey", "queryFn", "getNextPageParam", "initialPageParam"]);
84
- const abortController = new AbortController();
85
105
  const targetElm = useRef(null);
86
106
  const listElm = useRef(null);
107
+ const variableListRef = useRef(null);
108
+ const itemSizeMap = useRef({});
87
109
  const [viewPortDimensions, setViewPortDimensions] = useState({
88
110
  width: 0,
89
111
  height: 0,
90
112
  });
113
+ const [, setMeasurementRevision] = useState(0);
91
114
  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));
92
115
  const infinteOptionsData = infiniteQueryResult;
93
116
  const infiniteSelectOptions = infinteOptionsData || [];
@@ -137,37 +160,25 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, se
137
160
  })();
138
161
  const isObjectArray = (_a = Object.keys((visibleItems === null || visibleItems === void 0 ? void 0 : visibleItems[0]) || {})) === null || _a === void 0 ? void 0 : _a.includes("label");
139
162
  const isLoading = isLoadingInfiniteQuery;
140
- const handleOnScroll = (event) => {
163
+ const handleOnScroll = useCallback((event) => {
141
164
  const scrollTolerance = 15;
142
165
  onScroll === null || onScroll === void 0 ? void 0 : onScroll(event);
143
166
  const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;
144
- // scroll to top
145
167
  if (scrollTop <= scrollTolerance) {
146
168
  onScrollToTop === null || onScrollToTop === void 0 ? void 0 : onScrollToTop(event);
147
169
  }
148
- // Scroll to bottom
149
170
  if (scrollHeight - scrollTop <= clientHeight + scrollTolerance) {
150
171
  onScrollToBottom === null || onScrollToBottom === void 0 ? void 0 : onScrollToBottom(event);
151
172
  debouncedFetchNextPage();
152
173
  }
153
- };
174
+ }, [debouncedFetchNextPage, onScroll, onScrollToBottom, onScrollToTop]);
154
175
  useLayoutEffect(() => {
155
- if (listElm.current) {
156
- listElm.current.addEventListener("scroll", (e) => handleOnScroll(e));
157
- }
158
- // Event cleanup
159
- return () => {
160
- abortController.abort();
161
- };
162
- }, [
163
- filteredItems,
164
- listElm.current,
165
- isLoading,
166
- onScroll,
167
- onScrollToTop,
168
- onScrollToBottom,
169
- handleOnScroll,
170
- ]);
176
+ const list = listElm.current;
177
+ if (!list)
178
+ return;
179
+ list.addEventListener("scroll", handleOnScroll);
180
+ return () => list.removeEventListener("scroll", handleOnScroll);
181
+ }, [dynamicOptionHeight, handleOnScroll, isLoading, renderOption]);
171
182
  useLayoutEffect(() => {
172
183
  var _a;
173
184
  if (targetElm.current) {
@@ -181,13 +192,69 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, se
181
192
  const overscanCount = 10;
182
193
  const sizeTokens = getControlSizeTokens(size || "sm");
183
194
  const itemHeight = sizeTokens.menuRowHeight;
195
+ const dynamicListEnabled = dynamicOptionHeight !== null && dynamicOptionHeight !== void 0 ? dynamicOptionHeight : Boolean(renderOption);
196
+ const estimatedDynamicItemHeight = itemHeight + 16;
184
197
  const itemCount = (displayItems === null || displayItems === void 0 ? void 0 : displayItems.length) || 0;
198
+ const displayItemsKey = displayItems
199
+ .map((item) => `${item.value}:${item.label}:${item._isGroupHeader ? "g" : "i"}`)
200
+ .join("|");
201
+ const getDynamicItemSize = (index) => {
202
+ var _a;
203
+ return itemSizeMap.current[index] ||
204
+ (((_a = displayItems[index]) === null || _a === void 0 ? void 0 : _a._isGroupHeader) ? itemHeight : estimatedDynamicItemHeight);
205
+ };
206
+ const estimatedHeight = dynamicListEnabled
207
+ ? displayItems.reduce((total, _, index) => total + getDynamicItemSize(index), 0)
208
+ : itemCount * itemHeight;
185
209
  const height = viewPortDimensions.height
186
210
  ? viewPortDimensions.height
187
- : itemCount * itemHeight < 200
188
- ? itemCount * itemHeight
211
+ : estimatedHeight < 200
212
+ ? estimatedHeight
189
213
  : 200;
190
214
  const width = viewPortDimensions.width || 188;
215
+ const setItemSize = useCallback((index, measuredSize) => {
216
+ var _a;
217
+ if (itemSizeMap.current[index] === measuredSize)
218
+ return;
219
+ itemSizeMap.current = Object.assign(Object.assign({}, itemSizeMap.current), { [index]: measuredSize });
220
+ (_a = variableListRef.current) === null || _a === void 0 ? void 0 : _a.resetAfterIndex(index);
221
+ setMeasurementRevision((revision) => revision + 1);
222
+ }, []);
223
+ useLayoutEffect(() => {
224
+ var _a;
225
+ itemSizeMap.current = {};
226
+ (_a = variableListRef.current) === null || _a === void 0 ? void 0 : _a.resetAfterIndex(0, true);
227
+ setMeasurementRevision((revision) => revision + 1);
228
+ }, [displayItemsKey, dynamicListEnabled]);
229
+ const renderDisplayItem = (item, index, style) => {
230
+ if (item._isGroupHeader) {
231
+ 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));
232
+ }
233
+ if (item._isAddNew) {
234
+ return (_jsx(MenuItem, { className: "MenuItem", size: size, leftSection: _jsx(Plus, { size: 14 }), onClick: (e) => {
235
+ e.preventDefault();
236
+ e.stopPropagation();
237
+ onAddNew === null || onAddNew === void 0 ? void 0 : onAddNew(item.value);
238
+ }, style: style, children: item.label }, "__add_new__"));
239
+ }
240
+ const isSelected = !!(selected === null || selected === void 0 ? void 0 : selected.find((s) => {
241
+ return isObjectArray ? (s === null || s === void 0 ? void 0 : s.value) === (item === null || item === void 0 ? void 0 : item.value) : s === item;
242
+ }));
243
+ if (item.items) {
244
+ 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 }));
245
+ }
246
+ 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) => {
247
+ var _a;
248
+ newValue ? handleAddItem(item) : handleRemoveItem(item);
249
+ (_a = item === null || item === void 0 ? void 0 : item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, item);
250
+ } }), (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) => {
251
+ e.preventDefault();
252
+ e.stopPropagation();
253
+ handleItemClick(item, isSelected);
254
+ }, style: style, "$dynamicHeight": dynamicListEnabled, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) ||
255
+ (item === null || item === void 0 ? void 0 : item.label) ||
256
+ (typeof item === "string" || typeof item === "number" ? item : null) }, index));
257
+ };
191
258
  return (_jsxs("div", { children: [searchable && (_jsx(SearchInput, { variant: "outlined", size: size, placeholder: "Search", defaultValue: searchValue, onChange: (e) => {
192
259
  if (!manualSearch) {
193
260
  handleSearch(e);
@@ -201,40 +268,15 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, se
201
268
  alignItems: "center",
202
269
  height: "100%",
203
270
  padding: "10px 0",
204
- }, children: [_jsx("div", { style: { fontSize: `${sizeTokens.supportingFontSize}px` }, 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 }) => {
271
+ }, 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, outerRef: listElm, children: ({ data, index, style }) => {
272
+ const item = data === null || data === void 0 ? void 0 : data[index];
273
+ if (!item)
274
+ return null;
275
+ return (_jsx(MeasuredRow, { index: index, setItemSize: setItemSize, style: style, children: renderDisplayItem(item, index) }));
276
+ } })) : (_jsx(FixedSizeList, { itemData: displayItems, overscanCount: overscanCount, height: height, width: width, itemCount: itemCount, itemSize: itemHeight, outerRef: listElm, children: ({ data, index, style }) => {
205
277
  const item = data === null || data === void 0 ? void 0 : data[index];
206
278
  if (!item)
207
279
  return null;
208
- if (item._isGroupHeader) {
209
- 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));
210
- }
211
- if (item._isAddNew) {
212
- return (_jsx(MenuItem, { className: "MenuItem", size: size, leftSection: _jsx(Plus, { size: 14 }), onClick: (e) => {
213
- e.preventDefault();
214
- e.stopPropagation();
215
- onAddNew === null || onAddNew === void 0 ? void 0 : onAddNew(item.value);
216
- }, style: style, children: item.label }, "__add_new__"));
217
- }
218
- const isSelected = !!(selected === null || selected === void 0 ? void 0 : selected.find((s) => {
219
- return isObjectArray ? (s === null || s === void 0 ? void 0 : s.value) === (item === null || item === void 0 ? void 0 : item.value) : s === item;
220
- }));
221
- if (item.items) {
222
- return (_jsx(DropDownMenu, { data: item.items, size: size, buttonProps: Object.assign({ style }, item), disabled: item.disabled, children: item.label }));
223
- }
224
- 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) => {
225
- var _a;
226
- newValue
227
- ? handleAddItem(item)
228
- : handleRemoveItem(item);
229
- (_a = item === null || item === void 0 ? void 0 : item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, item);
230
- } }), (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) => {
231
- e.preventDefault();
232
- e.stopPropagation();
233
- handleItemClick(item, isSelected);
234
- }, style: style, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) ||
235
- (item === null || item === void 0 ? void 0 : item.label) ||
236
- (typeof item === "string" || typeof item === "number"
237
- ? item
238
- : null) }, index));
239
- } }) }))] }));
280
+ return renderDisplayItem(item, index, style);
281
+ } })) }))] }));
240
282
  };
@@ -44,6 +44,7 @@ export type DropDownMenuProps = {
44
44
  searchable?: boolean;
45
45
  manualSearch?: boolean;
46
46
  grouped?: boolean;
47
+ dynamicOptionHeight?: boolean;
47
48
  onAddNew?: (value: string) => void;
48
49
  loading?: boolean;
49
50
  arrow?: boolean;
@@ -77,4 +78,5 @@ export type MenuProps = {
77
78
  TooltipContent?: ComponentType<any>;
78
79
  dropDownProps?: ComponentPropsWithoutRef<typeof StyledContent>;
79
80
  disabled?: boolean;
81
+ dynamicOptionHeight?: boolean;
80
82
  };
@@ -10,7 +10,7 @@ import { StyledInputContainer, StyledInnerItemContainer, EmptyComponent, GroupTi
10
10
  // Re-export for backward compatibility
11
11
  export { StyledInputContainer };
12
12
  export const SelectBox = ({ className, data = [], placeholder = "Select...", arrow = true, onChange, onSearch, searchFn, onScroll, loading, defaultValue, value, size = "sm", variant = "outlined", width = "100%", allowCustomValue = false, searchable = false, clearable = false, label, description, required = false, error, openOnFocus = true, renderOption, actionComponent, focused, grouped, OptionTooltip, // Custom tooltip component for search menu items
13
- DropDownProps = {}, debounceTime = 175, sort = false, disabled = false,
13
+ DropDownProps = {}, debounceTime = 175, sort = false, disabled = false, dynamicOptionHeight,
14
14
  // Enhanced focus control props
15
15
  triggerFocus = false, triggerOpen = false, onFocused, onOpened, }) => {
16
16
  var _a, _b, _c, _d, _e, _f;
@@ -276,7 +276,7 @@ triggerFocus = false, triggerOpen = false, onFocused, onOpened, }) => {
276
276
  // ============================================================================
277
277
  // Render Helper Functions
278
278
  // ============================================================================
279
- const renderOptionItem = (item, index) => (_jsx(Tooltip, { content: OptionTooltip ? _jsx(OptionTooltip, { data: item.data }) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(e, item), "data-selected": (_value === null || _value === void 0 ? void 0 : _value.value) === item.value, "data-disabled": item.disabled, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || _jsx(_Fragment, { children: item === null || item === void 0 ? void 0 : item.label }) }, index) }, index));
279
+ const renderOptionItem = (item, index) => (_jsx(Tooltip, { content: OptionTooltip ? _jsx(OptionTooltip, { data: item.data }) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(e, item), "data-selected": (_value === null || _value === void 0 ? void 0 : _value.value) === item.value, "data-disabled": item.disabled, "$dynamicHeight": dynamicOptionHeight !== null && dynamicOptionHeight !== void 0 ? dynamicOptionHeight : Boolean(renderOption), size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || _jsx(_Fragment, { children: item === null || item === void 0 ? void 0 : item.label }) }, index) }, index));
280
280
  const renderActionButton = () => {
281
281
  if (clearable && (_value || !!inputValue)) {
282
282
  return (_jsx(ClearButton, { size: size, className: "input-btn", onClick: handleClear, onMouseDown: (e) => {
@@ -16,6 +16,7 @@ export declare const GroupTitle: import("styled-components/dist/types").IStyledC
16
16
  export declare const ActionMenu: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
17
17
  export declare const StyledItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
18
18
  size: Size;
19
+ $dynamicHeight?: boolean;
19
20
  }>> & string;
20
21
  export declare const StyledContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
21
22
  export {};
@@ -99,10 +99,11 @@ export const ActionMenu = styled.div ``;
99
99
  export const StyledItem = styled.div `
100
100
  color: ${(props) => props.theme.palette.text.primary};
101
101
  border-radius: 3px;
102
+ box-sizing: border-box;
102
103
  display: flex;
103
104
  align-items: center;
104
105
  min-height: ${({ size }) => `${getControlSizeTokens(size).menuRowHeight}px`};
105
- height: ${({ size }) => `${getControlSizeTokens(size).menuRowHeight}px`};
106
+ height: ${({ size, $dynamicHeight }) => $dynamicHeight ? "auto" : `${getControlSizeTokens(size).menuRowHeight}px`};
106
107
  position: relative;
107
108
  user-select: none;
108
109
  outline: none;
@@ -113,7 +114,7 @@ export const StyledItem = styled.div `
113
114
 
114
115
  font-size: ${({ size }) => `${getControlSizeTokens(size).fontSize}px`};
115
116
 
116
- padding: ${({ size }) => `0px ${getControlSizeTokens(size).menuItemPaddingX}px`};
117
+ padding: ${({ size, $dynamicHeight }) => `${$dynamicHeight ? 6 : 0}px ${getControlSizeTokens(size).menuItemPaddingX}px`};
117
118
 
118
119
  &:hover {
119
120
  background-color: ${(props) => props.theme.palette.action.hover};
@@ -34,6 +34,7 @@ export type SelectBoxProps = {
34
34
  debounceTime?: number;
35
35
  sort?: boolean;
36
36
  disabled?: boolean;
37
+ dynamicOptionHeight?: boolean;
37
38
  renderOption?: (item: Option | string) => React.ReactNode;
38
39
  OptionTooltip?: (props: {
39
40
  data: any;
@@ -1,3 +1,3 @@
1
1
  import { TagBoxProps } from "./types";
2
- declare const TagBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<TagBoxProps, never>> & string & Omit<({ className, data, placeholder, arrow, defaultValue, value, grouped, searchFn, onChange, onScroll, onSearch, onItemAdded, size, variant, width, allowCustomValue, searchable, clearable, openOnFocus, label, description, required, error, loading, sort, disabled, renderOption, renderTag, OptionTooltip, DropDownProps, }: TagBoxProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
2
+ declare const TagBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<TagBoxProps, never>> & string & Omit<({ className, data, placeholder, arrow, defaultValue, value, grouped, searchFn, onChange, onScroll, onSearch, onItemAdded, size, variant, width, allowCustomValue, searchable, clearable, openOnFocus, label, description, required, error, loading, sort, disabled, dynamicOptionHeight, renderOption, renderTag, OptionTooltip, DropDownProps, }: TagBoxProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
3
3
  export default TagBox;
@@ -213,10 +213,11 @@ const StyledItem = styled.div `
213
213
  line-height: 1;
214
214
  color: ${(props) => props.theme.palette.text.primary};
215
215
  border-radius: 3px;
216
+ box-sizing: border-box;
216
217
  display: flex;
217
218
  align-items: center;
218
219
  min-height: ${({ size }) => `${getControlSizeTokens(size).menuRowHeight}px`};
219
- height: ${({ size }) => `${getControlSizeTokens(size).menuRowHeight}px`};
220
+ height: ${({ size, $dynamicHeight }) => $dynamicHeight ? "auto" : `${getControlSizeTokens(size).menuRowHeight}px`};
220
221
  position: relative;
221
222
  user-select: none;
222
223
  outline: none;
@@ -225,7 +226,7 @@ const StyledItem = styled.div `
225
226
 
226
227
  font-family: ${({ theme }) => theme.typography.fontFamily};
227
228
  font-size: ${({ size }) => `${getControlSizeTokens(size).fontSize}px`};
228
- padding: ${({ size }) => `0px ${getControlSizeTokens(size).menuItemPaddingX}px`};
229
+ padding: ${({ size, $dynamicHeight }) => `${$dynamicHeight ? 6 : 0}px ${getControlSizeTokens(size).menuItemPaddingX}px`};
229
230
 
230
231
  &:hover {
231
232
  background-color: ${(props) => props.theme.palette.action.hover};
@@ -283,7 +284,7 @@ const resolveValues = (value, data) => {
283
284
  }
284
285
  return resolvedValues;
285
286
  };
286
- const TagBox = styled(({ className, data = [], placeholder = "Select tags", arrow = true, defaultValue, value, grouped, searchFn, onChange, onScroll, onSearch, onItemAdded, size = "sm", variant = "outlined", width = "100%", allowCustomValue = false, searchable = false, clearable = false, openOnFocus = true, label, description, required = false, error, loading = false, sort = false, disabled = false, renderOption, renderTag, OptionTooltip, DropDownProps = {}, }) => {
287
+ const TagBox = styled(({ className, data = [], placeholder = "Select tags", arrow = true, defaultValue, value, grouped, searchFn, onChange, onScroll, onSearch, onItemAdded, size = "sm", variant = "outlined", width = "100%", allowCustomValue = false, searchable = false, clearable = false, openOnFocus = true, label, description, required = false, error, loading = false, sort = false, disabled = false, dynamicOptionHeight, renderOption, renderTag, OptionTooltip, DropDownProps = {}, }) => {
287
288
  var _a, _b, _c, _d, _e, _f, _g;
288
289
  const isObjectArray = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("label");
289
290
  const isControlled = value !== undefined;
@@ -617,17 +618,16 @@ const TagBox = styled(({ className, data = [], placeholder = "Select tags", arro
617
618
  e.preventDefault();
618
619
  e.stopPropagation();
619
620
  handleItemClick(item);
620
- }, "data-highlighted": (preSelected === null || preSelected === void 0 ? void 0 : preSelected.value) === item.value, "data-disabled": item.disabled, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || (_jsx(_Fragment, { children: typeof item === "string"
621
+ }, "data-highlighted": (preSelected === null || preSelected === void 0 ? void 0 : preSelected.value) === item.value, "data-disabled": item.disabled, "$dynamicHeight": dynamicOptionHeight !== null && dynamicOptionHeight !== void 0 ? dynamicOptionHeight : Boolean(renderOption), size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || (_jsx(_Fragment, { children: typeof item === "string"
621
622
  ? item
622
623
  : item === null || item === void 0 ? void 0 : item.label })) }, index) }, index));
623
624
  })] }, group.label)))
624
625
  : filteredItems.map((item, index) => {
625
626
  return (_jsx(Tooltip, { content: OptionTooltip ? (_jsx(OptionTooltip, { data: item.data })) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => {
626
- console.log("clicked");
627
627
  e.preventDefault();
628
628
  e.stopPropagation();
629
629
  handleItemClick(item);
630
- }, "data-highlighted": (preSelected === null || preSelected === void 0 ? void 0 : preSelected.value) === item.value, "data-disabled": item.disabled, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || _jsx(_Fragment, { children: item === null || item === void 0 ? void 0 : item.label }) }, index) }, index));
630
+ }, "data-highlighted": (preSelected === null || preSelected === void 0 ? void 0 : preSelected.value) === item.value, "data-disabled": item.disabled, "$dynamicHeight": dynamicOptionHeight !== null && dynamicOptionHeight !== void 0 ? dynamicOptionHeight : Boolean(renderOption), size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || _jsx(_Fragment, { children: item === null || item === void 0 ? void 0 : item.label }) }, index) }, index));
631
631
  }) }))] })) }) }))] }));
632
632
  }) `
633
633
  position: relative;
@@ -32,6 +32,7 @@ export interface TagBoxProps {
32
32
  debounceTime?: number;
33
33
  sort?: boolean;
34
34
  disabled?: boolean;
35
+ dynamicOptionHeight?: boolean;
35
36
  renderOption?: (item: Option | string) => React.ReactNode;
36
37
  renderTag?: (item: Option | string) => React.ReactNode;
37
38
  OptionTooltip?: (props: {
@@ -50,6 +50,11 @@ const TextArea = styled(TextareaAutosize) `
50
50
  border: 1px solid ${(props) => props.theme.palette.primary.main};
51
51
  }
52
52
 
53
+ &[disabled] {
54
+ cursor: not-allowed;
55
+ opacity: 0.5;
56
+ }
57
+
53
58
  ::placeholder {
54
59
  font-size: ${({ size }) => `${getControlSizeTokens(size).placeholderFontSize}px`};
55
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monolith-forensics/monolith-ui",
3
- "version": "1.8.1-dev.0",
3
+ "version": "1.8.1-dev.2",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Matt Danner (Monolith Forensics LLC)",
@@ -1,3 +0,0 @@
1
- import { BarChartProps } from "./BarChart.types";
2
- export declare const BarChart: <TData>({ data, series, width, height, orientation, seriesLayout, margin, barGap, groupBarGap, maxBarThickness, barRadius, colors, colorGradient, barOpacity, barBorderColor, barBorderWidth, barBorderOpacity, minValue, maxValue, valueTickCount, showGridLines, showAxisLines, showCategoryAxisLabels, showValueAxisLabels, showLegend, showLegendSwatches, showLegendLabels, showLegendValues, showLabels, emptyLabel, ariaLabel, animateOnRender, animationDuration, animationStagger, showTooltips, valueFormatter, categoryLabelFormatter, tickFormatter, labelFormatter, tooltipFormatter, onBarClick, onLegendItemClick, onSeriesLegendItemClick, className, ...props }: BarChartProps<TData>) => import("react/jsx-runtime").JSX.Element;
3
- export default BarChart;