createSelect

function

createSelect<Item>(config?): SelectWidget<Item>

Creates a new select widget instance.

Type Parameters

Item

Parameters

config?: PropsConfig<SelectProps<Item>>

config of the modal, either as a store or as an object containing values or stores.

Returns

SelectWidget<Item>

a new select widget instance


getSelectDefaultConfig

function

getSelectDefaultConfig(): SelectProps<any>

Retrieve a shallow copy of the default Select config

Returns

SelectProps<any>

the default Select config


ItemContext

interface
Type Parameters

T

Properties
id

id: string

Unique id to identify the item


item

item: T

Original item given in the parameters


selected

selected: boolean

Specify if the item is checked


Select

function

Select<Item>(props): Element

Type Parameters

Item

Parameters

props: Partial<SelectProps<Item>>

Returns

Element


SelectActions

interface
Type Parameters

Item

Properties
onBadgeKeydown

onBadgeKeydown: (event, item) => void

Method to be plugged to on an keydown event of a badge container, in order to manage main actions on badges.

Parameters

event: KeyboardEvent

keyboard event

item: Item

corresponding item

Returns

void


onInput

onInput: (e) => void

Method to be plugged to on the 'input' event. The input text will be used as the filter text.

Parameters

e

e.target: any

Returns

void


onInputKeydown

onInputKeydown: (event) => void

Method to be plugged to on an keydown event of the main input, in order to control the keyboard interactions with the highlighted item. It manages arrow keys to move the highlighted item, or enter to toggle the item.

Parameters

event: KeyboardEvent

Returns

void


onRemoveBadgeClick

onRemoveBadgeClick: (event, item) => void

Method to be attached to the node element to close a badge on click.

Parameters

event: MouseEvent

item: Item

Returns

void


SelectApi

interface
Type Parameters

Item

Methods
clear

clear(): void

Clear all the selected items

Returns

void


clearText

clearText(): void

Clear the filter text

Returns

void


close

close(): void

close the select

Returns

void


highlight

highlight(item): void

Highlight the given item, if there is a corresponding match among the visible list

Parameters

item: Item

Returns

void


highlightFirst

highlightFirst(): void

Highlight the first item among the visible list

Returns

void


highlightLast

highlightLast(): void

Highlight the last item among the visible list

Returns

void


highlightNext

highlightNext(): void

Highlight the next item among the visible list. Loop to the first item if needed

Returns

void


highlightPrevious

highlightPrevious(): void

Highlight the previous item among the visible list Loop to the last item if needed

Returns

void


open

open(): void

open the select

Returns

void


select

select(item): void

Select the provided item. The selected list is used to

Parameters

item: Item

the item to select

Returns

void


toggle

toggle(isOpen?): void

Toggle the dropdown menu

Parameters

isOpen?: boolean

If specified, set the menu in the defined state.

Returns

void


toggleItem

toggleItem(item, selected?): void

Toggle the selection of an item

Parameters

item: Item

the item to toggle

selected?: boolean

an optional boolean to enforce the selected/unselected state instead of toggling

Returns

void


unselect

unselect(item): void

Unselect the provided item.

Parameters

item: Item

the item to unselect

Returns

void


SelectContext

type alias

SelectContext<Item>: WidgetSlotContext<SelectWidget<Item>>

A type for the slot context of the pagination widget

Type Parameters

Item


SelectDirectives

interface
Type Parameters

Item

Properties
badgeAttributesDirective

badgeAttributesDirective: Directive<ItemContext<Item>>

A directive that applies all the necessary attributes to the container badges


floatingDirective

floatingDirective: Directive<void, SSRHTMLElement>

Directive that enables dynamic positioning of menu element


hasFocusDirective

hasFocusDirective: Directive

Directive to be used in the input group and the menu containers


inputContainerDirective

inputContainerDirective: Directive

A directive to be applied to the element that contains the badges and the input


itemAttributesDirective

itemAttributesDirective: Directive<ItemContext<Item>>

A directive that applies all the necessary attributes to the dropdown item


menuAttributesDirective

menuAttributesDirective: Directive

A directive that applies all the necessary attributes to the dropdown menu


referenceDirective

referenceDirective: Directive<void, SSRHTMLElement>

A directive to be applied to the input group element serves as the base for menu positioning


SelectItemContext

type alias

SelectItemContext<Item>: SelectContext<Item> & object

Type declaration
itemContext

itemContext: ItemContext<Item>

Contextual data related to an item

Type Parameters

Item


SelectProps

interface
Type Parameters

Item

Properties
allowedPlacements

allowedPlacements: Placement[]

