UNPKG

@wix/design-system

Version:

@wix/design-system

41 lines 1.87 kB
import React, { CSSProperties, FocusEventHandler, ReactNode } from 'react'; import { SIZES, ALIGN_ITEMS } from './Radio.constants'; import { ValuesOf } from '../utils/typeUtils'; export type RadioAlignItems = ValuesOf<typeof ALIGN_ITEMS>; export type RadioSize = ValuesOf<typeof SIZES>; export type OnChangeEvent = Pick<RadioProps, 'value'> & React.ChangeEvent; export interface RadioProps { /** Applies a data-hook HTML attribute that can be used in tests. */ dataHook?: string; /** * Specifies a CSS class name to be appended to the component’s root element. * @internal */ className?: string; /** Specifies whether a radio is selected. */ checked?: boolean; /** Specifies whether radio should be disabled. */ disabled?: boolean; /** Sets the label on the right side of a radio. The default accepted value is a text string, but it can be overridden to any other component. */ label?: ReactNode; /** Assigns an unique identifier for the radio. */ id?: string; /** Sets the value that the radio represents. */ value?: string | number; /** Sets a unique name for the radio. */ name?: string; /** Defines a callback function which is called when radio is selected. */ onChange?(event: OnChangeEvent): void; /** Defines a callback function which is called when cursor enters radio. */ onMouseEnter?(event: OnChangeEvent): void; /** Defines a callback function which is called when cursor leaves radio. */ onMouseLeave?(event: OnChangeEvent): void; /** Control radio alignment with a label. */ alignItems?: RadioAlignItems; /** Control size. */ size?: RadioSize; style?: CSSProperties; focusableOnFocus?: FocusEventHandler<HTMLInputElement>; focusableOnBlur?: FocusEventHandler<HTMLInputElement>; } //# sourceMappingURL=Radio.types.d.ts.map