@monolith-forensics/monolith-ui 1.3.96 → 1.3.103
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.
- package/dist/Alert/Alert.d.ts +8 -0
- package/dist/Alert/Alert.js +52 -0
- package/dist/Alert/index.d.ts +1 -0
- package/dist/Alert/index.js +1 -0
- package/dist/Button/Button.d.ts +1 -0
- package/dist/Button/Button.js +4 -4
- package/dist/Calendar/Calendar.js +77 -76
- package/dist/DateInput/DateInput.d.ts +3 -4
- package/dist/DateInput/DateInput.js +39 -73
- package/dist/DropDownMenu/DropDownMenu.d.ts +1 -2
- package/dist/DropDownMenu/DropDownMenu.js +7 -13
- package/dist/DropDownMenu/components/MenuComponent.js +2 -2
- package/dist/DropDownMenu/components/MenuItem.js +1 -1
- package/dist/DropDownMenu/components/MenuItemList.d.ts +6 -2
- package/dist/DropDownMenu/components/MenuItemList.js +99 -30
- package/dist/DropDownMenu/index.d.ts +1 -1
- package/dist/DropDownMenu/index.js +1 -1
- package/dist/DropDownMenu/types.d.ts +23 -8
- package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +35 -0
- package/dist/QueryFilter/QueryFilter.js +52 -43
- package/dist/QueryFilter/index.d.ts +0 -1
- package/dist/QueryFilter/index.js +0 -1
- package/dist/QueryFilter/types.d.ts +3 -5
- package/dist/RichTextEditor/Components/BubbleMenu.js +1 -1
- package/dist/RichTextEditor/Components/ColorPicker.js +4 -2
- package/dist/RichTextEditor/Toolbar/Toolbar.js +1 -1
- package/dist/SelectBox/SelectBox.js +31 -2
- package/dist/SelectBox/select-box.styled-components.js +6 -1
- package/dist/SelectBox/types.d.ts +4 -0
- package/dist/Switch/Switch.d.ts +3 -4
- package/dist/Switch/Switch.js +1 -2
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/Table/TableComponents.js +16 -0
- package/dist/Table/TableMenu/TableMenu.js +18 -4
- package/dist/Table/TableProvider.js +214 -139
- package/dist/Table/TableRow.js +3 -2
- package/dist/Table/types.d.ts +40 -6
- package/dist/TextAreaInput/TextAreaInput.d.ts +11 -9
- package/dist/TextAreaInput/TextAreaInput.js +106 -107
- package/dist/index.d.ts +3 -5
- package/dist/index.js +3 -3
- package/dist/theme/variants.js +66 -1
- package/package.json +3 -3
- package/dist/QueryFilter/useFilterHelper.d.ts +0 -20
- package/dist/QueryFilter/useFilterHelper.js +0 -61
- package/dist/SelectableTextArea/SelectableTextArea.d.ts +0 -28
- package/dist/SelectableTextArea/SelectableTextArea.js +0 -180
- package/dist/SelectableTextArea/index.d.ts +0 -2
- package/dist/SelectableTextArea/index.js +0 -1
|
@@ -11,137 +11,136 @@ 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 styled from "styled-components";
|
|
14
|
+
import { forwardRef, useState, useRef, useEffect } from "react";
|
|
14
15
|
import { TextArea, FieldLabel, DropDownMenu, SelectBox, } from "..";
|
|
15
|
-
import { forwardRef, useRef, useState } from "react";
|
|
16
16
|
import { MoreHorizontal } from "lucide-react";
|
|
17
|
-
const
|
|
17
|
+
const DEFAULT_ACTIONS = [
|
|
18
|
+
{ value: "clear", label: "Clear Text" },
|
|
19
|
+
{ value: "insert", label: "Insert Item" },
|
|
20
|
+
];
|
|
21
|
+
const TextAreaWrapper = styled.div `
|
|
18
22
|
position: relative;
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: flex-start;
|
|
21
|
-
width: 100%;
|
|
22
|
-
z-index: 1; /* Lower than SelectBoxWrapper */
|
|
23
23
|
`;
|
|
24
|
-
const
|
|
24
|
+
const InsertMenuOverlay = styled.div `
|
|
25
25
|
position: absolute;
|
|
26
|
-
|
|
27
|
-
top: 0; /* Position at the top of the textarea */
|
|
26
|
+
top: 0;
|
|
28
27
|
left: 0;
|
|
29
|
-
|
|
28
|
+
right: 0;
|
|
29
|
+
z-index: 10;
|
|
30
|
+
opacity: ${({ $visible }) => ($visible ? 1 : 0)};
|
|
31
|
+
pointer-events: ${({ $visible }) => ($visible ? "auto" : "none")};
|
|
32
|
+
transform: ${({ $visible }) => $visible ? "translateY(0)" : "translateY(-4px)"};
|
|
33
|
+
transition:
|
|
34
|
+
opacity 0.2s ease,
|
|
35
|
+
transform 0.2s ease;
|
|
30
36
|
`;
|
|
31
|
-
const
|
|
32
|
-
/* Completely hide the SelectBox and disable all interactions */
|
|
33
|
-
position: relative;
|
|
37
|
+
const StyledInsertSelectBox = styled(SelectBox) `
|
|
34
38
|
width: 100%;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
opacity: 0;
|
|
43
|
-
pointer-events: none;
|
|
44
|
-
height: 0;
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* Only allow dropdown portal to be visible and interactive when opened programmatically */
|
|
49
|
-
[data-floating-ui-portal] {
|
|
50
|
-
opacity: 1 !important;
|
|
51
|
-
pointer-events: auto !important;
|
|
52
|
-
z-index: 1000 !important;
|
|
53
|
-
|
|
54
|
-
* {
|
|
55
|
-
opacity: 1 !important;
|
|
56
|
-
pointer-events: auto !important;
|
|
57
|
-
height: auto !important;
|
|
58
|
-
overflow: visible !important;
|
|
59
|
-
}
|
|
39
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
40
|
+
border: 1px solid ${({ theme }) => theme.palette.primary.main};
|
|
41
|
+
`;
|
|
42
|
+
const StyledMoreHorizontal = styled(MoreHorizontal) `
|
|
43
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
44
|
+
&:hover {
|
|
45
|
+
color: ${({ theme }) => theme.palette.text.primary};
|
|
60
46
|
}
|
|
61
47
|
`;
|
|
62
|
-
const TextAreaInput = forwardRef((
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
48
|
+
const TextAreaInput = forwardRef((props, ref) => {
|
|
49
|
+
const {
|
|
50
|
+
// UI
|
|
51
|
+
label, error, required, colSpan = 1, size = "sm", description, maxRows = 6, minRows = 3, onHeightChange, cacheMeasurements,
|
|
52
|
+
// Action menu
|
|
53
|
+
showActionMenu = false, actionMenuOptions = DEFAULT_ACTIONS, onActionMenuSelect,
|
|
54
|
+
// Insertable items
|
|
55
|
+
insertableItems, onInsertItem } = props,
|
|
56
|
+
// Rest of props for TextArea
|
|
57
|
+
rest = __rest(props, ["label", "error", "required", "colSpan", "size", "description", "maxRows", "minRows", "onHeightChange", "cacheMeasurements", "showActionMenu", "actionMenuOptions", "onActionMenuSelect", "insertableItems", "onInsertItem"]);
|
|
58
|
+
// State for insert menu visibility
|
|
59
|
+
const [showInsertMenu, setShowInsertMenu] = useState(false);
|
|
60
|
+
const [triggerSelectBoxOpen, setTriggerSelectBoxOpen] = useState(false);
|
|
61
|
+
const textareaRef = useRef(null);
|
|
62
|
+
const insertMenuRef = useRef(null);
|
|
63
|
+
// Merge refs
|
|
64
|
+
const mergedRef = (node) => {
|
|
65
|
+
textareaRef.current = node;
|
|
66
|
+
if (typeof ref === "function") {
|
|
67
|
+
ref(node);
|
|
77
68
|
}
|
|
78
|
-
else {
|
|
79
|
-
|
|
80
|
-
if (item.value === "recent") {
|
|
81
|
-
handleMenuClick();
|
|
82
|
-
}
|
|
69
|
+
else if (ref) {
|
|
70
|
+
ref.current = node;
|
|
83
71
|
}
|
|
84
72
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
selectInput.focus();
|
|
94
|
-
selectInput.click();
|
|
95
|
-
// Hide again immediately after triggering
|
|
96
|
-
setTimeout(() => {
|
|
97
|
-
selectInput.style.pointerEvents = "none";
|
|
98
|
-
selectInput.style.opacity = "0";
|
|
99
|
-
selectInput.style.height = "0";
|
|
100
|
-
}, 50);
|
|
73
|
+
// Handle click outside to close insert menu
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!showInsertMenu)
|
|
76
|
+
return;
|
|
77
|
+
const handleClickOutside = (event) => {
|
|
78
|
+
if (insertMenuRef.current &&
|
|
79
|
+
!insertMenuRef.current.contains(event.target)) {
|
|
80
|
+
setShowInsertMenu(false);
|
|
101
81
|
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
setTimeout(() => {
|
|
114
|
-
setSelectValue(null);
|
|
115
|
-
setSelectKey((prev) => prev + 1);
|
|
116
|
-
}, 100);
|
|
82
|
+
};
|
|
83
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
84
|
+
return () => {
|
|
85
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
86
|
+
};
|
|
87
|
+
}, [showInsertMenu]);
|
|
88
|
+
const handleActionSelect = (item) => {
|
|
89
|
+
if (item.value === "insert" && (insertableItems === null || insertableItems === void 0 ? void 0 : insertableItems.length)) {
|
|
90
|
+
setShowInsertMenu(true);
|
|
91
|
+
// Trigger SelectBox to open using the new enhanced props
|
|
92
|
+
setTriggerSelectBoxOpen(true);
|
|
117
93
|
}
|
|
118
94
|
else {
|
|
119
|
-
|
|
95
|
+
onActionMenuSelect === null || onActionMenuSelect === void 0 ? void 0 : onActionMenuSelect(item);
|
|
120
96
|
}
|
|
121
97
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
98
|
+
const handleSelectBoxOpened = () => {
|
|
99
|
+
// Reset the trigger after SelectBox has opened
|
|
100
|
+
setTriggerSelectBoxOpen(false);
|
|
101
|
+
};
|
|
102
|
+
const handleInsertSelect = (value, option) => {
|
|
103
|
+
console.log("Selected value:", value, "Selected option:", option); // Debug log
|
|
104
|
+
// SelectBox passes (value, option) - we want the full option object
|
|
105
|
+
const item = option;
|
|
106
|
+
if (!item || !item.value) {
|
|
107
|
+
console.warn("Invalid item selected:", item);
|
|
108
|
+
setShowInsertMenu(false);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (onInsertItem) {
|
|
112
|
+
onInsertItem(item);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
// Default behavior: insert at current cursor position
|
|
116
|
+
const textarea = textareaRef.current;
|
|
117
|
+
if (textarea) {
|
|
118
|
+
const start = textarea.selectionStart;
|
|
119
|
+
const end = textarea.selectionEnd;
|
|
120
|
+
const currentValue = textarea.value;
|
|
121
|
+
const newValue = currentValue.slice(0, start) + item.value + currentValue.slice(end);
|
|
122
|
+
textarea.value = newValue;
|
|
123
|
+
textarea.focus();
|
|
124
|
+
textarea.setSelectionRange(start + item.value.length, start + item.value.length);
|
|
125
|
+
// Trigger change event
|
|
126
|
+
const event = new Event("input", { bubbles: true });
|
|
127
|
+
textarea.dispatchEvent(event);
|
|
128
|
+
}
|
|
130
129
|
}
|
|
130
|
+
setShowInsertMenu(false);
|
|
131
131
|
};
|
|
132
|
-
return (_jsxs("div", { style: {
|
|
133
|
-
|
|
134
|
-
height: "fit-content",
|
|
135
|
-
}, children: [label && (_jsx(FieldLabel, { asterisk: required, error: error, description: description, size: size, actionComponent: showActionMenu ? (_jsx(DropDownMenu, { data: actionMenuOptions, variant: "text", size: "xs", arrow: false, onItemSelect: handleActionMenuSelect, buttonProps: {
|
|
132
|
+
return (_jsxs("div", { style: { gridColumn: `span ${colSpan}`, height: "fit-content" }, children: [label && (_jsx(FieldLabel, { asterisk: required, error: error, description: description, size: size, actionComponent: showActionMenu ? (_jsx(DropDownMenu, { data: actionMenuOptions, variant: "text", size: "xs", arrow: false, onItemSelect: handleActionSelect, buttonProps: {
|
|
133
|
+
"aria-label": "Open actions",
|
|
136
134
|
style: {
|
|
137
135
|
minWidth: "auto",
|
|
138
136
|
border: "none",
|
|
139
137
|
background: "transparent",
|
|
140
|
-
padding:
|
|
141
|
-
margin:
|
|
142
|
-
height:
|
|
143
|
-
width:
|
|
138
|
+
padding: 0,
|
|
139
|
+
margin: 0,
|
|
140
|
+
height: 16,
|
|
141
|
+
width: 16,
|
|
144
142
|
},
|
|
145
|
-
}, children: _jsx(
|
|
143
|
+
}, children: _jsx(StyledMoreHorizontal, { size: 16 }) })) : null, children: label })), _jsxs(TextAreaWrapper, { children: [_jsx(TextArea, Object.assign({ ref: mergedRef, size: size, maxRows: maxRows, minRows: minRows, onHeightChange: onHeightChange, cacheMeasurements: cacheMeasurements }, rest)), (insertableItems === null || insertableItems === void 0 ? void 0 : insertableItems.length) && (_jsx(InsertMenuOverlay, { ref: insertMenuRef, "$visible": showInsertMenu, children: _jsx(StyledInsertSelectBox, { data: insertableItems, placeholder: "Select item to insert...", searchable: true, clearable: false, arrow: false, focused: showInsertMenu, openOnFocus: true, triggerOpen: triggerSelectBoxOpen, onOpened: handleSelectBoxOpened, onChange: handleInsertSelect, size: size }) }))] })] }));
|
|
146
144
|
});
|
|
145
|
+
TextAreaInput.displayName = "TextAreaInput";
|
|
147
146
|
export default TextAreaInput;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,14 +8,13 @@ export * from "./Grid";
|
|
|
8
8
|
export * from "./TextInput";
|
|
9
9
|
export * from "./SelectBox";
|
|
10
10
|
export * from "./Button";
|
|
11
|
+
export * from "./DropDownMenu";
|
|
12
|
+
export * from "./Switch";
|
|
13
|
+
export * from "./Alert";
|
|
11
14
|
export { default as IconButton } from "./IconButton";
|
|
12
|
-
export { default as DropDownMenu } from "./DropDownMenu";
|
|
13
|
-
export type { DropDownItem } from "./DropDownMenu";
|
|
14
15
|
export { default as DateInput } from "./DateInput";
|
|
15
16
|
export { default as TextArea } from "./TextArea";
|
|
16
17
|
export { default as TextAreaInput } from "./TextAreaInput";
|
|
17
|
-
export { default as SelectableTextArea } from "./SelectableTextArea";
|
|
18
|
-
export type { SelectableTextAreaProps } from "./SelectableTextArea";
|
|
19
18
|
export { default as TagBox } from "./TagBox";
|
|
20
19
|
export type { TagBoxProps, TagboxOption } from "./TagBox";
|
|
21
20
|
export { default as FieldLabel } from "./FieldLabel";
|
|
@@ -23,7 +22,6 @@ export { default as Modal } from "./Modal";
|
|
|
23
22
|
export { default as Flyout } from "./Flyout";
|
|
24
23
|
export { FlyoutHeader, FlyoutTitle } from "./Flyout";
|
|
25
24
|
export { default as FileInputField } from "./FileInputField";
|
|
26
|
-
export { default as Switch } from "./Switch";
|
|
27
25
|
export { default as CheckBox } from "./CheckBox";
|
|
28
26
|
export { default as Input } from "./Input";
|
|
29
27
|
export { default as Tooltip } from "./Tooltip";
|
package/dist/index.js
CHANGED
|
@@ -3,19 +3,19 @@ export * from "./Grid";
|
|
|
3
3
|
export * from "./TextInput";
|
|
4
4
|
export * from "./SelectBox";
|
|
5
5
|
export * from "./Button";
|
|
6
|
+
export * from "./DropDownMenu";
|
|
7
|
+
export * from "./Switch";
|
|
8
|
+
export * from "./Alert";
|
|
6
9
|
export { default as IconButton } from "./IconButton";
|
|
7
|
-
export { default as DropDownMenu } from "./DropDownMenu";
|
|
8
10
|
export { default as DateInput } from "./DateInput";
|
|
9
11
|
export { default as TextArea } from "./TextArea";
|
|
10
12
|
export { default as TextAreaInput } from "./TextAreaInput";
|
|
11
|
-
export { default as SelectableTextArea } from "./SelectableTextArea";
|
|
12
13
|
export { default as TagBox } from "./TagBox";
|
|
13
14
|
export { default as FieldLabel } from "./FieldLabel";
|
|
14
15
|
export { default as Modal } from "./Modal";
|
|
15
16
|
export { default as Flyout } from "./Flyout";
|
|
16
17
|
export { FlyoutHeader, FlyoutTitle } from "./Flyout";
|
|
17
18
|
export { default as FileInputField } from "./FileInputField";
|
|
18
|
-
export { default as Switch } from "./Switch";
|
|
19
19
|
export { default as CheckBox } from "./CheckBox";
|
|
20
20
|
export { default as Input } from "./Input";
|
|
21
21
|
export { default as Tooltip } from "./Tooltip";
|
package/dist/theme/variants.js
CHANGED
|
@@ -173,8 +173,43 @@ const lightVariant = {
|
|
|
173
173
|
default: "transparent",
|
|
174
174
|
primary: customBlue[500],
|
|
175
175
|
secondary: "#a1a1a1",
|
|
176
|
+
alternate: "#f0f0f0",
|
|
176
177
|
error: "#f44336",
|
|
177
178
|
},
|
|
179
|
+
text: {
|
|
180
|
+
default: "#000",
|
|
181
|
+
primary: customBlue[500],
|
|
182
|
+
error: "#f44336",
|
|
183
|
+
secondary: "#a1a1a1",
|
|
184
|
+
alternate: "#000",
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
alert: {
|
|
188
|
+
info: {
|
|
189
|
+
background: "#3f88de25",
|
|
190
|
+
border: "#3f88de50",
|
|
191
|
+
color: "#357fff",
|
|
192
|
+
},
|
|
193
|
+
success: {
|
|
194
|
+
background: "#4bef2a25",
|
|
195
|
+
border: "#4bef2a90",
|
|
196
|
+
color: "#2eb333",
|
|
197
|
+
},
|
|
198
|
+
warning: {
|
|
199
|
+
background: "#eaa82425",
|
|
200
|
+
border: "#eaa82450",
|
|
201
|
+
color: "#d18f0b",
|
|
202
|
+
},
|
|
203
|
+
error: {
|
|
204
|
+
background: "#ee1d1d25",
|
|
205
|
+
border: "#ee1d1d50",
|
|
206
|
+
color: "#e41a1a",
|
|
207
|
+
},
|
|
208
|
+
default: {
|
|
209
|
+
background: "#fff",
|
|
210
|
+
border: "#cacaca",
|
|
211
|
+
color: "#000000",
|
|
212
|
+
},
|
|
178
213
|
},
|
|
179
214
|
};
|
|
180
215
|
const darkVariant = merge(lightVariant, {
|
|
@@ -282,11 +317,41 @@ const darkVariant = merge(lightVariant, {
|
|
|
282
317
|
default: "transparent",
|
|
283
318
|
primary: customBlue[500],
|
|
284
319
|
secondary: "#3f3f3f",
|
|
320
|
+
alternate: "#3f3f3f",
|
|
285
321
|
error: "#f44336",
|
|
286
322
|
},
|
|
287
323
|
text: {
|
|
288
|
-
primary:
|
|
324
|
+
primary: customBlue[500],
|
|
325
|
+
error: "#f44336",
|
|
289
326
|
secondary: "rgba(255, 255, 255, 0.6)",
|
|
327
|
+
alternate: "rgba(255, 255, 255, 0.6)",
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
alert: {
|
|
331
|
+
info: {
|
|
332
|
+
background: "#3f88de25",
|
|
333
|
+
border: "#3f88de50",
|
|
334
|
+
color: "#75a8ff",
|
|
335
|
+
},
|
|
336
|
+
success: {
|
|
337
|
+
background: "#4bef2a25",
|
|
338
|
+
border: "#4bef2a50",
|
|
339
|
+
color: "#5fd964",
|
|
340
|
+
},
|
|
341
|
+
warning: {
|
|
342
|
+
background: "#eaa82425",
|
|
343
|
+
border: "#eaa82450",
|
|
344
|
+
color: "#da9c21",
|
|
345
|
+
},
|
|
346
|
+
error: {
|
|
347
|
+
background: "#ee1d1d25",
|
|
348
|
+
border: "#ee1d1d50",
|
|
349
|
+
color: "#e41a1a",
|
|
350
|
+
},
|
|
351
|
+
default: {
|
|
352
|
+
background: "#222222",
|
|
353
|
+
border: "rgba(255, 255, 255, 0.15)",
|
|
354
|
+
color: "#ffffff99",
|
|
290
355
|
},
|
|
291
356
|
},
|
|
292
357
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monolith-forensics/monolith-ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.103",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Matt Danner (Monolith Forensics LLC)",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"moment": "^2.29.1",
|
|
57
57
|
"overlayscrollbars": "^2.6.0",
|
|
58
58
|
"overlayscrollbars-react": "^0.5.6",
|
|
59
|
-
"react-dom": "^18.3.1",
|
|
60
59
|
"react-dropzone": "^14.2.3",
|
|
61
60
|
"react-icons": "^5.2.1",
|
|
62
61
|
"react-pdf": "^9.1.1",
|
|
@@ -71,7 +70,8 @@
|
|
|
71
70
|
},
|
|
72
71
|
"peerDependencies": {
|
|
73
72
|
"@tanstack/react-query": "^5.59.16",
|
|
74
|
-
"react": "18.
|
|
73
|
+
"react": "^18.3.1",
|
|
74
|
+
"react-dom": "^18.3.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@tanstack/react-query": "5.59.16",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
-
import { FilterDefinition } from "./types";
|
|
3
|
-
import { DropDownItem } from "../DropDownMenu";
|
|
4
|
-
/** Override Filters Type
|
|
5
|
-
* some properties have been overridden to allow for partial overrides
|
|
6
|
-
*/
|
|
7
|
-
type FilterDefinitionOverride = Partial<Omit<FilterDefinition, "query" | "dataField">> & {
|
|
8
|
-
dataField: string;
|
|
9
|
-
query?: Omit<Partial<UseQueryOptions>, "select" | "queryKey"> & {
|
|
10
|
-
select?: (data: unknown) => DropDownItem[];
|
|
11
|
-
queryKey?: UseQueryOptions["queryKey"];
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export interface UseFilterHelperParams {
|
|
15
|
-
filterDef: FilterDefinition[];
|
|
16
|
-
overrides?: FilterDefinitionOverride[];
|
|
17
|
-
}
|
|
18
|
-
export type UseFilterHelperType = (p: UseFilterHelperParams) => FilterDefinition[];
|
|
19
|
-
export declare const useFilterHelper: UseFilterHelperType;
|
|
20
|
-
export {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { useQueries } from "@tanstack/react-query";
|
|
13
|
-
const mergeOverrides = (filterDef, overrides) => {
|
|
14
|
-
return filterDef.map((f) => {
|
|
15
|
-
var _a, _b, _c;
|
|
16
|
-
const override = overrides.find((o) => o.dataField === f.dataField);
|
|
17
|
-
if (!override) {
|
|
18
|
-
return f;
|
|
19
|
-
}
|
|
20
|
-
const { query, dropDownOptions } = override, rest = __rest(override, ["query", "dropDownOptions"]);
|
|
21
|
-
// Handle merge directly on query and dropDownOptions
|
|
22
|
-
// prevents overriding the entire query object
|
|
23
|
-
// allows user to override specific properties
|
|
24
|
-
if (query) {
|
|
25
|
-
f.query = Object.assign(Object.assign(Object.assign({}, f.query), query), { queryFn: query.queryFn || ((_a = f === null || f === void 0 ? void 0 : f.query) === null || _a === void 0 ? void 0 : _a.queryFn) || (() => { }), queryKey: query.queryKey || ((_b = f === null || f === void 0 ? void 0 : f.query) === null || _b === void 0 ? void 0 : _b.queryKey) || [], select: query.select || ((_c = f === null || f === void 0 ? void 0 : f.query) === null || _c === void 0 ? void 0 : _c.select) || (() => []) });
|
|
26
|
-
}
|
|
27
|
-
if (dropDownOptions) {
|
|
28
|
-
f.dropDownOptions = Object.assign(Object.assign({}, f.dropDownOptions), dropDownOptions);
|
|
29
|
-
}
|
|
30
|
-
// Merge override with original filter def
|
|
31
|
-
return Object.assign(Object.assign({}, f), rest);
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
export const useFilterHelper = ({ filterDef, overrides, }) => {
|
|
35
|
-
let _filterDef = filterDef;
|
|
36
|
-
if (!!overrides) {
|
|
37
|
-
_filterDef = mergeOverrides(filterDef, overrides);
|
|
38
|
-
}
|
|
39
|
-
// Keeps track of filters that have queries
|
|
40
|
-
const queryIndex = [];
|
|
41
|
-
// Get query options from filter defs
|
|
42
|
-
const queries = filterDef
|
|
43
|
-
.filter((f, i) => {
|
|
44
|
-
// Track array index of filter def that has a query
|
|
45
|
-
const hasQuery = f.query !== undefined;
|
|
46
|
-
hasQuery && queryIndex.push(i);
|
|
47
|
-
return hasQuery;
|
|
48
|
-
})
|
|
49
|
-
.map((filter) => filter.query);
|
|
50
|
-
// run queries from filter defs
|
|
51
|
-
const result = useQueries({
|
|
52
|
-
queries,
|
|
53
|
-
});
|
|
54
|
-
// Add useQueries result data to filter def as options
|
|
55
|
-
queryIndex.forEach((index, i) => {
|
|
56
|
-
var _a;
|
|
57
|
-
// User query index to add useQueries result data to filter def as options
|
|
58
|
-
filterDef[index].selectOptions = (_a = result[i]) === null || _a === void 0 ? void 0 : _a.data;
|
|
59
|
-
});
|
|
60
|
-
return filterDef;
|
|
61
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { DropDownItem } from "../DropDownMenu";
|
|
2
|
-
export interface SelectableTextAreaProps {
|
|
3
|
-
label?: string;
|
|
4
|
-
data?: Array<{
|
|
5
|
-
label: string;
|
|
6
|
-
value: string;
|
|
7
|
-
}>;
|
|
8
|
-
required?: boolean;
|
|
9
|
-
error?: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
value?: string;
|
|
12
|
-
onChange?: (value: string) => void;
|
|
13
|
-
selectProps?: Record<string, any>;
|
|
14
|
-
placeholder?: string;
|
|
15
|
-
textAreaProps?: Record<string, any>;
|
|
16
|
-
initialValue?: string;
|
|
17
|
-
showActionMenu?: boolean;
|
|
18
|
-
actionMenuData?: Array<{
|
|
19
|
-
label: string;
|
|
20
|
-
value: string;
|
|
21
|
-
}>;
|
|
22
|
-
onActionMenuSelect?: (item: DropDownItem) => void;
|
|
23
|
-
}
|
|
24
|
-
declare function SelectableTextArea({ label, data, required, error, description, selectProps, value, onChange, placeholder, textAreaProps, initialValue, showActionMenu, actionMenuData, onActionMenuSelect, }: SelectableTextAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
declare namespace SelectableTextArea {
|
|
26
|
-
var displayName: string;
|
|
27
|
-
}
|
|
28
|
-
export default SelectableTextArea;
|