import classNames from "classnames";
import React from "react";
import { SelectMultiAuxProps } from ":/components/Forms/Select/multi-common";
import {
optionToValue,
renderOption,
} from ":/components/Forms/Select/mono-common";
import { useCunningham } from ":/components/Provider";
import { Checkbox } from ":/components/Forms/Checkbox";
import { Option } from ":/components/Forms/Select/index";
export const SelectMultiMenu = (props: SelectMultiAuxProps) => {
const { t } = useCunningham();
return (
{props.downshiftReturn.isOpen && (
<>
{props.options.map((option, index) => (
))}
{props.options.length === 0 && (
-
{t("components.forms.select.menu_empty_placeholder")}
)}
>
)}
);
};
type MenuItemProps = SelectMultiAuxProps & { option: Option; index: number };
const MenuItem = (props: MenuItemProps) => {
if (props.menuOptionsStyle === "plain") {
return ;
}
if (props.menuOptionsStyle === "checkbox") {
return ;
}
throw new Error("Unknown menuOptionsStyle");
};
const MenuItemPlain = ({ option, index, ...props }: MenuItemProps) => {
const isHighlighted =
index === props.downshiftReturn.highlightedIndex || option.highlighted;
return (
{renderOption(option)}
);
};
const MenuItemCheckbox = ({ option, index, ...props }: MenuItemProps) => {
return (
);
};