Sha256: 8ab84eb568621cd0e4902cd0479b202f45edb584e3f8ce0ed819ad6f227c2a7a
Contents?: true
Size: 1.06 KB
Versions: 23
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Primer module Forms module Dsl # :nodoc: class SelectInput < Input SELECT_ARGUMENTS = [:multiple, :include_blank, :include_hidden, :prompt].freeze attr_reader :name, :label, :options, :select_arguments def initialize(name:, label:, **options) @name = name @label = label @options = [] @select_arguments = {}.tap do |select_args| SELECT_ARGUMENTS.each do |select_arg| select_args[select_arg] = options.delete(select_arg) end end super(**options) yield(self) if block_given? end def multiple? @select_arguments.fetch(:multiple, false) end def to_component Ariadne::Form::Select::Component.new(name:, label:, **@options) end # :nocov: def type :select_list end # :nocov: # :nocov: def focusable? true end # :nocov: end end end end
Version data entries
23 entries across 23 versions & 1 rubygems