UNPKG

@lion/ui

Version:

A package of extendable web components

82 lines (78 loc) 195 kB
--- parts: - API Table - Listbox title: 'Listbox: API Table' eleventyNavigation: key: API Table >> Listbox title: API Table order: 90 parent: Listbox --- # Listbox: API Table ## class: `LionListbox`, `lion-listbox` ### Fields | Name | Privacy | Type | Default | Description | Inherited From | | ------------------------------ | --------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | | `activeIndex` | public | | | | ListboxMixin | | `autofocus` | public | `boolean` | `false` | | FocusMixin | | `checkedIndex` | public | `number \| number[]` | | | ListboxMixin | | `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. | ValidateMixin | | `dirty` | public | `boolean` | `false` | True when user has changed the value of the field. | InteractionStateMixin | | `disabled` | public | `boolean` | `false` | | DisabledMixin | | `done` | public | `boolean` | `false` | | FormRegistrarMixin | | `fieldName` | public | `string` | | Will be used in validation messages to refer to the current field | FormControlMixin | | `filled` | public | `boolean` | `false` | True when the modelValue is non-empty (see \_isEmpty in FormControlMixin) | InteractionStateMixin | | `focused` | public | `boolean` | `false` | Whether the focusable element within (\`.\_focusableNode\`) is focused.&#xA;Reflects to attribute '\[focused]' as a styling hook | FocusMixin | | `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 | FocusMixin | | `formattedValue` | public | | | | ChoiceGroupMixin | | `formElements` | public | `FormControlsCollection` | `new FormControlsCollection()` | Closely mimics the natively supported HTMLFormControlsCollection. It can be accessed&#xA;both like an array and an object (based on control/element names). | FormRegistrarMixin | | `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. | ValidateMixin | | `hasNoDefaultSelected` | public | `boolean` | `false` | When setting this to true, on initial render, no option will be selected.&#xA;It is advisable to override \`\_noSelectionTemplate\` method in the select-invoker&#xA;to render some kind of placeholder initially | ListboxMixin | | `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 | FormControlMixin | | `initComplete` | public | `Promise<any>` | `new Promise((resolve, reject) => { this.__resolveInitComplete = resolve; this.__rejectInitComplete = reject; })` | initComplete resolves after all pending initialization logic&#xA;(for instance \`\<form-group .serializedValue=${{ child1: 'a', child2: 'b' }}>\`)&#xA;is executed | FormRegistrarMixin | | `isPending` | public | `boolean` | `false` | Flag indicating whether async validation is pending.&#xA;Creates attribute \[is-pending] as a styling hook | ValidateMixin | | `label` | public | `string` | | The label text for the input node.&#xA;When no light dom defined via \[slot=label], this value will be used. | FormControlMixin | | `labelSrOnly` | public | `boolean` | `false` | The label will only be visible for srceen readers when true | FormControlMixin | | `modelValue` | public | | | | FormControlMixin | | `multipleChoice` | public | `boolean` | `false` | When false (default), modelValue and serializedValue will reflect the&#xA;currently selected choice (usually a string). When true, modelValue will and&#xA;serializedValue will be an array of strings. | ChoiceGroupMixin | | `operationMode` | public | `OperationMode` | | Types of input interaction of the FormControl (for instance 'enter'\|'select'\|'upload') | ValidateMixin | | `orientation` | public | `string` | `'vertical'` | Informs screen reader and affects keyboard navigation.&#xA;By default 'vertical' | ListboxMixin | | `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. | InteractionStateMixin | | `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) | FormControlMixin | | `registrationComplete` | public | `Promise<any> & {done?:boolean}` | `new Promise((resolve, reject) => { this.__resolveRegistrationComplete = resolve; this.__rejectRegistrationComplete = reject; })` | registrationComplete waits for all children formElements to have registered | FormRegistrarMixin | | `rotateKeyboardNavigation` | public | `boolean` | `false` | Will give first option active state when navigated to the next option from&#xA;last option. | ListboxMixin | | `selectionFollowsFocus` | public | `boolean` | `false` | When true, will synchronize activedescendant and selected element on&#xA;arrow key navigation.&#xA;This behavior can usually be seen on \<select> on the Windows platform.&#xA;Note that this behavior cannot be used when multiple-choice is true.&#xA;See: https\://www\.w3.org/TR/wai-aria-practices/#kbd\_selection\_follows\_focus | ListboxMixin | | `serializedValue` | public | | | | ChoiceGroupMixin | | `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"]\` | ValidateMixin | | `submitted` | public | | | | InteractionStateMixin | | `touched` | public | `boolean` | `false` | True when user has focused and left(blurred) the field. | InteractionStateMixin | | `validationStates` | public | `ValidationStates` | `{}` | The outcome of a validation 'round'. Keyed by ValidationType and Validator name | ValidateMixin | | `validators` | public | `Validator[]` | `[]` | Used by Application Developers to add Validators to a FormControl. | ValidateMixin | | `_activeDescendantOwnerNode` | protected | `HTMLElement` | | | ListboxMixin | | `_allValidators` | protected | `(Validator \| MetaValidator)[]` | | Combination of validators provided by Application Developer and the default validators | ValidateMixin | | `_ariaDescribedNodes` | public | `HTMLElement[]` | `[]` | Contains all elements that should end up in aria-describedby of \`.\_inputNode\` | FormControlMixin | | `_ariaLabelledNodes` | public | `HTMLElement[]` | `[]` | Contains all elements that should end up in aria-labelledby of \`.\_inputNode\` | FormControlMixin | | `_feedbackConditionMeta` | protected | | | Allows Subclassers to add meta info for feedbackCondition | ValidateMixin | | `_feedbackNode` | protected | | | Element where validation feedback will be rendered to | FormControlMixin | | `_focusableNode` | protected | `HTMLElement` | | The focusable element:&#xA;could be an input, textarea, select, button or any other element with tabindex > -1 | FocusMixin | | `_helpTextNode` | protected | | | Element where help text will be rendered to | FormControlMixin | | `_inputId` | protected | `string` | | Unique id that can be used in all light dom | FormControlMixin | | `_inputNode` | protected | | | The interactive (form) element. Can be a native element like input/textarea/select or&#xA;an element with tabindex > -1 | FormControlMixin | | `_isFormOrFieldset` | protected | `boolean` | `false` | Flag that determines how ".formElements" should behave.&#xA;For a regular fieldset (see LionFieldset) we expect ".formElements"&#xA;to be accessible as an object.&#xA;In case of a radio-group, a checkbox-group or a select/listbox,&#xA;it should act like an array (see ChoiceGroupMixin).&#xA;Usually, when false, we deal with a choice-group (radio-group, checkbox-group,&#xA;(multi)select) | FormRegistrarMixin | | `_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. | FormControlMixin | | `_labelNode` | protected | | | Element where label will be rendered to | FormControlMixin | | `_leaveEvent` | protected | `string` | `'blur'` | The event that triggers the touched state | InteractionStateMixin | | `_listboxActiveDescendant` | protected | `number \| null` | `null` | | ListboxMixin | | `_listboxActiveDescendantNode` | protected | `HTMLElement` | | | ListboxMixin | | `_listboxNode` | protected | | | | ListboxMixin | | `_listboxReceivesNoFocus` | protected | `boolean` | `false` | When listbox is coupled to a textbox (in case we are dealing with a combobox),&#xA;spaces should not select an element (they need to be put in the textbox) | ListboxMixin | | `_listboxSlot` | protected | `HTMLElement` | | | ListboxMixin | | `_noTypeAhead` | public | `boolean` | `false` | When false, a user can type on which the focus will jump to the matching option | ListboxMixin | | `_oldModelValue` | protected | `string \| string[] \| undefined` | `undefined` | | ListboxMixin | | `_repropagationRole` | public | `'child'\|'choice-group'\|'fieldset'` | `'choice-group'` | Based on the role, details of handling model-value-changed repropagation differ. | FormControlMixin | | `_requestedToBeDisabled` | protected | `boolean` | `false` | | DisabledMixin | | `_scrollTargetNode` | protected | `HTMLElement` | | | ListboxMixin | | `_typeAheadTimeout` | protected | `number` | `1000` | The pending char sequence that will set active list item | ListboxMixin | | `_valueChangedEvent` | protected | `string` | `'model-value-changed'` | The event that triggers the dirty state | InteractionStateMixin | | `_visibleMessagesAmount` | protected | `number` | `1` | The amount of feedback messages that will visible in LionValidationFeedback