Sha256: a6efd710bfaec4f733dae2e7a050ddf7a23cb80e6aa14e3be5d3f24f2e7be748

Contents?: true

Size: 827 Bytes

Versions: 61

Compression:

Stored size: 827 Bytes

Contents

# frozen_string_literal: true

module Primer
  module Forms
    module Dsl
      # :nodoc:
      class RadioButtonGroupInput < Input
        attr_reader :name, :label, :radio_buttons

        def initialize(name:, label: nil, **system_arguments)
          @name = name
          @label = label
          @radio_buttons = []

          super(**system_arguments)

          yield(self) if block_given?
        end

        def to_component
          RadioButtonGroup.new(input: self)
        end

        def type
          :radio_button_group
        end

        def radio_button(**system_arguments, &block)
          @radio_buttons << RadioButtonInput.new(
            builder: @builder, form: @form, name: @name, disabled: disabled?,
            **system_arguments, &block
          )
        end
      end
    end
  end
end

Version data entries

61 entries across 61 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.23.0 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.19.0 lib/primer/forms/dsl/radio_button_group_input.rb
openproject-primer_view_components-0.22.2 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.18.2 lib/primer/forms/dsl/radio_button_group_input.rb
openproject-primer_view_components-0.22.1 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.18.1 lib/primer/forms/dsl/radio_button_group_input.rb
openproject-primer_view_components-0.22.0 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.18.0 lib/primer/forms/dsl/radio_button_group_input.rb
openproject-primer_view_components-0.21.0 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.17.0 lib/primer/forms/dsl/radio_button_group_input.rb
openproject-primer_view_components-0.20.0 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.16.1 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.16.0 lib/primer/forms/dsl/radio_button_group_input.rb
openproject-primer_view_components-0.19.0 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.15.1 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.15.0 lib/primer/forms/dsl/radio_button_group_input.rb
openproject-primer_view_components-0.18.1 lib/primer/forms/dsl/radio_button_group_input.rb
openproject-primer_view_components-0.17.1 lib/primer/forms/dsl/radio_button_group_input.rb
openproject-primer_view_components-0.17.0 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.14.0 lib/primer/forms/dsl/radio_button_group_input.rb