Class: Primer::Alpha::ActionMenu::SubMenuItem
- Inherits:
-
Primer::Alpha::ActionList::Item
- Object
- ViewComponent::Base
- Component
- Primer::Alpha::ActionList::Item
- Primer::Alpha::ActionMenu::SubMenuItem
- Defined in:
- app/components/primer/alpha/action_menu/sub_menu_item.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::Item
Primer::Alpha::ActionList::Item::DEFAULT_DESCRIPTION_SCHEME, Primer::Alpha::ActionList::Item::DEFAULT_SCHEME, Primer::Alpha::ActionList::Item::DEFAULT_SIZE, Primer::Alpha::ActionList::Item::DEFAULT_TRUNCATION_BEHAVIOR, Primer::Alpha::ActionList::Item::DESCRIPTION_SCHEME_MAPPINGS, Primer::Alpha::ActionList::Item::DESCRIPTION_SCHEME_OPTIONS, Primer::Alpha::ActionList::Item::SCHEME_MAPPINGS, Primer::Alpha::ActionList::Item::SCHEME_OPTIONS, Primer::Alpha::ActionList::Item::SIZE_MAPPINGS, Primer::Alpha::ActionList::Item::SIZE_OPTIONS, Primer::Alpha::ActionList::Item::TRUNCATION_BEHAVIOR_MAPPINGS, Primer::Alpha::ActionList::Item::TRUNCATION_BEHAVIOR_OPTIONS
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
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::Item
#active, #disabled, #href, #id, #item_id, #list, #parent
Instance Method Summary collapse
-
#initialize(content_arguments: {}, form_arguments: {}, **system_arguments) ⇒ SubMenuItem
constructor
A new instance of SubMenuItem.
- #with_avatar_item(**system_arguments, &block) ⇒ Object
- #with_divider(**system_arguments, &block) ⇒ Object
- #with_group(**system_arguments, &block) ⇒ Object
- #with_item(**system_arguments, &block) ⇒ Object
- #with_sub_menu_item(**system_arguments, &block) ⇒ Object
Methods inherited from Component
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Methods included from Primer::AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(content_arguments: {}, form_arguments: {}, **system_arguments) ⇒ SubMenuItem
Returns a new instance of SubMenuItem.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/primer/alpha/action_menu/sub_menu_item.rb', line 9 def initialize(content_arguments: {}, form_arguments: {}, **system_arguments) # We extract form_arguments from system_arguments here to avoid passing them to the # ActionList::Item base class or to the SubMenu instance. Doing so prevents a form # input from being emitted for sub-menu items, which prevents an extra empty value # from being sent to the server on form submit. = SubMenu.allocate system_arguments = .send(:initialize, **system_arguments) system_arguments[:id] = "#{@sub_menu.menu_id}-button" @form_arguments = form_arguments content_arguments[:tag] = :button content_arguments[:popovertarget] = "#{@sub_menu.menu_id}-overlay" content_arguments[:aria] = merge_aria( content_arguments, { aria: { controls: "#{@sub_menu.menu_id}-list", haspopup: true } } ) super end |
Instance Method Details
#with_avatar_item(**system_arguments, &block) ⇒ Object
43 44 45 |
# File 'app/components/primer/alpha/action_menu/sub_menu_item.rb', line 43 def with_avatar_item(**system_arguments, &block) .with_avatar_item(form_arguments: @form_arguments, **system_arguments, &block) end |
#with_divider(**system_arguments, &block) ⇒ Object
39 40 41 |
# File 'app/components/primer/alpha/action_menu/sub_menu_item.rb', line 39 def with_divider(**system_arguments, &block) .with_divider(form_arguments: @form_arguments, **system_arguments, &block) end |
#with_group(**system_arguments, &block) ⇒ Object
51 52 53 |
# File 'app/components/primer/alpha/action_menu/sub_menu_item.rb', line 51 def with_group(**system_arguments, &block) .with_group(form_arguments: @form_arguments, **system_arguments, &block) end |
#with_item(**system_arguments, &block) ⇒ Object
35 36 37 |
# File 'app/components/primer/alpha/action_menu/sub_menu_item.rb', line 35 def with_item(**system_arguments, &block) .with_item(form_arguments: @form_arguments, **system_arguments, &block) end |
#with_sub_menu_item(**system_arguments, &block) ⇒ Object
47 48 49 |
# File 'app/components/primer/alpha/action_menu/sub_menu_item.rb', line 47 def (**system_arguments, &block) .(form_arguments: @form_arguments, **system_arguments, &block) end |