{% load brickwork_icons i18n %} {% comment %} Empty state (STA-001/002). variant distinguishes "no data yet" (nothing ever created) from "no results" (a filter matched nothing), so the two are never identical: no_results offers a clear-filters action, no_data an onboarding one. The icon is decorative; the heading + body carry the meaning (both required, no package-supplied default copy, STA-003). Required context: heading (except at size="sm", see below), body (required at every scale, STA-003). Optional: variant ("no_data" default or "no_results"), icon (registry name), action_href, action_label. size ("sm" | "md", default "md"): emitted as bw-empty-state--size-sm only when "sm" is supplied (ADR-060, STA-019, #218); "lg" is not an earned value. "sm" is the in-panel scale, for an empty state nested inside a card or other bounded container rather than filling a page: it takes the tighter --bw-space-6 block padding, demotes the heading to a
(optional at this scale; body stays required at every scale), suppresses the icon unless one is explicitly passed, and renders any action_href/action_label as a plain bw-empty-state__action-link rather than a bw-btn--primary. At the default "md" the rendered output is unchanged (byte-identical) from before this option existed. Named blocks (semver-public, BR-BW-TPL-001), all empty by default: icon: present SINCE 3.4.0, with no deprecated predecessor: this is NEW capability, not a rename. Wraps the existing icon-resolution branch (CMP-032); an override replaces the whole icon markup. heading: present SINCE 3.4.0, the concise, correct successor to the deprecated title block below (ADR-077 SS4). Wraps the existing {{ heading }} rendering, matching both the context variable it wraps and the bw-empty-state__heading class it sits inside; "title" named neither correctly and is deprecated in the same cycle. body: present SINCE 3.4.0, the concise, correct successor to the deprecated description block below (ADR-077 SS4). Wraps the existing {{ body }} rendering, matching both the context variable it wraps and the bw-empty-state__body class it sits inside; "description" named neither correctly and is deprecated in the same cycle. action: present SINCE 3.4.0, the concise successor to the deprecated empty_state_action block below (CMP-032). Default content is the existing action_href/action_label anchor rendering, so a call site filling only those two context variables renders exactly what it always did. title, description, empty_state_action: present since before 3.4.0 (unchanged back to at least 3.2.1). DEPRECATED, removed at 4.0 (ADR-077 SS4, BR-BW-TPL-001/BR-BW-VER-001). Kept as additional empty extension points for backwards compatibility: a shipped block name cannot be renamed silently. Each deprecated block renders alongside its concise successor when both are filled; a caller migrating to the concise names fills heading/body/action only. TRAP: "title" is the deprecated name HERE, superseded by "heading", but "title" is simultaneously the concise, CURRENT block name in _modal.html, _slide_over.html and _card.html. The same word means opposite version states depending on which file it is copied between; check the file you are actually extending, not a name remembered from another component. A call site that supplies only heading/body/variant/icon/action_href/ action_label (the pre-existing context-variable path) renders byte-identical output to before these blocks existed. A block name this file does not define is SILENTLY DISCARDED by Django: no error, no warning, DEBUG=True does not catch it. If you extend this template using a name read from a newer checkout than the version you have pinned, check that name against your pinned version's own header before relying on it, or the region renders nothing. States: two content variants (no_data default, no_results, each pairing a different default icon and a different suggested action), and two scales (md default, sm). No interactive open/closed state: it is static markup, always fully rendered. Accessibility: the icon is decorative (bw_icon decorative=True); heading and body text carry the meaning, so the icon alone never communicates status. At the default scale the heading is a real
(an in-panel empty state nested inside a card should not contribute a page-level heading). Covered by axe.spec.mjs against console-*.html (size="md", app/console.html's own shape) and console-sm-*.html (size="sm", both themes). Responsive: no breakpoint switch; no width-dependent CSS on any .bw-empty-state* selector. The size axis (sm/md) is a fixed, explicitly chosen scale, never a viewport-driven one. {% endcomment %}
{% block body %}{% block description %}{{ body }}{% endblock %}{% endblock %}
{% block action %} {% if action_href and action_label %} {% if size == "sm" %} {{ action_label }} {% else %} {{ action_label }} {% endif %} {% endif %} {% endblock %} {% block empty_state_action %}{% endblock %}