import React from 'react'; import { ColorTokens } from '../../../foundation/Colors'; import { TypographyTokens } from '../../../foundation/Typography'; import { ExclaimTooltipProps } from '../../ExclaimTooltip'; import { TooltipLabel } from '../../TooltipLabel'; import { Typography } from '../../Typography'; import { FieldStyleProps } from '../_common/common.styled'; import { BottomBox, TextFieldBottomBox, TextFieldBox, TextInputStyled } from './TextField.styled'; export type TextFieldProps = { autoFocus?: boolean; bottomLeftText?: string; bottomLeftTextColorToken?: ColorTokens; bottomLeftTextTypographyToken?: TypographyTokens; disabled?: boolean; error?: boolean; id?: string; label?: string; labelAttentionIndicatorColorToken?: ColorTokens; labelColorToken?: ColorTokens; labelTypographyToken?: TypographyTokens; name?: string; onChange?: (value: string | undefined) => void; onFocus?: () => void; placeHolder?: string; tooltip?: ExclaimTooltipProps['children']; tooltipColorToken?: ColorTokens; type?: HTMLInputElement['type']; value?: string; } & FieldStyleProps; export const TextField: React.FunctionComponent = ({ onChange, value, disabled, error, labelColorToken = 'white300', labelTypographyToken = 'bodySmallMedium', label, tooltipColorToken, tooltip, type = 'text', placeHolder, typographyToken = 'bodyMediumMedium', name, labelAttentionIndicatorColorToken, bottomLeftTextTypographyToken = 'bodyXSmallMedium', bottomLeftTextColorToken = 'white300', bottomLeftText, borderColorToken = 'black700', backgroundColorToken = 'black900', hoverBackgroundColorToken = 'black800', disabledBackgroundColorToken = 'black900', placeholderColorToken = 'white950', disabledColorToken = 'white950', errorBorderColorToken = 'error800', errorColorToken = 'error400', colorToken = 'white100', hoverBorderColorToken = 'black700', hoverErrorBorderColorToken = 'error800', hoverColorToken = colorToken, hoverErrorColorToken = 'error100', disabledBorderColorToken = 'black700', autoFocus = false, id, onFocus, }) => { const handleOnChange = (event: React.ChangeEvent) => { typeof onChange === 'function' && onChange(event.target.value); }; return ( {bottomLeftText ? ( {bottomLeftText ? ( {bottomLeftText} ) : null} ) : null} ); };