✨(react) add monoline props to multi select
We want to enable a mode that prevent the pills the wrap on multiple lines in order to control any height overflowing. In monoline mode the selected items are displayed as text to allow text ellipsis, and the menu renders the list items with checkboxes.
This commit is contained in:
@@ -6,21 +6,22 @@ import { FieldProps } from ":/components/Forms/Field";
|
||||
export * from ":/components/Forms/Select/mono";
|
||||
export * from ":/components/Forms/Select/multi";
|
||||
|
||||
export type OptionWithRender = {
|
||||
disabled?: boolean;
|
||||
type BaseOption = {
|
||||
value: string;
|
||||
label: string;
|
||||
render: () => ReactNode;
|
||||
highlighted?: boolean;
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
export type Option =
|
||||
| {
|
||||
disabled?: boolean;
|
||||
value?: string;
|
||||
label: string;
|
||||
render?: undefined;
|
||||
}
|
||||
| OptionWithRender;
|
||||
export type OptionWithRender = BaseOption;
|
||||
|
||||
export type OptionWithoutRender = Omit<BaseOption, "value" | "render"> & {
|
||||
value?: string;
|
||||
render?: undefined;
|
||||
};
|
||||
|
||||
export type Option = OptionWithoutRender | OptionWithRender;
|
||||
|
||||
export interface SelectHandle {
|
||||
blur: () => void;
|
||||
@@ -45,6 +46,9 @@ export type SelectProps = PropsWithChildren &
|
||||
clearable?: boolean;
|
||||
multi?: boolean;
|
||||
showLabelWhenSelected?: boolean;
|
||||
monoline?: boolean;
|
||||
selectedItemsStyle?: "pills" | "text";
|
||||
menuOptionsStyle?: "plain" | "checkbox";
|
||||
};
|
||||
export const Select = forwardRef<SelectHandle, SelectProps>((props, ref) => {
|
||||
if (props.defaultValue && props.value) {
|
||||
|
||||
Reference in New Issue
Block a user