'use client'; import type * as React from 'react'; import { classNames } from '@vkontakte/vkjs'; import { useMergeProps } from '../../../hooks/useMergeProps'; import { warnOnce } from '../../../lib/warnOnce'; import type { HasDataAttribute, HasRootRef } from '../../../types'; import { AdaptiveIconRenderer } from '../../AdaptiveIconRenderer/AdaptiveIconRenderer'; import { RootComponent } from '../../RootComponent/RootComponent'; import { VisuallyHidden } from '../../VisuallyHidden/VisuallyHidden'; import styles from './RadioInput.module.css'; const warn = warnOnce('Radio.Input'); function RadioIcon24(props: React.ComponentProps<'svg'>) { return ( ); } function RadioIcon20(props: React.ComponentProps<'svg'>) { return ( ); } function RadioIcon() { return (
); } export interface RadioInputProps extends Pick< React.ComponentProps<'input'>, | 'checked' | 'defaultChecked' | 'disabled' | 'readOnly' | 'required' | 'autoFocus' | 'onChange' | 'name' | 'value' | 'onFocus' | 'onBlur' >, Omit, 'onChange' | 'onFocus' | 'onBlur'>, HasRootRef { /** * Свойства, которые можно прокинуть внутрь компонента: * - `root`: свойства для прокидывания в корень компонента; * - `input`: свойства для прокидывания в скрытый `input`. */ slotProps?: | { root?: | (Omit, 'children'> & HasRootRef & HasDataAttribute) | undefined; input?: | (Omit, 'type'> & HasRootRef & HasDataAttribute) | undefined; } | undefined; /** * @deprecated Since 7.9.0. Вместо этого используйте `slotProps={ input: { getRootRef: ... } }`. */ getRef?: React.Ref | undefined; } export function RadioInput({ getRef, // Input props checked, defaultChecked, disabled, readOnly, required, autoFocus, id, name, value, onChange, onFocus, onBlur, slotProps, ...restProps }: RadioInputProps) { if (process.env.NODE_ENV === 'development' && getRef) { warn('Свойство `getRef` устаревшее, используйте `slotProps={ input: { getRootRef: ... } }`'); } const rootRest = useMergeProps(restProps, slotProps?.root); const { className: inputClassName, ...inputProps } = useMergeProps( { getRootRef: getRef, checked, defaultChecked, disabled, readOnly, required, autoFocus, id, name, value, onChange, onFocus, onBlur, }, slotProps?.input, ); return ( ); }