Skip to content

Commit 6f68472

Browse files
committed
remove interface exports that were marked as deprecated before
1 parent 2e40d5b commit 6f68472

18 files changed

Lines changed: 78 additions & 196 deletions

File tree

src/components/AutoSuggestion/AutoSuggestion.tsx

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ export interface CodeAutocompleteFieldSuggestionBase {
3434
description?: string;
3535
}
3636

37-
/** @deprecated (v25) use CodeAutocompleteFieldSuggestionBase */
38-
export type ISuggestionBase = CodeAutocompleteFieldSuggestionBase;
39-
4037
/** Same as CodeAutocompleteFieldSuggestionBase, but with the query that was used to fetch this suggestion. */
4138
export interface CodeAutocompleteFieldSuggestionWithReplacementInfo extends CodeAutocompleteFieldSuggestionBase {
4239
// The query this result was filtered by
@@ -47,9 +44,6 @@ export interface CodeAutocompleteFieldSuggestionWithReplacementInfo extends Code
4744
length: number;
4845
}
4946

50-
/** @deprecated (v25) use CodeAutocompleteFieldSuggestionWithReplacementInfo */
51-
export type ISuggestionWithReplacementInfo = CodeAutocompleteFieldSuggestionWithReplacementInfo;
52-
5347
/** The suggestions for a specific substring of the given input string. */
5448
export interface CodeAutocompleteFieldReplacementResult {
5549
// The range of the input string that should be replaced
@@ -63,9 +57,6 @@ export interface CodeAutocompleteFieldReplacementResult {
6357
replacements: CodeAutocompleteFieldSuggestionBase[];
6458
}
6559

66-
/** @deprecated (v25) use CodeAutocompleteFieldReplacementResult */
67-
export type IReplacementResult = CodeAutocompleteFieldReplacementResult;
68-
6960
export interface CodeAutocompleteFieldPartialAutoCompleteResult {
7061
// Repeats the input string from the corresponding request
7162
inputString: string;
@@ -74,9 +65,6 @@ export interface CodeAutocompleteFieldPartialAutoCompleteResult {
7465
replacementResults: CodeAutocompleteFieldReplacementResult[];
7566
}
7667

77-
/** @deprecated (v25) use CodeAutocompleteFieldPartialAutoCompleteResult */
78-
export type IPartialAutoCompleteResult = CodeAutocompleteFieldPartialAutoCompleteResult;
79-
8068
/** Validation result */
8169
export interface CodeAutocompleteFieldValidationResult {
8270
// If the input value is valid or not
@@ -91,13 +79,7 @@ export interface CodeAutocompleteFieldValidationResult {
9179
};
9280
}
9381

94-
/** @deprecated (v25) use CodeAutocompleteFieldValidationResult */
95-
export type IValidationResult = CodeAutocompleteFieldValidationResult;
96-
97-
/**
98-
* @deprecated (v25) use `CodeAutocompleteFieldProps` instead.
99-
*/
100-
export interface AutoSuggestionProps {
82+
export interface CodeAutocompleteFieldProps {
10183
/** Additional class name.
10284
*/
10385
className?: string;
@@ -180,9 +162,12 @@ interface RequestMetaData {
180162
}
181163

182164
/**
183-
* @deprecated (support already removed) use `CodeAutocompleteField` as replacement.
165+
* Input component that allows partial, fine-grained auto-completion, i.e. of sub-strings of the input string.
166+
* This is comparable to a one line code editor.
167+
*
168+
* Example usage: input of a path string offering auto-completion for each single part of the path.
184169
*/
185-
const AutoSuggestion = ({
170+
export const CodeAutocompleteField = ({
186171
className,
187172
label,
188173
initialValue,
@@ -207,7 +192,7 @@ const AutoSuggestion = ({
207192
height,
208193
readOnly,
209194
outerDivAttributes,
210-
}: AutoSuggestionProps) => {
195+
}: CodeAutocompleteFieldProps) => {
211196
const value = React.useRef<string>(initialValue);
212197
const cursorPosition = React.useRef(0);
213198
const dropdownXYoffset = React.useRef<{ x: number; y: number }>({ x: 0, y: 0 });
@@ -684,7 +669,7 @@ const AutoSuggestion = ({
684669
<div
685670
id={id}
686671
ref={autoSuggestionDivRef}
687-
className={`${eccgui}-autosuggestion` + (className ? ` ${className}` : "")}
672+
className={`${eccgui}-codeautocompletefield ${eccgui}-autosuggestion` + (className ? ` ${className}` : "")}
688673
{...outerDivAttributes}
689674
>
690675
<div
@@ -766,4 +751,4 @@ const AutoSuggestion = ({
766751
);
767752
};
768753

769-
export default AutoSuggestion;
754+
export default CodeAutocompleteField;

src/components/AutoSuggestion/AutoSuggestionList.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ import {
1515
Spinner,
1616
Tooltip,
1717
} from "./../../";
18-
import { ISuggestionWithReplacementInfo } from "./AutoSuggestion";
18+
import { CodeAutocompleteFieldSuggestionWithReplacementInfo } from "./AutoSuggestion";
1919

2020
export interface AutoSuggestionListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
2121
// The options of the drop down
22-
options: Array<ISuggestionWithReplacementInfo>;
22+
options: Array<CodeAutocompleteFieldSuggestionWithReplacementInfo>;
2323
// Called when an item has been selected from the drop down
24-
onItemSelectionChange: (item: ISuggestionWithReplacementInfo) => any;
24+
onItemSelectionChange: (item: CodeAutocompleteFieldSuggestionWithReplacementInfo) => any;
2525
// If the drop down is visible
2626
isOpen: boolean;
2727
// If the drop down should show a loading state
2828
loading?: boolean;
2929
// The item from the drop down that is active
3030
currentlyFocusedIndex: number;
3131
// Callback indicating what item should currently being highlighted, i.e. is either active or is hovered over
32-
itemToHighlight: (item: ISuggestionWithReplacementInfo | undefined) => any;
32+
itemToHighlight: (item: CodeAutocompleteFieldSuggestionWithReplacementInfo | undefined) => any;
3333
/** horizontal and vertical offset values in relation to the cursor */
3434
offsetValues?: { x: number; y: number };
3535
}
@@ -86,7 +86,7 @@ export const AutoSuggestionList = ({
8686
offsetValues,
8787
...otherDivProps
8888
}: AutoSuggestionListProps) => {
89-
const [hoveredItem, setHoveredItem] = React.useState<ISuggestionWithReplacementInfo | undefined>(undefined);
89+
const [hoveredItem, setHoveredItem] = React.useState<CodeAutocompleteFieldSuggestionWithReplacementInfo | undefined>(undefined);
9090
// Refs of list items
9191
const [refs] = React.useState<React.RefObject<Element>[]>([]);
9292
const dropdownRef = React.useRef<HTMLDivElement>(null);

src/components/AutoSuggestion/ExtendedCodeEditor.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ export interface ExtendedCodeEditorProps {
6767
readOnly?: boolean;
6868
}
6969

70-
export type IEditorProps = ExtendedCodeEditorProps;
71-
7270
/** Supports single-line and multiline editing. */
7371
export const ExtendedCodeEditor = ({
7472
multiline = false,

src/components/AutoSuggestion/index.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/components/AutocompleteField/AutoCompleteField.stories.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/components/AutocompleteField/AutoCompleteField.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ type SearchFunction<T> = (value: string) => T[];
2323
type AsyncSearchFunction<T> = (value: string) => Promise<T[]>;
2424

2525
/**
26-
* @deprecated (v25) replaced by SuggestFieldProps
26+
* Parameters for the auto-complete field parameterized by T and U.
27+
* @param T is the input data structure/type of the items that can be selected.
28+
* @param UPDATE_VALUE The value type that will be pushed into the onChange callback.
2729
*/
28-
export interface AutoCompleteFieldProps<T, UPDATE_VALUE> {
30+
export interface SuggestFieldProps<T, UPDATE_VALUE> {
2931
/**
3032
* Additional class names.
3133
*/
@@ -158,12 +160,7 @@ export interface AutoCompleteFieldProps<T, UPDATE_VALUE> {
158160
loadMoreResults?: () => Promise<T[] | undefined>;
159161
}
160162

161-
/**
162-
* @deprecated (v25) replaced by SuggestFieldProps
163-
*/
164-
export type IAutoCompleteFieldProps<T, UPDATE_VALUE> = AutoCompleteFieldProps<T, UPDATE_VALUE>;
165-
166-
AutoCompleteField.defaultProps = {
163+
SuggestField.defaultProps = {
167164
autoFocus: false,
168165
disabled: false,
169166
onlyDropdownWithQuery: false, // FIXME: this should be `true` by default, otherwise similarity to `<Select />` is very close
@@ -173,9 +170,18 @@ AutoCompleteField.defaultProps = {
173170
};
174171

175172
/**
176-
* @deprecated (support already removed) use `SuggestField` as replacement.
173+
* A component with the appearance of an input field that allows to select and optionally create new items.
174+
* It shows suggestions for the entered text from which the user can select any option.
175+
* It has the following fixed behavior:
176+
*
177+
* - When not focused, a different representation of the item value can be shown, e.g. the label of the value.
178+
* - When changing an existing item the input text is set to the original value in order to be able to edit the original value.
179+
* - When for a specific input text, the only item returns is the currently set item itself, all items are shown below it, to make
180+
* clear that there are still other items to choose from.
181+
* - The suggestions are fetched with a short delay, so not too many unnecessary requests are fired.
182+
* - Items where itemRenderer returns a string have a default representation, i.e. highlighting of search words, active flag etc.
177183
*/
178-
function AutoCompleteField<T, UPDATE_VALUE>(props: AutoCompleteFieldProps<T, UPDATE_VALUE>) {
184+
export function SuggestField<T, UPDATE_VALUE>(props: SuggestFieldProps<T, UPDATE_VALUE>) {
179185
const {
180186
className,
181187
reset,
@@ -468,7 +474,7 @@ function AutoCompleteField<T, UPDATE_VALUE>(props: AutoCompleteFieldProps<T, UPD
468474

469475
return (
470476
<BlueprintSuggest<T>
471-
className={`${eccgui}-autocompletefield__input` + (className ? ` ${className}` : "")}
477+
className={`${eccgui}-suggestfield ${eccgui}-autocompletefield__input` + (className ? ` ${className}` : "")}
472478
disabled={disabled}
473479
// Need to display error messages in list
474480
items={requestError ? [requestError as unknown as T] : filtered}
@@ -505,4 +511,4 @@ function AutoCompleteField<T, UPDATE_VALUE>(props: AutoCompleteFieldProps<T, UPD
505511
);
506512
}
507513

508-
export default AutoCompleteField;
514+
export default SuggestField;

src/components/AutocompleteField/autoCompleteFieldUtils.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import MenuItem from "../Menu/MenuItem";
55
import OverflowText from "../Typography/OverflowText";
66

77
import { TestIconProps } from "./../Icon/TestIcon";
8-
import { IRenderModifiers } from "./interfaces";
8+
import { SuggestFieldItemRendererModifierProps } from "./interfaces";
99

1010
/**
1111
* Returns a function to be used in an AutoComplete widget for rendering custom elements based on the query string.
@@ -18,7 +18,7 @@ export const createNewItemRendererFactory = (
1818
iconName?: ValidIconName | React.ReactElement<TestIconProps>
1919
) => {
2020
// Return custom render function
21-
return (query: string, modifiers: IRenderModifiers, handleClick: React.MouseEventHandler<HTMLElement>) => {
21+
return (query: string, modifiers: SuggestFieldItemRendererModifierProps, handleClick: React.MouseEventHandler<HTMLElement>) => {
2222
let textElement = itemTextRenderer(query);
2323
if (typeof textElement === "string") {
2424
textElement = (

src/components/AutocompleteField/index.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/components/AutocompleteField/interfaces.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ export interface SuggestFieldItemRendererModifierProps {
66
highlightingEnabled: boolean;
77
}
88

9-
/** @deprecated (v25) use `SuggestFieldItemRendererModifierProps` */
10-
export type IRenderModifiers = SuggestFieldItemRendererModifierProps;
11-
12-
/** @deprecated (v25) use `SuggestFieldItemRendererModifierProps["styleWidth"]` */
13-
export interface IElementWidth {
9+
interface IElementWidth {
1410
minWidth: string;
1511
maxWidth: string;
1612
}

src/components/CodeAutocompleteField/CodeAutocompleteField.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)