Class: ShadcnPhlexcomponents::DropdownMenuSub

Inherits:
Base
  • Object
show all
Defined in:
lib/shadcn_phlexcomponents/components/dropdown_menu_sub.rb

Constant Summary

Constants inherited from Base

Base::SANITIZER_ALLOWED_ATTRIBUTES, Base::SANITIZER_ALLOWED_TAGS, Base::TAILWIND_MERGER

Instance Method Summary collapse

Methods inherited from Base

#before_template, #convert_collection_hash_to_struct, #find_as_child, #icon, #item_disabled?, #merge_default_attributes, #merged_as_child_attributes, #nokogiri_attributes_to_hash, #overlay, #sanitize_as_child

Constructor Details

#initialize(aria_id: nil, **attributes) ⇒ DropdownMenuSub

Returns a new instance of DropdownMenuSub.



5
6
7
8
# File 'lib/shadcn_phlexcomponents/components/dropdown_menu_sub.rb', line 5

def initialize(aria_id: nil, **attributes)
  @aria_id = aria_id
  super(**attributes)
end

Instance Method Details

#content(**attributes) ⇒ Object



14
15
16
# File 'lib/shadcn_phlexcomponents/components/dropdown_menu_sub.rb', line 14

def content(**attributes, &)
  DropdownMenuSubContent(aria_id: @aria_id, **attributes, &)
end

#default_attributes ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/shadcn_phlexcomponents/components/dropdown_menu_sub.rb', line 18

def default_attributes
  {
    data: {
      controller: "dropdown-menu-sub",
      action: "keydown.left->dropdown-menu-sub#closeOnLeftKeydown:prevent",
    },
  }
end

#trigger(**attributes) ⇒ Object



10
11
12
# File 'lib/shadcn_phlexcomponents/components/dropdown_menu_sub.rb', line 10

def trigger(**attributes, &)
  DropdownMenuSubTrigger(aria_id: @aria_id, **attributes, &)
end

#view_template ⇒ Object



27
28
29
# File 'lib/shadcn_phlexcomponents/components/dropdown_menu_sub.rb', line 27

def view_template(&)
  div(**@attributes, &)
end