Sha256: 05a549915008418af02f4a23380384956ad7133f2517367f480bbea7f2210fae

Contents?: true

Size: 737 Bytes

Versions: 27

Compression:

Stored size: 737 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 = { **@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

27 entries across 27 versions & 1 rubygems

Version Path
primer_view_components-0.0.112 lib/primer/forms/radio_button.rb
primer_view_components-0.0.111 lib/primer/forms/radio_button.rb
primer_view_components-0.0.110 lib/primer/forms/radio_button.rb
primer_view_components-0.0.109 lib/primer/forms/radio_button.rb
primer_view_components-0.0.108 lib/primer/forms/radio_button.rb
primer_view_components-0.0.107 lib/primer/forms/radio_button.rb
primer_view_components-0.0.106 lib/primer/forms/radio_button.rb
primer_view_components-0.0.105 lib/primer/forms/radio_button.rb
primer_view_components-0.0.104 lib/primer/forms/radio_button.rb
primer_view_components-0.0.103 lib/primer/forms/radio_button.rb
primer_view_components-0.0.102 lib/primer/forms/radio_button.rb
primer_view_components-0.0.101 lib/primer/forms/radio_button.rb
primer_view_components-0.0.100 lib/primer/forms/radio_button.rb
primer_view_components-0.0.99 lib/primer/forms/radio_button.rb
primer_view_components-0.0.98 lib/primer/forms/radio_button.rb
primer_view_components-0.0.97 lib/primer/forms/radio_button.rb
primer_view_components-0.0.96 lib/primer/forms/radio_button.rb
primer_view_components-0.0.95 lib/primer/forms/radio_button.rb
primer_view_components-0.0.94 lib/primer/forms/radio_button.rb
primer_view_components-0.0.93 lib/primer/forms/radio_button.rb