Class: Protos::Popover

Inherits:
Component
  • Object
show all
Defined in:
lib/protos/popover.rb,
lib/protos/popover/content.rb,
lib/protos/popover/trigger.rb

Direct Known Subclasses

Combobox, Dropdown

Defined Under Namespace

Classes: Content, Trigger

Constant Summary collapse

Positions =

DOCS: Like a dropdown, but instead of a list of menu items, its just a rendered block. The popover is triggered by a button or link.

Dropdowns, and popovers in general, use tippy.js to position content rather than pure CSS for accessibility. The layout of pure CSS was too tricky to get right and we felt the dependency tradeoff was worthwhile.

Tippy.js options can be passed in via the ‘options` attribute or, more conveniently by the typed options listed below.

Types::Coercible::Symbol.enum(
  :top,
  :top_start,
  :top_end,
  :right,
  :right_start,
  :right_end,
  :bottom,
  :bottom_start,
  :bottom_end,
  :left,
  :left_start,
  :left_end
)
Animations =
Types::Coercible::Symbol.enum(
  :fade,
  :shift_away,
  :shift_away_subtle,
  :shift_away_extreme,
  :shift_towards,
  :shift_towards_subtle,
  :shift_towards_extreme,
  :scale,
  :scale_subtle,
  :scale_extreme,
  :perspective,
  :perspective_subtle,
  :perspective_extreme
)
Triggers =
Types::Coercible::Symbol.enum(
  :focus,
  :mouseenter,
  :click,
  :focusin,
  :manual
)

Instance Method Summary collapse

Methods inherited from Component

#initialize

Constructor Details

This class inherits a constructor from Protos::Component

Instance Method Details

#contentObject



87
# File 'lib/protos/popover.rb', line 87

def content(...) = render Content.new(...)

#triggerObject



89
# File 'lib/protos/popover.rb', line 89

def trigger(...) = render Trigger.new(...)

#view_templateObject



83
84
85
# File 'lib/protos/popover.rb', line 83

def view_template(&)
  div(**attrs, &)
end