Sha256: 3e57fbe2be3395dadccce8c40ce290e119af6f7c3cd6e1963a1bfd6cdff4b833

Contents?: true

Size: 623 Bytes

Versions: 2

Compression:

Stored size: 623 Bytes

Contents

# frozen_string_literal: true

module Yattho
  module Forms
    # :nodoc:
    class SelectList < BaseComponent
      delegate :builder, :form, to: :@input

      def initialize(input:)
        @input = input
        @input.add_input_classes(
          "FormControl-select",
          "FormControl--medium"
        )

        @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

2 entries across 2 versions & 1 rubygems

Version Path
yattho_view_components-0.1.1 lib/yattho/forms/select_list.rb
yattho_view_components-0.0.1 lib/yattho/forms/select_list.rb