Module
Select.Primitives.Search
- Package
- purescript-halogen-select
- Repository
- citizennet/purescript-halogen-select
#SearchQuery Source
data SearchQuery o item e a
The query type for the Search
primitive. This primitive handles text input
and debouncing.
TextInput
: Handle new text input as a stringSearchReceiver
: Update the component with newInput
when the parent re-renders
Constructors
TextInput String a
Raise (o Unit) a
FromContainer (ContainerQuery o item Unit) a
SearchReceiver (SearchInput o item e) a
#SearchState Source
type SearchState e = { debouncer :: Maybe (Debouncer e), ms :: Milliseconds, search :: String }
The Search
primitive internal state
search
: TheString
contained within the primitivems
: Number of milliseconds for the input to be debounced before passing a message to the parent. Set to 0.0 if you don't want debouncing.debouncer
: Used to facilitate debouncing of the input
#SearchInput Source
type SearchInput o item e = { debounceTime :: Milliseconds, render :: SearchState e -> ComponentHTML (SearchQuery o item e), search :: Maybe String }
The input type of the Search
primitive
search
: An optional initial value for thesearch
key on theSearchState
debounceTime
: A value in milliseconds for the debounce delay. Set to 0.0 for no debouncing.render
: The render function for the primitive
#Message Source
data Message o item
The Search sends the parent messages in two instances:
Emit
: An embedded query has been triggered, and you must decide how to handle it; typically via evaluating in the parent or re-routing the query to another primitive.NewSearch
: Some new text has been searched (this is automatically debounced).
Constructors
NewSearch String
ContainerQuery (ContainerQuery o item Unit)
Emit (o Unit)
#component Source
component :: forall e item o. Component HTML (SearchQuery o item e) (SearchInput o item e) (Message o item) (FX e)
The primitive handles state and transformations but defers all rendering to the parent. The
render function can be written using our helper functions to ensure the right events are included. See the Dispatch
module for more information.
#getInputProps Source
getInputProps :: forall e0 e item o. Array (IProp (onBlur :: FocusEvent, onFocus :: FocusEvent, onInput :: Event, onKeyDown :: KeyboardEvent, onMouseDown :: MouseEvent, onMouseUp :: MouseEvent, tabIndex :: Int, value :: String | e) (SearchQuery o item e0)) -> Array (IProp (onBlur :: FocusEvent, onFocus :: FocusEvent, onInput :: Event, onKeyDown :: KeyboardEvent, onMouseDown :: MouseEvent, onMouseUp :: MouseEvent, tabIndex :: Int, value :: String | e) (SearchQuery o item e0))