Sha256: 22baa4fa97263d7515e4fae500aa6257aa95ec316d1724a30b6706e0a8537b37

Contents?: true

Size: 812 Bytes

Versions: 18

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true

module Primer
  # :nodoc:
  class FormComponents
    def self.from_input(input_klass)
      Class.new(Primer::Component) do
        @input_klass = input_klass

        class << self
          attr_reader :input_klass
        end

        def initialize(**system_arguments, &block)
          @system_arguments = system_arguments
          @block = block
        end

        def call
          builder = Primer::Forms::Builder.new(
            nil, nil, __vc_original_view_context, {}
          )

          input = self.class.input_klass.new(
            builder: builder,
            form: nil,
            **@system_arguments,
            &@block
          )

          input.to_component.render_in(__vc_original_view_context) { content }
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
primer_view_components-0.0.104 lib/primer/form_components.rb
primer_view_components-0.0.103 lib/primer/form_components.rb
primer_view_components-0.0.102 lib/primer/form_components.rb
primer_view_components-0.0.101 lib/primer/form_components.rb
primer_view_components-0.0.100 lib/primer/form_components.rb
primer_view_components-0.0.99 lib/primer/form_components.rb
primer_view_components-0.0.98 lib/primer/form_components.rb
primer_view_components-0.0.97 lib/primer/form_components.rb
primer_view_components-0.0.96 lib/primer/form_components.rb
primer_view_components-0.0.95 lib/primer/form_components.rb
primer_view_components-0.0.94 lib/primer/form_components.rb
primer_view_components-0.0.93 lib/primer/form_components.rb
primer_view_components-0.0.92 lib/primer/form_components.rb
primer_view_components-0.0.91 lib/primer/form_components.rb
primer_view_components-0.0.90 lib/primer/form_components.rb
primer_view_components-0.0.89 lib/primer/form_components.rb
primer_view_components-0.0.88 lib/primer/form_components.rb
primer_view_components-0.0.87 lib/primer/form_components.rb