Class: Yattho::Alpha::HiddenTextExpander
- Defined in:
- app/components/yattho/alpha/hidden_text_expander.rb
Overview
Use ‘HiddenTextExpander` to indicate and toggle hidden text.
Constant Summary
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
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(inline: false, button_arguments: {}, **system_arguments) ⇒ HiddenTextExpander
constructor
A new instance of HiddenTextExpander.
Methods inherited from Component
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(inline: false, button_arguments: {}, **system_arguments) ⇒ HiddenTextExpander
Returns a new instance of HiddenTextExpander.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/components/yattho/alpha/hidden_text_expander.rb', line 27 def initialize(inline: false, button_arguments: {}, **system_arguments) @system_arguments = deny_tag_argument(**system_arguments) @button_arguments = @system_arguments[:tag] = :span @system_arguments[:classes] = class_names( "hidden-text-expander", @system_arguments[:classes], "inline" => inline ) aria_label = system_arguments[:'aria-label'] || system_arguments.dig(:aria, :label) || @aria_label if aria_label.present? @button_arguments[:'aria-label'] = aria_label @system_arguments[:aria]&.delete(:label) end @button_arguments[:classes] = class_names( "ellipsis-expander", [:classes] ) end |
Instance Method Details
#call ⇒ Object
50 51 52 53 54 |
# File 'app/components/yattho/alpha/hidden_text_expander.rb', line 50 def call render(Yattho::BaseComponent.new(**@system_arguments)) do render(Yattho::Alpha::HellipButton.new(**@button_arguments)) end end |