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
primer_view_components-0.19.0 lib/primer/forms/select.rb
primer_view_components-0.18.2 lib/primer/forms/select.rb
primer_view_components-0.18.1 lib/primer/forms/select.rb
primer_view_components-0.18.0 lib/primer/forms/select.rb
primer_view_components-0.17.0 lib/primer/forms/select.rb
primer_view_components-0.16.1 lib/primer/forms/select.rb
primer_view_components-0.16.0 lib/primer/forms/select.rb
primer_view_components-0.15.1 lib/primer/forms/select.rb
primer_view_components-0.15.0 lib/primer/forms/select.rb
primer_view_components-0.14.0 lib/primer/forms/select.rb
openproject-primer_view_components-0.14.0 lib/primer/forms/select.rb
openproject-primer_view_components-0.13.1 lib/primer/forms/select.rb
primer_view_components-0.13.2 lib/primer/forms/select.rb
primer_view_components-0.13.1 lib/primer/forms/select.rb
openproject-primer_view_components-0.13.0 lib/primer/forms/select.rb
primer_view_components-0.13.0 lib/primer/forms/select.rb
primer_view_components-0.12.0 lib/primer/forms/select.rb
primer_view_components-0.11.0 lib/primer/forms/select.rb
openproject-primer_view_components-0.12.1 lib/primer/forms/select.rb
primer_view_components-0.10.0 lib/primer/forms/select.rb