Skip to content

Commit abd6337

Browse files
committed
[Resolve #31] Export SelectProps and Option 🎉
1 parent d81849e commit abd6337

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

‎src/components/Select.tsx‎

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,7 @@ import Options from "./Options";
88
import SearchInput from "./SearchInput";
99
import SelectProvider from "./SelectProvider";
1010
import Spinner from "./Spinner";
11-
import { ClassNames, GroupOption, Option, Options as ListOption, SelectValue } from "./type";
12-
13-
interface SelectProps {
14-
options: ListOption;
15-
value: SelectValue;
16-
onChange: (value: SelectValue) => void;
17-
onSearchInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
18-
placeholder?: string;
19-
isMultiple?: boolean;
20-
isClearable?: boolean;
21-
isSearchable?: boolean;
22-
isDisabled?: boolean;
23-
loading?: boolean;
24-
menuIsOpen?: boolean;
25-
searchInputPlaceholder?: string;
26-
noOptionsMessage?: string;
27-
primaryColor: string;
28-
formatGroupLabel?: ((data: GroupOption) => JSX.Element) | null;
29-
formatOptionLabel?: ((data: Option) => JSX.Element) | null;
30-
classNames?: ClassNames;
31-
}
11+
import { Option, Options as ListOption, SelectProps } from "./type";
3212

3313
const Select: React.FC<SelectProps> = ({
3414
options = [],

‎src/components/type.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from "react";
2+
13
export interface Option {
24
value: string;
35
label: string;
@@ -31,3 +33,23 @@ export interface ClassNames {
3133
}
3234

3335
export type SelectValue = Option | Option[] | null;
36+
37+
export interface SelectProps {
38+
options: Options;
39+
value: SelectValue;
40+
onChange: (value: SelectValue) => void;
41+
onSearchInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
42+
placeholder?: string;
43+
isMultiple?: boolean;
44+
isClearable?: boolean;
45+
isSearchable?: boolean;
46+
isDisabled?: boolean;
47+
loading?: boolean;
48+
menuIsOpen?: boolean;
49+
searchInputPlaceholder?: string;
50+
noOptionsMessage?: string;
51+
primaryColor: string;
52+
formatGroupLabel?: ((data: GroupOption) => JSX.Element) | null;
53+
formatOptionLabel?: ((data: Option) => JSX.Element) | null;
54+
classNames?: ClassNames;
55+
}

0 commit comments

Comments
 (0)