@m3e/list 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js
CHANGED
|
@@ -36,7 +36,7 @@ const G={attribute:!0,type:String,converter:V,reflect:!1,hasChanged:K},J=(t=G,e,
|
|
|
36
36
|
* Copyright 2017 Google LLC
|
|
37
37
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
38
38
|
*/
|
|
39
|
-
function X(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i))(e,i,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}var Y,tt,et,it,st,ot;let at=class extends(r(s,"listitem")){constructor(){super(...arguments),Y.add(this),tt.set(this,new l(this,{target:null,callback:()=>S(this,Y,"m",st).call(this)})),et.set(this,void 0),it.set(this,void 0)}get leadingContentType(){return S(this,et,"f")}get trailingContentType(){return S(this,it,"f")}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot?.querySelector(".base");e&&S(this,tt,"f").observe(e)}render(){return o`<slot name="leading" @slotchange="${this._handleLeadingSlotChange}"><slot name="leading-icon" @slotchange="${this._handleLeadingSlotChange}"></slot></slot><div class="base"><slot name="overline"></slot><slot></slot><slot name="supporting-text"></slot></div><slot name="trailing" @slotchange="${this._handleTrailingSlotChange}"><slot name="trailing-supporting-text" @slotchange="${this._handleTrailingSlotChange}"></slot><slot name="trailing-icon" @slotchange="${this._handleTrailingSlotChange}"></slot></slot>`}_handleLeadingSlotChange(t){const e=S(this,et,"f");E(this,et,S(this,Y,"m",ot).call(this,t.target),"f"),this.classList.toggle("-has-leading",void 0!==S(this,et,"f")),e!==S(this,et,"f")&&this.closest("m3e-list,m3e-action-list,m3e-selection-list")?.notifyLeadingContentTypeChange(e,S(this,et,"f"))}_handleTrailingSlotChange(t){const e=S(this,it,"f");E(this,it,S(this,Y,"m",ot).call(this,t.target),"f"),this.classList.toggle("-has-trailing",void 0!==S(this,it,"f")),e!==S(this,it,"f")&&this.closest("m3e-list,m3e-action-list,m3e-selection-list")?.notifyTrailingContentTypeChange(e,S(this,it,"f"))}};var nt,rt,lt,dt,ct;tt=new WeakMap,et=new WeakMap,it=new WeakMap,Y=new WeakSet,st=function(){const t=this.shadowRoot?.querySelector(".base")??null,e=null===t?0:c(t);this.classList.toggle("-one-line",e<=1),this.classList.toggle("-two-line",2==e),this.classList.toggle("-three-line",e>2)},ot=function(t){const e=t.assignedElements({flatten:!0});return e.some(t=>"VIDEO"===t.tagName)?"video":e.some(t=>"IMG"===t.tagName)?"image":e.some(t=>"M3E-AVATAR"===t.tagName)?"avatar":e.some(t=>"M3E-ICON"===t.tagName)?"icon":e.length>0?"text":void 0},at.styles=n`:host { flex: none; display: flex; box-sizing: border-box; column-gap: var(--m3e-list-item-between-space, 1rem); padding-inline-start: var(--m3e-list-item-leading-space, 1rem); padding-inline-end: var(--m3e-list-item-trailing-space, 1rem); border-top-left-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-container-shape, ${d.shape.corner.none}) ); border-top-right-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-container-shape, ${d.shape.corner.none}) ); border-bottom-left-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-container-shape, ${d.shape.corner.none}) ); border-bottom-right-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-container-shape, ${d.shape.corner.none}) ); transition: ${a(`border-radius ${d.motion.spring.fastEffects}, background-color ${d.motion.duration.short4} ${d.motion.easing.standard}`)}; } :host(.-one-line) { padding-block-start: var(--m3e-list-item-one-line-top-space, 0.5rem); padding-block-end: var(--m3e-list-item-one-line-bottom-space, 0.5rem); min-height: calc(var(--m3e-list-item-one-line-height, 3.5rem) + ${d.density.calc(-3)}); } :host(.-two-line) { padding-block-start: var(--m3e-list-item-two-line-top-space, 0.5rem); padding-block-end: var(--m3e-list-item-two-line-bottom-space, 0.5rem); min-height: calc(var(--m3e-list-item-two-line-height, 4.5rem) + ${d.density.calc(-3)}); } :host(.-three-line) { padding-block-start: var(--m3e-list-item-three-line-top-space, 0.75rem); padding-block-end: var(--m3e-list-item-three-line-bottom-space, 0.75rem); min-height: calc(var(--m3e-list-item-three-line-height, 5.5rem) + ${d.density.calc(-3)}); } :host(:not(.-three-line)) { align-items: center; } :host(.-three-line) { align-items: flex-start; } :host(:not(:disabled):not([selected]:not(:hover)):focus-visible) .state-layer, :host(:not(:disabled):not([selected]:not(:hover)):focus-visible) .ripple, :host(:not(:disabled):not([selected]:not(:hover)):focus-visible) .focus-ring { border-top-left-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-focus-container-shape, ${d.shape.corner.large}) ); border-top-right-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-focus-container-shape, ${d.shape.corner.large}) ); border-bottom-left-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-focus-container-shape, ${d.shape.corner.large}) ); border-bottom-right-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-focus-container-shape, ${d.shape.corner.large}) ); } :host(:not(:disabled):not([selected])) .state-layer, :host(:not(:disabled):not([selected])) .ripple, :host(:not(:disabled):not([selected])) .focus-ring { border-top-left-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-hover-container-shape, ${d.shape.corner.medium}) ); border-top-right-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-hover-container-shape, ${d.shape.corner.medium}) ); border-bottom-left-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-hover-container-shape, ${d.shape.corner.medium}) ); border-bottom-right-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-hover-container-shape, ${d.shape.corner.medium}) ); } .base { flex: 1 1 auto; display: flex; flex-direction: column; align-items: unset; justify-content: unset; } ::slotted([slot="overline"]) { font-size: var(--m3e-list-item-overline-font-size, ${d.typescale.standard.label.small.fontSize}); font-weight: var(--m3e-list-item-overline-font-weight, ${d.typescale.standard.label.small.fontWeight}); line-height: var(--m3e-list-item-overline-line-height, ${d.typescale.standard.label.small.lineHeight}); letter-spacing: var(--m3e-list-item-overline-tracking, ${d.typescale.standard.label.small.tracking}); } ::slotted([slot="supporting-text"]) { font-size: var(--m3e-list-item-supporting-text-font-size, ${d.typescale.standard.body.medium.fontSize}); font-weight: var( --m3e-list-item-supporting-text-font-weight, ${d.typescale.standard.body.medium.fontWeight} ); line-height: var( --m3e-list-item-supporting-text-line-height, ${d.typescale.standard.body.medium.lineHeight} ); letter-spacing: var( --m3e-list-item-supporting-text-tracking, ${d.typescale.standard.body.medium.tracking} ); } ::slotted(:not([slot])) { font-size: var(--m3e-list-item-font-size, ${d.typescale.standard.body.large.fontSize}); font-weight: var(--m3e-list-item-font-weight, ${d.typescale.standard.body.large.fontWeight}); line-height: var(--m3e-list-item-line-height, ${d.typescale.standard.body.large.lineHeight}); letter-spacing: var(--m3e-list-item-tracking, ${d.typescale.standard.body.large.tracking}); } :host(.-has-leading) slot[name="leading"], :host(.-has-trailing) slot[name="trailing"] { display: flex; justify-content: center; } :host(:not(.-has-leading)) slot[name="leading"] { display: var(--_list-item-leading-reserved-display, contents); } :host(:not(.-has-trailing)) slot[name="trailing"] { display: var(--_list-item-trailing-reserved-display, contents); } slot[name="leading"] { min-width: var(--_list-item-leading-reserved-space, 0px); margin-inline-start: calc(0px - var(--_list-item-leading-reserved-outset, 0px)); } slot[name="trailing"] { min-width: var(--_list-item-trailing-reserved-space, 0px); margin-inline-end: calc(0px - var(--_list-item-trailing-reserved-outset, 0px)); } ::slotted(span[slot="trailing"]), ::slotted([slot="trailing-supporting-text"]) { white-space: nowrap; font-size: var(--m3e-list-item-trailing-text-font-size, ${d.typescale.standard.label.small.fontSize}); font-weight: var( --m3e-list-item-trailing-text-font-weight, ${d.typescale.standard.label.small.fontWeight} ); line-height: var( --m3e-list-item-trailing-text-line-height, ${d.typescale.standard.label.small.lineHeight} ); letter-spacing: var( --m3e-list-item-trailing-text-tracking, ${d.typescale.standard.label.small.tracking} ); } ::slotted(video[slot="leading"]), ::slotted(video[slot="trailing"]), ::slotted(img[slot="leading"]), ::slotted(img[slot="trailing"]) { display: block; margin: 0 auto; overflow: hidden; object-fit: cover; } ::slotted(video) { width: var(--m3e-list-item-video-width, 6.25rem); height: var(--m3e-list-item-video-height, 3.5rem); } ::slotted(video[slot="leading"]), ::slotted(video[slot="trailing"]) { border-radius: var(--m3e-list-item-video-shape, ${d.shape.corner.none}); } ::slotted(video[slot="leading"]) { margin-inline-start: calc(0px - var(--_list-item-leading-video-outset, 0px)); } ::slotted(video[slot="trailing"]) { margin-inline-end: calc(0px - var(--_list-item-trailing-video-outset, 0px)); } ::slotted(img) { user-drag: none; user-select: none; pointer-events: none; width: var(--m3e-list-item-image-width, 3.5rem); height: var(--m3e-list-item-image-height, 3.5rem); } ::slotted(img[slot="leading"]), ::slotted(img[slot="trailing"]) { border-radius: var(--m3e-list-item-image-shape, ${d.shape.corner.none}); } ::slotted(m3e-icon[slot="leading"]), ::slotted(m3e-icon[slot="leading-icon"]), ::slotted(m3e-icon[slot="trailing"]), ::slotted(m3e-icon[slot="trailing-icon"]) { --m3e-icon-size: var(--m3e-list-item-icon-size, 1.5rem); } :host(:not(:disabled)) ::slotted(m3e-icon[slot="leading"]), :host(:not(:disabled)) ::slotted(m3e-icon[slot="leading-icon"]) { color: var(--m3e-list-item-leading-color, ${d.color.onSurfaceVariant}); } :host(:not(:disabled)) .base { color: var(--m3e-list-item-label-text-color, ${d.color.onSurface}); } :host(:not(:disabled)) ::slotted([slot="overline"]) { color: var(--m3e-list-item-overline-color, ${d.color.onSurfaceVariant}); } :host(:not(:disabled)) ::slotted([slot="supporting-text"]) { color: var(--m3e-list-item-supporting-text-color, ${d.color.onSurfaceVariant}); } :host(:not(:disabled)) ::slotted([slot="trailing"]), :host(:not(:disabled)) ::slotted([slot="trailing-supporting-text"]), :host(:not(:disabled)) ::slotted([slot="trailing-icon"]) { color: var(--m3e-list-item-trailing-color, ${d.color.onSurfaceVariant}); } :host(:not(:disabled)) { background-color: var(--_list-item-container-color, var(--m3e-list-item-container-color, transparent)); } :host(:disabled) { background-color: var(--m3e-list-item-disabled-container-color, transparent); } :host(:disabled) ::slotted(video), :host(:disabled) ::slotted(img), :host(:disabled) ::slotted(m3e-avatar) { opacity: var(--m3e-list-item-disabled-media-opacity, 38%); } :host(:disabled) .base { color: color-mix( in srgb, var(--m3e-list-item-disabled-label-text-color, ${d.color.onSurface}) var(--m3e-list-item-disabled-label-text-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="overline"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-overline-color, ${d.color.onSurface}) var(--m3e-list-item-disabled-overline-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="supporting-text"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-supporting-text-color, ${d.color.onSurface}) var(--m3e-list-item-disabled-supporting-text-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="leading"]), :host(:disabled) ::slotted([slot="leading-icon"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-leading-color, ${d.color.onSurface}) var(--m3e-list-item-disabled-leading-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="trailing"]), :host(:disabled) ::slotted([slot="trailing-supporting-text"]), :host(:disabled) ::slotted([slot="trailing-icon"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-trailing-color, ${d.color.onSurface}) var(--m3e-list-item-disabled-trailing-opacity, 38%), transparent ); } :host(:not(:disabled)) .state-layer { --m3e-state-layer-hover-color: var(--m3e-list-item-hover-state-layer-color, ${d.color.onSurface}); --m3e-state-layer-hover-opacity: var( --m3e-list-item-hover-state-layer-opacity, ${d.state.hoverStateLayerOpacity} ); --m3e-state-layer-focus-color: var(--m3e-list-item-focus-state-layer-color, ${d.color.onSurface}); --m3e-state-layer-focus-opacity: var( --m3e-list-item-focus-state-layer-opacity, ${d.state.focusStateLayerOpacity} ); } :host(:not(:disabled)) .ripple { --m3e-ripple-color: var(--m3e-list-item-pressed-state-layer-color, ${d.color.onSurface}); --m3e-ripple-opacity: var( --m3e-list-item-pressed-state-layer-opacity, ${d.state.pressedStateLayerOpacity} ); } @media (forced-colors: active) { :host(:disabled) ::slotted([slot="leading"]), :host(:disabled) ::slotted([slot="leading-icon"]), :host(:disabled) .base, :host(:disabled) ::slotted([slot="overline"]), :host(:disabled) ::slotted([slot="supporting-text"]), :host(:disabled) ::slotted([slot="trailing"]), :host(:disabled) ::slotted([slot="trailing-supporting-text"]), :host(:disabled) ::slotted([slot="trailing-icon"]) { color: GrayText; } } @media (prefers-reduced-motion) { :host { transition: none; } }`,at=A([C("m3e-list-item")],at);let ht=class extends(r(s,"list")){constructor(){super(...arguments),nt.add(this),rt.set(this,new Array),lt.set(this,{video:0,image:0,avatar:0,icon:0,text:0}),dt.set(this,{video:0,image:0,avatar:0,icon:0,text:0}),this.variant="standard"}get items(){return S(this,rt,"f")}get leadingContentType(){return S(this,lt,"f").video>0?"video":S(this,lt,"f").image>0?"image":S(this,lt,"f").avatar>0?"avatar":S(this,lt,"f").icon>0?"icon":S(this,lt,"f").text>0?"text":void 0}get trailingContentType(){return S(this,dt,"f").video>0?"video":S(this,dt,"f").image>0?"image":S(this,dt,"f").avatar>0?"avatar":S(this,dt,"f").icon>0?"icon":S(this,dt,"f").text>0?"text":void 0}render(){return o`<slot @slotchange="${S(this,nt,"m",ct)}"></slot>`}notifyItemsChange(){}notifyLeadingContentTypeChange(t,e){t&&S(this,lt,"f")[t]--,e&&S(this,lt,"f")[e]++,["video","image","avatar","icon"].forEach(t=>{this.classList.toggle(`-has-leading-${t}`,this.leadingContentType===t)})}notifyTrailingContentTypeChange(t,e){t&&S(this,dt,"f")[t]--,e&&S(this,dt,"f")[e]--,["video","image","avatar","icon"].forEach(t=>{this.classList.toggle(`-has-trailing-${t}`,this.trailingContentType===t)})}};var mt,pt,gt,ut,vt,ft,bt,yt,$t;rt=new WeakMap,lt=new WeakMap,dt=new WeakMap,nt=new WeakSet,ct=function(t){E(this,rt,t.target.assignedElements({flatten:!0}).filter(t=>t instanceof at),"f"),S(this,rt,"f").forEach((t,e)=>{t.classList.toggle("-first",0===e),t.classList.toggle("-last",e===S(this,rt,"f").length-1)}),this.notifyItemsChange()},ht.styles=n`:host { display: flex; flex-direction: column; overflow-y: auto; box-sizing: border-box; padding-block: var(--m3e-list-block-padding, 0px); --m3e-divider-inset-start-size: var(--m3e-list-divider-inset-start-size, 1rem); --m3e-divider-inset-end-size: var(--m3e-list-divider-inset-end-size, 1.5rem); } :host([variant="standard"]) { --_list-item-leading-video-outset: var(--m3e-list-item-leading-space, 1rem); --_list-item-trailing-video-outset: var(--m3e-list-item-trailing-space, 1rem); --_expandable-list-item-expanded-toggle-icon-container-color: transparent; } :host([variant="segmented"]) { row-gap: var(--m3e-segmented-list-segment-gap, 0.125rem); } :host([variant="segmented"]) { --m3e-list-item-container-color: var(--m3e-segmented-list-item-container-color, ${d.color.surface}); --m3e-list-item-disabled-container-color: var( --m3e-segmented-list-item-disabled-container-color, ${d.color.surface} ); --m3e-list-item-container-shape: var( --m3e-segmented-list-item-container-shape, ${d.shape.corner.extraSmall} ); --m3e-list-item-hover-container-shape: var( --m3e-segmented-list-item-hover-container-shape, ${d.shape.corner.medium} ); --m3e-list-item-focus-container-shape: var( --m3e-segmented-list-item-focus-container-shape, ${d.shape.corner.large} ); --m3e-list-item-selected-container-shape: var( --m3e-segmented-list-item-selected-container-shape, ${d.shape.corner.large} ); --m3e-list-item-video-shape: var(--m3e-segmented-list-item-video-shape, ${d.shape.corner.small}); --m3e-list-item-image-shape: var(--m3e-segmented-list-item-image-shape, ${d.shape.corner.small}); --m3e-list-item-between-space: var(--m3e-segmented-list-item-spacing, 0.75rem); --_expandable-list-item-items-segment-gap: var(--m3e-segmented-list-segment-gap, 0.125rem); --_expandable-list-item-expanded-top-shape: var( --m3e-segmented-list-container-shape, ${d.shape.corner.large} ); } :host([variant="segmented"]) ::slotted(.-first), :host([variant="segmented"]) ::slotted(.-last.-has-previous-open:not([open])) { --_list-item-top-container-shape: var(--m3e-segmented-list-container-shape, ${d.shape.corner.large}); } :host([variant="segmented"]) ::slotted(.-first.-has-next-open:not([open])), :host([variant="segmented"]) ::slotted(.-last) { --_list-item-bottom-container-shape: var(--m3e-segmented-list-container-shape, ${d.shape.corner.large}); } :host([variant="segmented"]) ::slotted(m3e-divider) { display: none; } :host(.-has-leading-video) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-list-item-video-width, 6.25rem); } :host([variant="standard"].-has-leading-video) { --_list-item-leading-reserved-outset: var(--m3e-list-item-leading-space, 1rem); --_list-item-trailing-reserved-outset: var(--m3e-list-item-trailing-space, 1rem); } :host(.-has-leading-image) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-list-item-image-width, 3.5rem); } :host(.-has-leading-avatar) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-avatar-size, 2.5rem); } :host(.-has-leading-icon) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-list-item-icon-size, 1.5rem); }`,A([Q({reflect:!0})],ht.prototype,"variant",void 0),ht=A([C("m3e-list")],ht);let _t=$t=class extends at{constructor(){super(...arguments),mt.add(this),pt.set(this,$t.__nextId++),gt.set(this,`m3e-expandable-list-item-${S(this,pt,"f")}-content`),ut.set(this,`m3e-expandable-list-item-${S(this,pt,"f")}-header`),vt.set(this,new Array),this.disabled=!1,this.open=!1}get items(){return S(this,vt,"f")}updated(t){if(super.updated(t),t.has("open")){for(let t=this.previousElementSibling;t;t=t.previousElementSibling)if(t instanceof at){t.classList.toggle("-has-next-open",this.open);break}for(let t=this.nextElementSibling;t;t=t.nextElementSibling)if(t instanceof at){t.classList.toggle("-has-previous-open",this.open);break}}}render(){return o`<m3e-list-item-button id="${S(this,ut,"f")}" class="header" ?disabled="${this.disabled}" aria-expanded="${this.open}" aria-controls="${S(this,gt,"f")}" @click="${S(this,mt,"m",ft)}"><slot name="leading" slot="leading" @slotchange="${this._handleLeadingSlotChange}"></slot><slot name="overline" slot="overline"></slot><slot></slot><slot name="supporting-text" slot="supporting-text"></slot><div class="toggle-container" slot="trailing" aria-hidden="true"><div class="toggle"><slot name="toggle-icon"><svg viewBox="0 -960 960 960" fill="currentColor"><path d="M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"/></svg></slot></div></div></m3e-list-item-button><m3e-collapsible id="${S(this,gt,"f")}" class="items" role="list" aria-labelledby="${S(this,ut,"f")}" aria-hidden="${!this.open}" ?open="${this.open}" @opening="${S(this,mt,"m",bt)}" @opened="${S(this,mt,"m",bt)}" @closing="${S(this,mt,"m",bt)}" @closed="${S(this,mt,"m",bt)}"><slot name="items" @slotchange="${S(this,mt,"m",yt)}"></slot></m3e-collapsible>`}};var xt,wt;pt=new WeakMap,gt=new WeakMap,ut=new WeakMap,vt=new WeakMap,mt=new WeakSet,ft=function(e){e.defaultPrevented||(this.open=!this.open,this.closest("m3e-action-list")?.[t].updateActiveItem(this.button))},bt=function(t){t.stopPropagation(),["opening","opened","closing","closed"].forEach(e=>{this.button?.classList.toggle(e,t.type===e)}),this.dispatchEvent(new Event(t.type,{bubbles:!0}))},yt=function(t){E(this,vt,t.target.assignedElements({flatten:!0}).flatMap(t=>[...t.childNodes].filter(t=>t instanceof at)),"f"),S(this,vt,"f").forEach((t,e)=>{e==S(this,vt,"f").length-1?t.style.setProperty("--_list-item-bottom-container-shape",`var(--m3e-segmented-list-container-shape, ${d.shape.corner.large})`):t.style.removeProperty("--_list-item-bottom-container-shape")}),this.closest("m3e-list, m3e-action-list, m3e-selection-list")?.notifyItemsChange()},_t.styles=n`.header { width: 100%; margin-bottom: 0px; transition: ${a(`margin-bottom \n var(--m3e-expandable-list-item-bounce-duration, ${d.motion.duration.medium1})\n ${d.motion.easing.standard}`)}; } .toggle-container { display: flex; align-items: center; justify-content: center; align-self: stretch; width: var(--m3e-expandable-list-item-toggle-icon-container-width, 2rem); border-radius: var(--m3e-expandable-list-item-toggle-icon-container-shape, ${d.shape.corner.full}); transition: ${a(`background-color ${d.motion.duration.short4} ${d.motion.easing.standard}`)}; } .toggle { display: flex; align-items: center; justify-content: center; vertical-align: middle; font-size: var(--m3e-expandable-list-item-toggle-icon-size, 1.5rem); transition: ${a(`transform ${d.motion.duration.short4} ${d.motion.easing.standard}`)}; } .toggle svg, ::slotted(svg[slot="toggle-icon"]) { width: 1em; height: 1em; } :host([open]) .toggle-container { background-color: var( --_expandable-list-item-expanded-toggle-icon-container-color, var(--m3e-expandable-list-item-expanded-toggle-icon-container-color, ${d.color.surfaceContainer}) ); } :host([open]) .toggle { transform: rotate(180deg); } :host([open]) .header { --_list-item-top-container-shape: var(--_expandable-list-item-expanded-top-shape, initial); --_list-item-bottom-container-shape: initial; margin-bottom: var(--_expandable-list-item-items-segment-gap, 0px); } :host([open]) .header.opening { margin-bottom: calc( var(--_expandable-list-item-items-segment-gap, 0px) * var(--m3e-expandable-list-item-bounce-factor, 4) ); } :host([open]) .header, :host([open]) .items { --_list-item-container-color: var( --m3e-expandable-list-item-expanded-container-color, var(--m3e-list-item-container-color, transparent) ); } :host, ::slotted([slot="items"]) { flex: none; display: flex; flex-direction: column; box-sizing: border-box; } ::slotted([slot="items"]) { --_list-item-top-container-shape: initial; --_list-item-bottom-container-shape: initial; row-gap: var(--_expandable-list-item-items-segment-gap, 0px); } .items { --m3e-collapsible-animation-duration: var( --m3e-expandable-list-item-expand-duration, ${d.motion.duration.medium1} ); } @media (forced-colors: active) { .header { transition: none; } :host([open]) .header.opening { margin-bottom: var(--_expandable-list-item-items-segment-gap, 0px); } } @media (prefers-reduced-motion) { .header, .toggle-container, .toggle { transition: none; } }`,_t.__nextId=0,A([Q({type:Boolean,reflect:!0})],_t.prototype,"disabled",void 0),A([Q({type:Boolean,reflect:!0})],_t.prototype,"open",void 0),A([X(".header")],_t.prototype,"button",void 0),_t=$t=A([C("m3e-expandable-list-item")],_t);let At=class extends ht{constructor(){super(...arguments),xt.set(this,e=>this[t].onKeyDown(e)),this[wt]=(new e).withWrap().withHomeAndEnd().withVerticalOrientation().withSkipPredicate(t=>{if(t.disabled)return!0;const e=t.getRootNode().host;if("items"===e.parentElement?.slot){let t=e.closest("m3e-expandable-list-item");for(;t;){if(!t.open)return!0;const e=t.closest("m3e-expandable-list-item,m3e-action-list");e instanceof _t&&(t=e);break}}return!1})}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",S(this,xt,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",S(this,xt,"f"))}async notifyItemsChange(){const e=[...this.querySelectorAll("m3e-list-action,m3e-expandable-list-item")];for(const t of e)t.isUpdatePending&&await t.updateComplete;this.isUpdatePending&&await this.updateComplete;const{added:i}=this[t].setItems(e.map(t=>t.button));this[t].activeItem||this[t].updateActiveItem(i.find(t=>!t.disabled))}};xt=new WeakMap,wt=t,At=A([C("m3e-action-list")],At);
|
|
39
|
+
function X(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i))(e,i,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}var Y,tt,et,it,st,ot;let at=class extends(r(s,"listitem")){constructor(){super(...arguments),Y.add(this),tt.set(this,new l(this,{target:null,callback:()=>S(this,Y,"m",st).call(this)})),et.set(this,void 0),it.set(this,void 0)}get leadingContentType(){return S(this,et,"f")}get trailingContentType(){return S(this,it,"f")}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot?.querySelector(".base");e&&S(this,tt,"f").observe(e)}render(){return o`<slot name="leading" @slotchange="${this._handleLeadingSlotChange}"><slot name="leading-icon" @slotchange="${this._handleLeadingSlotChange}"></slot></slot><div class="base"><slot name="overline"></slot><slot></slot><slot name="supporting-text"></slot></div><slot name="trailing" @slotchange="${this._handleTrailingSlotChange}"><slot name="trailing-supporting-text" @slotchange="${this._handleTrailingSlotChange}"></slot><slot name="trailing-icon" @slotchange="${this._handleTrailingSlotChange}"></slot></slot>`}_handleLeadingSlotChange(t){const e=S(this,et,"f");E(this,et,S(this,Y,"m",ot).call(this,t.target),"f"),this.classList.toggle("-has-leading",void 0!==S(this,et,"f")),e!==S(this,et,"f")&&this.closest("m3e-list,m3e-action-list,m3e-selection-list")?.notifyLeadingContentTypeChange(e,S(this,et,"f"))}_handleTrailingSlotChange(t){const e=S(this,it,"f");E(this,it,S(this,Y,"m",ot).call(this,t.target),"f"),this.classList.toggle("-has-trailing",void 0!==S(this,it,"f")),e!==S(this,it,"f")&&this.closest("m3e-list,m3e-action-list,m3e-selection-list")?.notifyTrailingContentTypeChange(e,S(this,it,"f"))}};var nt,rt,lt,dt,ct;tt=new WeakMap,et=new WeakMap,it=new WeakMap,Y=new WeakSet,st=function(){const t=this.shadowRoot?.querySelector(".base")??null,e=null===t?0:c(t);this.classList.toggle("-one-line",e<=1),this.classList.toggle("-two-line",2==e),this.classList.toggle("-three-line",e>2)},ot=function(t){const e=t.assignedElements({flatten:!0});return e.some(t=>"VIDEO"===t.tagName)?"video":e.some(t=>"IMG"===t.tagName)?"image":e.some(t=>"M3E-AVATAR"===t.tagName)?"avatar":e.some(t=>"M3E-ICON"===t.tagName)?"icon":e.length>0?"text":void 0},at.styles=n`:host { flex: none; display: flex; box-sizing: border-box; column-gap: var(--m3e-list-item-between-space, 1rem); padding-inline-start: var(--m3e-list-item-leading-space, 1rem); padding-inline-end: var(--m3e-list-item-trailing-space, 1rem); border-top-left-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-container-shape, ${d.shape.corner.none}) ); border-top-right-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-container-shape, ${d.shape.corner.none}) ); border-bottom-left-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-container-shape, ${d.shape.corner.none}) ); border-bottom-right-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-container-shape, ${d.shape.corner.none}) ); transition: ${a(`border-radius ${d.motion.spring.fastEffects}, background-color ${d.motion.duration.short4} ${d.motion.easing.standard}`)}; } :host(.-one-line) { padding-block-start: var(--m3e-list-item-one-line-top-space, 0.5rem); padding-block-end: var(--m3e-list-item-one-line-bottom-space, 0.5rem); min-height: calc(var(--m3e-list-item-one-line-height, 3.5rem) + ${d.density.calc(-3)}); } :host(.-two-line) { padding-block-start: var(--m3e-list-item-two-line-top-space, 0.5rem); padding-block-end: var(--m3e-list-item-two-line-bottom-space, 0.5rem); min-height: calc(var(--m3e-list-item-two-line-height, 4.5rem) + ${d.density.calc(-3)}); } :host(.-three-line) { padding-block-start: var(--m3e-list-item-three-line-top-space, 0.75rem); padding-block-end: var(--m3e-list-item-three-line-bottom-space, 0.75rem); min-height: calc(var(--m3e-list-item-three-line-height, 5.5rem) + ${d.density.calc(-3)}); } :host(:not(.-three-line)) { align-items: center; } :host(.-three-line) { align-items: flex-start; } :host(:not(:disabled):not([selected]:not(:hover)):focus-visible) .state-layer, :host(:not(:disabled):not([selected]:not(:hover)):focus-visible) .ripple, :host(:not(:disabled):not([selected]:not(:hover)):focus-visible) .focus-ring { border-top-left-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-focus-container-shape, ${d.shape.corner.large}) ); border-top-right-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-focus-container-shape, ${d.shape.corner.large}) ); border-bottom-left-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-focus-container-shape, ${d.shape.corner.large}) ); border-bottom-right-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-focus-container-shape, ${d.shape.corner.large}) ); } :host(:not(:disabled):not([selected])) .state-layer, :host(:not(:disabled):not([selected])) .ripple, :host(:not(:disabled):not([selected])) .focus-ring { border-top-left-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-hover-container-shape, ${d.shape.corner.medium}) ); border-top-right-radius: var( --_list-item-top-container-shape, var(--m3e-list-item-hover-container-shape, ${d.shape.corner.medium}) ); border-bottom-left-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-hover-container-shape, ${d.shape.corner.medium}) ); border-bottom-right-radius: var( --_list-item-bottom-container-shape, var(--m3e-list-item-hover-container-shape, ${d.shape.corner.medium}) ); } .base { flex: 1 1 auto; display: flex; flex-direction: column; align-items: unset; justify-content: unset; } ::slotted([slot="overline"]) { font-size: var(--m3e-list-item-overline-font-size, ${d.typescale.standard.label.small.fontSize}); font-weight: var(--m3e-list-item-overline-font-weight, ${d.typescale.standard.label.small.fontWeight}); line-height: var(--m3e-list-item-overline-line-height, ${d.typescale.standard.label.small.lineHeight}); letter-spacing: var(--m3e-list-item-overline-tracking, ${d.typescale.standard.label.small.tracking}); } ::slotted([slot="supporting-text"]) { font-size: var(--m3e-list-item-supporting-text-font-size, ${d.typescale.standard.body.medium.fontSize}); font-weight: var( --m3e-list-item-supporting-text-font-weight, ${d.typescale.standard.body.medium.fontWeight} ); line-height: var( --m3e-list-item-supporting-text-line-height, ${d.typescale.standard.body.medium.lineHeight} ); letter-spacing: var( --m3e-list-item-supporting-text-tracking, ${d.typescale.standard.body.medium.tracking} ); } ::slotted(:not([slot])) { font-size: var(--m3e-list-item-font-size, ${d.typescale.standard.body.large.fontSize}); font-weight: var(--m3e-list-item-font-weight, ${d.typescale.standard.body.large.fontWeight}); line-height: var(--m3e-list-item-line-height, ${d.typescale.standard.body.large.lineHeight}); letter-spacing: var(--m3e-list-item-tracking, ${d.typescale.standard.body.large.tracking}); } :host(.-has-leading) slot[name="leading"], :host(.-has-trailing) slot[name="trailing"] { display: flex; justify-content: center; } :host(:not(.-has-leading)) slot[name="leading"] { display: var(--_list-item-leading-reserved-display, contents); } :host(:not(.-has-trailing)) slot[name="trailing"] { display: var(--_list-item-trailing-reserved-display, contents); } slot[name="leading"] { min-width: var(--_list-item-leading-reserved-space, 0px); margin-inline-start: calc(0px - var(--_list-item-leading-reserved-outset, 0px)); } slot[name="trailing"] { min-width: var(--_list-item-trailing-reserved-space, 0px); margin-inline-end: calc(0px - var(--_list-item-trailing-reserved-outset, 0px)); } ::slotted(span[slot="trailing"]), ::slotted([slot="trailing-supporting-text"]) { white-space: nowrap; font-size: var(--m3e-list-item-trailing-text-font-size, ${d.typescale.standard.label.small.fontSize}); font-weight: var( --m3e-list-item-trailing-text-font-weight, ${d.typescale.standard.label.small.fontWeight} ); line-height: var( --m3e-list-item-trailing-text-line-height, ${d.typescale.standard.label.small.lineHeight} ); letter-spacing: var( --m3e-list-item-trailing-text-tracking, ${d.typescale.standard.label.small.tracking} ); } ::slotted(video[slot="leading"]), ::slotted(video[slot="trailing"]), ::slotted(img[slot="leading"]), ::slotted(img[slot="trailing"]) { display: block; margin: 0 auto; overflow: hidden; object-fit: cover; } ::slotted(video) { width: var(--m3e-list-item-video-width, 6.25rem); height: var(--m3e-list-item-video-height, 3.5rem); } ::slotted(video[slot="leading"]), ::slotted(video[slot="trailing"]) { border-radius: var(--m3e-list-item-video-shape, ${d.shape.corner.none}); } ::slotted(video[slot="leading"]) { margin-inline-start: calc(0px - var(--_list-item-leading-video-outset, 0px)); } ::slotted(video[slot="trailing"]) { margin-inline-end: calc(0px - var(--_list-item-trailing-video-outset, 0px)); } ::slotted(img) { user-drag: none; user-select: none; pointer-events: none; width: var(--m3e-list-item-image-width, 3.5rem); height: var(--m3e-list-item-image-height, 3.5rem); } ::slotted(img[slot="leading"]), ::slotted(img[slot="trailing"]) { border-radius: var(--m3e-list-item-image-shape, ${d.shape.corner.none}); } ::slotted(m3e-icon[slot="leading"]), ::slotted(m3e-icon[slot="leading-icon"]), ::slotted(m3e-icon[slot="trailing"]), ::slotted(m3e-icon[slot="trailing-icon"]) { --m3e-icon-size: var(--m3e-list-item-icon-size, 1.5rem); } :host(:not(:disabled)) ::slotted(m3e-icon[slot="leading"]), :host(:not(:disabled)) ::slotted(m3e-icon[slot="leading-icon"]) { color: var(--m3e-list-item-leading-color, ${d.color.onSurfaceVariant}); } :host(:not(:disabled)) .base { color: var(--m3e-list-item-label-text-color, ${d.color.onSurface}); } :host(:not(:disabled)) ::slotted([slot="overline"]) { color: var(--m3e-list-item-overline-color, ${d.color.onSurfaceVariant}); } :host(:not(:disabled)) ::slotted([slot="supporting-text"]) { color: var(--m3e-list-item-supporting-text-color, ${d.color.onSurfaceVariant}); } :host(:not(:disabled)) ::slotted([slot="trailing"]), :host(:not(:disabled)) ::slotted([slot="trailing-supporting-text"]), :host(:not(:disabled)) ::slotted([slot="trailing-icon"]) { color: var(--m3e-list-item-trailing-color, ${d.color.onSurfaceVariant}); } :host(:not(:disabled)) { background-color: var(--_list-item-container-color, var(--m3e-list-item-container-color, transparent)); } :host(:disabled) { background-color: var(--m3e-list-item-disabled-container-color, transparent); } :host(:disabled) ::slotted(video), :host(:disabled) ::slotted(img), :host(:disabled) ::slotted(m3e-avatar) { opacity: var(--m3e-list-item-disabled-media-opacity, 38%); } :host(:disabled) .base { color: color-mix( in srgb, var(--m3e-list-item-disabled-label-text-color, ${d.color.onSurface}) var(--m3e-list-item-disabled-label-text-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="overline"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-overline-color, ${d.color.onSurface}) var(--m3e-list-item-disabled-overline-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="supporting-text"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-supporting-text-color, ${d.color.onSurface}) var(--m3e-list-item-disabled-supporting-text-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="leading"]), :host(:disabled) ::slotted([slot="leading-icon"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-leading-color, ${d.color.onSurface}) var(--m3e-list-item-disabled-leading-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="trailing"]), :host(:disabled) ::slotted([slot="trailing-supporting-text"]), :host(:disabled) ::slotted([slot="trailing-icon"]) { color: color-mix( in srgb, var(--m3e-list-item-disabled-trailing-color, ${d.color.onSurface}) var(--m3e-list-item-disabled-trailing-opacity, 38%), transparent ); } :host(:not(:disabled)) .state-layer { --m3e-state-layer-hover-color: var(--m3e-list-item-hover-state-layer-color, ${d.color.onSurface}); --m3e-state-layer-hover-opacity: var( --m3e-list-item-hover-state-layer-opacity, ${d.state.hoverStateLayerOpacity} ); --m3e-state-layer-focus-color: var(--m3e-list-item-focus-state-layer-color, ${d.color.onSurface}); --m3e-state-layer-focus-opacity: var( --m3e-list-item-focus-state-layer-opacity, ${d.state.focusStateLayerOpacity} ); } :host(:not(:disabled)) .ripple { --m3e-ripple-color: var(--m3e-list-item-pressed-state-layer-color, ${d.color.onSurface}); --m3e-ripple-opacity: var( --m3e-list-item-pressed-state-layer-opacity, ${d.state.pressedStateLayerOpacity} ); } @media (forced-colors: active) { :host(:disabled) ::slotted([slot="leading"]), :host(:disabled) ::slotted([slot="leading-icon"]), :host(:disabled) .base, :host(:disabled) ::slotted([slot="overline"]), :host(:disabled) ::slotted([slot="supporting-text"]), :host(:disabled) ::slotted([slot="trailing"]), :host(:disabled) ::slotted([slot="trailing-supporting-text"]), :host(:disabled) ::slotted([slot="trailing-icon"]) { color: GrayText; } } @media (prefers-reduced-motion) { :host { transition: none; } }`,at=A([C("m3e-list-item")],at);let ht=class extends(r(s,"list")){constructor(){super(...arguments),nt.add(this),rt.set(this,new Array),lt.set(this,{video:0,image:0,avatar:0,icon:0,text:0}),dt.set(this,{video:0,image:0,avatar:0,icon:0,text:0}),this.variant="standard"}get items(){return S(this,rt,"f")}get leadingContentType(){return S(this,lt,"f").video>0?"video":S(this,lt,"f").image>0?"image":S(this,lt,"f").avatar>0?"avatar":S(this,lt,"f").icon>0?"icon":S(this,lt,"f").text>0?"text":void 0}get trailingContentType(){return S(this,dt,"f").video>0?"video":S(this,dt,"f").image>0?"image":S(this,dt,"f").avatar>0?"avatar":S(this,dt,"f").icon>0?"icon":S(this,dt,"f").text>0?"text":void 0}render(){return o`<slot @slotchange="${S(this,nt,"m",ct)}"></slot>`}notifyItemsChange(){}notifyLeadingContentTypeChange(t,e){t&&S(this,lt,"f")[t]--,e&&S(this,lt,"f")[e]++,["video","image","avatar","icon"].forEach(t=>{this.classList.toggle(`-has-leading-${t}`,this.leadingContentType===t)})}notifyTrailingContentTypeChange(t,e){t&&S(this,dt,"f")[t]--,e&&S(this,dt,"f")[e]--,["video","image","avatar","icon"].forEach(t=>{this.classList.toggle(`-has-trailing-${t}`,this.trailingContentType===t)})}};var mt,pt,gt,ut,vt,ft,bt,yt,$t;rt=new WeakMap,lt=new WeakMap,dt=new WeakMap,nt=new WeakSet,ct=function(t){E(this,rt,t.target.assignedElements({flatten:!0}).filter(t=>t instanceof at),"f"),S(this,rt,"f").forEach((t,e)=>{t.classList.toggle("-first",0===e),t.classList.toggle("-last",e===S(this,rt,"f").length-1)}),this.notifyItemsChange()},ht.styles=n`:host { display: flex; flex-direction: column; overflow-y: auto; box-sizing: border-box; padding-block: var(--m3e-list-block-padding, 0px); --m3e-divider-inset-start-size: var(--m3e-list-divider-inset-start-size, 1rem); --m3e-divider-inset-end-size: var(--m3e-list-divider-inset-end-size, 1.5rem); } :host([variant="standard"]) { --_list-item-leading-video-outset: var(--m3e-list-item-leading-space, 1rem); --_list-item-trailing-video-outset: var(--m3e-list-item-trailing-space, 1rem); --_expandable-list-item-expanded-toggle-icon-container-color: transparent; } :host([variant="segmented"]) { row-gap: var(--m3e-segmented-list-segment-gap, 0.125rem); } :host([variant="segmented"]) { --m3e-list-item-container-color: var(--m3e-segmented-list-item-container-color, ${d.color.surface}); --m3e-list-item-disabled-container-color: var( --m3e-segmented-list-item-disabled-container-color, ${d.color.surface} ); --m3e-list-item-container-shape: var( --m3e-segmented-list-item-container-shape, ${d.shape.corner.extraSmall} ); --m3e-list-item-hover-container-shape: var( --m3e-segmented-list-item-hover-container-shape, ${d.shape.corner.medium} ); --m3e-list-item-focus-container-shape: var( --m3e-segmented-list-item-focus-container-shape, ${d.shape.corner.large} ); --m3e-list-item-selected-container-shape: var( --m3e-segmented-list-item-selected-container-shape, ${d.shape.corner.large} ); --m3e-list-item-video-shape: var(--m3e-segmented-list-item-video-shape, ${d.shape.corner.small}); --m3e-list-item-image-shape: var(--m3e-segmented-list-item-image-shape, ${d.shape.corner.small}); --m3e-list-item-between-space: var(--m3e-segmented-list-item-spacing, 0.75rem); --_expandable-list-item-items-segment-gap: var(--m3e-segmented-list-segment-gap, 0.125rem); --_expandable-list-item-expanded-top-shape: var( --m3e-segmented-list-container-shape, ${d.shape.corner.large} ); } :host([variant="segmented"]) ::slotted(.-first), :host([variant="segmented"]) ::slotted(.-has-previous-open:not([open])) { --_list-item-top-container-shape: var(--m3e-segmented-list-container-shape, ${d.shape.corner.large}); } :host([variant="segmented"]) ::slotted(.-has-next-open:not([open])), :host([variant="segmented"]) ::slotted(.-last) { --_list-item-bottom-container-shape: var(--m3e-segmented-list-container-shape, ${d.shape.corner.large}); } :host([variant="segmented"]) ::slotted(m3e-divider) { display: none; } :host(.-has-leading-video) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-list-item-video-width, 6.25rem); } :host([variant="standard"].-has-leading-video) { --_list-item-leading-reserved-outset: var(--m3e-list-item-leading-space, 1rem); --_list-item-trailing-reserved-outset: var(--m3e-list-item-trailing-space, 1rem); } :host(.-has-leading-image) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-list-item-image-width, 3.5rem); } :host(.-has-leading-avatar) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-avatar-size, 2.5rem); } :host(.-has-leading-icon) { --_list-item-leading-reserved-display: block; --_list-item-leading-reserved-space: var(--m3e-list-item-icon-size, 1.5rem); }`,A([Q({reflect:!0})],ht.prototype,"variant",void 0),ht=A([C("m3e-list")],ht);let _t=$t=class extends at{constructor(){super(...arguments),mt.add(this),pt.set(this,$t.__nextId++),gt.set(this,`m3e-expandable-list-item-${S(this,pt,"f")}-content`),ut.set(this,`m3e-expandable-list-item-${S(this,pt,"f")}-header`),vt.set(this,new Array),this.disabled=!1,this.open=!1}get items(){return S(this,vt,"f")}updated(t){if(super.updated(t),t.has("open")){for(let t=this.previousElementSibling;t;t=t.previousElementSibling)if(t instanceof at){t.classList.toggle("-has-next-open",this.open);break}for(let t=this.nextElementSibling;t;t=t.nextElementSibling)if(t instanceof at){t.classList.toggle("-has-previous-open",this.open);break}}}render(){return o`<m3e-list-item-button id="${S(this,ut,"f")}" class="header" ?disabled="${this.disabled}" aria-expanded="${this.open}" aria-controls="${S(this,gt,"f")}" @click="${S(this,mt,"m",ft)}"><slot name="leading" slot="leading" @slotchange="${this._handleLeadingSlotChange}"></slot><slot name="overline" slot="overline"></slot><slot></slot><slot name="supporting-text" slot="supporting-text"></slot><div class="toggle-container" slot="trailing" aria-hidden="true"><div class="toggle"><slot name="toggle-icon"><svg viewBox="0 -960 960 960" fill="currentColor"><path d="M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"/></svg></slot></div></div></m3e-list-item-button><m3e-collapsible id="${S(this,gt,"f")}" class="items" role="list" aria-labelledby="${S(this,ut,"f")}" aria-hidden="${!this.open}" ?open="${this.open}" @opening="${S(this,mt,"m",bt)}" @opened="${S(this,mt,"m",bt)}" @closing="${S(this,mt,"m",bt)}" @closed="${S(this,mt,"m",bt)}"><slot name="items" @slotchange="${S(this,mt,"m",yt)}"></slot></m3e-collapsible>`}};var xt,wt;pt=new WeakMap,gt=new WeakMap,ut=new WeakMap,vt=new WeakMap,mt=new WeakSet,ft=function(e){e.defaultPrevented||(this.open=!this.open,this.closest("m3e-action-list")?.[t].updateActiveItem(this.button))},bt=function(t){t.stopPropagation(),["opening","opened","closing","closed"].forEach(e=>{this.button?.classList.toggle(e,t.type===e)}),this.dispatchEvent(new Event(t.type,{bubbles:!0}))},yt=function(t){E(this,vt,t.target.assignedElements({flatten:!0}).flatMap(t=>[...t.childNodes].filter(t=>t instanceof at)),"f"),S(this,vt,"f").forEach((t,e)=>{e==S(this,vt,"f").length-1?t.style.setProperty("--_list-item-bottom-container-shape",`var(--m3e-segmented-list-container-shape, ${d.shape.corner.large})`):t.style.removeProperty("--_list-item-bottom-container-shape")}),this.closest("m3e-list, m3e-action-list, m3e-selection-list")?.notifyItemsChange()},_t.styles=n`.header { width: 100%; margin-bottom: 0px; transition: ${a(`margin-bottom \n var(--m3e-expandable-list-item-bounce-duration, ${d.motion.duration.medium1})\n ${d.motion.easing.standard}`)}; --_list-item-button-trailing-align-self: stretch; } .toggle-container { display: flex; align-items: center; justify-content: center; align-self: stretch; width: var(--m3e-expandable-list-item-toggle-icon-container-width, 2rem); border-radius: var(--m3e-expandable-list-item-toggle-icon-container-shape, ${d.shape.corner.full}); transition: ${a(`background-color ${d.motion.duration.short4} ${d.motion.easing.standard}`)}; } .toggle { display: flex; align-items: center; justify-content: center; vertical-align: middle; font-size: var(--m3e-expandable-list-item-toggle-icon-size, 1.5rem); transition: ${a(`transform ${d.motion.duration.short4} ${d.motion.easing.standard}`)}; } .toggle svg, ::slotted(svg[slot="toggle-icon"]) { width: 1em; height: 1em; } :host([open]) .toggle-container { background-color: var( --_expandable-list-item-expanded-toggle-icon-container-color, var(--m3e-expandable-list-item-expanded-toggle-icon-container-color, ${d.color.surfaceContainer}) ); } :host([open]) .toggle { transform: rotate(180deg); } :host([open]) .header { --_list-item-top-container-shape: var(--_expandable-list-item-expanded-top-shape, initial); --_list-item-bottom-container-shape: initial; margin-bottom: var(--_expandable-list-item-items-segment-gap, 0px); } :host([open]) .header.opening { margin-bottom: calc( var(--_expandable-list-item-items-segment-gap, 0px) * var(--m3e-expandable-list-item-bounce-factor, 4) ); } :host([open]) .header, :host([open]) .items { --_list-item-container-color: var( --m3e-expandable-list-item-expanded-container-color, var(--m3e-list-item-container-color, transparent) ); } :host, ::slotted([slot="items"]) { flex: none; display: flex; flex-direction: column; box-sizing: border-box; } ::slotted([slot="items"]) { --_list-item-top-container-shape: initial; --_list-item-bottom-container-shape: initial; row-gap: var(--_expandable-list-item-items-segment-gap, 0px); } .items { --m3e-collapsible-animation-duration: var( --m3e-expandable-list-item-expand-duration, ${d.motion.duration.medium1} ); } @media (forced-colors: active) { .header { transition: none; } :host([open]) .header.opening { margin-bottom: var(--_expandable-list-item-items-segment-gap, 0px); } } @media (prefers-reduced-motion) { .header, .toggle-container, .toggle { transition: none; } }`,_t.__nextId=0,A([Q({type:Boolean,reflect:!0})],_t.prototype,"disabled",void 0),A([Q({type:Boolean,reflect:!0})],_t.prototype,"open",void 0),A([X(".header")],_t.prototype,"button",void 0),_t=$t=A([C("m3e-expandable-list-item")],_t);let At=class extends ht{constructor(){super(...arguments),xt.set(this,e=>this[t].onKeyDown(e)),this[wt]=(new e).withWrap().withHomeAndEnd().withVerticalOrientation().withSkipPredicate(t=>{if(t.disabled)return!0;const e=t.getRootNode().host;if("items"===e.parentElement?.slot){let t=e.closest("m3e-expandable-list-item");for(;t;){if(!t.open)return!0;const e=t.closest("m3e-expandable-list-item,m3e-action-list");e instanceof _t&&(t=e);break}}return!1})}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",S(this,xt,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",S(this,xt,"f"))}async notifyItemsChange(){const e=[...this.querySelectorAll("m3e-list-action,m3e-expandable-list-item")];for(const t of e)t.isUpdatePending&&await t.updateComplete;this.isUpdatePending&&await this.updateComplete;const{added:i}=this[t].setItems(e.map(t=>t.button));this[t].activeItem||this[t].updateActiveItem(i.find(t=>!t.disabled))}};xt=new WeakMap,wt=t,At=A([C("m3e-action-list")],At);
|
|
40
40
|
/**
|
|
41
41
|
* @license
|
|
42
42
|
* Copyright 2017 Google LLC
|
|
@@ -48,5 +48,5 @@ const St=globalThis,Et=St.trustedTypes,Ct=Et?Et.createPolicy("lit-html",{createH
|
|
|
48
48
|
* Copyright 2018 Google LLC
|
|
49
49
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
50
|
*/
|
|
51
|
-
const ne=t=>t??Vt;var re,le;let de=class extends(h(at)){constructor(){super(...arguments),re.add(this),this.disabled=!1}render(){return o`<m3e-list-item-button class="button" ?disabled="${this.disabled}" href="${ne(this.href||void 0)}" target="${ne(this.target||void 0)}" download="${ne(this.download||void 0)}" rel="${ne(this.rel||void 0)}" @click="${S(this,re,"m",le)}"><slot name="leading" slot="leading" @slotchange="${this._handleLeadingSlotChange}"></slot><slot name="overline" slot="overline"></slot><slot></slot><slot name="supporting-text" slot="supporting-text"></slot><slot name="trailing" slot="trailing" @slotchange="${this._handleTrailingSlotChange}"></slot></m3e-list-item-button>`}};re=new WeakSet,le=function(e){e.defaultPrevented||this.closest("m3e-action-list")?.[t].updateActiveItem(this.button)},de.styles=n`:host { display: block; } .button { width: 100%; }`,A([X(".button")],de.prototype,"button",void 0),A([Q({type:Boolean,reflect:!0})],de.prototype,"disabled",void 0),de=A([C("m3e-list-action")],de);let ce=class extends(m(h(p(g(u(r(at,"button"),!0)))))){firstUpdated(t){super.firstUpdated(t),[this._focusRing,this._stateLayer,this._ripple].forEach(t=>t?.attach(this))}render(){return o`<m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><m3e-focus-ring class="focus-ring" inward ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple>${this[v]()} ${super.render()}`}};var he,me,pe,ge,ue,ve;ce.styles=[at.styles,n`:host { position: relative; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host(:not(:disabled)) { cursor: pointer; } a { all: unset; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1; }`],A([X(".focus-ring")],ce.prototype,"_focusRing",void 0),A([X(".state-layer")],ce.prototype,"_stateLayer",void 0),A([X(".ripple")],ce.prototype,"_ripple",void 0),ce=A([C("m3e-list-item-button")],ce);let fe=class extends(m(p(f(g(u(r(at,"option"),!0)))))){constructor(){super(...arguments),he.add(this),me.set(this,void 0),pe.set(this,""),ge.set(this,t=>S(this,he,"m",ve).call(this,t))}get value(){return S(this,me,"f")??S(this,pe,"f")}set value(t){E(this,me,t,"f")}connectedCallback(){super.connectedCallback(),this.addEventListener("click",S(this,ge,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",S(this,ge,"f"))}firstUpdated(t){super.firstUpdated(t),[this._focusRing,this._stateLayer,this._ripple].forEach(t=>t?.attach(this))}update(e){if(super.update(e),e.has("selected")){this.closest("m3e-selection-list")?.[t].notifySelectionChange(this);for(const t of this.querySelectorAll("m3e-icon"))t.toggleAttribute("filled",this.selected)}}render(){return o`<m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><m3e-focus-ring class="focus-ring" inward ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple><slot name="leading" @slotchange="${this._handleLeadingSlotChange}"></slot><div class="base"><slot name="overline"></slot><slot @slotchange="${S(this,he,"m",ue)}"></slot><slot name="supporting-text"></slot></div><slot name="trailing" @slotchange="${this._handleTrailingSlotChange}"></slot><div class="indicator">${this.closest("m3e-selection-list")?.multi?o`<m3e-pseudo-checkbox ?checked="${this.selected}" ?disabled="${this.disabled}"></m3e-pseudo-checkbox>`:o`<m3e-pseudo-radio ?checked="${this.selected}" ?disabled="${this.disabled}"></m3e-pseudo-radio>`}</div>`}};var be,ye,$e,_e,xe;me=new WeakMap,pe=new WeakMap,ge=new WeakMap,he=new WeakSet,ue=function(t){E(this,pe,b(t.target),"f")},ve=function(e){const i=this.closest("m3e-selection-list");if(!e.defaultPrevented&&i&&(i.multi||!this.selected)){const e=this.selected;this.selected=!this.selected,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))?(i[t].notifySelectionChange(this),this.dispatchEvent(new Event("change",{bubbles:!0}))):this.selected=e}},fe.styles=[at.styles,n`:host { position: relative; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .indicator { min-width: 1.5rem; min-height: 1.5rem; display: flex; align-items: center; justify-content: center; } :host(:not(:disabled)) { cursor: pointer; } :host(.-three-line) .indicator { align-self: flex-start; margin-top: var(--m3e-list-item-three-line-top-offset, 0.25rem); } :host([selected]), :host([selected]) .state-layer, :host([selected]) .ripple, :host([selected]) .focus-ring { border-radius: var(--m3e-list-item-selected-container-shape, ${d.shape.corner.large}); } :host([selected]:not(:disabled)) .base { color: var(--m3e-list-item-selected-label-text-color, ${d.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="overline"]) { color: var(--m3e-list-item-selected-overline-color, ${d.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="supporting-text"]) { color: var(--m3e-list-item-selected-supporting-text-color, ${d.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="leading"]) { color: var(--m3e-list-item-selected-leading-color, ${d.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="trailing"]) { color: var(--m3e-list-item-selected-trailing-color, ${d.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) { background-color: var(--m3e-list-item-selected-container-color, ${d.color.secondaryContainer}); } :host([selected]:disabled) { background-color: color-mix( in srgb, var(--m3e-list-item-selected-disabled-container-color, ${d.color.onSurface}) var(--m3e-list-item-selected-disabled-container-opacity, 10%), transparent ); } :host([selected]:not(:disabled)) .state-layer { --m3e-state-layer-hover-color: var( --m3e-list-item-selected-hover-state-layer-color, ${d.color.onSurface} ); --m3e-state-layer-hover-opacity: var( --m3e-list-item-selected-hover-state-layer-opacity, ${d.state.hoverStateLayerOpacity} ); --m3e-state-layer-focus-color: var( --m3e-list-item-selected-focus-state-layer-color, ${d.color.onSurface} ); --m3e-state-layer-focus-opacity: var( --m3e-list-item-selected-focus-state-layer-opacity, ${d.state.focusStateLayerOpacity} ); } :host([selected]:not(:disabled)) .ripple { --m3e-ripple-color: var(--m3e-list-item-selected-pressed-state-layer-color, ${d.color.onSurface}); --m3e-ripple-opacity: var( --m3e-list-item-selected-pressed-state-layer-opacity, ${d.state.pressedStateLayerOpacity} ); } :host(.-hide-selection) .indicator, :host(:not(.-hide-selection)) ::slotted([slot="trailing"]) { display: none; } @media (forced-colors: active) { :host([selected]:not(:disabled)) .base, :host([selected]:not(:disabled)) ::slotted([slot="overline"]), :host([selected]:not(:disabled)) ::slotted([slot="supporting-text"]), :host([selected]:not(:disabled)) ::slotted([slot="leading"]), :host([selected]:not(:disabled)) ::slotted([slot="trailing"]) { color: HighlightText; forced-color-adjust: none; } :host([selected]:not(:disabled)) { background-color: Highlight; } }`],A([X(".focus-ring")],fe.prototype,"_focusRing",void 0),A([X(".state-layer")],fe.prototype,"_stateLayer",void 0),A([X(".ripple")],fe.prototype,"_ripple",void 0),A([Q()],fe.prototype,"value",null),fe=A([C("m3e-list-option")],fe);let we=class extends(y($(_(x(g(u(r(ht,"listbox")))))))){constructor(){super(...arguments),be.add(this),ye.set(this,e=>this[t].onKeyDown(e)),$e.set(this,t=>S(this,be,"m",_e).call(this,t)),this[xe]=(new i).withWrap().withHomeAndEnd().withVerticalOrientation(),this.multi=!1,this.hideSelectionIndicator=!1}get options(){return this[t]?.items??[]}get selected(){return this[t]?.selectedItems??[]}get value(){const t=this.selected.filter(t=>!t.disabled).map(t=>t.value);switch(t.length){case 0:return null;case 1:return t[0];default:return t}}get[(ye=new WeakMap,$e=new WeakMap,be=new WeakSet,xe=t,w)](){const t=this.value;if(Array.isArray(t)){const e=new FormData;for(const i of t)e.append(this.name,i);return e}return t}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",S(this,ye,"f")),this.addEventListener("change",S(this,$e,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",S(this,ye,"f")),this.removeEventListener("change",S(this,$e,"f"))}update(e){super.update(e),e.has("disabled")&&(void 0!==e.get("disabled")||this.disabled)&&(this[t].disabled=this.disabled),e.has("multi")&&(this[t].multi=this.multi,this.multi?this.setAttribute("aria-multiselectable","true"):this.removeAttribute("aria-multiselectable"),this[t].items.forEach(t=>t.requestUpdate())),e.has("hideSelectionIndicator")&&this[t].items.forEach(t=>t.classList.toggle("-hide-selection",this.hideSelectionIndicator))}notifyItemsChange(){const{added:e}=this[t].setItems(this.items.filter(t=>t instanceof fe));e.forEach(t=>t.classList.toggle("-hide-selection",this.hideSelectionIndicator)),this[t].activeItem||this[t].updateActiveItem(e.find(t=>!t.disabled))}};_e=function(t){t.target!==this&&(t.stopImmediatePropagation(),t.stopPropagation(),this.dispatchEvent(new Event("change",{bubbles:!0})))},A([Q({type:Boolean})],we.prototype,"multi",void 0),A([Q({attribute:"hide-selection-indicator",type:Boolean})],we.prototype,"hideSelectionIndicator",void 0),we=A([C("m3e-selection-list")],we);export{At as M3eActionListElement,_t as M3eExpandableListItem,de as M3eListActionElement,ht as M3eListElement,ce as M3eListItemButtonElement,at as M3eListItemElement,fe as M3eListOptionElement,we as M3eSelectionListElement};
|
|
51
|
+
const ne=t=>t??Vt;var re,le;let de=class extends(h(at)){constructor(){super(...arguments),re.add(this),this.disabled=!1}render(){return o`<m3e-list-item-button class="button" ?disabled="${this.disabled}" href="${ne(this.href||void 0)}" target="${ne(this.target||void 0)}" download="${ne(this.download||void 0)}" rel="${ne(this.rel||void 0)}" @click="${S(this,re,"m",le)}"><slot name="leading" slot="leading" @slotchange="${this._handleLeadingSlotChange}"></slot><slot name="overline" slot="overline"></slot><slot></slot><slot name="supporting-text" slot="supporting-text"></slot><slot name="trailing" slot="trailing" @slotchange="${this._handleTrailingSlotChange}"></slot></m3e-list-item-button>`}};re=new WeakSet,le=function(e){e.defaultPrevented||this.closest("m3e-action-list")?.[t].updateActiveItem(this.button)},de.styles=n`:host { display: block; } .button { width: 100%; }`,A([X(".button")],de.prototype,"button",void 0),A([Q({type:Boolean,reflect:!0})],de.prototype,"disabled",void 0),de=A([C("m3e-list-action")],de);let ce=class extends(m(h(p(g(u(r(at,"button"),!0)))))){firstUpdated(t){super.firstUpdated(t),[this._focusRing,this._stateLayer,this._ripple].forEach(t=>t?.attach(this))}render(){return o`<m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><m3e-focus-ring class="focus-ring" inward ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple>${this[v]()} ${super.render()}`}};var he,me,pe,ge,ue,ve;ce.styles=[at.styles,n`:host { position: relative; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host(:not(:disabled)) { cursor: pointer; } a { all: unset; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1; } slot[name="trailing"] { align-self: var(--_list-item-button-trailing-align-self, auto); }`],A([X(".focus-ring")],ce.prototype,"_focusRing",void 0),A([X(".state-layer")],ce.prototype,"_stateLayer",void 0),A([X(".ripple")],ce.prototype,"_ripple",void 0),ce=A([C("m3e-list-item-button")],ce);let fe=class extends(m(p(f(g(u(r(at,"option"),!0)))))){constructor(){super(...arguments),he.add(this),me.set(this,void 0),pe.set(this,""),ge.set(this,t=>S(this,he,"m",ve).call(this,t))}get value(){return S(this,me,"f")??S(this,pe,"f")}set value(t){E(this,me,t,"f")}connectedCallback(){super.connectedCallback(),this.addEventListener("click",S(this,ge,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",S(this,ge,"f"))}firstUpdated(t){super.firstUpdated(t),[this._focusRing,this._stateLayer,this._ripple].forEach(t=>t?.attach(this))}update(e){if(super.update(e),e.has("selected")){this.closest("m3e-selection-list")?.[t].notifySelectionChange(this);for(const t of this.querySelectorAll("m3e-icon"))t.toggleAttribute("filled",this.selected)}}render(){return o`<m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer><m3e-focus-ring class="focus-ring" inward ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple><slot name="leading" @slotchange="${this._handleLeadingSlotChange}"></slot><div class="base"><slot name="overline"></slot><slot @slotchange="${S(this,he,"m",ue)}"></slot><slot name="supporting-text"></slot></div><slot name="trailing" @slotchange="${this._handleTrailingSlotChange}"></slot><div class="indicator">${this.closest("m3e-selection-list")?.multi?o`<m3e-pseudo-checkbox ?checked="${this.selected}" ?disabled="${this.disabled}"></m3e-pseudo-checkbox>`:o`<m3e-pseudo-radio ?checked="${this.selected}" ?disabled="${this.disabled}"></m3e-pseudo-radio>`}</div>`}};var be,ye,$e,_e,xe;me=new WeakMap,pe=new WeakMap,ge=new WeakMap,he=new WeakSet,ue=function(t){E(this,pe,b(t.target),"f")},ve=function(e){const i=this.closest("m3e-selection-list");if(!e.defaultPrevented&&i&&(i.multi||!this.selected)){const e=this.selected;this.selected=!this.selected,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))?(i[t].notifySelectionChange(this),this.dispatchEvent(new Event("change",{bubbles:!0}))):this.selected=e}},fe.styles=[at.styles,n`:host { position: relative; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .indicator { min-width: 1.5rem; min-height: 1.5rem; display: flex; align-items: center; justify-content: center; } :host(:not(:disabled)) { cursor: pointer; } :host(.-three-line) .indicator { align-self: flex-start; margin-top: var(--m3e-list-item-three-line-top-offset, 0.25rem); } :host([selected]), :host([selected]) .state-layer, :host([selected]) .ripple, :host([selected]) .focus-ring { border-radius: var(--m3e-list-item-selected-container-shape, ${d.shape.corner.large}); } :host([selected]:not(:disabled)) .base { color: var(--m3e-list-item-selected-label-text-color, ${d.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="overline"]) { color: var(--m3e-list-item-selected-overline-color, ${d.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="supporting-text"]) { color: var(--m3e-list-item-selected-supporting-text-color, ${d.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="leading"]) { color: var(--m3e-list-item-selected-leading-color, ${d.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) ::slotted([slot="trailing"]) { color: var(--m3e-list-item-selected-trailing-color, ${d.color.onSecondaryContainer}); } :host([selected]:not(:disabled)) { background-color: var(--m3e-list-item-selected-container-color, ${d.color.secondaryContainer}); } :host([selected]:disabled) { background-color: color-mix( in srgb, var(--m3e-list-item-selected-disabled-container-color, ${d.color.onSurface}) var(--m3e-list-item-selected-disabled-container-opacity, 10%), transparent ); } :host([selected]:not(:disabled)) .state-layer { --m3e-state-layer-hover-color: var( --m3e-list-item-selected-hover-state-layer-color, ${d.color.onSurface} ); --m3e-state-layer-hover-opacity: var( --m3e-list-item-selected-hover-state-layer-opacity, ${d.state.hoverStateLayerOpacity} ); --m3e-state-layer-focus-color: var( --m3e-list-item-selected-focus-state-layer-color, ${d.color.onSurface} ); --m3e-state-layer-focus-opacity: var( --m3e-list-item-selected-focus-state-layer-opacity, ${d.state.focusStateLayerOpacity} ); } :host([selected]:not(:disabled)) .ripple { --m3e-ripple-color: var(--m3e-list-item-selected-pressed-state-layer-color, ${d.color.onSurface}); --m3e-ripple-opacity: var( --m3e-list-item-selected-pressed-state-layer-opacity, ${d.state.pressedStateLayerOpacity} ); } :host(.-hide-selection) .indicator, :host(:not(.-hide-selection)) ::slotted([slot="trailing"]) { display: none; } @media (forced-colors: active) { :host([selected]:not(:disabled)) .base, :host([selected]:not(:disabled)) ::slotted([slot="overline"]), :host([selected]:not(:disabled)) ::slotted([slot="supporting-text"]), :host([selected]:not(:disabled)) ::slotted([slot="leading"]), :host([selected]:not(:disabled)) ::slotted([slot="trailing"]) { color: HighlightText; forced-color-adjust: none; } :host([selected]:not(:disabled)) { background-color: Highlight; } }`],A([X(".focus-ring")],fe.prototype,"_focusRing",void 0),A([X(".state-layer")],fe.prototype,"_stateLayer",void 0),A([X(".ripple")],fe.prototype,"_ripple",void 0),A([Q()],fe.prototype,"value",null),fe=A([C("m3e-list-option")],fe);let we=class extends(y($(_(x(g(u(r(ht,"listbox")))))))){constructor(){super(...arguments),be.add(this),ye.set(this,e=>this[t].onKeyDown(e)),$e.set(this,t=>S(this,be,"m",_e).call(this,t)),this[xe]=(new i).withWrap().withHomeAndEnd().withVerticalOrientation(),this.multi=!1,this.hideSelectionIndicator=!1}get options(){return this[t]?.items??[]}get selected(){return this[t]?.selectedItems??[]}get value(){const t=this.selected.filter(t=>!t.disabled).map(t=>t.value);switch(t.length){case 0:return null;case 1:return t[0];default:return t}}get[(ye=new WeakMap,$e=new WeakMap,be=new WeakSet,xe=t,w)](){const t=this.value;if(Array.isArray(t)){const e=new FormData;for(const i of t)e.append(this.name,i);return e}return t}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",S(this,ye,"f")),this.addEventListener("change",S(this,$e,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",S(this,ye,"f")),this.removeEventListener("change",S(this,$e,"f"))}update(e){super.update(e),e.has("disabled")&&(void 0!==e.get("disabled")||this.disabled)&&(this[t].disabled=this.disabled),e.has("multi")&&(this[t].multi=this.multi,this.multi?this.setAttribute("aria-multiselectable","true"):this.removeAttribute("aria-multiselectable"),this[t].items.forEach(t=>t.requestUpdate())),e.has("hideSelectionIndicator")&&this[t].items.forEach(t=>t.classList.toggle("-hide-selection",this.hideSelectionIndicator))}notifyItemsChange(){const{added:e}=this[t].setItems(this.items.filter(t=>t instanceof fe));e.forEach(t=>t.classList.toggle("-hide-selection",this.hideSelectionIndicator)),this[t].activeItem||this[t].updateActiveItem(e.find(t=>!t.disabled))}};_e=function(t){t.target!==this&&(t.stopImmediatePropagation(),t.stopPropagation(),this.dispatchEvent(new Event("change",{bubbles:!0})))},A([Q({type:Boolean})],we.prototype,"multi",void 0),A([Q({attribute:"hide-selection-indicator",type:Boolean})],we.prototype,"hideSelectionIndicator",void 0),we=A([C("m3e-selection-list")],we);export{At as M3eActionListElement,_t as M3eExpandableListItem,de as M3eListActionElement,ht as M3eListElement,ce as M3eListItemButtonElement,at as M3eListItemElement,fe as M3eListOptionElement,we as M3eSelectionListElement};
|
|
52
52
|
//# sourceMappingURL=index.min.js.map
|