Class: FoxTail::DropdownComponent::StimulusController
- Inherits:
-
StimulusController
- Object
- StimulusController
- FoxTail::DropdownComponent::StimulusController
- Defined in:
- app/components/fox_tail/dropdown_component.rb
Constant Summary collapse
- TRIGGER_TYPES =
{ hover: { hoverShow: :mouseenter, hoverHide: :mouseleave } }.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
115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'app/components/fox_tail/dropdown_component.rb', line 115 def attributes( = {}) trigger_type = [:trigger_type]&.to_sym attributes = super attributes[:data][value_key(:placement)] = [:placement] attributes[:data][value_key(:offset)] = [:offset] attributes[:data][value_key(:shift)] = [:shift] attributes[:data][value_key(:ignore_click_outside)] = [:ignore_click_outside] attributes[:data][value_key(:disable_click_outside)] = [:disable_click_outside] attributes[:data][outlet_key(trigger_identifier)] = "##{[:trigger_id]}" attributes[:data][classes_key(:hidden)] = [:hidden_classes] attributes[:data][classes_key(:visible)] = [:visible_classes] attributes[:data][:action] = build_actions TRIGGER_TYPES[trigger_type] attributes end |
#trigger_identifier ⇒ Object
111 112 113 |
# File 'app/components/fox_tail/dropdown_component.rb', line 111 def trigger_identifier FoxTail::DropdownTriggerComponent.stimulus_controller_identifier end |