mui-chips-input
Version:
A chips input designed for the React library MUI
59 lines (49 loc) • 2.37 kB
TypeScript
import { ChipProps } from '@mui/material/Chip';
import { default as default_2 } from 'react';
import { JSX } from 'react/jsx-runtime';
import { TextFieldProps as TextFieldProps_2 } from '@mui/material/TextField';
declare interface BaseMuiChipsInputProps {
value?: MuiChipsInputChip[];
onInputChange?: (inputValue: string) => void;
inputValue?: string;
onAddChip?: (chipValue: MuiChipsInputChip, chipIndex: number) => void;
onDeleteChip?: (chipValue: MuiChipsInputChip, chipIndex: number) => void;
onEditChip?: (chipValue: MuiChipsInputChip, chipIndex: number) => void;
onChange?: (value: MuiChipsInputChip[]) => void;
addOnWhichKey?: string[] | string;
renderChip?: (ChipComponent: MuiChipsInputChipComponent, key: default_2.Key, ChipProps: MuiChipsInputChipProps) => default_2.ReactNode;
hideClearAll?: boolean;
disableEdition?: boolean;
disableDeleteOnBackspace?: boolean;
validate?: (chipValue: MuiChipsInputChip) => boolean | {
isError: boolean;
textError: string;
};
}
declare type ChipInputBlurBehavior = {
clearInputOnBlur: true;
addOnBlur?: never;
} | {
clearInputOnBlur?: never;
addOnBlur: true;
} | {
clearInputOnBlur?: false;
addOnBlur?: false;
};
export declare const MuiChipsInput: ({ value, onChange, onAddChip, onInputChange, onDeleteChip, disabled, validate, clearInputOnBlur, addOnBlur, hideClearAll, disableDeleteOnBackspace, onEditChip, renderChip, disableEdition, ref: propRef, addOnWhichKey, inputValue, ...restTextFieldProps }: MuiChipsInputProps) => JSX.Element;
export declare type MuiChipsInputChip = string;
export declare type MuiChipsInputChipComponent = default_2.ElementType<MuiChipsInputChipProps>;
export declare type MuiChipsInputChipProps = ChipProps & {
index: number;
label: string;
title: string;
isEditing: boolean;
disableEdition?: boolean;
size: ChipProps['size'];
disabled: ChipProps['disabled'];
onDelete: (index: number) => void;
onEdit: (index: number) => void;
};
export declare type MuiChipsInputProps = TextFieldProps & BaseMuiChipsInputProps & ChipInputBlurBehavior;
declare type TextFieldProps = Omit<TextFieldProps_2, 'onChange' | 'select' | 'type' | 'multiline' | 'defaultValue' | 'inputProps' | 'InputProps'>;
export { }