Jido.Chat.Modal.Element (Jido Chat v1.0.0)

Copy Markdown View Source

Canonical modal element used by Jido.Chat.Modal.

Summary

Functions

Builds a modal element from serialized data.

Creates a canonical modal element.

Normalizes modal element input.

Returns the schema for modal elements.

Serializes the modal element into a plain map with a type marker.

Types

input()

@type input() :: t() | map()

t()

@type t() :: %Jido.Chat.Modal.Element{
  help_text: nil | nil | binary(),
  id: binary(),
  kind: :text_input | :select | :radio_select | :select_option,
  label: nil | nil | binary(),
  max_length: nil | nil | integer(),
  metadata: map(),
  min_length: nil | nil | integer(),
  multiline: boolean(),
  options: [any()],
  placeholder: nil | nil | binary(),
  required: boolean(),
  value: nil | nil | binary()
}

Functions

from_map(map)

@spec from_map(map()) :: t()

Builds a modal element from serialized data.

new(element)

@spec new(t() | map()) :: t()

Creates a canonical modal element.

normalize(element)

@spec normalize(input()) :: t()

Normalizes modal element input.

schema()

Returns the schema for modal elements.

to_map(element)

@spec to_map(t()) :: map()

Serializes the modal element into a plain map with a type marker.