1 |
|
2 | import { ReactElement, ReactNode, Ref } from 'react';
|
3 | import { jsx } from '@emotion/react';
|
4 | import { MenuPlacement, MenuPosition, CommonProps, GroupBase, CommonPropsAndClassName, CoercedMenuPlacement, CSSObjectWithLabel } from '../types';
|
5 | interface CalculatedMenuPlacementAndHeight {
|
6 | placement: CoercedMenuPlacement;
|
7 | maxHeight: number;
|
8 | }
|
9 | interface PlacementArgs {
|
10 | maxHeight: number;
|
11 | menuEl: HTMLDivElement | null;
|
12 | minHeight: number;
|
13 | placement: MenuPlacement;
|
14 | shouldScroll: boolean;
|
15 | isFixedPosition: boolean;
|
16 | controlHeight: number;
|
17 | }
|
18 | export declare function getMenuPlacement({ maxHeight: preferredMaxHeight, menuEl, minHeight, placement: preferredPlacement, shouldScroll, isFixedPosition, controlHeight, }: PlacementArgs): CalculatedMenuPlacementAndHeight;
|
19 | export interface MenuPlacementProps {
|
20 |
|
21 | minMenuHeight: number;
|
22 |
|
23 | maxMenuHeight: number;
|
24 |
|
25 | menuPlacement: MenuPlacement;
|
26 |
|
27 | menuPosition: MenuPosition;
|
28 |
|
29 | menuShouldScrollIntoView: boolean;
|
30 | }
|
31 | export interface MenuProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> extends CommonPropsAndClassName<Option, IsMulti, Group>, MenuPlacementProps {
|
32 |
|
33 | innerRef: Ref<HTMLDivElement>;
|
34 | innerProps: JSX.IntrinsicElements['div'];
|
35 | isLoading: boolean;
|
36 | placement: CoercedMenuPlacement;
|
37 |
|
38 | children: ReactNode;
|
39 | }
|
40 | interface PlacerProps {
|
41 | placement: CoercedMenuPlacement;
|
42 | maxHeight: number;
|
43 | }
|
44 | interface ChildrenProps {
|
45 | ref: Ref<HTMLDivElement>;
|
46 | placerProps: PlacerProps;
|
47 | }
|
48 | export interface MenuPlacerProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> extends CommonProps<Option, IsMulti, Group>, MenuPlacementProps {
|
49 |
|
50 | children: (childrenProps: ChildrenProps) => ReactElement;
|
51 | }
|
52 | export declare const menuCSS: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ placement, theme: { borderRadius, spacing, colors }, }: MenuProps<Option, IsMulti, Group>, unstyled: boolean) => CSSObjectWithLabel;
|
53 | export declare const MenuPlacer: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: MenuPlacerProps<Option, IsMulti, Group>) => ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
54 | declare const Menu: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: MenuProps<Option, IsMulti, Group>) => jsx.JSX.Element;
|
55 | export default Menu;
|
56 | export interface MenuListProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> extends CommonPropsAndClassName<Option, IsMulti, Group> {
|
57 |
|
58 | maxHeight: number;
|
59 |
|
60 | children: ReactNode;
|
61 |
|
62 | innerRef: Ref<HTMLDivElement>;
|
63 |
|
64 | focusedOption: Option;
|
65 |
|
66 | innerProps: JSX.IntrinsicElements['div'];
|
67 | }
|
68 | export declare const menuListCSS: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ maxHeight, theme: { spacing: { baseUnit }, }, }: MenuListProps<Option, IsMulti, Group>, unstyled: boolean) => CSSObjectWithLabel;
|
69 | export declare const MenuList: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: MenuListProps<Option, IsMulti, Group>) => jsx.JSX.Element;
|
70 | export declare const noOptionsMessageCSS: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ theme: { spacing: { baseUnit }, colors, }, }: NoticeProps<Option, IsMulti, Group>, unstyled: boolean) => CSSObjectWithLabel;
|
71 | export declare const loadingMessageCSS: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ theme: { spacing: { baseUnit }, colors, }, }: NoticeProps<Option, IsMulti, Group>, unstyled: boolean) => CSSObjectWithLabel;
|
72 | export interface NoticeProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> extends CommonPropsAndClassName<Option, IsMulti, Group> {
|
73 |
|
74 | children: ReactNode;
|
75 |
|
76 | innerProps: JSX.IntrinsicElements['div'];
|
77 | }
|
78 | export declare const NoOptionsMessage: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ children, innerProps, ...restProps }: NoticeProps<Option, IsMulti, Group>) => jsx.JSX.Element;
|
79 | export declare const LoadingMessage: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ children, innerProps, ...restProps }: NoticeProps<Option, IsMulti, Group>) => jsx.JSX.Element;
|
80 | export interface MenuPortalProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> extends CommonPropsAndClassName<Option, IsMulti, Group> {
|
81 | appendTo: HTMLElement | undefined;
|
82 | children: ReactNode;
|
83 | controlElement: HTMLDivElement | null;
|
84 | innerProps: JSX.IntrinsicElements['div'];
|
85 | menuPlacement: MenuPlacement;
|
86 | menuPosition: MenuPosition;
|
87 | }
|
88 | export interface PortalStyleArgs {
|
89 | offset: number;
|
90 | position: MenuPosition;
|
91 | rect: {
|
92 | left: number;
|
93 | width: number;
|
94 | };
|
95 | }
|
96 | export declare const menuPortalCSS: ({ rect, offset, position, }: PortalStyleArgs) => CSSObjectWithLabel;
|
97 | export declare const MenuPortal: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: MenuPortalProps<Option, IsMulti, Group>) => jsx.JSX.Element | null;
|