import React, { forwardRef } from 'react'; import { useIsDesktop } from '@alfalab/core-components-mq'; import { type BaseInputProps } from './components/base-input'; import { InputDesktop } from './desktop'; import { InputMobile } from './mobile'; export type InputProps = Omit & { /** * Контрольная точка, с нее начинается desktop версия * @default 1024 */ breakpoint?: number; /** * Версия, которая будет использоваться при серверном рендеринге */ client?: 'desktop' | 'mobile'; /** * Значение по-умолчанию для хука useMatchMedia * @deprecated Используйте client */ defaultMatchMediaValue?: boolean | (() => boolean); }; export const Input = forwardRef( ( { breakpoint, client, defaultMatchMediaValue = client === undefined ? undefined : client === 'desktop', ...restProps }, ref, ) => { const isDesktop = useIsDesktop(breakpoint, defaultMatchMediaValue); const Component = isDesktop ? InputDesktop : InputMobile; return ; }, ); Input.displayName = 'Input';