UNPKG

1.55 kBTypeScriptView Raw
1/** @jsx jsx */
2import { ReactNode, RefCallback } from 'react';
3import { jsx } from '@emotion/react';
4import { CommonPropsAndClassName, CSSObjectWithLabel, GroupBase } from '../types';
5export interface OptionProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> extends CommonPropsAndClassName<Option, IsMulti, Group> {
6 /** The children to be rendered. */
7 children: ReactNode;
8 /** Inner ref to DOM Node */
9 innerRef: RefCallback<HTMLDivElement>;
10 /** props passed to the wrapping element for the group. */
11 innerProps: JSX.IntrinsicElements['div'];
12 /** Text to be displayed representing the option. */
13 label: string;
14 /** Type is used by the menu to determine whether this is an option or a group.
15 In the case of option this is always `option`. **/
16 type: 'option';
17 /** The data of the selected option. */
18 data: Option;
19 /** Whether the option is disabled. */
20 isDisabled: boolean;
21 /** Whether the option is focused. */
22 isFocused: boolean;
23 /** Whether the option is selected. */
24 isSelected: boolean;
25}
26export declare const optionCSS: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ isDisabled, isFocused, isSelected, theme: { spacing, colors }, }: OptionProps<Option, IsMulti, Group>, unstyled: boolean) => CSSObjectWithLabel;
27declare const Option: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: OptionProps<Option, IsMulti, Group>) => jsx.JSX.Element;
28export default Option;