Class: Primer::Forms::FieldsetGroup
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Primer::Forms::FieldsetGroup
- Defined in:
- app/lib/primer/forms/fieldset_group.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(title:, inputs:, builder:, form:, layout: Primer::Forms::Group::DEFAULT_LAYOUT, heading_arguments: {}, group_arguments: {}, **system_arguments) ⇒ FieldsetGroup
constructor
A new instance of FieldsetGroup.
Methods inherited from BaseComponent
#content, inherited, #input?, #perform_render, #render?, #to_component, #type
Methods included from ActsAsComponent
#base_template_path, #compile!, extended, #renders_templates, #template_root_path
Methods included from ClassNameHelper
Constructor Details
#initialize(title:, inputs:, builder:, form:, layout: Primer::Forms::Group::DEFAULT_LAYOUT, heading_arguments: {}, group_arguments: {}, **system_arguments) ⇒ FieldsetGroup
Returns a new instance of FieldsetGroup.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/lib/primer/forms/fieldset_group.rb', line 19 def initialize( # rubocop:disable Metrics/AbcSize title:, inputs:, builder:, form:, layout: Primer::Forms::Group::DEFAULT_LAYOUT, heading_arguments: {}, group_arguments: {}, **system_arguments ) super() @title = title @heading_arguments = heading_arguments @heading_arguments[:id] ||= "subhead-#{SecureRandom.uuid}" @heading_arguments[:tag] ||= :h3 @heading_arguments[:size] ||= :medium @fieldset_arguments = { legend_text: @title, visually_hide_legend: true, aria: { labelledby: @heading_arguments[:id] } } @group_arguments = group_arguments.merge(inputs:, builder:, form:, layout:) @system_arguments = system_arguments @system_arguments[:tag] = :section @system_arguments[:mb] ||= 4 @system_arguments[:aria] ||= {} @system_arguments[:aria][:labelledby] = @heading_arguments[:id] @system_arguments[:hidden] = :none if inputs.all?(&:hidden?) end |