generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 177
/
Copy pathaction-menu.js
44 lines (43 loc) · 3.8 KB
/
action-menu.js
1
2
3
4
5
6
7
8
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
34
35
36
37
38
39
40
41
42
43
44
/* eslint-disable */
/* Generated by Milo */
import{html as i}from"./base.js";import{state as y}from"./base.js";import{ifDefined as c}from"./base.js";import{property as u}from"./base.js";import{DESCRIPTION_ID as v,PickerBase as g}from"./picker.js";import"./action-button.js";import{ObserveSlotPresence as $}from"./shared.js";import{ObserveSlotText as x}from"./shared.js";import"./icons-workflow.js";import{css as h}from"./base.js";var m=h`
:host{display:inline-flex}:host([quiet]){min-width:0}:host>sp-menu{display:none}::slotted([slot=icon]){flex-shrink:0}.icon{flex-shrink:0}#popover{max-width:none}:host([dir=ltr]) ::slotted([slot=icon]),:host([dir=ltr]) .icon{margin-left:calc(-1*(var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted)))}:host([dir=rtl]) ::slotted([slot=icon]),:host([dir=rtl]) .icon{margin-right:calc(-1*(var(--spectrum-actionbutton-textonly-padding-left-adjusted) - var(--spectrum-actionbutton-padding-left-adjusted)))}:host([dir]) slot[icon-only]::slotted([slot=icon]),:host([dir]) slot[icon-only] .icon{margin-inline:calc(( var(--custom-actionbutton-edge-to-text,var(--spectrum-actionbutton-edge-to-text)) - var(--custom-actionbutton-edge-to-visual-only,var(--spectrum-actionbutton-edge-to-visual-only)))*-1)}sp-overlay:not(:defined){display:none}
`,p=m;import{SlottableRequestEvent as O}from"./overlay.js";var b=Object.defineProperty,f=Object.getOwnPropertyDescriptor,d=(n,t,l,s)=>{for(var e=s>1?void 0:s?f(t,l):t,r=n.length-1,a;r>=0;r--)(a=n[r])&&(e=(s?a(t,l,e):a(e))||e);return s&&e&&b(t,l,e),e},o=class extends $(x(g,"label"),'[slot="label-only"]'){constructor(){super(...arguments),this.selects=void 0,this.static=void 0,this.listRole="menu",this.itemRole="menuitem",this.handleSlottableRequest=t=>{this.dispatchEvent(new O(t.name,t.data))}}static get styles(){return[p]}get hasLabel(){return this.slotHasContent}get labelOnly(){return this.slotContentIsPresent}get buttonContent(){return[i`
${this.labelOnly?i``:i`
<slot
name="icon"
slot="icon"
?icon-only=${!this.hasLabel}
?hidden=${this.labelOnly}
>
<sp-icon-more class="icon"></sp-icon-more>
</slot>
`}
<slot name="label" ?hidden=${!this.hasLabel}></slot>
<slot name="label-only"></slot>
<slot
name="tooltip"
@slotchange=${this.handleTooltipSlotchange}
></slot>
`]}render(){return this.tooltipEl&&(this.tooltipEl.disabled=this.open),i`
<sp-action-button
aria-describedby=${v}
?quiet=${this.quiet}
?selected=${this.open}
static=${c(this.static)}
aria-haspopup="true"
aria-controls=${c(this.open?"menu":void 0)}
aria-expanded=${this.open?"true":"false"}
aria-label=${c(this.label||void 0)}
id="button"
class="button"
size=${this.size}
@blur=${this.handleButtonBlur}
@focus=${this.handleButtonFocus}
@keydown=${{handleEvent:this.handleEnterKeydown,capture:!0}}
?disabled=${this.disabled}
>
${this.buttonContent}
</sp-action-button>
${this.renderMenu} ${this.renderDescriptionSlot}
`}update(t){t.has("invalid")&&(this.invalid=!1),super.update(t)}};d([u({type:String})],o.prototype,"selects",2),d([u({type:String,reflect:!0})],o.prototype,"static",2),d([y()],o.prototype,"labelOnly",1);import{defineElement as S}from"./base.js";S("sp-action-menu",o);