UNPKG

2.52 kBTypeScriptView Raw
1/** @jsx jsx */
2import { ComponentType, ReactNode } from 'react';
3import { jsx } from '@emotion/react';
4import { CommonProps, CommonPropsAndClassName, CSSObjectWithLabel, CX, GetStyles, GroupBase, Options, Theme } from '../types';
5import { Props } from '../Select';
6export interface ForwardedHeadingProps<Option, Group extends GroupBase<Option>> {
7 id: string;
8 data: Group;
9}
10export interface GroupProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> extends CommonPropsAndClassName<Option, IsMulti, Group> {
11 /** The children to be rendered. */
12 children: ReactNode;
13 /** Component to wrap the label, receives headingProps. */
14 Heading: ComponentType<GroupHeadingProps<Option, IsMulti, Group>>;
15 /** Props to pass to Heading. */
16 headingProps: ForwardedHeadingProps<Option, Group>;
17 /** Props to be passed to the group element. */
18 innerProps: JSX.IntrinsicElements['div'];
19 /** Label to be displayed in the heading component. */
20 label: ReactNode;
21 /** The data of the group. */
22 data: Group;
23 options: Options<Option>;
24}
25export declare const groupCSS: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ theme: { spacing } }: GroupProps<Option, IsMulti, Group>, unstyled: boolean) => CSSObjectWithLabel;
26declare const Group: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: GroupProps<Option, IsMulti, Group>) => jsx.JSX.Element;
27interface GroupHeadingPropsDefinedProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> extends ForwardedHeadingProps<Option, Group> {
28 className?: string | undefined;
29 selectProps: Props<Option, IsMulti, Group>;
30 theme: Theme;
31 getStyles: GetStyles<Option, IsMulti, Group>;
32 getClassNames: CommonProps<Option, IsMulti, Group>['getClassNames'];
33 cx: CX;
34}
35export declare type GroupHeadingProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> = GroupHeadingPropsDefinedProps<Option, IsMulti, Group> & JSX.IntrinsicElements['div'];
36export declare const groupHeadingCSS: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ theme: { colors, spacing } }: GroupHeadingProps<Option, IsMulti, Group>, unstyled: boolean) => CSSObjectWithLabel;
37export declare const GroupHeading: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: GroupHeadingProps<Option, IsMulti, Group>) => jsx.JSX.Element;
38export default Group;