Class: Polaris::TooltipComponent
- Inherits:
-
Component
- Object
- Component
- Polaris::TooltipComponent
- Defined in:
- app/components/polaris/tooltip_component.rb
Constant Summary collapse
- POSITION_OPTIONS =
[:top, :bottom, :left, :right]
- DEFAULT_POSITION =
:bottom
Instance Method Summary collapse
-
#initialize(text: nil, position: DEFAULT_POSITION, active: true, **system_arguments) ⇒ TooltipComponent
constructor
A new instance of TooltipComponent.
Constructor Details
#initialize(text: nil, position: DEFAULT_POSITION, active: true, **system_arguments) ⇒ TooltipComponent
Returns a new instance of TooltipComponent.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/components/polaris/tooltip_component.rb', line 6 def initialize( text: nil, position: DEFAULT_POSITION, active: true, **system_arguments ) @text = text @system_arguments = system_arguments @position = fetch_or_fallback(POSITION_OPTIONS, position, DEFAULT_POSITION) @active = active system_arguments[:data] ||= {} prepend_option(system_arguments[:data], :polaris_tooltip_active_value, @active) prepend_option(system_arguments[:data], :polaris_tooltip_position_value, @position) prepend_option( system_arguments[:data], :action, %w[ mouseenter->polaris-tooltip#show mouseleave->polaris-tooltip#hide focus->polaris-tooltip#show blur->polaris-tooltip#hide ].join(" ") ) prepend_option(system_arguments[:data], :controller, "polaris-tooltip") end |