@monolith-forensics/monolith-ui 1.3.94 → 1.3.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
- export interface SearchableTextAreaProps {
1
+ import type { DropDownItem } from "../DropDownMenu";
2
+ export interface SelectableTextAreaProps {
2
3
  label?: string;
3
4
  data?: Array<{
4
5
  label: string;
@@ -17,9 +18,14 @@ export interface SearchableTextAreaProps {
17
18
  textAreaMaxRows?: number;
18
19
  textAreaProps?: Record<string, any>;
19
20
  initialValue?: string;
21
+ actionMenuData?: Array<{
22
+ label: string;
23
+ value: string;
24
+ }>;
25
+ onActionMenuSelect?: (item: DropDownItem) => void;
20
26
  }
21
- declare function SearchableTextArea({ label, data, searchable, allowCustomValue, required, error, description, selectProps, value, onChange, textAreaPlaceholder, textAreaMinRows, textAreaMaxRows, textAreaProps, initialValue, }: SearchableTextAreaProps): import("react/jsx-runtime").JSX.Element;
22
- declare namespace SearchableTextArea {
27
+ declare function SelectableTextArea({ label, data, searchable, allowCustomValue, required, error, description, selectProps, value, onChange, textAreaPlaceholder, textAreaMinRows, textAreaMaxRows, textAreaProps, initialValue, actionMenuData, onActionMenuSelect, }: SelectableTextAreaProps): import("react/jsx-runtime").JSX.Element;
28
+ declare namespace SelectableTextArea {
23
29
  var displayName: string;
24
30
  }
25
- export default SearchableTextArea;
31
+ export default SelectableTextArea;
@@ -34,7 +34,7 @@ const StyledSelectBox = styled(SelectBox) `
34
34
  pointer-events: none; /* Disable all interactions */
35
35
  height: 0;
36
36
  overflow: hidden;
37
-
37
+
38
38
  /* Hide all child elements */
39
39
  * {
40
40
  opacity: 0;
@@ -42,13 +42,13 @@ const StyledSelectBox = styled(SelectBox) `
42
42
  height: 0;
43
43
  overflow: hidden;
44
44
  }
45
-
45
+
46
46
  /* Only allow dropdown portal to be visible and interactive when opened programmatically */
47
47
  [data-floating-ui-portal] {
48
48
  opacity: 1 !important;
49
49
  pointer-events: auto !important;
50
50
  z-index: 1000 !important;
51
-
51
+
52
52
  * {
53
53
  opacity: 1 !important;
54
54
  pointer-events: auto !important;
@@ -97,7 +97,7 @@ const StyledTextArea = styled.textarea `
97
97
  opacity: 0.5;
98
98
  }
99
99
  `;
100
- function SearchableTextArea({ label, data, searchable, allowCustomValue, required, error, description, selectProps = {}, value, onChange, textAreaPlaceholder, textAreaMinRows = 3, textAreaMaxRows, textAreaProps = {}, initialValue = "", }) {
100
+ function SelectableTextArea({ label, data, searchable, allowCustomValue, required, error, description, selectProps = {}, value, onChange, textAreaPlaceholder, textAreaMinRows = 3, textAreaMaxRows, textAreaProps = {}, initialValue = "", actionMenuData, onActionMenuSelect, }) {
101
101
  // Use controlled value if provided, otherwise use internal state
102
102
  const [internalValue, setInternalValue] = useState(initialValue);
103
103
  const [selectValue, setSelectValue] = useState(null);
@@ -133,8 +133,7 @@ function SearchableTextArea({ label, data, searchable, allowCustomValue, require
133
133
  onChange(newValue);
134
134
  }
135
135
  };
136
- // Removed keyboard shortcuts - textarea behaves normally
137
- const handleSearchClick = () => {
136
+ const handleMenuClick = () => {
138
137
  if (selectBoxRef.current) {
139
138
  const selectInput = selectBoxRef.current.querySelector("input");
140
139
  if (selectInput) {
@@ -155,17 +154,28 @@ function SearchableTextArea({ label, data, searchable, allowCustomValue, require
155
154
  };
156
155
  // Used to create red border when zod validation detects errors
157
156
  const hasError = Boolean(error);
158
- return (_jsxs(CombinedInputWrapper, { children: [label && (_jsx(StyledFieldLabel, { asterisk: required, error: error, description: description, actionComponent: _jsx(DropDownMenu, { data: [
159
- {
160
- value: "search",
161
- label: "Select Recent Entry",
162
- visible: true,
163
- },
164
- ], variant: "text", size: "xs", arrow: false, onItemSelect: (item) => {
165
- if (item.value === "search") {
166
- handleSearchClick();
167
- }
168
- }, buttonProps: {
157
+ // Create default menu data if none provided
158
+ const defaultMenuData = [
159
+ {
160
+ value: "recent",
161
+ label: "Select Recent Entry",
162
+ },
163
+ ];
164
+ // Use provided menu data or fall back to default
165
+ const menuData = actionMenuData || defaultMenuData;
166
+ // Handle menu item selection with custom callback or default behavior
167
+ const handleActionMenuSelect = (item) => {
168
+ if (onActionMenuSelect) {
169
+ onActionMenuSelect(item);
170
+ }
171
+ else {
172
+ // Default behavior: if item value is "recent", trigger handleMenuClick
173
+ if (item.value === "recent") {
174
+ handleMenuClick();
175
+ }
176
+ }
177
+ };
178
+ return (_jsxs(CombinedInputWrapper, { children: [label && (_jsx(StyledFieldLabel, { asterisk: required, error: error, description: description, actionComponent: _jsx(DropDownMenu, { data: menuData, variant: "text", size: "xs", arrow: false, onItemSelect: handleActionMenuSelect, buttonProps: {
169
179
  style: {
170
180
  minWidth: "auto",
171
181
  border: "none",
@@ -177,5 +187,5 @@ function SearchableTextArea({ label, data, searchable, allowCustomValue, require
177
187
  },
178
188
  }, children: _jsx(MoreHorizontal, { size: 16 }) }), children: label })), _jsxs(TextAreaRow, { children: [_jsx(StyledTextArea, Object.assign({ placeholder: textAreaPlaceholder || "Enter details about the move", "$minRows": textAreaMinRows, "$maxRows": textAreaMaxRows, "$hasError": hasError, value: textAreaValue, onChange: handleTextAreaChange }, textAreaProps)), _jsx(SelectBoxWrapper, { ref: selectBoxRef, children: _jsx(StyledSelectBox, Object.assign({ data: data, searchable: searchable, allowCustomValue: allowCustomValue, arrow: false, value: selectValue || undefined, onChange: handleSelectChange, hasError: hasError }, selectProps), selectKey) })] })] }));
179
189
  }
180
- SearchableTextArea.displayName = "SearchableTextArea";
181
- export default SearchableTextArea;
190
+ SelectableTextArea.displayName = "SelectableTextArea";
191
+ export default SelectableTextArea;
@@ -0,0 +1,2 @@
1
+ export { default } from "./SelectableTextArea";
2
+ export type { SelectableTextAreaProps } from "./SelectableTextArea";
@@ -0,0 +1 @@
1
+ export { default } from "./SelectableTextArea";
package/dist/index.d.ts CHANGED
@@ -14,8 +14,8 @@ export type { DropDownItem } from "./DropDownMenu";
14
14
  export { default as DateInput } from "./DateInput";
15
15
  export { default as TextArea } from "./TextArea";
16
16
  export { default as TextAreaInput } from "./TextAreaInput";
17
- export { default as SearchableTextArea } from "./SearchableTextArea";
18
- export type { SearchableTextAreaProps } from "./SearchableTextArea";
17
+ export { default as SelectableTextArea } from "./SelectableTextArea";
18
+ export type { SelectableTextAreaProps } from "./SelectableTextArea";
19
19
  export { default as TagBox } from "./TagBox";
20
20
  export type { TagBoxProps, TagboxOption } from "./TagBox";
21
21
  export { default as FieldLabel } from "./FieldLabel";
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ export { default as DropDownMenu } from "./DropDownMenu";
8
8
  export { default as DateInput } from "./DateInput";
9
9
  export { default as TextArea } from "./TextArea";
10
10
  export { default as TextAreaInput } from "./TextAreaInput";
11
- export { default as SearchableTextArea } from "./SearchableTextArea";
11
+ export { default as SelectableTextArea } from "./SelectableTextArea";
12
12
  export { default as TagBox } from "./TagBox";
13
13
  export { default as FieldLabel } from "./FieldLabel";
14
14
  export { default as Modal } from "./Modal";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monolith-forensics/monolith-ui",
3
- "version": "1.3.94",
3
+ "version": "1.3.95",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Matt Danner (Monolith Forensics LLC)",
@@ -1,2 +0,0 @@
1
- export { default } from "./SearchableTextArea";
2
- export type { SearchableTextAreaProps } from "./SearchableTextArea";
@@ -1 +0,0 @@
1
- export { default } from "./SearchableTextArea";