Sha256: 5402f4526bb87e2ebcdea16c9e6b2f797bfa6d66cef76522a8148ac3ae1098fd

Contents?: true

Size: 761 Bytes

Versions: 149

Compression:

Stored size: 761 Bytes

Contents

# frozen_string_literal: true

module Primer
  module Forms
    # :nodoc:
    class RadioButton < BaseComponent
      delegate :builder, :form, to: :@input

      def initialize(input:)
        @input = input
        @input.add_label_classes("FormControl-label")
        @input.add_input_classes("FormControl-radio")
      end

      def nested_form_arguments
        return @nested_form_arguments if defined?(@nested_form_arguments)

        @nested_form_arguments = { hidden: @input.hidden?, **@input.nested_form_arguments }
        @nested_form_arguments[:class] = class_names(
          @nested_form_arguments[:class],
          @nested_form_arguments.delete(:classes),
          "ml-4"
        )

        @nested_form_arguments
      end
    end
  end
end

Version data entries

149 entries across 149 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.33.0 lib/primer/forms/radio_button.rb
primer_view_components-0.25.1 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.32.1 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.32.0 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.29.1 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.29.0 lib/primer/forms/radio_button.rb
primer_view_components-0.23.0 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.28.1 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.28.0 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.27.0 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.26.0 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.25.1 lib/primer/forms/radio_button.rb
primer_view_components-0.22.0 lib/primer/forms/radio_button.rb
primer_view_components-0.21.1 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.25.0 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.24.0 lib/primer/forms/radio_button.rb
primer_view_components-0.21.0 lib/primer/forms/radio_button.rb
primer_view_components-0.20.1 lib/primer/forms/radio_button.rb
primer_view_components-0.20.0 lib/primer/forms/radio_button.rb
openproject-primer_view_components-0.23.0 lib/primer/forms/radio_button.rb