@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
50 lines (49 loc) • 1.78 kB
TypeScript
/**
* MSKCC DSM 2021, 2023
*/
import React from 'react';
import { KeyboardEvent, MouseEvent } from 'react';
export interface ListBoxSelectionProps {
/**
* Specify a function to be invoked when a user interacts with the clear
* selection element.
*/
clearSelection(event: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>): void;
/**
* Specify whether or not the clear selection element should be disabled
*/
disabled?: boolean;
/**
* Specify an optional `onClearSelection` handler that is called when the underlying
* element is cleared
*/
onClearSelection?(event: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>): void;
/**
* Whether or not the Dropdown is readonly
*/
readOnly?: boolean;
label?: string;
/**
* Specify an optional `selectionCount` value that will be used to determine
* whether the selection should display a badge or a single clear icon.
*/
selectionCount?: number;
/**
* i18n hook used to provide the appropriate description for the given menu
* icon. This function takes in an id defined in `translationIds` and should
* return a string message for that given message id.
*/
translateWithId(messageId: string, args?: Record<string, unknown>): string;
}
export type ListBoxSelectionComponent = React.FC<ListBoxSelectionProps>;
/**
* `ListBoxSelection` is used to provide controls for clearing a selection, in
* addition to conditionally rendering a badge if the control has more than one
* selection.
*/
declare const ListBoxSelection: ListBoxSelectionComponent;
export declare const translationIds: {
'clear.all': string;
'clear.selection': string;
};
export default ListBoxSelection;