index.d.ts 1.7 KB

123456789101112131415161718192021222324252627
  1. import * as React from 'react';
  2. import type { SegmentedLabeledOption as RcSegmentedLabeledOption, SegmentedProps as RCSegmentedProps, SegmentedValue as RcSegmentedValue, SegmentedRawOption } from 'rc-segmented';
  3. import type { SizeType } from '../config-provider/SizeContext';
  4. export type { SegmentedValue } from 'rc-segmented';
  5. interface SegmentedLabeledOptionWithoutIcon<ValueType = RcSegmentedValue> extends RcSegmentedLabeledOption<ValueType> {
  6. label: RcSegmentedLabeledOption['label'];
  7. }
  8. interface SegmentedLabeledOptionWithIcon<ValueType = RcSegmentedValue> extends Omit<RcSegmentedLabeledOption<ValueType>, 'label'> {
  9. label?: RcSegmentedLabeledOption['label'];
  10. /** Set icon for Segmented item */
  11. icon: React.ReactNode;
  12. }
  13. export type SegmentedLabeledOption<ValueType = RcSegmentedValue> = SegmentedLabeledOptionWithIcon<ValueType> | SegmentedLabeledOptionWithoutIcon<ValueType>;
  14. export type SegmentedOptions<T = SegmentedRawOption> = (T | SegmentedLabeledOption<T>)[];
  15. export 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. vertical?: boolean;
  23. shape?: 'default' | 'round';
  24. }
  25. declare const InternalSegmented: React.ForwardRefExoticComponent<Omit<SegmentedProps<RcSegmentedValue>, "ref"> & React.RefAttributes<HTMLDivElement>>;
  26. declare const Segmented: (<ValueType>(props: SegmentedProps<ValueType> & React.RefAttributes<HTMLDivElement>) => ReturnType<typeof InternalSegmented>) & Pick<React.FC, "displayName">;
  27. export default Segmented;