Raxol.UI.Components.Input.SelectList.Search (Raxol v0.3.0)

View Source

Handles search and filtering functionality for the SelectList component.

Summary

Functions

Filters options based on search text and optional searchable fields. Returns nil if no search text is provided, otherwise returns filtered options.

Checks if an option matches the search text. If searchable_fields is provided, only those fields are searched. Otherwise, the option label is searched.

Updates search-related state based on new search text.

Types

option()

@type option() :: {String.t(), any()}

options()

@type options() :: [option()]

Functions

filter_options(options, search_text, searchable_fields)

Filters options based on search text and optional searchable fields. Returns nil if no search text is provided, otherwise returns filtered options.

search_matches?(arg, search_text, searchable_fields)

Checks if an option matches the search text. If searchable_fields is provided, only those fields are searched. Otherwise, the option label is searched.

update_search_state(state, search_text)

Updates search-related state based on new search text.