/** * Copyright 2021, 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 InputHTMLAttributes, type ComponentType } from 'react'; import type { ClickEvent } from '../../types/events.js'; export interface ImageInputProps extends Omit, 'size' | 'onChange'> { /** * A clear and concise description of the ImageInput's purpose. */ label: string; /** * The visual component to render as an image input. * It should accept a `src` prop to render the image, and `aria-hidden` to * hide it from assistive technology. */ component: ComponentType<{ src?: string; 'aria-hidden': 'true'; }>; /** * A callback function to call when the user has selected an image. */ onChange: (event: File) => void | Promise; /** * A callback function to call when the input is cleared. */ onClear: (event: ClickEvent) => void | Promise; /** * An accessible label for the "clear" icon button. */ clearButtonLabel: string; /** * An accessible label to communicate the input's loading state. */ loadingLabel: string; /** * The source URL of an existing Avatar to be displayed in the ImageInput. */ src?: string; /** * A unique identifier for the input element. If not defined, a generated id * is used. */ id?: string; /** * Triggers error styles on the component. Important for accessibility. */ invalid?: boolean; /** * An information 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; /** * Visually hide the label. Default: `true`. */ hideLabel?: boolean; } /** * The ImageInput component allows users to upload images. */ export declare const ImageInput: ({ label, src, id: customId, clearButtonLabel, onChange, onClear, disabled, validationHint, required, invalid, optionalLabel, loadingLabel, hideLabel, component: Component, className, style, "aria-describedby": descriptionId, ...props }: ImageInputProps) => import("react/jsx-runtime").JSX.Element;