Class: PhlexKit::MenubarSub

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/menubar/menubar_sub.rb

Overview

Nested submenu wrapper: SubTrigger row + SubContent panel, revealed on hover/focus with pure CSS. Mirrors shadcn/ui's MenubarSub. See menubar.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ MenubarSub

Returns a new instance of MenubarSub.



5
# File 'app/components/phlex_kit/menubar/menubar_sub.rb', line 5

def initialize(**attrs) = (@attrs = attrs)

Instance Method Details

#view_templateObject



6
7
8
9
10
11
12
13
# File 'app/components/phlex_kit/menubar/menubar_sub.rb', line 6

def view_template(&)
  # syncSub mirrors the CSS-driven open state (:hover / :focus-within)
  # onto the sub trigger's aria-expanded.
  div(**mix({
    class: "pk-menubar-sub",
    data: { action: "mouseenter->phlex-kit--menubar#syncSub mouseleave->phlex-kit--menubar#syncSub focusin->phlex-kit--menubar#syncSub focusout->phlex-kit--menubar#syncSub" }
  }, @attrs), &)
end