Sha256: 0b5d955771169385afe810e6a66132c8b62b74bfc89edd01e0be4aeac395330a

Contents?: true

Size: 1.57 KB

Versions: 10

Compression:

Stored size: 1.57 KB

Contents

# frozen_string_literal: true

module Ariadne
  module Form
    # :nodoc:
    module Group
      class Component < Ariadne::Form::BaseComponent
        VERTICAL = :vertical
        HORIZONTAL = :horizontal
        RELATIVE = :relative
        DEFAULT_LAYOUT = VERTICAL
        LAYOUTS = [VERTICAL, HORIZONTAL, RELATIVE].freeze

        accepts_html_attributes do |html_attrs|
          html_attrs[:class] = Ariadne::ViewComponents.tailwind_merger.merge([style(layout:), html_attrs[:class]].join(" "))
        end

        attr_reader :layout

        def initialize(inputs:, builder:, form:, layout: DEFAULT_LAYOUT, **system_arguments)
          @inputs = inputs
          @builder = builder
          @form = form
          @layout = layout
          @system_arguments = system_arguments
        end

        style do
          base do
          end

          variants do
            layout do
              vertical do
                [
                  "ariadne-space-y-8",
                ]
              end

              horizontal do
                [
                  "ariadne-flex ariadne-flex-row",
                ]
              end

              relative do
                [
                  "ariadne-relative",
                ]
              end

              right do
                [
                  "ariadne-mt-6",
                  "ariadne-flex",
                  "ariadne-items-center",
                  "ariadne-justify-end",
                  "ariadne-gap-x-6",
                ]
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.81 app/components/ariadne/form/group/component.rb
ariadne_view_components-0.0.80.3 app/components/ariadne/form/group/component.rb
ariadne_view_components-0.0.79.2 app/components/ariadne/form/group/component.rb
ariadne_view_components-0.0.79.1 app/components/ariadne/form/group/component.rb
ariadne_view_components-0.0.79 app/components/ariadne/form/group/component.rb
ariadne_view_components-0.0.78 app/components/ariadne/form/group/component.rb
ariadne_view_components-0.0.77 app/components/ariadne/form/group/component.rb
ariadne_view_components-0.0.76.1 app/components/ariadne/form/group/component.rb
ariadne_view_components-0.0.76 app/components/ariadne/form/group/component.rb
ariadne_view_components-0.0.75 app/components/ariadne/form/group/component.rb