{#- chirp-ui: Filter Bar composite Filter-first action container for list/table controls (form + action_strip). Wraps action_strip inside a form. Use one default slot with `chirpui-action-strip__primary`, `__controls`, and `__actions` children. For chip/pill faceted navigation (radiogroup, HTMX, optional register_colors), use chirpui/filter_chips.html — filter_group + filter_chip. See docs/COMPONENT-OPTIONS.md. For simple inline filter forms (2-3 controls, no toolbar chrome), use filter_row — a lightweight cluster form with HTMX support: {% call filter_row("/history/filter", attrs_map={"hx-target": "#results", "hx-swap": "innerHTML", "hx-trigger": "change delay:200ms from:input, change from:select"}) %} {{ text_field("skill", value=q, size="sm") }} {{ select_field("range", options=ranges, size="sm") }} {% end %} Usage (full filter_bar): from "chirpui/filter_bar.html" import filter_bar call filter_bar("/skills", attrs_map={"id": "skills_filters"})
...
...
...
end -#} {% from "chirpui/forms.html" import form %} {% from "chirpui/action_strip.html" import action_strip %} {% def filter_row(action=none, method="get", attrs="", attrs_unsafe="", attrs_map=none, gap="sm", cls="") %} {% set _attrs_raw = attrs_unsafe or (attrs | deprecate_param("attrs", "attrs_unsafe or attrs_map")) %} {% set hx = attrs_map or {} %} {% set _has_hx_request = hx.get("hx-get") or hx.get("hx-post") or hx.get("hx-put") or hx.get("hx-patch") or hx.get("hx-delete") %} {% set _has_hx_target = hx.get("hx-target") %} {% set _default_select = "unset" if _has_hx_request and _has_hx_target and not hx.get("hx-select") else none %} {% set _default_disinherit = "hx-select" if _default_select and not hx.get("hx-disinherit") else none %} {% set _default_sync = "this:replace" if _has_hx_request and _has_hx_target and not hx.get("hx-sync") else none %} {% slot %} {% end %} {% def filter_bar(action, method="get", attrs="", attrs_unsafe="", attrs_map=none, surface_variant="muted", density="sm", wrap="wrap", sticky=false, cls="") %} {% set _attrs_raw = attrs_unsafe or (attrs | deprecate_param("attrs", "attrs_unsafe or attrs_map")) %} {# @provides _bar_surface — no consumers yet (reserved for future use) #} {% provide _bar_surface = surface_variant %} {# @provides _bar_density — consumed by: btn, icon_btn #} {% provide _bar_density = density %} {% call form(action, method=method, attrs_unsafe=_attrs_raw, attrs_map=attrs_map, cls="chirpui-filter-bar__form") %} {% call action_strip(surface_variant=surface_variant, density=density, wrap=wrap, sticky=sticky, role="region", aria_label="Filter controls", cls="chirpui-filter-bar" ~ (" " ~ cls if cls else "")) %} {{ caller() }} {% end %} {% end %} {% end %} {% end %} {% end %}