UNPKG

@lion/ui

Version:

A package of extendable web components

88 lines (82 loc) 159 kB
--- parts: - API Table - Input Tel title: 'Input Tel: API Table' eleventyNavigation: key: API Table >> Input Tel title: API Table order: 90 parent: Input Tel --- # Input Tel: API Table ## class: `LionInputTel`, `lion-input-tel` ### Fields | Name | Privacy | Type | Default | Description | Inherited From | | ---------------------------- | --------- | ----------------------------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | | `activePhoneNumberType` | public | | | Type of phone number, derived from textbox value. Enum with values:&#xA;-'fixed-line'&#xA;-'fixed-line-or-mobile'&#xA;-'mobile'&#xA;-'pager'&#xA;-'personal-number'&#xA;-'premium-rate'&#xA;-'shared-cost'&#xA;-'toll-free'&#xA;-'uan'&#xA;-'voip'&#xA;-'unknown'&#xA;See https\://www\.npmjs.com/package/awesome-phonenumber | | | `activeRegion` | public | `string` | | Currently active region based on:&#xA;1\. allowed regions: get the region from configured allowed regions (if one entry)&#xA;2\. user input: try to derive active region from user input&#xA;3\. locale: try to get the region from locale (\`html\[lang]\` attribute) | | | `allowCrossRootRegistration` | public | `boolean` | `false` | To encourage accessibility best practices, \`form-element-register\` events&#xA;do not pierce through shadow roots. This forces the developer to create form groups and fieldsets that automatically allow the creation of accessible relationships in the same dom tree.&#xA;Use this option if you know what you're doing. It will then be possible to nest FormControls&#xA;inside shadow dom. See https\://lion.js.org/fundamentals/rationales/accessibility/#shadow-roots-and-accessibility | LionField | | `allowedRegions` | public | `RegionCode[]` | `[]` | The regions that should be considered when international phone numbers are detected.&#xA;(when not configured, all regions worldwide will be considered) | | | `autocomplete` | public | `string \| undefined` | `undefined` | Delegates this property to input/textarea/select. | NativeTextFieldMixin | | `autofocus` | public | `boolean` | `false` | | LionField | | `defaultValidators` | public | `Validator[]` | `[]` | Used by Subclassers to add default Validators to a particular FormControl.&#xA;A date input for instance, always needs the isDate validator. | LionField | | `dirty` | public | `boolean` | `false` | True when user has changed the value of the field. | LionField | | `disabled` | public | `boolean` | `false` | | LionField | | `fieldName` | public | `string` | | Set a default name for this field, so that validation feedback will be always&#xA;accessible and linguistically correct | LionField | | `filled` | public | `boolean` | `false` | True when the modelValue is non-empty (see \_isEmpty in FormControlMixin) | LionField | | `focused` | public | `boolean` | `false` | Whether the focusable element within (\`.\_focusableNode\`) is focused.&#xA;Reflects to attribute '\[focused]' as a styling hook | LionField | | `focusedVisible` | public | `boolean` | `false` | Whether the focusable element within (\`.\_focusableNode\`) matches ':focus-visible'&#xA;Reflects to attribute '\[focused-visible]' as a styling hook&#xA;See: https\://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible | LionField | | `formatCountryCodeStyle` | public | `string` | `'default'` | Extra styling of the format strategy&#xA;default \| parentheses | | | `formatOn` | protected | `string` | `'change'` | Event that will trigger formatting (more precise, visual update of the view, so the&#xA;user sees the formatted value)&#xA;Default: 'change' | LionField | | `formatOptions` | public | | `({ mode: 'auto' })` | Configuration object that will be available inside the formatter function | LionField | | `formatStrategy` | public | `PhoneNumberFormat` | `'international'` | Determines what the formatter output should look like.&#xA;Formatting strategies as provided by google-libphonenumber&#xA;See: https\://www\.npmjs.com/package/google-libphonenumber | | | `formattedValue` | public | `string\|undefined` | `undefined` | The view value is the result of the formatter function (when available).&#xA;The result will be stored in the native \_inputNode (usually an input\[type=text]).&#xA;&#xA;Examples:&#xA;- For a date input, this would be '20/01/1999' (dependent on locale).&#xA;- For a number input, this could be '1,234.56' (a String representation of modelValue&#xA;1234.56) | LionField | | `hasFeedbackFor` | public | `ValidationType[]` | `[]` | As soon as validation happens (after modelValue/validators/validator param change), this&#xA;array is updated with the active ValidationTypes ('error'\|'warning'\|'success'\|'info' etc.).&#xA;Notice the difference with \`.showsFeedbackFor\`, which filters \`.hasFeedbackFor\` based on&#xA;\`.feedbackCondition()\`.&#xA;&#xA;For styling purposes, will be reflected to \[has-feedback-for="error warning"]. This can&#xA;be useful for subtle visual feedback on keyup, like a red/green border around an input. | LionField | | `helpText` | public | `string` | | The helpt text for the input node.&#xA;When no light dom defined via \[slot=help-text], this value will be used | LionField | | `isPending` | public | `boolean` | `false` | Flag indicating whether async validation is pending.&#xA;Creates attribute \[is-pending] as a styling hook | LionField | | `label` | public | `string` | | The label text for the input node.&#xA;When no light dom defined via \[slot=label], this value will be used. | LionField | | `labelSrOnly` | public | `boolean` | `false` | The label will only be visible for srceen readers when true | LionField | | `modelValue` | public | | | | LionField | | `name` | public | `string` | `''` | The name the element will be registered with to the .formElements collection&#xA;of the parent. Also, it serves as the key of key/value pairs in&#xA; modelValue/serializedValue objects | LionField | | `operationMode` | public | `OperationMode` | | Types of input interaction of the FormControl (for instance 'enter'\|'select'\|'upload') | LionField | | `placeholder` | public | `string` | `''` | | LionInput | | `preferredRegions` | public | `RegionCode[]` | `[]` | Regions that will be shown on top of the dropdown | | | `prefilled` | public | `boolean` | `false` | True when user has left non-empty field or input is prefilled.&#xA;The name must be seen from the point of view of the input field:&#xA;once the user enters the input field, the value is non-empty. | LionField | | `readOnly` | public | `boolean` | `false` | A Boolean attribute which, if present, indicates that the user should not be able to edit&#xA;the value of the input. The difference between disabled and readonly is that read-only&#xA;controls can still function, whereas disabled controls generally do not function as&#xA;controls until they are enabled.&#xA;(From: https\://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) | LionField | | `selectionEnd` | public | `number` | | | NativeTextFieldMixin | | `selectionStart` | public | `number` | | | NativeTextFieldMixin | | `serializedValue` | public | `string\|undefined` | `undefined` | The serialized version of the model value.&#xA;This value exists for maximal compatibility with the platform API.&#xA;The serialized value can be an interface in context where data binding is not&#xA;supported and a serialized string needs to be set.&#xA;&#xA;Examples:&#xA;- For a date input, this would be the iso format of a date, e.g. '1999-01-20'.&#xA;- For a number input this would be the String representation of a float ('1234.56'&#xA; instead of 1234.56)&#xA;&#xA;When no parser is available, the value is usually the same as the formattedValue&#xA;(being \_inputNode.value) | LionField | | `showsFeedbackFor` | public | `ValidationType[]` | `[]` | Based on outcome of feedbackCondition, this array decides what ValidationTypes should be&#xA;shown in validationFeedback, based on meta data like interaction states.&#xA;&#xA;For styling purposes, it reflects it \`\[shows-feedback-for="error warning"]\` | LionField | | `slots` | public | | | Adds ".\_feedbackNode" as described below | LionField | | `submitted` | public | | | | LionField | | `touched` | public | `boolean` | `false` | True when user has focused and left(blurred) the field. | LionField | | `type` | public | `string` | `'text'` | | LionInput | | `validationStates` | public | `ValidationStates` | `{}` | The outcome of a validation 'round'. Keyed by ValidationType and Validator name | LionField | | `validators` | public | `Validator[]` | `[]` | Used by Application Developers to add Validators to a FormControl. | LionField | | `value` | public | | | The view value. Will be delegated to \`.\_inputNode.value\`&#xA;&#xA;Note: Overrides the implementation from FormatMixin | LionField | | `_allowedOrAllRegions` | protected | `RegionCode[]` | | Used for rendering the region/country list | | | `_allValidators` | protected | `(Validator \| MetaValidator)[]` | | Combination of validators provided by Application Developer and the default validators | LionField | | `_ariaDescribedNodes` | public | `HTMLElement[]` | `[]` | Contains all elements that should end up in aria-describedby of \`.\_inputNode\` | LionField | | `_ariaLabelledNodes` | public | `HTMLElement[]` | `[]` | Contains all elements that should end up in aria-labelledby of \`.\_inputNode\` | LionField | | `_feedbackConditionMeta` | protected | | | Allows Subclassers to add meta info for feedbackCondition | LionField | | `_feedbackNode` | protected | | | Element where validation feedback will be rendered to | LionField | | `_focusableNode` | protected | `HTMLElement` | | The focusable element:&#xA;could be an input, textarea, select, button or any other element with tabindex > -1 | LionField | | `_helpTextNode` | protected | | | Element where help text will be rendered to | LionField | | `_inputId` | protected | `string` | | Unique id that can be used in all light dom | LionField | | `_inputNode` | protected | `HTMLInputElement \| HTMLTextAreaElement` | | The interactive (form) element. Can be a native element like input/textarea/select or&#xA;an element with tabindex > -1 | LionField | | `_isHandlingUserInput` | protected | `boolean` | `false` | Flag that will be set when user interaction takes place (for instance after an 'input'&#xA;event). Will be added as meta info to the \`model-value-changed\` event. Depending on&#xA;whether a user is interacting, formatting logic will be handled differently. | LionField | | `_isPasting` | protected | `boolean` | `false` | Whether the user is pasting content. Allows Subclassers to do this in their subclass: | LionField | | `_isRepropagationEndpoint` | public | `boolean` | `false` | By default, a field with \_repropagationRole 'choice-group' will act as an&#xA;'endpoint'. This means it will be considered as an individual field: for&#xA;a select, individual options will not be part of the formPath. They&#xA;will.&#xA;Similarly, components that (a11y wise) need to be fieldsets, but 'interaction wise'&#xA;(from Application Developer perspective) need to be more like fields&#xA;(think of an amount-input with a currency select box next to it), can set this&#xA;to true to hide private internals in the formPath. | LionField | | `_labelNode` | protected | | | Element where label will be rendered to | LionField | | `_leaveEvent` | protected | `string` | `'blur'` | The event that triggers the touched state | LionField | | `_parentFormGroup` | protected | `FormRegistrarHost \| undefined` | `undefined` | The registrar this FormControl registers to, Usually a descendant of FormGroup or&#xA;ChoiceGroup | LionField | | `_phoneUtil` | protected | `AwesomePhoneNumber\|null` | | | | | `_phoneUtilLoadComplete` | protected | `Promise<PhoneNumber>` | | | | | `_repropagationRole` | public | `'child'\|'choice-group'\|'fieldset'` | `'child'` | Based on the role, details of handling model-value-changed repropagation differ. | LionField | | `_requestedToBeDisabled` | protected | `boolean` | `false` | | LionField | | `_valueChangedEvent` | protected | `string` | `'model-value-changed'` | The event that triggers the dirty state | LionField | | `_visibleMessagesAmount` | protected | `number` | `1` | The amount of feedback messages that will visible in LionValidationFeedback | LionField | ### Methods | Name | Privacy | Description | Parameters | Return | Inherited From | | ---------------------------------------- | --------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------