Class: Primer::AutoComplete::Input
- Defined in:
- app/components/primer/auto_complete.rb
Overview
This component is part of ‘Primer::AutoCompleteComponent` and should not be used as a standalone component.
Constant Summary collapse
- DEFAULT_TYPE =
:text- TYPE_OPTIONS =
[DEFAULT_TYPE, :search].freeze
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(type: DEFAULT_TYPE, **system_arguments) ⇒ Input
constructor
A new instance of Input.
- #missing_label? ⇒ Boolean
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Constructor Details
#initialize(type: DEFAULT_TYPE, **system_arguments) ⇒ Input
Returns a new instance of Input.
134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'app/components/primer/auto_complete.rb', line 134 def initialize(type: DEFAULT_TYPE, **system_arguments) @system_arguments = system_arguments @system_arguments[:tag] = :input @aria_label = system_arguments[:"aria-label"] @aria_labelledby = system_arguments[:"aria-labelledby"] || system_arguments.dig(:aria, :labelledby) @system_arguments[:type] = fetch_or_fallback(TYPE_OPTIONS, type, DEFAULT_TYPE) @system_arguments[:classes] = class_names( "form-control", system_arguments[:classes] ) end |
Instance Method Details
#call ⇒ Object
152 153 154 |
# File 'app/components/primer/auto_complete.rb', line 152 def call render(Primer::BaseComponent.new(**@system_arguments)) end |
#missing_label? ⇒ Boolean
148 149 150 |
# File 'app/components/primer/auto_complete.rb', line 148 def missing_label? @aria_label.blank? && @aria_labelledby.blank? end |