UNPKG

@douyinfe/semi-ui

Version:

A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.

108 lines (107 loc) 4.74 kB
import React from 'react'; import PropTypes from 'prop-types'; import BaseComponent from '../_base/baseComponent'; import Tooltip, { Position, TooltipProps, Trigger } from '../tooltip/index'; import DropdownMenu from './dropdownMenu'; import DropdownItem, { DropdownItemProps } from './dropdownItem'; import { DropdownDividerProps } from './dropdownDivider'; import DropdownTitle, { DropdownTitleProps } from './dropdownTitle'; import { DropdownContextType } from './context'; import '@douyinfe/semi-foundation/lib/cjs/dropdown/dropdown.css'; export type { DropdownDividerProps } from './dropdownDivider'; export type { DropdownItemProps, Type } from './dropdownItem'; export type { DropdownMenuProps } from './dropdownMenu'; export type { DropdownTitleProps } from './dropdownTitle'; export interface DropDownMenuItemItem extends DropdownItemProps { node: 'item'; name?: string; } export interface DropDownMenuItemDivider extends DropdownDividerProps { node: 'divider'; } export interface DropDownMenuItemTitle extends DropdownTitleProps { node: 'title'; name?: string; } export type DropDownMenuItem = DropDownMenuItemItem | DropDownMenuItemDivider | DropDownMenuItemTitle; export interface DropdownProps extends TooltipProps { render?: React.ReactNode; children?: React.ReactNode; visible?: boolean; position?: Position; getPopupContainer?: () => HTMLElement; mouseEnterDelay?: number; mouseLeaveDelay?: number; menu?: DropDownMenuItem[]; trigger?: Trigger; zIndex?: number; motion?: boolean; className?: string; contentClassName?: string | any[]; style?: React.CSSProperties; onVisibleChange?: (visible: boolean) => void; rePosKey?: string | number; showTick?: boolean; closeOnEsc?: TooltipProps['closeOnEsc']; onEscKeyDown?: TooltipProps['onEscKeyDown']; } interface DropdownState { popVisible: boolean; } declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> { static Menu: typeof DropdownMenu; static Item: typeof DropdownItem; static Divider: React.FC<import("../_base/baseComponent").BaseProps>; static Title: typeof DropdownTitle; static contextType: React.Context<DropdownContextType>; static propTypes: { children: PropTypes.Requireable<PropTypes.ReactNodeLike>; contentClassName: PropTypes.Requireable<NonNullable<string | any[]>>; className: PropTypes.Requireable<string>; getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>; margin: PropTypes.Requireable<NonNullable<number | object>>; mouseEnterDelay: PropTypes.Requireable<number>; mouseLeaveDelay: PropTypes.Requireable<number>; menu: PropTypes.Requireable<any[]>; motion: PropTypes.Requireable<NonNullable<boolean | object>>; onVisibleChange: PropTypes.Requireable<(...args: any[]) => any>; prefixCls: PropTypes.Requireable<string>; position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">; rePosKey: PropTypes.Requireable<NonNullable<string | number>>; render: PropTypes.Requireable<PropTypes.ReactNodeLike>; spacing: PropTypes.Requireable<NonNullable<number | object>>; showTick: PropTypes.Requireable<boolean>; style: PropTypes.Requireable<object>; trigger: PropTypes.Requireable<string>; visible: PropTypes.Requireable<boolean>; zIndex: PropTypes.Requireable<number>; }; static __SemiComponentName__: string; static defaultProps: any; tooltipRef: React.RefObject<Tooltip>; constructor(props: DropdownProps); context: DropdownContextType; get adapter(): { setPopVisible: (popVisible: boolean) => void; notifyVisibleChange: (visible: boolean) => void; getPopupId: () => string; getContext(key: string): any; getContexts(): any; getProp(key: string): any; getProps(): DropdownProps; getState(key: string): any; getStates(): DropdownState; setState<K extends "popVisible">(s: Pick<DropdownState, K>, callback?: any): void; getCache(c: string): any; getCaches(): any; setCache(key: any, value: any): void; stopPropagation(e: any): void; persistEvent: (event: any) => void; }; handleVisibleChange: (visible: boolean) => any; renderContent(): React.JSX.Element; renderMenu(): React.JSX.Element; renderPopCard(): React.JSX.Element; render(): React.JSX.Element; } export default Dropdown;