import * as React from 'react'; import { Filter, ResolvableContent } from '@nu-art/ts-common'; import { Adapter } from '../adapter/Adapter.js'; import { ComponentSync } from '../../core/ComponentSync.js'; import './TS_DropDown.scss'; import { UIProps_EditableItem } from '../../utils/EditableItem.js'; import { ComponentProps_Error } from '../types.js'; type State = ComponentProps_Error & { open?: boolean; adapter: Adapter; selected?: ItemType; hover?: ItemType; filterText?: string; dropDownRef: React.RefObject; treeContainerRef: React.RefObject; focusedItem?: ItemType; className?: string; hidePlaceholderOnOpen?: boolean; treeResizeObserver: ResizeObserver; }; type StaticProps = { caret: { open: React.ReactNode; close: React.ReactNode; }; }; type InputEvent = React.KeyboardEvent | React.MouseEvent; type Dropdown_Props = Partial & ComponentProps_Error & { adapter: Adapter | ((filter?: string) => Adapter); placeholder?: string; inputValue?: string; noOptionsRenderer?: React.ReactNode | ((filter?: string) => React.ReactNode); onNoMatchingSelectionForString?: (filterText: string, matchingItems: ItemType[], e: React.KeyboardEvent) => any; selected?: ItemType; filter?: Filter; queryFilter?: (item: ItemType) => boolean; tabIndex?: number; innerRef?: React.RefObject; id?: string; inputEventHandler?: (state: State, e: React.KeyboardEvent) => State; selectedItemRenderer?: (props?: ItemType) => React.ReactNode; showNothingWithoutFilterText?: boolean; disabled?: boolean; allowManualSelection?: boolean; className?: string; boundingParentSelector?: string; renderSearch?: (dropDown: TS_DropDown) => React.ReactNode; limitItems?: number; unselectLabel?: string; hidePlaceholderOnOpen?: boolean; onContextMenu?: (e: React.MouseEvent) => void; }; type Props_CanUnselect = { canUnselect: true; onSelected: (selected?: ItemType) => void; }; type Props_CanNotUnselect = { canUnselect?: false; onSelected: (selected: ItemType) => void; }; type Props_CanUnselect_NonMandatory = { canUnselect: true; onSelected?: (selected?: ItemType) => void; }; type Props_CanNotUnselect_NonMandatory = { canUnselect?: false; onSelected?: (selected: ItemType) => void; }; export type Props_DropDown = (Props_CanUnselect | Props_CanNotUnselect) & Dropdown_Props; export type MandatoryProps_TS_DropDown = Dropdown_Props; type BasePartialProps_DropDown = { className?: string; inputValue?: string; placeholder?: string; onNoMatchingSelectionForString?: (filterText: string, matchingItems: T[], e: React.KeyboardEvent) => Promise | void; mapper?: (item: T) => string[]; renderer?: (item: T) => React.ReactElement; queryFilter?: (item: T) => boolean; disabled?: boolean; ifNoneShowAll?: boolean; }; export type PartialProps_DropDown = BasePartialProps_DropDown & ComponentProps_Error & (Props_CanUnselect | Props_CanNotUnselect) & { selected?: T; }; type EditableDropDownProps = BasePartialProps_DropDown & UIProps_EditableItem & ComponentProps_Error & (Props_CanUnselect_NonMandatory | Props_CanNotUnselect_NonMandatory); export declare class TS_DropDown extends ComponentSync, State> { static readonly prepareEditable: (mandatoryProps: ResolvableContent>) => (props: EditableDropDownProps) => import("react/jsx-runtime").JSX.Element; static readonly prepareSelectable: (mandatoryProps: ResolvableContent>) => (props: PartialProps_DropDown) => import("react/jsx-runtime").JSX.Element; static readonly prepare: (mandatoryProps: ResolvableContent>) => { editable: (props: EditableDropDownProps) => import("react/jsx-runtime").JSX.Element; selectable: (props: PartialProps_DropDown) => import("react/jsx-runtime").JSX.Element; }; static defaultRenderSearch: (dropDown: TS_DropDown) => import("react/jsx-runtime").JSX.Element; static defaultProps: { renderSearch: (dropDown: TS_DropDown) => import("react/jsx-runtime").JSX.Element; }; constructor(props: Props_DropDown); protected deriveStateFromProps(nextProps: Props_DropDown, state?: Partial>): State; onTreeResize: () => void; componentDidUpdate(): void; private getBoundingParent; private closeList; onSelected: (item?: ItemType, e?: InputEvent) => void; private inputKeyEventHandler; private createAdapter; private getChildrenContainerMaxHeight; private getChildrenContainerPosX; private getChildrenContainerPosY; private getChildrenContainerWidth; render(): import("react/jsx-runtime").JSX.Element; private renderHeader; private renderTree; private renderSelectedItem; private renderSelectedOrFilterInput; private addKeyboardListener; private removeKeyboardListener; keyboardEventHandler: (e: KeyboardEvent) => void | null; } export {};