Sha256: fb3e7ef03f403a071cba3c013e5894b593fcac6cccfb31eb411cef19c045336a

Contents?: true

Size: 1.41 KB

Versions: 16

Compression:

Stored size: 1.41 KB

Contents

# typed: false
# frozen_string_literal: true

module Ariadne
  module Form
    module RadioButton
      class Component < Ariadne::Form::BaseInputComponent
        option :label
        option :name
        option :value

        option :label_classes, default: -> { "" }
        option :label_arguments, default: -> { {} }

        accepts_html_attributes do |html_attrs|
          html_attrs[:name] = @name
          html_attrs[:value] = @value
          html_attrs[:id] = id
        end

        def id
          "#{@name}_#{@value}"
        end

        def input_styles
          Ariadne::ViewComponents.tailwind_merger.merge([style(:input), html_attrs[:class]].join(" "))
        end

        def label_styles
          Ariadne::ViewComponents.tailwind_merger.merge([style(:label), label_classes].join(" "))
        end

        style(:input) do
          base do
            [
              "ariadne-h-4",
              "ariadne-w-4",
              "ariadne-border-gray-300",
              "ariadne-text-indigo-600",
              "focus:ariadne-ring-indigo-600",
            ]
          end
        end

        style(:label) do
          base do
            [
              "ariadne-ml-3",
              "ariadne-block",
              "ariadne-text-sm",
              "ariadne-font-medium",
              "ariadne-leading-6",
              "ariadne-text-gray-900",
            ]
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.82 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.81 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.80.3 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.79.2 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.79.1 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.79 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.78 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.77 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.76.1 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.76 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.75 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.74.1 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.74 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.73 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.72 app/components/ariadne/form/radio_button/component.rb
ariadne_view_components-0.0.71 app/components/ariadne/form/radio_button/component.rb