UNPKG

1.69 kBTypeScriptView Raw
1import type { SegmentedLabeledOption as RcSegmentedLabeledOption, SegmentedProps as RCSegmentedProps, SegmentedValue as RcSegmentedValue, SegmentedRawOption } from 'rc-segmented';
2import * as React from 'react';
3import type { SizeType } from '../config-provider/SizeContext';
4export type { SegmentedValue } from 'rc-segmented';
5interface SegmentedLabeledOptionWithoutIcon<ValueType = RcSegmentedValue> extends RcSegmentedLabeledOption<ValueType> {
6 label: RcSegmentedLabeledOption['label'];
7}
8interface SegmentedLabeledOptionWithIcon<ValueType = RcSegmentedValue> extends Omit<RcSegmentedLabeledOption<ValueType>, 'label'> {
9 label?: RcSegmentedLabeledOption['label'];
10 /** Set icon for Segmented item */
11 icon: React.ReactNode;
12}
13export type SegmentedLabeledOption<ValueType = RcSegmentedValue> = SegmentedLabeledOptionWithIcon<ValueType> | SegmentedLabeledOptionWithoutIcon<ValueType>;
14export type SegmentedOptions<T = SegmentedRawOption> = (T | SegmentedLabeledOption<T>)[];
15export interface SegmentedProps<ValueType = RcSegmentedValue> extends Omit<RCSegmentedProps<ValueType>, 'size' | 'options'> {
16 rootClassName?: string;
17 options: SegmentedOptions<ValueType>;
18 /** Option to fit width to its parent's width */
19 block?: boolean;
20 /** Option to control the display size */
21 size?: SizeType;
22}
23declare const InternalSegmented: React.ForwardRefExoticComponent<Omit<SegmentedProps<RcSegmentedValue>, "ref"> & React.RefAttributes<HTMLDivElement>>;
24declare const Segmented: (<ValueType>(props: SegmentedProps<ValueType> & React.RefAttributes<HTMLDivElement>) => ReturnType<typeof InternalSegmented>) & Pick<React.FC<{}>, "displayName">;
25export default Segmented;
26
\No newline at end of file