@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
71 lines (70 loc) • 3.14 kB
TypeScript
import { ChangeEventHandler, ClipboardEventHandler, FocusEventHandler, ForwardedRef, KeyboardEventHandler, MouseEventHandler, MutableRefObject } from 'react';
import { INTERNAL_ERROR_EXECUTION } from '../../input/types/input';
import { InputState } from '../../input/types/inputTheme';
import { InputTypeType } from '../../input/types/inputType';
import { InputDropdownOnChangeType, InputDropdownOptionsType } from '../types/inputDropdown';
import { InputDropdownStylesProps } from '../types/inputDropdownTheme';
export interface MultipleRef {
refInput?: MutableRefObject<HTMLInputElement | undefined>;
refList: ForwardedRef<unknown> | (({ ref, index }: {
ref: any;
index: any;
}) => void);
refActionBottomSheet: React.ForwardedRef<HTMLDivElement> | undefined | null;
refIcon: MutableRefObject<HTMLElement | undefined>;
}
type ParamsType = {
ref?: ForwardedRef<HTMLSelectElement | undefined>;
open: boolean;
allowSearch?: boolean;
elementsToShow: number;
optionList: InputDropdownOptionsType;
type: InputTypeType;
value?: string;
styles: InputDropdownStylesProps;
disabled?: boolean;
/**
* @deprecated
* @description This prop is deprecated and will be removed in the next major version.
*/
clearTextInputPopoverIconClick?: boolean;
error?: boolean;
informationAssociated?: string;
hasInputInSearchList?: boolean;
name?: string;
internalErrorExecution?: INTERNAL_ERROR_EXECUTION;
disabledCopyAndPaste?: boolean;
onClick?: (event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLInputElement, MouseEvent>) => void;
onIconClick?: MouseEventHandler<HTMLButtonElement>;
onRightIconClick?: MouseEventHandler<HTMLButtonElement>;
onInputPopoverIconClick?: () => void;
onChange?: InputDropdownOnChangeType;
onBlur?: FocusEventHandler<HTMLInputElement>;
onFocus?: FocusEventHandler<HTMLInputElement>;
onOpenCloseOptions?: (open: boolean) => void;
onInternalErrors?: (errors: string[]) => void;
onPaste?: ClipboardEventHandler<HTMLInputElement>;
};
type ReturnHookType = {
ref?: MultipleRef;
listOptionsHeight: string;
openOptions: boolean;
searchText: string;
inputPopoverText: string;
optionsFiltered: InputDropdownOptionsType;
handleOpenOptions: (open: boolean) => void;
handleClickInputDropdown: React.MouseEventHandler<HTMLInputElement>;
handleClickIconInputDropdown: React.MouseEventHandler<HTMLButtonElement>;
handleInputPopoverIconClick: () => void;
handleValueSelected: (value: any) => void;
handleChangeInputDropdown: ChangeEventHandler<HTMLInputElement>;
handleInputKeyDown: KeyboardEventHandler<HTMLInputElement>;
handleInputBlur: FocusEventHandler<HTMLInputElement>;
valueSearchSelected?: string;
state: InputState;
handleFocusInternal: FocusEventHandler<HTMLInputElement>;
handleInputPopoverChange: ChangeEventHandler<HTMLInputElement>;
handlePasteInternal?: ClipboardEventHandler<HTMLInputElement>;
};
export declare const useInputDropdown: (props: ParamsType) => ReturnHookType;
export {};