Sha256: e12ef1598eab34f5a5daf64922daab1481458256c219bfc86210d87912bf8002

Contents?: true

Size: 758 Bytes

Versions: 6

Compression:

Stored size: 758 Bytes

Contents

# frozen_string_literal: true

require "primer/classify"

module Primer
  module Forms
    # :nodoc:
    class Group < BaseComponent
      VERTICAL = :vertical
      HORIZONTAL = :horizontal
      DEFAULT_LAYOUT = VERTICAL
      LAYOUTS = [VERTICAL, HORIZONTAL].freeze

      def initialize(inputs:, builder:, form:, layout: DEFAULT_LAYOUT, **system_arguments)
        @inputs = inputs
        @builder = builder
        @form = form
        @layout = layout
        @system_arguments = system_arguments

        @system_arguments[:classes] = class_names(
          @system_arguments.delete(:classes),
          "FormControl-horizontalGroup" => horizontal?
        )
      end

      def horizontal?
        @layout == HORIZONTAL
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.49.2 app/lib/primer/forms/group.rb
primer_view_components-0.35.2 app/lib/primer/forms/group.rb
openproject-primer_view_components-0.49.1 app/lib/primer/forms/group.rb
openproject-primer_view_components-0.49.0 app/lib/primer/forms/group.rb
primer_view_components-0.35.1 app/lib/primer/forms/group.rb
primer_view_components-0.35.0 app/lib/primer/forms/group.rb