Class: Primer::Alpha::ActionMenu::ListWrapper

Inherits:
Primer::Alpha::ActionList show all
Defined in:
app/components/primer/alpha/action_menu/list_wrapper.rb

Overview

This component is part of <%= link_to_component(Primer::Alpha::ActionMenu) %> and should not be used as a standalone component.

Constant Summary

Constants inherited from Primer::Alpha::ActionList

Primer::Alpha::ActionList::ARIA_SELECTION_VARIANT_OPTIONS, Primer::Alpha::ActionList::DEFAULT_ARIA_SELECTION_VARIANT, Primer::Alpha::ActionList::DEFAULT_MENU_ITEM_ROLE, Primer::Alpha::ActionList::DEFAULT_ROLE, Primer::Alpha::ActionList::DEFAULT_SCHEME, Primer::Alpha::ActionList::DEFAULT_SELECT_VARIANT, Primer::Alpha::ActionList::LIST_BOX_ITEM_ROLE, Primer::Alpha::ActionList::MENU_ROLE, Primer::Alpha::ActionList::SCHEME_MAPPINGS, Primer::Alpha::ActionList::SCHEME_OPTIONS, Primer::Alpha::ActionList::SELECT_VARIANT_OPTIONS, Primer::Alpha::ActionList::SELECT_VARIANT_ROLE_MAP

Constants inherited from Component

Component::INVALID_ARIA_LABEL_TAGS

Constants included from Status::Dsl

Status::Dsl::STATUSES

Constants included from ViewHelper

ViewHelper::HELPERS

Constants included from TestSelectorHelper

TestSelectorHelper::TEST_SELECTOR_TAG

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Constants included from Primer::AttributesHelper

Primer::AttributesHelper::PLURAL_ARIA_ATTRIBUTES, Primer::AttributesHelper::PLURAL_DATA_ATTRIBUTES

Instance Attribute Summary

Attributes inherited from Primer::Alpha::ActionList

#aria_selection_variant, #id, #role, #select_variant

Instance Method Summary collapse

Methods inherited from Primer::Alpha::ActionList

#acts_as_form_input?, #acts_as_listbox?, #acts_as_menu?, #allows_selection?, #before_render, #build_avatar_item, #build_item, #custom_element_name, custom_element_name, #multi_select?, #required_form_arguments_given?, #single_select?, #will_add_item, #with_avatar_item, #with_divider, #with_item

Methods inherited from Component

deprecated?, generate_id

Methods included from JoinStyleArgumentsHelper

#join_style_arguments

Methods included from TestSelectorHelper

#add_test_selector

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?

Methods included from ClassNameHelper

#class_names

Methods included from Primer::AttributesHelper

#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes

Methods included from ExperimentalSlotHelpers

included

Methods included from ExperimentalRenderHelpers

included

Constructor Details

#initialize(menu_id:, **system_arguments) ⇒ ListWrapper

Returns a new instance of ListWrapper.

Parameters:

  • menu_id (String)

    ID of the parent menu.

  • system_arguments (Hash)

    The arguments accepted by <%= link_to_component(Primer::Alpha::ActionList) %>



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/components/primer/alpha/action_menu/list_wrapper.rb', line 23

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