Sha256: 189a953c40797938fe503dd0491fe2ea68c7028c846e8249f42b950e16d5d238

Contents?: true

Size: 1 KB

Versions: 71

Compression:

Stored size: 1 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
      end
    end
  end
end

Version data entries

71 entries across 71 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.48.2 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.48.1 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.48.0 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.47.1 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.47.0 lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.34.0 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.46.1 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.46.0 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.45.0 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.44.3 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.44.2 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.44.1 lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.33.0 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.44.0 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.43.1 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.43.0 lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.32.0 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.42.0 lib/primer/forms/dsl/radio_button_input.rb
primer_view_components-0.31.0 lib/primer/forms/dsl/radio_button_input.rb
openproject-primer_view_components-0.41.1 lib/primer/forms/dsl/radio_button_input.rb