Class: FoxTail::DropdownTriggerComponent::StimulusController
- Inherits:
-
StimulusController
- Object
- StimulusController
- FoxTail::DropdownTriggerComponent::StimulusController
- Defined in:
- app/components/fox_tail/dropdown_trigger_component.rb
Constant Summary collapse
- TRIGGER_TYPES =
{ hover: { show: :click, hoverShow: :mouseenter, hoverHide: :mouseleave }, click: { toggle: :click } }.freeze
Instance Attribute Summary
Attributes inherited from StimulusController
Instance Method Summary collapse
Methods inherited from StimulusController
#action, #action_param_key, #build_actions, #classes_key, #config, #event, #initialize, #merge, #merge!, #outlet_key, #target_key, #to_s, #to_sym, #value_key
Constructor Details
This class inherits a constructor from FoxTail::StimulusController
Instance Method Details
#attributes(options = {}) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'app/components/fox_tail/dropdown_trigger_component.rb', line 37 def attributes( = {}) trigger_type = [:trigger_type]&.to_sym attributes = super attributes[:data][value_key(:delay)] = [:delay] attributes[:data][outlet_key(dropdown_identifier)] = [:selector] attributes[:data][classes_key(:open)] = [:open_classes] attributes[:data][classes_key(:closed)] = [:closed_classes] attributes[:data][:action] = build_actions(TRIGGER_TYPES[trigger_type]) attributes end |
#dropdown_identifier ⇒ Object
33 34 35 |
# File 'app/components/fox_tail/dropdown_trigger_component.rb', line 33 def dropdown_identifier FoxTail::DropdownComponent.stimulus_controller_identifier end |