Sha256: a11911113a5ef7ac78b03de0d6c7fea2a5d0a17dd6c7f77022469d683143dbdd

Contents?: true

Size: 1.21 KB

Versions: 95

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    class ActionMenu
      # This component is part of <%= link_to_component(Primer::Alpha::ActionMenu) %> and should not be
      # used as a standalone component.
      class ListWrapper < Primer::Alpha::ActionList
        add_polymorphic_slot_type(
          slot_name: :items,
          type: :group,
          callable: lambda { |**system_arguments|
            Primer::Alpha::ActionMenu::Group.new(
              **system_arguments,
              role: :group,
              select_variant: @select_variant
            )
          }
        )

        # @param menu_id [String] ID of the parent menu.
        # @param system_arguments [Hash] The arguments accepted by <%= link_to_component(Primer::Alpha::ActionList) %>
        def initialize(menu_id:, **system_arguments)
          @menu_id = menu_id

          system_arguments[:aria] = merge_aria(
            system_arguments,
            { aria: { labelledby: "#{@menu_id}-button" } }
          )

          system_arguments[:role] = :menu
          system_arguments[:scheme] = :inset
          system_arguments[:id] = "#{@menu_id}-list"

          super(**system_arguments)
        end
      end
    end
  end
end

Version data entries

95 entries across 95 versions & 2 rubygems

Version Path
primer_view_components-0.36.5 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.52.2 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.36.4 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.52.1 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.52.0 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.36.3 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.51.0 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.36.2 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.50.1 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.50.0 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.36.1 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.36.0 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.49.2 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.35.2 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.49.1 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.49.0 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.35.1 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.35.0 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.48.2 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.48.1 app/components/primer/alpha/action_menu/list_wrapper.rb