Sha256: dda3f69ed0780eead659e948bc196185cae885d79e7b5cf5ad109f31fe456f16

Contents?: true

Size: 1.08 KB

Versions: 18

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Primer
  module Forms
    module Dsl
      # :nodoc:
      class RadioButtonInput < Input
        attr_reader :name, :value, :label, :nested_form_block, :nested_form_arguments

        def initialize(name:, value:, label:, **system_arguments)
          @name = name
          @value = value
          @label = label

          super(**system_arguments)

          yield(self) if block_given?
        end

        # radio buttons cannot be invalid, as both selected and unselected are valid states
        # :nocov:
        def valid?
          true
        end
        # :nocov:

        def to_component
          RadioButton.new(input: self)
        end

        def nested_form(**system_arguments, &block)
          @nested_form_arguments = system_arguments
          @nested_form_block = block
        end

        # :nocov:
        def type
          :radio_button
        end
        # :nocov:

        def supports_validation?
          false
        end

        def values_disambiguate_template_names?
          true
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
primer_view_components-0.36.5 app/lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.52.2 app/lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.36.4 app/lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.52.1 app/lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.52.0 app/lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.36.3 app/lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.51.0 app/lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.36.2 app/lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.50.1 app/lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.50.0 app/lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.36.1 app/lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.36.0 app/lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.49.2 app/lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.35.2 app/lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.49.1 app/lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.49.0 app/lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.35.1 app/lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.35.0 app/lib/primer/forms/dsl/radio_button_input.rb