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.7.0 lib/primer/forms/form_control.rb
openproject-primer_view_components-0.6.3 lib/primer/forms/form_control.rb
primer_view_components-0.6.0 lib/primer/forms/form_control.rb
primer_view_components-0.5.1 lib/primer/forms/form_control.rb
primer_view_components-0.5.0 lib/primer/forms/form_control.rb
primer_view_components-0.4.0 lib/primer/forms/form_control.rb
primer_view_components-0.3.1 lib/primer/forms/form_control.rb
primer_view_components-0.3.0 lib/primer/forms/form_control.rb
primer_view_components-0.2.0 lib/primer/forms/form_control.rb
primer_view_components-0.1.9 lib/primer/forms/form_control.rb
primer_view_components-0.1.8 lib/primer/forms/form_control.rb
primer_view_components-0.1.7 lib/primer/forms/form_control.rb
primer_view_components-0.1.6 lib/primer/forms/form_control.rb
primer_view_components-0.1.5 lib/primer/forms/form_control.rb
primer_view_components-0.1.4 lib/primer/forms/form_control.rb