| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
NanoUI.Widgets.Combo
Description
Combo box: a search field with a filtered, scrollable suggestion dropdown.
The per-frame logic is the pure comboStep over a persisted ComboState.
Synopsis
- comboBox :: forall f (es :: [Effect]). (Foldable f, Ui :> es) => Text -> f Text -> Text -> Eff es Text
- comboBox' :: forall f (es :: [Effect]). (Foldable f, Ui :> es) => Text -> f Text -> Text -> Eff es (Response, Text)
- data ComboState = ComboState {}
- data ComboInput = ComboInput {}
- data ComboStep = ComboStep {
- stepState :: !ComboState
- stepCommit :: !(Maybe Text)
- stepPicked :: !Bool
- stepDismissed :: !Bool
- stepRedraw :: !Bool
- comboStep :: ComboInput -> ComboState -> ComboStep
Documentation
comboBox :: forall f (es :: [Effect]). (Foldable f, Ui :> es) => Text -> f Text -> Text -> Eff es Text Source #
Combo box: the searchField with a select-style dropdown of options.
While the field holds focus, the shared select dropdown overlay lists the
options filtered by the field text (all of them while it is empty). The
value is free text: options are suggestions, not a closed set. See
comboStep for when the value commits. Pass the current text; the result is
the text after this frame, and respChanged on comboBox' marks a commit.
comboBox' :: forall f (es :: [Effect]). (Foldable f, Ui :> es) => Text -> f Text -> Text -> Eff es (Response, Text) Source #
data ComboState Source #
A combo's state between frames.
Constructors
| ComboState | |
Fields
| |
Instances
| Eq ComboState Source # | |
Defined in NanoUI.Widgets.Combo | |
| Show ComboState Source # | |
Defined in NanoUI.Widgets.Combo Methods showsPrec :: Int -> ComboState -> ShowS # show :: ComboState -> String # showList :: [ComboState] -> ShowS # | |
data ComboInput Source #
One frame's inputs to comboStep.
Constructors
| ComboInput | |
Fields
| |
What one frame of the combo decided.
Constructors
| ComboStep | |
Fields
| |
comboStep :: ComboInput -> ComboState -> ComboStep Source #
One frame of the combo: highlight, scrolling, thumb drags, and commits.
Typing edits the live text but never commits it: the committed value only changes on Enter (which commits the highlighted row only), on a row click (a field text the combo did not produce), or when the field loses focus. Escape reverts the live text to the last committed value. Hover highlights a row and makes it the Enter target; Up/Down move the highlight.