m3e/dialog

dialog provides Lustre support for the M3E Dialog component

Types

AlertStatus specifies if the dialog is an alert

pub type AlertStatus {
  Alert
  Standard
}

Constructors

  • Alert
  • Standard

CloseBehavior specifies if the dialog can be closed by clicking the backdrop or pressing ESC

pub type CloseBehavior {
  CloseDisabled
  CloseEnabled
}

Constructors

  • CloseDisabled
  • CloseEnabled

Config holds the configuration for a Dialog

pub type Config(msg) {
  Config(
    id: String,
    alert: AlertStatus,
    close_label: option.Option(String),
    focus_trap: FocusTrap,
    close_behavior: CloseBehavior,
    dismissibility: config.Dismissibility,
    header: String,
    close_icon_name: option.Option(String),
    actions: List(element.Element(msg)),
  )
}

Constructors

Dialog component

Fields:

  • id: The unique identifier for the dialog
  • alert: Whether the dialog is an alert
  • close_label: The accessible label given to the button used to dismiss the dialog
  • focus_trap: Whether to disable focus trapping, which keeps keyboard Tab navigation within the dialog
  • close_behavior: Whether users cannot click the backdrop or press ESC to dismiss the dialog
  • dismissibility: Whether a button is presented that can be used to close the dialog
  • header: The headline of the dialog
  • close_icon_name: The “close” icon of the dialog
  • actions: The actions of the dialog
pub opaque type Dialog(msg)

FocusTrap specifies if focus trapping is enabled

pub type FocusTrap {
  TrapFocus
  NoFocusTrap
}

Constructors

  • TrapFocus
  • NoFocusTrap

Slot gives type-safe names to each of the defined HTML named slots

pub type Slot {
  Actions
  CloseIcon
  Header
}

Constructors

  • Actions
  • CloseIcon
  • Header

Values

pub fn actions(
  d: Dialog(msg),
  actions: List(element.Element(msg)),
) -> Dialog(msg)

actions sets the actions field

pub fn alert(d: Dialog(msg), alert: AlertStatus) -> Dialog(msg)

alert sets the alert field

pub fn close_behavior(
  d: Dialog(msg),
  behavior: CloseBehavior,
) -> Dialog(msg)

close_behavior sets the close_behavior field

pub fn close_icon_name(
  d: Dialog(msg),
  close_icon_name: option.Option(String),
) -> Dialog(msg)

close_icon_name sets the close_icon_name field

pub fn close_label(
  d: Dialog(msg),
  close_label: option.Option(String),
) -> Dialog(msg)

close_label sets the close_label field

pub const default_alert_status: AlertStatus
pub const default_close_behavior: CloseBehavior
pub fn default_config() -> Config(msg)

default_config creates a new Config with default values

pub const default_focus_trap: FocusTrap
pub fn dismissibility(
  d: Dialog(msg),
  dismissibility: config.Dismissibility,
) -> Dialog(msg)

dismissibility sets the dismissibility field

pub fn focus_trap(d: Dialog(msg), trap: FocusTrap) -> Dialog(msg)

focus_trap sets the focus_trap field

pub fn from_config(c: Config(msg)) -> Dialog(msg)

from_config creates a Dialog from a Config record

pub fn header(d: Dialog(msg), header: String) -> Dialog(msg)

header sets the header field

pub fn id(d: Dialog(msg), id: String) -> Dialog(msg)

id sets the id field

pub fn new(id: String, header: String) -> Dialog(msg)

new creates a Dialog with default values

Parameters:

  • id: The unique identifier for the dialog
  • header: The headline of the dialog
pub fn render(
  d: Dialog(msg),
  attributes: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)

render creates a Lustre Element from a Dialog

pub fn render_config(
  config: Config(msg),
  attributes: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)

render_config creates a Lustre Element directly from a Config

pub fn slot(s: Slot) -> attribute.Attribute(msg)

slot creates a Lustre ‘slot’ Attribute(msg) for a Slot

Search Document