Sha256: 67560979d3e90d40139b985dc0cbfd087dda06d52e386b56a3d956746f1f4d6e

Contents?: true

Size: 1.21 KB

Versions: 13

Compression:

Stored size: 1.21 KB

Contents

# typed: false
# frozen_string_literal: true

module Ariadne
  module UI
    module Combobox
      module Option
        class Component < BaseComponent
          option :as, default: proc { :link } # :button

          option :type, default: proc { :multiple }
          option :text_content, default: proc { true }

          accepts_html_attributes disabled: false,
            tabindex: -1,
            data: proc {
              { action: "#{Ariadne::UI::Combobox::Component.stimulus_name}#checkboxClicked" }
            }

          def option_component
            cmp = type == :multiple ? Ariadne::Form::Checkbox : Ariadne::Form::Radio
            render(cmp::Component.new(html_attrs:))
          end

          style do
            base do
              [
                "ariadne-flex",
                "ariadne-gap-0.5",
                "ariadne-items-center",
                "ariadne-rounded",
                "!ariadne-ring-0",
                "hover:ariadne-bg-zinc-100",
                "hover:dark:ariadne-bg-zinc-800",
                "focus-within:ariadne-bg-zinc-100",
                "focus-within:dark:ariadne-bg-zinc-800",
              ]
            end
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.79.2 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.79.1 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.79 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.78 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.77 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.76.1 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.76 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.75 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.74.1 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.74 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.73 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.72 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.71 app/components/ariadne/ui/combobox/option/component.rb