@guardian/threads
Version:
35 lines (34 loc) • 1.39 kB
TypeScript
import React, { MouseEventHandler } from 'react';
import { Filter } from '../Filter';
import { ChipSpawnPosition } from './InputSupper';
import { ChipProps } from './Chip/abstract/Chip';
import { InputChip } from './Chip/abstract/InputChip';
interface InlineInputProps extends ChipProps {
isLastInput: boolean;
availableFilters: Filter[];
spawnChip: (index: number, chipPosition: ChipSpawnPosition, filter: Filter, negate: boolean) => void;
}
declare type InlineInputState = {
isFocused: boolean;
shouldRenderSuggestions: boolean;
suggestionIndex?: number;
filteredSuggestions?: Filter[];
isNegated?: boolean;
chipStartIndex?: number;
};
export declare const getInlineInputTestId: (index: number) => string;
export declare class InlineInput extends InputChip<InlineInputProps, InlineInputState> {
state: InlineInputState;
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
moveSuggestions: (step: 1 | -1) => void;
setSuggestionIndex: (i: number) => void;
onUpdate: (e: React.ChangeEvent<HTMLInputElement>) => void;
checkForFilters: (text: string, cursorPosition: number) => void;
wipeSuggestions: () => void;
createChip: (suggestionIndex: number) => void;
onClickInput: MouseEventHandler;
renderSuggestions(): JSX.Element | null;
dropFocus: () => void;
render(): JSX.Element;
}
export {};