Class: Primer::Forms::Dsl::TextAreaInput
- Defined in:
- app/lib/primer/forms/dsl/text_area_input.rb
Overview
:nodoc:
Constant Summary
Constants inherited from Input
Input::DEFAULT_SIZE, Input::SIZE_MAPPINGS, Input::SIZE_OPTIONS, Input::SPACE_DELIMITED_ARIA_ATTRIBUTES
Instance Attribute Summary collapse
-
#character_limit ⇒ Object
readonly
Returns the value of attribute character_limit.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Input
#base_id, #builder, #caption, #form, #form_control, #ids, #input_arguments, #label_arguments, #validation_message
Instance Method Summary collapse
- #character_limit? ⇒ Boolean
-
#focusable? ⇒ Boolean
:nocov:.
-
#initialize(name:, label:, **system_arguments) ⇒ TextAreaInput
constructor
A new instance of TextAreaInput.
- #to_component ⇒ Object
- #type ⇒ Object
Methods inherited from Input
#add_input_aria, #add_input_classes, #add_input_data, #add_label_classes, #autofocus!, #caption?, #caption_id, #caption_template?, #character_limit_id, #character_limit_target_prefix, #disabled?, #full_width?, #hidden?, #id, #input?, #invalid?, #merge_input_arguments!, #remove_input_data, #render_caption_template, #required?, #size, #supports_validation?, #valid?, #validation_arguments, #validation_error_icon_target, #validation_id, #validation_message_arguments, #validation_messages, #validation_success_icon_target, #value, #values_disambiguate_template_names?
Methods included from ClassNameHelper
Constructor Details
#initialize(name:, label:, **system_arguments) ⇒ TextAreaInput
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/lib/primer/forms/dsl/text_area_input.rb', line 10 def initialize(name:, label:, **system_arguments) @name = name @label = label @character_limit = system_arguments.delete(:character_limit) if @character_limit.present? && @character_limit.to_i <= 0 raise ArgumentError, "character_limit must be a positive integer, got #{@character_limit}" end super(**system_arguments) add_input_data(:target, "primer-text-area.inputElement") end |
Instance Attribute Details
#character_limit ⇒ Object (readonly)
Returns the value of attribute character_limit.
8 9 10 |
# File 'app/lib/primer/forms/dsl/text_area_input.rb', line 8 def character_limit @character_limit end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
8 9 10 |
# File 'app/lib/primer/forms/dsl/text_area_input.rb', line 8 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'app/lib/primer/forms/dsl/text_area_input.rb', line 8 def name @name end |
Instance Method Details
#character_limit? ⇒ Boolean
32 33 34 |
# File 'app/lib/primer/forms/dsl/text_area_input.rb', line 32 def character_limit? @character_limit.present? end |
#focusable? ⇒ Boolean
:nocov:
37 38 39 |
# File 'app/lib/primer/forms/dsl/text_area_input.rb', line 37 def focusable? true end |
#to_component ⇒ Object
24 25 26 |
# File 'app/lib/primer/forms/dsl/text_area_input.rb', line 24 def to_component TextArea.new(input: self) end |
#type ⇒ Object
28 29 30 |
# File 'app/lib/primer/forms/dsl/text_area_input.rb', line 28 def type :text_area end |