{# BPJudge UI Contract v1 macros. Import with: {% import "components/ui/v1.html" as ui_v1 %} Do not use `ui` as the alias: Hydro exposes its navigation registry through that global template name, and shadowing it breaks shared layout rendering. Text is escaped by the template environment. Translate user-facing copy at the call site so these primitives remain independent from business logic. #} {% macro help(text, label='使用说明') -%} {{ text }} {%- endmacro %} {% macro badge(text, tone='neutral', extra_class='') -%} {{ text }} {%- endmacro %} {% macro category_label(text, category=0) -%} {% set category = category if category in [0, 1, 2, 3, 4, 5, 6, 7, 8] else 0 -%} {{ text }} {%- endmacro %} {% macro stat(value, label, detail=none, extra_class='') -%}
{{ value }}
{{ label }}
{% if detail %}
{{ detail }}
{% endif %}
{%- endmacro %} {% macro empty_state(title, description=none, icon_class=none, extra_class='') -%}
{% if icon_class %}
{% endif %}
{{ title }}
{% if description %}
{{ description }}
{% endif %} {% if caller %}
{{ caller() }}
{% endif %}
{%- endmacro %} {% macro panel(title=none, description=none, extra_class='', body_class='') -%}
{% if title or description %}
{% if title %}

{{ title }}

{% endif %} {% if description %}
{{ description }}
{% endif %}
{% endif %}
{% if caller %}{{ caller() }}{% endif %}
{%- endmacro %} {% macro page_header(title, description=none, extra_class='') -%}

{{ title }}

{% if description %}
{{ description }}
{% endif %}
{% if caller %}
{{ caller() }}
{% endif %}
{%- endmacro %} {% macro alert(title, description=none, tone='neutral', extra_class='') -%}
{{ title }}
{% if description %}
{{ description }}
{% endif %}
{%- endmacro %} {% macro sortable_handle(label, described_by=none, enabled=true, extra_class='') -%} {%- endmacro %} {% macro sortable_index(value, label=none, extra_class='') -%} {{ value }} {%- endmacro %} {% macro sortable_action(text, label, action=none, disabled=false, href=none, button_type='button', name=none, value=none, icon_class=none, tone='neutral', extra_class='') -%} {% if href and disabled %} {% elif href %} {% else %} {% endif %} {%- endmacro %}