🏷️(react) move SelectProps to index.tsx

It makes more sense for this type to be next to the Select component.
This commit is contained in:
Nathan Vasse
2023-10-04 15:48:22 +02:00
committed by NathanVss
parent 1c7a114b6e
commit b5c91d429d
7 changed files with 33 additions and 37 deletions

View File

@@ -1,6 +1,7 @@
import React, { forwardRef } from "react";
import React, { forwardRef, PropsWithChildren } from "react";
import { SelectMulti } from ":/components/Forms/Select/multi";
import { SelectMono, SelectProps } from ":/components/Forms/Select/mono";
import { Option, SelectMono } from ":/components/Forms/Select/mono";
import { FieldProps } from ":/components/Forms/Field";
export * from ":/components/Forms/Select/mono";
export * from ":/components/Forms/Select/multi";
@@ -8,6 +9,26 @@ export * from ":/components/Forms/Select/multi";
export interface SelectHandle {
blur: () => void;
}
export type SelectProps = PropsWithChildren &
FieldProps & {
label: string;
hideLabel?: boolean;
options: Option[];
searchable?: boolean;
name?: string;
defaultValue?: string | number | string[];
value?: string | number | string[];
onChange?: (event: {
target: { value: string | number | undefined | string[] };
}) => void;
onBlur?: (event: {
target: { value: string | number | undefined | string[] };
}) => void;
disabled?: boolean;
clearable?: boolean;
multi?: boolean;
};
export const Select = forwardRef<SelectHandle, SelectProps>((props, ref) => {
if (props.defaultValue && props.value) {
throw new Error(