Sha256: f83e42b4d238b716566900cd5b047ca67413941507e982505b338ccd2768545e

Contents?: true

Size: 809 Bytes

Versions: 9

Compression:

Stored size: 809 Bytes

Contents

# frozen_string_literal: true

module Primer
  module Forms
    module Dsl
      # :nodoc:
      class CheckBoxGroupInput < Input
        attr_reader :label, :check_boxes

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

          super(**system_arguments)

          add_label_classes("FormControl-label", "mb-2")

          yield(self) if block_given?
        end

        def to_component
          CheckBoxGroup.new(input: self)
        end

        def name
          nil
        end

        def type
          :check_box_group
        end

        def check_box(**system_arguments)
          @check_boxes << CheckBoxInput.new(
            builder: @builder, form: @form, **system_arguments
          )
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
primer_view_components-0.0.94 lib/primer/forms/dsl/check_box_group_input.rb
primer_view_components-0.0.93 lib/primer/forms/dsl/check_box_group_input.rb
primer_view_components-0.0.92 lib/primer/forms/dsl/check_box_group_input.rb
primer_view_components-0.0.91 lib/primer/forms/dsl/check_box_group_input.rb
primer_view_components-0.0.90 lib/primer/forms/dsl/check_box_group_input.rb
primer_view_components-0.0.89 lib/primer/forms/dsl/check_box_group_input.rb
primer_view_components-0.0.88 lib/primer/forms/dsl/check_box_group_input.rb
primer_view_components-0.0.87 lib/primer/forms/dsl/check_box_group_input.rb
primer_view_components-0.0.86 lib/primer/forms/dsl/check_box_group_input.rb