Sha256: 88f3aa9275f8e04b7a8147571c11cf421108838b78c8f204f8ebe8555e9a21f4

Contents?: true

Size: 716 Bytes

Versions: 55

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

module Primer
  module Forms
    # :nodoc:
    class FormControl < BaseComponent
      delegate :builder, :form, to: :@input

      def initialize(input:, tag: :div, **system_arguments)
        @input = input
        @tag = tag
        @input.add_label_classes("FormControl-label")
        @form_group_arguments = {
          **system_arguments,
          class: class_names(
            system_arguments[:class],
            system_arguments[:classes],
            "FormControl",
            "width-full",
            "FormControl--fullWidth" => @input.full_width?
          )
        }

        @form_group_arguments[:hidden] = "hidden" if @input.hidden?
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 2 rubygems

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