# frozen_string_literal: true module Ariadne # `DropdownComponent` is a lightweight context menu for holding navigation and actions. class DropdownComponent < Ariadne::Component DEFAULT_TAG = :div TAG_OPTIONS = [DEFAULT_TAG].freeze DEFAULT_CLASSES = "" # Required trigger for the dropdown. Has the same arguments as <%= link_to_component(Ariadne::ButtonComponent) %>, # but it is locked as a `summary` tag. # # @param size [Symbol] <%= one_of(Ariadne::BaseButton::VALID_SIZES) %> # @param type [Symbol] <%= one_of(Ariadne::BaseButton::VALID_TYPES) %> # @param scheme [Symbol] <%= one_of(Ariadne::ButtonComponent::VALID_SCHEMES) %> # @param classes [String] <%= link_to_classes_docs %> # @param attributes [Hash] <%= link_to_attributes_docs %> renders_one :button, lambda { |size: Ariadne::BaseButton::DEFAULT_SIZE, scheme: :none, classes: "", attributes: {}| @button_classes = classes @button_attributes = attributes @button_attributes[:button] = true Ariadne::ButtonComponent.new(tag: :summary, type: :button, scheme: scheme, dropdown: @with_caret, size: size, classes: classes, attributes: attributes) } # Required context menu for the dropdown. # # @param as [Symbol] When `as` is `:list`, wraps the menu in a `