import React from 'react'; import classNames from 'classnames'; import { TextInput as CoreTextInput } from '@shoptet/ui-core-web'; import type { SafeOmit } from '@shoptet/utils'; import type { Complete, Exact, Size } from '../../../types'; import type { CommonInputProps, PlaceholderProps } from '../types'; export interface TextInputCommonProps extends SafeOmit, PlaceholderProps {} export interface TextInputOwnProps { label?: string; value?: string | number; defaultValue?: string | number; width?: Size; } /** @inheritdoc */ export interface TextInputProps extends TextInputOwnProps, TextInputCommonProps {} type GetInputClassName = Complete>; export const getTextInputClassName = ({ width, error, warning }: GetInputClassName) => classNames('textField', width, { 'error-field': error, 'warning-field': warning && !error, }); export const TextInput = React.forwardRef( ({ width = 'md', error, warning, label, value, defaultValue, ...rest }, ref) => { rest satisfies Exact & PlaceholderProps, typeof rest>; return ( ); } ); TextInput.displayName = 'TextInput';