ariadne_view_components 0.0.65 → 0.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/app/components/ariadne/form/caption/component.rb +19 -16
- data/app/components/ariadne/form/form_control/component.rb +18 -16
- data/app/components/ariadne/form/form_reference/component.rb +9 -7
- data/app/components/ariadne/form/group/component.rb +16 -14
- data/app/components/ariadne/form/hidden_field/component.rb +7 -5
- data/app/components/ariadne/form/separator/component.rb +3 -1
- data/app/components/ariadne/form/spacing_wrapper/component.rb +3 -1
- data/app/components/ariadne/form/validation_message/component.rb +6 -4
- data/lib/ariadne/view_components/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ced29e9d5d3ea81b63053dafceebaff0a5faa5912341adc06e5561ffde74f4be
         | 
| 4 | 
            +
              data.tar.gz: d1edeaa13348008834ea70e582393cb760de8fdb0257720cf18607e312e5f5d4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: abd39c12342494f01b486c4fe679a1d235d5c6ef3218b08ab59079bc6aa5ef462e78e37b779a04c7c3d8e154c0a21a3b4a65d09c3905619d418ef9c690887f3e
         | 
| 7 | 
            +
              data.tar.gz: 490bc1b70b1225d84988fffd9f7c6c09332c2c49424cc9f35547f8932147ff6790822f63ea6cf6745a9a3370f730a23e75d962ef05e8db3c23e7d46da8334c48
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| @@ -3,26 +3,29 @@ | |
| 3 3 | 
             
            module Ariadne
         | 
| 4 4 | 
             
              module Form
         | 
| 5 5 | 
             
                # :nodoc:
         | 
| 6 | 
            -
                 | 
| 7 | 
            -
                   | 
| 8 | 
            -
                     | 
| 9 | 
            -
             | 
| 6 | 
            +
                module Caption
         | 
| 7 | 
            +
                  class Component
         | 
| 8 | 
            +
                    Ariadne::Form::BaseInputComponent
         | 
| 9 | 
            +
                    def initialize(input:)
         | 
| 10 | 
            +
                      @input = input
         | 
| 11 | 
            +
                    end
         | 
| 10 12 |  | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 13 | 
            +
                    def caption_template?
         | 
| 14 | 
            +
                      @input.caption_template?
         | 
| 15 | 
            +
                    end
         | 
| 14 16 |  | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 17 | 
            +
                    def render_caption_template
         | 
| 18 | 
            +
                      @input.render_caption_template
         | 
| 19 | 
            +
                    end
         | 
| 18 20 |  | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            +
                    def before_render
         | 
| 22 | 
            +
                      return unless @input.caption? && caption_template?
         | 
| 21 23 |  | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 24 | 
            +
                      raise <<~MESSAGE
         | 
| 25 | 
            +
                        Please provide either a caption: argument or caption template for the
         | 
| 26 | 
            +
                        '#{@input.name}' input; both were found.
         | 
| 27 | 
            +
                      MESSAGE
         | 
| 28 | 
            +
                    end
         | 
| 26 29 | 
             
                  end
         | 
| 27 30 | 
             
                end
         | 
| 28 31 | 
             
              end
         | 
| @@ -3,24 +3,26 @@ | |
| 3 3 | 
             
            module Ariadne
         | 
| 4 4 | 
             
              module Form
         | 
| 5 5 | 
             
                # :nodoc:
         | 
| 6 | 
            -
                 | 
| 7 | 
            -
                   | 
| 6 | 
            +
                module FormControl
         | 
| 7 | 
            +
                  class Component < Ariadne::Form::BaseInputComponent
         | 
| 8 | 
            +
                    delegate :builder, :form, to: :@input
         | 
| 8 9 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 10 | 
            +
                    def initialize(input:, tag: :div, **system_arguments)
         | 
| 11 | 
            +
                      @input = input
         | 
| 12 | 
            +
                      @tag = tag
         | 
| 13 | 
            +
                      @input.add_label_classes("FormControl-label")
         | 
| 14 | 
            +
                      @form_group_arguments = {
         | 
| 15 | 
            +
                        # **system_arguments,
         | 
| 16 | 
            +
                        # class: class_names(
         | 
| 17 | 
            +
                        #   system_arguments[:class],
         | 
| 18 | 
            +
                        #   system_arguments[:classes],
         | 
| 19 | 
            +
                        #   "FormControl",
         | 
| 20 | 
            +
                        #   "width-full FormControl--fullWidth" => @input.full_width?,
         | 
| 21 | 
            +
                        # ),
         | 
| 22 | 
            +
                      }
         | 
| 22 23 |  | 
| 23 | 
            -
             | 
