<%= turbo_frame_tag @card, :assignment do %>
  <%= tag.div class: "max-width", data: {
				action: "turbo:before-cache@document->dialog#close keydown->navigable-list#navigate filter:changed->navigable-list#reset",
				controller: "filter navigable-list",
				dialog_target: "dialog",
				navigable_list_focus_on_selection_value: false,
				navigable_list_actionable_items_value: true } do %>
    <strong class="popup__title txt-nowrap">Assign this to…</strong>

    <% if @collection.users.active.count > 1 %>
			<%= text_field_tag :search, nil, placeholder: "Filter…", class: "input input--transparent txt-small margin-block-half", autofocus: true,
						type: "search", autocorrect: "off", autocomplete: "off", data: { "1p-ignore": "true", filter_target: "input", action: "input->filter#filter" } %>
    <% end %>

    <ul class="popup__list" data-filter-target="list">
      <% @collection.users.active.alphabetically.each do |user| %>
        <li class="popup__group flex align-center full-width" data-value="<%= user.name.downcase %>" data-filter-target="item" data-navigable-list-target="item">
          <%= button_to card_assignments_path(@card, params: { assignee_id: user.id }), method: :post,
              class: "btn popup__item min-width flex-item-grow full-width unpad-inline",
              form_class: "max-width flex-item-grow" do %>
            <span class="overflow-ellipsis flex-item-grow"><%= user.name %></span>
            <%= icon_tag "check", size: 18, class: "checked flex-item-no-shrink flex-item-justify-end", style: "--icon-size: 1em" if @card.assignees.include?(user) %>
          <% end %>
        </li>
      <% end %>
    </ul>
  <% end %>
<% end %>
