Sha256: 13a521faec4abf6fd5a7937f26bbe46d437ec5d80bb907acd5f8bb347516f1e2

Contents?: true

Size: 824 Bytes

Versions: 17

Compression:

Stored size: 824 Bytes

Contents

# frozen_string_literal: true

module Primer
  # :nocov:
  # :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

17 entries across 17 versions & 1 rubygems

Version Path
primer_view_components-0.0.121 lib/primer/form_components.rb
primer_view_components-0.0.120 lib/primer/form_components.rb
primer_view_components-0.0.119 lib/primer/form_components.rb
primer_view_components-0.0.118 lib/primer/form_components.rb
primer_view_components-0.0.117 lib/primer/form_components.rb
primer_view_components-0.0.116 lib/primer/form_components.rb
primer_view_components-0.0.115 lib/primer/form_components.rb
primer_view_components-0.0.114 lib/primer/form_components.rb
primer_view_components-0.0.113 lib/primer/form_components.rb
primer_view_components-0.0.112 lib/primer/form_components.rb
primer_view_components-0.0.111 lib/primer/form_components.rb
primer_view_components-0.0.110 lib/primer/form_components.rb
primer_view_components-0.0.109 lib/primer/form_components.rb
primer_view_components-0.0.108 lib/primer/form_components.rb
primer_view_components-0.0.107 lib/primer/form_components.rb
primer_view_components-0.0.106 lib/primer/form_components.rb
primer_view_components-0.0.105 lib/primer/form_components.rb