-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react-formio): add react-select
- Loading branch information
Showing
49 changed files
with
2,081 additions
and
605 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/react-formio/src/molecules/forms/select/Select.interfaces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { HTMLAttributes } from "react"; | ||
|
||
import { FormControlProps } from "../form-control/FormControl"; | ||
|
||
export interface SelectOptionBaseProps<Data = any> extends Record<string, any> { | ||
label: string | JSX.Element; | ||
value: string; | ||
id?: string; | ||
disabled?: boolean; | ||
note?: string | JSX.Element; | ||
group?: string; | ||
data?: Data; | ||
template?: (item: SelectOptionProps<Data>) => JSX.Element; | ||
} | ||
|
||
export interface SelectOptionProps<Data = string> extends SelectOptionBaseProps<Data> { | ||
options?: SelectOptionProps<Data>[]; | ||
} | ||
|
||
export interface SelectProps<Data = string> extends FormControlProps, Omit<HTMLAttributes<HTMLSelectElement>, "onChange" | "prefix"> { | ||
layout?: "html5" | "react" | "choicesjs"; | ||
/** | ||
* Error message | ||
*/ | ||
errorMessage?: string; | ||
disabled?: boolean; | ||
readonly?: boolean; | ||
size?: string; | ||
options: (SelectOptionBaseProps<Data> | Omit<SelectOptionProps<Data>, "value">)[]; | ||
disableSearch?: boolean; | ||
searchEnabled?: boolean; | ||
customProperties?: Record<string, any>; | ||
} | ||
|
||
export interface SelectSingle<Data = string> extends SelectProps<Data> { | ||
multiple?: false | undefined; | ||
value?: Data; | ||
onChange?: (name: string, value: Data) => void; | ||
} | ||
|
||
export interface SelectMultiple<Data = string> extends SelectProps<Data> { | ||
multiple: true; | ||
value?: Data[]; | ||
onChange?: (name: string, value: Data[]) => void; | ||
} | ||
|
||
export type AllSelectProps<Data = string> = SelectSingle<Data> | SelectMultiple<Data>; |
Oops, something went wrong.