diff --git a/api-generator/components/listbox.js b/api-generator/components/listbox.js index f13c660d6..75331ea5d 100644 --- a/api-generator/components/listbox.js +++ b/api-generator/components/listbox.js @@ -101,6 +101,42 @@ const ListboxProps = [ default: "null", description: "Fields used when filtering the options, defaults to optionLabel." }, + { + name: "filterInputProps", + type: "object", + default: "null", + description: "Uses to pass all properties of the HTMLInputElement to the filter input inside the component." + }, + { + name: "virtualScrollerOptions", + type: "object", + default: "null", + description: "Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it." + }, + { + name: "autoOptionFocus", + type: "boolean", + default: "true", + description: "Whether to focus on the first visible or selected element." + }, + { + name: "filterMessage", + type: "string", + default: "{0} results are available", + description: "Text to be displayed in hidden accessible field when filtering returns any results. Defaults to value from PrimeVue locale configuration." + }, + { + name: "selectionMessage", + type: "string", + default: "{0} items selected", + description: "Text to be displayed in hidden accessible field when options are selected. Defaults to value from PrimeVue locale configuration." + }, + { + name: "emptySelectionMessage", + type: "string", + default: "No selected item", + description: "Text to be displayed in hidden accessible field when any option is not selected. Defaults to value from PrimeVue locale configuration." + }, { name: "emptyFilterMessage", type: "string", @@ -112,6 +148,24 @@ const ListboxProps = [ type: "string", default: "No results found", description: "Text to display when there are no options available. Defaults to value from PrimeVue locale configuration." + }, + { + name: "tabindex", + type: "number", + default: "0", + description: "Index of the element in tabbing order." + }, + { + name: "ariaLabel", + type: "string", + default: "null", + description: "Defines a string value that labels an interactive element." + } + { + name: "ariaLabelledby", + type: "string", + default: "null", + description: "Identifier of the underlying input element." } ]; @@ -132,6 +186,28 @@ const ListboxEvents = [ } ] }, + { + name: "focus", + description: "Callback to invoke when component receives focus.", + arguments: [ + { + name: "event", + type: "object", + description: "Browser event" + } + ] + }, + { + name: "blur", + description: "Callback to invoke when component loses focus.", + arguments: [ + { + name: "event", + type: "object", + description: "Browser event" + } + ] + }, { name: "filter", description: "Callback to invoke on filter input.", @@ -147,12 +223,6 @@ const ListboxEvents = [ description: "Filter value" } ] - }, - { - name: "virtualScrollerOptions", - type: "object", - default: "null", - description: "Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it." } ]; diff --git a/src/components/listbox/Listbox.d.ts b/src/components/listbox/Listbox.d.ts index 9d2365238..964355804 100755 --- a/src/components/listbox/Listbox.d.ts +++ b/src/components/listbox/Listbox.d.ts @@ -3,13 +3,13 @@ import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; import { VirtualScrollerProps, VirtualScrollerItemOptions } from '../virtualscroller'; -type ListboxOptionLabelType = string | ((data: any) => string) | undefined; +type ListboxOptionLabelType = string | ((data: any) => string) | undefined; -type ListboxOptionValueType = string | ((data: any) => any) | undefined; +type ListboxOptionValueType = string | ((data: any) => any) | undefined; -type ListboxOptionDisabledType = string | ((data: any) => boolean) | undefined; +type ListboxOptionDisabledType = string | ((data: any) => boolean) | undefined; -type ListboxOptionChildrenType = string | ((data: any) => any[]) | undefined; +type ListboxOptionChildrenType = string | ((data: any) => any[]) | undefined; type ListboxFilterMatchModeType = 'contains' | 'startsWith' | 'endsWith' | undefined; @@ -108,6 +108,35 @@ export interface ListboxProps { * Fields used when filtering the options, defaults to optionLabel. */ filterFields?: string[] | undefined; + /** + * Uses to pass all properties of the HTMLInputElement to the filter input inside the component. + */ + filterInputProps?: HTMLInputElement | undefined; + /** + * Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it. + * @see VirtualScroller.VirtualScrollerProps + */ + virtualScrollerOptions?: VirtualScrollerProps; + /** + * Whether to focus on the first visible or selected element. + * Default value is true. + */ + autoOptionFocus?: boolean | undefined; + /** + * Text to be displayed in hidden accessible field when filtering returns any results. Defaults to value from PrimeVue locale configuration. + * Default value is '{0} results are available'. + */ + filterMessage?: string | undefined; + /** + * Text to be displayed in hidden accessible field when options are selected. Defaults to value from PrimeVue locale configuration. + * Default value is '{0} items selected'. + */ + selectionMessage?: string | undefined; + /** + * Text to be displayed in hidden accessible field when any option is not selected. Defaults to value from PrimeVue locale configuration. + * Default value is 'No selected item'. + */ + emptySelectionMessage?: string | undefined; /** * Text to display when filtering does not return any results. Defaults to value from PrimeVue locale configuration. * Default value is 'No results found'. @@ -119,10 +148,17 @@ export interface ListboxProps { */ emptyMessage?: string | undefined; /** - * Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it. - * @see VirtualScroller.VirtualScrollerProps + * Index of the element in tabbing order. */ - virtualScrollerOptions?: VirtualScrollerProps; + tabindex?: number | string | undefined; + /** + * Defines a string value that labels an interactive element. + */ + ariaLabel?: string | undefined; + /** + * Identifier of the underlying input element. + */ + ariaLabelledby?: string | undefined; } export interface ListboxSlots { @@ -238,6 +274,16 @@ export declare type ListboxEmits = { * @param {ListboxChangeEvent} event - Custom change event. */ 'change': (event: ListboxChangeEvent) => void; + /** + * Callback to invoke when the component receives focus. + * @param {Event} event - Browser event. + */ + 'focus': (event: Event) => void; + /** + * Callback to invoke when the component loses focus. + * @param {Event} event - Browser event. + */ + 'blur': (event: Event) => void; /** * Callback to invoke on filter input. * @param {ListboxFilterEvent} event - Custom filter event. diff --git a/src/components/listbox/Listbox.vue b/src/components/listbox/Listbox.vue index db8332553..7b96e95b1 100755 --- a/src/components/listbox/Listbox.vue +++ b/src/components/listbox/Listbox.vue @@ -1,60 +1,68 @@