Search

Find components, guides, and documentation

Input Tel Dropdown: API Table

class: LionInputTelDropdown, lion-input-tel-dropdown

Fields

NamePrivacyTypeDefaultDescriptionInherited From
activePhoneNumberTypepublicType of phone number, derived from textbox value. Enum with values: -‘fixed-line’ -‘fixed-line-or-mobile’ -‘mobile’ -‘pager’ -‘personal-number’ -‘premium-rate’ -‘shared-cost’ -‘toll-free’ -‘uan’ -‘voip’ -‘unknown’ See https://www.npmjs.com/package/awesome-phonenumberLionInputTel
activeRegionpublicstringCurrently active region based on: 1. allowed regions: get the region from configured allowed regions (if one entry) 2. user input: try to derive active region from user input 3. locale: try to get the region from locale (`html[lang]` attribute)LionInputTel
allowedRegionspublicRegionCode[][]The regions that should be considered when international phone numbers are detected. (when not configured, all regions worldwide will be considered)LionInputTel
autocompletepublicstring'tel'LionInputTel
fieldNamepublicSet a default name for this field, so that validation feedback will be always accessible and linguistically correctLionInputTel
formatCountryCodeStylepublicstring'default'Extra styling of the format strategy default | parenthesesLionInputTel
formatStrategypublicPhoneNumberFormat'international'Determines what the formatter output should look like. Formatting strategies as provided by google-libphonenumber See: https://www.npmjs.com/package/google-libphonenumberLionInputTel
placeholderpublicstring''LionInput
preferredRegionspublicRegionCode[][]Regions that will be shown on top of the dropdownLionInputTel
readOnlypublicbooleanfalseA Boolean attribute which, if present, indicates that the user should not be able to edit the value of the input. The difference between disabled and readonly is that read-only controls can still function, whereas disabled controls generally do not function as controls until they are enabled. (From: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly)LionInput
refspublicobject{ /** @type {DropdownRef} */ dropdown: /** @type {DropdownRef} */ (createRef()), }
slotspublicLionInput
typepublicstring'text'LionInput
_allCountriesLabelprotectedstring''Group label for all countries, when preferredCountries are shown
_allowedOrAllRegionsprotectedRegionCode[]Used for rendering the region/country listLionInputTel
_feedbackConditionMetaprotectedLionField
_focusableNodeprotectedLionField
_inputNodeprotectedHTMLInputElementLionInput
_langIsoprotectedRegionCode | undefinedundefinedLionInputTel
_phoneUtilprotectedAwesomePhoneNumber|nullLionInputTel
_phoneUtilLoadCompleteprotectedPromise<PhoneNumber>LionInputTel
_preferredCountriesLabelprotectedstring''Group label for preferred countries, when preferredCountries are shown
_templateDataDropdownprotectedTemplateDataForDropdownInputTelThis method provides a TemplateData object to be fed to pure template functions, a.k.a. Pure Templates™. The goal is to totally decouple presentation from logic here, so that Subclassers can override all content without having to loose private info contained within the template function that was overridden. Subclassers would need to make sure all the contents of the TemplateData object are implemented by making sure they are coupled to the right ‘ref’ ([data-ref=dropdown] in this example), with the help of lit’s spread operator directive. To enhance this process, the TemplateData object is completely typed. Ideally, this would be enhanced by providing linters that make sure all of their required members are implemented by a Subclasser. When a Subclasser wants to add more data, this can be done via:

Methods

NamePrivacyDescriptionParametersReturnInherited From
clearpublicClears modelValue. Interaction states are not cleared (use resetInteractionState for this)LionField
formatterpublicmodelValue: stringstringLionInputTel
onLocaleUpdatedpublicLionInputTel
parserpublicviewValue: stringstringLionInputTel
preprocessorpublicviewValue: string, { currentCaretIndex, prevViewValue }, options: @param {string} options.prevViewValue * @param {number} options.currentCaretIndex * { viewValue: string; caretIndex: number; } | undefinedLionInputTel
resetpublicResets modelValue to initial value. Interaction states are clearedLionField
resetInteractionStatepublicLionField
_initModelValueBasedOnDropdownprotected
_isEmptyprotectedUsed for Required validation and computation of interaction states. We need to override this, because we prefill the input with the region code (like +31), but for proper UX, we don’t consider this as having interaction state `prefilled`modelValue: stringboolean
_onChangeprotectedDispatches custom bubble eventev: Event=LionField
_onDropdownValueChangeprotectedevent: OnDropdownChangeEvent
_onPhoneNumberUtilReadyprotectedLionInputTel
_reflectBackOnprotectedDo not reflect back .formattedValue during typing (this normally wouldn’t happen when FormatMixin calls _calculateValues based on user input, but for LionInputTel we need to call it on .activeRegion change)booleanLionInputTel
_repropagationConditionprotectedUsually, we don’t use composition in regular LionFields (non choice-groups). Here we use a LionSelect(Rich) inside. We don’t want to repropagate any children, since an Application Developer is not concerned with these internals (see repropate logic in FormControlMixin) Also, we don’t want to give (wrong) info to InteractionStateMixin, that will set the wrong interaction states based on child info. TODO: Make “this._repropagationRole !== ‘child’” the default for FormControlMixin (so that FormControls used within are never repropagated for LionFields)
_setActiveRegionprotectedProtected setter for activeRegion, only meant for subclassersnewValue: RegionCode|undefinedLionInputTel

Events

NameTypeDescriptionInherited From
user-input-changedEventLionField

Attributes

NameFieldInherited From
allowedRegionsallowedRegionsLionInputTel
format-strategyformatStrategyLionInputTel
format-country-code-styleformatCountryCodeStyleLionInputTel
activeRegionactiveRegionLionInputTel
preferredRegionspreferredRegionsLionInputTel
_phoneUtil_phoneUtilLionInputTel
readonlyreadOnlyLionInput
typetypeLionInput
placeholderplaceholderLionInput