/** * 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 ReactNode, type SelectHTMLAttributes } from 'react'; import { type FieldSize } from '../Field/index.js'; export type SelectOption = { value: string | number; label: string; disabled?: boolean; [key: string]: unknown; }; export interface SelectProps extends Omit, 'size'> { children?: ReactNode; /** * A clear and concise description of the select purpose. */ label: string; /** * Name of the select form element. */ name?: string; /** * Options to select from. Can also be provided with the children prop. */ options?: SelectOption[]; /** * Styles the select as disabled. */ disabled?: boolean; /** * Triggers error styles on the component. Important for accessibility. */ invalid?: boolean; /** * Currently selected value. Matches the "value" property of the options * objects. If value is falsy, Select will render the "placeholder" prop as * currently selected. */ value?: string | number; defaultValue?: string | number; /** * String to show when no selection is made. */ placeholder?: string; /** * Render prop that should render a left-aligned overlay icon or element. * Receives a className prop. */ renderPrefix?: ComponentType<{ value?: string | number; className?: string; }>; /** * An information or error message, displayed below the select. */ validationHint?: string; /** * Label to indicate that the select is optional. Only displayed when the * `required` prop is falsy. */ optionalLabel?: string; /** * 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; /** * A unique identifier for the input field. If not defined, a randomly * generated id is used. */ id?: string; /** * Choose from 2 sizes. * @default m */ size?: FieldSize; } /** * A native select component. */ export declare const Select: import("react").ForwardRefExoticComponent>;