Class: ShadcnPhlexcomponents::DropdownMenuSubContent

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, side: :right, align: :start, **attributes) ⇒ DropdownMenuSubContent

Returns a new instance of DropdownMenuSubContent.



106
107
108
109
110
111
# File 'lib/shadcn_phlexcomponents/components/dropdown_menu_sub.rb', line 106

def initialize(aria_id: nil, side: :right, align: :start, **attributes)
  @side = side
  @align = align
  @aria_id = aria_id
  super(**attributes)
end

Instance Method Details

#default_attributesObject



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/shadcn_phlexcomponents/components/dropdown_menu_sub.rb', line 113

def default_attributes
  {
    id: "#{@aria_id}-content",
    tabindex: -1,
    role: "menu",
    aria: {
      labelledby: "#{@aria_id}-trigger",
      orientation: "vertical",
    },
    data: {
      state: "closed",
      side: @side,
      align: @align,
      dropdown_menu_sub_target: "content",
      action: "        mouseover->dropdown-menu-sub#open\#{\" \"}\n        keydown.up->dropdown-menu-sub#focusItemByIndex:prevent:self\n        keydown.down->dropdown-menu-sub#focusItemByIndex:prevent:self\n      HEREDOC\n    },\n  }\nend\n",

#view_templateObject



136
137
138
139
140
# File 'lib/shadcn_phlexcomponents/components/dropdown_menu_sub.rb', line 136

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