/*! * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved. * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (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 { AutocompleteProps as MuiAutocompleteProps, UseAutocompleteProps as MuiUseAutocompleteProps } from "@mui/material"; import type { HtmlProps } from "./HtmlProps.js"; import { FieldComponentProps } from "./FieldComponentProps.js"; export type AutocompleteProps = { /** * The default value. Use when the component is not controlled. */ defaultValue?: MuiUseAutocompleteProps["defaultValue"]; /** * Determines the filtered options to display when typing in the input. Defaults to MUI's client-side substring match against `getOptionLabel`. Override this (e.g. `(options) => options`) when `options` is already filtered server-side, to avoid MUI re-filtering already-matching results away. */ filterOptions?: MuiAutocompleteProps["filterOptions"]; /** * Used to determine if the option represents the given value. Uses strict equality by default if none provided. Both arguments need to be handled, an option can only match with one value. option: the option to test value: the value to test against * * You will need to implement this function if your `option` items are objects. */ getIsOptionEqualToValue?: (option: OptionType, value: OptionType) => boolean; /** * Used to determine the string value for a given option. It's used to fill the input (and the list box options if renderOption is not provided). If used in free solo mode, it must accept both the type of the options and a string. * * `function(option: Value) => string` */ getOptionLabel?: MuiUseAutocompleteProps["getOptionLabel"]; /** * Whether multiple options can be selected simultaneously. */ hasMultipleChoices?: MuiAutocompleteProps["multiple"]; /** * The value for the input */ inputValue?: MuiUseAutocompleteProps["inputValue"]; /** * If `true`, the user can type a custom value not present in the options list. */ isCustomValueAllowed?: MuiAutocompleteProps["freeSolo"]; /** * If `true`, the Autocomplete input is disabled. */ isDisabled?: MuiAutocompleteProps["disabled"]; /** * If `true`, a loading indicator is shown in place of the options list. */ isLoading?: MuiAutocompleteProps["loading"]; /** * If `true`, the Autocomplete input is read-only. */ isReadOnly?: MuiAutocompleteProps["readOnly"]; /** * If `true`, renders the options list using virtualization. Recommended when the list contains hundreds of items or more. */ isVirtualized?: boolean; /** * The label text for the autocomplete input */ label: string; /** * The text to display when no options are available. * @default "No options" */ noOptionsText?: string; /** * Called when the Autocomplete loses focus. */ onBlur?: MuiAutocompleteProps["onBlur"]; /** * Called when the selected value changes. */ onChange?: MuiUseAutocompleteProps["onChange"]; /** * Called when the Autocomplete gains focus. */ onFocus?: MuiAutocompleteProps["onFocus"]; /** * Called when the text input value changes. Receives the new input string. */ onInputChange?: MuiAutocompleteProps["onInputChange"]; /** * The options for the Autocomplete input */ options: ReadonlyArray; /** * The value of the Autocomplete input */ value?: MuiUseAutocompleteProps["value"]; } & Pick & Pick; /** * An input field with a dropdown list of selectable options that supports filtering, multi-select, and free-text entry. Use when users need to search or choose from a potentially large set of values. */ declare const Autocomplete: ({ ariaDescribedBy, defaultValue, errorMessage, errorMessageList, filterOptions, getIsOptionEqualToValue, getOptionLabel, hasMultipleChoices, hint, HintLinkComponent, id: idOverride, inputValue, isCustomValueAllowed, isDisabled, isFullWidth, isLoading, isOptional, isReadOnly, isVirtualized, label, name: nameOverride, noOptionsText, onBlur, onChange, onFocus, onInputChange, options, testId, translate, value, }: AutocompleteProps) => import("@emotion/react/jsx-runtime").JSX.Element; declare const MemoizedAutocomplete: typeof Autocomplete & { displayName?: string; }; export { MemoizedAutocomplete as Autocomplete }; //# sourceMappingURL=Autocomplete.d.ts.map