/** * Copyright 2019, SumUp Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { type ComponentType, type InputHTMLAttributes } from 'react'; import { type FieldSize } from '../Field/index.js'; import classes from './Input.module.css'; export { classes }; /** * @deprecated * * Use the `HTMLInputElement` or `HTMLTextAreaElement` interfaces instead. */ export type InputElement = HTMLInputElement; export interface BaseInputProps { /** * A clear and concise description of the input purpose. */ label: string; /** * A unique identifier for the input field. If not defined, a randomly * generated id is used. */ id?: string; /** * Render prop that should render a left-aligned overlay icon or element. * Receives a className prop. */ renderPrefix?: ComponentType<{ className?: string; value?: InputHTMLAttributes['value']; }>; /** * Render prop that should render a right-aligned overlay icon or element. * Receives a className prop. */ renderSuffix?: ComponentType<{ className?: string; }>; /** * An information, warning or error message, displayed below the input. */ validationHint?: string; /** * Label to indicate that the input is optional. Only displayed when the * `required` prop is falsy. */ optionalLabel?: string; /** * Triggers error styles on the component. Important for accessibility. */ invalid?: boolean; /** * Triggers warning styles on the component. */ hasWarning?: boolean; /** * Enables valid styles on the component. */ showValid?: boolean; /** * Triggers readonly styles on the component. */ readOnly?: boolean; /** * Aligns text in the input * @default left */ textAlign?: 'left' | 'right'; /** * Visually hide the label. This should only be used in rare cases and only * if the purpose of the field can be inferred from other context. */ hideLabel?: boolean; /** * Class to overwrite the input element styles. */ inputClassName?: string; /** * Choose from 2 sizes. * @default m */ size?: FieldSize; /** * Disable password manager overlayes on non-credential inputs that might * be incorrectly classify as login fields. */ passwordManagerIgnore?: boolean; } export interface InputProps extends BaseInputProps, Omit, 'size'> { /** * @private * * Use the {@link TextArea} component. */ as?: 'input' | 'textarea'; } /** * Input component for forms. Takes optional prefix and suffix as render props. */ export declare const Input: import("react").ForwardRefExoticComponent>;