Module: UI::CommandBehavior

Included in:
Command, CommandComponent
Defined in:
app/behaviors/ui/command_behavior.rb

Overview

UI::CommandBehavior

Instance Method Summary collapse

Instance Method Details

#command_classesObject



42
43
44
45
46
47
48
# File 'app/behaviors/ui/command_behavior.rb', line 42

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

#command_data_attributesObject



50
51
52
53
54
55
56
57
# File 'app/behaviors/ui/command_behavior.rb', line 50

def command_data_attributes
  {
    controller: "ui--command",
    slot: "command",
    ui__command_loop_value: @loop.to_s,
    ui__command_autofocus_value: @autofocus.to_s
  }
end

#command_html_attributesObject



35
36
37
38
39
40
# File 'app/behaviors/ui/command_behavior.rb', line 35

def command_html_attributes
  {
    class: command_classes,
    data: command_data_attributes
  }
end