Class: Shadcn::Tooltip::Provider::Component

Inherits:
ApplicationViewComponent show all
Defined in:
app/components/shadcn/tooltip/provider/component.rb

Overview

TooltipProvider — in React this only supplies the shared delay through context. Kept as a component so call sites read like the TSX; it renders nothing but its children.

Constant Summary

Constants inherited from ApplicationViewComponent

ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS

Instance Attribute Summary collapse

Attributes inherited from ApplicationViewComponent

#attributes

Instance Method Summary collapse

Methods inherited from ApplicationViewComponent

#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name

Constructor Details

#initialize(delay_duration: 0, **attributes) ⇒ Component

Returns a new instance of Component.



14
15
16
17
# File 'app/components/shadcn/tooltip/provider/component.rb', line 14

def initialize(delay_duration: 0, **attributes)
  @delay_duration = delay_duration
  super(**attributes)
end

Instance Attribute Details

#delay_durationObject (readonly)

Returns the value of attribute delay_duration.



12
13
14
# File 'app/components/shadcn/tooltip/provider/component.rb', line 12

def delay_duration
  @delay_duration
end

Instance Method Details

#element_attributes(**defaults) ⇒ Object



19
20
21
22
23
24
# File 'app/components/shadcn/tooltip/provider/component.rb', line 19

def element_attributes(**defaults)
  super(**{
    style: merged_style(CONTENTS_STYLE),
    "data-delay-duration" => delay_duration
  }.merge(defaults))
end