@kubit-ui-web/react-components
Version:
Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience
82 lines (81 loc) • 3.68 kB
TypeScript
import { ChangeEventHandler, ClipboardEventHandler, FocusEventHandler, ForwardedRef, KeyboardEventHandler, MutableRefObject } from 'react';
import { INTERNAL_ERROR_EXECUTION } from '../../input/types/input';
import { InputState } from '../../input/types/inputTheme';
import { InputTypeType } from '../../input/types/inputType';
import { IOptionGroup, SearchFilterConfig } from '../types/inputSearch';
import { InputSearchStylesProps } from '../types/inputSearchTheme';
interface MultipleRef {
refInput?: MutableRefObject<HTMLInputElement | undefined>;
refList: ForwardedRef<unknown> | (({ ref, index }: {
ref: any;
index: any;
}) => void);
refIcon: MutableRefObject<HTMLSpanElement | undefined>;
refActionBottomSheet: React.ForwardedRef<HTMLDivElement> | undefined | null;
}
type ParamsType = {
ref?: ForwardedRef<HTMLInputElement | undefined>;
open: boolean;
styles?: InputSearchStylesProps;
elementsToShow: number;
options: IOptionGroup[];
type: InputTypeType;
value?: string;
regex?: string | RegExp;
disabled?: boolean;
error?: boolean;
hasResultTextWrittenByUser?: boolean;
disableErrorInvalidOption?: boolean;
/**
* @deprecated
* @description This prop is deprecated and will be removed in the next major version.
*/
clearTextInputPopoverIconClick?: boolean;
highlightedOption?: string;
informationAssociated?: string;
maxLength?: number;
searchFilterConfig?: SearchFilterConfig;
caseSensitive?: boolean;
internalErrorExecution?: INTERNAL_ERROR_EXECUTION;
disabledCopyAndPaste?: boolean;
onClick?: (event: React.MouseEvent<HTMLInputElement, MouseEvent>) => void;
onIconClick?: React.MouseEventHandler<HTMLButtonElement>;
executeInternalOpenOptions?: boolean;
onInputPopoverIconClick?: () => void;
onInputPopoverEnterKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
onBlur?: FocusEventHandler<HTMLInputElement>;
onFocus?: FocusEventHandler<HTMLInputElement>;
onKeyDown?: KeyboardEventHandler<HTMLInputElement>;
onPopoverOpen?: (open: boolean) => void;
onInternalErrors?: (errors: string[]) => void;
onOptionClick?: (value: string) => void;
onPaste?: ClipboardEventHandler<HTMLInputElement>;
onRightIconClick?: React.MouseEventHandler<HTMLButtonElement>;
};
type ReturnType = {
ref?: MultipleRef;
listOptionsHeight: string;
openOptions: boolean;
showHighlightedOption: boolean;
searchText: string;
inputPopoverText: string;
optionsFiltered: IOptionGroup[];
handleOpenOptions: (open: boolean) => void;
handleClickInputSearch: React.MouseEventHandler<HTMLInputElement>;
handleIconClick: React.MouseEventHandler<HTMLButtonElement>;
handleInputPopoverIconClick: () => void;
handleValueSelected: (value: any) => void;
handleChangeInputSearch: ChangeEventHandler<HTMLInputElement>;
handleInputKeyDown: KeyboardEventHandler<HTMLInputElement>;
handleInputPopoverKeyDown: KeyboardEventHandler<HTMLInputElement>;
state: InputState;
handleBlurInternal: FocusEventHandler<HTMLInputElement>;
handleFocusInternal: FocusEventHandler<HTMLInputElement>;
handleInputPopoverChange: ChangeEventHandler<HTMLInputElement>;
handleOptionsListKeyDown: KeyboardEventHandler<HTMLDivElement>;
handlePasteInternal: ClipboardEventHandler<HTMLInputElement>;
handleRightIconClick: React.MouseEventHandler<HTMLButtonElement>;
};
export declare const useInputSearch: ({ executeInternalOpenOptions, ...props }: ParamsType) => ReturnType;
export {};