UNPKG

@douyinfe/semi-ui

Version:

A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.

85 lines (84 loc) 3.56 kB
import PropTypes from 'prop-types'; import React from 'react'; import { strings } from '@douyinfe/semi-foundation/lib/cjs/radio/constants'; import RadioGroupFoundation, { RadioGroupAdapter } from '@douyinfe/semi-foundation/lib/cjs/radio/radioGroupFoundation'; import { RadioChangeEvent } from '@douyinfe/semi-foundation/lib/cjs/radio/radioInnerFoundation'; import { ArrayElement } from '../_base/base'; import BaseComponent from '../_base/baseComponent'; import { RadioGroupButtonSize, RadioMode } from './context'; import { RadioType } from './radio'; export interface OptionItem { label?: React.ReactNode; value?: string | number; disabled?: boolean; extra?: React.ReactNode; style?: React.CSSProperties; className?: string; addonId?: string; addonStyle?: React.CSSProperties; addonClassName?: string; extraId?: string; } export type Options = string[] | Array<OptionItem>; export type RadioGroupProps = { defaultValue?: string | number; disabled?: boolean; name?: string; options?: Options; value?: string | number; onChange?: (event: RadioChangeEvent) => void; className?: string; children?: React.ReactNode; style?: React.CSSProperties; direction?: ArrayElement<typeof strings.DIRECTION_SET>; mode?: RadioMode; type?: RadioType; buttonSize?: RadioGroupButtonSize; prefixCls?: string; 'aria-label'?: React.AriaAttributes['aria-label']; 'aria-describedby'?: React.AriaAttributes['aria-describedby']; 'aria-errormessage'?: React.AriaAttributes['aria-errormessage']; 'aria-invalid'?: React.AriaAttributes['aria-invalid']; 'aria-labelledby'?: React.AriaAttributes['aria-labelledby']; 'aria-required'?: React.AriaAttributes['aria-required']; id?: string; }; export interface RadioGroupState { value?: any; } declare class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState> { static propTypes: { defaultValue: PropTypes.Requireable<any>; disabled: PropTypes.Requireable<boolean>; name: PropTypes.Requireable<string>; options: PropTypes.Requireable<any[]>; buttonSize: PropTypes.Requireable<"small" | "large" | "middle">; type: PropTypes.Requireable<"default" | "button" | "card" | "pureCard">; value: PropTypes.Requireable<any>; onChange: PropTypes.Requireable<(...args: any[]) => any>; children: PropTypes.Requireable<PropTypes.ReactNodeLike>; prefixCls: PropTypes.Requireable<string>; className: PropTypes.Requireable<string>; style: PropTypes.Requireable<object>; direction: PropTypes.Requireable<"horizontal" | "vertical">; mode: PropTypes.Requireable<"" | "advanced">; 'aria-label': PropTypes.Requireable<string>; 'aria-describedby': PropTypes.Requireable<string>; 'aria-errormessage': PropTypes.Requireable<string>; 'aria-invalid': PropTypes.Requireable<boolean>; 'aria-labelledby': PropTypes.Requireable<string>; 'aria-required': PropTypes.Requireable<boolean>; id: PropTypes.Requireable<string>; }; static defaultProps: Partial<RadioGroupProps>; foundation: RadioGroupFoundation; constructor(props: RadioGroupProps); componentDidMount(): void; componentDidUpdate(prevProps: RadioGroupProps): void; componentWillUnmount(): void; get adapter(): RadioGroupAdapter; onChange: (evt: RadioChangeEvent) => void; getFormatName: () => string; render(): React.JSX.Element; } export default RadioGroup;