@wix/design-system
Version:
@wix/design-system
80 lines • 3.59 kB
TypeScript
import React, { KeyboardEvent, PureComponent, RefObject } from 'react';
import { DropdownLayoutOption, DropdownLayoutValueOption } from '../DropdownLayout';
import type { DropdownLayout as DropdownLayoutClass } from '../DropdownLayout/DropdownLayout';
import type { DropdownBaseProps } from './DropdownBase.types';
import { OpenChangeReason } from '@floating-ui/react';
type DropdownBaseState = {
open?: boolean | undefined;
listAutoFocus?: boolean;
selectedId?: string | number | undefined;
activeDescendantId?: string | undefined;
};
declare class DropdownBase extends PureComponent<DropdownBaseProps, DropdownBaseState> {
static displayName: string;
triggerElementRef: RefObject<HTMLElement>;
constructor(props: DropdownBaseProps);
static defaultProps: {
placement: string;
appendTo: string;
showArrow: boolean;
maxHeight: string;
dynamicWidth: boolean;
minWidth: number;
fluid: boolean;
animate: boolean;
listType: string;
onShow: () => void;
onHide: () => void;
onMouseEnter: () => void;
onMouseLeave: () => void;
};
uniqueId: string;
_dropdownLayoutRef: DropdownLayoutClass | null;
_shouldCloseOnMouseLeave: boolean;
state: {
open: boolean | undefined;
selectedId: string | number;
activeDescendantId: undefined;
listAutoFocus: boolean;
};
/**
* Return `true` if the `open` prop is being controlled
*/
_isControllingOpen: (props?: Readonly<DropdownBaseProps>) => boolean;
/**
* Return `true` if the selection behaviour is being controlled
*/
_isControllingSelection: (props?: Readonly<DropdownBaseProps>) => boolean;
_setIsOpen: (isOpen: boolean, _?: OpenChangeReason, newState?: any) => void;
_handleClickOutside: () => void;
_handlePopoverMouseEnter: (renderedTrigger: React.ReactNode) => void;
_handlePopoverMouseLeave: (renderedTrigger: React.ReactNode) => void;
_handleSelect: (selectedOption: DropdownLayoutValueOption) => void;
_handleOptionMarked: (_option: DropdownLayoutOption | null, optionElementId?: string) => void;
_open: () => void;
_close: () => void;
_handleClose: () => void;
_getSelectedOption: (selectedId: DropdownLayoutOption["id"]) => DropdownLayoutOption | undefined;
/**
* Determine if a certain key should open the DropdownLayout
*/
_isOpenKey: (key: string) => boolean;
_isClosingKey: (key: string) => boolean;
/**
* A common `keydown` event that can be used for the target elements. It will automatically
* delegate the event to the underlying <DropdownLayout/>, and will determine when to open the
* dropdown depending on the pressed key.
*/
_handleKeyDown: (e: KeyboardEvent) => void;
_delegateKeyDown: (e: KeyboardEvent) => boolean | DropdownLayoutOption | undefined;
UNSAFE_componentWillReceiveProps(nextProps: DropdownBaseProps): void;
_renderChildren(renderedTrigger: React.ReactNode): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined;
_setDropdownLayoutRef: (ref: DropdownLayoutClass) => void;
_handleOutsideClick: (_: boolean, reason?: OpenChangeReason) => void;
_isDialogMode: () => boolean;
_isEventFromFixedRegion: (event: KeyboardEvent) => boolean;
_renderDropdownLayout(): React.JSX.Element;
render(): React.JSX.Element;
}
export default DropdownBase;
//# sourceMappingURL=DropdownBase.d.ts.map