2023-10-03 17:02:23 +02:00
|
|
|
import React, { forwardRef } from "react";
|
2023-06-12 14:27:40 +02:00
|
|
|
import { SelectMulti } from ":/components/Forms/Select/multi";
|
|
|
|
|
import { SelectMono, SelectProps } from ":/components/Forms/Select/mono";
|
2023-05-05 16:04:50 +02:00
|
|
|
|
2023-08-29 16:21:19 +02:00
|
|
|
export * from ":/components/Forms/Select/mono";
|
|
|
|
|
export * from ":/components/Forms/Select/multi";
|
|
|
|
|
|
2023-10-03 17:02:23 +02:00
|
|
|
export interface SelectHandle {
|
|
|
|
|
blur: () => void;
|
|
|
|
|
}
|
|
|
|
|
export const Select = forwardRef<SelectHandle, SelectProps>((props, ref) => {
|
2023-05-05 16:04:50 +02:00
|
|
|
if (props.defaultValue && props.value) {
|
|
|
|
|
throw new Error(
|
2023-07-18 15:43:56 +02:00
|
|
|
"You cannot use both defaultValue and value props on Select component",
|
2023-05-05 16:04:50 +02:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-03 17:02:23 +02:00
|
|
|
return props.multi ? (
|
|
|
|
|
<SelectMulti {...props} ref={ref} />
|
|
|
|
|
) : (
|
|
|
|
|
<SelectMono {...props} ref={ref} />
|
|
|
|
|
);
|
|
|
|
|
});
|