| 24 | 
            +
                      @form_group_arguments[:hidden] = "hidden" if @input.hidden?
         | 
| 25 | 
            +
                    end
         | 
| 24 26 | 
             
                  end
         | 
| 25 27 | 
             
                end
         | 
| 26 28 | 
             
              end
         | 
| @@ -3,15 +3,17 @@ | |
| 3 3 | 
             
            module Ariadne
         | 
| 4 4 | 
             
              module Form
         | 
| 5 5 | 
             
                # :nodoc:
         | 
| 6 | 
            -
                 | 
| 7 | 
            -
                   | 
| 6 | 
            +
                module FormReference
         | 
| 7 | 
            +
                  class Component < Ariadne::Form::BaseInputComponent
         | 
| 8 | 
            +
                    delegate :builder, :form, to: :@input
         | 
| 8 9 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 10 | 
            +
                    def initialize(input:)
         | 
| 11 | 
            +
                      @input = input
         | 
| 12 | 
            +
                    end
         | 
| 12 13 |  | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 14 | 
            +
                    def builder_or_view
         | 
| 15 | 
            +
                      @input.nested? ? builder : @view_context
         | 
| 16 | 
            +
                    end
         | 
| 15 17 | 
             
                  end
         | 
| 16 18 | 
             
                end
         | 
| 17 19 | 
             
              end
         | 
| @@ -4,22 +4,24 @@ module Ariadne | |
| 4 4 | 
             
              module Form
         | 
| 5 5 | 
             
                # :nodoc:
         | 
| 6 6 | 
             
                module Group
         | 
| 7 | 
            -
                   | 
| 8 | 
            -
                     | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 7 | 
            +
                  module Component
         | 
| 8 | 
            +
                    class Component < Ariadne::Form::BaseInputComponent
         | 
| 9 | 
            +
                      VERTICAL = :vertical
         | 
| 10 | 
            +
                      HORIZONTAL = :horizontal
         | 
| 11 | 
            +
                      DEFAULT_LAYOUT = VERTICAL
         | 
| 12 | 
            +
                      LAYOUTS = [VERTICAL, HORIZONTAL].freeze
         | 
| 12 13 |  | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 14 | 
            +
                      def initialize(inputs:, builder:, form:, layout: DEFAULT_LAYOUT, **system_arguments)
         | 
| 15 | 
            +
                        @inputs = inputs
         | 
| 16 | 
            +
                        @builder = builder
         | 
| 17 | 
            +
                        @form = form
         | 
| 18 | 
            +
                        @layout = layout
         | 
| 19 | 
            +
                        @system_arguments = system_arguments
         | 
| 20 | 
            +
                      end
         | 
| 20 21 |  | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 22 | 
            +
                      def horizontal?
         | 
| 23 | 
            +
                        @layout == HORIZONTAL
         | 
| 24 | 
            +
                      end
         | 
| 23 25 | 
             
                    end
         | 
| 24 26 | 
             
                  end
         | 
| 25 27 | 
             
                end
         | 
| @@ -3,12 +3,14 @@ | |
| 3 3 | 
             
            module Ariadne
         | 
| 4 4 | 
             
              module Form
         | 
| 5 5 | 
             
                # :nodoc:
         | 
| 6 | 
            -
                 | 
| 7 | 
            -
                   | 
| 6 | 
            +
                module HiddenField
         | 
| 7 | 
            +
                  class Component < Ariadne::Form::BaseInputComponent
         | 
| 8 | 
            +
                    delegate :builder, :form, to: :@input
         | 
| 8 9 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 10 | 
            +
                    def initialize(input:)
         | 
| 11 | 
            +
                      @input = input
         | 
| 12 | 
            +
                      @input.add_input_classes("FormField-input")
         | 
| 13 | 
            +
                    end
         | 
| 12 14 | 
             
                  end
         | 
| 13 15 | 
             
                end
         | 
| 14 16 | 
             
              end
         | 
| @@ -3,11 +3,13 @@ | |
| 3 3 | 
             
            module Ariadne
         | 
| 4 4 | 
             
              module Form
         | 
| 5 5 | 
             
                # :nodoc:
         | 
| 6 | 
            -
                 | 
| 7 | 
            -
                   | 
| 6 | 
            +
                module ValidationMessage
         | 
| 7 | 
            +
                  class Component < Ariadne::Form::BaseInputComponent
         | 
| 8 | 
            +
                    attr_reader :input
         | 
| 8 9 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 10 | 
            +
                    def initialize(input:)
         | 
| 11 | 
            +
                      @input = input
         | 
| 12 | 
            +
                    end
         | 
| 11 13 | 
             
                  end
         | 
| 12 14 | 
             
                end
         | 
| 13 15 | 
             
              end
         |