-
Notifications
You must be signed in to change notification settings - Fork 0
/
react-selection-box.d.ts
94 lines (84 loc) · 2.2 KB
/
react-selection-box.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import * as React from 'react';
export type ITypes = 'single' | 'multiple' | 'range'
export interface IOptions {
value: number | string
label: number | string
checked: boolean
}
export interface IOnChangeData {
value?: string[] | number[] | string | number | null
min?: string | number | null
max?: string | number | null
}
interface IValueAndLabelShape {
value: number | string
label: number | string
}
export interface IDefaultSelectedRange {
min?: IValueAndLabelShape,
max?: IValueAndLabelShape
}
export interface ITranslates {
label?: {
from: string,
to: string
},
placeholder?: {
min: string,
max: string,
search: string,
},
button?: {
apply: string,
cancel: string,
},
loading?: string,
no_options?: string
}
export interface IReactSelectionBoxProps {
children?: React.ReactNode;
// select label
label: string;
// select tag name
name: string;
// selection type
type: ITypes;
//selection options
options: IOptions[];
// selection onChange
onChange: (data: IOnChangeData | null) => void
// select container class name
className?: string
// in multiple type, you can select how many items can be displayed in the caption
// default = 3
countSelectedInCaption?: number
// rtl
// default false
rtl?: boolean
// searchable
// default true
searchable?: boolean
// cleanable
// default true
cleanable?: boolean
// loading
// default false
loading?: boolean
// disable selection
// default false
disabled?: boolean
// autocomplete
autocomplete?: boolean
// required if autocomplete is true
onChangeAutocomplete?: (pattern: string | null) => void
// when selection dropdown opened
onShow?: (show: boolean) => void
// when selection dropdown closed
onHide?: (show: boolean) => void
// in rang selection, you can add default selected rang
defaultSelectedRange?: IDefaultSelectedRange
// selection translate
translates?: ITranslates
}
// ReactSelectionBox component is the default export
export default function Selection(props: IReactSelectionBoxProps)