/* * Copyright (c) 2025, Salesforce, Inc. * All rights reserved. * For full license text, see the LICENSE.txt file */ /** * The `lightning/inputName` component represents a name compound field. * @see {@link https://developer.salesforce.com/docs/component-library/bundle/lightning-input-name/documentation |Lightning Input Name Documentation} */ declare module "lightning/inputName" { import { LightningElement } from "lwc"; /** * Represents a name compound field. */ export default class LightningInputName extends LightningElement { /** * Reserved for internal use. */ salutationLabel: string; /** * Reserved for internal use. */ firstNameLabel: string; /** * Reserved for internal use. */ middleNameLabel: string; /** * Reserved for internal use. */ lastNameLabel: string; /** * Reserved for internal use. */ suffixLabel: string; /** * Reserved for internal use. */ informalNameLabel: string; /** * The label of the input name field. */ label: string; /** * Displays a list of salutation options, such as Dr. or Mrs., provided as label-value pairs. */ options: Array<{ label: string; value: string }>; /** * List of fields to be displayed on the component. This value defaults to * ['firstName', 'salutation', 'lastName']. Other field values include middleName, * informalName, suffix. */ fieldsToDisplay: Array< | "firstName" | "salutation" | "lastName" | "middleName" | "informalName" | "suffix" >; /** * Displays the Salutation field as a dropdown menu. Use the options attribute to provide salutations in an array of label-value pairs. */ salutation: string; /** * Displays the First Name field. */ firstName: string; /** * Displays the Middle Name field. */ middleName: string; /** * Displays the Informal Name field. */ informalName: string; /** * Displays the Last Name field. */ lastName: string; /** * Displays the Suffix field. */ suffix: string; /** * If present, the input name field is disabled and users cannot interact with it. */ disabled: boolean; /** * If present, the input name field is read-only and cannot be edited. */ readOnly: boolean; /** * If present, the input name field must be filled out before the form is submitted. * A red asterisk is displayed on the Last Name field. An error * message is displayed if a user interacts with the Last Name * field and does not provide a value. */ required: boolean; /** * The variant changes the appearance of a name compound field. * Accepted variants include standard, label-hidden, label-inline, and label-stacked. * This value defaults to standard. * Use label-hidden to hide the label but make it available to assistive technology. * Use label-inline to horizontally align the label and name fields. * Use label-stacked to place the label above the name fields. */ variant: "standard" | "label-hidden" | "label-inline" | "label-stacked"; /** * Help text detailing the purpose and function of the input. */ fieldLevelHelp: string; /** * Represents the validity states that an element can be in, with respect to constraint validation. */ validity: ValidityState; /** * Sets focus on the first input field. */ focus(): void; /** * Removes keyboard focus from the input element. */ blur(): void; /** * Returns the valid property value (Boolean) on the ValidityState object to * indicate whether input name fields have validity errors. */ checkValidity(): boolean; /** * Displays error messages on the input fields if the entries are invalid. */ showHelpMessageIfInvalid(): void; /** * Sets a custom error message to be displayed for the input name fields when * the input value is submitted. */ 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. */ reportValidity(): boolean; } }