Class: FoxTail::Tabs::TabComponent
- Inherits:
-
ClickableComponent
- Object
- ClickableComponent
- FoxTail::Tabs::TabComponent
show all
- Defined in:
- app/components/fox_tail/tabs/tab_component.rb
Defined Under Namespace
Classes: StimulusController
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.stimulus_controller_name ⇒ Object
105
106
107
|
# File 'app/components/fox_tail/tabs/tab_component.rb', line 105
def stimulus_controller_name
:tab
end
|
Instance Method Details
#before_render ⇒ Object
61
62
63
64
65
66
67
68
|
# File 'app/components/fox_tail/tabs/tab_component.rb', line 61
def before_render
super
html_attributes[:role] = :tab
html_attributes[:aria] ||= {}
html_attributes[:aria][:selected] = selected?
html_attributes[:aria][:controls] = panel_id if panel_id?
end
|
#call ⇒ Object
70
71
72
73
74
75
76
|
# File 'app/components/fox_tail/tabs/tab_component.rb', line 70
def call
super do
concat left_visual if left_visual?
concat content
concat right_visual if right_visual?
end
end
|
#stimulus_controller_options ⇒ Object
82
83
84
85
86
87
88
89
90
|
# File 'app/components/fox_tail/tabs/tab_component.rb', line 82
def stimulus_controller_options
{
selected: selected?,
active_classes: active_classes,
selected_classes: selected_classes,
siblings: tabs_id? ? "##{tabs_id} [data-controller~='fox_tail--tab']" : nil,
panel: panel_id? ? "##{panel_id}" : nil
}
end
|
#use_stimulus? ⇒ Boolean
78
79
80
|
# File 'app/components/fox_tail/tabs/tab_component.rb', line 78
def use_stimulus?
!disabled? && super
end
|
#visuals? ⇒ Boolean
57
58
59
|
# File 'app/components/fox_tail/tabs/tab_component.rb', line 57
def visuals?
left_visual? || right_visual?
end
|