mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 16:35:14 +00:00
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import { DropdownContextValue } from './DropdownContext';
|
|
export interface UseDropdownToggleProps {
|
|
ref: DropdownContextValue['setToggle'];
|
|
onClick: React.MouseEventHandler;
|
|
'aria-haspopup': boolean;
|
|
'aria-expanded': boolean;
|
|
}
|
|
export interface UseDropdownToggleMetadata {
|
|
show: DropdownContextValue['show'];
|
|
toggle: DropdownContextValue['toggle'];
|
|
}
|
|
/**
|
|
* Wires up Dropdown toggle functionality, returning a set a props to attach
|
|
* to the element that functions as the dropdown toggle (generally a button).
|
|
*
|
|
* @memberOf Dropdown
|
|
*/
|
|
export declare function useDropdownToggle(): [
|
|
UseDropdownToggleProps,
|
|
UseDropdownToggleMetadata
|
|
];
|
|
export interface DropdownToggleProps {
|
|
children: (props: UseDropdownToggleProps, meta: UseDropdownToggleMetadata) => React.ReactNode;
|
|
}
|
|
/**
|
|
* Also exported as `<Dropdown.Toggle>` from `Dropdown`.
|
|
*
|
|
* @displayName DropdownToggle
|
|
* @memberOf Dropdown
|
|
*/
|
|
declare function DropdownToggle({ children }: DropdownToggleProps): JSX.Element;
|
|
declare namespace DropdownToggle {
|
|
var displayName: string;
|
|
var propTypes: {
|
|
/**
|
|
* A render prop that returns a Toggle element. The `props`
|
|
* argument should spread through to **a component that can accept a ref**. Use
|
|
* the `onToggle` argument to toggle the menu open or closed
|
|
*
|
|
* @type {Function ({
|
|
* show: boolean,
|
|
* toggle: (show: boolean) => void,
|
|
* props: {
|
|
* ref: (?HTMLElement) => void,
|
|
* aria-haspopup: true
|
|
* aria-expanded: boolean
|
|
* },
|
|
* }) => React.Element}
|
|
*/
|
|
children: PropTypes.Validator<(...args: any[]) => any>;
|
|
};
|
|
}
|
|
/** @component */
|
|
export default DropdownToggle;
|