Class: Pulse::Popover

Inherits:
Component
  • Object
show all
Defined in:
app/components/pulse/popover.rb

Overview

Use Popover to bring attention to specific user interface elements, typically to suggest an action or to guide users through a new experience.

By default, the popover renders with absolute positioning, meaning it should usually be wrapped in an element with a relative position in order to be positioned properly. To render the popover with relative positioning, use the relative property.

Constant Summary collapse

CARET_DEFAULT =
:top
CARET_MAPPINGS =
{
  CARET_DEFAULT => 'pulse-caret-top',
  :bottom => 'pulse-caret-bottom',
  :bottom_right => 'Popover-message--bottom-right',
  :bottom_left => 'Popover-message--bottom-left',
  :left => 'pulse-caret-left',
  :left_bottom => 'Popover-message--left-bottom',
  :left_top => 'Popover-message--left-top',
  :right => 'pulse-caret-right',
  :right_bottom => 'Popover-message--right-bottom',
  :right_top => 'Popover-message--right-top',
  :top_left => 'Popover-message--top-left',
  :top_right => 'Popover-message--top-right'
}.freeze
DEFAULT_HEADING_TAG =
:h4

Instance Method Summary collapse

Constructor Details

#initialize(**system_arguments) ⇒ Popover

Returns a new instance of Popover.

Parameters:

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



71
72
73
74
75
76
77
78
# File 'app/components/pulse/popover.rb', line 71

def initialize(**system_arguments)
  @system_arguments = deny_tag_argument(**system_arguments)
  @system_arguments[:tag] = :div
  @system_arguments[:classes] = merge_classes(
    'pulse-relative pulse-z-10 pulse-w-64',
    system_arguments[:classes]
  )
end

Instance Method Details

#body_componentObject



84
85
86
# File 'app/components/pulse/popover.rb', line 84

def body_component
  Pulse::Box.new(**@body_arguments)
end

#render?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'app/components/pulse/popover.rb', line 80

def render?
  body.present?
end