{% from "chirpui/spinner.html" import spinner %} {#- chirp-ui: File item / attachment chip Id-addressable attachment chip for the composer. Status (uploading / processing / ready / error) is server-authoritative and delivered by OOB swaps targeting #attachment-{id} (NO fake client timers — see docs/patterns/ai-chat.md). Doc-icon morphs to a spinner while pending. -#} {% def attachment_chip(id, name, status="uploading", size=none, href=none, preview_url=none, dismiss_url=none, cls="") %} {% set _status = status | validate_variant( ("uploading", "processing", "ready", "error"), "uploading") %} {% set _pending = _status in ("uploading", "processing") %} {% if preview_url %} {% elif href %} {{ name }} {% else %} {{ name }} {% end %} {% if size %}{{ size }}{% end %} {% if dismiss_url %} {% end %} {% end %} {% def file_item(id, name, status="ready", size=none, href=none, cls="") %} {{ attachment_chip(id=id, name=name, status=status, size=size, href=href, cls="chirpui-attachment-chip--row " ~ cls) }} {% end %}