@helpwave/hightide
Version:
helpwave's component and theming library
43 lines (40 loc) • 2.04 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
import { ReactNode } from 'react';
import { PropsForTranslation } from '../../localization/useTranslation.js';
import { LabelProps } from './Label.js';
import { SelectOption } from './Select.js';
import { FormTranslationType } from '../../localization/defaults/form.js';
import { MenuProps, MenuBag } from './Menu.js';
import { UseSearchProps } from '../../hooks/useSearch.js';
import '../../localization/util.js';
import '../../util/PropsWithFunctionChildren.js';
import '../../hooks/usePopoverPosition.js';
type MultiSelectAddonTranslation = {
selected: string;
};
type MultiSelectTranslation = MultiSelectAddonTranslation & FormTranslationType;
type MultiSelectOption<T> = SelectOption<T> & {
selected: boolean;
};
type MultiSelectBag = MenuBag & {
search: string;
};
type MultiSelectProps<T> = Omit<MenuProps<HTMLButtonElement>, 'trigger' | 'children'> & {
options: MultiSelectOption<T>[];
label?: LabelProps;
onChange: (options: MultiSelectOption<T>[]) => void;
hintText?: string;
selectedDisplayOverwrite?: ReactNode;
searchOptions?: Omit<UseSearchProps<SelectOption<T>>, 'list' | 'searchMapping'>;
additionalItems?: (bag: MultiSelectBag) => ReactNode;
useChipDisplay?: boolean;
className?: string;
triggerClassName?: string;
hintTextClassName?: string;
};
/**
* A Component for multi selection
*/
declare const MultiSelect: <T>({ overwriteTranslation, label, options, onChange, hintText, selectedDisplayOverwrite, searchOptions, additionalItems, useChipDisplay, className, triggerClassName, hintTextClassName, ...menuProps }: PropsForTranslation<MultiSelectTranslation, MultiSelectProps<T>>) => react_jsx_runtime.JSX.Element;
declare const MultiSelectUncontrolled: <T>({ options, onChange, ...props }: PropsForTranslation<MultiSelectTranslation, MultiSelectProps<T>>) => react_jsx_runtime.JSX.Element;
export { MultiSelect, type MultiSelectBag, type MultiSelectOption, type MultiSelectProps, MultiSelectUncontrolled };