{#- chirp-ui: Timeline component Vertical timeline for activity feeds, order tracking, audit logs. Usage: from "chirpui/timeline.html" import timeline, timeline_item timeline(items=[ {"title": "Created", "date": "Jan 1", "content": "Order placed"}, {"title": "Shipped", "date": "Jan 3", "content": "In transit"} ]) Or with slot: call timeline() timeline_item("Created", "Jan 1", "Order placed") timeline_item("Shipped", "Jan 3", "In transit") end Variants: timeline_item("Deployed", "Now", icon="◎", variant="success") timeline_item("Error", "12:05", variant="error", avatar="/img/user.jpg") timeline(hoverable=true) Links: href defaults to a whole-row overlay link. link_mode="title" renders the title itself as the link. Hints: item hint="..." or timeline_item(..., hint="...") wraps the title in a tooltip. -#} {% from "chirpui/tooltip.html" import tooltip %} {% def timeline_title_content(title, href=none, link_mode="overlay") %} {% if href and link_mode == "title" %} {{ title }} {% else %} {{ title }} {% end %} {% end %} {% def timeline_title(title, href=none, link_mode="overlay", hint=none, hint_position="top") %} {% if hint %} {% call tooltip(hint, position=hint_position, cls="chirpui-timeline__hint") %} {{ timeline_title_content(title, href, link_mode) }} {% end %} {% else %} {{ timeline_title_content(title, href, link_mode) }} {% end %} {% end %} {% def timeline(items=none, hoverable=false, link_mode="overlay", density="", variant="", cls="") %} {# @consumes _surface_variant from: panel, surface — falls back to "" #} {% set _surface = consume("_surface_variant", "") %} {% set _on_surface = " chirpui-timeline--on-" ~ _surface if _surface and _surface != "default" else "" %} {% set hover_class = " chirpui-timeline--hoverable" if hoverable else "" %} {% set _default_link_mode = link_mode | validate_variant(("overlay", "title"), "overlay") %} {% set _density = density | validate_variant(("", "compact", "spacious"), "") %} {% set _variant = variant | validate_variant(("", "cards"), "") %} {% set _density_class = " chirpui-timeline--" ~ _density if _density else "" %} {% set _variant_class = " chirpui-timeline--" ~ _variant if _variant else "" %}