@eccenca/gui-elements
Version:
GUI elements based on other libraries, usable in React application, written in Typescript.
45 lines (44 loc) • 2.23 kB
TypeScript
import React from "react";
import { SelectProps as BlueprintSelectProps } from "@blueprintjs/select";
import { TestableComponent } from "../interfaces";
import { ButtonProps, ContextOverlayProps } from "./../../index";
export interface SelectProps<T> extends TestableComponent, Omit<BlueprintSelectProps<T>, "popoverTargetProps" | "popoverContentProps" | "popoverProps" | "popoverRef">, Pick<ButtonProps, "icon" | "rightIcon"> {
/**
* Textual representation of the the selected value.
* This is displayed if the select target is not controlled directly via `children` elements.
*/
text?: string;
/**
* Placeholder text displayed for selects without defined `text`.
* This is displayed if the select target is not controlled directly via `children` elements.
*/
placeholder?: string;
/**
* Props to spread to `ContextOverlay` that is used to display the dropdown.
*/
contextOverlayProps?: Partial<Omit<ContextOverlayProps, "content" | "defaultIsOpen" | "disabled" | "fill" | "renderTarget" | "targetTagName">>;
/**
* Event handler to reset search input.
* Only works with the uncontrolled default select target.
* If set then `rightElement` is automatically set with an action button to trigger the handler.
*/
onClearanceHandler?: () => void;
/**
* Tooltip to show for the clear button.
* Only works with the uncontrolled default select target.
*/
onClearanceText?: string;
/**
* If set then a `div` element is used as wrapper.
* It uses the attributes given via this property.
*/
wrapperProps?: React.HTMLAttributes<HTMLDivElement>;
}
/**
* Create a Select box without the HTML select element.
* It is possible to filter options, as well as to add new options if necessary.
*
* **Use this input element when the value is primarily selected from a defined set of elements.**
*/
export declare function Select<T>({ contextOverlayProps, className, children, text, placeholder, icon, rightIcon, onClearanceHandler, inputProps, onClearanceText, "data-test-id": dataTestId, "data-testid": dataTestid, wrapperProps, ...otherSelectProps }: SelectProps<T>): React.JSX.Element;
export default Select;