Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions dojo/static/dojo/css/dojo.css
Original file line number Diff line number Diff line change
Expand Up @@ -1084,8 +1084,9 @@ span.endpoint_product {
.filter-form-group > .col-lg-3 { grid-column: span 3; }
}

/* Filter category grouping (details/summary) */
/* Filter category grouping (Alpine-toggled accordion) */
.filter-category {
flex: 0 0 100%;
border-bottom: 1px solid var(--color-border, #DCDCDC);
}

Expand All @@ -1097,14 +1098,15 @@ span.endpoint_product {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
padding: 0.5rem 0.25rem;
background: none;
border: none;
font: inherit;
color: inherit;
text-align: left;
cursor: pointer;
user-select: none;
list-style: none;
}

.filter-category-header::-webkit-details-marker {
display: none;
}

.filter-category-title {
Expand All @@ -1121,10 +1123,27 @@ span.endpoint_product {
transition: transform 0.2s ease;
}

.filter-category[open] > .filter-category-header .filter-category-chevron {
.filter-category-chevron.is-open {
transform: rotate(180deg);
}

/* Slide the whole category open/closed via the grid-rows trick so the header
stack moves together smoothly instead of snapping. Works in all browsers. */
.filter-category-content {
display: grid;
grid-template-rows: 0fr;
transition: grid-template-rows 0.2s ease;
}

.filter-category-content.is-open {
grid-template-rows: 1fr;
}

.filter-category-content > .filter-category-clip {
overflow: hidden;
min-height: 0;
}

.filter-category-body {
padding-bottom: 0.75rem;
}
Expand Down
48 changes: 26 additions & 22 deletions dojo/templates/dojo/filter_snippet.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,35 @@
{% endfor %}
{% get_filter_groups form as filter_groups %}
{% for group in filter_groups %}
<details class="filter-category" {% if group.open %}open{% endif %}>
<summary class="filter-category-header">
<div class="filter-category" x-data="{ open: {% if group.open %}true{% else %}false{% endif %} }">
<button type="button" class="filter-category-header" @click="open = !open" :aria-expanded="open">
<span class="filter-category-title">{{ group.name }}</span>
<i class="fa-solid fa-chevron-down filter-category-chevron"></i>
</summary>
<div class="container-fluid filter-form-group filter-category-body">
{% for field in group.fields %}
<div class="col-lg-3 col-md-4 col-sm-6 col-12">
<div class="filter-form-input" style="min-width: 0;">
<label for="{{ field.auto_id }}" class="form-label mb-1" style="display: block;">
{{ field.label }}
{% if field.help_text %}
<i class="fa-solid fa-circle-question has-popover"
data-content="{{ field.help_text }}">
</i>
{% endif %}
</label>
{% with placeholder="placeholder:"|add:field.label %}
{{ field|addcss:"class: form-control filter-form-control"|addcss:placeholder }}
{% endwith %}
</div>
<i class="fa-solid fa-chevron-down filter-category-chevron{% if group.open %} is-open{% endif %}" :class="{ 'is-open': open }"></i>
</button>
<div class="filter-category-content{% if group.open %} is-open{% endif %}" :class="{ 'is-open': open }">
<div class="filter-category-clip">
<div class="container-fluid filter-form-group filter-category-body">
{% for field in group.fields %}
<div class="col-lg-3 col-md-4 col-sm-6 col-12">
<div class="filter-form-input" style="min-width: 0;">
<label for="{{ field.auto_id }}" class="form-label mb-1" style="display: block;">
{{ field.label }}
{% if field.help_text %}
<i class="fa-solid fa-circle-question has-popover"
data-content="{{ field.help_text }}">
</i>
{% endif %}
</label>
{% with placeholder="placeholder:"|add:field.label %}
{{ field|addcss:"class: form-control filter-form-control"|addcss:placeholder }}
{% endwith %}
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
</details>
</div>
{% endfor %}
<div class="container-fluid">
<div class="row mt-3">
Expand Down
Loading