Sha256: 9b54a8fc481904802eea39be5fb0bb63cb86de939c823980db42e6686cbdd0b7

Contents?: true

Size: 1.03 KB

Versions: 42

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

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

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

          super(**options)

          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
          Ariadne::Form::RadioButton::Component.new(name:, value:, label:, **@options)
        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

42 entries across 42 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.93.2 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.93.1 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.93 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.92 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.91 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.90 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.89.1 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.89 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.88 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.87 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.86.9 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.86.8 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.86.7 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.86.6 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.86.5 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.86.4 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.86.3 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.86.2 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.86.1 lib/ariadne/forms/dsl/radio_button_input.rb
ariadne_view_components-0.0.86 lib/ariadne/forms/dsl/radio_button_input.rb