Skip to content
This repository was archived by the owner on Dec 23, 2022. It is now read-only.

Commit 890de05

Browse files
pantharshit00leMaik
authored andcommitted
Add TS definitions (#233)
* add typings to package.json * add typings * add typing on publish * change component to componentType * add error to types * update typings * change card to any * fix more types
1 parent af34a67 commit 890de05

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
2-
"name": "material-ui-chip-input",
3-
"version": "1.0.0-beta.7",
2+
"name": "@harshitpant/material-ui-chip-input",
3+
"version": "2.0.5",
4+
"typings": "typings/index.d.ts",
45
"description": "A chip input field using Material-UI.",
56
"main": "lib/ChipInput.js",
67
"files": [
78
"lib/**/*.js",
9+
"typings/*.d.ts",
810
"README.md",
911
"LICENSE",
1012
"demo.gif"

typings/index.d.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import * as React from 'react';
2+
import { FormHelperTextProps } from '@material-ui/core/FormHelperText'
3+
import {InputProps} from '@material-ui/core/Input'
4+
import {InputLabelProps} from '@material-ui/core/InputLabel'
5+
6+
export interface ChipRendererArgs {
7+
value: string;
8+
text: string;
9+
chip: any;
10+
isFocused: boolean;
11+
isDisabled: boolean;
12+
handleClick: React.EventHandler<any>;
13+
handleDelete: React.EventHandler<any>;
14+
className: string;
15+
}
16+
17+
export type ChipRenderer = (
18+
args: ChipRendererArgs,
19+
key: any
20+
) => React.ReactNode;
21+
22+
export interface Props {
23+
allowDuplicates?: boolean;
24+
blurBehavior?: 'clear' | 'add' | 'ignore';
25+
chipRenderer?: ChipRenderer;
26+
clearInputValueOnChange?: boolean;
27+
dataSource?: any[];
28+
dataSourceConfig?: {
29+
text: string;
30+
value: string;
31+
};
32+
defaultValue?: any[];
33+
disabled?: boolean;
34+
FormHelperTextProps?: FormHelperTextProps;
35+
fullWidth?: boolean;
36+
fullWidthInput?: boolean;
37+
helperText?: React.ReactNode;
38+
InputLabelProps?: InputLabelProps;
39+
InputProps?: InputProps;
40+
inputRef?: (ref: React.Ref<HTMLInputElement>) => any;
41+
label?: React.ReactNode;
42+
newChipKeyCodes?: number[];
43+
onAdd?: (chip: any) => any;
44+
onBeforeAdd?: (chip: any) => boolean;
45+
onChange?: (chips: any[]) => any;
46+
onDelete?: (chip:any, index: number) => any;
47+
onUpdateInput?: React.EventHandler<any>
48+
placeholder?: string;
49+
value?: any[];
50+
error?: boolean;
51+
}
52+
53+
declare const ChipInput: React.ComponentType<Props>;
54+
export default ChipInput;

0 commit comments

Comments
 (0)