1 | import PropTypes from 'prop-types';
|
2 | import React from 'react';
|
3 | import { DropdownContextValue } from './DropdownContext';
|
4 | export interface UseDropdownToggleProps {
|
5 | ref: DropdownContextValue['setToggle'];
|
6 | onClick: React.MouseEventHandler;
|
7 | 'aria-haspopup': boolean;
|
8 | 'aria-expanded': boolean;
|
9 | }
|
10 | export interface UseDropdownToggleMetadata {
|
11 | show: DropdownContextValue['show'];
|
12 | toggle: DropdownContextValue['toggle'];
|
13 | }
|
14 | /**
|
15 | * Wires up Dropdown toggle functionality, returning a set a props to attach
|
16 | * to the element that functions as the dropdown toggle (generally a button).
|
17 | *
|
18 | * @memberOf Dropdown
|
19 | */
|
20 | export declare function useDropdownToggle(): [
|
21 | UseDropdownToggleProps,
|
22 | UseDropdownToggleMetadata
|
23 | ];
|
24 | export interface DropdownToggleProps {
|
25 | children: (props: UseDropdownToggleProps, meta: UseDropdownToggleMetadata) => React.ReactNode;
|
26 | }
|
27 | /**
|
28 | * Also exported as `<Dropdown.Toggle>` from `Dropdown`.
|
29 | *
|
30 | * @displayName DropdownToggle
|
31 | * @memberOf Dropdown
|
32 | */
|
33 | declare function DropdownToggle({ children }: DropdownToggleProps): JSX.Element;
|
34 | declare namespace DropdownToggle {
|
35 | var displayName: string;
|
36 | var propTypes: {
|
37 | /**
|
38 | * A render prop that returns a Toggle element. The `props`
|
39 | * argument should spread through to **a component that can accept a ref**. Use
|
40 | * the `onToggle` argument to toggle the menu open or closed
|
41 | *
|
42 | * @type {Function ({
|
43 | * show: boolean,
|
44 | * toggle: (show: boolean) => void,
|
45 | * props: {
|
46 | * ref: (?HTMLElement) => void,
|
47 | * aria-haspopup: true
|
48 | * aria-expanded: boolean
|
49 | * },
|
50 | * }) => React.Element}
|
51 | */
|
52 | children: PropTypes.Validator<(...args: any[]) => any>;
|
53 | };
|
54 | }
|
55 | /** @component */
|
56 | export default DropdownToggle;
|