2020-12-01 15:45:09 +00:00
|
|
|
{{yield}}
|
|
|
|
<div
|
|
|
|
class="popover-menu"
|
|
|
|
...attributes
|
|
|
|
>
|
|
|
|
<AriaMenu @keyboardAccess={{keyboardAccess}} as |change keypress keypressClick aria|>
|
2020-08-10 08:26:02 +00:00
|
|
|
|
|
|
|
{{#let (hash
|
|
|
|
MenuItem=(component
|
|
|
|
'popover-menu/menu-item'
|
|
|
|
menu=(hash
|
|
|
|
addSubmenu=(action "addSubmenu")
|
|
|
|
removeSubmenu=(action "removeSubmenu")
|
|
|
|
confirm=(concat "popover-menu-" guid "-")
|
|
|
|
clickTrigger=this.toggle.click
|
|
|
|
keypressClick=keypressClick
|
|
|
|
)
|
|
|
|
)
|
|
|
|
MenuSeparator=(component
|
|
|
|
'popover-menu/menu-separator'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
as |components|}}
|
2020-12-01 15:45:09 +00:00
|
|
|
{{#let (hash
|
|
|
|
toggle=this.toggle.click
|
|
|
|
)
|
|
|
|
as |api|}}
|
2020-08-10 08:26:02 +00:00
|
|
|
|
2020-12-01 15:45:09 +00:00
|
|
|
<ToggleButton
|
|
|
|
@checked={{if keyboardAccess aria.expanded expanded}}
|
|
|
|
@onchange={{queue change (action "change")}}
|
|
|
|
as |toggle|>
|
|
|
|
<Ref @target={{this}} @name="toggle" @value={{toggle}} />
|
|
|
|
<button type="button" aria-haspopup="menu" onkeydown={{keypress}} onclick={{this.toggle.click}} id={{aria.labelledBy}} aria-controls={{aria.controls}}>
|
|
|
|
<YieldSlot @name="trigger">
|
|
|
|
{{yield components api}}
|
|
|
|
</YieldSlot>
|
|
|
|
</button>
|
|
|
|
</ToggleButton>
|
2020-08-10 08:26:02 +00:00
|
|
|
|
2020-12-01 15:45:09 +00:00
|
|
|
<MenuPanel @position={{position}} id={{aria.controls}} aria-labelledby={{aria.labelledBy}} aria-expanded={{aria.expanded}} as |menu|>
|
|
|
|
<Ref @target={{this}} @name="menu" @value={{menu}} />
|
|
|
|
<BlockSlot @name="controls">
|
|
|
|
<input type="checkbox" id={{concat 'popover-menu-' guid '-'}} />
|
|
|
|
{{#each submenus as |sub|}}
|
|
|
|
<input type="checkbox" id={{concat 'popover-menu-' guid '-' sub}} onchange={{menu.change}} />
|
|
|
|
{{/each}}
|
|
|
|
</BlockSlot>
|
|
|
|
{{#if hasHeader}}
|
|
|
|
<BlockSlot @name="header">
|
|
|
|
{{yield components api}}
|
|
|
|
{{#yield-slot name="header"}}{{else}}{{/yield-slot}}
|
2020-08-10 08:26:02 +00:00
|
|
|
</BlockSlot>
|
2020-12-01 15:45:09 +00:00
|
|
|
{{/if}}
|
|
|
|
<BlockSlot @name="menu">
|
|
|
|
<YieldSlot @name="menu" @params={{block-params (concat "popover-menu-" guid "-") send keypressClick this.toggle.click}}>
|
|
|
|
{{yield components api}}
|
|
|
|
</YieldSlot>
|
|
|
|
</BlockSlot>
|
|
|
|
</MenuPanel>
|
2020-08-10 08:26:02 +00:00
|
|
|
|
2020-12-01 15:45:09 +00:00
|
|
|
{{/let}}
|
2020-08-10 08:26:02 +00:00
|
|
|
{{/let}}
|
|
|
|
|
2020-12-01 15:45:09 +00:00
|
|
|
</AriaMenu>
|
|
|
|
</div>
|