Sha256: 08fc41a242920b87c7ed847aabe34c5074bd23f4edfce1314b8b48e632b25f61

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 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: "#{UI::Combobox::Component.stimulus_name}#checkboxClicked" }
            }

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.70 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.69 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.68 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.67 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.66 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.65 app/components/ariadne/ui/combobox/option/component.rb
ariadne_view_components-0.0.64 app/components/ariadne/ui/combobox/option/component.rb