/* * Copyright (c) 2025, Salesforce, Inc. * All rights reserved. * For full license text, see the LICENSE.txt file */ /** * The `lightning/inputAddress` component represents an address compound field, allowing users to enter and edit address information in a structured format. * @see {@link https://developer.salesforce.com/docs/component-library/bundle/lightning-input-address/documentation | Lightning Input Address Documentation} */ declare module "lightning/inputAddress" { import type { LightningElement } from "lwc"; /** * Represents a label-value option for picklists. */ export interface LabelValueOption { label: string; value: string; } /** * Represents an array of label-value options for picklists. */ export type LabelValueOptions = Array; /** * A component that represents an address compound field. */ export default class LightningInputAddress extends LightningElement { /** * The label for the address compound field. */ addressLabel: string; /** * The label for the street field. */ streetLabel: string; /** * The label for the subpremise field. Use this attribute with show-compact-address. */ subpremiseLabel: string; /** * The label for the city field. */ cityLabel: string; /** * The label for the province field. */ provinceLabel: string; /** * The label for the country field. */ countryLabel: string; /** * The label for the postal code field. */ postalCodeLabel: string; /** * The placeholder for the street field. */ streetPlaceholder: string; /** * The placeholder for the subpremise field. Use this attribute with show-compact-address. */ subpremisePlaceholder: string; /** * The placeholder for the city field. */ cityPlaceholder: string; /** * The placeholder for the province field. */ provincePlaceholder: string; /** * The placeholder for the country field. */ countryPlaceholder: string; /** * The placeholder for the postal code field. */ postalCodePlaceholder: string; /** * The placeholder for the address lookup field option. Visible only when using show-address-lookup. */ addressLookupPlaceholder: string; /** * The label for the address lookup field option. Only visible when show-address-lookup is set to true and label string is passed. */ addressLookupLabel: string; /** * The array of label-value pairs for the province. Displays a dropdown menu of options. */ provinceOptions: LabelValueOptions; /** * If present, the province field is hidden from the UI and users cannot interact with it. * Defaults to false. */ hideProvince: boolean; /** * The array of label-value pairs for the country. Displays a dropdown menu of options. */ countryOptions: LabelValueOptions; /** * If present, the country field is disabled and users cannot interact with it. * Defaults to false. */ countryDisabled: boolean; /** * Specifies the locale used to determine the layout of the address fields. Defaults to en-US. */ locale: string; /** * If present, an address lookup field using Google Maps is displayed. When used with show-compact-address, the first street field functions as the address lookup field. * Defaults to false. */ showAddressLookup: boolean; /** * A list of ISO 3166-1 Alpha-2 country codes to filter the address with. Country codes are case-insensitive. Use with the show-address-lookup attribute. Specify up to five country codes. * Defaults to []. */ countryLookupFilter: string[]; /** * If present, the street field is rendered as two separate inputs instead of a single textarea. To provide a label for the first street field, use street-label. To provide a label for the second street field, use subpremise-label. * Defaults to false. */ showCompactAddress: boolean; /** * If present, the address fields are read-only and cannot be edited. Defaults to false. */ readOnly: boolean; /** * If present, the address fields must be filled before the form is submitted. Defaults to false. */ required: boolean; /** * The variant changes the appearance of an input address field. Accepted variants include standard, label-hidden, label-inline, and label-stacked. Defaults to standard. */ variant: string; /** * Help text detailing the purpose and function of the input. */ fieldLevelHelp: string; /** * The value for the street field. Maximum length is 255 characters when rendered as a textarea. Maximum length is 80 characters when rendered as an input using show-compact-address. */ street: string; /** * The value for the subpremise field. Use with show-compact-address. Maximum length is 80 characters. */ subpremise: string; /** * The value for the city field. Maximum length is 40 characters. */ city: string; /** * The province field for the address. If province-options is provided, this province value is selected by default. Maximum length is 80 characters. */ province: string; /** * The country field for the address. If country-options is provided, this country value is selected by default. Maximum length is 80 characters. */ country: string; /** * The value for postal code field. Maximum length is 20 characters. */ postalCode: string; /** * If present, the address fields are disabled and users cannot interact with them. Defaults to false. */ disabled: boolean; /** * Represents the validity states that an element can be in, with respect to constraint validation. */ readonly validity: ValidityState; /** * Checks if the input is valid. * @returns Indicates whether the element meets all constraint validations. */ checkValidity(): boolean; /** * Displays error messages on the address fields if the values are invalid. */ showHelpMessageIfInvalid(): void; /** * Sets a custom error message to be displayed for the specified fieldName when the input address value is submitted. * @param message The string that describes the error. If message is an empty string, the error message is reset. * @param fieldName Name of the field, which must be one of the following: street, city, province, postalCode, country. */ setCustomValidityForField(message: string, fieldName: string): void; /** * Displays the error messages and returns false if the input is invalid. If the input is valid, reportValidity() clears displayed error messages and returns true. * @returns The validity status of the input fields. */ reportValidity(): boolean; /** * Sets focus on the first input element. */ focus(): void; /** * Removes focus from all input fields. */ blur(): void; } }