Module: UI::ItemBehavior

Included in:
Item, ItemComponent
Defined in:
app/behaviors/ui/item_behavior.rb

Overview

UI::ItemBehavior

Instance Method Summary collapse

Instance Method Details

#item_actions_html_attributesObject

Returns HTML attributes for the actions container



74
75
76
77
78
79
# File 'app/behaviors/ui/item_behavior.rb', line 74

def item_actions_html_attributes
  {
    class: "shrink-0",
    data: {slot: "item-actions"}
  }
end

#item_classesObject

Returns combined CSS classes for the item



31
32
33
34
35
36
37
38
39
40
# File 'app/behaviors/ui/item_behavior.rb', line 31

def item_classes
  classes_value = respond_to?(:classes, true) ? classes : @classes
  TailwindMerge::Merger.new.merge([
    item_base_classes,
    item_variant_classes,
    item_size_classes,
    classes_value

  ].compact.join(" "))
end

#item_content_html_attributesObject

Returns HTML attributes for the content container



51
52
53
54
55
# File 'app/behaviors/ui/item_behavior.rb', line 51

def item_content_html_attributes
  {
    class: "min-w-0 flex-1"
  }
end

#item_content_text_html_attributesObject

Returns HTML attributes for the content text



58
59
60
61
62
63
# File 'app/behaviors/ui/item_behavior.rb', line 58

def item_content_text_html_attributes
  {
    class: "font-medium",
    data: {slot: "item-content"}
  }
end

#item_description_html_attributesObject

Returns HTML attributes for the description



66
67
68
69
70
71
# File 'app/behaviors/ui/item_behavior.rb', line 66

def item_description_html_attributes
  {
    class: "text-muted-foreground text-sm",
    data: {slot: "item-description"}
  }
end

#item_html_attributesObject

Returns HTML attributes for the item container



21
22
23
24
25
26
27
28
# File 'app/behaviors/ui/item_behavior.rb', line 21

def item_html_attributes
  {
    class: item_classes,
    "data-slot": "item",
    "data-variant": @variant,
    "data-size": @size
  }.compact
end

#item_media_html_attributesObject

Returns HTML attributes for the media container



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

def item_media_html_attributes
  {
    class: "shrink-0",
    data: {slot: "item-media"}
  }
end