List of allowed placements for the dropdown. This refers to the allowedPlacements from floating UI, given the different Placement possibilities.

Default Value
['bottom-start', 'top-start', 'bottom-end', 'top-end']

ariaLabel

ariaLabel: undefined | string

aria-label used for the input inside the select

Default Value

'Select'


badgeClassName

badgeClassName: string

Class to be added on selected items (displayed in the input zone)

Default Value

''


badgeLabel

badgeLabel: SlotContent<SelectItemContext<Item>>

The template to override the way each badge on the left of the input is displayed. This define the content of the badge inside the badge container.

Default Value
({itemContext}: SelectItemContext<any>) => itemContext.item

className

className: string

CSS classes to be applied on the widget main container

Default Value

''


disabled

disabled: boolean

true if the select is disabled

Default Value

false


filterText

filterText: string

Filtered text to be display in the filter input

Default Value

''


id

id: undefined | string

id used for the input inside the select


itemLabel

itemLabel: SlotContent<SelectItemContext<Item>>

The template to override the way each item is displayed in the list. This define the content of the badge inside the badge container.

Default Value
({itemContext}: SelectItemContext<any>) => itemContext.item

items

items: Item[]

List of available items for the dropdown

Default Value

[]


loading

loading: boolean

true if a loading process is being done

Default Value

false


menuClassName

menuClassName: string

Class to be added on the dropdown menu container

Default Value

''


menuItemClassName

menuItemClassName: string

Class to be added on menu items

Default Value

''


open

open: boolean

true if the select is open

Default Value

false


selected

selected: Item[]

List of selected item ids

Default Value

[]

Methods
itemIdFn

itemIdFn(item): string

Custom function to get the id of an item By default, the item is returned

Parameters

item: Item

Returns

string

Default Value
(item: any) => '' + item

navSelector

navSelector(node): NodeListOf<HTMLInputElement | HTMLSpanElement>

Retrieves navigable elements within an HTML element containing badges and the input.

Parameters

node: HTMLElement

HTMLElement that contains the badges and the input

Returns

NodeListOf<HTMLInputElement | HTMLSpanElement>

Default Value
(node: HTMLElement) => node.querySelectorAll('.au-select-badge,input')

onFilterTextChange

onFilterTextChange(text): void

Callback called when the text filter change

Parameters

text: string

Filtered text

Returns

void

Default Value
() => {}

onOpenChange

onOpenChange(isOpen): void

Callback called dropdown open state change

Parameters

isOpen: boolean

updated open state

Returns

void

Default Value
() => {}

onSelectedChange

onSelectedChange(selected): void

Callback called when the selection change

Parameters

selected: Item[]

Returns

void

Default Value
() => {}

SelectState

interface
Type Parameters

Item

Properties
ariaLabel

ariaLabel: undefined | string

aria-label used for the input inside the select

Default Value

'Select'


badgeClassName

badgeClassName: string

Class to be added on selected items (displayed in the input zone)

Default Value

''


badgeLabel

badgeLabel: SlotContent<SelectItemContext<Item>>

The template to override the way each badge on the left of the input is displayed. This define the content of the badge inside the badge container.

Default Value
({itemContext}: SelectItemContext<any>) => itemContext.item

className

className: string

CSS classes to be applied on the widget main container

Default Value

''


disabled

disabled: boolean

true if the select is disabled

Default Value

false


filterText

filterText: string

Filtered text to be display in the filter input

Default Value

''


highlighted

highlighted: undefined | ItemContext<Item>

Highlighted item context. It is designed to define the highlighted item in the dropdown menu


id

id: undefined | string

id used for the input inside the select


itemLabel

itemLabel: SlotContent<SelectItemContext<Item>>

The template to override the way each item is displayed in the list. This define the content of the badge inside the badge container.

Default Value
({itemContext}: SelectItemContext<any>) => itemContext.item

loading

loading: boolean

true if a loading process is being done

Default Value

false


menuClassName

menuClassName: string

Class to be added on the dropdown menu container

Default Value

''


menuItemClassName

menuItemClassName: string

Class to be added on menu items

Default Value

''


open

open: boolean

true if the select is open

Default Value

false


placement

placement: undefined | Placement

Current placement of the dropdown


selected

selected: Item[]

List of selected item ids

Default Value

[]


selectedContexts

selectedContexts: ItemContext<Item>[]

List of selected items to be display


visibleItems

visibleItems: ItemContext<Item>[]

List of item contexts, to be displayed in the menu


SelectWidget

type alias

SelectWidget<Item>: Widget<SelectProps<Item>, SelectState<Item>, SelectApi<Item>, SelectActions<Item>, SelectDirectives<Item>>

Type Parameters

Item