Module: UI::CommandListBehavior

Included in:
CommandList, CommandListComponent
Defined in:
app/behaviors/ui/command_list_behavior.rb

Overview

ListBehavior

Shared behavior for CommandList component.

Instance Method Summary collapse

Instance Method Details

#command_list_classesObject



18
19
20
21
22
23
24
# File 'app/behaviors/ui/command_list_behavior.rb', line 18

def command_list_classes
  classes_value = respond_to?(:classes, true) ? classes : @classes
  TailwindMerge::Merger.new.merge([
    command_list_base_classes,
    classes_value
  ].compact.join(" "))
end

#command_list_data_attributesObject



26
27
28
29
30
31
# File 'app/behaviors/ui/command_list_behavior.rb', line 26

def command_list_data_attributes
  {
    slot: "command-list",
    ui__command_target: "list"
  }
end

#command_list_html_attributesObject



9
10
11
12
13
14
15
16
# File 'app/behaviors/ui/command_list_behavior.rb', line 9

def command_list_html_attributes
  {
    class: command_list_classes,
    data: command_list_data_attributes,
    role: "listbox",
    tabindex: "-1" # Not focusable via Tab - navigation is via arrows in combobox input
  }
end