UNPKG

2.48 kBTypeScriptView Raw
1import * as React from 'react';
2import { PolymorphicProps, SlotComponentProps } from '../utils';
3export interface OptionGroupRootSlotPropsOverrides {
4}
5export interface OptionGroupLabelSlotPropsOverrides {
6}
7export interface OptionGroupListSlotPropsOverrides {
8}
9export interface OptionGroupOwnProps {
10 /**
11 * The human-readable description of the group.
12 */
13 label?: React.ReactNode;
14 className?: string;
15 children?: React.ReactNode;
16 /**
17 * If `true` all the options in the group will be disabled.
18 * @default false
19 */
20 disabled?: boolean;
21 /**
22 * The components used for each slot inside the OptionGroup.
23 * Either a string to use a HTML element or a component.
24 * @default {}
25 */
26 slots?: OptionGroupSlots;
27 /**
28 * The props used for each slot inside the Input.
29 * @default {}
30 */
31 slotProps?: {
32 root?: SlotComponentProps<'li', OptionGroupRootSlotPropsOverrides, OptionGroupOwnerState>;
33 label?: SlotComponentProps<'span', OptionGroupLabelSlotPropsOverrides, OptionGroupOwnerState>;
34 list?: SlotComponentProps<'ul', OptionGroupListSlotPropsOverrides, OptionGroupOwnerState>;
35 };
36}
37export interface OptionGroupSlots {
38 /**
39 * The component that renders the root.
40 * @default 'li'
41 */
42 root?: React.ElementType;
43 /**
44 * The component that renders the label.
45 * @default 'span'
46 */
47 label?: React.ElementType;
48 /**
49 * The component that renders the list.
50 * @default 'ul'
51 */
52 list?: React.ElementType;
53}
54export interface OptionGroupTypeMap<AdditionalProps = {}, RootComponentType extends React.ElementType = 'li'> {
55 props: OptionGroupOwnProps & AdditionalProps;
56 defaultComponent: RootComponentType;
57}
58export type OptionGroupProps<RootComponentType extends React.ElementType = OptionGroupTypeMap['defaultComponent']> = PolymorphicProps<OptionGroupTypeMap<{}, RootComponentType>, RootComponentType>;
59export type OptionGroupOwnerState = OptionGroupOwnProps;
60export type OptionGroupRootSlotProps = {
61 children?: React.ReactNode;
62 className?: string;
63 ownerState: OptionGroupOwnerState;
64 ref: React.Ref<HTMLLIElement>;
65};
66export type OptionGroupLabelSlotProps = {
67 children?: React.ReactNode;
68 className?: string;
69 ownerState: OptionGroupOwnerState;
70};
71export type OptionGroupListSlotProps = {
72 children?: React.ReactNode;
73 className?: string;
74 ownerState: OptionGroupOwnerState;
75};