Class: PhlexKit::ComboboxPopover

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/combobox/combobox_popover.rb

Overview

The combobox dropdown panel — like upstream, a native [popover] (manual: the controller owns open/close and click-outside), anchor-positioned to the combobox with viewport-edge flipping (combobox.css). The keyboard nav actions ride on it, since focus sits in the search input inside. See combobox.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ ComboboxPopover

Returns a new instance of ComboboxPopover.



8
9
10
# File 'app/components/phlex_kit/combobox/combobox_popover.rb', line 8

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

Instance Method Details

#view_templateObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/components/phlex_kit/combobox/combobox_popover.rb', line 12

def view_template(&)
  div(**mix({
    class: "pk-combobox-popover",
    popover: "manual",
    data: {
      phlex_kit__combobox_target: "popover",
      action: [
        "keydown.down->phlex-kit--combobox#keyDownPressed",
        "keydown.up->phlex-kit--combobox#keyUpPressed",
        "keydown.enter->phlex-kit--combobox#keyEnterPressed",
        "keydown.esc->phlex-kit--combobox#closePopover:prevent"
      ].join(" ")
    }
  }, @attrs), &)
end