Sha256: b3f8e4f7291ef9afff9f9d6688fb5653ffa8d67fba533bc75abbd16dcda3f9b3

Contents?: true

Size: 651 Bytes

Versions: 49

Compression:

Stored size: 651 Bytes

Contents

# frozen_string_literal: true

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

      def initialize(input:)
        @input = input
        @input.add_input_classes(
          "FormControl-select",
          Primer::Forms::Dsl::Input::SIZE_MAPPINGS[@input.size]
        )

        @field_wrap_arguments = {
          class: "FormControl-select-wrap",
          hidden: @input.hidden?
        }
      end

      def options
        @options ||= @input.options.map do |option|
          [option.label, option.value, option.system_arguments]
        end
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.11.0 lib/primer/forms/select.rb
openproject-primer_view_components-0.10.0 lib/primer/forms/select.rb
primer_view_components-0.9.0 lib/primer/forms/select.rb
openproject-primer_view_components-0.9.1 lib/primer/forms/select.rb
openproject-primer_view_components-0.9.0 lib/primer/forms/select.rb
openproject-primer_view_components-0.8.0 lib/primer/forms/select.rb
primer_view_components-0.8.0 lib/primer/forms/select.rb
primer_view_components-0.7.0 lib/primer/forms/select.rb
openproject-primer_view_components-0.7.0 lib/primer/forms/select.rb
openproject-primer_view_components-0.6.3 lib/primer/forms/select.rb
primer_view_components-0.6.0 lib/primer/forms/select.rb
primer_view_components-0.5.1 lib/primer/forms/select.rb
primer_view_components-0.5.0 lib/primer/forms/select.rb
primer_view_components-0.4.0 lib/primer/forms/select.rb
primer_view_components-0.3.1 lib/primer/forms/select.rb
primer_view_components-0.3.0 lib/primer/forms/select.rb
primer_view_components-0.2.0 lib/primer/forms/select.rb
primer_view_components-0.1.9 lib/primer/forms/select.rb
primer_view_components-0.1.8 lib/primer/forms/select.rb
primer_view_components-0.1.7 lib/primer/forms/select.rb