wix-style-react
Version:
wix-style-react
182 lines • 9.63 kB
TypeScript
export default DropdownBase;
declare class DropdownBase extends React.PureComponent<any, any, any> {
static displayName: string;
static propTypes: {
/** Applies a data-hook HTML attribute that can be used in the tests */
dataHook: PropTypes.Requireable<string>;
/** Specifies a CSS class name to be appended to the component’s root element */
className: PropTypes.Requireable<string>;
/** Control whether the <Popover/> should be opened */
open: PropTypes.Requireable<boolean>;
/** Control popover placement */
placement: PropTypes.Requireable<string>;
/** Specifies where popover should be inserted as a last child - whether `parent` or `window` containers */
appendTo: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
/** Specifies whether popover arrow should be shown */
showArrow: PropTypes.Requireable<boolean>;
/** Defines a callback function which is called when user clicks outside of a dropdown */
onClickOutside: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called on `onMouseEnter` event on the entire component */
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called on `onMouseLeave` event on the entire component */
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called when dropdown is opened */
onShow: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called when dropdown is closed */
onHide: PropTypes.Requireable<(...args: any[]) => any>;
/** Defines a callback function which is called whenever user selects a different option in the list */
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
/**
* Set popover's content width to a minimum width of a trigger element,
* but it can expand up to the defined value of `maxWidth`
*/
dynamicWidth: PropTypes.Requireable<boolean>;
/** Controls the minimum width of dropdown layout */
minWidth: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
/** Controls the maximum width of dropdown layout */
maxWidth: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
/** Controls the maximum height of dropdown layout */
maxHeight: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
/**
* Specifies a target component to be rendered. If a regular node is passed, it'll be rendered as-is.
* If a function is passed, it's expected to return a React element.
* The function accepts an object containing the following properties:
*
* * `open` - will open the Popover
* * `close` - will close the Popover
* * `toggle` - will toggle the Popover
* * `isOpen` - indicates whether the items list is currently open
* * `delegateKeyDown` - the underlying DropdownLayout's keydown handler. It can be called
* inside another keyDown event in order to delegate it.
* * `selectedOption` - the currently selected option
*
* Check inserted component documentation for more information on available properties.
*/
children: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactNodeLike>>;
/**
* Specifies an array of options for a dropdown list. Objects must have an id and can include string value or node.
* If value is '-', a divider will be rendered instead (dividers do not require and id).
*/
options: PropTypes.Requireable<(NonNullable<PropTypes.InferProps<{
id: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
value: PropTypes.Validator<NonNullable<NonNullable<((...args: any[]) => any) | PropTypes.ReactNodeLike>>>;
disabled: PropTypes.Requireable<boolean>;
overrideStyle: PropTypes.Requireable<boolean>;
}> | PropTypes.InferProps<{
value: PropTypes.Requireable<string>;
}> | null | undefined> | null | undefined)[]>;
/** Sets the initial marking of an option in the list when opened:
* - `false` - no initially hovered list item
* - `true` - hover first selectable option
* - any `number/string` specify the id of an option to be hovered
*/
markedOption: PropTypes.Requireable<NonNullable<string | number | boolean | null | undefined>>;
/** Define the selected option in the list */
selectedId: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
/** Handles container overflow behaviour */
overflow: PropTypes.Requireable<string>;
/** Indicates that element can be focused and where it participates in sequential keyboard navigation */
tabIndex: PropTypes.Requireable<number>;
/**
* Sets the initially selected option in the list. Used when selection
* behaviour is being controlled.
*/
initialSelectedId: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
/** Specifies the stack order (`z-index`) of a dropdown layout */
zIndex: PropTypes.Requireable<number>;
/** Moves dropdown content relative to the parent on X or Y axis by a defined amount of pixels */
moveBy: PropTypes.Requireable<PropTypes.InferProps<{
x: PropTypes.Requireable<number>;
y: PropTypes.Requireable<number>;
}>>;
/**
* Specifies whether to flip the <Popover/> placement
* when it starts to overlap the target element (<Popover.Element/>)
*/
flip: PropTypes.Requireable<boolean>;
/**
* Specifies whether to enable the fixed behaviour. If enabled, <Popover/> keep its
* original placement even when it's being positioned outside the boundary.
*/
fixed: PropTypes.Requireable<boolean>;
/** Stretches trigger element to fill its parent container width */
fluid: PropTypes.Requireable<boolean>;
/** Adds enter and exit animation */
animate: PropTypes.Requireable<boolean>;
/** Focus to the selected option when dropdown is opened */
focusOnSelectedOption: PropTypes.Requireable<boolean>;
/** Specifies whether lazy loading of the dropdown items is enabled */
infiniteScroll: PropTypes.Requireable<boolean>;
/** Defines a callback function which is called on a request to render more list items */
loadMore: PropTypes.Requireable<(...args: any[]) => any>;
/** Specifies whether there are more items to load */
hasMore: PropTypes.Requireable<boolean>;
/** Focus to the specified option when dropdown is opened */
focusOnOption: PropTypes.Requireable<number>;
/** Scrolls to the specified option when dropdown is opened without marking it */
scrollToOption: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
/** Defines type of behavior applied in list */
listType: PropTypes.Requireable<string>;
/** A fixed header to the list */
fixedHeader: PropTypes.Requireable<PropTypes.ReactNodeLike>;
/** A fixed footer to the list */
fixedFooter: PropTypes.Requireable<PropTypes.ReactNodeLike>;
/** Specifies whether first list item should be focused */
autoFocus: PropTypes.Requireable<boolean>;
};
static defaultProps: {
placement: string;
appendTo: string;
showArrow: boolean;
maxHeight: string;
fluid: boolean;
animate: boolean;
listType: string;
onShow: () => void;
onHide: () => void;
};
constructor(props: any);
triggerElementRef: React.RefObject<any>;
_dropdownLayoutRef: null;
_shouldCloseOnMouseLeave: boolean;
state: {
open: any;
selectedId: any;
listAutoFocus: boolean;
};
/**
* Return `true` if the `open` prop is being controlled
*/
_isControllingOpen: (props?: Readonly<any>) => boolean;
/**
* Return `true` if the selection behaviour is being controlled
*/
_isControllingSelection: (props?: Readonly<any>) => boolean;
_open: () => void;
_close: (e: any) => void;
_toggle: () => void;
_handleClickOutside: () => void;
_handlePopoverMouseEnter: () => void;
_handlePopoverMouseLeave: () => void;
_handleSelect: (selectedOption: any) => void;
_handleClose: () => void;
_getSelectedOption: (selectedId: any) => any;
/**
* Determine if a certain key should open the DropdownLayout
*/
_isOpenKey: (key: any) => boolean;
_isClosingKey: (key: any) => 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: any) => void;
_delegateKeyDown: (e: any) => any;
UNSAFE_componentWillReceiveProps(nextProps: any): void;
_renderChildren(): any;
render(): React.JSX.Element;
}
import React from 'react';
import PropTypes from 'prop-types';
//# sourceMappingURL=DropdownBase.d.ts.map