Raxol.UI.Components.Modal.State (Raxol v2.0.1)

View Source

State management and form validation for the Modal component.

Summary

Functions

Changes focus between form fields.

Gets field full ID with modal prefix if modal has ID.

Handles form submission with validation.

Handles prompt input changes.

Generates set_focus command for current field.

Updates field value and clears errors.

Functions

change_focus(state, direction)

Changes focus between form fields.

get_field_full_id(field, state)

@spec get_field_full_id(map(), Raxol.UI.Components.Modal.t()) :: String.t() | any()

Gets field full ID with modal prefix if modal has ID.

handle_form_submission(state, original_msg)

@spec handle_form_submission(Raxol.UI.Components.Modal.t(), any()) ::
  {Raxol.UI.Components.Modal.t(), list()}

Handles form submission with validation.

handle_prompt_input(state, value)

@spec handle_prompt_input(Raxol.UI.Components.Modal.t(), any()) ::
  {Raxol.UI.Components.Modal.t(), list()}

Handles prompt input changes.

handle_prompt_submission(state, original_msg)

@spec handle_prompt_submission(Raxol.UI.Components.Modal.t(), any()) ::
  {Raxol.UI.Components.Modal.t(), list()}

Handles prompt submission.

set_focus_command(state)

@spec set_focus_command(Raxol.UI.Components.Modal.t()) :: {atom(), any()}

Generates set_focus command for current field.

update_field_value(state, field_id, new_value)

@spec update_field_value(Raxol.UI.Components.Modal.t(), any(), any()) ::
  {Raxol.UI.Components.Modal.t(), list()}

Updates field value and clears errors.