<% yield %> <% form ||= current_fields_form html_options ||= {} html_options[:id] ||= form.field_id(method) multiple ||= false show_select_all_top ||= false show_select_all_bottom ||= false use_columns ||= false other_options ||= {} options ||= options_for(form, method) labels = labels_for(form, method) option_field_options ||= {} option_field_options[:data] ||= {} option_field_options[:data][:controller] ||= "" option_field_options[:data][:controller] += " fields--field" if multiple option_field_options[:data] = option_field_options[:data].merge({ "select-all-target": 'checkbox' }) option_field_options[:data][:action] ||= "" option_field_options[:data][:action] += " select-all#updateToggle" end %> <% if multiple && (show_select_all_top || show_select_all_bottom) %> <% select_all = capture do %>
<%= tag.div class: [ "hidden", "inline-block dark:border-darkPrimary-600", "border-b pb-4 mb-4": show_select_all_top && !show_select_all_bottom, "border-t pt-4 mt-4": !show_select_all_top && show_select_all_bottom ], data: { "select-all-target": "wrapper" } do %> <% end %> <% if content_for? :actions_on_multiple %> <%= yield :actions_on_multiple %> <% flush_content_for :actions_on_multiple %> <% end %>
<% end %> <% end %> <%= render 'shared/fields/field', form: form, method: method, options: html_options, other_options: other_options do %> <% content_for :field do %> <%= tag.div class: "pt-1.5 pb-1 sm:col-span-2", data: { controller: "select-all", "select-all-unavailable-class": "hidden" } do %> <% if multiple && show_select_all_top && !show_select_all_bottom %> <%= select_all %> <% end %> <%= tag.div class: ["max-w-lg": !use_columns, "max-w-3xl": use_columns, "columns-[var(--column-width,_15ch)_3]": use_columns] do %> <% options.each do |value, label| %> <% end %> <% end %> <% if multiple && !show_select_all_top && show_select_all_bottom %> <%= select_all %> <% end %> <% end %> <% end %> <% end %>