Skip to content

Commit

Permalink
[Resolve #31] Export SelectProps and Option 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
onesine committed Mar 9, 2023
1 parent d81849e commit abd6337
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
22 changes: 1 addition & 21 deletions src/components/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,7 @@ import Options from "./Options";
import SearchInput from "./SearchInput";
import SelectProvider from "./SelectProvider";
import Spinner from "./Spinner";
import { ClassNames, GroupOption, Option, Options as ListOption, SelectValue } from "./type";

interface SelectProps {
options: ListOption;
value: SelectValue;
onChange: (value: SelectValue) => void;
onSearchInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
placeholder?: string;
isMultiple?: boolean;
isClearable?: boolean;
isSearchable?: boolean;
isDisabled?: boolean;
loading?: boolean;
menuIsOpen?: boolean;
searchInputPlaceholder?: string;
noOptionsMessage?: string;
primaryColor: string;
formatGroupLabel?: ((data: GroupOption) => JSX.Element) | null;
formatOptionLabel?: ((data: Option) => JSX.Element) | null;
classNames?: ClassNames;
}
import { Option, Options as ListOption, SelectProps } from "./type";

const Select: React.FC<SelectProps> = ({
options = [],
Expand Down
22 changes: 22 additions & 0 deletions src/components/type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from "react";

export interface Option {
value: string;
label: string;
Expand Down Expand Up @@ -31,3 +33,23 @@ export interface ClassNames {
}

export type SelectValue = Option | Option[] | null;

export interface SelectProps {
options: Options;
value: SelectValue;
onChange: (value: SelectValue) => void;
onSearchInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
placeholder?: string;
isMultiple?: boolean;
isClearable?: boolean;
isSearchable?: boolean;
isDisabled?: boolean;
loading?: boolean;
menuIsOpen?: boolean;
searchInputPlaceholder?: string;
noOptionsMessage?: string;
primaryColor: string;
formatGroupLabel?: ((data: GroupOption) => JSX.Element) | null;
formatOptionLabel?: ((data: Option) => JSX.Element) | null;
classNames?: ClassNames;
}

0 comments on commit abd6337

Please sign in to comment.