Current section
Files
Jump to
Current section
Files
src/m3e/rich_tooltip_action.gleam
//// RichTooltipAction is an element, nested within a clickable element, used to dismiss a parenting rich tooltip.
////
//// This file was generated by m3e/generator
////
//// DO NOT EDIT
////
import gleam/list
import lustre/attribute.{type Attribute}
import lustre/element.{type Element}
import m3e/attr
// --- Types ---
/// RichTooltipAction is a View Model for this component
///
/// ## Fields:
///
/// - disable_restore_focus: Whether to focus should not be restored to the trigger when activated.
///
pub opaque type RichTooltipAction {
RichTooltipAction(disable_restore_focus: DisableRestoreFocus)
}
/// DisableRestoreFocus is whether to focus should not be restored to the trigger when activated.
///
pub type DisableRestoreFocus {
IsDisableRestoreFocus
IsNotDisableRestoreFocus
}
// --- Defaults ---
pub const default_disable_restore_focus: DisableRestoreFocus = IsNotDisableRestoreFocus
// --- Constructors ---
/// new creates a new RichTooltipAction with the default configuration.
///
pub fn new(disable_restore_focus: DisableRestoreFocus) -> RichTooltipAction {
RichTooltipAction(disable_restore_focus: disable_restore_focus)
}
// --- Setters ---
/// disable_restore_focus sets the value of disable_restore_focus for this RichTooltipAction.
///
pub fn disable_restore_focus(
_: RichTooltipAction,
disable_restore_focus: DisableRestoreFocus,
) -> RichTooltipAction {
RichTooltipAction(disable_restore_focus: disable_restore_focus)
}
// --- Renderers ---
/// render creates a Lustre Element for a RichTooltipAction
///
pub fn render(
model: RichTooltipAction,
attributes: List(Attribute(msg)),
children: List(Element(msg)),
) -> Element(msg) {
element.element(
"m3e-rich-tooltip-action",
list.flatten([
[
attr.boolean(
"disable-restore-focus",
model.disable_restore_focus == IsDisableRestoreFocus,
),
],
attributes,
])
|> list.filter(fn(a) { a != attribute.none() }),
children,
)
}