Skip to content

Commit 2705c54

Browse files
andreas-schultzhaschek
authored andcommitted
Allow to set parameters of the outer div container of the CodeAutocompleteField
1 parent e4b6afe commit 2705c54

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
99
### Added
1010

1111
- Extended existing height and readOnly props from `CodeEditorProps` to `AutoSuggestionProps` & `ExtendedCodeEditorProps` to be configurable from `<CodeAutocompleteField />`
12+
- `<CodeAutocompleteField />:
13+
- outerDivAttributes parameter: Allows to set parameter of the container div element of the code complete field.
1214

1315
### Fixed
1416

src/components/AutoSuggestion/AutoSuggestion.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ export interface AutoSuggestionProps {
170170
height?: number | string;
171171
/** Set read-only mode. Default: false */
172172
readOnly?: boolean;
173+
/** Properties that should be added to the outer div container. */
174+
outerDivAttributes?: Omit<React.HTMLAttributes<HTMLDivElement>, "id" | "data-test-id">;
173175
}
174176

175177
// Meta data regarding a request
@@ -202,8 +204,9 @@ const AutoSuggestion = ({
202204
mode,
203205
multiline = false,
204206
reInitOnInitialValueChange = false,
205-
height,
206-
readOnly
207+
height,
208+
readOnly,
209+
outerDivAttributes
207210
}: AutoSuggestionProps) => {
208211
const value = React.useRef<string>(initialValue);
209212
const cursorPosition = React.useRef(0);
@@ -682,6 +685,7 @@ const AutoSuggestion = ({
682685
id={id}
683686
ref={autoSuggestionDivRef}
684687
className={`${eccgui}-autosuggestion` + (className ? ` ${className}` : "")}
688+
{...outerDivAttributes}
685689
>
686690
<div
687691
className={` ${eccgui}-autosuggestion__inputfield ${BlueprintClassNames.INPUT_GROUP} ${

0 commit comments

Comments
 (0)