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
openproject-primer_view_components-0.33.0 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.25.1 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.32.1 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.32.0 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.29.1 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.29.0 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.23.0 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.28.1 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.28.0 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.27.0 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.26.0 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.25.1 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.22.0 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.21.1 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.25.0 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.24.0 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.21.0 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.20.1 app/components/primer/alpha/action_menu/list_wrapper.rb
primer_view_components-0.20.0 app/components/primer/alpha/action_menu/list_wrapper.rb
openproject-primer_view_components-0.23.0 app/components/primer/alpha/action_menu/list_wrapper.rb