diff --git a/app/frontend/src/javascript/components/base/fab-multi-select.tsx b/app/frontend/src/javascript/components/base/fab-multi-select.tsx new file mode 100644 index 000000000..077b69b39 --- /dev/null +++ b/app/frontend/src/javascript/components/base/fab-multi-select.tsx @@ -0,0 +1,50 @@ +import React, { SelectHTMLAttributes } from 'react'; +import Select from 'react-select'; +import { Controller, Path } from 'react-hook-form'; +import { Control } from 'react-hook-form/dist/types/form'; +import { FieldValues } from 'react-hook-form/dist/types/fields'; +import { FieldPath } from 'react-hook-form/dist/types/path'; +import { FieldPathValue, UnpackNestedValue } from 'react-hook-form/dist/types'; + +interface FabSelectProps extends SelectHTMLAttributes { + id: string, + label?: string, + className?: string, + control: Control, + placeholder?: string, + options: Array>, + valuesDefault?: Array, +} + +/** + * Option format, expected by react-select + * @see https://github.com/JedWatson/react-select + */ +type selectOption = { value: TOptionValue, label: string }; + +/** + * This component is a wrapper around react-select to use with react-hook-form. + * It is a multi-select component. + */ +export const FabMultiSelect = ({ id, label, className, control, placeholder, options, valuesDefault }: FabSelectProps) => { + return ( +