Class: StimulusPlumbers::Components::Combobox::Config

Inherits:
Plumber::Config show all
Defined in:
lib/stimulus_plumbers/components/combobox/config.rb

Overview

Yielded to Combobox#render: selects a variant renderer, then exposes its metadata (trigger/wrapper wiring) and renders its panel body.

Defined Under Namespace

Modules: DefaultMetadata

Instance Attribute Summary

Attributes inherited from Plumber::Config

#template

Instance Method Summary collapse

Methods inherited from Plumber::Config

#initialize

Constructor Details

This class inherits a constructor from StimulusPlumbers::Plumber::Config

Instance Method Details

#date(**options) ⇒ Object



17
18
19
# File 'lib/stimulus_plumbers/components/combobox/config.rb', line 17

def date(**options)
  select(Date, options)
end


9
10
11
# File 'lib/stimulus_plumbers/components/combobox/config.rb', line 9

def dropdown(**options)
  select(Dropdown, options)
end

#metadataObject



37
38
39
# File 'lib/stimulus_plumbers/components/combobox/config.rb', line 37

def 
  renderer ? renderer::Metadata : DefaultMetadata
end

#optionsObject



33
34
35
# File 'lib/stimulus_plumbers/components/combobox/config.rb', line 33

def options
  config(:options) || {}
end

#render_panel(panel_attrs:) ⇒ Object



41
42
43
# File 'lib/stimulus_plumbers/components/combobox/config.rb', line 41

def render_panel(panel_attrs:)
  renderer&.new(template)&.render(panel_attrs: panel_attrs, **options)
end

#rendererObject



29
30
31
# File 'lib/stimulus_plumbers/components/combobox/config.rb', line 29

def renderer
  config(:renderer)
end

#selected?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/stimulus_plumbers/components/combobox/config.rb', line 25

def selected?
  configured?(:renderer)
end

#time(**options) ⇒ Object



21
22
23
# File 'lib/stimulus_plumbers/components/combobox/config.rb', line 21

def time(**options)
  select(Time, options)
end

#typeahead(**options) ⇒ Object



13
14
15
# File 'lib/stimulus_plumbers/components/combobox/config.rb', line 13

def typeahead(**options)
  select(Typeahead, options)
end