@activecollab/components
Version:
ActiveCollab Components
55 lines • 2.06 kB
TypeScript
import { FC, ReactElement, PropsWithChildren } from "react";
import { Placement } from "@popperjs/core";
import { IOptionGroupProps, IOptionItemProps } from "../Select";
export type DataType = {
id: number | string;
title: string;
searchPlaceholder?: string;
disableInternalSort?: boolean;
submenu: Array<IOptionGroupProps | IOptionItemProps>;
isSingleSelect?: boolean;
defaultValue?: string;
emptyValue?: string;
emptyAction?: (e: string | undefined) => void;
/** Type of submenu - 'select' renders options list, 'input' renders an input field with save button */
type?: "select" | "input";
/** Placeholder text for input field (only used when type='input') */
inputPlaceholder?: string;
/** Label for the save button (only used when type='input') */
saveLabel?: string;
/** Label for the clear button (only used when type='input') */
clearLabel?: string;
};
export type SelectedType = {
[key: number | string]: Array<string>;
};
export interface FilterProps {
/** Data rendered in submenus */
data: Array<DataType>;
/** Selected data inside submenus */
selected?: SelectedType;
/** Main filter label */
label: string;
/** Filter width */
width?: number;
/** Text displayed for the tooltip of clear all button */
clearAllText: string;
/** Handler for changes on the filter */
onChange: (selected: SelectedType) => void;
/** Label for reset button inside submenu */
resetLabel?: string;
/** Text to show when search results are empty */
noResultText: string;
/** Text to show when there are no submenus to display */
emptyFilterText?: string;
/** Position of the dropped menu. */
position?: Placement;
/** Icon of the trigger element. */
icon?: ReactElement;
/** Disabled state of the trigger. */
disabled?: boolean;
/** Applies passed classes for label text */
className?: string;
}
export declare const Filter: FC<PropsWithChildren<FilterProps>>;
//# sourceMappingURL=Filter.d.ts.map